Commit 0f9215cd authored by fangxinjiang's avatar fangxinjiang

合同待办

parent c8f291dd
...@@ -205,7 +205,7 @@ public class TEmpContractAlert extends BaseEntity { ...@@ -205,7 +205,7 @@ public class TEmpContractAlert extends BaseEntity {
private String alertPerson; private String alertPerson;
/** /**
* 处理状态 0 待处理 1 处理 * 处理状态 0 待处理 1 处理
*/ */
@ExcelAttribute(name = "处理状态" ) @ExcelAttribute(name = "处理状态" )
@Schema(description ="处理状态") @Schema(description ="处理状态")
......
...@@ -26,13 +26,11 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; ...@@ -26,13 +26,11 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.constants.ArchivesConstants; import com.yifu.cloud.plus.v1.yifu.archives.constants.ArchivesConstants;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpBadRecord; import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpContractAlert;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmpContractAlertMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmpContractAlertMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpContractAlertService; import com.yifu.cloud.plus.v1.yifu.archives.service.TEmpContractAlertService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ContractAlertSearchVo; import com.yifu.cloud.plus.v1.yifu.archives.vo.ContractAlertSearchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
...@@ -62,6 +60,8 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM ...@@ -62,6 +60,8 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
private final TEmployeeInfoMapper employeeInfoMapper; private final TEmployeeInfoMapper employeeInfoMapper;
private final TEmployeeProjectMapper projectMapper;
@Override @Override
public IPage<TEmpContractAlert> pageDiy(Page page, ContractAlertSearchVo searchVo) { public IPage<TEmpContractAlert> pageDiy(Page page, ContractAlertSearchVo searchVo) {
LambdaQueryWrapper<TEmpContractAlert> wrapper = buildQueryWrapper(searchVo); LambdaQueryWrapper<TEmpContractAlert> wrapper = buildQueryWrapper(searchVo);
...@@ -210,28 +210,31 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM ...@@ -210,28 +210,31 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
**/ **/
@Override @Override
public R<Boolean> taskCreateContractAlert() { public R<Boolean> taskCreateContractAlert() {
baseMapper.truncate();
// 获取合同为在档、员工类型为“0外包”、“1派遣”、最近一次合同审核通过、过期或离过期还有3个月的数据 // 获取合同为在档、员工类型为“0外包”、“1派遣”、最近一次合同审核通过、过期或离过期还有3个月的数据
List<TEmployeeContractInfo> alertList = contractInfoMapper.selectList(Wrappers.<TEmployeeContractInfo>query() List<TEmployeeContractInfo> alertList = contractInfoMapper.selectList(Wrappers.<TEmployeeContractInfo>query()
.lambda().eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.TWO_STRING) .lambda().eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.TWO_STRING)
.isNotNull(TEmployeeContractInfo::getAuditTimeLast) .isNotNull(TEmployeeContractInfo::getAuditTimeLast)
.eq(TEmployeeContractInfo::getContractType,"1") .eq(TEmployeeContractInfo::getIsObsolete,CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getContractType,CommonConstants.ONE_STRING)
.eq(TEmployeeContractInfo::getWorkFlag,CommonConstants.ZERO_STRING) .eq(TEmployeeContractInfo::getWorkFlag,CommonConstants.ZERO_STRING)
.ne(TEmployeeContractInfo::getSituation,"续签 ")
.ne(TEmployeeContractInfo::getSituation,"终止")
.le(TEmployeeContractInfo::getContractEnd,DateUtil.dateIncreaseByDay( .le(TEmployeeContractInfo::getContractEnd,DateUtil.dateIncreaseByDay(
DateUtil.dateIncreaseByMonth(DateUtil.getCurrentDateTime(), DateUtil.dateIncreaseByMonth(DateUtil.getCurrentDateTime(),
CommonConstants.dingleDigitIntArray[3]),CommonConstants.dingleDigitIntArray[1])) CommonConstants.dingleDigitIntArray[3]),CommonConstants.dingleDigitIntArray[1]))
.eq(TEmployeeContractInfo::getDeleteFlag,CommonConstants.ZERO_STRING)); .eq(TEmployeeContractInfo::getDeleteFlag,CommonConstants.ZERO_STRING));
// 获取所有未审核通过的合同数据 // 获取所有未审核通过的合同数据
List<TEmployeeContractInfo> notAccessList = contractInfoMapper.selectList(Wrappers.<TEmployeeContractInfo>query() List<TEmployeeContractInfo> notAccessList = contractInfoMapper.selectList(Wrappers.<TEmployeeContractInfo>query().lambda()
.lambda().ne(TEmployeeContractInfo::getAuditStatus,CommonConstants.TWO_STRING) .and(obj->obj.eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getContractType,"1") .or().eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.ONE_STRING))
.eq(TEmployeeContractInfo::getIsObsolete,CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getWorkFlag,CommonConstants.ZERO_STRING) .eq(TEmployeeContractInfo::getWorkFlag,CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getDeleteFlag,CommonConstants.ZERO_STRING)); .eq(TEmployeeContractInfo::getDeleteFlag,CommonConstants.ZERO_STRING));
Map<String,TEmpContractAlert> alertMap = new HashMap<>(); Map<String,TEmpContractAlert> alertMap = new HashMap<>();
Map<String,TEmpContractAlert> existMap = new HashMap<>(); Map<String,TEmpContractAlert> existMap = new HashMap<>();
initExistMap(existMap); initExistMap(existMap);
if (Common.isNotNull(alertList)){ if (Common.isNotNull(alertList)){
Date nowDate = DateUtil.dateIncreaseByDay(new Date(),CommonConstants.ONE_INT); Date nowDate = new Date();
for (TEmployeeContractInfo contract:alertList){ for (TEmployeeContractInfo contract:alertList){
extracted(nowDate, contract,alertMap,existMap); extracted(nowDate, contract,alertMap,existMap);
} }
...@@ -239,14 +242,14 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM ...@@ -239,14 +242,14 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
if (Common.isNotNull(notAccessList) && Common.isNotNull(alertMap)){ if (Common.isNotNull(notAccessList) && Common.isNotNull(alertMap)){
TEmpContractAlert exist; TEmpContractAlert exist;
for (TEmployeeContractInfo contract:notAccessList){ for (TEmployeeContractInfo contract:notAccessList){
exist = alertMap.get(contract.getEmpIdcard()); exist = alertMap.get(contract.getEmpIdcard()+CommonConstants.DOWN_LINE_STRING+contract.getDeptNo());
if (Common.isNotNull(exist)){ if (Common.isNotNull(exist)){
exist.setHandleStatus(CommonConstants.ONE_STRING); exist.setHandleStatus(CommonConstants.ONE_STRING);
alertMap.put(exist.getEmpIdcard(),exist); alertMap.put(contract.getEmpIdcard()+CommonConstants.DOWN_LINE_STRING+contract.getDeptNo(),exist);
} }
} }
} }
baseMapper.truncate();
if (Common.isNotNull(alertMap)){ if (Common.isNotNull(alertMap)){
this.saveBatch(alertMap.values()); this.saveBatch(alertMap.values());
} }
...@@ -257,37 +260,44 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM ...@@ -257,37 +260,44 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
List<TEmpContractAlert> exists = baseMapper.selectList(Wrappers.<TEmpContractAlert>query()); List<TEmpContractAlert> exists = baseMapper.selectList(Wrappers.<TEmpContractAlert>query());
if (Common.isNotNull(exists)){ if (Common.isNotNull(exists)){
for (TEmpContractAlert alert:exists){ for (TEmpContractAlert alert:exists){
existMap.put(alert.getEmpIdcard() existMap.put(alert.getContractId(),alert);
+CommonConstants.DOWN_LINE_STRING
+alert.getProjectNo()
+CommonConstants.DOWN_LINE_STRING
+alert.getContractId(),alert);
} }
} }
} }
private void extracted(Date nowDate, private void extracted(Date nowDate,
TEmployeeContractInfo contract, TEmployeeContractInfo contract,
Map<String, TEmpContractAlert> alertMap, Map<String, TEmpContractAlert> existMap) { Map<String, TEmpContractAlert> alertMap,
Map<String, TEmpContractAlert> existMap) {
TEmployeeInfo employeeInfo = employeeInfoMapper.selectById(contract.getEmpId()); TEmployeeInfo employeeInfo = employeeInfoMapper.selectById(contract.getEmpId());
if (Common.isNotNull(employeeInfo) if (Common.isNotNull(employeeInfo)){
&& !CommonConstants.ZERO_STRING.equals(employeeInfo.getEmpNatrue()) TEmployeeProject project = projectMapper.selectOne(Wrappers.<TEmployeeProject>query().lambda()
&& !CommonConstants.ONE_STRING.equals(employeeInfo.getEmpNatrue())){ .eq(TEmployeeProject::getEmpIdcard,employeeInfo.getEmpIdcard())
.eq(TEmployeeProject::getDeleteFlag,CommonConstants.ZERO_STRING)
.eq(TEmployeeProject::getDeptNo,contract.getDeptNo())
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(project)
&& ((Common.isNotNull(project.getProjectStatus())
&& project.getProjectStatus().intValue()== CommonConstants.ONE_INT)
|| (
!CommonConstants.ZERO_STRING.equals(project.getEmpNatrue())
&& !CommonConstants.ONE_STRING.equals(project.getEmpNatrue()))
)){
return; return;
} }
}
TEmpContractAlert alert = alertMap.get(contract.getEmpIdcard()+CommonConstants.DOWN_LINE_STRING+contract.getDeptNo()); TEmpContractAlert alert = alertMap.get(contract.getEmpIdcard()+CommonConstants.DOWN_LINE_STRING+contract.getDeptNo());
// 存在多个审核通过的数据 用最新的审核通过的合同覆盖已有的 // 存在多个审核通过的数据 用最新的审核通过的合同覆盖已有的
if (Common.isNotNull(alert) if (Common.isNotNull(alert)
&& Common.isNotNull(alert.getContractEnd()) && Common.isNotNull(alert.getAuditTime())
&& Common.isNotNull(contract.getContractEnd()) && Common.isNotNull(contract.getAuditTimeLast())
&& alert.getAuditTime().after(contract.getContractEnd())){ && alert.getAuditTime().after(LocalDateTimeUtils.convertLDTToDate(contract.getAuditTimeLast()))){
return; return;
} }
TEmpContractAlert exist = existMap.get(alert.getEmpIdcard() TEmpContractAlert exist = null;
+CommonConstants.DOWN_LINE_STRING if (Common.isNotNull(contract)){
+alert.getProjectNo() exist = existMap.get(contract.getId());
+CommonConstants.DOWN_LINE_STRING }
+alert.getContractId());
alert = new TEmpContractAlert(); alert = new TEmpContractAlert();
if (Common.isNotNull(exist) && Common.isNotNull(exist.getFirstAlertTime())){ if (Common.isNotNull(exist) && Common.isNotNull(exist.getFirstAlertTime())){
alert.setFirstAlertTime(exist.getFirstAlertTime()); alert.setFirstAlertTime(exist.getFirstAlertTime());
...@@ -318,12 +328,14 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM ...@@ -318,12 +328,14 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
alert.setContractType(contract.getContractName()); alert.setContractType(contract.getContractName());
alert.setContractTerm(contract.getContractType()); alert.setContractTerm(contract.getContractType());
if (Common.isNotNull(alert.getContractEnd())){ if (Common.isNotNull(alert.getContractEnd())){
if (Common.isNotNull(contract.getContractEnd()) && contract.getContractEnd().before(nowDate)){ if (Common.isNotNull(contract.getContractEnd()) && DateUtil.daysBetween(alert.getContractEnd(),nowDate) > 0){
alert.setDueFlag(CommonConstants.ONE_STRING);
alert.setDaysOver(DateUtil.daysBetween(alert.getContractEnd(),nowDate)); alert.setDaysOver(DateUtil.daysBetween(alert.getContractEnd(),nowDate));
alert.setDueFlag(CommonConstants.ONE_STRING);
alert.setDaysDue(null);
}else { }else {
alert.setDaysDue(DateUtil.daysBetween( nowDate,alert.getContractEnd())); alert.setDaysDue(DateUtil.daysBetween(nowDate,alert.getContractEnd()));
alert.setDueFlag(CommonConstants.ZERO_STRING); alert.setDueFlag(CommonConstants.ZERO_STRING);
alert.setDaysOver(null);
} }
} }
alert.setHandleStatus(CommonConstants.ZERO_STRING); alert.setHandleStatus(CommonConstants.ZERO_STRING);
......
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