Commit d2c7d2a3 by tangzhaoqian
parents b021f24d 199b578f
package cn.timer.api.bean.kqmk;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
/**
* @author lal 2020-06-22
*/
@Data
@Builder
@Table(name = "kqgl_asso_leave_employee_balance")
@ApiModel("员工假期余额表")
public class KqglAssoLeaveEmployeeBalance extends Model<KqglAssoLeaveEmployeeBalance> {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "id id", example = "101")
private Integer id;
@ApiModelProperty(value = "假期规则id 假期规则id", example = "101")
private Integer leaveRulesId;
@ApiModelProperty(value = "员工id 员工id", example = "101")
private Integer userid;
@ApiModelProperty(value = "余额天数 ", example = "余额天数")
private double balanceDays;
@ApiModelProperty(value = "最后修改人 最后修改人", example = "101")
private Integer modifyUserid;
@ApiModelProperty(value = "最后修改时间 ", example = "最后修改时间")
private String modifyTimer;
@ApiModelProperty(value = "企业组织代码 企业组织代码", example = "101")
private Integer orgCode;
}
\ No newline at end of file
package cn.timer.api.bean.kqmk;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
/**
* @author Tang 2020-06-23
*/
@Data
@Builder
@Table(name = "kqgl_asso_leave_rules_t")
@ApiModel("假期规则")
public class KqglAssoLeaveRulesT extends Model<KqglAssoLeaveRulesT> {
/**
*
*/
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue
@TableId(type = IdType.AUTO)
@ApiModelProperty(value = "假期规则编号 假期规则编号", example = "101")
private Integer id;
@ApiModelProperty(value = "假期名称 ", example = "假期名称")
private String name;
@ApiModelProperty(value = "请假单位 1:按天请假;2:按半天;3:按小时", example = "101")
private Integer company;
@ApiModelProperty(value = "假期类型 1:系统项;2:自定义项", example = "101")
private Integer leaveType;
@ApiModelProperty(value = "适用范围 0:全公司 >0:考勤组id", example = "101")
private Integer apply;
@ApiModelProperty(value = "是否开启 0:否;1:是 [只针对系统项]", example = "101")
private Integer isOpen;
@ApiModelProperty(value = "假期余额 0:关(该项余额为“不限余额”);1:开(该项余额为“0”)", example = "101")
private Integer leaveBalance;
@ApiModelProperty(value = "1:事假;2:调休;3:病假;4:年假;5:产假;6:陪产假;7:婚假;8:例假;9:丧假;10:哺乳假 1:事假;2:调休;3:病假;4:年假;5:产假;6:陪产假;7:婚假;8:例假;9:丧假;10:哺乳假", example = "101")
private Integer rulesType;
}
\ No newline at end of file
......@@ -58,6 +58,9 @@ public class QyzxEntInfoM extends Model<QyzxEntInfoM> {
@ApiModelProperty(value = "电话号码 ", example = "18712345678")
private String phone;
@ApiModelProperty(value = "邮编 ", example = "110000")
private String zipCode;
@ApiModelProperty(value = "所在地区id", example = "广东省广州市白云区")
private String area;
......
package cn.timer.api.controller;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -33,7 +34,9 @@ import cn.hutool.core.util.StrUtil;
import cn.timer.api.aspect.lang.annotation.Log;
import cn.timer.api.aspect.lang.enums.BusinessType;
import cn.timer.api.bean.jxgl.JxglBasicSetting;
import cn.timer.api.bean.kqmk.KqglAssoLeaveEmployeeBalance;
import cn.timer.api.bean.kqmk.KqglAssoLeaveRules;
import cn.timer.api.bean.kqmk.KqglAssoLeaveRulesT;
import cn.timer.api.bean.qyxx.CmsContent;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.bean.qyzx.QyzxEmpLogin;
......@@ -561,15 +564,17 @@ public class LoginController {
// *****************************考勤假期初始化
// 获取模板数据
List<KqglAssoLeaveRules> ruless = new LambdaQueryChainWrapper<KqglAssoLeaveRules>(kqglassoleaverulesmapper)
.eq(KqglAssoLeaveRules::getOrgCode, 0).list();
// List<KqglAssoLeaveRules> ruless = new LambdaQueryChainWrapper<KqglAssoLeaveRules>(kqglassoleaverulesmapper)
// .eq(KqglAssoLeaveRules::getOrgCode, 0).list();
List<KqglAssoLeaveRulesT> ruless = KqglAssoLeaveRulesT.builder().build().selectAll();
// 查询当前公司是否已初始化
KqglAssoLeaveRules rule = kqglassoleaverulesmapper.selectOne(new QueryWrapper<KqglAssoLeaveRules>().lambda()
.eq(KqglAssoLeaveRules::getOrgCode, qyzxEntInfoM.getId()).eq(KqglAssoLeaveRules::getLeaveType, 1)
.last("LIMIT 1"));
if (rule == null) {
List<KqglAssoLeaveRules> rullist = new ArrayList<KqglAssoLeaveRules>();
for (KqglAssoLeaveRules rul : ruless) {
for (KqglAssoLeaveRulesT rul : ruless) {
KqglAssoLeaveRules vice = KqglAssoLeaveRules.builder().name(rul.getName()).company(rul.getCompany())
.leaveType(rul.getLeaveType()).apply(rul.getApply()).createTime(new Date().getTime())
.createUserid(999).orgCode(qyzxEntInfoM.getId()).isOpen(rul.getIsOpen())
......@@ -584,6 +589,20 @@ public class LoginController {
System.out.println("重复初始化数据!");
}
//假期规则初始化
String current_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
List<KqglAssoLeaveRules> rul = KqglAssoLeaveRules.builder().build().selectList(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getOrgCode, qyId));
for(KqglAssoLeaveRules r : rul) {
if(r.getLeaveBalance() == 0) {
KqglAssoLeaveEmployeeBalance.builder().leaveRulesId(r.getId()).userid(login.getId()).balanceDays(-1).modifyUserid(login.getId()).modifyTimer(current_time).orgCode(qyId).build().insert();
}else {
KqglAssoLeaveEmployeeBalance.builder().leaveRulesId(r.getId()).userid(login.getId()).balanceDays(0.0).modifyUserid(login.getId()).modifyTimer(current_time).orgCode(qyId).build().insert();
}
}
// 绩效设置初始化
JxglBasicSetting bS = jxglService.selectAT(qyId);
if (bS == null) {
......
......@@ -4,7 +4,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
......@@ -24,7 +23,9 @@ import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
......@@ -446,7 +447,7 @@ public class CrmController {
}
List<Integer> addList = CheckUtil.reduce(newIdsList, oldIdsList); // 要加的协助人
for (Integer id : addList) {
CrmClientAssociate.builder().cid(cid).associateId(id).build().insert();
CrmClientAssociate.builder().cid(cid).associateId(id).orgCode(getOrgCode(userBean)).build().insert();
}
crmClientData.setModifyUser(getEmpNum(userBean));
if (crmClientData.updateById())
......@@ -532,12 +533,20 @@ public class CrmController {
.collect(Collectors.toList());
}
private <T> List<T> getPageList(List<T> list, int pageNumber, int pageSize, Comparator<T> comparator) {
return list.stream().sorted(comparator).skip((pageNumber - 1) * pageSize).limit(pageSize)
.collect(Collectors.toList());
}
@GetMapping("getMyCilentTotal")
@ApiOperation(value = "获取我的客户列表(全)", httpMethod = "GET", notes = "接口发布说明")
public Result<List<CrmClientData>> getMyCilentTotal(@CurrentUser UserBean userBean,
@RequestParam(required = false, defaultValue = "0") Integer type,
@RequestParam(required = false) Integer groupId, @RequestParam(required = false) Integer status,
@RequestParam(required = false) String like) {
@RequestParam(required = false) String like,
@RequestParam(required = false, defaultValue = "1") int pageNumber,
@RequestParam(required = false, defaultValue = "10") int pageSize) {
Integer empNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean);
List<CrmClientData> crmClientDatas = null;
......@@ -556,8 +565,16 @@ public class CrmController {
crmClientDatas = getCilentFollowOvertime(empNum, orgCode, groupId, status);
else
return ResultUtil.error("查询失败");
Collections.sort(crmClientDatas, Comparator.comparing(CrmClientData::getCreateTime).reversed()); // 按时间降序排序
return ResultUtil.data(crmClientDatas, "查询成功");
// Collections.sort(crmClientDatas, Comparator.comparing(CrmClientData::getCreateTime).reversed()); // 按时间降序排序
// int pageNumber = 1;
// int pageSize = 10;
List<CrmClientData> result = getPageList(crmClientDatas, pageNumber, pageSize,
Comparator.comparing(CrmClientData::getCreateTime).reversed());
return ResultUtil.pageData(result, (long) crmClientDatas.size(), "查询成功");
// return ResultUtil.data(crmClientDatas, "查询成功");
}
private List<Integer> MyJoinGroup(Integer empNum, Integer orgCode) {
......@@ -579,7 +596,9 @@ public class CrmController {
@ApiOperation(value = "获取公海客户列表(全)", httpMethod = "GET", notes = "接口发布说明")
public Result<List<CrmClientData>> getSeaCilentTotal(@CurrentUser UserBean userBean,
@RequestParam(required = false) Integer type, @RequestParam(required = false) Integer groupId,
@RequestParam(required = false) Integer status, @RequestParam(required = false) String like) {
@RequestParam(required = false) Integer status, @RequestParam(required = false) String like,
@RequestParam(required = false, defaultValue = "1") int pageNumber,
@RequestParam(required = false, defaultValue = "10") int pageSize) {
Integer empNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean);
......@@ -603,7 +622,14 @@ public class CrmController {
.like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
.like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like));
return ResultUtil.data(list, "查询成功");
// int pageNumber = 1;
// int pageSize = 5;
List<CrmClientData> result = getPageList(list, pageNumber, pageSize,
Comparator.comparing(CrmClientData::getCreateTime).reversed());
return ResultUtil.pageData(result, (long) list.size(), "查询成功");
// return ResultUtil.data(list, "查询成功");
} else {
......@@ -625,7 +651,11 @@ public class CrmController {
for (CrmClientData data : datas)
crmClientDatas.add(data);
}
return ResultUtil.data(crmClientDatas, "查询成功");
List<CrmClientData> result = getPageList(crmClientDatas, pageNumber, pageSize,
Comparator.comparing(CrmClientData::getCreateTime).reversed());
return ResultUtil.pageData(result, (long) crmClientDatas.size(), "查询成功");
// return ResultUtil.data(crmClientDatas, "查询成功");
}
}
......@@ -637,7 +667,9 @@ public class CrmController {
@RequestParam(required = false) String startCreateTime,
@RequestParam(required = false) String endCreateTime,
@RequestParam(required = false) String startFollowTime,
@RequestParam(required = false) String endFollowTime) {
@RequestParam(required = false) String endFollowTime,
@RequestParam(required = false, defaultValue = "1") int pageNumber,
@RequestParam(required = false, defaultValue = "10") int pageSize) {
Integer empNum = getEmpNum(userBean);
Integer orgCode = getOrgCode(userBean);
......@@ -653,8 +685,10 @@ public class CrmController {
&& (qyzxEmpEntAsso.getUserType() == SysRoleType.U_TYPE_ADMIN.getType()
|| qyzxEmpEntAsso.getUserType() == SysRoleType.U_TYPE_C_ADMIN.getType())) {
List<CrmClientData> datas = CrmClientData.builder().build()
.selectList(new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
IPage<CrmClientData> page = new Page<CrmClientData>(pageNumber, pageSize);
IPage<CrmClientData> datas = CrmClientData.builder().build().selectPage(page,
new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
.eq(type != null && type >= 0, CrmClientData::getClientType, type)
.eq(status != null && status >= 0, CrmClientData::getClientStatus, status)
......@@ -663,13 +697,15 @@ public class CrmController {
.ge(StringUtils.isNotBlank(startFollowTime), CrmClientData::getCreateTime, startFollowTime)
.le(StringUtils.isNotBlank(endFollowTime), CrmClientData::getCreateTime, endFollowTime)
.like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
.like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like));
return ResultUtil.data(datas, "查询成功");
.like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like)
.orderByDesc(CrmClientData::getCreateTime));
return ResultUtil.pageData(datas.getRecords(), datas.getTotal(), "查询成功");
} else {
// 当前用户管理的组
List<Integer> gids = MyManageGroup(empNum, orgCode);
List<Object> crmClientDatas = new ArrayList<Object>();
List<CrmClientData> crmClientDatas = new ArrayList<CrmClientData>();
for (Integer gid : gids) {
List<CrmClientData> datas = CrmClientData.builder().build().selectList(new QueryWrapper<CrmClientData>()
.lambda().eq(CrmClientData::getBelongGroup, gid)
......@@ -685,7 +721,12 @@ public class CrmController {
for (CrmClientData data : datas)
crmClientDatas.add(data);
}
return ResultUtil.data(crmClientDatas, "查询成功");
List<CrmClientData> result = getPageList(crmClientDatas, pageNumber, pageSize,
Comparator.comparing(CrmClientData::getCreateTime).reversed());
return ResultUtil.pageData(result, (long) crmClientDatas.size(), "查询成功");
// return ResultUtil.data(crmClientDatas, "查询成功");
}
}
......
......@@ -24,6 +24,39 @@ public class ClockInTool {
static SimpleDateFormat famt = new SimpleDateFormat("yyyy-MM-dd");
/**
* 判断某个字符串是否存在于数组中
* @param stringArray 原数组
* @param source 查找的字符串
* @return 是否找到
*/
public static boolean contains(String[] stringArray, String source) {
// 转换为list
List<String> tempList = Arrays.asList(stringArray);
// 利用list的包含方法,进行判断
if(tempList.contains(source))
{
return true;
} else {
return false;
}
}
/**
* @param ss
* @return 去除重复
*/
public static String[] duplicate_removal(String[] ss) {
List<String> list =new ArrayList<String>();
for(String s:ss){
if(!list.contains(s)) //或者list.indexOf(s)!=-1
list.add(s);
}
return list.toArray(new String[list.size()]);
}
/**
* 将String时间转换为时间戳
*
* @param time
......
......@@ -52,6 +52,7 @@ import cn.timer.api.bean.kqmk.KqglAssoDkwx;
import cn.timer.api.bean.kqmk.KqglAssoKqj;
import cn.timer.api.bean.kqmk.KqglAssoKqzdkfs;
import cn.timer.api.bean.kqmk.KqglAssoLeaveBalance;
import cn.timer.api.bean.kqmk.KqglAssoLeaveEmployeeBalance;
import cn.timer.api.bean.kqmk.KqglAssoLeaveRules;
import cn.timer.api.bean.kqmk.KqglAssoMonthPunchSummary;
import cn.timer.api.bean.kqmk.KqglAssoOvertimeBasics;
......@@ -82,6 +83,7 @@ import cn.timer.api.dao.kqmk.KqglAssoDkwxMapper;
import cn.timer.api.dao.kqmk.KqglAssoKqjMapper;
import cn.timer.api.dao.kqmk.KqglAssoKqzdkfsMapper;
import cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper;
import cn.timer.api.dao.kqmk.KqglAssoLeaveEmployeeBalanceMapper;
import cn.timer.api.dao.kqmk.KqglAssoLeaveRulesMapper;
import cn.timer.api.dao.kqmk.KqglAssoMonthPunchSummaryMapper;
import cn.timer.api.dao.kqmk.KqglAssoOvertimeRangeMapper;
......@@ -102,6 +104,7 @@ import cn.timer.api.dto.kqmk.AttendanceAssistantDto;
import cn.timer.api.dto.kqmk.AttendanceCardListDto;
import cn.timer.api.dto.kqmk.AttendanceSummaryQueryDto;
import cn.timer.api.dto.kqmk.AttqueryCriteriaDto;
import cn.timer.api.dto.kqmk.BalanceSheetDataDto;
import cn.timer.api.dto.kqmk.CalendarDetailsDto;
import cn.timer.api.dto.kqmk.CalendarPunchDetailsDto;
import cn.timer.api.dto.kqmk.CalendarTableDataDto;
......@@ -468,6 +471,9 @@ public class TimeCardController {
@Autowired
private KqglAssoRulesViceMapper kqglassorulesvicemapper;
@Autowired
private KqglAssoLeaveEmployeeBalanceMapper kqglassoleaveemployeebalancemapper;
/**
* 新增/修改--假期规则
*/
......@@ -475,6 +481,8 @@ public class TimeCardController {
@ApiOperation(value = "12:新增/修改--假期规则", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 12)
public Result<Object> LeaveRules(@CurrentUser UserBean userBean,@RequestBody KqglAssoLeaveRulesDto leaverules) {
String current_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
leaverules.setCreateTime(new Date().getTime());
leaverules.setOrgCode(userBean.getOrgCode());
leaverules.setCreateUserid(userBean.getEmpNum());
......@@ -487,21 +495,21 @@ public class TimeCardController {
Integer id = learul.getId();
Console.log("新增/修改--假期规则id: " + id);
KqglAssoLeaveBalance.builder().build().delete(new QueryWrapper<KqglAssoLeaveBalance>().lambda().eq(KqglAssoLeaveBalance::getLeaveRulesId, id)
.eq(KqglAssoLeaveBalance :: getOrgCode, userBean.getOrgCode()));
KqglAssoLeaveEmployeeBalance.builder().build().delete(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getLeaveRulesId, id)
.eq(KqglAssoLeaveEmployeeBalance :: getOrgCode, userBean.getOrgCode()));
List<YgglMainEmp> yggl = YgglMainEmp.builder().build().selectList(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, userBean.getOrgCode()));
if(leaverules.getLeaveBalance() == 1) {//假期余额 0:关(该项余额为“不限余额”);1:开(该项余额为“0”)
//该项公司员工余额为“0”
for(YgglMainEmp ye:yggl) {
KqglAssoLeaveBalance.builder().leaveRulesId(id).userid(ye.getEmpNum()).modifyAction(1).balanceDays("+0")
.reason("系统按照规则自动").modifyUserid(userBean.getEmpNum()).modifyTimer(new Date().getTime()).orgCode(userBean.getOrgCode()).isAutomatic(1).modifyNumber(1).build().insert();//员工假期余额
KqglAssoLeaveEmployeeBalance.builder().leaveRulesId(id).userid(ye.getEmpNum()).balanceDays(0.0).modifyUserid(userBean.getEmpNum()).modifyTimer(current_time).orgCode(userBean.getOrgCode()).build().insert();
}
}else {
for(YgglMainEmp ye:yggl) {
KqglAssoLeaveBalance.builder().leaveRulesId(id).userid(ye.getEmpNum()).modifyAction(1).balanceDays("-1")
.reason("不限制余额").modifyUserid(userBean.getEmpNum()).modifyTimer(new Date().getTime()).orgCode(userBean.getOrgCode()).isAutomatic(1).modifyNumber(1).build().insert();//员工假期余额
KqglAssoLeaveEmployeeBalance.builder().leaveRulesId(id).userid(ye.getEmpNum()).balanceDays(-1).modifyUserid(userBean.getEmpNum()).modifyTimer(current_time).orgCode(userBean.getOrgCode()).build().insert();
}
}
List<KqglAssoRulesVice> vices = new ArrayList<KqglAssoRulesVice>();
String[] rest = leaverules.getRange();
if(rest.length == 0) {
......@@ -858,6 +866,15 @@ public class TimeCardController {
balance.setModifyUserid(userBean.getEmpNum());
balance.setModifyTimer(new Date().getTime());
balance.setOrgCode(userBean.getOrgCode());
String balanceDays = "0";
if(balance.getModifyAction() == 1) {//增加
balanceDays = "+" + balance.getBalanceDays();
}else {
balanceDays = "-" + balance.getBalanceDays();
}
balance.setBalanceDays(balanceDays);
KqglAssoLeaveBalance balan = kqglassoleavebalancemapper.selectOne(new QueryWrapper<KqglAssoLeaveBalance>().lambda().eq(KqglAssoLeaveBalance::getUserid, balance.getUserid())
.orderByDesc(KqglAssoLeaveBalance :: getModifyNumber).last("LIMIT 1"));
if(balan != null) {
......@@ -865,16 +882,45 @@ public class TimeCardController {
}else {
balance.setModifyNumber(1);
}
return balance.insert() ? ResultUtil.success("操作成功!") : ResultUtil.error("操作失败!");
//添加成功
if(balance.insert()) {
//查询员工假期余额表中所对应的假期id
KqglAssoLeaveEmployeeBalance emba = KqglAssoLeaveEmployeeBalance.builder().build().selectOne(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getLeaveRulesId, balance.getLeaveRulesId())
.eq(KqglAssoLeaveEmployeeBalance::getUserid, balance.getUserid()).eq(KqglAssoLeaveEmployeeBalance::getOrgCode, userBean.getOrgCode()));
//获取最后得到的最终余额
double balance_days = kqglassoleavebalancemapper.Sumbalancedays(balance.getUserid(), userBean.getOrgCode(),balance.getLeaveRulesId());
if(emba != null && balance_days > 0) {
if(emba.getBalanceDays() != -1) {//确认为限制余额的
//修改最终的余额数
KqglAssoLeaveEmployeeBalance.builder().id(emba.getId()).balanceDays(balance_days).build().updateById();
}
}
}
return ResultUtil.success("操作成功!") ;
// return balance.insert() ? ResultUtil.success("操作成功!") : ResultUtil.error("操作失败!");
}
/**
* 根据考勤余额id获取信息
* 根据考勤余额id获取信息 ||大于“0”为有数字限制 ||为“-1”时为无数字限制
*/
@GetMapping(value="/hqleavebalance/{id}")
@ApiOperation(value = "根据考勤余额id获取信息", httpMethod = "GET", notes = "接口发布说明")
public Result<Object> hqleavebalance(@PathVariable("id") Integer id,@CurrentUser UserBean userBean) {
JiaqibalanceDto leanemp = kqglassoleavebalancemapper.selectleavebalanceList(id,userBean.getEmpNum());
// JiaqibalanceDto leanemp = kqglassoleavebalancemapper.selectleavebalanceList(id,userBean.getEmpNum());
JiaqibalanceDto leanemp = JiaqibalanceDto.builder().build();
KqglAssoLeaveEmployeeBalance emba = KqglAssoLeaveEmployeeBalance.builder().build().selectOne(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getUserid, userBean.getEmpNum())
.eq(KqglAssoLeaveEmployeeBalance::getLeaveRulesId, id).eq(KqglAssoLeaveEmployeeBalance::getOrgCode, userBean.getOrgCode()));
if(emba != null) {
leanemp.setBalancedays(String.valueOf(emba.getBalanceDays()));
}
return ResultUtil.data(leanemp, "操作成功!");
}
......@@ -906,11 +952,20 @@ public class TimeCardController {
if(yhd != null) {
//获取假期适用全公司的
String company = "";
List<KqglAssoLeaveRules> whole = kqglassoleaverulesmapper.selCompanywidedata(userBean.getOrgCode(), 2, 1);
for(KqglAssoLeaveRules rul : whole) {
LeaveTypeDto lea = LeaveTypeDto.builder().build();
lea.setId(rul.getId());
lea.setValue(rul.getName());
if(rul.getCompany() == 1) {
company = "天";
}else if(rul.getCompany() == 2) {
company = "半天";
}else {
company = "小时";
}
lea.setCompany(company);
leas.add(lea);
}
......@@ -919,6 +974,14 @@ public class TimeCardController {
LeaveTypeDto lea = LeaveTypeDto.builder().build();
lea.setId(rul1.getId());
lea.setValue(rul1.getName());
if(rul1.getCompany() == 1) {
company = "天";
}else if(rul1.getCompany() == 2) {
company = "半天";
}else {
company = "小时";
}
lea.setCompany(company);
leas.add(lea);
}
}
......@@ -2075,15 +2138,35 @@ public class TimeCardController {
@ApiOperation(value = "45:获取假期余额列表数据", httpMethod = "POST", notes = "接口发布说明")
@ApiOperationSupport(order = 45)
public Result<Object> LeaveBalanceList(@CurrentUser UserBean userBean, @Validated @RequestBody AttqueryCriteriaDto attquerycriteriadto) {
IPage<EmployeeLeaveBalanceDto> page = new Page<EmployeeLeaveBalanceDto>(
attquerycriteriadto.getCurrentPage() == null ? 1 : attquerycriteriadto.getCurrentPage(),
attquerycriteriadto.getTotalPage() == 10 ? 9999 : attquerycriteriadto.getTotalPage());
IPage<EmployeeLeaveBalanceDto> page = new Page<EmployeeLeaveBalanceDto>(attquerycriteriadto.getCurrentPage(),attquerycriteriadto.getTotalPage());
attquerycriteriadto.setOrgCode(userBean.getOrgCode());
attquerycriteriadto.setEmpNum(userBean.getEmpNum());
// 缺-部门id 搜索
IPage<EmployeeLeaveBalanceDto> pageAs = kqglassoleavebalancemapper.selectPageByQueryLeaveBalance(page, attquerycriteriadto);
List<EmployeeLeaveBalanceDto> listAs = pageAs.getRecords();
return ResultUtil.data(pageAs, listAs, "操作成功!");
List<EmployeeLeaveBalanceDto> sumlist = new ArrayList<EmployeeLeaveBalanceDto>();
for(EmployeeLeaveBalanceDto endo : listAs) {
EmployeeLeaveBalanceDto dets = EmployeeLeaveBalanceDto.builder().build();
BeanUtil.copyProperties(endo, dets , "balanceTo");
List<KqglAssoLeaveEmployeeBalance> empye = KqglAssoLeaveEmployeeBalance.builder().build().selectList(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getUserid, endo.getEmpnum())
.eq(KqglAssoLeaveEmployeeBalance::getOrgCode, endo.getOrgcode()));
List<BalanceSheetDataDto> balanceTo = new ArrayList<BalanceSheetDataDto>();
for(KqglAssoLeaveEmployeeBalance empyes : empye) {
BalanceSheetDataDto bal = BalanceSheetDataDto.builder().build();
bal.setBalancedays(empyes.getBalanceDays());
bal.setLeaverulesid(empyes.getLeaveRulesId());
balanceTo.add(bal);
}
dets.setBalanceTo(balanceTo);
sumlist.add(dets);
}
return ResultUtil.data(pageAs, sumlist, "操作成功!");
}
......@@ -2137,9 +2220,7 @@ public class TimeCardController {
@ApiOperation(value = "获取考勤报表汇总数据", httpMethod = "POST", notes = "接口发布说明")
public Result<Object> SummarydataList(@CurrentUser UserBean userBean, @Validated @RequestBody AttendanceSummaryQueryDto attesummqueto) throws ParseException {
IPage<KqglAssoMonthPunchSummaryDto> page = new Page<KqglAssoMonthPunchSummaryDto>(
attesummqueto.getCurrentPage() == null ? 1 : attesummqueto.getCurrentPage(),
attesummqueto.getTotalPage() == null ? 10 : attesummqueto.getTotalPage());
IPage<KqglAssoMonthPunchSummaryDto> page = new Page<KqglAssoMonthPunchSummaryDto>( attesummqueto.getCurrentPage(),attesummqueto.getTotalPage());
attesummqueto.setOrgCode(userBean.getOrgCode());
String year = null,month = null;
......@@ -2147,29 +2228,89 @@ public class TimeCardController {
if(attesummqueto.getTimes() != null && !("").equals(attesummqueto.getTimes())) {
year = attesummqueto.getTimes().substring(0, 4);
month = attesummqueto.getTimes().substring(5, 7);
staapptime = ClockInTool.getFirstDayOfMonth1(Integer.valueOf(year),Integer.valueOf(month));
endapptime = ClockInTool.getLastDayOfMonth1(Integer.valueOf(year),Integer.valueOf(month));
// staapptime = ClockInTool.getFirstDayOfMonth1(Integer.valueOf(year),Integer.valueOf(month));
// endapptime = ClockInTool.getLastDayOfMonth1(Integer.valueOf(year),Integer.valueOf(month));
String time = attesummqueto.getTimes()+"-01";
String sdaet = ClockInTool.getMinMonthDate(time);
staapptime = String.valueOf(ClockInTool.getStartTime(0,ClockInTool.getStringTime(sdaet,"yyyy-MM-dd")).getTime());
String edate = ClockInTool.getMaxMonthDate(time);
endapptime = String.valueOf(ClockInTool.getnowEndTime(23,ClockInTool.getStringTime(edate,"yyyy-MM-dd")).getTime());
}else {
year = new SimpleDateFormat("yyyy").format(new Date()).toString();
month = new SimpleDateFormat("MM").format(new Date()).toString();
// Calendar c = Calendar.getInstance();
// c.add(Calendar.MONTH, 0);
// c.set(Calendar.DAY_OF_MONTH,1);
// staapptime = DateUtil.getStringFormat(DateUtil.getStringTime(mat.format(c.getTime()),"yyyy-MM-dd"));
// Calendar ca = Calendar.getInstance();
// ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
// endapptime = DateUtil.getStringFormat(DateUtil.getStringTime(mat.format(ca.getTime()),"yyyy-MM-dd"));
Calendar c = Calendar.getInstance();
c.add(Calendar.MONTH, 0);
c.set(Calendar.DAY_OF_MONTH,1);
staapptime = DateUtil.getStringFormat(DateUtil.getStringTime(mat.format(c.getTime()),"yyyy-MM-dd"));
c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天
String first = mat.format(c.getTime());
staapptime = String.valueOf(DateUtil.getStartTime(0,DateUtil.getStringTime(first,"yyyy-MM-dd")).getTime());
//获取当前月最后一天
Calendar ca = Calendar.getInstance();
ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
endapptime = DateUtil.getStringFormat(DateUtil.getStringTime(mat.format(ca.getTime()),"yyyy-MM-dd"));
String last = mat.format(ca.getTime());
endapptime = String.valueOf(DateUtil.getnowEndTime(23,DateUtil.getStringTime(last,"yyyy-MM-dd")).getTime());
}
attesummqueto.setYear(year);
attesummqueto.setMonth(month);
attesummqueto.setStaapptime(staapptime);
attesummqueto.setEndapptime(endapptime);
// 缺-部门id 搜索
IPage<KqglAssoMonthPunchSummaryDto> pageAs = kqglassomonthpunchsummarymapper.AttendanceSummaryData(page, attesummqueto);
// List<BalanceSheetDataDto> balanceTo = new ArrayList<BalanceSheetDataDto>();
// int num = 0;
// int nums = 0;
//
// List<KqglAssoLeaveRules> rul = KqglAssoLeaveRules.builder().build().selectList(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getOrgCode, userBean.getOrgCode()));
// if(rul.size() > 0) {
// num = rul.size();
// }
//
// List<KqglAssoMonthPunchSummary> pusu = KqglAssoMonthPunchSummary.builder().build().selectList(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda().eq(KqglAssoMonthPunchSummary::getOrgCode, userBean.getOrgCode())
// .eq(KqglAssoMonthPunchSummary::getBelongYear, year).eq(KqglAssoMonthPunchSummary::getBelongMonth, month));
// if(pusu.size() > 0) {
// nums = pusu.size();
// }
List<KqglAssoMonthPunchSummaryDto> listAs = pageAs.getRecords();
return ResultUtil.data(pageAs, listAs, "操作成功!");
List<KqglAssoMonthPunchSummaryDto> sumlist = new ArrayList<KqglAssoMonthPunchSummaryDto>();
for(KqglAssoMonthPunchSummaryDto endo : listAs) {
KqglAssoMonthPunchSummaryDto dets = KqglAssoMonthPunchSummaryDto.builder().build();
BeanUtil.copyProperties(endo, dets , "balanceTo");
List<KqglAssoLeaveEmployeeBalance> empye = KqglAssoLeaveEmployeeBalance.builder().build().selectList(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getUserid, endo.getNum())
.eq(KqglAssoLeaveEmployeeBalance::getOrgCode, endo.getOrgCode()));
List<BalanceSheetDataDto> balanceTo = new ArrayList<BalanceSheetDataDto>();
for(KqglAssoLeaveEmployeeBalance empyes : empye) {
BalanceSheetDataDto bal = BalanceSheetDataDto.builder().build();
bal.setBalancedays(empyes.getBalanceDays());
bal.setLeaverulesid(empyes.getLeaveRulesId());
balanceTo.add(bal);
}
dets.setBalanceTo(balanceTo);
sumlist.add(dets);
}
// return ResultUtil.attdata(pageAs, listAs, "操作成功!",num,nums);
return ResultUtil.data(pageAs, sumlist, "操作成功!");
}
@PostMapping(value = "/Daily_details")
......@@ -2198,9 +2339,32 @@ public class TimeCardController {
attesummqueto.setTimes(time);
// 缺-部门id 搜索
IPage<DailyDetailsDto> pageAs = kqglassomonthpunchsummarymapper.Dailydetails(page, attesummqueto);
List<DailyDetailsDto> listAs = pageAs.getRecords();
return ResultUtil.data(pageAs, listAs, "操作成功!");
List<DailyDetailsDto> sumlist = new ArrayList<DailyDetailsDto>();
//多条
for(DailyDetailsDto endo : listAs) {
DailyDetailsDto dets = DailyDetailsDto.builder().build();
BeanUtil.copyProperties(endo, dets , "balanceTo");
List<KqglAssoLeaveEmployeeBalance> empye = KqglAssoLeaveEmployeeBalance.builder().build().selectList(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getUserid, endo.getNum())
.eq(KqglAssoLeaveEmployeeBalance::getOrgCode, endo.getOrgcode()));
List<BalanceSheetDataDto> balanceTo = new ArrayList<BalanceSheetDataDto>();
for(KqglAssoLeaveEmployeeBalance empyes : empye) {
BalanceSheetDataDto bal = BalanceSheetDataDto.builder().build();
bal.setBalancedays(empyes.getBalanceDays());
bal.setLeaverulesid(empyes.getLeaveRulesId());
balanceTo.add(bal);
}
dets.setBalanceTo(balanceTo);
sumlist.add(dets);
}
return ResultUtil.data(pageAs, sumlist, "操作成功!");
}
......
......@@ -30,7 +30,6 @@ import cn.timer.api.bean.kqmk.KqglAssoRelationSummary;
import cn.timer.api.bean.kqmk.KqglAssoTeshu;
import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban;
import cn.timer.api.bean.kqmk.KqglMainKqz;
import cn.timer.api.bean.qyzx.QyzxEntInfoM;
import cn.timer.api.controller.kqgl.ClockInTool;
import cn.timer.api.dao.kqgl.AttendanceWeeklySchMapper;
import cn.timer.api.dao.kqgl.PunchCardDetailsMapper;
......@@ -105,7 +104,7 @@ public class AttendanceTaskTiming{
*/
//3.添加定时任务 每天下午七点执行一次
@Scheduled(cron = "0 50 8 * * ?")
@Scheduled(cron = "0 0 19 * * ?")
//或直接指定时间间隔,例如:5秒
//@Scheduled(fixedRate=5000)
......@@ -142,7 +141,7 @@ public class AttendanceTaskTiming{
ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
Long endDate = DateUtil.getnowEndTime(23,DateUtil.getStringTime(sdf1.format(ca.getTime()),"yyyy-MM-dd")).getTime();
List<QyzxEntInfoM> orgcodelist = qyzxentinfommapper.selectList(new QueryWrapper<QyzxEntInfoM>());//系统中的所有公司 所有未到期的公司
// List<QyzxEntInfoM> orgcodelist = qyzxentinfommapper.selectList(new QueryWrapper<QyzxEntInfoM>());//系统中的所有公司 所有未到期的公司
String str = new SimpleDateFormat("yyyy-MM-dd").format(new Date()).toString();//
String ttstr = new SimpleDateFormat("yyyy-MM").format(new Date()).toString();//
......@@ -154,8 +153,8 @@ public class AttendanceTaskTiming{
KqglAssoMonthPunchSummary.builder().build().delete(new QueryWrapper<KqglAssoMonthPunchSummary>().lambda().eq(KqglAssoMonthPunchSummary::getBelongYear, year).eq(KqglAssoMonthPunchSummary::getBelongMonth, month));
for(int t = 0;t<orgcodelist.size();t++){
int org_code = orgcodelist.get(t).getId();//企业组织代码
// for(int t = 0;t<orgcodelist.size();t++){
int org_code = 117;//orgcodelist.get(t).getId();//企业组织代码
List<AdditionalDto> userlist = kqglassoleavebalancemapper.selectAdditionalList(org_code);
for(AdditionalDto user : userlist) {
double traveltotal = 0,egresstotal = 0,overtimetotal = 0;
......@@ -459,7 +458,29 @@ public class AttendanceTaskTiming{
rowData.add("未排班");
}else if(sdf1.parse(beginTime).getTime() < sdf1.parse(num).getTime()) {
rowData.add("未到班期");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(leaves), num) >= 0) {//请假
}else {
if(Arrays.binarySearch(ClockInTool.deleteArrayNull(sblacks), num) >= 0) {
rowData.add("上班缺卡");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(sblacks), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) {
rowData.add("上班缺卡,下班早退");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0) {
rowData.add("上班迟到");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(xblacks), num) >= 0) {
rowData.add("上班迟到,下班缺卡");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) {
rowData.add("上班迟到,下班早退");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(xblacks), num) >= 0) {
rowData.add("下班缺卡");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) {
rowData.add("下班早退");
}else {
rowData.add("正常");
}
}
// if(Arrays.binarySearch(ClockInTool.deleteArrayNull(leaves), num) >= 0) {//请假
if(ClockInTool.contains(ClockInTool.deleteArrayNull(leaves),num)) {
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 2));
String leavetype = "未知";//请假类型
String company = "未知";//请假单位
......@@ -474,17 +495,26 @@ public class AttendanceTaskTiming{
}
}
rowData.add(lea.getStartTime() +"到"+ lea.getEndTime()+"请"+leavetype+lea.getDuration()+company);
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(travels), num) >= 0) {//出差
}
// if(Arrays.binarySearch(ClockInTool.deleteArrayNull(travels), num) >= 0) {//出差
if(ClockInTool.contains(ClockInTool.deleteArrayNull(travels),num)) {
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 3));
rowData.add(lea.getStartTime() +"到"+ lea.getEndTime()+"出差"+lea.getDuration()+"天");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(goouts), num) >= 0){//外出
}
// if(Arrays.binarySearch(ClockInTool.deleteArrayNull(goouts), num) >= 0){//外出
if(ClockInTool.contains(ClockInTool.deleteArrayNull(goouts),num)) {
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 4));
rowData.add(lea.getStartTime() +"到"+ lea.getEndTime()+"外出"+lea.getDuration()+"天");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cards), num) >= 0){//补卡
}
// if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cards), num) >= 0){//补卡
if(ClockInTool.contains(ClockInTool.deleteArrayNull(cards),num)) {
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 5));
rowData.add("已补卡:"+lea.getStartTime());
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(overtimes), num) >= 0) {//加班
}
// if(Arrays.binarySearch(ClockInTool.deleteArrayNull(overtimes), num) >= 0) {//加班
if(ClockInTool.contains(ClockInTool.deleteArrayNull(overtimes),num)) {
KqglAssoRelationSummary lea = KqglAssoRelationSummary.builder().build().selectOne(new QueryWrapper<KqglAssoRelationSummary>().lambda().eq(KqglAssoRelationSummary::getUserId, user.getEmpnum()).eq(KqglAssoRelationSummary::getAppTime, num).eq(KqglAssoRelationSummary::getApprovalType, 1));
String company = "未知",method = "无";//加班单位、加班补偿方式
//最小加班单位 1:按分钟加班、2:按半小时加班、3:按小时加班、4:按半天加班、5:按天加班
KqglAssoOvertimeBasics basics = KqglAssoOvertimeBasics.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeBasics>().lambda().eq(KqglAssoOvertimeBasics::getOrgCode, org_code));
......@@ -500,7 +530,8 @@ public class AttendanceTaskTiming{
rowData.add(lea.getStartTime() +"到"+ lea.getEndTime()+"加班"+lea.getDuration()+company+"["+method+"]");
//加班补偿方式 1:转调休;2:转加班费;3:转调休或加班费
//工作日
if(Arrays.binarySearch(ClockInTool.deleteArrayNull(ycqts), num) >= 0) {
// if(Arrays.binarySearch(ClockInTool.deleteArrayNull(ycqts), num) >= 0) {
if(ClockInTool.contains(ClockInTool.deleteArrayNull(ycqts),num)) {
if(lea.getCompensateId() == 1) {
workingturncompenleave++;
}else if(lea.getCompensateId() == 2) {
......@@ -508,39 +539,42 @@ public class AttendanceTaskTiming{
}
}
//休息日
if(Arrays.binarySearch(ClockInTool.deleteArrayNull(xxts), num) >= 0) {
// if(Arrays.binarySearch(ClockInTool.deleteArrayNull(xxts), num) >= 0) {
if(ClockInTool.contains(ClockInTool.deleteArrayNull(xxts),num)) {
if(lea.getCompensateId() == 1) {
restturncompenleave++;
}else if(lea.getCompensateId() == 2) {
resttransferovertime++;
}
}
if(Arrays.binarySearch(ClockInTool.deleteArrayNull(ycqts), num) < 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(xxts), num) < 0) {
// if(Arrays.binarySearch(ClockInTool.deleteArrayNull(ycqts), num) < 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(xxts), num) < 0) {
if(!ClockInTool.contains(ClockInTool.deleteArrayNull(ycqts),num) && !ClockInTool.contains(ClockInTool.deleteArrayNull(xxts),num)) {
if(lea.getCompensateId() == 1) {
holidayturncompenleave++;
}else if(lea.getCompensateId() == 2) {
holidaytransferovertime++;
}
}
}else{
if(Arrays.binarySearch(ClockInTool.deleteArrayNull(sblacks), num) >= 0) {
rowData.add("上班缺卡");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(sblacks), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) {
rowData.add("上班缺卡,下班早退");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0) {
rowData.add("上班迟到");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(xblacks), num) >= 0) {
rowData.add("上班迟到,下班缺卡");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0 && Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) {
rowData.add("上班迟到,下班早退");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(xblacks), num) >= 0) {
rowData.add("下班缺卡");
}else if(Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) {
rowData.add("下班早退");
}else {
rowData.add("正常");
}
}
/*
* else{ if(Arrays.binarySearch(ClockInTool.deleteArrayNull(sblacks), num) >= 0)
* { rowData.add("上班缺卡"); }else
* if(Arrays.binarySearch(ClockInTool.deleteArrayNull(sblacks), num) >= 0 &&
* Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) {
* rowData.add("上班缺卡,下班早退"); }else
* if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0) {
* rowData.add("上班迟到"); }else
* if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0 &&
* Arrays.binarySearch(ClockInTool.deleteArrayNull(xblacks), num) >= 0) {
* rowData.add("上班迟到,下班缺卡"); }else
* if(Arrays.binarySearch(ClockInTool.deleteArrayNull(cdts), num) >= 0 &&
* Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) {
* rowData.add("上班迟到,下班早退"); }else
* if(Arrays.binarySearch(ClockInTool.deleteArrayNull(xblacks), num) >= 0) {
* rowData.add("下班缺卡"); }else
* if(Arrays.binarySearch(ClockInTool.deleteArrayNull(ztts), num) >= 0) {
* rowData.add("下班早退"); }else { rowData.add("正常"); } }
*/
}
KqglAssoBcsz shif = KqglAssoBcsz.builder().build();
......@@ -690,7 +724,7 @@ public class AttendanceTaskTiming{
summary.setDay31(noticesArray[30]);
summary.insert();
}
}
// }
// KqglTaskTiming.builder().task("AttendanceTask").id(sockid).executionStatus(0).lastExecutionTime(new Date().getTime()).build().updateById();
// return new Exception().getStackTrace()[0].getMethodName();
......
......@@ -15,14 +15,17 @@ import cn.timer.api.bean.kqmk.KqglAssoBcsz;
import cn.timer.api.bean.kqmk.KqglAssoDkjl;
import cn.timer.api.bean.kqmk.KqglAssoDkmx;
import cn.timer.api.bean.kqmk.KqglAssoLeaveBalance;
import cn.timer.api.bean.kqmk.KqglAssoLeaveEmployeeBalance;
import cn.timer.api.bean.kqmk.KqglAssoLeaveRules;
import cn.timer.api.bean.kqmk.KqglAssoOvertimeRange;
import cn.timer.api.bean.kqmk.KqglAssoOvertimeRules;
import cn.timer.api.bean.kqmk.KqglAssoRelationSummary;
import cn.timer.api.bean.kqmk.KqglAssoTeshu;
import cn.timer.api.bean.kqmk.KqglAssoYhkqz;
import cn.timer.api.bean.kqmk.KqglAssoZhoupaiban;
import cn.timer.api.bean.kqmk.KqglMainKqz;
import cn.timer.api.bean.yggl.YgglMainEmp;
import cn.timer.api.config.exception.CustomException;
import cn.timer.api.controller.kqgl.ClockInController;
import cn.timer.api.controller.kqgl.ClockInTool;
import cn.timer.api.controller.kqgl.EmptyUtil;
import cn.timer.api.dao.kqmk.KqglAssoLeaveBalanceMapper;
......@@ -62,7 +65,7 @@ public class KqglServiceImpl implements KqglService {
.leaveTypeId(leaveappr.getLeavetype()).startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(leaveappr.getStarttime()))
.endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(leaveappr.getEndtime())).orgCode(leaveappr.getOrgcode()).build().insert();
}
YgglMainEmp emp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, leaveappr.getUserid()));
YgglMainEmp emp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum, leaveappr.getUserid()).eq(YgglMainEmp::getOrgCode, leaveappr.getOrgcode()));
int modifynumber = 1;
KqglAssoLeaveBalance balan = kqglassoleavebalancemapper.selectOne(new QueryWrapper<KqglAssoLeaveBalance>().lambda().eq(KqglAssoLeaveBalance::getUserid, leaveappr.getUserid()).eq(KqglAssoLeaveBalance::getOrgCode, leaveappr.getOrgcode())
......@@ -72,6 +75,21 @@ public class KqglServiceImpl implements KqglService {
}
KqglAssoLeaveBalance.builder().leaveRulesId(leaveappr.getLeavetype()).userid(leaveappr.getUserid()).modifyAction(2).balanceDays("-"+leaveappr.getDuration())
.reason("系统按照规则自动").modifyUserid(emp.getEmpNum()).modifyTimer(new Date().getTime()).orgCode(emp.getOrgCode()).isAutomatic(1).modifyNumber(modifynumber).build().insert();//员工假期余额
//查询员工假期余额表中所对应的假期id
KqglAssoLeaveEmployeeBalance emba = KqglAssoLeaveEmployeeBalance.builder().build().selectOne(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getLeaveRulesId, leaveappr.getLeavetype())
.eq(KqglAssoLeaveEmployeeBalance::getUserid, leaveappr.getUserid()).eq(KqglAssoLeaveEmployeeBalance::getOrgCode, leaveappr.getOrgcode()));
//获取最后得到的最终余额
double balance_days = kqglassoleavebalancemapper.Sumbalancedays(leaveappr.getUserid(), leaveappr.getOrgcode(),leaveappr.getLeavetype());
if(emba != null && balance_days > 0) {
if(emba.getBalanceDays() != -1) {//确认为限制余额的
//修改最终的余额数
KqglAssoLeaveEmployeeBalance.builder().id(emba.getId()).balanceDays(balance_days).build().updateById();
}
}
return true;
}
......@@ -98,6 +116,8 @@ public class KqglServiceImpl implements KqglService {
if(overappr.getCompensate() == 1) {
double duration = 0l;//
int modifynumber = 1;
KqglAssoLeaveBalance balan = kqglassoleavebalancemapper.selectOne(new QueryWrapper<KqglAssoLeaveBalance>().lambda().eq(KqglAssoLeaveBalance::getUserid, overappr.getUserid()).eq(KqglAssoLeaveBalance::getOrgCode, overappr.getOrgcode())
.orderByDesc(KqglAssoLeaveBalance :: getModifyNumber).last("LIMIT 1"));
......@@ -105,8 +125,59 @@ public class KqglServiceImpl implements KqglService {
modifynumber = balan.getModifyNumber()+1;
}
KqglAssoLeaveBalance.builder().leaveRulesId(learul.getId()).userid(overappr.getUserid()).modifyAction(2).balanceDays("+"+overappr.getDuration())
.reason("系统按照规则自动(加班)").modifyUserid(emp.getEmpNum()).modifyTimer(new Date().getTime()).orgCode(emp.getOrgCode()).isAutomatic(1).modifyNumber(modifynumber).build().insert();//员工假期余额
KqglAssoYhkqz yhd = KqglAssoYhkqz.builder().build().selectOne(new QueryWrapper<KqglAssoYhkqz>().lambda().eq(KqglAssoYhkqz::getUserid, overappr.getUserid()).eq(KqglAssoYhkqz::getQyid, overappr.getOrgcode()));
if(yhd != null) {
KqglAssoOvertimeRange timeran = KqglAssoOvertimeRange.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeRange>().lambda().eq(KqglAssoOvertimeRange::getAttgroupId, yhd.getKqzid()));
if(timeran != null) {
KqglAssoOvertimeRules rul = KqglAssoOvertimeRules.builder().build().selectOne(new QueryWrapper<KqglAssoOvertimeRules>().lambda().eq(KqglAssoOvertimeRules::getId, timeran.getOvertimeRulesId()));
if(rul != null) {
//1:工作日加班;2:休息日加班;3:节假日加班
if(overappr.getOvertimetype() == 1) {
if(rul.getIsWorkovertime() == 1) {
if(rul.getWork() == 1) {
duration = Double.valueOf(rul.getWorkOne()) * overappr.getDuration();
}else if(rul.getWork() == 3) {
duration = Double.valueOf(rul.getWorkThree()) * overappr.getDuration();
}
}
}else if(overappr.getOvertimetype() == 2) {
if(rul.getIsRestovertime() == 1) {
if(rul.getRest() == 1) {
duration = Double.valueOf(rul.getRestOne()) * overappr.getDuration();
}else if(rul.getRest() == 3) {
duration = Double.valueOf(rul.getRestThree()) * overappr.getDuration();
}
}
}else {
if(rul.getIsHolidays() == 1) {
if(rul.getHolidays() == 1) {
duration = Double.valueOf(rul.getHolidaysOne()) * overappr.getDuration();
}else if(rul.getHolidays() == 3) {
duration = Double.valueOf(rul.getHolidaysThree()) * overappr.getDuration();
}
}
}
}
}
}
KqglAssoLeaveBalance.builder().leaveRulesId(learul.getId()).userid(overappr.getUserid()).modifyAction(2).balanceDays("+"+duration)
.reason("系统按照审批自动(加班)").modifyUserid(emp.getEmpNum()).modifyTimer(overappr.getStarttime()).orgCode(emp.getOrgCode()).isAutomatic(1).modifyNumber(modifynumber).build().insert();//员工假期余额
//查询员工假期余额表中所对应的假期id
KqglAssoLeaveEmployeeBalance emba = KqglAssoLeaveEmployeeBalance.builder().build().selectOne(new QueryWrapper<KqglAssoLeaveEmployeeBalance>().lambda().eq(KqglAssoLeaveEmployeeBalance::getLeaveRulesId, learul.getId())
.eq(KqglAssoLeaveEmployeeBalance::getUserid, overappr.getUserid()).eq(KqglAssoLeaveEmployeeBalance::getOrgCode, overappr.getOrgcode()));
//获取最后得到的最终余额
double balance_days = kqglassoleavebalancemapper.Sumbalancedays(overappr.getUserid(), overappr.getOrgcode(),learul.getId());
if(emba != null && balance_days > 0) {
if(emba.getBalanceDays() != -1) {//确认为限制余额的
//修改最终的余额数
KqglAssoLeaveEmployeeBalance.builder().id(emba.getId()).balanceDays(balance_days).build().updateById();
}
}
}
return true;
......@@ -123,7 +194,7 @@ public class KqglServiceImpl implements KqglService {
String[] days=ClockInTool.listToString(ClockInTool.getDays(startdate,enddate)).split(",");
for(String num : days) {
//记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(3)
KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(3).duration(evecappr.getDuration())
.startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getStarttime())).endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getEndtime()))
.orgCode(evecappr.getOrgcode()).build().insert();
}
......@@ -133,7 +204,7 @@ public class KqglServiceImpl implements KqglService {
String[] days=ClockInTool.listToString(ClockInTool.getDays(startdate,enddate)).split(",");
for(String num : days) {
//记入打卡月汇总关联表
KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(4)
KqglAssoRelationSummary.builder().userId(evecappr.getUserid()).appTime(num).approvalId(evecappr.getEvectionid()).approvalType(4).duration(evecappr.getDuration())
.startTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getStarttime())).endTime(new SimpleDateFormat("yyyy-MM-dd' 'HH:mm:ss").format(evecappr.getEndtime()))
.orgCode(evecappr.getOrgcode()).build().insert();
}
......
......@@ -92,6 +92,8 @@ public class Auth {
Integer empNum = userBean.getEmpNum();
QyzxEmpEntAsso qyzxEmpEntAsso = selectMain(orgCode, empNum);
if (qyzxEmpEntAsso != null) {
if (qyzxEmpEntAsso.getUserType() == SysRoleType.U_TYPE_ADMIN.getType())
return ResultUtil.error("主账号暂时不能删除");
if (QyzxEmpEntAsso.builder().userType(SysRoleType.U_TYPE_EMP.getType()).build()
.update(new LambdaQueryWrapper<QyzxEmpEntAsso>().eq(QyzxEmpEntAsso::getOrgCode, orgCode)
.eq(QyzxEmpEntAsso::getEmpNum, childEmpNum)))
......
......@@ -298,7 +298,8 @@ public class QyzxBusinessController {
.eq(QyzxUseRecord::getPmid, 1)
.eq(StringUtils.isNotBlank(orderNo), QyzxUseRecord::getOrderNo, orderNo)
.ge(StringUtils.isNotBlank(startTime), QyzxUseRecord::getCreateTime, startTime)
.le(StringUtils.isNotBlank(endTime), QyzxUseRecord::getCreateTime, endTime));
.le(StringUtils.isNotBlank(endTime), QyzxUseRecord::getCreateTime, endTime)
.last("order by create_time desc"));
return ResultUtil.pageData(list, page.getTotal(), "查询成功");
}
......
......@@ -6,6 +6,7 @@
package cn.timer.api.controller.yggl;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
......@@ -60,6 +61,7 @@ import cn.hutool.poi.excel.ExcelWriter;
import cn.timer.api.bean.clazz.CommonArea;
import cn.timer.api.bean.clazz.SysRegion;
import cn.timer.api.bean.kqmk.KqglAssoLeaveBalance;
import cn.timer.api.bean.kqmk.KqglAssoLeaveEmployeeBalance;
import cn.timer.api.bean.kqmk.KqglAssoLeaveRules;
import cn.timer.api.bean.qyzx.QyzxEmpEntAsso;
import cn.timer.api.bean.qyzx.QyzxEmpLogin;
......@@ -289,25 +291,19 @@ public class YgglController {
.empNum(login.getId()).orgCode(orgCode).bmgwId(bmgwId).build();
ygglMainEmp.insert();
//假期规则初始化
String current_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
List<KqglAssoLeaveRules> rul = KqglAssoLeaveRules.builder().build().selectList(new QueryWrapper<KqglAssoLeaveRules>().lambda().eq(KqglAssoLeaveRules::getOrgCode, orgCode));
for(KqglAssoLeaveRules r : rul) {
if(r.getLeaveBalance() == 0) {
KqglAssoLeaveBalance.builder().leaveRulesId(r.getId()).userid(ygglMainEmp.getEmpNum()).modifyAction(2).balanceDays("-1")
.reason("不限制余额").modifyUserid(ygglMainEmp.getEmpNum()).modifyTimer(new Date().getTime()).orgCode(userBean.getOrgCode()).isAutomatic(1).modifyNumber(1).build().insert();//员工假期余额
KqglAssoLeaveEmployeeBalance.builder().leaveRulesId(r.getId()).userid(ygglMainEmp.getEmpNum()).balanceDays(-1).modifyUserid(userBean.getEmpNum()).modifyTimer(current_time).orgCode(userBean.getOrgCode()).build().insert();
}else {
KqglAssoLeaveBalance.builder().leaveRulesId(r.getId()).userid(ygglMainEmp.getEmpNum()).modifyAction(1).balanceDays("+0")
.reason("系统按照规则自动").modifyUserid(ygglMainEmp.getEmpNum()).modifyTimer(new Date().getTime()).orgCode(userBean.getOrgCode()).isAutomatic(1).modifyNumber(1).build().insert();//员工假期余额
KqglAssoLeaveEmployeeBalance.builder().leaveRulesId(r.getId()).userid(ygglMainEmp.getEmpNum()).balanceDays(0.0).modifyUserid(userBean.getEmpNum()).modifyTimer(current_time).orgCode(userBean.getOrgCode()).build().insert();
}
}
return ResultUtil.data(ygglMainEmp, "添加员工成功!");
} else {
return ResultUtil.error("该手机号已被使用,请输入正确手机号");
......
......@@ -28,5 +28,7 @@ public interface KqglAssoLeaveBalanceMapper extends BaseMapper<KqglAssoLeaveBala
List<AdditionalDto> selectAdditionalList(int orgcode);
JiaqibalanceDto selectleavebalanceList(int leaverulesid,int userid);
// JiaqibalanceDto selectleavebalanceList(int leaverulesid,int userid);
Double Sumbalancedays(int userid,int orgcode,int leaverulesid);
}
package cn.timer.api.dao.kqmk;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.kqmk.KqglAssoLeaveEmployeeBalance;
/**
* 员工假期余额表
*
* @author lal 2020-06-22
*/
@Repository
public interface KqglAssoLeaveEmployeeBalanceMapper extends BaseMapper<KqglAssoLeaveEmployeeBalance> {
}
package cn.timer.api.dao.kqmk;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import cn.timer.api.bean.kqmk.KqglAssoLeaveRulesT;
/**
* 假期规则
* @author Tang 2020-06-23
*/
@Repository
public interface KqglAssoLeaveRulesTMapper extends BaseMapper<KqglAssoLeaveRulesT> {
}
package cn.timer.api.dto.kqmk;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -10,11 +12,23 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BalanceSheetDataDto {
public class BalanceSheetDataDto implements Serializable{
/**
*
*/
private static final long serialVersionUID = -6994914131126332691L;
/**
*
*/
@ApiModelProperty(value = "id id", example = "101")
private Integer yzid;
@ApiModelProperty(value = "假期规则id", example = "字段说明")
private Integer leaverulesid;
@ApiModelProperty(value = "余额天数 ", example = "字段说明")
private Integer balancedays;
private double balancedays;
}
......@@ -18,6 +18,7 @@ public class DailyDetailsDto {
private Integer num;// 工号
private String dept;// 部门
private String post;// 岗位
private Integer orgcode;// 岗位
private String attname;// 考勤组名称
private Integer attpbfs;// 排班方式(1:固定排班;2:自由排班;3:自由工时)
private String attdate;// 考勤日期
......
......@@ -26,6 +26,9 @@ public class EmployeeLeaveBalanceDto {
@ApiModelProperty(value = "入职日期 ", example = "字段说明")
private String rztime;
@ApiModelProperty(value = "入职日期 ", example = "字段说明")
private Integer orgcode;
@ApiModelProperty(value = "表数据", example = "字段说明")
List<BalanceSheetDataDto> balanceTo;
......
package cn.timer.api.dto.kqmk;
import java.io.Serializable;
import java.util.List;
import javax.persistence.GeneratedValue;
......@@ -21,7 +22,16 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class KqglAssoMonthPunchSummaryDto {
public class KqglAssoMonthPunchSummaryDto implements Serializable{
/**
*
*/
private static final long serialVersionUID = -6391675154319774211L;
/**
*
*/
@Id
@GeneratedValue
......
......@@ -18,4 +18,7 @@ public class LeaveTypeDto {
@ApiModelProperty(value = "假期名称", example = "事假、调休...")
private String value;
@ApiModelProperty(value = "假期单位", example = "1:按天请假;2:按半天;3:按小时")
private String company;
}
package cn.timer.api.dto.kqmk;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SummaryDisplayDto {
private List<DailyDetailsDto> sumlist;
}
package cn.timer.api.dto.kqmk;
import org.apache.poi.ss.formula.functions.T;
import cn.timer.api.utils.Result;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SuperfluousDto<T> extends Result<T>{
/**
*
*/
private static final long serialVersionUID = -4971179863446442731L;
private int num;
private int nums;
}
......@@ -22,6 +22,7 @@
<result column="empname" property="empname" />
<result column="department" property="department" />
<result column="rztime" property="rztime" />
<result column="orgcode" property="orgcode" />
<collection property="balanceTo" ofType="cn.timer.api.dto.kqmk.BalanceSheetDataDto">
<result column="leaverulesid" property="leaverulesid"/>
<result column="balancedays" property="balancedays"/>
......@@ -69,7 +70,7 @@
</sql>
<select id="selectPageByQueryLeaveBalance" resultMap="LeaveBalanceMap">
SELECT emp.emp_num as empnum,
<!-- SELECT emp.emp_num as empnum,
emp.`name` as empname,
IFNULL(c.name,'') as department,
IFNULL(emp.rz_time,'') as rztime,
......@@ -82,7 +83,18 @@
from kqgl_asso_leave_balance bal
where bal.org_code = #{param.orgCode}
GROUP BY bal.userid,bal.leave_rules_id) as yz on yz.userid = emp.emp_num
where emp.org_code = #{param.orgCode} -->
SELECT emp.emp_num as empnum,
emp.`name` as empname,
emp.org_code as orgcode,
IFNULL(c.name,'') as department,
IFNULL(emp.rz_time,'') as rztime
from yggl_main_emp emp
LEFT JOIN zzgl_bmgw_m as gw on gw.id = emp.bmgw_id
LEFT JOIN zzgl_bmgw_m as c ON c.id = gw.up_id
where emp.org_code = #{param.orgCode}
and emp.job_status != 3
<if test="param.query != null and param.query != ''">
and ( emp.`name` like CONCAT('%',#{param.query},'%') or
emp.emp_num like CONCAT('%',#{param.query},'%') or
......@@ -91,7 +103,10 @@
<if test="param.deptid != null and param.deptid != ''">
and c.id = #{param.deptid}
</if>
ORDER BY emp.emp_num DESC
<!-- ORDER BY emp.emp_num DESC
LEFT JOIN kqgl_asso_leave_employee_balance as yz on yz.userid = emp.emp_num
yz.leave_rules_id as leaverulesid,
yz.balance_days as balancedays-->
</select>
......@@ -116,15 +131,19 @@
LEFT JOIN zzgl_bmgw_m as gw on gw.id = emp.bmgw_id
LEFT JOIN zzgl_bmgw_m as c ON c.id = gw.up_id
where emp.org_code = #{orgcode}
and emp.job_status in (0,1)
and emp.job_status != 3
</select>
<select id="selectleavebalanceList" resultMap="JiaqibalanceMap">
<!-- <select id="selectleavebalanceList" resultMap="JiaqibalanceMap">
select bal.userid,SUM(bal.balance_days) as balancedays
from kqgl_asso_leave_balance bal
where bal.leave_rules_id = #{leaverulesid} and bal.userid = #{userid}
GROUP BY bal.userid
</select> -->
<select id="Sumbalancedays" resultType="java.lang.Double">
select SUM(ba.balance_days) from kqgl_asso_leave_balance ba where ba.userid = #{userid} and ba.org_code = #{orgcode} and ba.leave_rules_id = #{leaverulesid}
</select>
<!--
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.kqmk.KqglAssoLeaveEmployeeBalanceMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.kqmk.KqglAssoLeaveEmployeeBalance" >
<id column="id" property="id" />
<result column="leave_rules_id" property="leaveRulesId" />
<result column="userid" property="userid" />
<result column="balance_days" property="balanceDays" />
<result column="modify_userid" property="modifyUserid" />
<result column="modify_timer" property="modifyTimer" />
<result column="org_code" property="orgCode" />
</resultMap>
<sql id="Base_Column_List">
id,
leave_rules_id,
userid,
balance_days,
modify_userid,
modify_timer,
org_code
</sql>
<sql id="Base_Column_List_Alias">
id KqglAssoLeaveEmployeeBalance_id,
leave_rules_id KqglAssoLeaveEmployeeBalance_leave_rules_id,
userid KqglAssoLeaveEmployeeBalance_userid,
balance_days KqglAssoLeaveEmployeeBalance_balance_days,
modify_userid KqglAssoLeaveEmployeeBalance_modify_userid,
modify_timer KqglAssoLeaveEmployeeBalance_modify_timer,
org_code KqglAssoLeaveEmployeeBalance_org_code
</sql>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoLeaveEmployeeBalance">
INSERT INTO kqgl_asso_leave_employee_balance
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != leaveRulesId'>
leave_rules_id,
</if>
<if test ='null != userid'>
userid,
</if>
<if test ='null != balanceDays'>
balance_days,
</if>
<if test ='null != modifyUserid'>
modify_userid,
</if>
<if test ='null != modifyTimer'>
modify_timer,
</if>
<if test ='null != orgCode'>
org_code
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != leaveRulesId'>
#{leaveRulesId},
</if>
<if test ='null != userid'>
#{userid},
</if>
<if test ='null != balanceDays'>
#{balanceDays},
</if>
<if test ='null != modifyUserid'>
#{modifyUserid},
</if>
<if test ='null != modifyTimer'>
#{modifyTimer},
</if>
<if test ='null != orgCode'>
#{orgCode}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM kqgl_asso_leave_employee_balance
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.kqmk.KqglAssoLeaveEmployeeBalance">
UPDATE kqgl_asso_leave_employee_balance
<set>
<if test ='null != leaveRulesId'>leave_rules_id = #{leaveRulesId},</if>
<if test ='null != userid'>userid = #{userid},</if>
<if test ='null != balanceDays'>balance_days = #{balanceDays},</if>
<if test ='null != modifyUserid'>modify_userid = #{modifyUserid},</if>
<if test ='null != modifyTimer'>modify_timer = #{modifyTimer},</if>
<if test ='null != orgCode'>org_code = #{orgCode}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM kqgl_asso_leave_employee_balance
WHERE id = #{id}
</select>
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM kqgl_asso_leave_employee_balance
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM kqgl_asso_leave_employee_balance
</select>
-->
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.timer.api.dao.kqmk.KqglAssoLeaveRulesTMapper">
<resultMap id="BaseResultMap" type="cn.timer.api.bean.kqmk.KqglAssoLeaveRulesT" >
<id column="id" property="id" />
<result column="name" property="name" />
<result column="company" property="company" />
<result column="leave_type" property="leaveType" />
<result column="apply" property="apply" />
<result column="is_open" property="isOpen" />
<result column="leave_balance" property="leaveBalance" />
<result column="rules_type" property="rulesType" />
</resultMap>
<sql id="Base_Column_List">
id,
name,
company,
leave_type,
apply,
is_open,
leave_balance,
rules_type
</sql>
<sql id="Base_Column_List_Alias">
id KqglAssoLeaveRulesT_id,
name KqglAssoLeaveRulesT_name,
company KqglAssoLeaveRulesT_company,
leave_type KqglAssoLeaveRulesT_leave_type,
apply KqglAssoLeaveRulesT_apply,
is_open KqglAssoLeaveRulesT_is_open,
leave_balance KqglAssoLeaveRulesT_leave_balance,
rules_type KqglAssoLeaveRulesT_rules_type
</sql>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.kqmk.KqglAssoLeaveRulesT">
INSERT INTO kqgl_asso_leave_rules_t
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != name'>
name,
</if>
<if test ='null != company'>
company,
</if>
<if test ='null != leaveType'>
leave_type,
</if>
<if test ='null != apply'>
apply,
</if>
<if test ='null != isOpen'>
is_open,
</if>
<if test ='null != leaveBalance'>
leave_balance,
</if>
<if test ='null != rulesType'>
rules_type
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != name'>
#{name},
</if>
<if test ='null != company'>
#{company},
</if>
<if test ='null != leaveType'>
#{leaveType},
</if>
<if test ='null != apply'>
#{apply},
</if>
<if test ='null != isOpen'>
#{isOpen},
</if>
<if test ='null != leaveBalance'>
#{leaveBalance},
</if>
<if test ='null != rulesType'>
#{rulesType}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM kqgl_asso_leave_rules_t
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.kqmk.KqglAssoLeaveRulesT">
UPDATE kqgl_asso_leave_rules_t
<set>
<if test ='null != name'>name = #{name},</if>
<if test ='null != company'>company = #{company},</if>
<if test ='null != leaveType'>leave_type = #{leaveType},</if>
<if test ='null != apply'>apply = #{apply},</if>
<if test ='null != isOpen'>is_open = #{isOpen},</if>
<if test ='null != leaveBalance'>leave_balance = #{leaveBalance},</if>
<if test ='null != rulesType'>rules_type = #{rulesType}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM kqgl_asso_leave_rules_t
WHERE id = #{id}
</select>
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM kqgl_asso_leave_rules_t
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM kqgl_asso_leave_rules_t
</select>
-->
</mapper>
\ No newline at end of file
......@@ -140,6 +140,7 @@
<result column="last_modified" property="lastModified" />
<collection property="balanceTo" ofType="cn.timer.api.dto.kqmk.BalanceSheetDataDto">
<id column="yzid" property="yzid"/>
<result column="leaverulesid" property="leaverulesid"/>
<result column="balancedays" property="balancedays"/>
</collection>
......@@ -150,6 +151,7 @@
<result column="num" property="num" />
<result column="dept" property="dept" />
<result column="post" property="post" />
<result column="orgcode" property="orgcode" />
<result column="address" property="address" />
<result column="remarks" property="remarks" />
......@@ -212,6 +214,7 @@
<result column="duration" property="duration" />
<collection property="balanceTo" ofType="cn.timer.api.dto.kqmk.BalanceSheetDataDto">
<id column="yzid" property="yzid"/>
<result column="leaverulesid" property="leaverulesid"/>
<result column="balancedays" property="balancedays"/>
</collection>
......@@ -220,28 +223,8 @@
<select id="AttendanceSummaryData" resultMap="SummarydataMap">
select sum.*,
(select kqz.name from kqgl_main_kqz kqz where kqz.id = sum.att_group) as attname,
yz.leaverulesid as leaverulesid,
yz.duration as balancedays
(select kqz.name from kqgl_main_kqz kqz where kqz.id = sum.att_group) as attname
from kqgl_asso_month_punch_summary sum
LEFT JOIN (SELECT les.id as leaverulesid,
hz.user_id,
hz.duration
FROM kqgl_asso_leave_rules les
LEFT JOIN (select ry.user_id,ry.leave_type_id,SUM(ry.duration) as duration
from (
select rel.user_id,rel.leave_type_id,rel.duration
from kqgl_asso_relation_summary rel
where rel.approval_type = 2
and rel.app_time &gt;= #{param.staapptime}
and rel.app_time &lt;= #{param.endapptime}
GROUP BY rel.user_id,rel.leave_type_id,rel.duration
) as ry
GROUP BY ry.user_id,ry.leave_type_id
) as hz on hz.leave_type_id = les.id
WHERE les.org_code = #{param.orgCode}
AND (les.leave_type = 2 OR les.is_open = 1)
) as yz on yz.user_id = sum.num
where sum.org_code = #{param.orgCode}
and sum.belong_year = #{param.year}
and sum.belong_month = #{param.month}
......@@ -253,100 +236,17 @@
and sum.att_group = #{param.attid}
</if>
<!-- yz.id as yzid,
yz.leave_rules_id as leaverulesid,
yz.balance_days as balancedays
LEFT JOIN kqgl_asso_leave_employee_balance as yz on yz.userid = sum.num
ORDER BY sum.num DESC -->
</select>
<select id="Dailydetails" resultMap="DailyDetailsMap">
<!-- select sum.`name`,sum.num,sum.dept,sum.post,
IFNULL((select kqz.name from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') as attname,
IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') as attpbfs,
'' address,
'' remarks,
'' cardtype,
'' macaddress,
'' macname,
IFNULL(rtj.bcszid, '') bcszid,
IFNULL(rtj.bcname, '') bcname,
IFNULL(rtj.bcsbdk1, '') bcsbdk1,
IFNULL(rtj.bcxbdk1, '') bcxbdk1,
IFNULL(rtj.bcsbdk2, '') bcsbdk2,
IFNULL(rtj.bcxbdk2, '') bcxbdk2,
IFNULL(rtj.bcsbdk3, '') bcsbdk3,
IFNULL(rtj.bcxbdk3, '') bcxbdk3,
IFNULL(rtj.attdate, '') attdate,
IFNULL(rtj.userid,'') userid,
IFNULL(rtj.data,'') data,
IFNULL(rtj.sbdk1,'') sbdk1,
IFNULL(rtj.sbdk1jg,'') sbdk1jg,
IFNULL(rtj.xbdk1 ,'') xbdk1,
IFNULL(rtj.xbdk1jg,'') xbdk1jg,
IFNULL(rtj.sbdk2 ,'') sbdk2,
IFNULL(rtj.sbdk2jg ,'') sbdk2jg,
IFNULL(rtj.xbdk2 ,'') xbdk2,
IFNULL(rtj.xbdk2jg,'') xbdk2jg,
IFNULL(rtj.sbdk3 ,'') sbdk3,
IFNULL(rtj.sbdk3jg ,'') sbdk3jg,
IFNULL(rtj.xbdk3,'') xbdk3,
IFNULL(rtj.xbdk3jg ,'') xbdk3jg,
IFNULL(rtj.ydkcs ,'') ydkcs,
IFNULL(rtj.gzsc ,'') gzsc,
IFNULL(rtj.qyid,'') qyid,
IFNULL(rtj.dksj ,'') dksj,
IFNULL(rtj.yzcdcs ,'') yzcdcs,
IFNULL(rtj.yzcdsc ,'') yzcdsc,
IFNULL(rtj.kgcdfzs,'') kgcdfzs,
sum.days_on_duty as daysonduty,
sum.days_off as daysoff,
sum.length_business_trip as lengthbusinesstrip,
sum.time_out as timeout,
sum.total_overtime_hours as totalovertimehours,
sum.working_turn_compen_leave as workingturncompenleave,
sum.rest_turn_compen_leave as restturncompenleave,
sum.holiday_turn_compen_leave as holidayturncompenleave,
sum.working_transfer_overtime as workingtransferovertime,
sum.rest_transfer_overtime as resttransferovertime,
sum.holiday_transfer_overtime as holidaytransferovertime,
IFNULL(mrtj.leaverulesid,'') as leaverulesid,
IFNULL(mrtj.duration,'') as balancedays
from kqgl_asso_month_punch_summary sum
LEFT JOIN (
select DISTINCT info.`name` as username ,
dkjl.attdate,bcsz.id as bcszid,
bcsz.`name` as bcname,bcsz.sbdk1 as bcsbdk1,bcsz.xbdk1 as bcxbdk1,bcsz.sbdk2 as bcsbdk2,bcsz.xbdk2 as bcxbdk2,bcsz.sbdk3 as bcsbdk3,bcsz.xbdk3 as bcxbdk3,
dkmx.`userid`,dkmx.`data` ,dkmx.`sbdk1`,dkmx.`sbdk1jg`,dkmx.`xbdk1` ,dkmx.`xbdk1jg`,dkmx.`sbdk2` ,dkmx.`sbdk2jg` ,dkmx.`xbdk2` ,
dkmx.`xbdk2jg`,dkmx.`sbdk3` ,dkmx.`sbdk3jg` ,dkmx.`xbdk3`,dkmx.`xbdk3jg` ,dkmx.`ydkcs` ,dkmx.`gzsc` ,dkmx.`qyid`,dkmx.`dksj` ,
dkmx.`yzcdcs` ,dkmx.`yzcdsc` ,dkmx.`kgcdfzs`
from kqgl_asso_dkmx dkmx
LEFT JOIN yggl_main_emp as info on info.emp_num = dkmx.userid and info.org_code = #{param.orgCode}
LEFT JOIN (select * from kqgl_asso_dkjl dkjl
where dkjl.id in (select MAX(dkjl.id) from kqgl_asso_dkjl dkjl
LEFT JOIN kqgl_asso_dkmx as dkmx on dkmx.id = dkjl.dkmxid
where dkmx.qyid = #{param.orgCode}
and dkmx.`data` = #{param.times}
GROUP BY dkjl.user_id)) as dkjl on dkjl.dkmxid = dkmx.id
LEFT JOIN kqgl_asso_bcsz as bcsz on bcsz.id = dkjl.bcid
where dkmx.qyid = #{param.orgCode}
and dkmx.`data` = #{param.times}
) as rtj on rtj.userid = sum.num
LEFT JOIN (SELECT les.id as leaverulesid,hz.user_id,hz.duration
FROM kqgl_asso_leave_rules les
LEFT JOIN (select ry.user_id,ry.leave_type_id,SUM(ry.duration) as duration
from (
select rel.user_id,rel.leave_type_id,rel.duration
from kqgl_asso_relation_summary rel
where rel.approval_type = 2
and rel.app_time = #{param.times}
GROUP BY rel.user_id,rel.leave_type_id,rel.duration
) as ry
GROUP BY ry.user_id,ry.leave_type_id) as hz on hz.leave_type_id = les.id
WHERE les.org_code = #{param.orgCode}
AND (les.leave_type = 2 OR les.is_open = 1)
) as mrtj on mrtj.user_id = sum.num
where sum.org_code = #{param.orgCode}
and sum.belong_year = #{param.year}
and sum.belong_month = #{param.month} -->
select sum.`name`,
sum.num,
select sum.num,
sum.`name`,
sum.org_code as orgcode,
sum.dept,sum.post,
IFNULL((select kqz.name from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') as attname,
IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') as attpbfs,
......@@ -450,34 +350,16 @@
WHEN IFNULL((select kqz.pbfs from kqgl_main_kqz kqz where kqz.id = sum.att_group),'') = 2
THEN (select pb.bcid from kqgl_asso_pbmx pb where pb.userid = sum.num
and pb.`data` = #{param.times} and pb.kqzid = sum.att_group) ELSE '' END))),'') as ydkcs,
'' address,
'' remarks,
'' cardtype,
'' macaddress,
'' macname,
IFNULL(rtj.attdate, '') attdate,
IFNULL(rtj.userid,'') userid,
'' address,'' remarks,'' cardtype,'' macaddress,'' macname,
IFNULL(rtj.attdate, '') attdate,IFNULL(rtj.userid,'') userid,
#{param.times} data,
IFNULL(rtj.sbdk1,'') sbdk1,
IFNULL(rtj.sbdk1jg,'') sbdk1jg,
IFNULL(rtj.xbdk1 ,'') xbdk1,
IFNULL(rtj.xbdk1jg,'') xbdk1jg,
IFNULL(rtj.sbdk2 ,'') sbdk2,
IFNULL(rtj.sbdk2jg ,'') sbdk2jg,
IFNULL(rtj.xbdk2 ,'') xbdk2,
IFNULL(rtj.xbdk2jg,'') xbdk2jg,
IFNULL(rtj.sbdk3 ,'') sbdk3,
IFNULL(rtj.sbdk3jg ,'') sbdk3jg,
IFNULL(rtj.xbdk3,'') xbdk3,
IFNULL(rtj.xbdk3jg ,'') xbdk3jg,
IFNULL(rtj.dktj1,'') dktj1,
IFNULL(rtj.dktj2,'') dktj2,
IFNULL(rtj.dktj3,'') dktj3,
IFNULL(rtj.dktj4,'') dktj4,
IFNULL(rtj.dktj5,'') dktj5,
IFNULL(rtj.dktj6,'') dktj6,
IFNULL(rtj.sbdk1,'') sbdk1,IFNULL(rtj.sbdk1jg,'') sbdk1jg,
IFNULL(rtj.xbdk1 ,'') xbdk1,IFNULL(rtj.xbdk1jg,'') xbdk1jg,
IFNULL(rtj.sbdk2 ,'') sbdk2,IFNULL(rtj.sbdk2jg ,'') sbdk2jg,
IFNULL(rtj.xbdk2 ,'') xbdk2,IFNULL(rtj.xbdk2jg,'') xbdk2jg,
IFNULL(rtj.sbdk3 ,'') sbdk3,IFNULL(rtj.sbdk3jg ,'') sbdk3jg,
IFNULL(rtj.xbdk3,'') xbdk3,IFNULL(rtj.xbdk3jg ,'') xbdk3jg,
IFNULL(rtj.dktj1,'') dktj1,IFNULL(rtj.dktj2,'') dktj2,IFNULL(rtj.dktj3,'') dktj3,IFNULL(rtj.dktj4,'') dktj4,IFNULL(rtj.dktj5,'') dktj5,IFNULL(rtj.dktj6,'') dktj6,
IFNULL(rtj.gzsc ,'') gzsc,
IFNULL(rtj.qyid,'') qyid,
IFNULL(rtj.dksj ,'') dksj,
......@@ -494,9 +376,7 @@
sum.holiday_turn_compen_leave as holidayturncompenleave,
sum.working_transfer_overtime as workingtransferovertime,
sum.rest_transfer_overtime as resttransferovertime,
sum.holiday_transfer_overtime as holidaytransferovertime,
IFNULL(mrtj.leaverulesid,'') as leaverulesid,
IFNULL(mrtj.duration,'') as balancedays
sum.holiday_transfer_overtime as holidaytransferovertime
from kqgl_asso_month_punch_summary sum
LEFT JOIN (
select DISTINCT info.`name` as username ,
......@@ -512,20 +392,7 @@
where dkmx.qyid = #{param.orgCode}
and dkmx.`data` = #{param.times}
) as rtj on rtj.userid = sum.num
LEFT JOIN (SELECT les.id as leaverulesid,hz.user_id,hz.duration
FROM kqgl_asso_leave_rules les
LEFT JOIN (select ry.user_id,ry.leave_type_id,SUM(ry.duration) as duration
from (
select rel.user_id,rel.leave_type_id,rel.duration
from kqgl_asso_relation_summary rel
where rel.approval_type = 2
and rel.app_time = #{param.times}
GROUP BY rel.user_id,rel.leave_type_id,rel.duration
) as ry
GROUP BY ry.user_id,ry.leave_type_id) as hz on hz.leave_type_id = les.id
WHERE les.org_code = #{param.orgCode}
AND (les.leave_type = 2 OR les.is_open = 1)
) as mrtj on mrtj.user_id = sum.num
where sum.org_code = #{param.orgCode}
and sum.belong_year = #{param.year}
and sum.belong_month = #{param.month}
......@@ -536,6 +403,10 @@
<if test="param.attid != null and param.attid != ''">
and sum.att_group = #{param.attid}
</if>
<!-- LEFT JOIN kqgl_asso_leave_employee_balance as mrtj on mrtj.userid = sum.num
IFNULL(mrtj.leave_rules_id,'') as leaverulesid,
IFNULL(mrtj.balance_days,'') as balancedays-->
</select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment