Commit a29790bb authored by huyuchen's avatar huyuchen

huych-社保自动化相关提交

parent 77dd2305
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class CustomerExpiringStatistics implements Serializable {
private String customerUserLoginname;
private int expiringCount = 0;
}
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class CustomerRevokeStatistics implements Serializable {
private String customerUserLoginname;
private int revokedCount = 0;
}
package com.yifu.cloud.plus.v1.yifu.archives.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class CustomerStatistics implements Serializable {
private String customerUserLoginname;
private String customerUsername;
private int initiatedCount = 0;
private int failedCount = 0;
private int electronicSignFailedCount = 0;
private int offlineSignFailedCount = 0;
}
...@@ -5,6 +5,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute; ...@@ -5,6 +5,7 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex; import com.yifu.cloud.plus.v1.yifu.common.core.vo.RowIndex;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Length;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -344,6 +345,14 @@ public class TDispatchInfoPreVo extends RowIndex implements Serializable { ...@@ -344,6 +345,14 @@ public class TDispatchInfoPreVo extends RowIndex implements Serializable {
@Schema(description = "合同签署状态 0已签署 1未签署") @Schema(description = "合同签署状态 0已签署 1未签署")
@ExcelProperty("合同签署状态") @ExcelProperty("合同签署状态")
private String contractStatus; private String contractStatus;
/**
* 就职岗位
*/
@Length(max = 50, message = "就职岗位 不能超过50 个字符")
@ExcelAttribute(name = "就职岗位", maxLength = 50)
@Schema(description = "就职岗位")
@ExcelProperty("就职岗位")
private String position;
/** /**
* 合同id * 合同id
*/ */
......
...@@ -248,4 +248,40 @@ public class TEmployeeContractPreController { ...@@ -248,4 +248,40 @@ public class TEmployeeContractPreController {
public Boolean checkContractPreIsExit(@RequestBody EmpProjectStatusVo vo) { public Boolean checkContractPreIsExit(@RequestBody EmpProjectStatusVo vo) {
return tEmployeeContractPreService.checkContractPreIsExit(vo); return tEmployeeContractPreService.checkContractPreIsExit(vo);
} }
/**
* @Description: 每日晚23:00自动撤销超时电子签署任务
* @Author: huych
* @Date: 2025-10-15
* @return: R
**/
@Inner
@PostMapping("/inner/autoRevokeElectronicSign")
public R autoRevokeElectronicSign() {
return tEmployeeContractPreService.autoRevokeElectronicSign();
}
/**
* @Description: 每日早9点通知前端客服前一日撤销电子签署情况
* @Author: huych
* @Date: 2025-10-15
* @return: R
**/
@Inner
@PostMapping("/inner/notifyRevokedElectronicSign")
public R notifyRevokedElectronicSign() {
return tEmployeeContractPreService.notifyRevokedElectronicSign();
}
/**
* @Description: 每日早9点电子签合同即将超期提醒
* @Author: huych
* @Date: 2025-10-15
* @return: R
**/
@Inner
@PostMapping("/inner/electronicSignExpiringReminder")
public R electronicSignExpiringReminder() {
return tEmployeeContractPreService.electronicSignExpiringReminder();
}
} }
...@@ -79,4 +79,22 @@ public interface TEmployeeContractPreService extends IService<TEmployeeContractP ...@@ -79,4 +79,22 @@ public interface TEmployeeContractPreService extends IService<TEmployeeContractP
Boolean checkContractPreIsExit(EmpProjectStatusVo vo); Boolean checkContractPreIsExit(EmpProjectStatusVo vo);
/**
* 每日晚23:00自动撤销超时电子签署任务
* @return R
*/
R autoRevokeElectronicSign();
/**
* 每日早9点通知前端客服前一日撤销电子签署情况
* @return R
*/
R notifyRevokedElectronicSign();
/**
* 每日早9点电子签合同即将超期提醒
* @return R
*/
R electronicSignExpiringReminder();
} }
...@@ -21,6 +21,7 @@ import com.fasc.open.api.exception.ApiException; ...@@ -21,6 +21,7 @@ import com.fasc.open.api.exception.ApiException;
import com.fasc.open.api.v5_1.res.template.SignTemplateListInfo; import com.fasc.open.api.v5_1.res.template.SignTemplateListInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*; import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.FddContractInfoMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.FddContractInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractPreMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.*; import com.yifu.cloud.plus.v1.yifu.archives.service.*;
import com.yifu.cloud.plus.v1.yifu.archives.utils.FascUtil; import com.yifu.cloud.plus.v1.yifu.archives.utils.FascUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
...@@ -49,7 +50,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr ...@@ -49,7 +50,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
private final TFascPushLogService tFascPushLogService; private final TFascPushLogService tFascPushLogService;
private final TFascTemplateService tFascTemplateService; private final TFascTemplateService tFascTemplateService;
private final TFascTemplateDetailService tFascTemplateDetailService; private final TFascTemplateDetailService tFascTemplateDetailService;
private final TEmployeeContractPreService tEmployeeContractPreService; private final TEmployeeContractPreMapper tEmployeeContractPreMapper;
@Override @Override
public R<String> getTemplate(String templateName) throws ApiException { public R<String> getTemplate(String templateName) throws ApiException {
...@@ -170,7 +171,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr ...@@ -170,7 +171,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
@Override @Override
public R<String> submitContract(String id) throws ApiException { public R<String> submitContract(String id) throws ApiException {
// templateName 签署任务模板名称 // templateName 签署任务模板名称
TEmployeeContractPre contract = tEmployeeContractPreService.getById(id); TEmployeeContractPre contract = tEmployeeContractPreMapper.selectById(id);
if (contract == null) { if (contract == null) {
return R.failed("未找到合同"); return R.failed("未找到合同");
} }
...@@ -194,7 +195,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr ...@@ -194,7 +195,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
} }
// TODO - 判断是否入职超过1个月 // TODO - 判断是否入职超过1个月
R<String> requestInfo = fascUtil.submitContract(contract, tFascPushLogService, tEmployeeContractPreService); R<String> requestInfo = fascUtil.submitContract(contract, tFascPushLogService, tEmployeeContractPreMapper);
return requestInfo; return requestInfo;
} }
...@@ -209,7 +210,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr ...@@ -209,7 +210,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
@Override @Override
public R<String> cancelTask(String id) throws ApiException { public R<String> cancelTask(String id) throws ApiException {
// templateName 签署任务模板名称 // templateName 签署任务模板名称
TEmployeeContractPre contract = tEmployeeContractPreService.getById(id); TEmployeeContractPre contract = tEmployeeContractPreMapper.selectById(id);
if (contract == null) { if (contract == null) {
return R.failed("未找到合同"); return R.failed("未找到合同");
} }
...@@ -218,7 +219,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr ...@@ -218,7 +219,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
} }
// TODO - 判断什么状态撤销等,需要产品定 // TODO - 判断什么状态撤销等,需要产品定
return fascUtil.cancelTask(contract, tFascPushLogService, tEmployeeContractPreService); return fascUtil.cancelTask(contract, tFascPushLogService, tEmployeeContractPreMapper);
} }
...@@ -232,7 +233,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr ...@@ -232,7 +233,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
@Override @Override
public R<String> urgeTask(String id) throws ApiException { public R<String> urgeTask(String id) throws ApiException {
// templateName 签署任务模板名称 // templateName 签署任务模板名称
TEmployeeContractPre contract = tEmployeeContractPreService.getById(id); TEmployeeContractPre contract = tEmployeeContractPreMapper.selectById(id);
if (contract == null) { if (contract == null) {
return R.failed("未找到合同"); return R.failed("未找到合同");
} }
...@@ -241,7 +242,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr ...@@ -241,7 +242,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
} }
// TODO - 判断什么状态催办等,需要产品定 // TODO - 判断什么状态催办等,需要产品定
return fascUtil.urgeTask(contract, tFascPushLogService, tEmployeeContractPreService); return fascUtil.urgeTask(contract, tFascPushLogService, tEmployeeContractPreMapper);
} }
......
...@@ -22,8 +22,10 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; ...@@ -22,8 +22,10 @@ import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*; import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.SocialDaprUtils;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.UpmsDaprUtils; import com.yifu.cloud.plus.v1.yifu.common.dapr.util.UpmsDaprUtils;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils; import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.social.vo.TEmployeeInsuranceWorkDayVo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -55,6 +57,8 @@ public class TEmployeeContractPreServiceImpl extends ServiceImpl<TEmployeeContra ...@@ -55,6 +57,8 @@ public class TEmployeeContractPreServiceImpl extends ServiceImpl<TEmployeeContra
private final TEmployeeContractAuditService tEmployeeContractAuditService; private final TEmployeeContractAuditService tEmployeeContractAuditService;
private final FascService fascService;
@Autowired @Autowired
private final TEmployeeContractInfoService contractInfoService; private final TEmployeeContractInfoService contractInfoService;
...@@ -66,6 +70,9 @@ public class TEmployeeContractPreServiceImpl extends ServiceImpl<TEmployeeContra ...@@ -66,6 +70,9 @@ public class TEmployeeContractPreServiceImpl extends ServiceImpl<TEmployeeContra
@Lazy @Lazy
private final TAttaInfoService attaInfoService; private final TAttaInfoService attaInfoService;
@Autowired
private SocialDaprUtils socialDaprUtils;
/** /**
* 合同待签订任务记录表简单分页查询 * 合同待签订任务记录表简单分页查询
...@@ -277,18 +284,129 @@ public class TEmployeeContractPreServiceImpl extends ServiceImpl<TEmployeeContra ...@@ -277,18 +284,129 @@ public class TEmployeeContractPreServiceImpl extends ServiceImpl<TEmployeeContra
if (Common.isEmpty(contractPreList)) { if (Common.isEmpty(contractPreList)) {
return R.failed(CommonConstants.NO_DATA_TO_HANDLE); return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
} }
// 创建一个Map映射preId到TEmployeeContractPre对象
Map<String, TEmployeeContractPre> preContractMap = contractPreList.stream()
.collect(Collectors.toMap(TEmployeeContractPre::getId, pre -> pre));
//发起派单 //发起派单
List<ErrorMessage> errorMessageListAll = new ArrayList<>(); List<ErrorMessage> errorMessageListAll = new ArrayList<>();
List<EmployeeContractVO> excelVOList = baseMapper.getDisPatcherContractList(idList,CommonConstants.socialInfoStatus,type); List<EmployeeContractVO> excelVOList = baseMapper.getDisPatcherContractList(idList,CommonConstants.socialInfoStatus,type);
// 拆分电子签和线下签
List<EmployeeContractVO> electronicSignList = new ArrayList<>();
List<EmployeeContractVO> offlineSignList = new ArrayList<>();
if (Common.isNotNull(excelVOList) && !excelVOList.isEmpty()) { if (Common.isNotNull(excelVOList) && !excelVOList.isEmpty()) {
for (EmployeeContractVO contractVO : excelVOList) {
TEmployeeContractPre contractPre = preContractMap.get(contractVO.getPreId());
if (contractPre != null && "0".equals(contractPre.getSignType())) {
// 电子签
electronicSignList.add(contractVO);
} else {
// 线下签
offlineSignList.add(contractVO);
}
}
}
// 按前端客服分组统计
Map<String, CustomerStatistics> customerStatisticsMap = new HashMap<>();
// 处理电子签合同
if (!electronicSignList.isEmpty()) {
LocalDate currentDate = LocalDate.now();
for (EmployeeContractVO contractVO : electronicSignList) {
TEmployeeContractPre contractPre = preContractMap.get(contractVO.getPreId());
if (contractPre != null && contractPre.getJoinLeaveDate() != null) {
// 获取或创建客服统计信息
String customerLoginName = contractPre.getCustomerUserLoginname();
CustomerStatistics customerStats = customerStatisticsMap.computeIfAbsent(customerLoginName, k -> {
CustomerStatistics stats = new CustomerStatistics();
stats.setCustomerUserLoginname(customerLoginName);
stats.setCustomerUsername(contractPre.getCustomerUsername());
return stats;
});
customerStats.setInitiatedCount(customerStats.getInitiatedCount() + 1);
LocalDate joinDate = LocalDateTimeUtils.convertDateToLDT(contractPre.getJoinLeaveDate()).toLocalDate();
// 判断是否超过入职日期一个月
if (currentDate.isAfter(joinDate.plusMonths(1))) {
// 超过一个月,算电子签发起失败
customerStats.setFailedCount(customerStats.getFailedCount() + 1);
customerStats.setElectronicSignFailedCount(customerStats.getElectronicSignFailedCount() + 1);
// 更新processStatus为电子签发起失败
LambdaUpdateWrapper<TEmployeeContractPre> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TEmployeeContractPre::getId, contractPre.getId())
.set(TEmployeeContractPre::getProcessStatus, CommonConstants.FIVE_STRING)
.set(TEmployeeContractPre::getErrorInfo, "电子签发起失败:已超过入职日期一个月")
.set(TEmployeeContractPre::getSignType, CommonConstants.ONE_STRING)
.set(TEmployeeContractPre::getErrorTime, LocalDateTimeUtils.convertLDToDate(LocalDate.now()));
this.update(updateWrapper);
// 添加错误信息
ErrorMessage<EmployeeContractVO> errorMessage = new ErrorMessage<>(contractVO.getRowIndex(), "电子签发起失败:已超过入职日期一个月");
errorMessage.setData(contractVO);
errorMessageListAll.add(errorMessage);
} else {
// 未超过一个月,调用FascService的submitContract方法
R<String> result = null;
try {
result = fascService.submitContract(contractPre.getId());
} catch (Exception e) {
log.error("法大大推送执行异常", e);
}
if (result == null || result.getCode() != CommonConstants.SUCCESS) {
customerStats.setFailedCount(customerStats.getFailedCount() + 1);
customerStats.setElectronicSignFailedCount(customerStats.getElectronicSignFailedCount() + 1);
String errorMsg = result != null ? result.getMsg() : "电子签发起失败";
// 更新processStatus为电子签发起失败
LambdaUpdateWrapper<TEmployeeContractPre> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TEmployeeContractPre::getId, contractPre.getId())
.set(TEmployeeContractPre::getProcessStatus, CommonConstants.SIX_STRING)
.set(TEmployeeContractPre::getErrorInfo, errorMsg)
.set(TEmployeeContractPre::getErrorTime, LocalDateTimeUtils.convertLDToDate(LocalDate.now()));
this.update(updateWrapper);
// 添加错误信息
ErrorMessage<EmployeeContractVO> errorMessage = new ErrorMessage<>(contractVO.getRowIndex(), errorMsg);
errorMessage.setData(contractVO);
errorMessageListAll.add(errorMessage);
}
}
}
}
}
// 处理线下签合同(走原逻辑)
if (!offlineSignList.isEmpty()) {
// 统计线下签的发起数量
for (EmployeeContractVO contractVO : offlineSignList) {
TEmployeeContractPre contractPre = preContractMap.get(contractVO.getPreId());
if (contractPre != null) {
String customerLoginName = contractPre.getCustomerUserLoginname();
CustomerStatistics customerStats = customerStatisticsMap.computeIfAbsent(customerLoginName, k -> {
CustomerStatistics stats = new CustomerStatistics();
stats.setCustomerUserLoginname(customerLoginName);
stats.setCustomerUsername(contractPre.getCustomerUsername());
return stats;
});
customerStats.setInitiatedCount(customerStats.getInitiatedCount() + 1);
}
}
List<EmployeeContractVO> disList; List<EmployeeContractVO> disList;
int k = 0; int k = 0;
int i = (int) Math.ceil((double) excelVOList.size() / CommonConstants.INTEGER_HUNDRED); int i = (int) Math.ceil((double) offlineSignList.size() / CommonConstants.INTEGER_HUNDRED);
for (int j = 0; j < i; j++) { for (int j = 0; j < i; j++) {
if (j == i - 1) { if (j == i - 1) {
disList = excelVOList.subList(k, excelVOList.size()); disList = offlineSignList.subList(k, offlineSignList.size());
} else { } else {
disList = excelVOList.subList(k, k + 100); disList = offlineSignList.subList(k, k + 100);
} }
k = k + 100; k = k + 100;
if (Common.isNotNull(disList)) { if (Common.isNotNull(disList)) {
...@@ -301,6 +419,21 @@ public class TEmployeeContractPreServiceImpl extends ServiceImpl<TEmployeeContra ...@@ -301,6 +419,21 @@ public class TEmployeeContractPreServiceImpl extends ServiceImpl<TEmployeeContra
for (ErrorMessage errorMessage : errorMessageList) { for (ErrorMessage errorMessage : errorMessageList) {
if (!errorMessage.getMessage().equals(CommonConstants.SAVE_SUCCESS)) { if (!errorMessage.getMessage().equals(CommonConstants.SAVE_SUCCESS)) {
EmployeeContractVO contractVO = disList.stream().filter(vo -> Objects.equals(vo.getRowIndex(), errorMessage.getLineNum())).collect(Collectors.toList()).get(0); EmployeeContractVO contractVO = disList.stream().filter(vo -> Objects.equals(vo.getRowIndex(), errorMessage.getLineNum())).collect(Collectors.toList()).get(0);
// 获取合同预签订信息以便统计
TEmployeeContractPre contractPre = preContractMap.get(contractVO.getPreId());
if (contractPre != null) {
String customerLoginName = contractPre.getCustomerUserLoginname();
CustomerStatistics customerStats = customerStatisticsMap.computeIfAbsent(customerLoginName, key -> {
CustomerStatistics stats = new CustomerStatistics();
stats.setCustomerUserLoginname(customerLoginName);
stats.setCustomerUsername(contractPre.getCustomerUsername());
return stats;
});
customerStats.setFailedCount(customerStats.getFailedCount() + 1);
customerStats.setOfflineSignFailedCount(customerStats.getOfflineSignFailedCount() + 1);
}
LambdaUpdateWrapper<TEmployeeContractPre> updateWrapper = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<TEmployeeContractPre> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.in(TEmployeeContractPre::getId, contractVO.getPreId()) updateWrapper.in(TEmployeeContractPre::getId, contractVO.getPreId())
.in(TEmployeeContractPre::getProcessStatus, CommonConstants.socialInfoStatus) .in(TEmployeeContractPre::getProcessStatus, CommonConstants.socialInfoStatus)
...@@ -316,6 +449,25 @@ public class TEmployeeContractPreServiceImpl extends ServiceImpl<TEmployeeContra ...@@ -316,6 +449,25 @@ public class TEmployeeContractPreServiceImpl extends ServiceImpl<TEmployeeContra
} }
} }
} }
if ("2".equals(type)) {
// 为每个前端客服发送企微消息
for (Map.Entry<String, CustomerStatistics> entry : customerStatisticsMap.entrySet()) {
CustomerStatistics stats = entry.getValue();
if (stats.getFailedCount() > 0 && Common.isNotNull(stats.getCustomerUserLoginname())) {
// 生成客服个人的汇总信息
String customerSummaryInfo = String.format("合同签署发起总数:%d份,失败总数:%d份;\n" +
"电子签失败份数:%d份,线下签失败份数:%d份",
stats.getInitiatedCount(),
stats.getFailedCount(),
stats.getElectronicSignFailedCount(),
stats.getOfflineSignFailedCount());
// 发送企微消息
sendFailueMessageToWx(stats.getCustomerUserLoginname(), customerSummaryInfo);
}
}
}
return R.ok(errorMessageListAll); return R.ok(errorMessageListAll);
} }
...@@ -489,6 +641,47 @@ public class TEmployeeContractPreServiceImpl extends ServiceImpl<TEmployeeContra ...@@ -489,6 +641,47 @@ public class TEmployeeContractPreServiceImpl extends ServiceImpl<TEmployeeContra
} }
} }
//发送企业微信待办
private void sendFailueMessageToWx(String loginName,String summary) {
//获取前端客服
SysUser user;
if (Common.isEmpty(loginName)) {
return;
}
R<SysUser> res = upmsDaprUtils.getSimpleUserByLoginName(loginName);
if (Common.isNotNull(res) && Common.isNotNull(res.getData())) {
user = res.getData();
} else {
return;
}
StringBuilder sendUser = null;
if (Common.isNotKong(user.getWxMessage())) {
sendUser = new StringBuilder(user.getWxMessage());
}
if (sendUser != null) {
RestTemplate restTemplate = new RestTemplate();
Map<String, Object> requestMap = new HashMap<>();
Map<String, Object> textcard = new HashMap<>();
String authUrl = String.format(SecurityConstants.WX_GET_MESSAGE_AUTH_URL, wxConfig.getCorpid(), wxConfig.getDomainName() + "/auth/oauth/wxLogin", "69" + loginName);
StringBuilder description = new StringBuilder();
String title = "作业自动化——合同签署发起失败提醒";
description.append(summary).append("<br>");
description.append("请及时至HRO系统处理,以免耽误签署进度!").append("<br>");
textcard.put("title", title);
textcard.put("url", authUrl);
textcard.put("description", description.toString());
requestMap.put("touser", sendUser);
requestMap.put("agentid", wxConfig.getAgentid());
requestMap.put("msgtype", "textcard");
requestMap.put("textcard", textcard);
// 必须加上header说明
if (!wxConfig.sendTextCard(restTemplate, requestMap)) {
wxConfig.sendTextCard(restTemplate, requestMap);
}
}
}
public boolean haveRole(YifuUser user, long roleId) { public boolean haveRole(YifuUser user, long roleId) {
List<Long> roleList = user.getClientRoleMap().get(ClientNameConstants.CLIENT_MVP); List<Long> roleList = user.getClientRoleMap().get(ClientNameConstants.CLIENT_MVP);
for (Long role : roleList) { for (Long role : roleList) {
...@@ -498,4 +691,338 @@ public class TEmployeeContractPreServiceImpl extends ServiceImpl<TEmployeeContra ...@@ -498,4 +691,338 @@ public class TEmployeeContractPreServiceImpl extends ServiceImpl<TEmployeeContra
} }
return false; return false;
} }
@Override
public R autoRevokeElectronicSign() {
try {
// 查询符合条件的合同:状态为"签署中"(6) 且 为电子签任务(signType=0) 且 入职日期到当日正好一个月
LocalDate currentDate = LocalDate.now();
LocalDate oneMonthAgo = currentDate.minusMonths(1);
List<TEmployeeContractPre> contractsToRevoke = baseMapper.selectList(Wrappers.<TEmployeeContractPre>query()
.lambda()
.eq(TEmployeeContractPre::getProcessStatus, CommonConstants.SIX_STRING) // 签署中
.eq(TEmployeeContractPre::getSignType, CommonConstants.ZERO_STRING) // 电子签
.eq(TEmployeeContractPre::getJoinLeaveDate, LocalDateTimeUtils.convertLDToDate(oneMonthAgo)) // 入职日期正好一个月前
);
if (Common.isEmpty(contractsToRevoke)) {
return R.ok("未找到需要撤销的超时电子签署任务");
}
for (TEmployeeContractPre contractPre : contractsToRevoke) {
try {
// 调用法大大撤销签署接口
R<String> revokeResult = fascService.cancelTask(contractPre.getId());
if (revokeResult.getCode() == 200) {
// 撤销成功:状态更新为"待发起"(1) 且 签署方式变更为"线下签"(1)
LambdaUpdateWrapper<TEmployeeContractPre> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TEmployeeContractPre::getId, contractPre.getId())
.set(TEmployeeContractPre::getProcessStatus, CommonConstants.ONE_STRING) // 待发起
.set(TEmployeeContractPre::getSignType, CommonConstants.ONE_STRING) // 线下签
.set(TEmployeeContractPre::getRevokeReason, "超时未签署自行变更为线下签");
this.update(updateWrapper);
TEmployeeContractAudit audit = new TEmployeeContractAudit();
audit.setRootName("撤销签署");
audit.setLinkId(contractPre.getContractId());
audit.setLinkType(CommonConstants.ONE_INT);
tEmployeeContractAuditService.save(audit);
} else if ("已完成签署".equals(revokeResult.getMsg())) {
// 撤销失败原因为已完成签署:更新为签署完成的"待归档"状态(8)
LambdaUpdateWrapper<TEmployeeContractPre> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TEmployeeContractPre::getId, contractPre.getId())
.set(TEmployeeContractPre::getProcessStatus, CommonConstants.EIGHT_STRING); // 电子待归档
this.update(updateWrapper);
} else {
// 其他撤销失败原因
log.error("合同ID:{},撤销失败,原因:{}", contractPre.getId(), revokeResult.getMsg());
}
} catch (Exception e) {
log.error("处理合同ID:{}时发生异常", contractPre.getId(), e);
}
}
return R.ok();
} catch (Exception e) {
log.error("执行自动撤销超时电子签署任务时发生异常", e);
return R.failed("执行自动撤销超时电子签署任务时发生异常:" + e.getMessage());
}
}
@Override
public R notifyRevokedElectronicSign() {
try {
// 通过审计表查询前一日的撤销记录
LocalDate yesterday = LocalDate.now().minusDays(1);
Date yesterdayStart = LocalDateTimeUtils.convertLDToDate(yesterday);
Date yesterdayEnd = LocalDateTimeUtils.convertLDToDate(yesterday.plusDays(1));
// 查询前一日的撤销审计记录
List<TEmployeeContractAudit> yesterdayAudits = tEmployeeContractAuditService.list(Wrappers.<TEmployeeContractAudit>query()
.lambda()
.eq(TEmployeeContractAudit::getRootName, "撤销签署")
.eq(TEmployeeContractAudit::getLinkType, CommonConstants.ONE_INT)
.ge(TEmployeeContractAudit::getCreateTime, yesterdayStart)
.lt(TEmployeeContractAudit::getCreateTime, yesterdayEnd)
);
if (Common.isEmpty(yesterdayAudits)) {
return R.ok("前一日未发现撤销的电子签署任务");
}
// 根据审计记录获取对应的合同ID列表
List<String> contractIds = yesterdayAudits.stream()
.map(TEmployeeContractAudit::getLinkId)
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (Common.isEmpty(contractIds)) {
return R.ok("前一日撤销记录中未找到有效的合同ID");
}
// 根据合同ID查询对应的合同预签订记录
List<TEmployeeContractPre> revokedContracts = baseMapper.selectList(Wrappers.<TEmployeeContractPre>query()
.lambda()
.in(TEmployeeContractPre::getContractId, contractIds)
.eq(TEmployeeContractPre::getProcessStatus, CommonConstants.ONE_STRING) // 待发起
.eq(TEmployeeContractPre::getSignType, CommonConstants.ONE_STRING) // 线下签
.eq(TEmployeeContractPre::getRevokeReason, "超时未签署自行变更为线下签")
);
if (Common.isEmpty(revokedContracts)) {
return R.ok("前一日未发现撤销的电子签署任务");
}
// 按前端客服分组统计
Map<String, CustomerRevokeStatistics> customerStatsMap = new HashMap<>();
for (TEmployeeContractPre contract : revokedContracts) {
String customerLoginName = contract.getCustomerUserLoginname();
if (Common.isNotNull(customerLoginName)) {
CustomerRevokeStatistics stats = customerStatsMap.computeIfAbsent(customerLoginName, k -> {
CustomerRevokeStatistics newStats = new CustomerRevokeStatistics();
newStats.setCustomerUserLoginname(customerLoginName);
return newStats;
});
stats.setRevokedCount(stats.getRevokedCount() + 1);
}
}
// 为每个前端客服发送通知
for (Map.Entry<String, CustomerRevokeStatistics> entry : customerStatsMap.entrySet()) {
CustomerRevokeStatistics stats = entry.getValue();
if (stats.getRevokedCount() > 0 && Common.isNotNull(stats.getCustomerUserLoginname())) {
// 生成通知内容
String notificationContent = String.format("距离入职日期已超过1个月,仍未完成合同签署(%d人),系统已自动撤回签署任务,点击可查看具体撤回清单",
stats.getRevokedCount());
// 发送企微通知
sendRevokeNotificationToWx(stats.getCustomerUserLoginname(), notificationContent);
}
}
return R.ok();
} catch (Exception e) {
log.error("执行通知前端客服撤销电子签署情况任务时发生异常", e);
return R.failed("执行通知前端客服撤销电子签署情况任务时发生异常:" + e.getMessage());
}
}
/**
* 发送撤销通知到企微
* @param loginName 客服登录名
* @param content 通知内容
*/
private void sendRevokeNotificationToWx(String loginName, String content) {
//获取前端客服
SysUser user;
if (Common.isEmpty(loginName)) {
return;
}
R<SysUser> res = upmsDaprUtils.getSimpleUserByLoginName(loginName);
if (Common.isNotNull(res) && Common.isNotNull(res.getData())) {
user = res.getData();
} else {
return;
}
StringBuilder sendUser = null;
if (Common.isNotKong(user.getWxMessage())) {
sendUser = new StringBuilder(user.getWxMessage());
}
if (sendUser != null) {
RestTemplate restTemplate = new RestTemplate();
Map<String, Object> requestMap = new HashMap<>();
Map<String, Object> textcard = new HashMap<>();
String authUrl = String.format(SecurityConstants.WX_GET_MESSAGE_AUTH_URL, wxConfig.getCorpid(), wxConfig.getDomainName() + "/auth/oauth/wxLogin", "71" + loginName);
StringBuilder description = new StringBuilder();
String title = "作业自动化——电子合同签署超期自动撤回提醒";
description.append(content).append("<br>");
description.append("请及时进行线下签署,以免产生用工风险!").append("<br>");
textcard.put("title", title);
textcard.put("url", authUrl);
textcard.put("description", description.toString());
requestMap.put("touser", sendUser);
requestMap.put("agentid", wxConfig.getAgentid());
requestMap.put("msgtype", "textcard");
requestMap.put("textcard", textcard);
// 必须加上header说明
if (!wxConfig.sendTextCard(restTemplate, requestMap)) {
wxConfig.sendTextCard(restTemplate, requestMap);
}
}
}
@Override
public R electronicSignExpiringReminder() {
try {
LocalDate today = LocalDate.now();
// 查询所有状态为"签署中"(6)且为电子签(signType=0)的合同
List<TEmployeeContractPre> signingContracts = baseMapper.selectList(Wrappers.<TEmployeeContractPre>query()
.lambda()
.eq(TEmployeeContractPre::getProcessStatus, CommonConstants.SIX_STRING) // 签署中
.eq(TEmployeeContractPre::getSignType, CommonConstants.ZERO_STRING) // 电子签
);
if (Common.isEmpty(signingContracts)) {
return R.ok("未找到签署中的电子签合同");
}
// 按前端客服分组统计需要提醒的合同
Map<String, CustomerExpiringStatistics> customerStatsMap = new HashMap<>();
for (TEmployeeContractPre contract : signingContracts) {
if (contract.getJoinLeaveDate() != null) {
// 计算入职一个月的最后一天
LocalDate joinDate = LocalDateTimeUtils.convertDateToLDT(contract.getJoinLeaveDate()).toLocalDate();
LocalDate lastDayOfMonth = joinDate.plusMonths(1);
// 计算往前3个工作日
List<LocalDate> reminderDates = calculateReminderWorkDays(lastDayOfMonth);
// 判断今天是否是提醒日期之一
if (reminderDates.contains(today)) {
String customerLoginName = contract.getCustomerUserLoginname();
if (Common.isNotNull(customerLoginName)) {
CustomerExpiringStatistics stats = customerStatsMap.computeIfAbsent(customerLoginName, k -> {
CustomerExpiringStatistics newStats = new CustomerExpiringStatistics();
newStats.setCustomerUserLoginname(customerLoginName);
return newStats;
});
stats.setExpiringCount(stats.getExpiringCount() + 1);
}
}
}
}
// 为每个前端客服发送提醒
for (Map.Entry<String, CustomerExpiringStatistics> entry : customerStatsMap.entrySet()) {
CustomerExpiringStatistics stats = entry.getValue();
if (stats.getExpiringCount() > 0 && Common.isNotNull(stats.getCustomerUserLoginname())) {
// 生成提醒内容
String reminderContent = String.format("距离入职1个月还剩3天,仍未签署合同的员工数:%d人",
stats.getExpiringCount());
// 发送企微提醒
sendExpiringReminderToWx(stats.getCustomerUserLoginname(), reminderContent);
}
}
return R.ok();
} catch (Exception e) {
log.error("执行电子签合同即将超期提醒任务时发生异常", e);
return R.failed("执行电子签合同即将超期提醒任务时发生异常:" + e.getMessage());
}
}
/**
* 计算入职一个月最后一天往前3个工作日的日期列表
* @param lastDay 入职一个月的最后一天
* @return 3个工作日的日期列表
*/
private List<LocalDate> calculateReminderWorkDays(LocalDate lastDay) {
List<LocalDate> reminderDates = new ArrayList<>();
LocalDate currentDate = lastDay;
int workDayCount = 0;
// 往前找3个工作日
while (workDayCount < 3) {
// 检查当前日期是否为工作日
if (isWorkDay(currentDate)) {
reminderDates.add(currentDate);
workDayCount++;
}
// 往前一天
currentDate = currentDate.minusDays(1);
}
// 按日期正序排列(最早的日期在前)
Collections.reverse(reminderDates);
return reminderDates;
}
/**
* 判断指定日期是否为工作日
* @param date 要检查的日期
* @return true-工作日,false-非工作日
*/
private boolean isWorkDay(LocalDate date) {
TEmployeeInsuranceWorkDayVo workDayVo = new TEmployeeInsuranceWorkDayVo();
workDayVo.setRegistDate(LocalDateTimeUtils.convertLDToDate(date));
// 使用THolidayInfoService的checkIsWorkDay方法判断是否为假期
// 如果是假期则不是工作日,否则是工作日
R<Boolean> res = socialDaprUtils.checkIsWorkDay(workDayVo);
return !res.getData();
}
/**
* 发送即将超期提醒到企微
* @param loginName 客服登录名
* @param content 提醒内容
*/
private void sendExpiringReminderToWx(String loginName, String content) {
//获取前端客服
SysUser user;
if (Common.isEmpty(loginName)) {
return;
}
R<SysUser> res = upmsDaprUtils.getSimpleUserByLoginName(loginName);
if (Common.isNotNull(res) && Common.isNotNull(res.getData())) {
user = res.getData();
} else {
return;
}
StringBuilder sendUser = null;
if (Common.isNotKong(user.getWxMessage())) {
sendUser = new StringBuilder(user.getWxMessage());
}
if (sendUser != null) {
RestTemplate restTemplate = new RestTemplate();
Map<String, Object> requestMap = new HashMap<>();
Map<String, Object> textcard = new HashMap<>();
String authUrl = String.format(SecurityConstants.WX_GET_MESSAGE_AUTH_URL, wxConfig.getCorpid(), wxConfig.getDomainName() + "/auth/oauth/wxLogin", "70" + loginName);
StringBuilder description = new StringBuilder();
String title = "作业自动化——合同签署超期提醒";
description.append(content).append("<br>");
description.append("请及时提醒员工,尽快完成法大大签署任务!").append("<br>");
textcard.put("title", title);
textcard.put("url", authUrl);
textcard.put("description", description.toString());
requestMap.put("touser", sendUser);
requestMap.put("agentid", wxConfig.getAgentid());
requestMap.put("msgtype", "textcard");
requestMap.put("textcard", textcard);
// 必须加上header说明
if (!wxConfig.sendTextCard(restTemplate, requestMap)) {
wxConfig.sendTextCard(restTemplate, requestMap);
}
}
}
} }
...@@ -26,7 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractPre; ...@@ -26,7 +26,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeContractPre;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascPushLog; import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascPushLog;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascTemplate; import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascTemplate;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascTemplateDetail; import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascTemplateDetail;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeContractPreService; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractPreMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TFascPushLogService; import com.yifu.cloud.plus.v1.yifu.archives.service.TFascPushLogService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
...@@ -313,7 +313,7 @@ public class FascUtil { ...@@ -313,7 +313,7 @@ public class FascUtil {
} }
public R<String> submitContract(TEmployeeContractPre contract, TFascPushLogService tFascPushLogService public R<String> submitContract(TEmployeeContractPre contract, TFascPushLogService tFascPushLogService
, TEmployeeContractPreService tEmployeeContractPreService) throws ApiException { , TEmployeeContractPreMapper tEmployeeContractPreMapper) throws ApiException {
OpenApiClient openApiClient = new OpenApiClient(fascConfig.getAppId(), fascConfig.getAppSecret(), fascConfig.getAppUrl()); OpenApiClient openApiClient = new OpenApiClient(fascConfig.getAppId(), fascConfig.getAppSecret(), fascConfig.getAppUrl());
String accessToken = this.getFascToken(openApiClient); String accessToken = this.getFascToken(openApiClient);
OpenId openId = new OpenId(); OpenId openId = new OpenId();
...@@ -364,7 +364,7 @@ public class FascUtil { ...@@ -364,7 +364,7 @@ public class FascUtil {
sendValue = submitTask(requestId, openApiClient, accessToken); sendValue = submitTask(requestId, openApiClient, accessToken);
if (R.isSuccess(sendValue)) { if (R.isSuccess(sendValue)) {
// 电子签签署中 // 电子签签署中
this.doSuccessContract(contract, tEmployeeContractPreService, requestId); this.doSuccessContract(contract, tEmployeeContractPreMapper, requestId);
return R.ok(); return R.ok();
} else { } else {
msg = "第三步失败:提交任务失败:" + sendValue.getMsg(); msg = "第三步失败:提交任务失败:" + sendValue.getMsg();
...@@ -376,24 +376,24 @@ public class FascUtil { ...@@ -376,24 +376,24 @@ public class FascUtil {
msg = "第一步失败:" + res.getMsg(); msg = "第一步失败:" + res.getMsg();
} }
} }
this.doFailContract(contract, tEmployeeContractPreService, msg); this.doFailContract(contract, tEmployeeContractPreMapper, msg);
return R.failed(msg); return R.failed(msg);
} }
// 发起失败,更新合同状态 // 发起失败,更新合同状态
private void doFailContract(TEmployeeContractPre contract, TEmployeeContractPreService tEmployeeContractPreService, String msg) { private void doFailContract(TEmployeeContractPre contract, TEmployeeContractPreMapper tEmployeeContractPreMapper, String msg) {
contract.setProcessStatus(CommonConstants.dingleDigitStrArray[7]); contract.setProcessStatus(CommonConstants.dingleDigitStrArray[7]);
contract.setRequestMsg(msg); contract.setRequestMsg(msg);
tEmployeeContractPreService.updateById(contract); tEmployeeContractPreMapper.updateById(contract);
} }
// 发起成功,更新合同状态 // 发起成功,更新合同状态
private void doSuccessContract(TEmployeeContractPre contract, TEmployeeContractPreService tEmployeeContractPreService, String requestId) { private void doSuccessContract(TEmployeeContractPre contract, TEmployeeContractPreMapper tEmployeeContractPreMapper, String requestId) {
// 电子签签署中 // 电子签签署中
contract.setProcessStatus(CommonConstants.dingleDigitStrArray[6]); contract.setProcessStatus(CommonConstants.dingleDigitStrArray[6]);
contract.setRequestId(requestId); contract.setRequestId(requestId);
contract.setRequestMsg(""); contract.setRequestMsg("");
tEmployeeContractPreService.updateById(contract); tEmployeeContractPreMapper.updateById(contract);
} }
// 第二步:填写控件 // 第二步:填写控件
...@@ -524,7 +524,7 @@ public class FascUtil { ...@@ -524,7 +524,7 @@ public class FascUtil {
// 撤销签署 // 撤销签署
public R<String> cancelTask(TEmployeeContractPre contract, TFascPushLogService tFascPushLogService public R<String> cancelTask(TEmployeeContractPre contract, TFascPushLogService tFascPushLogService
, TEmployeeContractPreService tEmployeeContractPreService) throws ApiException { , TEmployeeContractPreMapper tEmployeeContractPreMapper) throws ApiException {
OpenApiClient openApiClient = new OpenApiClient(fascConfig.getAppId(), fascConfig.getAppSecret(), fascConfig.getAppUrl()); OpenApiClient openApiClient = new OpenApiClient(fascConfig.getAppId(), fascConfig.getAppSecret(), fascConfig.getAppUrl());
String accessToken = this.getFascToken(openApiClient); String accessToken = this.getFascToken(openApiClient);
...@@ -551,7 +551,7 @@ public class FascUtil { ...@@ -551,7 +551,7 @@ public class FascUtil {
contract.setProcessStatus(CommonConstants.dingleDigitStrArray[1]); contract.setProcessStatus(CommonConstants.dingleDigitStrArray[1]);
contract.setSignType(CommonConstants.dingleDigitStrArray[1]); contract.setSignType(CommonConstants.dingleDigitStrArray[1]);
contract.setRequestMsg(""); contract.setRequestMsg("");
tEmployeeContractPreService.updateById(contract); tEmployeeContractPreMapper.updateById(contract);
return R.ok(); return R.ok();
} else { } else {
// 撤销签署失败原因为 已完成签署(处理的同时员工完成签署公司免验证签完成),则更新为签署完成的“待归档”状态。 // 撤销签署失败原因为 已完成签署(处理的同时员工完成签署公司免验证签完成),则更新为签署完成的“待归档”状态。
...@@ -560,7 +560,7 @@ public class FascUtil { ...@@ -560,7 +560,7 @@ public class FascUtil {
contract.setRevokeReason(FascConstants.TIME_OUT_REASON); contract.setRevokeReason(FascConstants.TIME_OUT_REASON);
} }
contract.setRequestMsg(res.getMsg()); contract.setRequestMsg(res.getMsg());
tEmployeeContractPreService.updateById(contract); tEmployeeContractPreMapper.updateById(contract);
return R.failed(res.getMsg()); return R.failed(res.getMsg());
} }
} }
...@@ -570,7 +570,7 @@ public class FascUtil { ...@@ -570,7 +570,7 @@ public class FascUtil {
// 催办 // 催办
public R<String> urgeTask(TEmployeeContractPre contract, TFascPushLogService tFascPushLogService public R<String> urgeTask(TEmployeeContractPre contract, TFascPushLogService tFascPushLogService
, TEmployeeContractPreService tEmployeeContractPreService) throws ApiException { , TEmployeeContractPreMapper tEmployeeContractPreMapper) throws ApiException {
OpenApiClient openApiClient = new OpenApiClient(fascConfig.getAppId(), fascConfig.getAppSecret(), fascConfig.getAppUrl()); OpenApiClient openApiClient = new OpenApiClient(fascConfig.getAppId(), fascConfig.getAppSecret(), fascConfig.getAppUrl());
String accessToken = this.getFascToken(openApiClient); String accessToken = this.getFascToken(openApiClient);
...@@ -599,7 +599,7 @@ public class FascUtil { ...@@ -599,7 +599,7 @@ public class FascUtil {
return R.ok(); return R.ok();
} else { } else {
contract.setRequestMsg(res.getMsg()); contract.setRequestMsg(res.getMsg());
tEmployeeContractPreService.updateById(contract); tEmployeeContractPreMapper.updateById(contract);
return R.failed(res.getMsg()); return R.failed(res.getMsg());
} }
} }
......
...@@ -1713,6 +1713,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr ...@@ -1713,6 +1713,7 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
preVo.setJoinLeaveDate(registration.getJoinLeaveDate()); preVo.setJoinLeaveDate(registration.getJoinLeaveDate());
preVo.setDeptNo(registration.getDeptNo()); preVo.setDeptNo(registration.getDeptNo());
preVo.setEmpName(registration.getEmployeeName()); preVo.setEmpName(registration.getEmployeeName());
preVo.setPosition(registration.getPosition());
preVo.setEmpIdcard(registration.getEmpIdcard()); preVo.setEmpIdcard(registration.getEmpIdcard());
preVo.setCreateBy(user.getId()); preVo.setCreateBy(user.getId());
preVo.setCreateName(user.getNickname()); preVo.setCreateName(user.getNickname());
......
...@@ -123,4 +123,49 @@ public class ArchiveTask { ...@@ -123,4 +123,49 @@ public class ArchiveTask {
log.info("-------------每天刷新合同续签待待办信息到微信-定时任务结束------------"); log.info("-------------每天刷新合同续签待待办信息到微信-定时任务结束------------");
} }
/**
* @Author huych
* @Description 每日晚23:00自动撤销超时电子签署任务
* @Date 2025-10-15
* @Param
* @return
**/
public void autoRevokeElectronicSignTask() {
log.info("-------------每日晚23:00自动撤销超时电子签署任务-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(), daprArchivesProperties.getAppId(),
"/temployeecontractpre/inner/autoRevokeElectronicSign", "", Object.class,
SecurityConstants.FROM_IN);
log.info("-------------每日晚23:00自动撤销超时电子签署任务-定时任务结束------------");
}
/**
* @Author huych
* @Description 每日早9点通知前端客服前一日撤销电子签署情况
* @Date 2025-10-15
* @Param
* @return
**/
public void notifyRevokedElectronicSignTask() {
log.info("-------------每日早9点通知前端客服前一日撤销电子签署情况-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(), daprArchivesProperties.getAppId(),
"/temployeecontractpre/inner/notifyRevokedElectronicSign", "", Object.class,
SecurityConstants.FROM_IN);
log.info("-------------每日早9点通知前端客服前一日撤销电子签署情况-定时任务结束------------");
}
/**
* @Author huych
* @Description 每日早9点电子签合同即将超期提醒
* @Date 2025-10-15
* @Param
* @return
**/
public void electronicSignExpiringReminderTask() {
log.info("-------------每日早9点电子签合同即将超期提醒-定时任务开始------------");
HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(), daprArchivesProperties.getAppId(),
"/temployeecontractpre/inner/electronicSignExpiringReminder", "", Object.class,
SecurityConstants.FROM_IN);
log.info("-------------每日早9点电子签合同即将超期提醒-定时任务结束------------");
}
} }
\ No newline at end of file
...@@ -404,4 +404,13 @@ public class TDispatchInfoPre extends BaseEntity { ...@@ -404,4 +404,13 @@ public class TDispatchInfoPre extends BaseEntity {
@Schema(description = "0未删除1删除") @Schema(description = "0未删除1删除")
private String deleteFlag; private String deleteFlag;
/**
* 就职岗位
*/
@Length(max = 50, message = "就职岗位 不能超过50 个字符")
@ExcelAttribute(name = "就职岗位", maxLength = 50)
@Schema(description = "就职岗位")
@ExcelProperty("就职岗位")
private String position;
} }
...@@ -148,8 +148,8 @@ public class TDispatchInfoPreController { ...@@ -148,8 +148,8 @@ public class TDispatchInfoPreController {
* @return * @return
*/ */
@Operation(description = "社保待购买数量查询") @Operation(description = "社保待购买数量查询")
@GetMapping("/getListCount") @PostMapping("/getListCount")
public R getListCount(TDispatchInfoPreSearchVo searchVo) { public R getListCount(@RequestBody TDispatchInfoPreSearchVo searchVo) {
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, searchVo); menuUtil.setAuthSql(user, searchVo);
return R.ok(tDispatchInfoPreService.getDispatchInfoCount(searchVo)); return R.ok(tDispatchInfoPreService.getDispatchInfoCount(searchVo));
......
...@@ -466,7 +466,7 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap ...@@ -466,7 +466,7 @@ public class TDispatchInfoPreServiceImpl extends ServiceImpl<TDispatchInfoPreMap
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
Map<String, Object> requestMap = new HashMap<>(); Map<String, Object> requestMap = new HashMap<>();
Map<String, Object> textcard = new HashMap<>(); Map<String, Object> textcard = new HashMap<>();
String authUrl = String.format(SecurityConstants.WX_GET_MESSAGE_AUTH_URL, wxConfig.getCorpid(), wxConfig.getDomainName() + "/auth/oauth/wxLogin", "05" + LoginName); String authUrl = String.format(SecurityConstants.WX_GET_MESSAGE_AUTH_URL, wxConfig.getCorpid(), wxConfig.getDomainName() + "/auth/oauth/wxLogin", "67" + LoginName);
StringBuilder description = new StringBuilder(); StringBuilder description = new StringBuilder();
String title = "作业自动化——社保派单发起失败提醒"; String title = "作业自动化——社保派单发起失败提醒";
description.append("社保派单数:").append(sum).append("份,失败份数:").append(falureNum).append("份;").append("<br>"); description.append("社保派单数:").append(sum).append("份,失败份数:").append(falureNum).append("份;").append("<br>");
......
...@@ -62,6 +62,7 @@ ...@@ -62,6 +62,7 @@
<result property="errorInfo" column="error_info"/> <result property="errorInfo" column="error_info"/>
<result property="errorBackInfo" column="error_back_info"/> <result property="errorBackInfo" column="error_back_info"/>
<result property="errorTime" column="error_time"/> <result property="errorTime" column="error_time"/>
<result property="position" column="position"/>
</resultMap> </resultMap>
<resultMap id="tDispatchInfoPreExportMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchInfoPreExportVo"> <resultMap id="tDispatchInfoPreExportMap" type="com.yifu.cloud.plus.v1.yifu.social.vo.TDispatchInfoPreExportVo">
...@@ -82,7 +83,7 @@ ...@@ -82,7 +83,7 @@
a.EMP_NAME, a.EMP_NAME,
a.EMP_IDCARD, a.EMP_IDCARD,
a.PROCESS_STATUS, a.PROCESS_STATUS,
a.SETTLE_DOMAIN, a.DEPT_ID,
a.SOCIAL_PROVINCE, a.SOCIAL_PROVINCE,
a.SOCIAL_CITY, a.SOCIAL_CITY,
a.SOCIAL_TOWN, a.SOCIAL_TOWN,
...@@ -130,24 +131,24 @@ ...@@ -130,24 +131,24 @@
a.CREATE_NAME, a.CREATE_NAME,
a.UPDATE_TIME, a.UPDATE_TIME,
a.CREATE_TIME, a.CREATE_TIME,
a.DELETE_FLAG,error_info,error_time,a.DISPATCHER_ID,a.error_back_info a.DELETE_FLAG,error_info,error_time,a.DISPATCHER_ID,a.error_back_info,a.position
</sql> </sql>
<sql id="tDispatchInfoPre_where"> <sql id="tDispatchInfoPre_where">
<if test="tDispatchInfoPre != null"> <if test="tDispatchInfoPre != null">
<if test="tDispatchInfoPre.id != null and tDispatchInfoPre.id.trim() != ''"> <if test="tDispatchInfoPre.id != null and tDispatchInfoPre.id.trim() != ''">
AND a.ID = #{tDispatchInfoPre.id} AND a.ID = #{tDispatchInfoPre.id}
</if> </if>
` <if test="tDispatchInfoPre.idList != null and tDispatchInfoPre.idList.size() > 0"> <if test="tDispatchInfoPre.idList != null and tDispatchInfoPre.idList.size() > 0">
and a.id in and a.id in
<foreach collection="tDispatchInfoPre.idList" item="param" index="index" open="(" close=")" <foreach collection="tDispatchInfoPre.idList" item="param" index="index" open="(" close=")"
separator=","> separator=",">
#{param} #{param}
</foreach> </foreach>
</if>` </if>
<if test="tDispatchInfoPre.statusList != null and tDispatchInfoPre.statusList.size() > 0"> <if test="tDispatchInfoPre.statusList != null and tDispatchInfoPre.statusList.size() > 0">
AND a.process_status in AND a.process_status in
<foreach item="item" index="index" collection="tDispatchInfoPre.statusList" open="(" separator="," close=")"> <foreach item="item" index="index" collection="tDispatchInfoPre.statusList" open="(" separator="," close=")">
'${item}' #{item}
</foreach> </foreach>
</if> </if>
<if test="tDispatchInfoPre.empName != null and tDispatchInfoPre.empName.trim() != ''"> <if test="tDispatchInfoPre.empName != null and tDispatchInfoPre.empName.trim() != ''">
...@@ -159,27 +160,7 @@ ...@@ -159,27 +160,7 @@
<if test="tDispatchInfoPre.processStatus != null and tDispatchInfoPre.processStatus.trim() != ''"> <if test="tDispatchInfoPre.processStatus != null and tDispatchInfoPre.processStatus.trim() != ''">
AND a.PROCESS_STATUS = #{tDispatchInfoPre.processStatus} AND a.PROCESS_STATUS = #{tDispatchInfoPre.processStatus}
</if> </if>
<if test="tDispatchInfoPre.settleDomain != null and tDispatchInfoPre.settleDomain.trim() != ''">
AND a.SETTLE_DOMAIN = #{tDispatchInfoPre.settleDomain}
</if>
<if test="tDispatchInfoPre.socialProvince != null and tDispatchInfoPre.socialProvince.trim() != ''">
AND a.SOCIAL_PROVINCE = #{tDispatchInfoPre.socialProvince}
</if>
<if test="tDispatchInfoPre.socialCity != null and tDispatchInfoPre.socialCity.trim() != ''">
AND a.SOCIAL_CITY = #{tDispatchInfoPre.socialCity}
</if>
<if test="tDispatchInfoPre.socialTown != null and tDispatchInfoPre.socialTown.trim() != ''">
AND a.SOCIAL_TOWN = #{tDispatchInfoPre.socialTown}
</if>
<if test="tDispatchInfoPre.fundProvince != null and tDispatchInfoPre.fundProvince.trim() != ''">
AND a.FUND_PROVINCE = #{tDispatchInfoPre.fundProvince}
</if>
<if test="tDispatchInfoPre.fundCity != null and tDispatchInfoPre.fundCity.trim() != ''">
AND a.FUND_CITY = #{tDispatchInfoPre.fundCity}
</if>
<if test="tDispatchInfoPre.fundTown != null and tDispatchInfoPre.fundTown.trim() != ''">
AND a.FUND_TOWN = #{tDispatchInfoPre.fundTown}
</if>
<if test="tDispatchInfoPre.deptName != null and tDispatchInfoPre.deptName.trim() != ''"> <if test="tDispatchInfoPre.deptName != null and tDispatchInfoPre.deptName.trim() != ''">
AND a.DEPT_NAME like CONCAT('%',#{tDispatchInfoPre.deptName},'%') AND a.DEPT_NAME like CONCAT('%',#{tDispatchInfoPre.deptName},'%')
</if> </if>
...@@ -204,11 +185,11 @@ ...@@ -204,11 +185,11 @@
<if test="tDispatchInfoPre.expectedCollectionTime != null"> <if test="tDispatchInfoPre.expectedCollectionTime != null">
AND DATE_FORMAT(a.EXPECTED_COLLECTION_TIME,'%Y-%m-%d') = CURDATE() AND DATE_FORMAT(a.EXPECTED_COLLECTION_TIME,'%Y-%m-%d') = CURDATE()
</if> </if>
<if test="tDispatchInfoPre.dispatcherTimeStart != null and tDispatchInfoPre.dispatcherTimeStart.trim() != ''"> <if test="tDispatchInfoPre.dispatcherTimeStart != null">
AND DATE_FORMAT(a.EXPECTED_COLLECTION_TIME,'%Y-%m-%d') <![CDATA[ >= ]]> #{tEmployeeInsurancePre.dispatcherTimeStart} AND DATE_FORMAT(a.EXPECTED_COLLECTION_TIME,'%Y-%m-%d') <![CDATA[ >= ]]> #{tDispatchInfoPre.dispatcherTimeStart}
</if> </if>
<if test="tDispatchInfoPre.dispatcherTimeEnd != null and tDispatchInfoPre.dispatcherTimeEnd.trim() != ''"> <if test="tDispatchInfoPre.dispatcherTimeEnd != null">
and DATE_FORMAT(a.EXPECTED_COLLECTION_TIME,'%Y-%m-%d') <![CDATA[ <= ]]> #{tEmployeeInsurancePre.dispatcherTimeEnd} and DATE_FORMAT(a.EXPECTED_COLLECTION_TIME,'%Y-%m-%d') <![CDATA[ <= ]]> #{tDispatchInfoPre.dispatcherTimeEnd}
</if> </if>
<if test="tDispatchInfoPre.expectedConfirmTime != null"> <if test="tDispatchInfoPre.expectedConfirmTime != null">
AND a.EXPECTED_CONFIRM_TIME = #{tDispatchInfoPre.expectedConfirmTime} AND a.EXPECTED_CONFIRM_TIME = #{tDispatchInfoPre.expectedConfirmTime}
...@@ -222,9 +203,6 @@ ...@@ -222,9 +203,6 @@
<if test="tDispatchInfoPre.contractStatus != null and tDispatchInfoPre.contractStatus.trim() != ''"> <if test="tDispatchInfoPre.contractStatus != null and tDispatchInfoPre.contractStatus.trim() != ''">
AND a.CONTRACT_STATUS = #{tDispatchInfoPre.contractStatus} AND a.CONTRACT_STATUS = #{tDispatchInfoPre.contractStatus}
</if> </if>
<if test="tDispatchInfoPre.failType != null and tDispatchInfoPre.failType.trim() != ''">
AND a.error_info is not null
</if>
<if test="tDispatchInfoPre.authSql != null and tDispatchInfoPre.authSql.trim() != ''"> <if test="tDispatchInfoPre.authSql != null and tDispatchInfoPre.authSql.trim() != ''">
${tDispatchInfoPre.authSql} ${tDispatchInfoPre.authSql}
</if> </if>
......
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