Commit 9dd0aa39 authored by hongguangwu's avatar hongguangwu

MVP1.7.9-修改商险自动化

parent c10b4d74
......@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.csp.entity.EmployeeRegistration;
import com.yifu.cloud.plus.v1.csp.vo.EmployeeRegistrationUpdateVo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.EmployeeRegistrationPreMapper;
......@@ -49,6 +50,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.text.ParseException;
import java.time.LocalDateTime;
import java.util.*;
......@@ -408,11 +410,16 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
**/
@Override
public R updateCommonInfo(EmployeeRegistrationPre employeeRegistrationPre) {
if (Common.isEmpty(employeeRegistrationPre.getId())) {
String id = employeeRegistrationPre.getId();
if (Common.isEmpty(id)) {
return R.failed("请传ID");
}
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user) || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
//旧的对象,用来对比变更参数
EmployeeRegistrationPre comparePre = baseMapper.selectById(employeeRegistrationPre.getId());
EmployeeRegistrationPre comparePre = baseMapper.selectById(id);
if (Common.isEmpty(comparePre)) {
return R.failed(CommonConstants.NO_DATA_TO_HANDLE);
}
......@@ -420,7 +427,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
Map<String, TEmployeeInsurancePre> oldMap = new HashMap<>();
// 查原商险,来对比
R<EmployeePreLogListVo> sdr = HttpDaprUtil.invokeMethodPost(daprInsurancesProperties.getAppUrl(), daprInsurancesProperties.getAppId()
, "/temployeeinsurancepre/inner/getListByEmpPreId", employeeRegistrationPre.getId(), EmployeePreLogListVo.class, SecurityConstants.FROM_IN);
, "/temployeeinsurancepre/inner/getListByEmpPreId", id, EmployeePreLogListVo.class, SecurityConstants.FROM_IN);
List<TEmployeeInsurancePre> oldList = null;
if (sdr != null && sdr.getData() != null && sdr.getData().getPreList() != null && !sdr.getData().getPreList().isEmpty()) {
oldList = sdr.getData().getPreList();
......@@ -448,6 +455,8 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
if (Common.isNotNull(insurancePreVo.getId())) {
newMap.put(insurancePreVo.getId(), insurancePreVo);
}
// 初始化信息
initInsurancePreInfo(employeeRegistrationPre, insurancePreVo, user, id);
// 1:重复性判断
key = this.getFiveKey(insurancePreVo);
newDeptNo = insurancePreVo.getDeptNo();
......@@ -611,9 +620,7 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
}
}
}
YifuUser user = SecurityUtils.getUser();
try {
baseMapper.updateById(employeeRegistrationPre);
if (null != natureItemBefore) {
comparePre.setEmpNature(natureItemBefore);
......@@ -643,6 +650,46 @@ public class EmployeeRegistrationPreServiceImpl extends ServiceImpl<EmployeeRegi
return R.ok();
}
private void initInsurancePreInfo(EmployeeRegistrationPre registration, TEmployeeInsurancePre preVo,
YifuUser user, String id) {
preVo.setRegisterId(id);
preVo.setCustomerUsername(registration.getCustomerUsername());
preVo.setCustomerUserLoginname(registration.getCustomerUserLoginname());
preVo.setDeptName(registration.getDeptName());
preVo.setDeptId(registration.getDeptId());
preVo.setDataSource(registration.getDataSource());
preVo.setPosition(registration.getPosition());
preVo.setJoinLeaveDate(registration.getJoinLeaveDate());
preVo.setDeptNo(registration.getDeptNo());
preVo.setEmpPhone(registration.getEmpPhone());
preVo.setEmployeeName(registration.getEmployeeName());
preVo.setEmpIdcard(registration.getEmpIdcard());
preVo.setCreateBy(user.getId());
preVo.setCreateName(user.getNickname());
preVo.setUpdateBy(user.getId());
/*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( preVo.getExpectedCollectionTime(), DateUtil.ISO_EXPANDED_DATE_FORMAT) + " 14:00", DateUtil.DATETIME_PATTERN_MINUTE));
}
/**
* @param insurancePreVo
* @Description: 获取5个字段构成的关键字
......
......@@ -147,7 +147,8 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
List<TEmployeePreLogDetail> detailList = new ArrayList<>();
// 档案信息修改
TEmployeePreLogDetail detailEmpLog = null;
if (Common.isNotNull(differenceKey)) {
if (Common.isNotNull(differenceKey) && !"insurancePreList".equals(differenceKey)) {
differenceKey = differenceKey.replace("insurancePreList","");
diffTitle = "档案信息";
detailEmpLog = new TEmployeePreLogDetail();
detailEmpLog.setModelType(CommonConstants.TWO_STRING);
......@@ -233,9 +234,10 @@ public class TEmployeePreLogServiceImpl extends ServiceImpl<TEmployeePreLogMappe
tEmployeePreLogDetailService.saveBatch(detailList);
}
if (!saveOrUpdateList.isEmpty()) {
// JSON.toJSONString(
HttpDaprUtil.invokeMethodPost(daprInsurancesProperties.getAppUrl(), daprInsurancesProperties.getAppId()
, "/temployeeinsurancepre/inner/saveOrUpdateInsuranceList"
, JSON.toJSONString(saveOrUpdateList), Boolean.class, SecurityConstants.FROM_IN);
, saveOrUpdateList, Boolean.class, SecurityConstants.FROM_IN);
}
}
} catch (Exception e) {
......
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