Commit 0f9215cd authored by fangxinjiang's avatar fangxinjiang

合同待办

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