Commit f18e8855 authored by huyuchen's avatar huyuchen

优化修改

parent f5d79e55
......@@ -130,6 +130,14 @@ public class TEmployeeContractInfo extends BaseEntity {
@ExcelAttribute(name = "客户名称", maxLength = 128)
@Schema(description = "客户名称", name = "subjectUnit")
private String subjectUnit;
/**
* 0 是 1 否
*/
@NotBlank(message = "是否同步终止合同、减项、减档")
@Length(max = 1, message = "是否同步终止合同、减项、减档不能超过1个字符")
@ExcelAttribute(name = "是否同步终止合同、减项、减档", maxLength = 1)
@Schema(description = "是否同步终止合同、减项、减档", name = "situation")
private String changeContractAndEmployee;
/**
* 签订类型(字典也是汉字
*/
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import java.time.LocalDateTime;
/**
* 任务处理清单表
*
* @author huyc
* @date 2023-06-15 12:18:28
*/
@Data
@TableName("t_work_handler_info")
@EqualsAndHashCode()
@Schema(description = "任务处理清单表")
public class TWorkHandlerInfo {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@ExcelProperty("主键")
@Schema(description = "主键")
private String id;
/**
* 结算主体编码
*/
@ExcelAttribute(name = "结算主体编码", isNotEmpty = true, errorInfo = "结算主体编码不能为空", maxLength = 32)
@NotBlank(message = "结算主体编码不能为空")
@Length(max = 32, message = "结算主体编码不能超过32个字符")
@ExcelProperty("结算主体编码")
@Schema(description = "结算主体编码")
private String departNo;
/**
* 结算主体名称
*/
@ExcelAttribute(name = "结算主体名称", isNotEmpty = true, errorInfo = "结算主体名称不能为空", maxLength = 50)
@NotBlank(message = "结算主体名称不能为空")
@Length(max = 50, message = "结算主体名称不能超过50个字符")
@ExcelProperty("结算主体名称")
@Schema(description = "结算主体名称")
private String departName;
/**
* 员工姓名
*/
@ExcelAttribute(name = "员工姓名", maxLength = 32)
@Length(max = 32, message = "员工姓名不能超过32个字符")
@ExcelProperty("员工姓名")
@Schema(description = "员工姓名")
private String empName;
/**
* 员工身份证
*/
@ExcelAttribute(name = "员工身份证", maxLength = 32)
@Length(max = 32, message = "员工身份证不能超过32个字符")
@ExcelProperty("员工身份证")
@Schema(description = "员工身份证")
private String empIdcard;
/**
* 是否删除(0否/1是)
*/
@ExcelAttribute(name = "是否删除", isExport = false)
@Schema(description = "是否删除(0否/1是)")
private String deleteFlag;
/**
* 联动端口
*/
@ExcelAttribute(name = "联动端口", maxLength = 8)
@Length(max = 8, message = "联动端口不能超过8个字符")
@ExcelProperty("联动端口")
@Schema(description = "联动端口")
private String infoFrom;
/**
* 操作人
*/
@ExcelAttribute(name = "操作人", maxLength = 32)
@Length(max = 32, message = "操作人不能超过32个字符")
@ExcelProperty("操作人")
@Schema(description = "操作人")
private String operUser;
/**
* 操作时间
*/
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "操作时间")
@TableField(fill = FieldFill.INSERT)
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("操作时间")
private LocalDateTime operTime;
/**
* 执行结果
*/
@ExcelAttribute(name = "执行结果", maxLength = 5)
@Length(max = 5, message = "执行结果不能超过5个字符")
@ExcelProperty("执行结果")
@Schema(description = "执行结果")
private String operResult;
/**
* 执行详情
*/
@ExcelAttribute(name = "执行详情", maxLength = 255)
@Length(max = 255, message = "执行详情不能超过255个字符")
@ExcelProperty("执行详情")
@Schema(description = "执行详情")
private String operInfo;
/**
* 原因
*/
@ExcelAttribute(name = "原因", maxLength = 255)
@Length(max = 255, message = "原因不能超过255个字符")
@ExcelProperty("原因")
@Schema(description = "原因")
private String reason;
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.entity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.Set;
/**
* 任务处理清单表
*
* @author huyc
* @date 2023-06-15 12:18:28
*/
@Data
public class TWorkHandlerInfoSearchVo extends TWorkHandlerInfo {
@Schema(description = "导出的表头的Set")
private Set<String> exportFields;
/**
* 多选导出或删除等操作
*/
@Schema(description = "选中ID,多个逗号分割")
private String ids;
/**
* 创建时间区间 [开始时间,结束时间]
*/
@Schema(description = "创建时间区间")
private LocalDateTime[] createTimes;
/**
* @Author fxj
* 查询数据起
**/
@Schema(description = "查询limit 开始")
private int limitStart;
/**
* @Author fxj
* 查询数据止
**/
@Schema(description = "查询limit 数据条数")
private int limitEnd;
/**
* 开始日期
*/
@Schema(description = "开始日期")
private String startTime;
/**
* 结束日期
*/
@Schema(description = "结束日期")
private String endTime;
}
......@@ -56,9 +56,10 @@ public class EmployeeConstants {
public static final String WORKING_HOURS_EMPTY = "工时制不能为空";
public static final String EXIT_PRIJECT_STATUS = "人员已有该项目信息,禁止重复添加";
public static final String CONTRACT_REDUCE_INFO_NOT_EMPTY = "签订类型为终止时,离职日期和终止原因必填";
public static final String CONTRACT_REDUCE_INFO_NOT_EMPTY = "签订类型为终止时,离职日期、终止原因和是否同步终止合同、减项、减档必填";
public static final String CONTRACT_REDUCE_REASON_NOT_EMPTY = "终止原因为其他时,原因说明必填";
/**
* 对应项目编码已停止合作
*/
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TWorkHandlerInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TWorkHandlerInfoSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.service.TWorkHandlerInfoService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
/**
* 任务处理清单表
*
* @author huyc
* @date 2023-06-15 12:18:28
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/tworkhandlerinfo")
@Tag(name = "任务处理清单表管理")
public class TWorkHandlerInfoController {
private final TWorkHandlerInfoService tWorkHandlerInfoService;
/**
* 简单分页查询
*
* @param page 分页对象
* @param tWorkHandlerInfo 任务处理清单表
* @return
*/
@Operation(description = "简单分页查询")
@GetMapping("/page")
public R<IPage<TWorkHandlerInfo>> getTWorkHandlerInfoPage(Page<TWorkHandlerInfo> page, TWorkHandlerInfoSearchVo tWorkHandlerInfo) {
return new R<>(tWorkHandlerInfoService.getTWorkHandlerInfoPage(page, tWorkHandlerInfo));
}
/**
* 通过id查询任务处理清单表
*
* @param id id
* @return R
*/
@Operation(summary = "通过id查询", description = "通过id查询:hasPermission('archives_tworkhandlerinfo_get')")
@GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('archives_tworkhandlerinfo_get')")
public R<TWorkHandlerInfo> getById(@PathVariable("id") String id) {
return R.ok(tWorkHandlerInfoService.getById(id));
}
/**
* 任务处理清单表 批量导出
*
* @author huyc
* @date 2023-06-15 12:18:28
**/
@Operation(description = "导出任务处理清单表 hasPermission('archives_tworkhandlerinfo-export')")
@PostMapping("/export")
@PreAuthorize("@pms.hasPermission('archives_tworkhandlerinfo-export')")
public void export(HttpServletResponse response, @RequestBody TWorkHandlerInfoSearchVo searchVo) {
tWorkHandlerInfoService.listExport(response, searchVo);
}
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TWorkHandlerInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TWorkHandlerInfoSearchVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 任务处理清单表
*
* @author huyc
* @date 2023-06-15 12:18:28
*/
@Mapper
public interface TWorkHandlerInfoMapper extends BaseMapper<TWorkHandlerInfo> {
/**
* 任务处理清单表简单分页查询
* @param tWorkHandlerInfo 任务处理清单表
* @return
*/
IPage<TWorkHandlerInfo> getTWorkHandlerInfoPage(Page<TWorkHandlerInfo> page, @Param("tWorkHandlerInfo") TWorkHandlerInfoSearchVo tWorkHandlerInfo);
Integer noPageCountDiy(@Param("tWorkHandlerInfo") TWorkHandlerInfoSearchVo tWorkHandlerInfo);
List<TWorkHandlerInfo> noPageDiy(@Param("tWorkHandlerInfo") TWorkHandlerInfoSearchVo tWorkHandlerInfo);
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TWorkHandlerInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TWorkHandlerInfoSearchVo;
import javax.servlet.http.HttpServletResponse;
/**
* 任务处理清单表
*
* @author huyc
* @date 2023-06-15 12:18:28
*/
public interface TWorkHandlerInfoService extends IService<TWorkHandlerInfo> {
/**
* 任务处理清单表简单分页查询
* @param tWorkHandlerInfo 任务处理清单表
* @return
*/
IPage<TWorkHandlerInfo> getTWorkHandlerInfoPage(Page<TWorkHandlerInfo> page, TWorkHandlerInfoSearchVo tWorkHandlerInfo);
void listExport(HttpServletResponse response, TWorkHandlerInfoSearchVo searchVo);
}
......@@ -47,7 +47,6 @@ import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprSocialProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
......@@ -96,6 +95,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
private final TAttaInfoService tAttaInfoService;
private final TEmployeeContractAuditService tEmployeeContractAuditService;
private final TEmployeeLogService tEmployeeLogService;
private final TWorkHandlerInfoService workHandlerInfoService;
@Autowired
private DaprSocialProperties socialProperties;
// 缓存信息
......@@ -590,6 +590,23 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
}
}
/**
* @param tEmployeeContractInfo
* @Description: 保存审核操作记录
* @Author: huyc
* @Date: 2023/6/16 10:16
* @return: void
**/
private void setAuditInfoNew(TEmployeeContractInfo tEmployeeContractInfo,String flag) {
TEmployeeContractAudit audit = new TEmployeeContractAudit();
audit.setRootName("合同审核");
audit.setAuditStatus(CommonConstants.ZERO_STRING.equals(flag) ? "审核通过" : "审核不通过");
audit.setRemark("终止合同联动");
audit.setLinkId(tEmployeeContractInfo.getId());
audit.setLinkType(CommonConstants.ONE_INT);
tEmployeeContractAuditService.save(audit);
}
/**
* @Description: 合同归档记录
* @Author: hgw
......@@ -726,37 +743,131 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
} else {
return R.failed("未找到关联的原合同");
}
// 作废、终止审核通过:
// 更新项目合同状态为(2不在用),档案状态要判断
TEmployeeProject tEmployeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query()
.lambda().eq(TEmployeeProject::getEmpId, contractInfo.getEmpId())
.eq(TEmployeeProject::getDeptId, contractInfo.getSettleDomain())
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.last(CommonConstants.LAST_ONE_SQL));
if (tEmployeeProject != null) {
tEmployeeProject.setContractStatus(CommonConstants.TWO_INT);
tEmployeeProjectService.updateById(tEmployeeProject);
}
// 更新档案、项目合同状态为(0无合同 1在用 2不在用)
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(contractInfo.getEmpId());
if (tEmployeeInfo != null) {
// 判断人员有无审核通过的其他合同
TEmployeeContractInfo contractInfoInUse = this.getOne(Wrappers.<TEmployeeContractInfo>query()
//同步任务处理清单执行详情
StringBuilder workInfo = new StringBuilder();
StringBuilder failueInfo = new StringBuilder();
//是否同步终止合同、减项、减档为是的时候 单独写逻辑
if (EmployeeConstants.SITUATION_SIX.equals(contractInfo.getSituation())
&& CommonConstants.ONE_STRING.equals(contractInfo.getChangeContractAndEmployee())) {
workInfo.append("合同终止成功,");
//该项目下其他在用的合同统一更新成不在用
List<TEmployeeContractInfo> contractInfoList = baseMapper.selectList(Wrappers.<TEmployeeContractInfo>query()
.lambda().eq(TEmployeeContractInfo::getEmpId, contractInfo.getEmpId())
.and(obj -> obj.ge(TEmployeeContractInfo::getContractEnd, DateUtil.getThisDayByPatten("yyyy-MM-dd"))
.or().isNull(TEmployeeContractInfo::getContractEnd))
.eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_INT)
.eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_INT)
.eq(TEmployeeContractInfo::getSettleDomain, contractInfo.getSettleDomain())
.eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_INT));
if (Common.isNotNull(contractInfoList)) {
for (TEmployeeContractInfo contractInfo1:contractInfoList) {
contractInfo1.setInUse(CommonConstants.ONE_STRING);
baseMapper.updateById(contractInfo1);
//增加审核记录
this.setAuditInfoNew(contractInfo1,CommonConstants.ZERO_STRING);
}
}
//在途的合同更新为审核不通过
List<TEmployeeContractInfo> contractInfoListZt = baseMapper.selectList(Wrappers.<TEmployeeContractInfo>query()
.lambda().eq(TEmployeeContractInfo::getEmpId, contractInfo.getEmpId())
.eq(TEmployeeContractInfo::getSettleDomain, contractInfo.getSettleDomain())
.eq(TEmployeeContractInfo::getAuditStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_INT));
if (Common.isNotNull(contractInfoListZt)) {
for (TEmployeeContractInfo contractInfo1:contractInfoListZt) {
contractInfo1.setAuditStatus(CommonConstants.THREE_INT);
baseMapper.updateById(contractInfo1);
//增加审核记录
this.setAuditInfoNew(contractInfo1,CommonConstants.ONE_STRING);
}
}
//项目档案处理
TEmployeeProject tEmployeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query()
.lambda().eq(TEmployeeProject::getEmpId, contractInfo.getEmpId())
.eq(TEmployeeProject::getDeptId, contractInfo.getSettleDomain())
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.last(CommonConstants.LAST_ONE_SQL));
if (contractInfoInUse != null) {
tEmployeeInfo.setContractStatus(CommonConstants.ONE_INT);
} else {
tEmployeeInfo.setContractStatus(CommonConstants.TWO_INT);
if (tEmployeeProject != null) {
TEmployeeProject tEmployeeProjectOld = tEmployeeProjectService.getById(tEmployeeProject.getId());
tEmployeeProject.setContractStatus(CommonConstants.TWO_INT);
//如果该项目仍有社保、公积金的数据不同步减项,如正常减项,记录项目档案操作记录
if (tEmployeeProject.getSocialStatus() == CommonConstants.ZERO_INT
|| tEmployeeProject.getSocialStatus() == CommonConstants.FOUR_INT
|| tEmployeeProject.getFundStatus() == CommonConstants.ZERO_INT
|| tEmployeeProject.getFundStatus() == CommonConstants.FOUR_INT) {
tEmployeeProject.setProjectStatus(CommonConstants.ONE_INT);
tEmployeeProject.setLeaveRemark("终止合同联动减项");
tEmployeeProject.setLeaveTime(LocalDateTime.now());
workInfo.append("减项成功,");
} else {
failueInfo.append("存在社保/公积金,无法减项");
}
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "",
tEmployeeProject.getId(), tEmployeeProjectOld, tEmployeeProject);
tEmployeeProjectService.updateById(tEmployeeProject);
//如果项目档案已减项,如果人员存在多个项目不处理,反之则减档
if (tEmployeeProject.getProjectStatus() == CommonConstants.ONE_INT) {
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
if (Common.isNotNull(tEmployeeInfo) && tEmployeeInfo.getProjectNum() == CommonConstants.ONE_INT) {
//减档
TEmployeeInfo tEmployeeInfoOld = tEmployeeInfoMapper.selectById(tEmployeeInfo.getId());
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeInfo.setLeaveRemark(tEmployeeProject.getLeaveRemark());
tEmployeeInfo.setLeaveTime(DateUtil.getCurrentDateTime());
tEmployeeInfo.setLeaveUser(user.getId());
tEmployeeInfo.setLeaveUserName(user.getNickname());
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfo.getId(),
"", tEmployeeInfoOld, tEmployeeInfo);
workInfo.append("减档成功,");
tEmployeeInfoMapper.updateById(tEmployeeInfo);
} else {
failueInfo.append("存在其他项目,无法减档");
}
}
}
//增加任务处理情况查询表数据
TWorkHandlerInfo handlerInfo = new TWorkHandlerInfo();
handlerInfo.setEmpIdcard(contractInfo.getEmpIdcard());
handlerInfo.setEmpName(contractInfo.getEmpName());
handlerInfo.setDepartName(contractInfo.getSubjectDepart());
handlerInfo.setDepartNo(contractInfo.getDeptNo());
handlerInfo.setInfoFrom("合同终止");
handlerInfo.setOperInfo(workInfo.substring(0,workInfo.length()-1));
handlerInfo.setReason(failueInfo.length() > 1 ? failueInfo.toString() : "");
handlerInfo.setOperResult(failueInfo.length() > 1 ? "1" :"2");
handlerInfo.setOperUser(user.getNickname());
handlerInfo.setOperTime(LocalDateTime.now());
workHandlerInfoService.save(handlerInfo);
} else {
// 作废、终止审核通过:
// 更新项目合同状态为(2不在用),档案状态要判断
TEmployeeProject tEmployeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query()
.lambda().eq(TEmployeeProject::getEmpId, contractInfo.getEmpId())
.eq(TEmployeeProject::getDeptId, contractInfo.getSettleDomain())
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.last(CommonConstants.LAST_ONE_SQL));
if (tEmployeeProject != null) {
tEmployeeProject.setContractStatus(CommonConstants.TWO_INT);
tEmployeeProjectService.updateById(tEmployeeProject);
}
// 更新档案、项目合同状态为(0无合同 1在用 2不在用)
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(contractInfo.getEmpId());
if (tEmployeeInfo != null) {
// 判断人员有无审核通过的其他合同
TEmployeeContractInfo contractInfoInUse = this.getOne(Wrappers.<TEmployeeContractInfo>query()
.lambda().eq(TEmployeeContractInfo::getEmpId, contractInfo.getEmpId())
.and(obj -> obj.ge(TEmployeeContractInfo::getContractEnd, DateUtil.getThisDayByPatten("yyyy-MM-dd"))
.or().isNull(TEmployeeContractInfo::getContractEnd))
.eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL));
if (contractInfoInUse != null) {
tEmployeeInfo.setContractStatus(CommonConstants.ONE_INT);
} else {
tEmployeeInfo.setContractStatus(CommonConstants.TWO_INT);
}
tEmployeeInfoMapper.updateById(tEmployeeInfo);
}
tEmployeeInfoMapper.updateById(tEmployeeInfo);
}
}
}
......@@ -1091,7 +1202,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
|| EmployeeConstants.SITUATION_SEVEN.equals(insert.getSituation())) {
// 终止 离职日期 和减少原因必填
if (EmployeeConstants.SITUATION_SEVEN.equals(insert.getSituation())) {
if (Common.isEmpty(insert.getReduceReason()) || Common.isEmpty(insert.getLeaveDate())) {
if (Common.isEmpty(insert.getReduceReason()) || Common.isEmpty(insert.getLeaveDate()) || Common.isEmpty(insert.getChangeContractAndEmployee())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), EmployeeConstants.CONTRACT_REDUCE_INFO_NOT_EMPTY));
return;
}
......@@ -1477,6 +1588,9 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
TEmployeeInfo tEmployeeInfo;
int i = 1;
int errorCount = 0;
List<TEmployeeContractInfo> contractInfoList;
List<TEmployeeContractInfo> contractInfoListZt;
for (TEmployeeContractInfo contract : contractInfos) {
i++;
if (contract.getAuditStatus() != CommonConstants.ONE_INT) {
......@@ -1542,38 +1656,133 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
continue;
}
// 作废、终止审核通过:
// 更新项目合同状态为(2不在用),档案状态要判断
tEmployeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query()
.lambda().eq(TEmployeeProject::getEmpId, contract.getEmpId())
.eq(TEmployeeProject::getDeptId, contract.getSettleDomain())
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.last(CommonConstants.LAST_ONE_SQL));
if (tEmployeeProject != null) {
tEmployeeProject.setContractStatus(CommonConstants.TWO_INT);
tEmployeeProjectService.updateById(tEmployeeProject);
}
// 更新档案、项目合同状态为(0无合同 1在用 2不在用)
tEmployeeInfo = tEmployeeInfoMapper.selectById(contract.getEmpId());
if (tEmployeeInfo != null) {
// 判断人员有无审核通过的其他合同
contractInfoInUse = this.getOne(Wrappers.<TEmployeeContractInfo>query()
//同步任务处理清单执行详情
StringBuilder workInfo = new StringBuilder();
StringBuilder failueInfo = new StringBuilder();
//是否同步终止合同、减项、减档为是的时候 单独写逻辑
if (EmployeeConstants.SITUATION_SIX.equals(contract.getSituation())
&& CommonConstants.ONE_STRING.equals(contract.getChangeContractAndEmployee())) {
workInfo.append("合同终止成功,");
//该项目下其他在用的合同统一更新成不在用
contractInfoList = baseMapper.selectList(Wrappers.<TEmployeeContractInfo>query()
.lambda().eq(TEmployeeContractInfo::getEmpId, contract.getEmpId())
.and(obj -> obj.ge(TEmployeeContractInfo::getContractEnd, DateUtil.getThisDayByPatten("yyyy-MM-dd"))
.or().isNull(TEmployeeContractInfo::getContractEnd))
.eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_INT)
.eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_INT)
.eq(TEmployeeContractInfo::getSettleDomain, contract.getSettleDomain())
.eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_INT));
if (Common.isNotNull(contractInfoList)) {
for (TEmployeeContractInfo contractInfo1 : contractInfoList) {
contractInfo1.setInUse(CommonConstants.ONE_STRING);
baseMapper.updateById(contractInfo1);
//增加审核记录
this.setAuditInfoNew(contractInfo1, CommonConstants.ZERO_STRING);
}
}
//在途的合同更新为审核不通过
contractInfoListZt = baseMapper.selectList(Wrappers.<TEmployeeContractInfo>query()
.lambda().eq(TEmployeeContractInfo::getEmpId, contract.getEmpId())
.eq(TEmployeeContractInfo::getSettleDomain, contract.getSettleDomain())
.eq(TEmployeeContractInfo::getAuditStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_INT));
if (Common.isNotNull(contractInfoListZt)) {
for (TEmployeeContractInfo contractInfo1 : contractInfoListZt) {
contractInfo1.setAuditStatus(CommonConstants.THREE_INT);
baseMapper.updateById(contractInfo1);
//增加审核记录
this.setAuditInfoNew(contractInfo1, CommonConstants.ONE_STRING);
}
}
//项目档案处理
tEmployeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query()
.lambda().eq(TEmployeeProject::getEmpId, contract.getEmpId())
.eq(TEmployeeProject::getDeptId, contract.getSettleDomain())
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.last(CommonConstants.LAST_ONE_SQL));
if (contractInfoInUse != null) {
tEmployeeInfo.setContractStatus(CommonConstants.ONE_INT);
} else {
tEmployeeInfo.setContractStatus(CommonConstants.TWO_INT);
if (null != tEmployeeProject) {
TEmployeeProject tEmployeeProjectOld = tEmployeeProjectService.getById(tEmployeeProject.getId());
tEmployeeProject.setContractStatus(CommonConstants.TWO_INT);
//如果该项目仍有社保、公积金的数据不同步减项,如正常减项,记录项目档案操作记录
if (tEmployeeProject.getSocialStatus() == CommonConstants.ZERO_INT
|| tEmployeeProject.getSocialStatus() == CommonConstants.FOUR_INT
|| tEmployeeProject.getFundStatus() == CommonConstants.ZERO_INT
|| tEmployeeProject.getFundStatus() == CommonConstants.FOUR_INT) {
tEmployeeProject.setProjectStatus(CommonConstants.ONE_INT);
tEmployeeProject.setLeaveRemark("终止合同联动减项");
tEmployeeProject.setLeaveTime(LocalDateTime.now());
workInfo.append("减项成功,");
} else {
failueInfo.append("存在社保/公积金,无法减项");
}
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "",
tEmployeeProject.getId(), tEmployeeProjectOld, tEmployeeProject);
tEmployeeProjectService.updateById(tEmployeeProject);
//如果项目档案已减项,如果人员存在多个项目不处理,反之则减档
if (tEmployeeProject.getProjectStatus() == CommonConstants.ONE_INT) {
tEmployeeInfo = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
if (Common.isNotNull(tEmployeeInfo) && tEmployeeInfo.getProjectNum() == CommonConstants.ONE_INT) {
//减档
TEmployeeInfo tEmployeeInfoOld = tEmployeeInfoMapper.selectById(tEmployeeInfo.getId());
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeInfo.setLeaveRemark(tEmployeeProject.getLeaveRemark());
tEmployeeInfo.setLeaveTime(DateUtil.getCurrentDateTime());
tEmployeeInfo.setLeaveUser(user.getId());
tEmployeeInfo.setLeaveUserName(user.getNickname());
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0], tEmployeeInfo.getId(),
"", tEmployeeInfoOld, tEmployeeInfo);
workInfo.append("减档成功,");
tEmployeeInfoMapper.updateById(tEmployeeInfo);
} else {
failueInfo.append("存在其他项目,无法减档");
}
}
}
//增加任务处理情况查询表数据
TWorkHandlerInfo handlerInfo = new TWorkHandlerInfo();
handlerInfo.setEmpIdcard(contract.getEmpIdcard());
handlerInfo.setEmpName(contract.getEmpName());
handlerInfo.setDepartName(contract.getSubjectDepart());
handlerInfo.setDepartNo(contract.getDeptNo());
handlerInfo.setInfoFrom("合同终止");
handlerInfo.setOperInfo(workInfo.substring(0, workInfo.length() - 1));
handlerInfo.setReason(failueInfo.length() > 1 ? failueInfo.toString() : "");
handlerInfo.setOperResult(failueInfo.length() > 1 ? "1" : "2");
handlerInfo.setOperUser(user.getNickname());
handlerInfo.setOperTime(LocalDateTime.now());
workHandlerInfoService.save(handlerInfo);
} else{
// 作废、终止审核通过:
// 更新项目合同状态为(2不在用),档案状态要判断
tEmployeeProject = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query()
.lambda().eq(TEmployeeProject::getEmpId, contract.getEmpId())
.eq(TEmployeeProject::getDeptId, contract.getSettleDomain())
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT)
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.last(CommonConstants.LAST_ONE_SQL));
if (tEmployeeProject != null) {
tEmployeeProject.setContractStatus(CommonConstants.TWO_INT);
tEmployeeProjectService.updateById(tEmployeeProject);
}
// 更新档案、项目合同状态为(0无合同 1在用 2不在用)
tEmployeeInfo = tEmployeeInfoMapper.selectById(contract.getEmpId());
if (tEmployeeInfo != null) {
// 判断人员有无审核通过的其他合同
contractInfoInUse = this.getOne(Wrappers.<TEmployeeContractInfo>query()
.lambda().eq(TEmployeeContractInfo::getEmpId, contract.getEmpId())
.and(obj -> obj.ge(TEmployeeContractInfo::getContractEnd, DateUtil.getThisDayByPatten("yyyy-MM-dd"))
.or().isNull(TEmployeeContractInfo::getContractEnd))
.eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_INT)
.eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_INT)
.last(CommonConstants.LAST_ONE_SQL));
if (contractInfoInUse != null) {
tEmployeeInfo.setContractStatus(CommonConstants.ONE_INT);
} else {
tEmployeeInfo.setContractStatus(CommonConstants.TWO_INT);
}
tEmployeeInfoMapper.updateById(tEmployeeInfo);
}
}
tEmployeeInfoMapper.updateById(tEmployeeInfo);
}
}
}
// 不是待提交,记录审核记录
this.setAuditInfo(tEmployeeContractInfo);
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TWorkHandlerInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TWorkHandlerInfoSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TWorkHandlerInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TWorkHandlerInfoService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
/**
* 任务处理清单表
*
* @author huyc
* @date 2023-06-15 12:18:28
*/
@Log4j2
@Service
public class TWorkHandlerInfoServiceImpl extends ServiceImpl<TWorkHandlerInfoMapper, TWorkHandlerInfo> implements TWorkHandlerInfoService {
/**
* 任务处理清单表简单分页查询
* @param tWorkHandlerInfo 任务处理清单表
* @return
*/
@Override
public IPage<TWorkHandlerInfo> getTWorkHandlerInfoPage(Page<TWorkHandlerInfo> page, TWorkHandlerInfoSearchVo tWorkHandlerInfo){
return baseMapper.getTWorkHandlerInfoPage(page,tWorkHandlerInfo);
}
/**
* 任务处理清单表批量导出
* @param searchVo 任务处理清单表
* @return
*/
@Override
public void listExport(HttpServletResponse response, TWorkHandlerInfoSearchVo searchVo){
String fileName = "任务处理清单表批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表
List<TWorkHandlerInfo> list = new ArrayList<>();
Integer count = baseMapper.noPageCountDiy(searchVo);
try (ServletOutputStream out = response.getOutputStream()) {
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName , CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, TWorkHandlerInfo.class).includeColumnFieldNames(searchVo.getExportFields()).build();
int index = 0;
if (count > CommonConstants.ZERO_INT){
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = baseMapper.noPageDiy(searchVo);
if (Common.isNotNull(list)){
WriteSheet writeSheet = EasyExcel.writerSheet("任务处理清单表"+index).build();
excelWriter.write(list,writeSheet);
index++;
}
if (Common.isNotNull(list)){
list.clear();
}
}
}else {
WriteSheet writeSheet = EasyExcel.writerSheet("任务处理清单表"+index).build();
excelWriter.write(list,writeSheet);
}
if (Common.isNotNull(list)){
list.clear();
}
excelWriter.finish();
}catch (Exception e){
log.error("执行异常" ,e);
}
}
}
......@@ -83,6 +83,7 @@
<result property="type" column="TYPE"/>
<result property="leaveDate" column="LEAVE_DATE"/>
<result property="reduceReason" column="REDUCE_REASON"/>
<result property="changeContractAndEmployee" column="CHANGE_CONTRACT_AND_EMPLOYEE"/>
</resultMap>
<!-- 合同审核导出 -->
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.archives.mapper.TWorkHandlerInfoMapper">
<resultMap id="tWorkHandlerInfoMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TWorkHandlerInfo">
<id property="id" column="ID"/>
<result property="departNo" column="DEPART_NO"/>
<result property="departName" column="DEPART_NAME"/>
<result property="empName" column="EMP_NAME"/>
<result property="empIdcard" column="EMP_IDCARD"/>
<result property="deleteFlag" column="DELETE_FLAG"/>
<result property="infoFrom" column="INFO_FROM"/>
<result property="operUser" column="OPER_USER"/>
<result property="operTime" column="OPER_TIME"/>
<result property="operResult" column="OPER_RESULT"/>
<result property="operInfo" column="OPER_INFO"/>
<result property="reason" column="REASON"/>
</resultMap>
<sql id="Base_Column_List">
a.ID,
a.DEPART_NO,
a.DEPART_NAME,
a.EMP_NAME,
a.EMP_IDCARD,
a.DELETE_FLAG,
a.INFO_FROM,
a.OPER_USER,
a.OPER_TIME,
a.OPER_RESULT,
a.OPER_INFO,
a.REASON
</sql>
<sql id="tWorkHandlerInfo_where">
<if test="tWorkHandlerInfo != null">
<if test="tWorkHandlerInfo.departNo != null and tWorkHandlerInfo.departNo.trim() != ''">
AND a.DEPART_NO = #{tWorkHandlerInfo.departNo}
</if>
<if test="tWorkHandlerInfo.departName != null and tWorkHandlerInfo.departName.trim() != ''">
AND a.DEPART_NAME = #{tWorkHandlerInfo.departName}
</if>
<if test="tWorkHandlerInfo.empName != null and tWorkHandlerInfo.empName.trim() != ''">
AND a.EMP_NAME = like concat('%', #{tWorkHandlerInfo.empName} ,'%')
</if>
<if test="tWorkHandlerInfo.empIdcard != null and tWorkHandlerInfo.empIdcard.trim() != ''">
AND a.EMP_IDCARD like concat('%', #{tWorkHandlerInfo.empIdcard} ,'%')
</if>
<if test="tWorkHandlerInfo.infoFrom != null and tWorkHandlerInfo.infoFrom.trim() != ''">
AND a.INFO_FROM = #{tWorkHandlerInfo.infoFrom}
</if>
<if test="tWorkHandlerInfo.operUser != null and tWorkHandlerInfo.operUser.trim() != ''">
AND a.OPER_USER like concat('%', #{tWorkHandlerInfo.operUser} ,'%')
</if>
<if test="tWorkHandlerInfo.startTime != null and tWorkHandlerInfo.startTime.trim() != '' ">
AND a.OPER_TIME <![CDATA[ >= ]]> concat(#{tWorkHandlerInfo.startTime}, ' 00:00:00')
</if>
<if test="tWorkHandlerInfo.endTime != null and tWorkHandlerInfo.endTime.trim() != '' ">
AND a.OPER_TIME <![CDATA[ <= ]]> concat(#{tWorkHandlerInfo.endTime}, ' 23:59:59')
</if>
<if test="tWorkHandlerInfo.operResult != null and tWorkHandlerInfo.operResult.trim() != ''">
AND a.OPER_RESULT = #{tWorkHandlerInfo.operResult}
</if>
</if>
</sql>
<!--tWorkHandlerInfo简单分页查询-->
<select id="getTWorkHandlerInfoPage" resultMap="tWorkHandlerInfoMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_work_handler_info a
<where>
1=1
<include refid="tWorkHandlerInfo_where"/>
</where>
order by a.OPER_TIME desc
</select>
<select id="noPageCountDiy" resultType="java.lang.Integer">
SELECT
count(1)
FROM t_work_handler_info a
<where>
1=1
<include refid="tWorkHandlerInfo_where"/>
</where>
</select>
<select id="noPageDiy" resultMap="tWorkHandlerInfoMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_work_handler_info a
<where>
1=1
<include refid="tWorkHandlerInfo_where"/>
</where>
order by a.OPER_TIME desc
limit #{tWorkHandlerInfo.limitStart},#{tWorkHandlerInfo.limitEnd}
</select>
</mapper>
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