Commit 182158ea authored by huyuchen's avatar huyuchen

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

parent 49debd0c
......@@ -36,5 +36,11 @@
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</dependency>
</dependencies>
<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-insurances-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
......@@ -120,7 +120,7 @@ public class EmployeeRegistrationPreController {
**/
@Inner
@PostMapping("/inner/saveRegistPreInfo")
public Boolean saveRegistPreInfo(@RequestBody EmployeeRegistrationPreVo preVo) {
public String saveRegistPreInfo(@RequestBody EmployeeRegistrationPreVo preVo) {
return employeeRegistrationPreService.saveRegistPreInfo(preVo);
}
......
......@@ -47,7 +47,7 @@ public interface EmployeeRegistrationPreService extends IService<EmployeeRegistr
* @param preVo 新增入职待建档vo
* @return
*/
Boolean saveRegistPreInfo(EmployeeRegistrationPreVo preVo);
String saveRegistPreInfo(EmployeeRegistrationPreVo preVo);
/**
* 拒绝入职
......
......@@ -220,7 +220,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
@Override
@Transactional
public Boolean saveRegistPreInfo(EmployeeRegistrationPreVo preVo) {
public String saveRegistPreInfo(EmployeeRegistrationPreVo preVo) {
//判断是否存在入职确认信息
EmployeeRegistrationPre preExit = baseMapper.selectOne(Wrappers.<EmployeeRegistrationPre>query().lambda()
.eq(EmployeeRegistrationPre::getEmpIdcard, preVo.getEmpIdcard())
......@@ -349,7 +349,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
}
});
}
return true;
return pre.getId();
}
@Override
......
......@@ -553,8 +553,8 @@ public class ArchivesDaprUtil {
* @Param
* @return
**/
public R<Boolean> saveRegistPreInfo(EmployeeRegistrationPreVo preVo) {
return HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/employeeregistrationpre/inner/saveRegistPreInfo", JSON.toJSONString(preVo), Boolean.class, SecurityConstants.FROM_IN);
public R<String> saveRegistPreInfo(EmployeeRegistrationPreVo preVo) {
return HttpDaprUtil.invokeMethodPost(daprArchivesProperties.getAppUrl(),daprArchivesProperties.getAppId(),"/employeeregistrationpre/inner/saveRegistPreInfo", JSON.toJSONString(preVo), String.class, SecurityConstants.FROM_IN);
}
/**
......
......@@ -10,6 +10,7 @@ import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSocialViewVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.*;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import com.yifu.cloud.plus.v1.yifu.social.entity.TPaymentInfo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TEmployeeInsuranceWorkDayVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TIncomeDetailReturnVo;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -177,4 +178,25 @@ public class SocialDaprUtils {
,"/tsocialfundinfo/inner/selectWorkInjuryHandleAll", null, ListStringVo.class, SecurityConstants.FROM_IN);
}
/**
* @Author huyc
* @Description 查询最近的工作日期
* @Date 16:39 2025/4/7
* @Param
* @return
**/
public R<TEmployeeInsuranceWorkDayVo> getBeforeOrAfterWorkDay(TEmployeeInsuranceWorkDayVo vo) {
return HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tholidayinfo/inner/getBeforeOrAfterWorkDay", JSON.toJSONString(vo), TEmployeeInsuranceWorkDayVo.class, SecurityConstants.FROM_IN);
}
/**
* @Author huyc
* @Description 查询最近的工作日期
* @Date 17:56 2025/4/7
* @Param
* @return
**/
public R<Boolean> checkIsWorkDay(TEmployeeInsuranceWorkDayVo vo) {
return HttpDaprUtil.invokeMethodPost(daprProperties.getAppUrl(),daprProperties.getAppId(),"/tholidayinfo/inner/checkIsWorkDay", JSON.toJSONString(vo), Boolean.class, SecurityConstants.FROM_IN);
}
}
......@@ -33,13 +33,11 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.UserPermissionVo;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprArchivesProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.InsuranceDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.UpmsDaprUtils;
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.insurances.util.ValidityUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.TEmployeeInsurancePreVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TEmployeeInsuranceWorkDayVo;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -79,6 +77,9 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
@Autowired
private ArchivesDaprUtil archivesDaprUtil;
@Autowired
private SocialDaprUtils socialDaprUtils;
@Autowired
private WxConfig wxConfig;
......@@ -541,6 +542,19 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
*/
@Override
public R confirmReceive(EmployeeRegistrationPreVo preVo) {
if (preVo.getServerItem().contains("商险") && !preVo.getEmployeeInsurancePreVos().isEmpty()) {
StringBuilder errorTemp = new StringBuilder();
for (TEmployeeInsurancePreVo insurancePreVo : preVo.getEmployeeInsurancePreVos()) {
String error = checkInsuranceBuy(insurancePreVo,CommonConstants.ONE_STRING);
if (null != error) {
errorTemp.append(error);
}
}
if (errorTemp.length() > 0) {
return R.other(CommonConstants.TWO_INT,null,errorTemp.toString());
}
}
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(preVo)) {
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
......@@ -550,6 +564,9 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
!CommonConstants.ONE_STRING.equals(registration.getProcessStatus()))) {
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
}
//商险是否存在判断
//点击“接收确认”的时候,监测到该人员该项目下已有在项的档案时,再次提醒:该人员已在项,
//状态将更新成“已处理”;处理记录中,针对此情况,记录真实的进项时间,备注:先于登记入项
EmpProjectStatusVo vo = new EmpProjectStatusVo();
......@@ -566,11 +583,12 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
try {
//生成档案待建档数据
initRegistPreInfo(registration, preVo, user, CommonConstants.ZERO_STRING);
archivesDaprUtil.saveRegistPreInfo(preVo);
if (preVo.getServerItem().contains("商险") && !preVo.getEmployeeInsurancePreVos().isEmpty()) {
R<String> domainR = archivesDaprUtil.saveRegistPreInfo(preVo);
if (Common.isNotNull(domainR) && Common.isNotNull(domainR.getData()) &&
preVo.getServerItem().contains("商险") && !preVo.getEmployeeInsurancePreVos().isEmpty()) {
//生成商险待购买的数据
for (TEmployeeInsurancePreVo insurancePreVo : preVo.getEmployeeInsurancePreVos()) {
initInsruancePreInfo(registration, insurancePreVo, user, CommonConstants.ZERO_STRING);
initInsruancePreInfo(registration, insurancePreVo, user, CommonConstants.ZERO_STRING,domainR.getData());
}
insuranceDaprUtil.saveInsurancePreInfo(preVo);
}
......@@ -591,6 +609,18 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
if (Common.isEmpty(preVo)) {
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
if (preVo.getServerItem().contains("商险") && !preVo.getEmployeeInsurancePreVos().isEmpty()) {
StringBuilder errorTemp = new StringBuilder();
for (TEmployeeInsurancePreVo insurancePreVo : preVo.getEmployeeInsurancePreVos()) {
String error = checkInsuranceBuy(insurancePreVo,CommonConstants.TWO_STRING);
if (null != error) {
errorTemp.append(error);
}
}
if (errorTemp.length() > 0) {
return R.other(CommonConstants.TWO_INT,null,errorTemp.toString());
}
}
//查询该项目该前端客服下所有待接收的入职登记
//前端客服的所有项目权限赋值
EmployeeRegistrationSearchVo searchVo = new EmployeeRegistrationSearchVo();
......@@ -606,6 +636,9 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
if (Common.isEmpty(registrationList)) {
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
}
//先进行商险是否存在校验
List<EmployeeRegistrationReceiveVo> receiveVoList = new ArrayList<>();
for (EmployeeRegistration registration:registrationList) {
//点击“接收确认”的时候,监测到该人员该项目下已有在项的档案时,再次提醒:该人员已在项,
......@@ -632,11 +665,12 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
try {
//生成档案待建档数据
initRegistPreInfo(registration, preVo, user, CommonConstants.ZERO_STRING);
archivesDaprUtil.saveRegistPreInfo(preVo);
if (preVo.getServerItem().contains("商险") && !preVo.getEmployeeInsurancePreVos().isEmpty()) {
R<String> domainR = archivesDaprUtil.saveRegistPreInfo(preVo);
if (Common.isNotNull(domainR) && Common.isNotNull(domainR.getData()) &&
preVo.getServerItem().contains("商险") && !preVo.getEmployeeInsurancePreVos().isEmpty()) {
//生成商险待购买的数据
for (TEmployeeInsurancePreVo insurancePreVo : preVo.getEmployeeInsurancePreVos()) {
initInsruancePreInfo(registration, insurancePreVo, user, CommonConstants.ZERO_STRING);
initInsruancePreInfo(registration, insurancePreVo, user, CommonConstants.ZERO_STRING,domainR.getData());
}
insuranceDaprUtil.saveInsurancePreInfo(preVo);
}
......@@ -1119,8 +1153,8 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
//商险待购买数据初始化
private void initInsruancePreInfo(EmployeeRegistration registration,TEmployeeInsurancePreVo preVo,
YifuUser user,String status) throws ParseException {
preVo.setRegisterId(registration.getId());
YifuUser user,String status,String id) throws ParseException {
preVo.setRegisterId(id);
preVo.setCustomerUsername(registration.getCustomerUsername());
preVo.setCustomerUserLoginname(registration.getCustomerUserLoginname());
preVo.setDeptName(registration.getDeptName());
......@@ -1137,7 +1171,62 @@ public class EmployeeRegistrationServiceImpl extends ServiceImpl<EmployeeRegistr
preVo.setUpdateBy(user.getId());
preVo.setEmpIdcard(registration.getEmpIdcard());
preVo.setProcessStatus(status);
if (Common.isNotNull(preVo.getPolicyStartType()) && CommonConstants.ONE_STRING.equals(preVo.getPolicyStartType())) {
preVo.setPolicyStart(preVo.getJoinLeaveDate());
}
//预计派单日期
if (Common.isEmpty(preVo.getExpectedCollectionTime())) {
TEmployeeInsuranceWorkDayVo dayVo = new TEmployeeInsuranceWorkDayVo();
dayVo.setType(CommonConstants.ONE_STRING);
if (preVo.getBuyType() ==1) {
dayVo.setRegistDate(preVo.getPolicyStart());
} else {
dayVo.setRegistDate(preVo.getJoinLeaveDate());
}
R<TEmployeeInsuranceWorkDayVo> dataR = socialDaprUtils.getBeforeOrAfterWorkDay(dayVo);
if (Common.isNotNull(dataR) && Common.isNotNull(dataR.getData())
&& Common.isNotNull(dataR.getData().getRegistDate())) {
preVo.setExpectedCollectionTime(dataR.getData().getRegistDate());
} else {
preVo.setExpectedCollectionTime(preVo.getPolicyStart());
}
}
preVo.setExpectedCollectionTime(DateUtil.parseDate(DateUtil.dateToString(
registration.getJoinLeaveDate(), DateUtil.ISO_EXPANDED_DATE_FORMAT) + " 14:00", DateUtil.DATETIME_PATTERN_MINUTE));
preVo.getExpectedCollectionTime(), DateUtil.ISO_EXPANDED_DATE_FORMAT) + " 14:00", DateUtil.DATETIME_PATTERN_MINUTE));
}
//商险的工作日判断 type 1 单个接收 2 批量接收
private String checkInsuranceBuy(TEmployeeInsurancePreVo preVo,String type) {
//新增判断保单开始日期
TEmployeeInsuranceWorkDayVo vo = new TEmployeeInsuranceWorkDayVo();
R<Boolean> dataR;
if (preVo.getBuyType() == 1) {
vo.setRegistDate(preVo.getPolicyStart());
dataR = socialDaprUtils.checkIsWorkDay(vo);
if (Common.isNotNull(dataR) && Boolean.TRUE.equals(dataR.getData())) {
return "新增类型的保单开始日期不能为工作日;";
}
}
if (preVo.getBuyType() == 3 && CommonConstants.ONE_STRING.equals(type)){
vo.setRegistDate(preVo.getExpectedCollectionTime());
dataR = socialDaprUtils.checkIsWorkDay(vo);
if (Common.isNotNull(dataR) && Boolean.TRUE.equals(dataR.getData())) {
return "批增类型的预计派单日期不能为工作日;";
}
}
if (preVo.getBuyType() == 4 && CommonConstants.ONE_STRING.equals(type)){
vo.setRegistDate(preVo.getExpectedCollectionTime());
dataR = socialDaprUtils.checkIsWorkDay(vo);
if (Common.isNotNull(dataR) && Boolean.TRUE.equals(dataR.getData())) {
return "替换类型的预计派单日期不能为工作日;";
}
}
return null;
}
//商险是否存在判断 type 1 单个接收 2 批量接收
private String checkInsuranceExit(TEmployeeInsurancePreVo preVo,String type) {
return null;
}
}
......@@ -233,11 +233,11 @@ public class TEmployeeInsurancePreVo implements Serializable {
private String cityCode;
/**
* 入离职登记主表id
* 入职确认信息id
*/
@ExcelAttribute(name = "入离职登记主表id")
@Schema(description = "入离职登记主表id")
@ExcelProperty("入离职登记主表id")
@ExcelAttribute(name = "入职确认信息主表id")
@Schema(description = "入职确认信息主表id")
@ExcelProperty("入职确认信息主表id")
private String registerId;
/**
......@@ -273,4 +273,7 @@ public class TEmployeeInsurancePreVo implements Serializable {
@Schema(description = "更新人")
private String updateBy;
@Schema(description = "保单开始日期类型 1的话默认等于入职日期")
private String policyStartType;
}
......@@ -6,7 +6,7 @@ import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
@Configuration
public class TaskSchedulerConfig {
public class InsuranceTaskSchedulerConfig {
@Bean
public TaskScheduler taskScheduler() {
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
......
......@@ -6,6 +6,7 @@ import com.yifu.cloud.plus.v1.yifu.insurances.entity.TEmployeeInsurancePre;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.ScheduleService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TEmployeeInsurancePreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionTemplate;
......@@ -22,9 +23,12 @@ public class ScheduleServiceImpl implements ScheduleService {
@Autowired
private TEmployeeInsurancePreService insurancePreService;
@Autowired
private TaskScheduler taskScheduler;
@Autowired
@Qualifier("insurancesTransactionTemplate")
private TransactionTemplate transactionTemplate;
// 应用启动时初始化未处理的任务
......
......@@ -181,6 +181,28 @@ public class THolidayInfoController {
**/
@PostMapping("/selectBeforeOrAfterWorkDay")
public R selectBeforeOrAfterWorkDay(@RequestBody TEmployeeInsuranceWorkDayVo vo) {
return R.ok(tHolidayInfoService.selectBeforeOrAfterWorkDay(vo));
}
/**
* @Author huyc
* @Description 查询日期的前一个/后一个工作日
* @Date 10:27 2025/4/7
**/
@Inner
@PostMapping("/inner/getBeforeOrAfterWorkDay")
public TEmployeeInsuranceWorkDayVo getBeforeOrAfterWorkDay(@RequestBody TEmployeeInsuranceWorkDayVo vo) {
return tHolidayInfoService.selectBeforeOrAfterWorkDay(vo);
}
/**
* @Author huyc
* @Description 判断日期是否为节假日
* @Date 17:55 2025/4/7
**/
@Inner
@PostMapping("/inner/checkIsWorkDay")
public Boolean checkIsWorkDay(@RequestBody TEmployeeInsuranceWorkDayVo vo) {
return tHolidayInfoService.checkIsWorkDay(vo);
}
}
......@@ -51,5 +51,7 @@ public interface THolidayInfoService extends IService<THolidayInfo> {
void createHolidayInfo();
R selectBeforeOrAfterWorkDay(TEmployeeInsuranceWorkDayVo vo);
TEmployeeInsuranceWorkDayVo selectBeforeOrAfterWorkDay(TEmployeeInsuranceWorkDayVo vo);
Boolean checkIsWorkDay(TEmployeeInsuranceWorkDayVo vo);
}
......@@ -281,7 +281,7 @@ public class THolidayInfoServiceImpl extends ServiceImpl<THolidayInfoMapper, THo
}
@Override
public R selectBeforeOrAfterWorkDay(TEmployeeInsuranceWorkDayVo vo) {
public TEmployeeInsuranceWorkDayVo selectBeforeOrAfterWorkDay(TEmployeeInsuranceWorkDayVo vo) {
//获取当年所有假期配置表
Date date = new Date();
List<THolidayInfo> holidayInfos = baseMapper.selectList(Wrappers.<THolidayInfo>query().lambda()
......@@ -293,7 +293,15 @@ public class THolidayInfoServiceImpl extends ServiceImpl<THolidayInfoMapper, THo
}
}
getWorkDay(holidayMap,vo);
return R.ok(vo);
return vo;
}
@Override
public Boolean checkIsWorkDay(TEmployeeInsuranceWorkDayVo vo) {
//假期配置表
return baseMapper.selectCount(Wrappers.<THolidayInfo>query().lambda()
.eq(THolidayInfo::getDate,vo.getRegistDate())) > 0;
}
private void getWorkDay(Map<Date, String> holidayMap, TEmployeeInsuranceWorkDayVo 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