Commit 065e5ebd authored by 查济's avatar 查济

Merge branch 'feature-zhaji' into 'develop'

"feature-zhaJi:修改商险重发部分逻辑"

See merge request fangxinjiang/yifu!239
parents 16c50c06 703ce61c
...@@ -38,7 +38,7 @@ public class TInsuranceEkp implements Serializable { ...@@ -38,7 +38,7 @@ public class TInsuranceEkp implements Serializable {
/** /**
* 单据类型 (0、与薪资合并结算 1、单独结算) * 单据类型 (0、与薪资合并结算 1、单独结算)
*/ */
private Integer settleType; private String settleType;
/** /**
* 项目编码 * 项目编码
...@@ -138,7 +138,7 @@ public class TInsuranceEkp implements Serializable { ...@@ -138,7 +138,7 @@ public class TInsuranceEkp implements Serializable {
/** /**
* 单据状态 * 单据状态
*/ */
private Integer interactiveType; private String interactiveType;
/** /**
* 重发标识 * 重发标识
......
...@@ -5648,13 +5648,13 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -5648,13 +5648,13 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
} }
param.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL); param.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
param.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL); param.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
pushType = CommonConstants.FIVE_INT; pushType = CommonConstants.SIX_INT;
} }
//4更新实际保费(用于登记保单保费场景推送过实缴保费) //4更新实际保费(用于登记保单保费场景推送过实缴保费)
if(CommonConstants.FOUR_INT == type){ if(CommonConstants.FOUR_INT == type){
param.setInteractiveType(InsurancesConstants.UPDATE_SETTLE_BILL); param.setInteractiveType(InsurancesConstants.UPDATE_SETTLE_BILL);
param.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL); param.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
pushType = CommonConstants.SEVEN_INT; pushType = CommonConstants.THREE_INT;
} }
//作废 //作废
if(CommonConstants.FIVE_INT == type){ if(CommonConstants.FIVE_INT == type){
......
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.ekp.constant.EkpConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpInsuranceUtil; import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpInsuranceUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants; import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail; import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
...@@ -58,183 +59,185 @@ public class TInsuranceEkpServiceImpl extends ServiceImpl<TInsuranceEkpMapper, T ...@@ -58,183 +59,185 @@ public class TInsuranceEkpServiceImpl extends ServiceImpl<TInsuranceEkpMapper, T
@Override @Override
public R resend() { public R resend() {
List<TInsuranceEkp> ekpRefundList = this.baseMapper.getEkpRefundList(); List<TInsuranceEkp> ekpRefundList = this.baseMapper.getEkpRefundList();
List<TInsuranceEkp> failList = new ArrayList<>();
List<TInsuranceEkp> successLit = new ArrayList<>();
if (CollectionUtils.isNotEmpty(ekpRefundList)){ if (CollectionUtils.isNotEmpty(ekpRefundList)){
for (TInsuranceEkp tInsuranceEkp : ekpRefundList) { for (TInsuranceEkp tInsuranceEkp : ekpRefundList) {
TInsuranceDetail byId = tInsuranceDetailService.getById(tInsuranceEkp.getDetailId()); TInsuranceDetail byId = tInsuranceDetailService.getById(tInsuranceEkp.getDetailId());
String defaultSettleId = byId.getDefaultSettleId(); String defaultSettleId = byId.getDefaultSettleId();
if (tInsuranceEkp.getDefaultSettleId().equals(defaultSettleId)){ String s = null;
//ekp结算信息 String settleType = tInsuranceEkp.getSettleType();
SettleVo settleVo = tInsuranceDetailService.getInsuranceDetailSettleStatus(tInsuranceEkp.getDetailId(), tInsuranceEkp.getDefaultSettleId()); Integer pushType = tInsuranceEkp.getPushType();
//商险结算信息 //商险结算信息
TInsuranceSettle insuranceSettle = tInsuranceSettleService.getById(tInsuranceEkp.getDefaultSettleId()); TInsuranceSettle insuranceSettle = tInsuranceSettleService.getById(tInsuranceEkp.getDefaultSettleId());
//预估推送状态 boolean settleIdEquals = tInsuranceEkp.getDefaultSettleId().equals(defaultSettleId);
Integer isEstimatePush = insuranceSettle.getIsEstimatePush(); //预估是否已发送
//实缴推送状态 boolean estimatePush = Common.isEmpty(insuranceSettle) && insuranceSettle.getIsEstimatePush() == CommonConstants.ZERO_INT;
Integer isActualPush = insuranceSettle.getIsActualPush(); //实缴是否已发送
//实缴结算状态 boolean actualPush = Common.isEmpty(insuranceSettle) && insuranceSettle.getIsActualPush() == CommonConstants.ZERO_INT;
String actualStatus = settleVo.getActualStatus(); //结算类型是否一致
//预缴结算状态 boolean settleTypeEquals = settleType.equals(byId.getSettleType().toString());
String estimateStatus = settleVo.getEstimateStatus(); EkpInteractiveParam ekpParam = new EkpInteractiveParam();
Integer pushType = tInsuranceEkp.getPushType(); BeanCopyUtils.copyProperties(tInsuranceEkp,ekpParam);
//如果当前需要重发预估保费的数据已发送,则过滤掉执行下一条数据 LambdaUpdateWrapper<TInsuranceSettle> settleUpdate = new LambdaUpdateWrapper<>();
if(CommonConstants.ONE_INT == pushType && CommonConstants.ONE_INT == isEstimatePush){ settleUpdate.eq(TInsuranceSettle :: getId,tInsuranceEkp.getDefaultSettleId());
tInsuranceEkp.setResendFlag(CommonConstants.THREE_INT); LambdaUpdateWrapper<TInsuranceDetail> detailUpdate = new LambdaUpdateWrapper<>();
failList.add(tInsuranceEkp); detailUpdate.eq(TInsuranceDetail :: getId,tInsuranceEkp.getDetailId());
LambdaUpdateWrapper<TInsuranceEkp> ekpUpdate = new LambdaUpdateWrapper<>();
ekpUpdate.eq(TInsuranceEkp :: getId,tInsuranceEkp.getId());
if(settleType.equals(CommonConstants.ZERO_STRING)){
ekpParam.setEstimateStatus(EkpConstants.HAVE);
}else{
ekpParam.setEstimateStatus(EkpConstants.NOTHING);
}
//预估新增重发
if(CommonConstants.ONE_INT == pushType){
//如果结算类型不一致,结算类型不为空且已预估发送,结算id不一致
if(!settleTypeEquals || !estimatePush || !settleIdEquals){
ekpUpdate.set(TInsuranceEkp :: getResendFlag,CommonConstants.TWO_INT);
update(ekpUpdate);
continue; continue;
}else{
ekpParam.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
ekpParam.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)){
settleUpdate.set(TInsuranceSettle :: getEstimatePushTime,LocalDateTime.now())
.set(TInsuranceSettle ::getIsEstimatePush,CommonConstants.ONE_INT);
tInsuranceSettleService.update(settleUpdate);
ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT);
update(ekpUpdate);
}else{
break;
}
} }
//如果当前需要重发实际保费的数据已发送,则过滤掉执行下一条数据 }
if(CommonConstants.TWO_INT == pushType && CommonConstants.ONE_INT == isActualPush){ //实缴新增重发
tInsuranceEkp.setResendFlag(CommonConstants.THREE_INT); if(CommonConstants.TWO_INT == pushType){
failList.add(tInsuranceEkp); //如果结算类型不一致,结算类型不为空且已发送,结算id不一致
if(!settleTypeEquals || !actualPush || !settleIdEquals){
ekpUpdate.set(TInsuranceEkp :: getResendFlag,CommonConstants.TWO_INT);
update(ekpUpdate);
continue; continue;
}else{
ekpParam.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
ekpParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)){
settleUpdate.set(TInsuranceSettle :: getActualPushTime,LocalDateTime.now())
.set(TInsuranceSettle ::getIsActualPush,CommonConstants.ONE_INT);
tInsuranceSettleService.update(settleUpdate);
ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT);
update(ekpUpdate);
}else{
break;
}
} }
EkpInteractiveParam ekpParam = new EkpInteractiveParam(); }
BeanCopyUtils.copyProperties(tInsuranceEkp,ekpParam); //ekp结算信息
//如果预估未结算 SettleVo settleVo = tInsuranceDetailService.getInsuranceDetailSettleStatus(tInsuranceEkp.getDetailId(), tInsuranceEkp.getDefaultSettleId());
LambdaUpdateWrapper<TInsuranceSettle> updateWrapper = new LambdaUpdateWrapper<>(); //实缴结算状态
String s = null; String actualStatus = null;
if(InsurancesConstants.SETTLE_ZERO.equals(estimateStatus)){ //预缴结算状态
//实缴未结算 String estimateStatus = null;
if(InsurancesConstants.SETTLE_ZERO.equals(actualStatus)){ if(!Common.isEmpty(settleVo) ){
//如果是新增预估保费,则推送预估保费新增 estimateStatus = settleVo.getEstimateStatus();
if(CommonConstants.ONE_INT == pushType){ actualStatus = settleVo.getActualStatus();
s = ekpInsuranceUtil.sendToEkp(ekpParam); }
if(StringUtils.isNotBlank(s)){ boolean eStatus = InsurancesConstants.SETTLE_ZERO.equals(estimateStatus);
updateWrapper.eq(TInsuranceSettle :: getId,tInsuranceEkp.getDefaultSettleId()) boolean aStatus = InsurancesConstants.SETTLE_ZERO.equals(actualStatus);
.set(TInsuranceSettle :: getIsEstimatePush,CommonConstants.ONE_INT) //变更结算信息
.set(TInsuranceSettle :: getEstimatePushTime, LocalDateTime.now()); if(CommonConstants.THREE_INT == pushType){
tInsuranceSettleService.update(updateWrapper); //如果结算类型不一致,结算类型不为空且已发送,结算id不一致
} if(!settleTypeEquals || !settleIdEquals || !eStatus || !aStatus){
} ekpUpdate.set(TInsuranceEkp :: getResendFlag,CommonConstants.TWO_INT);
//如果是新增实缴保费,则推送实缴保费新增 update(ekpUpdate);
if(CommonConstants.TWO_INT == pushType){ continue;
s = ekpInsuranceUtil.sendToEkp(ekpParam); }else{
if(StringUtils.isNotBlank(s)) { ekpParam.setInteractiveType(InsurancesConstants.UPDATE_SETTLE_BILL);
updateWrapper.eq(TInsuranceSettle::getId, tInsuranceEkp.getDefaultSettleId()) s = ekpInsuranceUtil.sendToEkp(ekpParam);
.set(TInsuranceSettle::getIsActualPush, CommonConstants.ONE_INT) if(StringUtils.isNotBlank(s)){
.set(TInsuranceSettle::getActualPushTime, LocalDateTime.now()); ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT);
tInsuranceSettleService.update(updateWrapper); update(ekpUpdate);
} }else{
} break;
//如果是变更结算信息,则推送变更结算信息 }
if(CommonConstants.THREE_INT == pushType){ }
s = ekpInsuranceUtil.sendToEkp(ekpParam); }
if(StringUtils.isNotBlank(s)) { //推送作废信息
updateWrapper.eq(TInsuranceSettle::getId, tInsuranceEkp.getDefaultSettleId()) if(CommonConstants.FOUR_INT == pushType){
.set(TInsuranceSettle::getIsActualPush, CommonConstants.ONE_INT) //如果结算类型不一致,结算类型不为空且已发送,结算id不一致
.set(TInsuranceSettle::getActualPushTime, LocalDateTime.now()); if(eStatus && aStatus){
tInsuranceSettleService.update(updateWrapper); ekpParam.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
LambdaUpdateWrapper<TInsuranceDetail> detailLambdaUpdate = new LambdaUpdateWrapper<>(); ekpParam.setInteractiveType(InsurancesConstants.ABOLISH_SETTLE_BILL);
detailLambdaUpdate.eq(TInsuranceDetail::getId, tInsuranceEkp.getDetailId()) s = ekpInsuranceUtil.sendToEkp(ekpParam);
.set(TInsuranceDetail::getSettleMonth, CommonConstants.ONE_INT); if(StringUtils.isNotBlank(s)){
tInsuranceSettleService.update(updateWrapper); detailUpdate.set(TInsuranceDetail :: getDefaultSettleId,null);
} tInsuranceDetailService.update(detailUpdate);
} ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT);
//如果是作废信息,则推送作废信息 update(ekpUpdate);
if(CommonConstants.FOUR_INT == pushType){ }else{
s = ekpInsuranceUtil.sendToEkp(ekpParam); break;
} }
if(CommonConstants.FIVE_INT == pushType || CommonConstants.SIX_INT == pushType){ }
tInsuranceEkp.setResendFlag(CommonConstants.TWO_INT); if(!eStatus || !aStatus){
failList.add(tInsuranceEkp); ekpParam.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
continue; //如果为合并结算,则推送预估红冲
} if(settleType.equals(CommonConstants.ZERO_STRING) && actualPush){
//成功则更新,不成功则跳出循环 BigDecimal estimatePremium = ekpParam.getEstimatePremium();
if(StringUtils.isNotBlank(s)) { ekpParam.setEstimatePremium(estimatePremium.negate());
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT); ekpParam.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
updateById(tInsuranceEkp); s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)){
ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT);
update(ekpUpdate);
}else{ }else{
break; break;
} }
} }
//实缴结算中,已结算 //如果为合并结算,则推送实缴红冲
if(InsurancesConstants.SETTLE_ONE.equals(actualStatus) || InsurancesConstants.SETTLE_TWO.equals(actualStatus)){ if(!actualPush){
//如果是作废,则推送实缴红冲 ekpParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
if(CommonConstants.FOUR_INT == pushType){ BigDecimal actualPremium = ekpParam.getActualPremium();
BigDecimal actualPremium = ekpParam.getActualPremium(); ekpParam.setActualPremium(actualPremium.negate());
ekpParam.setActualPremium(actualPremium.negate()); s = ekpInsuranceUtil.sendToEkp(ekpParam);
ekpParam.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL); if(StringUtils.isNotBlank(s)){
ekpParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL); ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT);
s = ekpInsuranceUtil.sendToEkp(ekpParam); update(ekpUpdate);
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
updateById(tInsuranceEkp);
}else{
break;
}
}
if(CommonConstants.SIX_INT == pushType){
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
updateById(tInsuranceEkp);
}else{
break;
}
}else{ }else{
//推送预估新增,实缴新增,变更结算信息,作废,则不进行重发 break;
tInsuranceEkp.setResendFlag(CommonConstants.TWO_INT);
updateById(tInsuranceEkp);
} }
} }
}else{ }else{
//如果实缴未结算 ekpUpdate.set(TInsuranceEkp :: getResendFlag,CommonConstants.TWO_INT);
if(InsurancesConstants.SETTLE_ZERO.equals(actualStatus)){ update(ekpUpdate);
//如果是作废信息,则推送预估红冲信息 continue;
if(CommonConstants.FOUR_INT == pushType){ }
BigDecimal estimatePremium = ekpParam.getEstimatePremium(); }
ekpParam.setActualPremium(estimatePremium.negate()); //推送预估红冲信息
ekpParam.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL); if(CommonConstants.FIVE_INT == pushType){
ekpParam.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL); ekpParam.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
s = ekpInsuranceUtil.sendToEkp(ekpParam); ekpParam.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
if(StringUtils.isNotBlank(s)) { s = ekpInsuranceUtil.sendToEkp(ekpParam);
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT); if(StringUtils.isNotBlank(s)){
updateById(tInsuranceEkp); ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT);
}else{ update(ekpUpdate);
break; }else{
} break;
} else if(CommonConstants.FIVE_INT == pushType){
//如果是预估红冲信息,则推送预估红冲信息
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
updateById(tInsuranceEkp);
}else{
break;
}
}else{
tInsuranceEkp.setResendFlag(CommonConstants.TWO_INT);
updateById(tInsuranceEkp);
}
}else{
//如果是实缴红冲信息,则推送实缴红冲信息
if(CommonConstants.SIX_INT == pushType){
BigDecimal actualPremium = ekpParam.getActualPremium();
ekpParam.setActualPremium(actualPremium.negate());
ekpParam.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
ekpParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
updateById(tInsuranceEkp);
}else{
break;
}
}else{
tInsuranceEkp.setResendFlag(CommonConstants.TWO_INT);
updateById(tInsuranceEkp);
}
}
} }
}else{
//结算id与当前不一致则不进行重发
tInsuranceEkp.setResendFlag(CommonConstants.THREE_INT);
failList.add(tInsuranceEkp);
} }
//推送实缴红冲信息
if(CommonConstants.SIX_INT == pushType){
ekpParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
ekpParam.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)){
ekpUpdate.set(TInsuranceEkp :: getResendFlag ,CommonConstants.ONE_INT);
update(ekpUpdate);
}else{
break;
}
}
} }
updateBatchById(failList);
return R.ok("发送成功"); return R.ok("发送成功");
}else{ }else{
return R.failed("无需要发送的信息"); return R.failed("无需要发送的信息");
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
<result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/> <result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
<result property="pushTime" column="PUSH_TIME" jdbcType="TIMESTAMP"/> <result property="pushTime" column="PUSH_TIME" jdbcType="TIMESTAMP"/>
<result property="pushType" column="PUSH_TYPE" jdbcType="TINYINT"/> <result property="pushType" column="PUSH_TYPE" jdbcType="TINYINT"/>
<result property="settleType" column="SETTLE_TYPE" jdbcType="TINYINT"/>
</resultMap> </resultMap>
...@@ -44,7 +45,7 @@ ...@@ -44,7 +45,7 @@
POLICY_END,BUY_STANDARD,MEDICAL_QUOTA, POLICY_END,BUY_STANDARD,MEDICAL_QUOTA,
DIE_DISABLE_QUOTA,ACTUAL_PREMIUM,ESTIMATE_PREMIUM, DIE_DISABLE_QUOTA,ACTUAL_PREMIUM,ESTIMATE_PREMIUM,
SETTLE_MONTH,INTERACTIVE_TYPE,RESEND_FLAG, SETTLE_MONTH,INTERACTIVE_TYPE,RESEND_FLAG,
CREATE_TIME,PUSH_TIME,PUSH_TYPE CREATE_TIME,PUSH_TIME,PUSH_TYPE,SETTLE_TYPE
</sql> </sql>
<select id="getEkpRefundList" resultMap="BaseResultMap"> <select id="getEkpRefundList" resultMap="BaseResultMap">
......
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