Commit a6545edc authored by hongguangwu's avatar hongguangwu

MVP1.7.17-商险待续签

parent 7e265cac
......@@ -33,6 +33,7 @@ import com.yifu.cloud.plus.v1.yifu.common.dapr.util.MenuUtil;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.TInsuranceAlertSearchVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
......@@ -87,6 +88,12 @@ public class TEmpContractAlertController {
setAuth(searchVo);
return R.ok(tEmpContractAlertService.getAutoPage(page, searchVo));
}
@Operation(description = "合同待续签数量查询")
@PostMapping("/getAutoContractCount")
public R<Long> getAutoContractCount(@RequestBody ContractAlertSearchVo searchVo) {
setAuth(searchVo);
return R.ok(tEmpContractAlertService.getAutoContractCount(searchVo));
}
/**
* 不分页查询
* @param searchVo 员工合同续签待办
......
......@@ -41,7 +41,10 @@ import java.util.List;
public interface TEmpContractAlertService extends IService<TEmpContractAlert> {
IPage<TEmpContractAlert> pageDiy(Page page, ContractAlertSearchVo searchVo);
// 给自动化用的-合同待续签-分页查询
IPage<TEmpContractAlert> getAutoPage(Page page, ContractAlertSearchVo searchVo);
// 合同待续签数量查询
long getAutoContractCount(ContractAlertSearchVo searchVo);
List<TEmpContractAlert> listDiy(ContractAlertSearchVo searchVo);
......
......@@ -122,6 +122,26 @@ public class TEmpContractAlertServiceImpl extends ServiceImpl<TEmpContractAlertM
}
return baseMapper.selectPage(page,wrapper);
}
@Override
public long getAutoContractCount(ContractAlertSearchVo searchVo) {
List<String> deptList = tAutoMainRelMapper.getAutoDeptNo();
LambdaQueryWrapper<TEmpContractAlert> wrapper = buildQueryWrapper(searchVo);
wrapper.isNotNull(TEmpContractAlert::getId);
if (deptList != null && !deptList.isEmpty()) {
wrapper.in(TEmpContractAlert::getProjectNo, deptList);
}
if (Common.isNotNull(searchVo.getContractEndStart())){
wrapper.ge(TEmpContractAlert::getContractEnd,searchVo.getContractEndStart());
}
if (Common.isNotNull(searchVo.getContractEndEnd())){
wrapper.le(TEmpContractAlert::getContractEnd,searchVo.getContractEndEnd());
}
if (Common.isNotNull(searchVo.getAuthSql())) {
wrapper.last(searchVo.getAuthSql());
}
return baseMapper.selectCount(wrapper);
}
@Override
public IPage<TEmpContractAlert> pageDiy(Page page, ContractAlertSearchVo searchVo) {
LambdaQueryWrapper<TEmpContractAlert> wrapper = buildQueryWrapper(searchVo);
......
......@@ -16,6 +16,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Sets;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.admin.api.vo.SysUserListVo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.archives.vo.*;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
......@@ -30,6 +32,7 @@ import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.*;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.ekp.constant.EkpConstants;
import com.yifu.cloud.plus.v1.yifu.insurances.config.WxConfig;
import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.*;
import com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.*;
......@@ -53,9 +56,11 @@ import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
......@@ -144,6 +149,18 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Resource
private TInsuranceWarnMapper tInsuranceWarnMapper;
@Resource
private TInsurancePreRenewDetailQwService tInsurancePreRenewDetailQwService;
@Resource
private TInsurancePreRenewDetailQwDetailService tInsurancePreRenewDetailQwDetailService;
@Autowired
private UpmsDaprUtils upmsDaprUtils;
@Autowired
private WxConfig wxConfig;
/***********************商险办理********************************/
/**
* 每日定时刷新商险到期数据
......@@ -1161,7 +1178,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
detailList.add(detail);
updateEmployeeInsurancePreById(detail, Stream.of("3").collect(Collectors.toList()),CommonConstants.FOUR_STRING);
updateEmployeeInsurancePreRenewById(detail, Stream.of("3").collect(Collectors.toList()),CommonConstants.FOUR_STRING);
updateEmployeeInsurancePreRenewById(detail, Stream.of("3").collect(Collectors.toList()),CommonConstants.FOUR_STRING, false);
}
}
}
......@@ -1327,7 +1344,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
detailList.add(detail);
updateEmployeeInsurancePreById(detail, Stream.of("3").collect(Collectors.toList()),CommonConstants.FOUR_STRING);
updateEmployeeInsurancePreRenewById(detail, Stream.of("3").collect(Collectors.toList()),CommonConstants.FOUR_STRING);
updateEmployeeInsurancePreRenewById(detail, Stream.of("3").collect(Collectors.toList()),CommonConstants.FOUR_STRING, false);
}
}
}
......@@ -1629,7 +1646,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
});
updateEmployeeInsurancePreById(detail,Stream.of("3","4","6").collect(Collectors.toList()),CommonConstants.FIVE_STRING);
updateEmployeeInsurancePreRenewById(detail,Stream.of("3","4","6").collect(Collectors.toList()),CommonConstants.FIVE_STRING);
updateEmployeeInsurancePreRenewById(detail,Stream.of("3","4","6").collect(Collectors.toList()),CommonConstants.FIVE_STRING, true);
}
//更新状态
this.updateBatchById(successList);
......@@ -1758,7 +1775,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detail.setPolicyEffect(LocalDate.now().plusDays(CommonConstants.ONE_INT));
successOne.add(detail);
updateEmployeeInsurancePreById(detail, Stream.of("4").collect(Collectors.toList()),CommonConstants.SIX_STRING);
updateEmployeeInsurancePreRenewById(detail, Stream.of("4").collect(Collectors.toList()),CommonConstants.SIX_STRING);
updateEmployeeInsurancePreRenewById(detail, Stream.of("4").collect(Collectors.toList()),CommonConstants.SIX_STRING, false);
//查找被替换人信息
one = tInsuranceReplaceService.getOne(Wrappers.<TInsuranceReplace>query().lambda()
......@@ -1816,7 +1833,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detail.setDefaultSettleId(settle.getId());
successTwo.add(detail);
updateEmployeeInsurancePreById(detail, Stream.of("4").collect(Collectors.toList()),CommonConstants.SIX_STRING);
updateEmployeeInsurancePreRenewById(detail, Stream.of("4").collect(Collectors.toList()),CommonConstants.SIX_STRING);
updateEmployeeInsurancePreRenewById(detail, Stream.of("4").collect(Collectors.toList()),CommonConstants.SIX_STRING, false);
//生成收入数据
createInsuranceInfo(detail,settleDomain);
}else {
......@@ -1854,7 +1871,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detail.setDefaultSettleId(settle.getId());
successTwo.add(detail);
updateEmployeeInsurancePreById(detail, Stream.of("4").collect(Collectors.toList()),CommonConstants.SIX_STRING);
updateEmployeeInsurancePreRenewById(detail, Stream.of("4").collect(Collectors.toList()),CommonConstants.SIX_STRING);
updateEmployeeInsurancePreRenewById(detail, Stream.of("4").collect(Collectors.toList()),CommonConstants.SIX_STRING, false);
//生成收入数据
createInsuranceInfo(detail,settleDomain);
}
......@@ -1875,7 +1892,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detail.setUpdateBy(user.getId());
successOne.add(detail);
updateEmployeeInsurancePreById(detail, Stream.of("4").collect(Collectors.toList()),CommonConstants.SIX_STRING);
updateEmployeeInsurancePreRenewById(detail, Stream.of("4").collect(Collectors.toList()),CommonConstants.SIX_STRING);
updateEmployeeInsurancePreRenewById(detail, Stream.of("4").collect(Collectors.toList()),CommonConstants.SIX_STRING, false);
}
}
}
......@@ -8798,7 +8815,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
// hgw-3商险待续签-商险各个入口更新待购买列表状态更新
private void updateEmployeeInsurancePreRenewById(TInsuranceDetail insuranceDetail,List<String> preStatusList,String status) {
// handleFailToSendQwFlag - 办理失败发送企微
private void updateEmployeeInsurancePreRenewById(TInsuranceDetail insuranceDetail, List<String> preStatusList
, String status, boolean handleFailToSendQwFlag) {
TInsurancePreRenewDetail pre = tInsurancePreRenewDetailMapper.selectOne(Wrappers.<TInsurancePreRenewDetail>query().lambda()
.eq(TInsurancePreRenewDetail::getInsurancesIdNew,insuranceDetail.getId())
.in(TInsurancePreRenewDetail::getProcessStatus,preStatusList)
......@@ -8806,6 +8825,103 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (Common.isNotNull(pre)) {
pre.setProcessStatus(status);
tInsurancePreRenewDetailMapper.updateById(pre);
if (handleFailToSendQwFlag) {
handleFailToSendQw(pre.getCustomerUserLoginname(), pre.getCustomerUsername(), pre.getId(), pre.getEmpName()
, pre.getEmpIdcardNo(), insuranceDetail.getBackRemark());
}
}
}
/**
* @Description: 自动化续签的商险办理失败,发送企微
* @Author: hgw
* @Date: 2025/11/19 18:02
* @return: void
**/
private void handleFailToSendQw(String customerUserLoginname, String customerUsername, String preRenewId, String empName
, String empIdCard, String errorrMessage) {
TInsurancePreRenewDetailQw qw = new TInsurancePreRenewDetailQw();
String qwUuId = String.valueOf(UUID.randomUUID()).replace("-", "");
qw.setId(qwUuId);
qw.setCreateTime(LocalDateTime.now());
qw.setCustomerUserLoginname(customerUserLoginname);
qw.setCustomerUsername(customerUsername);
qw.setDescription("张三-" + empIdCard + ",商险续保办理失败 <br>请及时处理,以免产生用工风险!");
// 派单失败,组装需要推送企微的明细
TInsurancePreRenewDetailQwDetail qwDetail = new TInsurancePreRenewDetailQwDetail();
qwDetail.setPreId(preRenewId);
qwDetail.setMainId(qwUuId);
qwDetail.setEmpName(empName);
qwDetail.setEmpIdcard(empIdCard);
qwDetail.setErrorInfo(errorrMessage);
qwDetail.setErrorTime(LocalDateTime.now());
tInsurancePreRenewDetailQwService.save(qw);
tInsurancePreRenewDetailQwDetailService.save(qwDetail);
if (Common.isNotNull(customerUserLoginname)) {
Map<String, String> sysUserMap = getUserQiWeiInfo(customerUserLoginname);
String qwInfo;
if (!sysUserMap.isEmpty()) {
qwInfo = sysUserMap.get(customerUserLoginname);
if (Common.isNotNull(qwInfo)) {
sendMessageToWx(qwInfo, qw.getDescription(), qw.getId());
}
}
}
}
/**
* @param userLoginNames 登录名,逗号拼接
* @Description: 获取客服的企微信息
* @Author: hgw
* @Date: 2025/8/8 17:59
* @return: java.util.Map<java.lang.String, java.lang.String>
**/
private Map<String, String> getUserQiWeiInfo(String userLoginNames) {
Map<String, String> sysUserMap = new HashMap<>();
// 获取项目对应的前端客服用户信息--客服账号需要正常
if (Common.isNotKong(userLoginNames)) {
R<SysUserListVo> res = upmsDaprUtils.getUserIdsByUserNames(userLoginNames);
List<SysUser> users = null;
if (Common.isNotNull(res) && Common.isNotNull(res.getData()) && Common.isNotNull(res.getData().getUserList())) {
users = res.getData().getUserList();
}
if (Common.isNotKong(users)) {
for (SysUser user : users) {
if (Common.isNotNull(user.getWxMessage())) {
sysUserMap.put(user.getUsername(), user.getWxMessage());
}
}
}
}
return sysUserMap;
}
//发送企业微信待办
private void sendMessageToWx(String useruserWx, String content, String mainId) {
if (Common.isEmpty(useruserWx) || Common.isEmpty(content)) {
return;
}
StringBuilder sendUser = null;
if (Common.isNotKong(useruserWx)) {
sendUser = new StringBuilder(useruserWx);
}
if (sendUser != null) {
RestTemplate restTemplate = new RestTemplate();
Map<String, Object> requestMap = new HashMap<>();
Map<String, Object> textcard = new HashMap<>();
textcard.put("title", "【作业自动化——商险续保办理失败提醒】");
textcard.put("url", String.format(SecurityConstants.WX_GET_MESSAGE_AUTH_URL, wxConfig.getCorpid(), wxConfig.getDomainName() + "/auth/oauth/wxLogin", "77" + mainId));
textcard.put("description", content);
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);
}
}
}
}
......@@ -391,7 +391,6 @@ public class TInsurancePreRenewDetailServiceImpl extends ServiceImpl<TInsuranceP
errorMessageMap.put(info.getInsurancePreRenewId(), info.getErrorMessage());
}
Map<String, Set<String>> deptNumMap = new HashMap<>();
Map<String, Integer> allNumMap = new HashMap<>();
Map<String, Integer> failNumMap = new HashMap<>();
Map<String, TInsurancePreRenewDetailQw> preQwMap = new HashMap<>();
......@@ -400,7 +399,6 @@ public class TInsurancePreRenewDetailServiceImpl extends ServiceImpl<TInsuranceP
TInsurancePreRenewDetail updatePre;
LocalDateTime now = LocalDateTime.now();
String errorrMessage;
Set<String> tempSet;
Integer nums;
String customerUserLoginname;
......@@ -411,14 +409,6 @@ public class TInsurancePreRenewDetailServiceImpl extends ServiceImpl<TInsuranceP
for (TInsurancePreRenewDetail pre : insurancePreList) {
customerUserLoginname = pre.getCustomerUserLoginname();
if (Common.isNotNull(customerUserLoginname)) {
tempSet = deptNumMap.get(customerUserLoginname);
if (tempSet == null) {
tempSet = new HashSet<>();
}
tempSet.add(pre.getDeptNo());
deptNumMap.put(customerUserLoginname, tempSet);
}
updatePre = new TInsurancePreRenewDetail();
updatePre.setId(pre.getId());
String qwUuId;
......@@ -483,7 +473,6 @@ public class TInsurancePreRenewDetailServiceImpl extends ServiceImpl<TInsuranceP
// pushQiWeiFlag 推送企微的flag,true表示推送企微
if (pushQiWeiFlag && !preQwMap.isEmpty()) {
List<TInsurancePreRenewDetailQw> qwList = new ArrayList<>();
int deptNum;
int allNum;
int failNum;
StringBuilder description;
......@@ -496,12 +485,6 @@ public class TInsurancePreRenewDetailServiceImpl extends ServiceImpl<TInsuranceP
userLoginNames = customerUserLoginname;
}
qw = entry.getValue();
tempSet = deptNumMap.get(customerUserLoginname);
if (Common.isNotNull(tempSet)) {
deptNum = tempSet.size();
} else {
deptNum = 0;
}
allNum = allNumMap.get(customerUserLoginname);
if (Common.isEmpty(allNum)) {
allNum = 0;
......@@ -510,8 +493,8 @@ public class TInsurancePreRenewDetailServiceImpl extends ServiceImpl<TInsuranceP
if (Common.isEmpty(failNum)) {
failNum = 0;
}
description = new StringBuilder("项目数:").append(deptNum).append("个;自动化派单人数:")
.append(allNum).append("个,【失败人数:").append(failNum).append("个】<br>请及时至HRO系统处理,以免人员漏保!");
description = new StringBuilder("商险派单数:").append(allNum).append("份,【失败份数:").append(failNum)
.append("份】<br>点击查看详情!<br>请及时至HRO系统处理,以免耽误购买进度!");
qw.setDescription(description.toString());
qwList.add(qw);
}
......@@ -649,7 +632,7 @@ public class TInsurancePreRenewDetailServiceImpl extends ServiceImpl<TInsuranceP
RestTemplate restTemplate = new RestTemplate();
Map<String, Object> requestMap = new HashMap<>();
Map<String, Object> textcard = new HashMap<>();
textcard.put("title", "【商险自动化派单——失败提醒】");
textcard.put("title", "【作业自动化——商险续保发起失败提醒】");
textcard.put("url", String.format(SecurityConstants.WX_GET_MESSAGE_AUTH_URL, wxConfig.getCorpid(), wxConfig.getDomainName() + "/auth/oauth/wxLogin", "76" + mainId));
textcard.put("description", content);
requestMap.put("touser", sendUser);
......
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