Commit ec3e9b30 authored by zhaji's avatar zhaji

"feature-zhaJi:优化减员退回bug"

parent 84dba00e
......@@ -243,6 +243,8 @@ public interface CommonConstants {
int FIVE_INT = 5;
String TEN_STRING = "10";
int SEVEN_INT = 7;
public static final String SPOT = ".";
int FIFTY_INT = 50;
......
package com.yifu.cloud.plus.v1.yifu.insurances.entity;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
......@@ -136,12 +138,18 @@ public class TInsuranceEkp implements Serializable {
/**
* 创建时间
*/
private Date createTime;
private LocalDateTime createTime;
/**
* 发送时间
*/
private Date pushTime;
private LocalDateTime pushTime;
/**
* EKP推送类型
*/
@Schema(description = "1推送预估费用,2推送实缴费用,3变更结算月,4推送作废信息,5推送红冲信息,6投保退回红冲,7变更保单保费")
private Integer pushType;
private static final long serialVersionUID = 1L;
......
......@@ -85,7 +85,7 @@ public class EKPUtil {
public static String sendToEKP(EKPInteractiveParam param){
log.info("推送EKP开始");
RestTemplate yourRestTemplate = new RestTemplate();
TInsuranceSettlePushParam pushParam = InsuranceDetail2PushParam(param);
TInsuranceSettlePushParam pushParam = insuranceDetail2PushParam(param);
try{
String formValues = new ObjectMapper().writeValueAsString(pushParam);
//指向EKP的接口url
......@@ -134,7 +134,7 @@ public class EKPUtil {
* @param param 转换类
* @return {@link TInsuranceSettlePushParam}
*/
public static TInsuranceSettlePushParam InsuranceDetail2PushParam(EKPInteractiveParam param){
public static TInsuranceSettlePushParam insuranceDetail2PushParam(EKPInteractiveParam param){
String format = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
TInsuranceSettlePushParam pushParam = new TInsuranceSettlePushParam();
param.setHappenDate(format);
......
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
/**
* @author zhaji
* @description TODO
* @date 2022-08-08 17:59:20
*/
@Data
public class EKP {
@Value("${ekp.url}")
private String url;
@Value("${ekp.fdModelId}")
private String fdModelId;
@Value("${ekp.fdFlowId}")
private String fdFlowId;
@Value("${ekp.docStatus}")
private String docStatus;
@Value("${ekp.docSubject}")
private String docSubject;
}
......@@ -165,4 +165,10 @@ public class EKPInteractiveParam implements Serializable {
@Schema(description = "状态:1新增结算单,2更新结算单信息,3作废结算单信息")
private Integer interactiveType;
/**
* EKP推送类型
*/
@Schema(description = "1推送预估费用,2推送实缴费用,3变更结算月,4推送作废信息,5推送红冲信息,6投保退回红冲,7变更保单保费")
private Integer pushType;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import java.io.Serializable;
/**
* @author zhaji
* @description EKP结算信息表
* @date 2022-08-24 17:37:21
*/
@Data
@Tag(name = "EKP结算信息表")
public class SettleVo implements Serializable {
/**
* 结算id
*/
@Schema(description = "结算id")
private String fd_3b05ba46bb042e;
/**
* 预估单结算状态
*/
@Schema(description = "预估单结算状态:未结算、已结算、结算中、无需结算")
private String fd_3b05ba4808a3ca;
/**
* 实缴单结算状态
*/
@Schema(description = "实缴单结算状态:未结算、已结算、结算中、无需结算")
private String fd_3b05bd5ed0b976;
}
......@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceEkp;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author Administrator
* @description 针对表【t_insurance_ekp(ekp交互失败存储表)】的数据库操作Mapper
......@@ -13,5 +15,13 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TInsuranceEkpMapper extends BaseMapper<TInsuranceEkp> {
/**
* 获取所有待发送的ekp
*
* @author zhaji
* @param
* @return {@link List< TInsuranceEkp>}
*/
List<TInsuranceEkp> getEkpRefundList();
}
......@@ -7,7 +7,6 @@ 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.google.common.collect.Sets;
import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.yifu.archives.vo.ProjectSetInfoVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.SetInfoVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TSettleDomainListVo;
......@@ -78,9 +77,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Resource
private TInsuranceOperateService tInsuranceOperateService;
@Resource
private CheckDaprUtil checkDaprUtil;
@Resource
private TInsuranceRefundService tInsuranceRefundService;
@Resource
private TInsuranceEkpService tInsuranceEkpService;
@Resource
private TInsuranceSettleCancelService tInsuranceSettleCancelService;
......@@ -1025,7 +1026,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
//获取成功数据的remark
paramList.stream().forEach(e ->{
if (detail.getId().equals(e.getId())){
......@@ -1223,7 +1223,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
updateBatchById(successList);
if (CollectionUtils.isNotEmpty(successList)){
threadPool.execute(() -> {
//todo 根据结算类型是合并结算,推送预估保费到ekp(上面已经算好,这里直接判断有预估保费的就推送)
//根据结算类型是合并结算,推送预估保费到ekp(上面已经算好,这里直接判断有预估保费的就推送)
for (TInsuranceDetail tInsuranceDetail : successList) {
Integer settleType = tInsuranceDetail.getSettleType();
//如果是合并计算则推送至EKP
......@@ -1237,8 +1237,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.set(TInsuranceSettle :: getEstimatePushTime,LocalDateTime.now());
//更新结算信息表
tInsuranceSettleService.update(settleWrapper);
}else{
//todo 异常处理
}
}
}
......@@ -1325,6 +1323,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (detail.getActualPremium() == null || (new BigDecimal(success.getActualPremium()).compareTo(detail.getActualPremium()) != 0)){
// todo 判断是否推送过ekp,没推送过调新增接口,推送过调更新接口
if (StringUtils.isNotBlank(detail.getDefaultSettleId())){
SettleVo settleVo = getInsuranceDetailSettleStatus(detail.getId(), detail.getDefaultSettleId());
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if (Optional.ofNullable(settle).isPresent()){
settle.setActualPremium(new BigDecimal(success.getActualPremium()));
......@@ -1358,6 +1357,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
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);
......@@ -2340,13 +2340,13 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
continue;
}else {
//校验当前项目是否在权限范围内
if(!deptNoList.stream().anyMatch(u ->u.equals(param.getDeptNo()))){
if(deptNoList.stream().noneMatch(u ->u.equals(param.getDeptNo()))){
param.setErrorMessage(InsurancesConstants.OLD_DEPT_NO_NOT_IN_DEPT_LIST);
listResult.add(param);
continue;
}
//校验当前项目是否在权限范围内
if(!deptNoList.stream().anyMatch(u ->u.equals(param.getReplaceDeptNo()))){
if(deptNoList.stream().noneMatch(u ->u.equals(param.getReplaceDeptNo()))){
param.setErrorMessage(InsurancesConstants.NEW_DEPT_NO_NOT_IN_DEPT_LIST);
listResult.add(param);
continue;
......@@ -2916,7 +2916,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
insuranceList = this.baseMapper.getInsuredListPage(page, param);
if (CollectionUtils.isNotEmpty(insuranceList.getRecords())){
//根据项目编码获取项目名称
List<String> collect = insuranceList.getRecords().stream().map(e -> e.getDeptNo()).distinct().collect(Collectors.toList());
List<String> collect = insuranceList.getRecords().stream().map(InsuredListVo::getDeptNo).distinct().collect(Collectors.toList());
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
......@@ -2954,7 +2954,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
insuredList = this.baseMapper.getInsuredList(param);
if (CollectionUtils.isNotEmpty(insuredList)){
//根据项目编码获取项目名称
List<String> collect = insuredList.stream().map(e -> e.getDeptNo()).distinct().collect(Collectors.toList());
List<String> collect = insuredList.stream().map(InsuredListVo::getDeptNo).distinct().collect(Collectors.toList());
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
......@@ -2991,7 +2991,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
IPage<InsuranceRefundListVo> insuranceRefundPageList = this.baseMapper.getInsuranceRefundPageList(page, param);
if (CollectionUtils.isNotEmpty(insuranceRefundPageList.getRecords())){
//根据项目编码获取项目名称
List<String> collect = insuranceRefundPageList.getRecords().stream().map(e -> e.getDeptNo()).distinct().collect(Collectors.toList());
List<String> collect = insuranceRefundPageList.getRecords().stream().map(InsuranceRefundListVo::getDeptNo).distinct().collect(Collectors.toList());
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
......@@ -3023,7 +3023,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<InsuranceRefundListVo> insuranceRefundList = this.baseMapper.getInsuranceRefundList(param);
if (CollectionUtils.isNotEmpty(insuranceRefundList)){
//根据项目编码获取项目名称
List<String> collect = insuranceRefundList.stream().map(e -> e.getDeptNo()).distinct().collect(Collectors.toList());
List<String> collect = insuranceRefundList.stream().map(InsuranceRefundListVo::getDeptNo).distinct().collect(Collectors.toList());
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
......@@ -3061,7 +3061,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
IPage<RefundExportListVo> insuranceRefundHandlingPageList = this.baseMapper.getInsuranceRefundHandlingPageList(page, param);
if (CollectionUtils.isNotEmpty(insuranceRefundHandlingPageList.getRecords())){
//根据项目编码获取项目名称
List<String> collect = insuranceRefundHandlingPageList.getRecords().stream().map(e -> e.getDeptNo()).distinct().collect(Collectors.toList());
List<String> collect = insuranceRefundHandlingPageList.getRecords().stream().map(RefundExportListVo::getDeptNo).distinct().collect(Collectors.toList());
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
......@@ -3097,11 +3097,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//如勾选项不为空,则导出勾选记录;否则导出当前筛选条件下 && 「待减员」的结果集
if (CollectionUtils.isNotEmpty(param.getIdList())){
refundExportList = baseMapper.getRefundExportListBySelect(param.getIdList());
for (RefundExportListVo refundExportListVo : refundExportList) {
if(null != refundExportListVo.getReduceHandleStatus() && CommonConstants.ONE_INT != refundExportListVo.getReduceHandleStatus()){
return R.failed(InsurancesConstants.CHANGE_ERROR);
}
}
}else {
refundExportList = baseMapper.getRefundExportList(param);
}
......@@ -3109,7 +3104,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<TInsuranceDetail> detailList = new ArrayList<>();
List<TInsuranceRefund> refundList = new ArrayList<>();
//根据项目编码获取项目名称
List<String> collect = refundExportList.stream().map(e -> e.getDeptNo()).distinct().collect(Collectors.toList());
List<String> collect = refundExportList.stream().map(RefundExportListVo::getDeptNo).distinct().collect(Collectors.toList());
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
......@@ -3139,10 +3134,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//批量更新
if (CollectionUtils.isNotEmpty(detailList)){
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
for (TInsuranceDetail s : detailList) {
updateWrapper.eq(TInsuranceDetail :: getId,s.getId())
.set(TInsuranceDetail :: getReduceHandleStatus,CommonConstants.TWO_INT);
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceDetail :: getId,s.getId()).set(TInsuranceDetail :: getReduceHandleStatus,CommonConstants.TWO_INT);
update(updateWrapper);
}
}
......@@ -3305,6 +3299,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//初始化线程池
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(10, 10, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(10));
YifuUser user = SecurityUtils.getUser();
List<TInsuranceDetail> detailList =new ArrayList<>();
if (!Common.isNotEmpty(settleMonthCheckList)) {
return R.failed(InsurancesConstants.SETTLE_MONTH_CHANGE_LIST_IS_EMPTY);
}
......@@ -3313,7 +3308,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<SettleMonthChangeCheckParam> successList = map.get("successList");
List<SettleMonthChangeCheckParam> errorList = map.get("errorList");
List<SettleMonthChangeCheckParam> ekpList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(successList)) {
if (CollectionUtils.isNotEmpty(successList)){
for (SettleMonthChangeCheckParam settleMonthChangeCheckParam : successList) {
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceDetail::getId, settleMonthChangeCheckParam.getId())
......@@ -3331,7 +3326,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceOperateService.save(insuranceOperate);
TInsuranceDetail byId = getById(settleMonthChangeCheckParam.getId());
String defaultSettleId = byId.getDefaultSettleId();
if (StringUtils.isNotBlank(defaultSettleId)) {
if (StringUtils.isNotBlank(defaultSettleId)){
TInsuranceSettle settle = tInsuranceSettleService.getById(defaultSettleId);
if (settle.getIsActualPush() == CommonConstants.ONE_INT || settle.getIsEstimatePush() == CommonConstants.ONE_INT) {
ekpList.add(settleMonthChangeCheckParam);
......@@ -3342,9 +3337,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//当前保单结算信息不为空且已推送的情况下,推送EKP进行变更
threadPool.execute(()->{
List<EKPInteractiveParam> deptDetail = getDeptDetail(ekpList);
for (EKPInteractiveParam ekpInteractiveParam : deptDetail) {
for (EKPInteractiveParam ekpInteractiveParam : deptDetail) {
String body = EKPUtil.sendToEKP(ekpInteractiveParam);
if (!StringUtils.isBlank(body)) {
if (!StringUtils.isBlank(body)){
TInsuranceOperate insuranceOperate = new TInsuranceOperate();
insuranceOperate.setInsuranceDetailId(ekpInteractiveParam.getDetailId());
insuranceOperate.setCreateBy(user.getId());
......@@ -3354,6 +3349,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
insuranceOperate.setDisplayFlag(CommonConstants.ZERO_INT);
tInsuranceOperateService.save(insuranceOperate);
} else {
saveInsuranceEkp(ekpInteractiveParam,CommonConstants.THREE_INT);
for (SettleMonthChangeCheckParam success : successList) {
if (success.getId().equals(ekpInteractiveParam.getDetailId())) {
success.setErrorMessage(InsurancesConstants.EKP_UPDATE_SETTLE_MONTH_ERROR);
......@@ -3364,6 +3360,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
});
}
//操作记录
addOperate(detailList,user,InsurancesConstants.MONTH_CHANGE,null,CommonConstants.ZERO_INT);
return R.ok(errorList, InsurancesConstants.IMPORT_SUCCESS );
}
/**
......@@ -3446,7 +3444,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceSettleCancelService.save(cancel);
//如果已经推送过实际保费,则先作废,再推送新的实际保费
if (byId.getIsActualPush() == CommonConstants.ONE_INT) {
//TODO: 2022/8/2
//推送至EKP执行作废操作
interactiveParam.setActualPremium(one.getActualPremium());
interactiveParam.setCustomerCode(success.getOldCustomerCode());
......@@ -3476,12 +3473,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
newInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(newInsuranceSettle);
}else {
//异常处理 // TODO: 2022/8/9
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.TWO_INT);
}
}
//变更后为合并结算
if (CommonConstants.ZERO_INT == newSettleType) {
// TODO: 2022/8/2
//先推送预估,再推送实际
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
......@@ -3510,13 +3507,76 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
newInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(newInsuranceSettle);
}else{
//异常处理 // TODO: 2022/8/9
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.TWO_INT);
}
}else{
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.ONE_INT);
}
}
}
}else{
// TODO: 2022/8/9 已有实缴但是未推送属于异常,暂时不推
// TODO: 2022/8/9 已有实缴但是未推送则推送新的结算信息
//变更后为单独结算
if (CommonConstants.ONE_INT == newSettleType) {
//推送新的结算信息至EKP
interactiveParam.setSettleType(CommonConstants.ONE_INT);
interactiveParam.setInteractiveType(CommonConstants.ONE_INT);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
interactiveParam.setDeptNo(success.getNewDeptNo());
interactiveParam.setDeptName(success.getNewDeptName());
interactiveParam.setActualPremium(success.getActualPremium());
String addBody = EKPUtil.sendToEKP(interactiveParam);
if (StringUtils.isNotBlank(addBody)){
newInsuranceSettle.setActualPushTime(LocalDateTime.now());
newInsuranceSettle.setIsActualPush(CommonConstants.ONE_INT);
newInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(newInsuranceSettle);
}else {
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.TWO_INT);
}
}
//变更后为合并结算
if (CommonConstants.ZERO_INT == newSettleType) {
//先推送预估,再推送实际
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
interactiveParam.setDeptNo(success.getNewDeptNo());
interactiveParam.setDeptName(success.getNewDeptName());
interactiveParam.setInteractiveType(CommonConstants.ONE_INT);
//推送预估单
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(null);
interactiveParam.setSettleType(CommonConstants.ZERO_INT);
String estimateBody = EKPUtil.sendToEKP(interactiveParam);
if (StringUtils.isNotBlank(estimateBody)) {
newInsuranceSettle.setEstimatePushTime(LocalDateTime.now());
newInsuranceSettle.setIsEstimatePush(CommonConstants.ONE_INT);
newInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(newInsuranceSettle);
//推送实缴单
interactiveParam.setSettleType(CommonConstants.ONE_INT);
interactiveParam.setEstimatePremium(null);
interactiveParam.setActualPremium(success.getActualPremium());
String actualBody = EKPUtil.sendToEKP(interactiveParam);
if (StringUtils.isNotBlank(actualBody)) {
//推送成功后更新本地推送状态
newInsuranceSettle.setActualPushTime(LocalDateTime.now());
newInsuranceSettle.setIsActualPush(CommonConstants.ONE_INT);
newInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(newInsuranceSettle);
}else{
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.TWO_INT);
}
}else{
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.ONE_INT);
}
}
}
}
//未登记保单保费
......@@ -3524,7 +3584,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//变更后为单独结算
if (CommonConstants.ONE_INT == newSettleType){
//变更项目且不做处理
//update(updateWrapper);
}
//变更后为合并结算
if (CommonConstants.ZERO_INT == newSettleType){
......@@ -3542,7 +3601,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,tInsuranceSettle.getId());
update(updateWrapper);
//推送结算信息至EKP
// TODO: 2022/8/2
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
interactiveParam.setDeptNo(success.getNewDeptNo());
......@@ -3559,7 +3617,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(tInsuranceSettle);
}else{
//异常处理 // TODO: 2022/8/9
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.ONE_INT);
}
}
}
......@@ -3591,9 +3650,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceSettleService.save(newInsuranceSettle);
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,newInsuranceSettle.getId());
update(updateWrapper);
//如果预估和实缴都推送了
if(byId.getIsActualPush() == CommonConstants.ONE_INT && byId.getIsEstimatePush() == CommonConstants.ONE_INT){
//推送作废结算信息至EKP
// TODO: 2022/8/2
interactiveParam.setCustomerCode(success.getOldCustomerCode());
interactiveParam.setCustomerName(success.getOldCustomerName());
interactiveParam.setDeptNo(success.getOldDeptNo());
......@@ -3613,7 +3672,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
updateWrapper.set(TInsuranceDetail ::getEstimatePremium,new BigDecimal("0.00"));
update(updateWrapper);
//推送新的结算信息至EKP,推实际保费
// TODO: 2022/8/2
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
interactiveParam.setDeptNo(success.getNewDeptNo());
......@@ -3630,12 +3688,13 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
newInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(newInsuranceSettle);
}else{
//异常处理 // TODO: 2022/8/9
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.TWO_INT);
}
}
//变更为合并结算
if (CommonConstants.ZERO_INT == newSettleType){
// 推送新的结算信息 TODO: 2022/8/2
// 推送新的结算信息
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
interactiveParam.setDeptNo(success.getNewDeptNo());
......@@ -3654,20 +3713,107 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
newInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(newInsuranceSettle);
}else{
//todo 异常情况,需进行处理
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.ONE_INT);
}
}
}else{
//todo 异常情况,需进行处理
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.FOUR_INT);
}
}
//如果预估已推送和实缴未推送
if(byId.getIsActualPush() == CommonConstants.ZERO_INT && byId.getIsEstimatePush() == CommonConstants.ONE_INT){
//推送作废结算信息至EKP
interactiveParam.setCustomerCode(success.getOldCustomerCode());
interactiveParam.setCustomerName(success.getOldCustomerName());
interactiveParam.setDeptNo(success.getOldDeptNo());
interactiveParam.setDeptName(success.getOldDeptName());
interactiveParam.setInteractiveType(CommonConstants.THREE_INT);
interactiveParam.setEstimatePremium(one.getEstimatePremium());
interactiveParam.setActualPremium(one.getActualPremium());
interactiveParam.setSettleType(CommonConstants.ONE_INT);
String deleteBody = EKPUtil.sendToEKP(interactiveParam);
if(StringUtils.isNotBlank(deleteBody)){
//先推送预估,再推送实际
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
interactiveParam.setDeptNo(success.getNewDeptNo());
interactiveParam.setDeptName(success.getNewDeptName());
interactiveParam.setInteractiveType(CommonConstants.ONE_INT);
//推送预估单
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(null);
interactiveParam.setSettleType(CommonConstants.ZERO_INT);
String estimateBody = EKPUtil.sendToEKP(interactiveParam);
if (StringUtils.isNotBlank(estimateBody)) {
newInsuranceSettle.setEstimatePushTime(LocalDateTime.now());
newInsuranceSettle.setIsEstimatePush(CommonConstants.ONE_INT);
newInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(newInsuranceSettle);
//推送实缴单
interactiveParam.setSettleType(CommonConstants.ONE_INT);
interactiveParam.setEstimatePremium(null);
interactiveParam.setActualPremium(success.getActualPremium());
String actualBody = EKPUtil.sendToEKP(interactiveParam);
if (StringUtils.isNotBlank(actualBody)) {
//推送成功后更新本地推送状态
newInsuranceSettle.setActualPushTime(LocalDateTime.now());
newInsuranceSettle.setIsActualPush(CommonConstants.ONE_INT);
newInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(newInsuranceSettle);
}else{
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.TWO_INT);
}
}else{
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.ONE_INT);
}
}
}
//如果预估和实缴均未推送
if(byId.getIsActualPush() == CommonConstants.ZERO_INT && byId.getIsEstimatePush() == CommonConstants.ONE_INT){
//先推送预估,再推送实际
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
interactiveParam.setDeptNo(success.getNewDeptNo());
interactiveParam.setDeptName(success.getNewDeptName());
interactiveParam.setInteractiveType(CommonConstants.ONE_INT);
//推送预估单
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(null);
interactiveParam.setSettleType(CommonConstants.ZERO_INT);
String estimateBody = EKPUtil.sendToEKP(interactiveParam);
if (StringUtils.isNotBlank(estimateBody)) {
newInsuranceSettle.setEstimatePushTime(LocalDateTime.now());
newInsuranceSettle.setIsEstimatePush(CommonConstants.ONE_INT);
newInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(newInsuranceSettle);
//推送实缴单
interactiveParam.setSettleType(CommonConstants.ONE_INT);
interactiveParam.setEstimatePremium(null);
interactiveParam.setActualPremium(success.getActualPremium());
String actualBody = EKPUtil.sendToEKP(interactiveParam);
if (StringUtils.isNotBlank(actualBody)) {
//推送成功后更新本地推送状态
newInsuranceSettle.setActualPushTime(LocalDateTime.now());
newInsuranceSettle.setIsActualPush(CommonConstants.ONE_INT);
newInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(newInsuranceSettle);
}else{
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.TWO_INT);
}
}else{
//异常处理
saveInsuranceEkp(interactiveParam,CommonConstants.ONE_INT);
}
}else{
//todo 异常情况,需进行处理
}
}
//如果没有登记保费
if (BigDecimalUtils.isNullOrZero(actualPremium)){
if(byId.getIsEstimatePush() == CommonConstants.ONE_INT){
//推送至EKP TODO: 2022/8/2
interactiveParam.setCustomerCode(success.getOldCustomerCode());
interactiveParam.setCustomerName(success.getOldCustomerName());
interactiveParam.setDeptNo(success.getOldDeptNo());
......@@ -3702,7 +3848,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,newInsuranceSettle.getId());
update(updateWrapper);
//推送新的结算信息至EKP
// TODO: 2022/8/2
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
interactiveParam.setDeptNo(success.getNewDeptNo());
......@@ -3720,13 +3865,34 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceSettleService.updateById(newInsuranceSettle);
}else{
//异常处理 // TODO: 2022/8/9
saveInsuranceEkp(interactiveParam,CommonConstants.ONE_INT);
}
}
}else{
//异常处理 // TODO: 2022/8/9
saveInsuranceEkp(interactiveParam,CommonConstants.FOUR_INT);
}
}else{
//todo 异常情况,需进行处理
//推送新的结算信息至EKP
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
interactiveParam.setDeptNo(success.getNewDeptNo());
interactiveParam.setDeptName(success.getNewDeptName());
interactiveParam.setInteractiveType(CommonConstants.ONE_INT);
interactiveParam.setEstimatePremium(success.getEstimatePremium());
interactiveParam.setActualPremium(null);
interactiveParam.setSettleType(CommonConstants.ONE_INT);
String estimateBody = EKPUtil.sendToEKP(interactiveParam);
if(StringUtils.isNotBlank(estimateBody)){
//推送成功更新预估推送状态
newInsuranceSettle.setIsEstimatePush(CommonConstants.ONE_INT);
newInsuranceSettle.setEstimatePushTime(LocalDateTime.now());
newInsuranceSettle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(newInsuranceSettle);
}else{
//异常处理 // TODO: 2022/8/9
saveInsuranceEkp(interactiveParam,CommonConstants.ONE_INT);
}
}
}
}
......@@ -3952,7 +4118,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
errorList.add(param);
continue;
}
if(!deptNoList.stream().anyMatch(u -> u.equals(one.getDeptNo()))){
if(deptNoList.stream().noneMatch(u -> u.equals(one.getDeptNo()))){
param.setErrorMessage(InsurancesConstants.DEPT_NO_NOT_IN_DEPT_LIST);
errorList.add(param);
continue;
......@@ -4131,7 +4297,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
continue;
}
//项目所属权限验证
if(!deptNoList.stream().anyMatch(u ->u.equals(deptNo))){
if(deptNoList.stream().noneMatch(u ->u.equals(deptNo))){
param.setErrorMessage(InsurancesConstants.DEPT_NO_NOT_IN_USER_DEPT_LIST);
errorList.add(param);
continue;
......@@ -4500,15 +4666,15 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
errorList.add(param);
continue;
}
//已减员
//减员退回
if(CommonConstants.THREE_INT == reduceHandleStatus ){
param.setErrorMessage(InsurancesConstants.REFUND_STATUS_THREE_HANDLE_ERROR);
param.setErrorMessage(InsurancesConstants.REFUND_STATUS_FOUR_HANDLE_ERROR);
errorList.add(param);
continue;
}
//减员退回
if(CommonConstants.FOUR_INT == reduceHandleStatus ){
param.setErrorMessage(InsurancesConstants.REFUND_STATUS_FOUR_HANDLE_ERROR);
//已减员
if(CommonConstants.FOUR_INT== reduceHandleStatus ){
param.setErrorMessage(InsurancesConstants.REFUND_STATUS_THREE_HANDLE_ERROR);
errorList.add(param);
continue;
}
......@@ -4696,18 +4862,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
//旧项目ID不在当前权限范围内
if(!deptNoList.stream().anyMatch(u ->u.equals(oldDeptNo))){
param.setErrorMessage(InsurancesConstants.OLD_DEPT_NO_NOT_IN_DEPT_LIST);
errorList.add(param);
continue;
}
//新项目ID不在当前权限范围内
if(!deptNoList.stream().anyMatch(u ->u.equals(newDeptNo))){
param.setErrorMessage(InsurancesConstants.NEW_DEPT_NO_NOT_IN_DEPT_LIST);
errorList.add(param);
continue;
}
//必填格式校通过后查询对应的保单信息
LambdaQueryWrapper<TInsuranceDetail> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceDetail :: getDeleteFlag,CommonConstants.ZERO_INT)
......@@ -4735,13 +4889,13 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
continue;
}
//旧项目ID不在当前权限范围内
if(!deptNoList.stream().anyMatch(u ->u.equals(oldDeptNo))){
if(deptNoList.stream().noneMatch(u ->u.equals(oldDeptNo))){
param.setErrorMessage(InsurancesConstants.OLD_DEPT_NO_NOT_IN_DEPT_LIST);
errorList.add(param);
continue;
}
//新项目ID不在当前权限范围内
if(!deptNoList.stream().anyMatch(u ->u.equals(newDeptNo))){
if(deptNoList.stream().noneMatch(u ->u.equals(newDeptNo))){
param.setErrorMessage(InsurancesConstants.NEW_DEPT_NO_NOT_IN_DEPT_LIST);
errorList.add(param);
continue;
......@@ -4860,7 +5014,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
public R getDeptList(){
List<TInsuranceDetail> detailList = new ArrayList<>();
//EKPUtil.testAddNewsInRestTemplate(detailList);
/* List<Dept> deptList = new ArrayList<>();
List<Dept> deptList = new ArrayList<>();
R<TSettleDomainListVo> tSettleDomainListVoR = archivesDaprUtil.selectAllSettleDomainSelectVos();
if (null != tSettleDomainListVoR && tSettleDomainListVoR.getCode() == CommonConstants.SUCCESS && Common.isNotNull(tSettleDomainListVoR.getData())) {
TSettleDomainListVo data = tSettleDomainListVoR.getData();
......@@ -4873,8 +5027,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
return R.ok(deptList);*/
return R.ok();
return R.ok(deptList);
}
/**
......@@ -5031,7 +5184,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
public List<EKPInteractiveParam> getDeptDetail(List<SettleMonthChangeCheckParam> list){
//根据项目编码获取项目名称
List<String> collect = list.stream().map(e -> e.getDeptNo()).distinct().collect(Collectors.toList());
List<String> collect = list.stream().map(SettleMonthChangeCheckParam::getDeptNo).distinct().collect(Collectors.toList());
List<EKPInteractiveParam> ekpInteractiveParams = new ArrayList<>();
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(collect);
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS && Common.isNotNull(setInfoByCodes.getData())) {
......@@ -5052,13 +5205,14 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
/**
* 投保成功后推送预估保费
* 推送EKP
*
* @author zhaji
* @param
* @return {@link String}
*/
public String pushEstimate(TInsuranceDetail tInsuranceDetail,Integer pushType){
public String pushEstimate(TInsuranceDetail tInsuranceDetail,Integer type){
Integer pushType = null;
//1,推送预估保费,2,推送实际保费,3推送预估冲正保费,4更新实际保费
EKPInteractiveParam param = new EKPInteractiveParam();
List<String> deptNoList =new ArrayList<>();
......@@ -5075,17 +5229,19 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setCustomerCode(projectSetInfoVo.getCustomerCode());
}
//1,推送预估保费(用户办理成功,推送预估保费)
if(CommonConstants.ONE_INT == pushType){
if(CommonConstants.ONE_INT == type){
param.setInteractiveType(CommonConstants.ONE_INT);
param.setSettleType(CommonConstants.ONE_INT);
pushType = CommonConstants.ONE_INT;
}
//2,推送实际保费(用于登记保单保费未推送过实缴保费)
if(CommonConstants.TWO_INT == pushType){
if(CommonConstants.TWO_INT == type){
param.setInteractiveType(CommonConstants.ONE_INT);
param.setSettleType(CommonConstants.TWO_INT);
pushType = CommonConstants.TWO_INT;
}
//3推送预估冲正保费(用于投保退回场景)
if(CommonConstants.THREE_INT == pushType){
if(CommonConstants.THREE_INT == type){
String defaultSettleId = tInsuranceDetail.getDefaultSettleId();
TInsuranceSettle byId = tInsuranceSettleService.getById(defaultSettleId);
//冲正取负数
......@@ -5097,14 +5253,54 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
param.setInteractiveType(CommonConstants.ONE_INT);
param.setSettleType(CommonConstants.ONE_INT);
pushType = CommonConstants.FIVE_INT;
}
//4更新实际保费(用于登记保单保费场景推送过实缴保费)
if(CommonConstants.FOUR_INT == pushType){
if(CommonConstants.FOUR_INT == type){
param.setInteractiveType(CommonConstants.TWO_INT);
param.setSettleType(CommonConstants.ONE_INT);
pushType = CommonConstants.SEVEN_INT;
}
String body = EKPUtil.sendToEKP(param);
return body;
if(StringUtils.isBlank(EKPUtil.sendToEKP(param))){
saveInsuranceEkp(param,pushType);
return null;
}else {
return EKPUtil.sendToEKP(param);
}
}
/**
* 获取当前保单的结算状态
*
* @author zhaji
* @param
* @return {@link String}
*/
public SettleVo getInsuranceDetailSettleStatus(String detailId,String settleId){
String id = detailId+CommonConstants.DOWN_LINE_STRING+settleId;
//获取ekp结算信息
SettleVo settleVo = new SettleVo();
//id
settleVo.setFd_3b05ba46bb042e(id);
settleVo.setFd_3b05ba4808a3ca("预估单结算状态");
settleVo.setFd_3b05bd5ed0b976("实缴单结算状态");
return settleVo;
}
/**
* 保存失败信息
*
* @author zhaji
* @param
* @return {@link String}
*/
public Boolean saveInsuranceEkp(EKPInteractiveParam param,Integer pushType){
TInsuranceEkp ekp = new TInsuranceEkp();
BeanCopyUtils.copyProperties(param,ekp);
ekp.setCreateTime(LocalDateTime.now());
ekp.setPushType(pushType);
tInsuranceEkpService.save(ekp);
return Boolean.TRUE;
}
......
......@@ -24,13 +24,9 @@ public class TInsuranceEkpServiceImpl extends ServiceImpl<TInsuranceEkpMapper, T
@Override
public R resend() {
LambdaQueryWrapper<TInsuranceEkp> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceEkp :: getResendFlag , CommonConstants.ZERO_INT);
queryWrapper.orderByDesc(TInsuranceEkp::getDetailId);
queryWrapper.orderByAsc(TInsuranceEkp::getCreateTime);
List<TInsuranceEkp> list = list(queryWrapper);
if (CollectionUtils.isNotEmpty(list)){
for (TInsuranceEkp tInsuranceEkp : list) {
List<TInsuranceEkp> ekpRefundList = this.baseMapper.getEkpRefundList();
if (CollectionUtils.isNotEmpty(ekpRefundList)){
for (TInsuranceEkp tInsuranceEkp : ekpRefundList) {
EKPInteractiveParam ekpParam = new EKPInteractiveParam();
BeanCopyUtils.copyProperties(tInsuranceEkp,ekpParam);
String detailId = ekpParam.getDetailId();
......
......@@ -31,6 +31,8 @@
<result property="resendFlag" column="RESEND_FLAG" jdbcType="VARCHAR"/>
<result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
<result property="pushTime" column="PUSH_TIME" jdbcType="TIMESTAMP"/>
<result property="pushType" column="PUSH_TYPE" jdbcType="TINYINT"/>
</resultMap>
<sql id="Base_Column_List">
......@@ -42,8 +44,17 @@
POLICY_END,BUY_STANDARD,MEDICAL_QUOTA,
DIE_DISABLE_QUOTA,ACTUAL_PREMIUM,ESTIMATE_PREMIUM,
SETTLE_MONTH,INTERACTIVE_TYPE,RESEND_FLAG,
CREATE_TIME,PUSH_TIME
CREATE_TIME,PUSH_TIME,PUSH_TYPE
</sql>
<select id="getEkpRefundList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"></include>
from
t_insurance_ekp
where
RESEND_FLAG = 0
</select>
</mapper>
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