Commit e756c16c authored by huyuchen's avatar huyuchen

huych-入职登记商险待办提交

parent 1c593853
......@@ -36,5 +36,17 @@
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</dependency>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-insurances-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-archives-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
package com.yifu.cloud.plus.v1.csp.vo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.TEmployeeInsuranceExitCheckVo;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 入离职登记表
*
* @author huych
* @date 2025-02-25 14:48:11
*/
@Data
public class EmployeeRegistrationBatchErrorVo implements Serializable {
private List<EmployeeRegistrationReceiveVo> registrationReceiveVoList;
private List<TEmployeeInsuranceExitCheckVo> errorList;
}
package com.yifu.cloud.plus.v1.csp.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeRegistrationPreVo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......@@ -34,5 +35,7 @@ public class EmployeeRegistrationReceiveVo implements Serializable {
@Schema(description = "项目档案id")
private String empProjectId;
private EmployeeRegistrationPreVo preVo;
}
......@@ -257,7 +257,7 @@ public class EmployeeRegistrationController {
*/
@Operation(description = "入职待确认列表简单分页查询")
@GetMapping("/hrConfirmIdcardList")
public R<List<String>> getHrConfirmIdcardList(EmployeeRegistrationSearchVo employeeRegistration) {
public R<List<EmployeeRegistration>> getHrConfirmIdcardList(EmployeeRegistrationSearchVo employeeRegistration) {
YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, employeeRegistration);
return R.ok(employeeRegistrationService.getHrConfirmIdcardList(employeeRegistration));
......
......@@ -27,7 +27,7 @@ public interface EmployeeRegistrationMapper extends BaseMapper<EmployeeRegistrat
*/
IPage<EmployeeRegistration> getEmployeeRegistrationPage(Page<EmployeeRegistration> page, @Param("employeeRegistration") EmployeeRegistrationSearchVo employeeRegistration);
List<String> getHrConfirmIdcardList(@Param("employeeRegistration") EmployeeRegistrationSearchVo employeeRegistration);
List<EmployeeRegistration> getHrConfirmIdcardList(@Param("employeeRegistration") EmployeeRegistrationSearchVo employeeRegistration);
List<EmployeeRegistration> getEmployeeRegistrationList(@Param("employeeRegistration") EmployeeRegistrationSearchVo employeeRegistration);
......
......@@ -116,7 +116,7 @@ public interface EmployeeRegistrationService extends IService<EmployeeRegistrati
* @param searchVo 入离职登记
* @return
*/
List<String> getHrConfirmIdcardList(EmployeeRegistrationSearchVo searchVo);
List<EmployeeRegistration> getHrConfirmIdcardList(EmployeeRegistrationSearchVo searchVo);
/**
* 入职待确认表确认接收
......
......@@ -245,9 +245,9 @@
</select>
<!--employeeRegistration简单分页查询-->
<select id="getHrConfirmIdcardList" resultType="java.lang.String">
<select id="getHrConfirmIdcardList" resultMap="employeeRegistrationMap">
SELECT
a.emp_idcard
<include refid="Base_Column_List"/>
FROM employee_registration a
<where>
1=1
......
......@@ -89,14 +89,15 @@ public class TEmployeeInsurancePre extends BaseEntity {
@Schema(description = "购买类型, 1新增、3批增、4替换")
private Integer buyType;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "保单开始时间")
private Date policyStart;
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern="yyyy-MM-dd HH:mm:ss")
@Schema(description = "保单结束时间")
private Date policyEnd;
@Schema(description = "预计生效日期")
private Date policyEffect;
@Schema(description = "保单号")
private String policyNo;
......@@ -133,6 +134,12 @@ public class TEmployeeInsurancePre extends BaseEntity {
@Schema(description = "替换项目编码")
private String replaceDeptNo;
@Schema(description = "配置名称")
private String configName;
@Schema(description = "商险ID")
private String insurancesId;
@TableField(exist = false)
@Schema(description = "修改类型:1新增;2修改;3删除;4状态346为不可编辑")
private String modelType;
......
......@@ -168,6 +168,11 @@ public class TEmployeeInsurancePreVo implements Serializable {
@ExcelProperty("保单结束时间")
private Date policyEnd;
@ExcelAttribute(name = "保单预计生效日期", isDate = true)
@Schema(description = "保单预计生效日期")
@ExcelProperty("保单预计生效日期")
private Date policyEffect;
/**
* 保单号
*/
......@@ -264,6 +269,17 @@ public class TEmployeeInsurancePreVo implements Serializable {
@ExcelProperty("替换项目编码")
private String replaceDeptNo;
@Schema(description = "商险ID")
private String insurancesId;
/**
* 配置名称
*/
@ExcelAttribute(name = "配置名称")
@Schema(description = "配置名称")
@ExcelProperty("配置名称")
private String configName;
@Schema(description = "创建人-姓名")
private String createName;
......
......@@ -213,6 +213,19 @@ public class TEmployeeInsurancePreController {
tEmployeeInsurancePreService.pushWxConfrimMessage();
}
/**
* 每天下午三点二十推送待派单数据
* @author huych
* @date 2025-04-11 10:46:12
* @return void
*/
@SysLog("每天下午三点二十推送待派单数据")
@Inner
@PostMapping("/inner/pushDisConfrimInsurances")
public void pushDisConfrimInsurances() {
tEmployeeInsurancePreService.pushDisConfrimInsurances();
}
/**
* @param empPreId 入职确认信息表ID
* @Description: 获取商险信息
......
......@@ -39,6 +39,8 @@ public interface TEmployeeInsurancePreMapper extends BaseMapper<TEmployeeInsuran
List<TEmployeeInsurancePre> getAllUnconfimData();
List<String> getAllUnDisData();
/**
* 根据empPreId查询
* @param empPreId 入职确认信息表主键
......
......@@ -84,6 +84,8 @@ public interface TEmployeeInsurancePreService extends IService<TEmployeeInsuranc
void pushWxConfrimMessage();
void pushDisConfrimInsurances();
/**
* @Description: 查询list
* @Author: hgw
......
......@@ -37,14 +37,11 @@ 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.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.web.client.RestTemplate;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -174,7 +171,6 @@ public class TEmployeeInsurancePreServiceImpl extends ServiceImpl<TEmployeeInsur
}
@Override
@Transactional
public R batchDispatcherInsurance(List<String> idList) {
List<TEmployeeInsurancePre> insurancePreList = baseMapper.selectList(Wrappers.<TEmployeeInsurancePre>query()
.lambda().in(TEmployeeInsurancePre::getId, idList)
......@@ -274,6 +270,7 @@ public class TEmployeeInsurancePreServiceImpl extends ServiceImpl<TEmployeeInsur
LambdaUpdateWrapper<TEmployeeInsurancePre> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.in(TEmployeeInsurancePre::getId,pushIdList)
.set(TEmployeeInsurancePre::getProcessStatus, CommonConstants.THREE_STRING);
this.update(updateWrapper);
} else {
// 将 autoAddParamList 中的身份证和项目等信息提取出来,放入一个 Set 中
Set<String> autoAddParamSet = autoAddParamList.stream()
......@@ -287,16 +284,16 @@ public class TEmployeeInsurancePreServiceImpl extends ServiceImpl<TEmployeeInsur
List<TEmployeeInsurancePre> existingList = insurancePreList.stream()
.filter(pre -> autoAddParamSet.contains(pre.getEmpIdcard() + "-" + pre.getDeptNo()
+ "-" + pre.getBuyStandard()+ "-" + pre.getInsuranceTypeName()
+ "-" + pre.getInsuranceCompanyName() + "-" + pre.getPolicyStart()
+ "-" + pre.getPolicyEnd()))
+ "-" + pre.getInsuranceCompanyName() + "-" + DateUtil.dateToString(pre.getPolicyStart(),DateUtil.ISO_EXPANDED_DATE_FORMAT)
+ "-" + DateUtil.dateToString(pre.getPolicyEnd(),DateUtil.ISO_EXPANDED_DATE_FORMAT)))
.collect(Collectors.toList());
// 找出 insurancePreList 中在 autoAddParamList 中不存在的数据
List<TEmployeeInsurancePre> nonExistingList = insurancePreList.stream()
.filter(pre -> !autoAddParamSet.contains(pre.getEmpIdcard() + "-" + pre.getDeptNo()
+ "-" + pre.getBuyStandard()+ "-" + pre.getInsuranceTypeName()
+ "-" + pre.getInsuranceCompanyName() + "-" + pre.getPolicyStart()
+ "-" + pre.getPolicyEnd()))
+ "-" + pre.getInsuranceCompanyName() + "-" + DateUtil.dateToString(pre.getPolicyStart(),DateUtil.ISO_EXPANDED_DATE_FORMAT)
+ "-" + DateUtil.dateToString(pre.getPolicyEnd(),DateUtil.ISO_EXPANDED_DATE_FORMAT)))
.collect(Collectors.toList());
//派单成功的更新状态为代投保,派单失败更新成派单失败
if (!existingList.isEmpty()){
......@@ -304,12 +301,14 @@ public class TEmployeeInsurancePreServiceImpl extends ServiceImpl<TEmployeeInsur
LambdaUpdateWrapper<TEmployeeInsurancePre> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.in(TEmployeeInsurancePre::getId,onIdList)
.set(TEmployeeInsurancePre::getProcessStatus, CommonConstants.TWO_STRING);
this.update(updateWrapper);
}
if (!nonExistingList.isEmpty()){
List<String> unIdList = insurancePreList.stream().map(TEmployeeInsurancePre::getId).collect(Collectors.toList());
LambdaUpdateWrapper<TEmployeeInsurancePre> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.in(TEmployeeInsurancePre::getId,unIdList)
.set(TEmployeeInsurancePre::getProcessStatus, CommonConstants.THREE_STRING);
this.update(updateWrapper);
}
}
return R.ok(autoAddParamList);
......@@ -325,8 +324,11 @@ public class TEmployeeInsurancePreServiceImpl extends ServiceImpl<TEmployeeInsur
//判断是否存在商险待购买信息
preExit = baseMapper.selectOne(Wrappers.<TEmployeeInsurancePre>query().lambda()
.eq(TEmployeeInsurancePre::getEmpIdcard, preVo.getEmpIdcard())
.eq(TEmployeeInsurancePre::getDeptNo, preVo.getDeptNo())
.eq(TEmployeeInsurancePre::getBuyType, preVo.getBuyType())
.eq(TEmployeeInsurancePre::getBuyStandard, preVo.getBuyStandard())
.eq(TEmployeeInsurancePre::getInsuranceTypeName, preVo.getInsuranceTypeName())
.eq(TEmployeeInsurancePre::getInsuranceCompanyName, preVo.getInsuranceCompanyName())
.eq(TEmployeeInsurancePre::getPolicyStart, preVo.getPolicyStart())
.eq(TEmployeeInsurancePre::getPolicyEnd, preVo.getPolicyEnd())
.last(CommonConstants.LAST_ONE_SQL));
TEmployeeInsurancePre pre = new TEmployeeInsurancePre();
BeanUtils.copyProperties(preVo, pre);
......@@ -340,20 +342,21 @@ public class TEmployeeInsurancePreServiceImpl extends ServiceImpl<TEmployeeInsur
//todo 操作记录
} else {
baseMapper.insert(pre);
if (Common.isNotNull(pre.getExpectedCollectionTime())) {
// 事务提交后触发调度
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
LocalDateTime now = LocalDateTime.now();
if (pre.getExpectedCollectionTime().isEqual(now)) {
scheduleService.executeTask(pre.getId());
} else if (preVo.getExpectedCollectionTime().compareTo(LocalDateTimeUtils.convertLDTToDate(now)) > 0){
scheduleService.scheduleTask(pre);
}
}
});
}
//暂时不需要,先注释,后续可能会需要
// if (Common.isNotNull(pre.getExpectedCollectionTime())) {
// // 事务提交后触发调度
// TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
// @Override
// public void afterCommit() {
// LocalDateTime now = LocalDateTime.now();
// if (pre.getExpectedCollectionTime().isEqual(now)) {
// scheduleService.executeTask(pre.getId());
// } else if (preVo.getExpectedCollectionTime().compareTo(LocalDateTimeUtils.convertLDTToDate(now)) > 0){
// scheduleService.scheduleTask(pre);
// }
// }
// });
// }
}
}
}
......@@ -400,8 +403,25 @@ public class TEmployeeInsurancePreServiceImpl extends ServiceImpl<TEmployeeInsur
//获取所有预计派单时间为当天而且状态是待确认的商险待购买数据
List<TEmployeeInsurancePre> unConfirmList = baseMapper.getAllUnconfimData();
if (Common.isNotNull(unConfirmList) && !unConfirmList.isEmpty()) {
for(TEmployeeInsurancePre pre : unConfirmList) {
sendMessageToWx(pre);
for (TEmployeeInsurancePre pre : unConfirmList) {
try {
sendMessageToWx(pre);
} catch (Exception e) {
log.error("执行异常", e);
}
}
}
}
@Override
public void pushDisConfrimInsurances() {
//获取所有待派单的数据
List<String> unConfirmList = baseMapper.getAllUnDisData();
if (null != unConfirmList && !unConfirmList.isEmpty()) {
try {
this.batchDispatcherInsurance(unConfirmList);
} catch (Exception e) {
log.error("执行异常", e);
}
}
}
......@@ -458,6 +478,7 @@ public class TEmployeeInsurancePreServiceImpl extends ServiceImpl<TEmployeeInsur
autoParam.setSettleMonth(addParam.getSettleMonth());
autoParam.setPost(addParam.getPost());
autoParam.setRemark(addParam.getRemark());
autoParam.setErrorMessage(addParam.getErrorMessage());
return autoParam;
}
......@@ -476,6 +497,7 @@ public class TEmployeeInsurancePreServiceImpl extends ServiceImpl<TEmployeeInsur
autoParam.setSettleMonth(batchParam.getSettleMonth());
autoParam.setPost(batchParam.getPost());
autoParam.setRemark(batchParam.getRemark());
autoParam.setErrorMessage(batchParam.getErrorMessage());
return autoParam;
}
......@@ -494,6 +516,7 @@ public class TEmployeeInsurancePreServiceImpl extends ServiceImpl<TEmployeeInsur
autoParam.setReplaceEmpName(replaceParam.getReplaceEmpName());
autoParam.setReplaceDeptNo(replaceParam.getReplaceDeptNo());
autoParam.setReplaceEmpIdcardNo(replaceParam.getReplaceEmpIdcardNo());
autoParam.setErrorMessage(replaceParam.getErrorMessage());
return autoParam;
}
......
......@@ -376,9 +376,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detail.setCreateName(user.getNickname());
detailList.add(detail);
sourceIdCardList.add(detail.getEmpIdcardNo());
baseMapper.insert(detail);
updateEmployeeInsurancePre(detail,CommonConstants.processStatus,CommonConstants.THREE_STRING);
}
this.saveBatch(detailList);
List<String> replaceIdList = new ArrayList<>();
for (TInsuranceDetail d : detailList) {
replaceIdList.add(d.getId());
......@@ -439,9 +439,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detailList.add(detail);
sourceIdCardList.add(detail.getEmpIdcardNo());
replaceIdList.add(detail.getId());
baseMapper.insert(detail);
updateEmployeeInsurancePre(detail,CommonConstants.processStatus,CommonConstants.THREE_STRING);
}
this.saveBatch(detailList);
// 同步操作档案的 商险状态为:2正常(0无2正常3失效4处理中)
this.doFailInfo(detailList, sourceIdCardList, replaceIdList, CommonConstants.FOUR_STRING);
}
......@@ -566,7 +566,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
replace.setCreateName(user.getNickname());
replace.setCreateTime(LocalDateTime.now());
tInsuranceReplaceService.save(replace);
updateEmployeeInsurancePre(detail,CommonConstants.processStatus,CommonConstants.THREE_STRING);
updateEmployeeInsurancePre(newDetail,CommonConstants.processStatus,CommonConstants.THREE_STRING);
}
detailList.add(newDetail);
}
......@@ -8339,6 +8339,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.last(CommonConstants.LAST_ONE_SQL));
if (Common.isNotNull(pre)) {
pre.setProcessStatus(status);
if (Common.isNotNull(insuranceDetail.getId())) {
pre.setInsurancesId(insuranceDetail.getId());
}
employeeInsurancePreMapper.updateById(pre);
}
}
......
......@@ -27,6 +27,7 @@
<result property="buyType" column="buy_type"/>
<result property="policyStart" column="policy_start"/>
<result property="policyEnd" column="policy_end"/>
<result property="policyEffect" column="policy_effect"/>
<result property="policyNo" column="policy_no"/>
<result property="isAddress" column="is_address"/>
<result property="position" column="position"/>
......@@ -39,6 +40,7 @@
<result property="replaceEmployeeName" column="replace_employee_name"/>
<result property="replaceEmpIdcard" column="replace_emp_idcard"/>
<result property="replaceDeptNo" column="replace_dept_no"/>
<result property="configName" column="config_name"/>
<result property="createBy" column="create_by"/>
<result property="createName" column="create_name"/>
<result property="createTime" column="create_time"/>
......@@ -99,7 +101,7 @@
a.create_name,
a.create_time,
a.update_by,
a.update_time,a.policy_no
a.update_time,a.policy_no,a.config_name,a.policy_effect
</sql>
<sql id="tEmployeeInsurancePre_where">
<if test="tEmployeeInsurancePre != null">
......@@ -309,4 +311,11 @@
where a.process_status = '0' and DATE_FORMAT(a.expected_collection_time,"%Y-%m-%d") = CURDATE()
group by a.customer_user_loginname
</select>
<select id="getAllUnDisData" resultType="java.lang.String">
SELECT
id
FROM t_employee_insurance_pre a
where a.process_status in ('1','2','5') and DATE_FORMAT(a.expected_collection_time,"%Y-%m-%d") <![CDATA[ <= ]]> CURDATE()
</select>
</mapper>
......@@ -15,7 +15,7 @@ import java.util.Date;
@Data
public class TEmployeeInsuranceWorkDayVo implements Serializable {
@Schema(description = "保单开始日期")
@Schema(description = "保单开始日期/预计生效日期")
private Date registDate;
@Schema(description = "预计派单日期")
......
......@@ -310,42 +310,42 @@ public class THolidayInfoServiceImpl extends ServiceImpl<THolidayInfoMapper, THo
holidayMap.put(h.getDate(),h.getDay());
}
}
if (CommonConstants.TWO_STRING.equals(vo.getType())) {
//查找入职日期的前一个工作日
TEmployeeInsuranceWorkDayVo newVo = new TEmployeeInsuranceWorkDayVo();
newVo.setRegistDate(vo.getRegistDate());
newVo.setType(CommonConstants.ONE_STRING);
getWorkDay(holidayMap, newVo);
//查找入职日期的前一个工作日
TEmployeeInsuranceWorkDayVo newVo = new TEmployeeInsuranceWorkDayVo();
newVo.setRegistDate(vo.getRegistDate());
newVo.setType(CommonConstants.ONE_STRING);
getWorkDay(holidayMap, newVo);
//判断前一个工作日是否大于今天
LocalDate givenLocalDate = newVo.getRegistDate().toInstant()
.atZone(java.time.ZoneId.systemDefault())
.toLocalDate();
// 获取今天的 LocalDate
LocalDate today = LocalDate.now();
LocalTime currentTime = LocalTime.now();
//判断前一个工作日是否大于今天
LocalDate givenLocalDate = newVo.getRegistDate().toInstant()
.atZone(java.time.ZoneId.systemDefault())
.toLocalDate();
// 获取今天的 LocalDate
LocalDate today = LocalDate.now();
LocalTime currentTime = LocalTime.now();
if (givenLocalDate.isBefore(today) || givenLocalDate.isEqual(today)) {
// 如果日期前一个工作日日期小于等于今天
if (currentTime.isBefore(LocalTime.of(14, 0))) {
// 如果当前时间在14:00之前
vo.setRegistDate(LocalDateTimeUtils.convertLDToDate(today));
vo.setPriDisDate(LocalDateTimeUtils.convertLDToDate(today));
} else {
// 如果当前时间在14:00之后
TEmployeeInsuranceWorkDayVo afterVo = new TEmployeeInsuranceWorkDayVo();
afterVo.setRegistDate(vo.getRegistDate());
afterVo.setType(CommonConstants.TWO_STRING);
getWorkDay(holidayMap, afterVo);
vo.setRegistDate(afterVo.getRegistDate());
vo.setPriDisDate(afterVo.getRegistDate());
}
if (givenLocalDate.isBefore(today) || givenLocalDate.isEqual(today)) {
// 如果日期前一个工作日日期小于等于今天
if (currentTime.isBefore(LocalTime.of(15, 20)) || currentTime.equals(LocalTime.of(15, 20))) {
// 如果当前时间在15:20之前
vo.setPriDisDate(LocalDateTimeUtils.convertLDToDate(today));
vo.setRegistDate(DateUtil.addDayByDate(vo.getPriDisDate(), CommonConstants.ONE_INT));
} else {
//如果前一个工作日日期大于今天
vo.setRegistDate(newVo.getRegistDate());
// 如果当前时间在15:20之后
TEmployeeInsuranceWorkDayVo afterVo = new TEmployeeInsuranceWorkDayVo();
afterVo.setRegistDate(LocalDateTimeUtils.convertLDToDate(today));
afterVo.setType(CommonConstants.TWO_STRING);
getWorkDay(holidayMap, afterVo);
vo.setPriDisDate(afterVo.getRegistDate());
vo.setRegistDate(DateUtil.addDayByDate(newVo.getRegistDate(), CommonConstants.ONE_INT));
}
} else {
//如果前一个工作日日期大于今天
//预计派单日期
vo.setPriDisDate(newVo.getRegistDate());
//预计生效日期
vo.setRegistDate(DateUtil.addDayByDate(newVo.getRegistDate(), CommonConstants.ONE_INT));
}
getWorkDay(holidayMap,vo);
return vo;
}
......
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