Commit a4b626e4 authored by zhaji's avatar zhaji

"feature-zhaJi:新增登记保单保费,商险办理成功,商险退回的EKP交互"

parent 196ebb65
......@@ -36,17 +36,17 @@ public class InsurancesConstants {
*/
public static final String CHANGE_ERROR = "数据发生变动,请刷新数据后重新办理";
/**
* 导出办理
* 投保导出办理
*/
public static final String EXPORT = "导出办理";
public static final String EXPORT = "投保导出办理";
/**
* 投保退回
*/
public static final String ROLLBACK = "投保退回";
/**
* 办理成功
* 投保办理成功
*/
public static final String SUCCESSFUL = "办理成功";
public static final String SUCCESSFUL = "投保办理成功";
/**
* 登记保单保费
*/
......@@ -687,18 +687,18 @@ public class InsurancesConstants {
public static final String INSURANCE_REFUND_IMPORT = "导入减员数据";
/**
* 导出待减员数据
* 减员导出办理
*/
public static final String INSURANCE_REFUND_EXPORT = "导出待减员数据";
public static final String INSURANCE_REFUND_EXPORT = "减员导出办理";
/**
* 减员成功
* 减员办理成功
*/
public static final String INSURANCE_REFUND_SUCCESS = "减员成功";
public static final String INSURANCE_REFUND_SUCCESS = "减员办理成功";
/**
* 减员退回
* 减员退回成功
*/
public static final String INSURANCE_REFUND_FAILED = "减员退回";
......
......@@ -36,7 +36,7 @@ public class EKPInteractiveParam implements Serializable {
/**
* 单据类型 (0、与薪资合并结算 1、单独结算)
*/
@Schema(description = "单据类型 (0、预估单 1、实缴单)")
@Schema(description = "单据类型 (1、预估单 2、实缴单)")
private Integer settleType;
/**
......
......@@ -938,7 +938,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if(detail.getBuyType() == CommonConstants.FOUR_INT){
//替换者有效状态为空
detail.setIsEffect(null);
TInsuranceReplace one = tInsuranceReplaceService.getOne(Wrappers.<TInsuranceReplace>query().lambda()
.eq(TInsuranceReplace::getToInsuranceDetailId, detail.getId())
.last(CommonConstants.LAST_ONE_SQL));
......@@ -994,9 +993,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
tInsuranceSettleService.save(burden);
//推送负的给ekp
String s = pushEstimate(detail, CommonConstants.THREE_INT);
//这里退回的时候,必须置为null,防止是实缴的时候,登记保费出错
detail.setDefaultSettleId(null);
if(StringUtils.isNotBlank(s)){
detail.setDefaultSettleId(null);
}
}
}
}
......@@ -1020,6 +1021,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
public R<List<InsuranceListVO>> successfulInsurance(List<String> idList) {
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(50, 50, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(10));
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
......@@ -1079,11 +1081,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
settle.setInsDetailId(detail.getId());
settle.setSettleType(detail.getSettleType());
settle.setSettleHandleStatus(CommonConstants.ONE_STRING);
settle.setCreateTime(LocalDateTime.now());
settle.setEstimatePremium(estimatePremium);
//调完ekp接口才会是1
settle.setIsEstimatePush(CommonConstants.ONE_INT);
settle.setEstimatePushTime(LocalDateTime.now());
settle.setCreateTime(LocalDateTime.now());
settle.setIsEstimatePush(CommonConstants.ZERO_INT);
tInsuranceSettleService.save(settle);
detail.setDefaultSettleId(settle.getId());
successList.add(detail);
......@@ -1142,13 +1143,27 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
if (CollectionUtils.isNotEmpty(successList)){
for (TInsuranceDetail tInsuranceDetail : successList) {
this.updateById(tInsuranceDetail);
pushEstimate(tInsuranceDetail);
Integer settleType = tInsuranceDetail.getSettleType();
//如果是合并计算则推送至EKP
if(CommonConstants.ZERO_INT == settleType){
//存储成功后发送给EKP
threadPool.execute(() -> {
String s = pushEstimate(tInsuranceDetail,CommonConstants.ONE_INT);
if(StringUtils.isNotBlank(s)){
LambdaUpdateWrapper<TInsuranceSettle> settleWrapper = new LambdaUpdateWrapper<>();
settleWrapper.eq(TInsuranceSettle :: getId,tInsuranceDetail.getDefaultSettleId())
.set(TInsuranceSettle :: getIsEstimatePush,CommonConstants.ONE_INT)
.set(TInsuranceSettle :: getEstimatePushTime,LocalDateTime.now());
//更新结算信息表
tInsuranceSettleService.update(settleWrapper);
//更新保单信息表
updateById(tInsuranceDetail);
}
});
}else{
updateById(tInsuranceDetail);
}
}
//更新
this.saveOrUpdateBatch(successList);
//todo 根据结算类型是合并结算,推送预估保费到ekp(上面已经算好,这里直接判断有预估保费的就推送)
//结算状态是待结算,结算中、已结算是ekp反馈的,如果结算失败,反馈到我们这边的状态是待结算
}
......@@ -1168,6 +1183,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
public R<List<InsuranceRegisterParam>> registeredPolicyPremium(List<InsuranceRegisterParam> paramList) {
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(50, 50, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(10));
if (CollectionUtils.isEmpty(paramList)){
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
......@@ -1216,9 +1232,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
settle.setActualPushTime(LocalDateTime.now());
settle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(settle);
//调更新接口
//更新实际保费
detail.setActualPremium(new BigDecimal(success.getActualPremium()));
threadPool.execute(() ->{
pushEstimate(detail,CommonConstants.FOUR_INT);
});
}
}else {
//保费存储
......@@ -1227,22 +1245,26 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
settle.setSettleType(detail.getSettleType());
settle.setSettleHandleStatus(CommonConstants.ONE_STRING);
settle.setActualPremium(new BigDecimal(success.getActualPremium()));
settle.setIsActualPush(CommonConstants.ZERO_INT);
//调完ekp接口才会是1
settle.setIsActualPush(CommonConstants.ONE_INT);
settle.setActualPushTime(LocalDateTime.now());
settle.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(settle);
detail.setDefaultSettleId(settle.getId());
//调新增接口
//调EKP新增实际保费
detail.setActualPremium(new BigDecimal(success.getActualPremium()));
threadPool.execute(() ->{
String s = pushEstimate(detail, CommonConstants.TWO_INT);
if(StringUtils.isNotBlank(s)){
settle.setActualPushTime(LocalDateTime.now());
settle.setIsActualPush(CommonConstants.ONE_INT);
tInsuranceSettleService.updateById(settle);
}
});
}
}
detail.setActualPremium(new BigDecimal(success.getActualPremium()));
}
//可以改成批量更新
this.updateById(detail);
detailList.add(detail);
}
}
......@@ -3054,7 +3076,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
BeanCopyUtils.copyProperties(byId,ekpInteractiveParam);
ekpInteractiveParam.setSettleMonth(settleMonth);
String body = EKPUtil.sendToEKP(ekpInteractiveParam);
System.out.println("变更成功后的id为:"+body);
if (!StringUtils.isBlank(body)){
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceDetail ::getId,ekpInteractiveParam.getId())
......@@ -3068,9 +3089,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
insuranceOperate.setCreateName(user.getNickname());
insuranceOperate.setCreateTime(LocalDateTime.now());
insuranceOperate.setOperateDesc(InsurancesConstants.MONTH_CHANGE);
operateList.add(insuranceOperate);
tInsuranceOperateService.save(insuranceOperate);
}else{
System.out.println("更新EKP结算月份失败");
for (SettleMonthChangeCheckParam success: successList ){
if(success.getId().equals(ekpInteractiveParam.getId())){
success.setErrorMessage("更新EKP结算月份失败");
......@@ -3091,7 +3111,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
insuranceOperate.setCreateName(user.getNickname());
insuranceOperate.setCreateTime(LocalDateTime.now());
insuranceOperate.setOperateDesc(InsurancesConstants.MONTH_CHANGE);
operateList.add(insuranceOperate);
tInsuranceOperateService.save(insuranceOperate);
}
}else{
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
......@@ -3106,12 +3126,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
insuranceOperate.setCreateName(user.getNickname());
insuranceOperate.setCreateTime(LocalDateTime.now());
insuranceOperate.setOperateDesc(InsurancesConstants.MONTH_CHANGE);
operateList.add(insuranceOperate);
tInsuranceOperateService.save(insuranceOperate);
}
});
}
tInsuranceOperateService.saveBatch(operateList);
}
return R.ok(errorList,"导入成功");
}
......@@ -3133,7 +3151,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.failed("当前变更所属项目列表为空");
}
Map<String, List<DeptChangeCheckParam>> stringListMap = deptChangeCheck(deptChangeCheckList,user);
//todo 生成EKP通知,通知ekp变更结算所属项目
List<DeptChangeCheckParam> successList = stringListMap.get("successList");
List<TInsuranceOperate> operateList = new ArrayList<>(16);
if(CollectionUtils.isNotEmpty(successList)){
......@@ -3183,7 +3200,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
interactiveParam.setDeptName(success.getOldDeptName());
interactiveParam.setInteractiveType(CommonConstants.THREE_INT);
String deleteBody = EKPUtil.sendToEKP(interactiveParam);
if (StringUtils.isBlank(deleteBody)) {
if (StringUtils.isNotBlank(deleteBody)) {
//推送成功更新作废推送状态
cancel.setIsCancelPush(CommonConstants.ONE_INT);
tInsuranceSettleCancelService.updateById(cancel);
......@@ -3252,7 +3269,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
interactiveParam.setActualPremium(null);
interactiveParam.setSettleType(CommonConstants.ZERO_INT);
String estimateBody = EKPUtil.sendToEKP(interactiveParam);
if (!StringUtils.isBlank(estimateBody)) {
if (StringUtils.isNotBlank(estimateBody)) {
newInsuranceSettle.setEstimatePushTime(LocalDateTime.now());
newInsuranceSettle.setIsEstimatePush(CommonConstants.ONE_INT);
newInsuranceSettle.setUpdateTime(LocalDateTime.now());
......@@ -3262,7 +3279,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
interactiveParam.setEstimatePremium(null);
interactiveParam.setActualPremium(success.getActualPremium());
String actualBody = EKPUtil.sendToEKP(interactiveParam);
if (!StringUtils.isBlank(actualBody)) {
if (StringUtils.isNotBlank(actualBody)) {
//推送成功后更新本地推送状态
newInsuranceSettle.setActualPushTime(LocalDateTime.now());
newInsuranceSettle.setIsActualPush(CommonConstants.ONE_INT);
......@@ -3312,7 +3329,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
interactiveParam.setActualPremium(null);
interactiveParam.setSettleType(CommonConstants.ZERO_INT);
String estimateBody = EKPUtil.sendToEKP(interactiveParam);
if(!StringUtils.isBlank(estimateBody)){
if(StringUtils.isNotBlank(estimateBody)){
//推送成功后更新本地推送状态
tInsuranceSettle.setIsEstimatePush(CommonConstants.ONE_INT);
tInsuranceSettle.setEstimatePushTime(LocalDateTime.now());
......@@ -3433,7 +3450,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}else{
//异常处理 // TODO: 2022/8/9
}
}
//如果没有登记保费
if (BigDecimalUtils.isNullOrZero(actualPremium)){
......@@ -4615,10 +4631,50 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @param
* @return {@link String}
*/
public String pushEstimate(TInsuranceDetail tInsuranceDetail){
String deptNo = tInsuranceDetail.getDeptNo();
return null;
public String pushEstimate(TInsuranceDetail tInsuranceDetail,Integer pushType){
//1,推送预估保费,2,推送实际保费,3推送预估冲正保费,4更新实际保费
EKPInteractiveParam param = new EKPInteractiveParam();
List<String> deptNoList =new ArrayList<>();
deptNoList.add(tInsuranceDetail.getDeptNo());
BeanCopyUtils.copyProperties(tInsuranceDetail,param);
//获取当前项目的名称,客户名称和客户编码
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(deptNoList);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
SetInfoVo data = setInfoByCodes.getData();
Map<String, ProjectSetInfoVo> projectSetInfoVoMap = data.getProjectSetInfoVoMap();
ProjectSetInfoVo projectSetInfoVo = projectSetInfoVoMap.get(tInsuranceDetail.getDeptNo());
param.setDeptName(projectSetInfoVo.getDepartName());
param.setCustomerName(projectSetInfoVo.getCustomerName());
param.setCustomerCode(projectSetInfoVo.getCustomerCode());
}
//1,推送预估保费(用户办理成功,推送预估保费)
if(CommonConstants.ONE_INT == pushType){
param.setInteractiveType(CommonConstants.ONE_INT);
param.setSettleType(CommonConstants.ONE_INT);
}
//2,推送实际保费(用于登记保单保费未推送过实缴保费)
if(CommonConstants.TWO_INT == pushType){
param.setInteractiveType(CommonConstants.ONE_INT);
param.setSettleType(CommonConstants.TWO_INT);
}
//3推送预估冲正保费(用于投保退回场景)
if(CommonConstants.THREE_INT == pushType){
String defaultSettleId = tInsuranceDetail.getDefaultSettleId();
TInsuranceSettle byId = tInsuranceSettleService.getById(defaultSettleId);
//冲正取负数
param.setEstimatePremium(byId.getEstimatePremium().negate());
param.setActualPremium(byId.getActualPremium().negate());
param.setInteractiveType(CommonConstants.ONE_INT);
param.setSettleType(CommonConstants.ONE_INT);
}
//4更新实际保费(用于登记保单保费场景推送过实缴保费)
if(CommonConstants.FOUR_INT == pushType){
param.setInteractiveType(CommonConstants.TWO_INT);
param.setSettleType(CommonConstants.ONE_INT);
}
String body = EKPUtil.sendToEKP(param);
return body;
}
}
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