Commit 6b36c8e2 authored by hongguangwu's avatar hongguangwu

Merge remote-tracking branch 'origin/develop' into develop

parents 372821d8 32d0725b
......@@ -203,7 +203,7 @@ public class TEmpContractAlert extends BaseEntity {
private String alertPerson;
/**
* 处理状态
* 处理状态 0 待处理 1 处理重
*/
@ExcelAttribute(name = "处理状态" )
@Schema(description ="处理状态")
......
......@@ -24,16 +24,19 @@ 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.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.java.Log;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
......@@ -138,5 +141,16 @@ public class TEmpContractAlertController {
public void export(HttpServletResponse response, @RequestBody ContractAlertSearchVo searchVo) {
tEmpContractAlertService.listExport(response,searchVo);
}
/**
* 定时任务生成合同续签代码信息
* @return R<List>
* @Author FXJ
* @Date 2022-07-4
**/
@SysLog("定时任务生成合同续签代码信息")
@Inner
@PostMapping("/inner/taskCreateContractAlert")
public R<Boolean> taskCreateContractAlert() {
return tEmpContractAlertService.taskCreateContractAlert();
}
}
......@@ -30,4 +30,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TEmpContractAlertMapper extends BaseMapper<TEmpContractAlert> {
void truncate();
}
......@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmpContractAlert;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ContractAlertSearchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
......@@ -39,4 +40,12 @@ public interface TEmpContractAlertService extends IService<TEmpContractAlert> {
List<TEmpContractAlert> listDiy(ContractAlertSearchVo searchVo);
void listExport(HttpServletResponse response, ContractAlertSearchVo searchVo);
/**
* 定时任务生成合同续签代码信息
* @return R<List>
* @Author FXJ
* @Date 2022-07-4
**/
R<Boolean> taskCreateContractAlert();
}
......@@ -29,23 +29,25 @@ 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.TEmpFamily;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractInfo;
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.service.TEmpContractAlertService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ContractAlertSearchVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.FamilySearchVO;
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.ExcelUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.*;
/**
* 员工合同续签待办
......@@ -53,9 +55,12 @@ import java.util.List;
* @author fxj
* @date 2022-07-01 14:15:05
*/
@RequiredArgsConstructor
@Service
public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertMapper, TEmpContractAlert> implements TEmpContractAlertService {
private final TEmployeeContractInfoMapper contractInfoMapper;
@Override
public IPage<TEmpContractAlert> pageDiy(Page page, ContractAlertSearchVo searchVo) {
LambdaQueryWrapper<TEmpContractAlert> wrapper = buildQueryWrapper(searchVo);
......@@ -190,4 +195,85 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
}
return wrapper;
}
/**
* 定时任务生成合同续签代码信息
* @return R<List>
* @Author FXJ
* @Date 2022-07-4
**/
@Override
public R<Boolean> taskCreateContractAlert() {
baseMapper.truncate();
// 获取合同为在档、员工类型为“派遣”、“外包”、最近一次合同审核通过、过期或离过期还有3个月的数据
List<TEmployeeContractInfo> alertList = contractInfoMapper.selectList(Wrappers.<TEmployeeContractInfo>query()
.lambda().eq(TEmployeeContractInfo::getAuditStatus,CommonConstants.TWO_STRING)
.isNotNull(TEmployeeContractInfo::getAuditTimeLast)
.eq(TEmployeeContractInfo::getWorkFlag,CommonConstants.ZERO_STRING)
.ge(TEmployeeContractInfo::getAuditTimeLast,DateUtil.dateIncreaseByMonth(DateUtil.getCurrentDateTime(),CommonConstants.THREE_INT_NEGATE))
.eq(TEmployeeContractInfo::getDeleteFlag,CommonConstants.ZERO_STRING));
// 获取所有未审核通过的合同数据
List<TEmployeeContractInfo> notAccessList = contractInfoMapper.selectList(Wrappers.<TEmployeeContractInfo>query()
.lambda().ne(TEmployeeContractInfo::getAuditStatus,CommonConstants.TWO_STRING)
.eq(TEmployeeContractInfo::getWorkFlag,CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getDeleteFlag,CommonConstants.ZERO_STRING));
Map<String,TEmpContractAlert> alertMap = new HashMap<>();
if (Common.isNotNull(alertList)){
LocalDate now = LocalDate.now();
Date nowDate = new Date();
for (TEmployeeContractInfo contract:alertList){
extracted(now, nowDate, contract,alertMap);
}
}
if (Common.isNotNull(notAccessList) && Common.isNotNull(alertMap)){
TEmpContractAlert exist;
for (TEmployeeContractInfo contract:notAccessList){
exist = alertMap.get(contract.getEmpIdcard());
if (Common.isNotNull(exist)){
exist.setHandleStatus(CommonConstants.ONE_STRING);
alertMap.put(exist.getEmpIdcard(),exist);
}
}
}
if (Common.isNotNull(alertMap)){
this.saveBatch(alertMap.values());
}
return R.ok();
}
private void extracted(LocalDate now, Date nowDate,
TEmployeeContractInfo contract,
Map<String,TEmpContractAlert> alertMap) {
TEmpContractAlert alert = alertMap.get(contract.getEmpIdcard());
// 存在多个审核通过的数据 用最新的审核通过的合同覆盖已有的
if (Common.isNotNull(alert) &&
alert.getContractEnd().after(LocalDateTimeUtils.convertLDToDate(contract.getContractEnd()))){
return;
}
alert = new TEmpContractAlert();
alert.setAlertPerson(contract.getCreateName());
alert.setEmpName(contract.getEmpName());
alert.setEmpId(contract.getEmpId());
alert.setProject(contract.getSubjectDepart());
alert.setProjectNo(contract.getDeptNo());
alert.setEmpIdcard(contract.getEmpIdcard());
alert.setContractStart(LocalDateTimeUtils.convertLDToDate(contract.getContractStart()));
alert.setContractEnd(LocalDateTimeUtils.convertLDToDate(contract.getContractEnd()));
alert.setFileProvince(Integer.toString(contract.getFileProvince()));
alert.setFileCity(Integer.toString(contract.getFileCity()));
alert.setFileTown(Integer.toString(contract.getFileTown()));
alert.setEmpType(contract.getEmpNatrue());
alert.setContractTerm(contract.getContractType());
alert.setContractTerm(contract.getContractTerm());
if (Common.isNotNull(contract.getContractEnd()) && contract.getContractEnd().isBefore(now)){
alert.setDueFlag(CommonConstants.ONE_STRING);
alert.setDaysOver(DateUtil.daysBetween(nowDate,alert.getContractEnd()));
}else {
alert.setDaysDue(DateUtil.daysBetween(alert.getContractEnd(), nowDate));
alert.setDueFlag(CommonConstants.ZERO_STRING);
}
alert.setFirstAlertTime(DateUtil.dateIncreaseByMonth(alert.getContractEnd(),CommonConstants.THREE_INT_NEGATE));
alert.setHandleStatus(CommonConstants.ZERO_STRING);
alertMap.put(alert.getEmpIdcard(),alert);
}
}
......@@ -51,4 +51,7 @@
<result property="createTime" column="CREATE_TIME"/>
<result property="updateTime" column="UPDATE_TIME"/>
</resultMap>
<update id="truncate">
TRUNCATE t_emp_contract_alert
</update>
</mapper>
......@@ -299,4 +299,22 @@ public interface CommonConstants {
* 失败颜色
*/
String RED = "red";
/**
* 数字int -1
* @author fxj
*/
int ONE_INT_NEGATE = -1;
/**
* 数字int -1
* @author fxj
*/
int TWO_INT_NEGATE = -2;
/**
* 数字int -1
* @author fxj
*/
int THREE_INT_NEGATE = -3;
}
package com.yifu.cloud.plus.v1.yifu.common.dapr.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
/**
* @Author fxj
* @Date 2022/7/4
* @Description
* @Version 1.0
*/
@Data
@Component
@PropertySource("classpath:daprConfig.properties")
@ConfigurationProperties(value = "dapr.archives", ignoreInvalidFields = false)
public class DaprArchivesProperties {
/*
* @author fxj
* @date 14:34
* @Description dapr sidercar url 如:http://localhost:3005/v1.0/invoke/
**/
String appUrl;
/*
* @author fxj
* @date 14:35
* @decription app_id 如:"yifu_upms_sider"
**/
String appId;
String appPort;
String httpPort;
String grpcPort;
String metricsPort;
}
package com.yifu.cloud.plus.v1.job.compont;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprUpmsProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @Author fxj
* @Date 2022/7/4
* @Description 定时任务生成续签代办提醒
* @Version 1.0
*/
@Component(value = "createContractAlertTask")
@Slf4j
@EnableConfigurationProperties(DaprArchivesProperties.class)
public class CreateContractAlertTask {
@Autowired
private DaprArchivesProperties daprArchivesProperties;
/**
* @Author fxj
* @Description
* @Date 10:49 2022/6/15
* @Param
* @return
**/
public void createContractAlertTask() {
log.info("------------定时任务生成续签代办提醒-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/tempcontractalert/inner/taskCreateContractAlert","", Object.class, SecurityConstants.FROM_IN);
log.info("------------定时任务生成续签代办提醒-定时任务结束------------");
}
}
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