Commit 78dd39a9 authored by fangxinjiang's avatar fangxinjiang

短信模板替换-fxj

parent 303d8207
...@@ -60,7 +60,7 @@ import java.util.stream.Stream; ...@@ -60,7 +60,7 @@ import java.util.stream.Stream;
@Log4j2 @Log4j2
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
@EnableConfigurationProperties({DaprInsurancesProperties.class,DaprCheckProperties.class}) @EnableConfigurationProperties({DaprInsurancesProperties.class, DaprCheckProperties.class})
public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegistrationPreMapper, EmployeeRegistrationPre> implements EmployeeRegistrationPreService { public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegistrationPreMapper, EmployeeRegistrationPre> implements EmployeeRegistrationPreService {
private final DaprInsurancesProperties daprInsurancesProperties; private final DaprInsurancesProperties daprInsurancesProperties;
...@@ -106,6 +106,9 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -106,6 +106,9 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
@Lazy @Lazy
private ScheduleService scheduleService; private ScheduleService scheduleService;
@Autowired
SysConfigMapper sysConfigMapper;
/** /**
* 入职待建档表简单分页查询 * 入职待建档表简单分页查询
* @param employeeRegistrationPre 入职待建档表 * @param employeeRegistrationPre 入职待建档表
...@@ -119,79 +122,81 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -119,79 +122,81 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
&& !CommonConstants.THREE_STRING.equals(employeeRegistrationPre.getType())) { && !CommonConstants.THREE_STRING.equals(employeeRegistrationPre.getType())) {
employeeRegistrationPre.setStatusList(CommonConstants.processPreArchivesStatus); employeeRegistrationPre.setStatusList(CommonConstants.processPreArchivesStatus);
} }
return baseMapper.getEmployeeRegistrationPrePage(page,employeeRegistrationPre); return baseMapper.getEmployeeRegistrationPrePage(page, employeeRegistrationPre);
} }
/** /**
* 入职待建档表批量导出 * 入职待建档表批量导出
* @param searchVo 入职待建档表 *
* @return * @param searchVo 入职待建档表
*/ * @return
@Override */
public void listExport(HttpServletResponse response, EmployeeRegistrationPreSearchVo searchVo){ @Override
String fileName = "入职待建档表批量导出" + DateUtil.getThisTime() + ".xlsx"; public void listExport(HttpServletResponse response, EmployeeRegistrationPreSearchVo searchVo) {
//获取要导出的列表 String fileName = "入职待建档表批量导出" + DateUtil.getThisTime() + ".xlsx";
List<EmployeeRegistrationPreExportVo> list = new ArrayList<>(); //获取要导出的列表
List<EmployeeRegistrationPreExportVo> list = new ArrayList<>();
//权限赋值 //权限赋值
initSearchVo(searchVo); initSearchVo(searchVo);
if (Common.isEmpty(searchVo.getStatusList()) if (Common.isEmpty(searchVo.getStatusList())
&& !CommonConstants.THREE_STRING.equals(searchVo.getType())) { && !CommonConstants.THREE_STRING.equals(searchVo.getType())) {
searchVo.setStatusList(CommonConstants.processPreArchivesStatus); searchVo.setStatusList(CommonConstants.processPreArchivesStatus);
} }
long count = baseMapper.selectExportCount(searchVo); long count = baseMapper.selectExportCount(searchVo);
try (ServletOutputStream out= response.getOutputStream();){ try (ServletOutputStream out = response.getOutputStream();) {
response.setContentType(CommonConstants.MULTIPART_FORM_DATA); response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName , CommonConstants.UTF8)); response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭 // 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelUtil<EmployeeRegistrationPreExportVo> util = new ExcelUtil<>(EmployeeRegistrationPreExportVo.class); ExcelUtil<EmployeeRegistrationPreExportVo> util = new ExcelUtil<>(EmployeeRegistrationPreExportVo.class);
// 获取所有字典type // 获取所有字典type
Map<String,String> nameAndDicTypeMap = util.getConverterDicType(); Map<String, String> nameAndDicTypeMap = util.getConverterDicType();
// 获取所有字典对应的值 // 获取所有字典对应的值
Map<String,String> redisLabelMap = (Map<String, String>) RedisUtil.redis.opsForValue().get(CacheConstants.REDIS_DICT_LABLE); Map<String, String> redisLabelMap = (Map<String, String>) RedisUtil.redis.opsForValue().get(CacheConstants.REDIS_DICT_LABLE);
Set<String> exportFields = new HashSet<>(Arrays.asList("deptName", "deptNo", "employeeName", "empIdcard", Set<String> exportFields = new HashSet<>(Arrays.asList("deptName", "deptNo", "employeeName", "empIdcard",
"empPhone", "joinLeaveDate", "empNature", "contractType", "dataSource", "customerUsernameNew", "expectedCollectionTime", "processStatus")); "empPhone", "joinLeaveDate", "empNature", "contractType", "dataSource", "customerUsernameNew", "expectedCollectionTime", "processStatus"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭 // 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, EmployeeRegistrationPreExportVo.class) ExcelWriter excelWriter = EasyExcel.write(out, EmployeeRegistrationPreExportVo.class)
.registerConverter(new DictConverter(nameAndDicTypeMap,redisLabelMap)) .registerConverter(new DictConverter(nameAndDicTypeMap, redisLabelMap))
.includeColumnFieldNames(exportFields).build(); .includeColumnFieldNames(exportFields).build();
int index = 0; int index = 0;
if (count > CommonConstants.ZERO_INT){ if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) { for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录 // 获取实际记录
searchVo.setLimitStart(i); searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT); searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = baseMapper.selectExportList(searchVo); list = baseMapper.selectExportList(searchVo);
if (Common.isNotNull(list)){ if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcel.writerSheet("入职待建档表"+index).build(); WriteSheet writeSheet = EasyExcel.writerSheet("入职待建档表" + index).build();
excelWriter.write(list,writeSheet); excelWriter.write(list, writeSheet);
index++; index++;
} }
if (Common.isNotNull(list)){ if (Common.isNotNull(list)) {
list.clear(); list.clear();
} }
} }
}else { } else {
WriteSheet writeSheet = EasyExcel.writerSheet("入职待建档表"+index).build(); WriteSheet writeSheet = EasyExcel.writerSheet("入职待建档表" + index).build();
excelWriter.write(list,writeSheet); excelWriter.write(list, writeSheet);
} }
if (Common.isNotNull(list)){ if (Common.isNotNull(list)) {
list.clear(); list.clear();
} }
excelWriter.finish(); excelWriter.finish();
}catch (Exception e){ } catch (Exception e) {
log.error("执行异常" ,e); log.error("执行异常", e);
} }
} }
/** /**
* 入职确认信息批量导出 * 入职确认信息批量导出
*
* @param searchVo 入职待建档表 * @param searchVo 入职待建档表
* @return * @return
*/ */
@Override @Override
public void confirmExport(HttpServletResponse response, EmployeeRegistrationPreSearchVo searchVo){ public void confirmExport(HttpServletResponse response, EmployeeRegistrationPreSearchVo searchVo) {
String fileName = "入职确认信息批量导出" + DateUtil.getThisTime() + ".xlsx"; String fileName = "入职确认信息批量导出" + DateUtil.getThisTime() + ".xlsx";
//获取要导出的列表 //获取要导出的列表
List<EmployeeRegistrationPreInfoExportVo> list = new ArrayList<>(); List<EmployeeRegistrationPreInfoExportVo> list = new ArrayList<>();
...@@ -202,50 +207,50 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -202,50 +207,50 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
searchVo.setStatusList(CommonConstants.processPreArchivesStatus); searchVo.setStatusList(CommonConstants.processPreArchivesStatus);
} }
long count = baseMapper.selectExportCount(searchVo); long count = baseMapper.selectExportCount(searchVo);
try (ServletOutputStream out= response.getOutputStream();){ try (ServletOutputStream out = response.getOutputStream();) {
response.setContentType(CommonConstants.MULTIPART_FORM_DATA); response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName , CommonConstants.UTF8)); response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName, CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭 // 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelUtil<EmployeeRegistrationPreInfoExportVo> util = new ExcelUtil<>(EmployeeRegistrationPreInfoExportVo.class); ExcelUtil<EmployeeRegistrationPreInfoExportVo> util = new ExcelUtil<>(EmployeeRegistrationPreInfoExportVo.class);
// 获取所有字典type // 获取所有字典type
Map<String,String> nameAndDicTypeMap = util.getConverterDicType(); Map<String, String> nameAndDicTypeMap = util.getConverterDicType();
// 获取所有字典对应的值 // 获取所有字典对应的值
Map<String,String> redisLabelMap = (Map<String, String>) RedisUtil.redis.opsForValue().get(CacheConstants.REDIS_DICT_LABLE); Map<String, String> redisLabelMap = (Map<String, String>) RedisUtil.redis.opsForValue().get(CacheConstants.REDIS_DICT_LABLE);
Set<String> exportFields = new HashSet<>(Arrays.asList("deptName", "deptNo", "employeeName", "empIdcard", Set<String> exportFields = new HashSet<>(Arrays.asList("deptName", "deptNo", "employeeName", "empIdcard",
"empPhone", "position","joinLeaveDate", "confirmUser", "confirmTime", "serverItem", "empNature", "empPhone", "position", "joinLeaveDate", "confirmUser", "confirmTime", "serverItem", "empNature",
"contractType", "fileAdress")); "contractType", "fileAdress"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭 // 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, EmployeeRegistrationPreInfoExportVo.class) ExcelWriter excelWriter = EasyExcel.write(out, EmployeeRegistrationPreInfoExportVo.class)
.registerConverter(new DictConverter(nameAndDicTypeMap,redisLabelMap)) .registerConverter(new DictConverter(nameAndDicTypeMap, redisLabelMap))
.includeColumnFieldNames(exportFields).build(); .includeColumnFieldNames(exportFields).build();
int index = 0; int index = 0;
if (count > CommonConstants.ZERO_INT){ if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) { for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录 // 获取实际记录
searchVo.setLimitStart(i); searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT); searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = baseMapper.selectConfirmExportList(searchVo); list = baseMapper.selectConfirmExportList(searchVo);
if (Common.isNotNull(list)){ if (Common.isNotNull(list)) {
WriteSheet writeSheet = EasyExcel.writerSheet("入职确认信息表"+index).build(); WriteSheet writeSheet = EasyExcel.writerSheet("入职确认信息表" + index).build();
excelWriter.write(list,writeSheet); excelWriter.write(list, writeSheet);
index++; index++;
} }
if (Common.isNotNull(list)){ if (Common.isNotNull(list)) {
list.clear(); list.clear();
} }
} }
}else { } else {
WriteSheet writeSheet = EasyExcel.writerSheet("入职确认信息表"+index).build(); WriteSheet writeSheet = EasyExcel.writerSheet("入职确认信息表" + index).build();
excelWriter.write(list,writeSheet); excelWriter.write(list, writeSheet);
} }
if (Common.isNotNull(list)){ if (Common.isNotNull(list)) {
list.clear(); list.clear();
} }
excelWriter.finish(); excelWriter.finish();
}catch (Exception e){ } catch (Exception e) {
log.error("执行异常" ,e); log.error("执行异常", e);
} }
} }
...@@ -284,7 +289,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -284,7 +289,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
.eq(EmployeeRegistrationPre::getDeptNo, preVo.getDeptNo()) .eq(EmployeeRegistrationPre::getDeptNo, preVo.getDeptNo())
.last(CommonConstants.LAST_ONE_SQL)); .last(CommonConstants.LAST_ONE_SQL));
EmployeeRegistrationPre pre = new EmployeeRegistrationPre(); EmployeeRegistrationPre pre = new EmployeeRegistrationPre();
BeanUtils.copyProperties(preVo,pre); BeanUtils.copyProperties(preVo, pre);
if (Common.isNotNull(preVo.getExpectedCollectionTime())) { if (Common.isNotNull(preVo.getExpectedCollectionTime())) {
pre.setExpectedCollectionTime(LocalDateTimeUtils.dateToLocalDateTime(preVo.getExpectedCollectionTime())); pre.setExpectedCollectionTime(LocalDateTimeUtils.dateToLocalDateTime(preVo.getExpectedCollectionTime()));
} }
...@@ -304,7 +309,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -304,7 +309,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
CommonConstants.ZERO_STRING.equals(preVo.getEmployeeContractPreVos().getContractFlag())) { CommonConstants.ZERO_STRING.equals(preVo.getEmployeeContractPreVos().getContractFlag())) {
//查询老的合同明细 //查询老的合同明细
TEmployeeContractPre contractOld = contractPreMapper.selectOne(Wrappers.<TEmployeeContractPre>query().lambda() TEmployeeContractPre contractOld = contractPreMapper.selectOne(Wrappers.<TEmployeeContractPre>query().lambda()
.eq(TEmployeeContractPre::getRegisterId,pre.getId()) .eq(TEmployeeContractPre::getRegisterId, pre.getId())
.last(CommonConstants.LAST_ONE_SQL)); .last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(contractOld)) { if (Common.isNotNull(contractOld)) {
// 创建更新条件构造器 // 创建更新条件构造器
...@@ -474,11 +479,11 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -474,11 +479,11 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
} }
//查询老的合同明细 //查询老的合同明细
TEmployeeContractPre contractOld = contractPreMapper.selectOne(Wrappers.<TEmployeeContractPre>query().lambda() TEmployeeContractPre contractOld = contractPreMapper.selectOne(Wrappers.<TEmployeeContractPre>query().lambda()
.eq(TEmployeeContractPre::getRegisterId,pre.getId()) .eq(TEmployeeContractPre::getRegisterId, pre.getId())
.last(CommonConstants.LAST_ONE_SQL)); .last(CommonConstants.LAST_ONE_SQL));
// 添加日志并修改商险list // 添加日志并修改商险list
tEmployeePreLogService.saveUpdateInsurance(preExit.getId(), preExit tEmployeePreLogService.saveUpdateInsurance(preExit.getId(), preExit
, pre, preVo.getCreateBy(),preVo.getCreateName(), oldMap,contractOld); , pre, preVo.getCreateBy(), preVo.getCreateName(), oldMap, contractOld);
} }
if (Common.isNotNull(preVo.getExpectedCollectionTime())) { if (Common.isNotNull(preVo.getExpectedCollectionTime())) {
// 事务提交后触发调度 // 事务提交后触发调度
...@@ -488,7 +493,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -488,7 +493,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
if (pre.getExpectedCollectionTime().isEqual(now)) { if (pre.getExpectedCollectionTime().isEqual(now)) {
scheduleService.executeTask(pre.getId()); scheduleService.executeTask(pre.getId());
} else if (preVo.getExpectedCollectionTime().compareTo(LocalDateTimeUtils.convertLDTToDate(now)) > 0){ } else if (preVo.getExpectedCollectionTime().compareTo(LocalDateTimeUtils.convertLDTToDate(now)) > 0) {
scheduleService.scheduleTask(pre); scheduleService.scheduleTask(pre);
} }
} }
...@@ -525,12 +530,12 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -525,12 +530,12 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
//手机号真实性校验 //手机号真实性校验
TCheckMobile checkMobile = new TCheckMobile(); TCheckMobile checkMobile = new TCheckMobile();
checkMobile.setMobile(employeeRegistrationPre.getEmpPhone()); checkMobile.setMobile(employeeRegistrationPre.getEmpPhone());
R<TCheckMobile> res = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(),daprCheckProperties.getAppId(),"/tcheckmobile/inner/checkOneMobile", JSON.toJSONString(checkMobile), TCheckMobile.class, SecurityConstants.FROM_IN); R<TCheckMobile> res = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId(), "/tcheckmobile/inner/checkOneMobile", JSON.toJSONString(checkMobile), TCheckMobile.class, SecurityConstants.FROM_IN);
if (Common.isEmpty(res) || Common.isEmpty(res.getData())){ if (Common.isEmpty(res) || Common.isEmpty(res.getData())) {
return R.failed("校验手机号码信息失败!"); return R.failed("校验手机号码信息失败!");
} }
TCheckMobile cm = res.getData(); TCheckMobile cm = res.getData();
if (Common.isEmpty(cm.getStatus()) || !CommonConstants.ONE_STRING.equals(cm.getStatus())){ if (Common.isEmpty(cm.getStatus()) || !CommonConstants.ONE_STRING.equals(cm.getStatus())) {
return R.failed(cm.getMessage()); return R.failed(cm.getMessage());
} }
} }
...@@ -706,11 +711,11 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -706,11 +711,11 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
employeeRegistrationPre.setInsuranceIsBuy(""); employeeRegistrationPre.setInsuranceIsBuy("");
// 2:保存时不存在商险类型,判断是否有不可删除的数据,有则拒绝: // 2:保存时不存在商险类型,判断是否有不可删除的数据,有则拒绝:
if (oldList != null && !oldList.isEmpty()) { if (oldList != null && !oldList.isEmpty()) {
for (TEmployeeInsurancePre oldInsurance: oldList) { for (TEmployeeInsurancePre oldInsurance : oldList) {
if (Common.isNotNull(oldInsurance.getProcessStatus()) if (Common.isNotNull(oldInsurance.getProcessStatus())
&& (CommonConstants.THREE_STRING.equals(oldInsurance.getProcessStatus()) && (CommonConstants.THREE_STRING.equals(oldInsurance.getProcessStatus())
|| CommonConstants.FOUR_STRING.equals(oldInsurance.getProcessStatus()) || CommonConstants.FOUR_STRING.equals(oldInsurance.getProcessStatus())
|| CommonConstants.SIX_STRING.equals(oldInsurance.getProcessStatus()) )) { || CommonConstants.SIX_STRING.equals(oldInsurance.getProcessStatus()))) {
return R.failed("含有不可删除的商险,请刷新后再修改!"); return R.failed("含有不可删除的商险,请刷新后再修改!");
} }
} }
...@@ -719,7 +724,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -719,7 +724,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
//查询老的合同明细 //查询老的合同明细
TEmployeeContractPre contractOld = contractPreMapper.selectOne(Wrappers.<TEmployeeContractPre>query().lambda() TEmployeeContractPre contractOld = contractPreMapper.selectOne(Wrappers.<TEmployeeContractPre>query().lambda()
.eq(TEmployeeContractPre::getRegisterId,employeeRegistrationPre.getId()) .eq(TEmployeeContractPre::getRegisterId, employeeRegistrationPre.getId())
.last(CommonConstants.LAST_ONE_SQL)); .last(CommonConstants.LAST_ONE_SQL));
//1.9.12合同自动化校验逻辑 //1.9.12合同自动化校验逻辑
//根据身份证号码和项目编号查询合同 //根据身份证号码和项目编号查询合同
...@@ -742,7 +747,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -742,7 +747,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
TEmployeeContractPre contractStatus = contractPreMapper.selectById(employeeContractPreVo.getId()); TEmployeeContractPre contractStatus = contractPreMapper.selectById(employeeContractPreVo.getId());
//待确认/待发起/发起失败/线下签待审核/线下签审核不通过/线下签待归档 不能编辑 //待确认/待发起/发起失败/线下签待审核/线下签审核不通过/线下签待归档 不能编辑
if (Common.isNotNull(contractStatus) && (CommonConstants.NINE_STRING.equals(contractStatus.getProcessStatus()) if (Common.isNotNull(contractStatus) && (CommonConstants.NINE_STRING.equals(contractStatus.getProcessStatus())
|| CommonConstants.TWO_STRING.equals(contractStatus.getProcessStatus()) || CommonConstants.TWO_STRING.equals(contractStatus.getProcessStatus())
|| CommonConstants.SIX_STRING.equals(contractStatus.getProcessStatus()) || CommonConstants.SIX_STRING.equals(contractStatus.getProcessStatus())
|| CommonConstants.FOUR_STRING.equals(contractStatus.getProcessStatus()) || CommonConstants.FOUR_STRING.equals(contractStatus.getProcessStatus())
|| CommonConstants.EIGHT_STRING.equals(contractStatus.getProcessStatus())) || CommonConstants.EIGHT_STRING.equals(contractStatus.getProcessStatus()))
...@@ -755,7 +760,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -755,7 +760,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
return R.failed("该人员已存在审核中或已签署的合同,请勿重复发起签署!"); return R.failed("该人员已存在审核中或已签署的合同,请勿重复发起签署!");
} }
if (CommonConstants.ONE_STRING.equals(employeeContractPreVo.getContractFlag()) || Common.isEmpty(employeeContractPreVo.getContractFlag())) { if (CommonConstants.ONE_STRING.equals(employeeContractPreVo.getContractFlag()) || Common.isEmpty(employeeContractPreVo.getContractFlag())) {
initContractPreInfo(employeeRegistrationPre,employeeContractPreVo, user, id); initContractPreInfo(employeeRegistrationPre, employeeContractPreVo, user, id);
employeeRegistrationPre.setEmployeeContractPre(employeeContractPreVo); employeeRegistrationPre.setEmployeeContractPre(employeeContractPreVo);
} else { } else {
employeeRegistrationPre.setEmployeeContractPre(null); employeeRegistrationPre.setEmployeeContractPre(null);
...@@ -771,14 +776,14 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -771,14 +776,14 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
//是否已签署为是需要判断合同是否在用或者流程中 //是否已签署为是需要判断合同是否在用或者流程中
if (CommonConstants.ZERO_STRING.equals(employeeRegistrationPre.getSocialIsBuy()) && if (CommonConstants.ZERO_STRING.equals(employeeRegistrationPre.getSocialIsBuy()) &&
(Common.isEmpty(socialFlag) || Boolean.TRUE.equals(!socialFlag.getData()))) { (Common.isEmpty(socialFlag) || Boolean.TRUE.equals(!socialFlag.getData()))) {
return R.other(CommonConstants.TWO_INT,null,"未找到流程中或者在用的社保信息!"); return R.other(CommonConstants.TWO_INT, null, "未找到流程中或者在用的社保信息!");
} }
//是否已签署为否需要判断是否在用或者流程中的合同 //是否已签署为否需要判断是否在用或者流程中的合同
if (CommonConstants.ONE_STRING.equals(employeeRegistrationPre.getSocialIsBuy()) && if (CommonConstants.ONE_STRING.equals(employeeRegistrationPre.getSocialIsBuy()) &&
Common.isNotNull(socialFlag) && Boolean.TRUE.equals(socialFlag.getData()) && Common.isNotNull(socialFlag) && Boolean.TRUE.equals(socialFlag.getData()) &&
null != employeeRegistrationPre.getDispatchInfoPreVo() && null != employeeRegistrationPre.getDispatchInfoPreVo() &&
Common.isEmpty(employeeRegistrationPre.getDispatchInfoPreVo().getId())) { Common.isEmpty(employeeRegistrationPre.getDispatchInfoPreVo().getId())) {
return R.other(CommonConstants.TWO_INT,null,"该人员存在在途/有效的社保数据,请将“是否已参保”调整为“是”"); return R.other(CommonConstants.TWO_INT, null, "该人员存在在途/有效的社保数据,请将“是否已参保”调整为“是”");
} }
//流程中的社保数据不能修改 //流程中的社保数据不能修改
//查已购买社保明细 //查已购买社保明细
...@@ -789,7 +794,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -789,7 +794,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
&& null != socialSdr.getData().getDispatchInfoPreVo() && null != socialSdr.getData().getDispatchInfoPreVo()
&& (socialSdr.getData().getDispatchInfoPreVo().getProcessStatus().equals(CommonConstants.THREE_STRING) || && (socialSdr.getData().getDispatchInfoPreVo().getProcessStatus().equals(CommonConstants.THREE_STRING) ||
socialSdr.getData().getDispatchInfoPreVo().getProcessStatus().equals(CommonConstants.FIVE_STRING) || socialSdr.getData().getDispatchInfoPreVo().getProcessStatus().equals(CommonConstants.FIVE_STRING) ||
socialSdr.getData().getDispatchInfoPreVo().getProcessStatus().equals(CommonConstants.SIX_STRING)|| socialSdr.getData().getDispatchInfoPreVo().getProcessStatus().equals(CommonConstants.SIX_STRING) ||
socialSdr.getData().getDispatchInfoPreVo().getProcessStatus().equals(CommonConstants.SEVEN_STRING) || socialSdr.getData().getDispatchInfoPreVo().getProcessStatus().equals(CommonConstants.SEVEN_STRING) ||
socialSdr.getData().getDispatchInfoPreVo().getProcessStatus().equals(CommonConstants.NINE_STRING))) { socialSdr.getData().getDispatchInfoPreVo().getProcessStatus().equals(CommonConstants.NINE_STRING))) {
return R.failed("流程中的社保待购买数据不可修改!"); return R.failed("流程中的社保待购买数据不可修改!");
...@@ -797,7 +802,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -797,7 +802,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
} }
//更新合同签署状态 //更新合同签署状态
if (null != employeeRegistrationPre.getDispatchInfoPreVo()) { if (null != employeeRegistrationPre.getDispatchInfoPreVo()) {
employeeRegistrationPre.getDispatchInfoPreVo().setContractStatus(flag ? CommonConstants.ZERO_STRING :CommonConstants.ONE_STRING); employeeRegistrationPre.getDispatchInfoPreVo().setContractStatus(flag ? CommonConstants.ZERO_STRING : CommonConstants.ONE_STRING);
} }
} }
...@@ -809,13 +814,13 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -809,13 +814,13 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
String contractXfBefore = null; String contractXfBefore = null;
String contractXfAfter = null; String contractXfAfter = null;
if (!comparePre.getContractType().equals(employeeRegistrationPre.getContractType())) { if (!comparePre.getContractType().equals(employeeRegistrationPre.getContractType())) {
Map<String,String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue().get( Map<String, String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue().get(
CacheConstants.DICT_DETAILS + CommonConstants.COLON_STRING + "personnel_type"); CacheConstants.DICT_DETAILS + CommonConstants.COLON_STRING + "personnel_type");
for (Map.Entry<String,String> entry:dicObj.entrySet()){ for (Map.Entry<String, String> entry : dicObj.entrySet()) {
if (Common.isNotNull(entry.getKey()) && entry.getKey().equals(comparePre.getContractType())){ if (Common.isNotNull(entry.getKey()) && entry.getKey().equals(comparePre.getContractType())) {
contractItemBefore = entry.getValue(); contractItemBefore = entry.getValue();
} }
if (Common.isNotNull(entry.getKey()) && entry.getKey().equals(employeeRegistrationPre.getContractType())){ if (Common.isNotNull(entry.getKey()) && entry.getKey().equals(employeeRegistrationPre.getContractType())) {
contractItemAfter = entry.getValue(); contractItemAfter = entry.getValue();
} }
if (null != contractItemBefore && null != contractItemAfter) { if (null != contractItemBefore && null != contractItemAfter) {
...@@ -824,13 +829,13 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -824,13 +829,13 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
} }
} }
if (!comparePre.getEmpNature().equals(employeeRegistrationPre.getEmpNature())) { if (!comparePre.getEmpNature().equals(employeeRegistrationPre.getEmpNature())) {
Map<String,String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue().get( Map<String, String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue().get(
CacheConstants.DICT_DETAILS + CommonConstants.COLON_STRING + "emp_natrue"); CacheConstants.DICT_DETAILS + CommonConstants.COLON_STRING + "emp_natrue");
for (Map.Entry<String,String> entry:dicObj.entrySet()){ for (Map.Entry<String, String> entry : dicObj.entrySet()) {
if (Common.isNotNull(entry.getKey()) && entry.getKey().equals(comparePre.getEmpNature())){ if (Common.isNotNull(entry.getKey()) && entry.getKey().equals(comparePre.getEmpNature())) {
natureItemBefore = entry.getValue(); natureItemBefore = entry.getValue();
} }
if (Common.isNotNull(entry.getKey()) && entry.getKey().equals(employeeRegistrationPre.getEmpNature())){ if (Common.isNotNull(entry.getKey()) && entry.getKey().equals(employeeRegistrationPre.getEmpNature())) {
natureItemAfter = entry.getValue(); natureItemAfter = entry.getValue();
} }
if (null != natureItemAfter && null != natureItemBefore) { if (null != natureItemAfter && null != natureItemBefore) {
...@@ -839,34 +844,34 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -839,34 +844,34 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
} }
} }
if (null != comparePre.getContractSubName() && null == employeeRegistrationPre.getContractSubName()) { if (null != comparePre.getContractSubName() && null == employeeRegistrationPre.getContractSubName()) {
Map<String,String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue().get( Map<String, String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue().get(
CacheConstants.DICT_DETAILS + CommonConstants.COLON_STRING + "contract_business_type"); CacheConstants.DICT_DETAILS + CommonConstants.COLON_STRING + "contract_business_type");
for (Map.Entry<String,String> entry:dicObj.entrySet()){ for (Map.Entry<String, String> entry : dicObj.entrySet()) {
if (Common.isNotNull(entry.getKey()) && entry.getKey().equals(comparePre.getContractSubName())){ if (Common.isNotNull(entry.getKey()) && entry.getKey().equals(comparePre.getContractSubName())) {
contractXfBefore = entry.getValue(); contractXfBefore = entry.getValue();
break; break;
} }
} }
} }
if (null == comparePre.getContractSubName() && null != employeeRegistrationPre.getContractSubName()) { if (null == comparePre.getContractSubName() && null != employeeRegistrationPre.getContractSubName()) {
Map<String,String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue().get( Map<String, String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue().get(
CacheConstants.DICT_DETAILS + CommonConstants.COLON_STRING + "contract_business_type"); CacheConstants.DICT_DETAILS + CommonConstants.COLON_STRING + "contract_business_type");
for (Map.Entry<String,String> entry:dicObj.entrySet()){ for (Map.Entry<String, String> entry : dicObj.entrySet()) {
if (Common.isNotNull(entry.getKey()) && entry.getKey().equals(employeeRegistrationPre.getContractSubName())){ if (Common.isNotNull(entry.getKey()) && entry.getKey().equals(employeeRegistrationPre.getContractSubName())) {
contractXfAfter = entry.getValue(); contractXfAfter = entry.getValue();
break; break;
} }
} }
} }
if (null != comparePre.getContractSubName() && null != employeeRegistrationPre.getContractSubName() if (null != comparePre.getContractSubName() && null != employeeRegistrationPre.getContractSubName()
&& !comparePre.getContractSubName().equals(employeeRegistrationPre.getContractSubName())) { && !comparePre.getContractSubName().equals(employeeRegistrationPre.getContractSubName())) {
Map<String,String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue().get( Map<String, String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue().get(
CacheConstants.DICT_DETAILS + CommonConstants.COLON_STRING + "contract_business_type"); CacheConstants.DICT_DETAILS + CommonConstants.COLON_STRING + "contract_business_type");
for (Map.Entry<String,String> entry:dicObj.entrySet()){ for (Map.Entry<String, String> entry : dicObj.entrySet()) {
if (Common.isNotNull(entry.getKey()) && entry.getKey().equals(comparePre.getContractSubName())){ if (Common.isNotNull(entry.getKey()) && entry.getKey().equals(comparePre.getContractSubName())) {
contractXfBefore = entry.getValue(); contractXfBefore = entry.getValue();
} }
if (Common.isNotNull(entry.getKey()) && entry.getKey().equals(employeeRegistrationPre.getContractSubName())){ if (Common.isNotNull(entry.getKey()) && entry.getKey().equals(employeeRegistrationPre.getContractSubName())) {
contractXfAfter = entry.getValue(); contractXfAfter = entry.getValue();
} }
if (null != contractXfBefore && null != contractXfAfter) { if (null != contractXfBefore && null != contractXfAfter) {
...@@ -907,7 +912,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -907,7 +912,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
//商险状态是否正常判断 //商险状态是否正常判断
private boolean checkInsuranceIsProcess(EmployeeRegistrationPre pre) { private boolean checkInsuranceIsProcess(EmployeeRegistrationPre pre) {
EmployeeRegistrationPreVo preVo = new EmployeeRegistrationPreVo(); EmployeeRegistrationPreVo preVo = new EmployeeRegistrationPreVo();
BeanUtils.copyProperties(pre,preVo); BeanUtils.copyProperties(pre, preVo);
R<Boolean> flag = insuranceDaprUtil.checkExitInsuanceIsProcess(preVo); R<Boolean> flag = insuranceDaprUtil.checkExitInsuanceIsProcess(preVo);
//是否已签署为是需要判断合同是否在用或者流程中 //是否已签署为是需要判断合同是否在用或者流程中
return Common.isEmpty(flag) || Boolean.TRUE.equals(!flag.getData()); return Common.isEmpty(flag) || Boolean.TRUE.equals(!flag.getData());
...@@ -1069,9 +1074,9 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -1069,9 +1074,9 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
boolean erorFlag = false; boolean erorFlag = false;
R<TEmployeeInsuranceSelectVo> dataR = insuranceDaprUtil.selectInsurancePreInfoList(preVo); R<TEmployeeInsuranceSelectVo> dataR = insuranceDaprUtil.selectInsurancePreInfoList(preVo);
//查询商险数据 //查询商险数据
TInsuranceDetail insuranceDetail= null; TInsuranceDetail insuranceDetail = null;
R<TEmployeeInsuranceSelectVo> dataInsurR = insuranceDaprUtil.selectInsuranceInfo(preVo); R<TEmployeeInsuranceSelectVo> dataInsurR = insuranceDaprUtil.selectInsuranceInfo(preVo);
if (Common.isNotNull(dataInsurR) && Common.isNotNull(dataInsurR.getData())&& Common.isNotNull(dataInsurR.getData().getInsuranceDetail())) { if (Common.isNotNull(dataInsurR) && Common.isNotNull(dataInsurR.getData()) && Common.isNotNull(dataInsurR.getData().getInsuranceDetail())) {
insuranceDetail = dataInsurR.getData().getInsuranceDetail(); insuranceDetail = dataInsurR.getData().getInsuranceDetail();
} }
//二次确认接收场景 //二次确认接收场景
...@@ -1146,9 +1151,9 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -1146,9 +1151,9 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
@Override @Override
public R registrationPreAudit(EmployeeRegistrationPre pre) { public R registrationPreAudit(EmployeeRegistrationPre pre) {
TPreEmpMain empMain = empMainMapper.selectOne(Wrappers.<TPreEmpMain>query().lambda() TPreEmpMain empMain = empMainMapper.selectOne(Wrappers.<TPreEmpMain>query().lambda()
.eq(TPreEmpMain::getEmpIdcard,pre.getEmpIdcard()) .eq(TPreEmpMain::getEmpIdcard, pre.getEmpIdcard())
.eq(TPreEmpMain::getDeptId,pre.getDeptId()) .eq(TPreEmpMain::getDeptId, pre.getDeptId())
.eq(TPreEmpMain::getStatus,CommonConstants.TWO_STRING) .eq(TPreEmpMain::getStatus, CommonConstants.TWO_STRING)
.last(CommonConstants.LAST_ONE_SQL)); .last(CommonConstants.LAST_ONE_SQL));
if (Common.isEmpty(empMain)) { if (Common.isEmpty(empMain)) {
return R.failed(CommonConstants.NO_DATA_TO_HANDLE); return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
...@@ -1157,26 +1162,39 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -1157,26 +1162,39 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
} }
@Override @Override
public R batchSendMessage(List<SendMessageUpdateVo> voList,String type) { public R batchSendMessage(List<SendMessageUpdateVo> voList, String type) {
if (Common.isNotNull(voList) && voList.size() >200) { if (Common.isNotNull(voList) && voList.size() > 200) {
return R.failed("短信批量发送单次最多两百条"); return R.failed("短信批量发送单次最多两百条");
} }
//获取联系电话
String contactTel ="0551-63468931";
//获取模板
String modelCode = "";
SysConfig sysConfig = sysConfigMapper.getSysConfigLimitByKey("EMPLOYMENT_SMS_RLY");
if (null != sysConfig){
contactTel = sysConfig.getConfigValue();
modelCode = sysConfig.getConfigValue1();
}
MessageTempleteVo templeteVo = baseMapper.selectTempleteVo(modelCode);
String[] paramsDetail;
String[] phonesArr;
RlySmsUtil rlySmsUtil = new RlySmsUtil();
HashMap<String, Object> sendResult;
HashMap<String, Object> data;
HashMap<String, Object> detail;
String[][] t;
//获取短信待发放和信息待填写的数据 //获取短信待发放和信息待填写的数据
List<String> errorList = new ArrayList<>(); List<String> errorList = new ArrayList<>();
if (CommonConstants.ONE_STRING.equals(type)) { if (CommonConstants.ONE_STRING.equals(type)) {
for(SendMessageUpdateVo updateVo:voList) { for (SendMessageUpdateVo updateVo : voList) {
RegistParamVo paramVo = new RegistParamVo(); paramsDetail = new String[3];
List<RegistParamVo> params = new ArrayList<>(); phonesArr = new String[1];
List<String> phones = new ArrayList<>();
EmployeeRegistrationPre updatePre; EmployeeRegistrationPre updatePre;
AliSmsResult res;
updatePre = baseMapper.selectOne(Wrappers.<EmployeeRegistrationPre>query() updatePre = baseMapper.selectOne(Wrappers.<EmployeeRegistrationPre>query()
.lambda().eq(EmployeeRegistrationPre::getId, updateVo.getId()) .lambda().eq(EmployeeRegistrationPre::getId, updateVo.getId())
.in(EmployeeRegistrationPre::getProcessStatus, CommonConstants.processStatus) .in(EmployeeRegistrationPre::getProcessStatus, CommonConstants.processStatus)
.last(CommonConstants.LAST_ONE_SQL)); .last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(updatePre)) { if (Common.isNotNull(updatePre)) {
paramVo.setName(updatePre.getEmployeeName());
phones.add(updatePre.getEmpPhone());
if (CommonConstants.ZERO_STRING.equals(updatePre.getProcessStatus())) { if (CommonConstants.ZERO_STRING.equals(updatePre.getProcessStatus())) {
updatePre.setProcessStatus(CommonConstants.ONE_STRING); updatePre.setProcessStatus(CommonConstants.ONE_STRING);
} }
...@@ -1191,33 +1209,36 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -1191,33 +1209,36 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
smsEmployee.setType(CommonConstants.ONE_STRING); smsEmployee.setType(CommonConstants.ONE_STRING);
smsEmployee.setDeptId(updatePre.getDeptId()); smsEmployee.setDeptId(updatePre.getDeptId());
employeeService.save(smsEmployee); employeeService.save(smsEmployee);
paramVo.setLink(smsEmployee.getId().toString()); paramsDetail[0] = smsEmployee.getEmpName()!=null?smsEmployee.getEmpName():"";
params.add(paramVo); paramsDetail[1] = smsEmployee.getId()!=null?smsEmployee.getId().toString():"";
res = sendMessage(phones, params); paramsDetail[2] = contactTel;
if (null != res && null != res.getBizId()) { if (smsEmployee.getEmpPhone() == null){
smsEmployee.setBizId(res.getBizId()); smsEmployee.setMessage("短信发送失败: 电话不可为空!");
smsEmployee.setMessage(res.getMessage());
employeeService.updateById(smsEmployee); employeeService.updateById(smsEmployee);
this.updateById(updatePre); continue;
} else { }
smsEmployee.setMessage("短信发送失败"); if (null == templeteVo || null == templeteVo.getTempleteCode()){
smsEmployee.setMessage("短信发送失败: 模板不可为空!");
employeeService.updateById(smsEmployee); employeeService.updateById(smsEmployee);
errorList.add("短信发送失败"); continue;
} }
phonesArr[0]= smsEmployee.getEmpPhone();
t = new String[1][3]; // 创建正确大小的二维数组
t[0]=paramsDetail;
//调用RlySmsUtil的sendBatchSms方法
sendResult = rlySmsUtil.sendBatchSms(phonesArr, templeteVo.getTempleteCode(), t);
handleSmsRes(sendResult, errorList, updatePre, smsEmployee);
} }
} }
} else { } else {
TEmployeeInfo info; TEmployeeInfo info;
for(SendMessageUpdateVo updateVo:voList) { for (SendMessageUpdateVo updateVo : voList) {
RegistParamVo paramVo = new RegistParamVo(); paramsDetail = new String[3];
List<RegistParamVo> params = new ArrayList<>(); phonesArr = new String[1];
List<String> phones = new ArrayList<>();
EmployeeRegistrationPre updatePre; EmployeeRegistrationPre updatePre;
AliSmsResult res;
info = employeeInfoMapper.selectById(updateVo.getId()); info = employeeInfoMapper.selectById(updateVo.getId());
if (Common.isNotNull(info)) { if (Common.isNotNull(info)) {
paramVo.setName(info.getEmpName());
phones.add(info.getEmpPhone());
//如果有入职待建档数据同步更新 //如果有入职待建档数据同步更新
updatePre = baseMapper.selectOne(Wrappers.<EmployeeRegistrationPre>query().lambda() updatePre = baseMapper.selectOne(Wrappers.<EmployeeRegistrationPre>query().lambda()
.eq(EmployeeRegistrationPre::getEmpIdcard, info.getEmpIdcard()) .eq(EmployeeRegistrationPre::getEmpIdcard, info.getEmpIdcard())
...@@ -1238,36 +1259,73 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -1238,36 +1259,73 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
smsEmployee.setType(CommonConstants.TWO_STRING); smsEmployee.setType(CommonConstants.TWO_STRING);
smsEmployee.setDeptId(updateVo.getDeptId()); smsEmployee.setDeptId(updateVo.getDeptId());
employeeService.save(smsEmployee); employeeService.save(smsEmployee);
paramVo.setLink(smsEmployee.getId().toString()); paramsDetail[0] = smsEmployee.getEmpName()!=null?smsEmployee.getEmpName():"";
params.add(paramVo); paramsDetail[1] = smsEmployee.getId()!=null?smsEmployee.getId().toString():"";
res = sendMessage(phones, params); paramsDetail[2] = contactTel;
if (null != res && null != res.getBizId()) { if (smsEmployee.getEmpPhone() == null){
smsEmployee.setBizId(res.getBizId()); smsEmployee.setMessage("短信发送失败: 电话不可为空!");
smsEmployee.setMessage(res.getMessage());
employeeService.updateById(smsEmployee); employeeService.updateById(smsEmployee);
if (Common.isNotNull(updatePre)) { continue;
this.updateById(updatePre); }
} if (null == templeteVo || null == templeteVo.getTempleteCode()){
} else { smsEmployee.setMessage("短信发送失败: 模板不可为空!");
smsEmployee.setMessage("短信发送失败");
employeeService.updateById(smsEmployee); employeeService.updateById(smsEmployee);
errorList.add("短信发送失败"); continue;
} }
phonesArr[0]= smsEmployee.getEmpPhone();
t = new String[1][3]; // 创建正确大小的二维数组
t[0]=paramsDetail;
//调用RlySmsUtil的sendBatchSms方法
sendResult = rlySmsUtil.sendBatchSms(phonesArr, templeteVo.getTempleteCode(), t);
handleSmsRes(sendResult, errorList, updatePre, smsEmployee);
} }
} }
} }
if (!errorList.isEmpty() && errorList.stream().allMatch(e->e.equals("短信发送失败"))) { if (!errorList.isEmpty() && errorList.stream().allMatch(e -> e.equals("短信发送失败"))) {
return R.ok("短信发送失败"); return R.ok("短信发送失败");
} }
return R.ok("短信发送成功"); return R.ok("短信发送成功");
} }
private void handleSmsRes(HashMap<String, Object> sendResult, List<String> errorList, EmployeeRegistrationPre updatePre, TRegisteWarningEmployee smsEmployee) {
HashMap<String, Object> detail;
HashMap<String, Object> data;
if (null != sendResult && "000000".equals(sendResult.get("statusCode"))) {
// 成功情况处理
data = (HashMap<String, Object>) sendResult.get("data");
detail = null;
if (data != null){
detail = (HashMap<String, Object>) data.get("templateSMS");
}
String smsMessageSid = "";
if (detail != null){
smsMessageSid = detail.get("smsMessageSid").toString();
}
smsEmployee.setBizId(smsMessageSid);
smsEmployee.setMessage("短信发送成功");
employeeService.updateById(smsEmployee);
if (Common.isNotNull(updatePre)) {
this.updateById(updatePre);
}
} else {
// 失败情况处理
String errorMsg = "未知错误";
if (sendResult != null) {
errorMsg = "错误码=" + sendResult.get("statusCode") + " 错误信息=" + sendResult.get("statusMsg");
}
smsEmployee.setMessage("短信发送失败: " + errorMsg);
employeeService.updateById(smsEmployee);
errorList.add("短信发送失败");
}
}
@Override @Override
public void updatePreStatusToEnd(String deptNo, String empIdcard) { public void updatePreStatusToEnd(String deptNo, String empIdcard) {
EmployeeRegistrationPre registrationPre = baseMapper.selectOne(Wrappers.<EmployeeRegistrationPre>query().lambda() EmployeeRegistrationPre registrationPre = baseMapper.selectOne(Wrappers.<EmployeeRegistrationPre>query().lambda()
.eq(EmployeeRegistrationPre::getEmpIdcard,empIdcard) .eq(EmployeeRegistrationPre::getEmpIdcard, empIdcard)
.eq(EmployeeRegistrationPre::getDeptNo,deptNo) .eq(EmployeeRegistrationPre::getDeptNo, deptNo)
.in(EmployeeRegistrationPre::getProcessStatus,CommonConstants.processPreArchivesStatus) .in(EmployeeRegistrationPre::getProcessStatus, CommonConstants.processPreArchivesStatus)
.last(CommonConstants.LAST_ONE_SQL)); .last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(registrationPre)) { if (Common.isNotNull(registrationPre)) {
registrationPre.setProcessStatus(CommonConstants.FOUR_STRING); registrationPre.setProcessStatus(CommonConstants.FOUR_STRING);
...@@ -1304,7 +1362,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -1304,7 +1362,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
@Override @Override
public R<EmployeeInfoMsgVo> getEmployeeInfo(String id) { public R<EmployeeInfoMsgVo> getEmployeeInfo(String id) {
//获取人员档案id //获取人员档案id
EmployeeInfoMsgVo msgInfoVo = baseMapper.getEmployeeArchivesInfo(id,CommonConstants.preMainStatus); EmployeeInfoMsgVo msgInfoVo = baseMapper.getEmployeeArchivesInfo(id, CommonConstants.preMainStatus);
if (Common.isEmpty(msgInfoVo)) { if (Common.isEmpty(msgInfoVo)) {
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR); return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
} }
...@@ -1399,10 +1457,10 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -1399,10 +1457,10 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
* @Date: 2025/3/18 17:02 * @Date: 2025/3/18 17:02
* @return: * @return:
**/ **/
public AliSmsResult sendMessage (List<String> phones,List<RegistParamVo> params ) { public AliSmsResult sendMessage(List<String> phones, List<RegistParamVo> params) {
List<String> signNames = new ArrayList<>(); List<String> signNames = new ArrayList<>();
MessageTempleteVo templeteVo = baseMapper.selectTempleteVo(CommonConstants.ONE_STRING); MessageTempleteVo templeteVo = baseMapper.selectTempleteVo(CommonConstants.ONE_STRING);
for (int i=0;i<phones.size();i++){ for (int i = 0; i < phones.size(); i++) {
signNames.add(templeteVo.getSignName()); signNames.add(templeteVo.getSignName());
} }
return YiFuSmsUtil.sendRegistBatchSms(phones, params, signNames, templeteVo.getTempleteCode()); return YiFuSmsUtil.sendRegistBatchSms(phones, params, signNames, templeteVo.getTempleteCode());
...@@ -1497,7 +1555,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -1497,7 +1555,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
} }
//获取合同待签订数据 //获取合同待签订数据
TEmployeeContractPre contract = contractPreMapper.selectOne(Wrappers.<TEmployeeContractPre>query().lambda() TEmployeeContractPre contract = contractPreMapper.selectOne(Wrappers.<TEmployeeContractPre>query().lambda()
.eq(TEmployeeContractPre::getRegisterId,id) .eq(TEmployeeContractPre::getRegisterId, id)
.last(CommonConstants.LAST_ONE_SQL)); .last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(contract)) { if (Common.isNotNull(contract)) {
//附件赋值 //附件赋值
...@@ -1506,9 +1564,9 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -1506,9 +1564,9 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
// 如果附件信息非空,则为每个附件生成可访问的URL,并将其添加到员工注册信息中 // 如果附件信息非空,则为每个附件生成可访问的URL,并将其添加到员工注册信息中
if (attaContractInfo != null && !attaContractInfo.isEmpty()) { if (attaContractInfo != null && !attaContractInfo.isEmpty()) {
URL url; URL url;
for (TAttaInfo a: attaContractInfo) { for (TAttaInfo a : attaContractInfo) {
url = ossUtil.getObjectUrl(null, a.getAttaSrc()); url = ossUtil.getObjectUrl(null, a.getAttaSrc());
a.setAttaUrl(null != url ? url.toString(): ""); a.setAttaUrl(null != url ? url.toString() : "");
} }
contract.setAttaList(attaContractInfo); contract.setAttaList(attaContractInfo);
} }
...@@ -1520,9 +1578,9 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi ...@@ -1520,9 +1578,9 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
// 如果附件信息非空,则为每个附件生成可访问的URL,并将其添加到员工注册信息中 // 如果附件信息非空,则为每个附件生成可访问的URL,并将其添加到员工注册信息中
if (attaInfo != null && !attaInfo.isEmpty()) { if (attaInfo != null && !attaInfo.isEmpty()) {
URL url; URL url;
for (TAttaInfo a: attaInfo) { for (TAttaInfo a : attaInfo) {
url = ossUtil.getObjectUrl(null, a.getAttaSrc()); url = ossUtil.getObjectUrl(null, a.getAttaSrc());
a.setAttaUrl(null != url ? url.toString(): ""); a.setAttaUrl(null != url ? url.toString() : "");
} }
pre.setAttaList(attaInfo); pre.setAttaList(attaInfo);
} }
......
...@@ -121,5 +121,17 @@ ...@@ -121,5 +121,17 @@
<artifactId>xlsx-streamer</artifactId> <artifactId>xlsx-streamer</artifactId>
<version>2.2.0</version> <version>2.2.0</version>
</dependency> </dependency>
<!-- 容联云短信SDK -->
<dependency>
<groupId>com.cloopen</groupId>
<artifactId>java-sms-sdk</artifactId>
<version>1.0.3</version>
</dependency>
<!-- gson 解析 -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
package com.yifu.cloud.plus.v1.yifu.common.core.util;
import com.cloopen.rest.sdk.BodyType;
import com.cloopen.rest.sdk.CCPRestSmsSDK;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Set;
/**
* 容联云短信实现工具类,可以单个发送短信,批量发送短信
*
* @author fxj
* @version 1.0
* @since 2025/10/21
*/
@Component
@Data
@Slf4j
public class RlySmsUtil {
private CCPRestSmsSDK sdk;
// 服务器地址
private String serverIp = "app.cloopen.com";
// 服务器端口
private String serverPort = "8883";
// 主账号
private String accountSId = "8a48b5515388ec150153acb1cd5b3899";
// 主账号令牌
private String accountToken = "5487aa42bb574b47aca1c785b4e7c018";
// 应用ID
private String appId = "2c94811c9787a27f019854cd1b532b7e";
/**
* 初始化SDK
*
* @param accountSId 主账号
* @param accountToken 主账号令牌
* @param appId 应用ID
*/
public void init(String accountSId, String accountToken, String appId) {
if (null == sdk){
this.accountSId = accountSId;
this.accountToken = accountToken;
this.appId = appId;
sdk = new CCPRestSmsSDK();
sdk.init(serverIp, serverPort);
sdk.setAccount(accountSId, accountToken);
sdk.setAppId(appId);
sdk.setBodyType(BodyType.Type_JSON);
}
}
/**
* 单个发送短信
*
* @param phoneNumber 手机号码
* @param templateId 模板ID
* @param datas 短信参数
* @return 发送结果 true-成功 false-失败
*/
public boolean sendSingleSms(String phoneNumber, String templateId, String[] datas) {
init(accountSId, accountToken, appId);
HashMap<String, Object> result = sdk.sendTemplateSMS(phoneNumber, templateId, datas);
if ("000000".equals(result.get("statusCode"))) {
// 正常返回输出data包体信息
HashMap<String, Object> data = (HashMap<String, Object>) result.get("data");
Set<String> keySet = data.keySet();
for (String key : keySet) {
Object object = data.get(key);
}
return true;
} else {
// 异常返回输出错误码和错误信息
log.error("错误码=" + result.get("statusCode") + " 错误信息= " + result.get("statusMsg"));
return false;
}
}
/**
* 批量发送短信
*
* @param phoneNumbers 手机号码数组
* @param templateId 模板ID
* @param datas 短信参数
* @return 发送结果 true-成功 false-失败
*/
public HashMap<String, Object> sendBatchSms(String[] phoneNumbers, String templateId, String[][] datas) {
init(accountSId, accountToken, appId);
// 将手机号数组转换为逗号分隔的字符串
StringBuilder phoneNumbersStr = new StringBuilder();
for (int i = 0; i < phoneNumbers.length; i++) {
if (i > 0) {
phoneNumbersStr.append(",");
}
phoneNumbersStr.append(phoneNumbers[i]);
}
// 容联云短信SDK只支持单个模板参数数组,不直接支持多个不同参数
// 这里假设所有手机号使用相同参数发送
// 如果需要不同的参数,需要多次调用单个发送方法
String[] singleData = datas.length > 0 ? datas[0] : new String[0];
HashMap<String, Object> result = sdk.sendTemplateSMS(phoneNumbersStr.toString(), templateId, singleData);
return result;
}
}
\ No newline at end of file
...@@ -7,4 +7,5 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ ...@@ -7,4 +7,5 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.yifu.cloud.plus.v1.yifu.common.core.config.WebMvcConfiguration,\ com.yifu.cloud.plus.v1.yifu.common.core.config.WebMvcConfiguration,\
com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil,\ com.yifu.cloud.plus.v1.yifu.common.core.util.OSSUtil,\
com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil,\ com.yifu.cloud.plus.v1.yifu.common.core.util.RedisUtil,\
com.yifu.cloud.plus.v1.yifu.common.core.redis.lock4j.MyLockFailureStrategy com.yifu.cloud.plus.v1.yifu.common.core.redis.lock4j.MyLockFailureStrategy,\
com.yifu.cloud.plus.v1.yifu.common.core.util.RlySmsUtil
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