Commit a6d6490b authored by huyuchen's avatar huyuchen

huych-商险变更项目逻辑修改

parent c02698d4
...@@ -156,7 +156,20 @@ public class DeptChangeCheckParam implements Serializable { ...@@ -156,7 +156,20 @@ public class DeptChangeCheckParam implements Serializable {
* 客户编码 * 客户编码
*/ */
@Schema(description = "客户编码") @Schema(description = "客户编码")
private String oldCustomerCode; private String oldCustomerCode;
@Schema(description = "结算状态")
private String settleStatus;
@Schema(description = "支出结算状态")
private String paySettleStatus;
@Schema(description = "预估结算状态")
private String ygSettleStatus;
@Schema(description = "预估支出结算状态")
private String ygPaySettleStatus;
} }
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 huyc
* @description EKP结算信息表
* @date 2024-12-25 17:37:21
*/
@Data
@Tag(name = "EKP结算信息表")
public class DeptSettleVo implements Serializable {
/**
* 主键id
*/
private String id;
/**
* 结算id
*/
@Schema(description = "结算id")
private String detailId;
@Schema(description = "结算状态")
private String settleStatus;
@Schema(description = "支出结算状态")
private String paySettleStatus;
}
package com.yifu.cloud.plus.v1.yifu.insurances.mapper.ekp; package com.yifu.cloud.plus.v1.yifu.insurances.mapper.ekp;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.DeptSettleVo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpInsuranceViewVo; import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpInsuranceViewVo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSocialViewVo; import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSocialViewVo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.SettleVo; import com.yifu.cloud.plus.v1.yifu.insurances.vo.SettleVo;
...@@ -24,6 +25,24 @@ public interface EkpSettleMapper { ...@@ -24,6 +25,24 @@ public interface EkpSettleMapper {
*/ */
SettleVo getSettle(String id); SettleVo getSettle(String id);
/**
* 获取结算信息
*
* @author zhaji
* @param id
* @return {@link SettleVo}
*/
DeptSettleVo getDeptSettle(String id);
/**
* 获取结算信息
*
* @author zhaji
* @param id
* @return {@link SettleVo}
*/
DeptSettleVo getDeptYgSettle(String id);
/** /**
* 从商险订单明细中获取当前保单的结算状态 * 从商险订单明细中获取当前保单的结算状态
* *
......
...@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.yifu.insurances.service.ekp; ...@@ -3,6 +3,7 @@ package com.yifu.cloud.plus.v1.yifu.insurances.service.ekp;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
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.insurances.entity.TInsuranceTypeRate; import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeRate;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.DeptSettleVo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpInsuranceViewVo; import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpInsuranceViewVo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSocialViewVo; import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSocialViewVo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.SettleVo; import com.yifu.cloud.plus.v1.yifu.insurances.vo.SettleVo;
...@@ -25,6 +26,10 @@ public interface EkpSettleService extends IService<TInsuranceTypeRate> { ...@@ -25,6 +26,10 @@ public interface EkpSettleService extends IService<TInsuranceTypeRate> {
*/ */
SettleVo getSettle(String id); SettleVo getSettle(String id);
DeptSettleVo getDeptSettle(String id);
DeptSettleVo getDeptYgSettle(String id);
/** /**
* 从商险订单明细中获取当前保单的结算状态 * 从商险订单明细中获取当前保单的结算状态
* *
......
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeRate; import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceTypeRate;
import com.yifu.cloud.plus.v1.yifu.insurances.mapper.ekp.EkpSettleMapper; import com.yifu.cloud.plus.v1.yifu.insurances.mapper.ekp.EkpSettleMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.service.ekp.EkpSettleService; import com.yifu.cloud.plus.v1.yifu.insurances.service.ekp.EkpSettleService;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.DeptSettleVo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpInsuranceViewVo; import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpInsuranceViewVo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSocialViewVo; import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSocialViewVo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.SettleVo; import com.yifu.cloud.plus.v1.yifu.insurances.vo.SettleVo;
...@@ -31,6 +32,16 @@ public class EkpSettleServiceImpl implements EkpSettleService { ...@@ -31,6 +32,16 @@ public class EkpSettleServiceImpl implements EkpSettleService {
return ekpSettleMapper.getSettle(id); return ekpSettleMapper.getSettle(id);
} }
@Override
public DeptSettleVo getDeptSettle(String id) {
return ekpSettleMapper.getDeptSettle(id);
}
@Override
public DeptSettleVo getDeptYgSettle(String id) {
return ekpSettleMapper.getDeptYgSettle(id);
}
@Override @Override
public String getSettleStatusFromEkpInsuranceDetail(String id) { public String getSettleStatusFromEkpInsuranceDetail(String id) {
return ekpSettleMapper.getSettleStatusFromEkpInsuranceDetail(id); return ekpSettleMapper.getSettleStatusFromEkpInsuranceDetail(id);
......
...@@ -468,6 +468,10 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> { ...@@ -468,6 +468,10 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
SettleVo getInsuranceDetailSettleStatus(String detailId, String defaultSettleId); SettleVo getInsuranceDetailSettleStatus(String detailId, String defaultSettleId);
DeptSettleVo deptUpdGetSettleStatusFromEkpInsuranceDetail(String detailId, String defaultSettleId);
DeptSettleVo deptYgGetSettleStatusFromEkpInsuranceDetail(String detailId, String defaultSettleId);
/** /**
* @param changeDeptVo * @param changeDeptVo
* @Description: ekp费用划转,商险划转项目 * @Description: ekp费用划转,商险划转项目
......
...@@ -5117,6 +5117,25 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -5117,6 +5117,25 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if(CollectionUtils.isNotEmpty(successList)){ if(CollectionUtils.isNotEmpty(successList)){
threadPool.execute(() -> { threadPool.execute(() -> {
for (DeptChangeCheckParam success : successList) { for (DeptChangeCheckParam success : successList) {
//取出预估和实缴的是否需要推送的状态
boolean sjFlag = true;
boolean ygFlag = true;
if ((Common.isNotNull(success.getSettleStatus()) &&
(InsurancesConstants.SETTLE_ONE.equals(success.getSettleStatus()) ||
InsurancesConstants.SETTLE_TWO.equals(success.getSettleStatus())))
|| (Common.isNotNull(success.getPaySettleStatus()) &&
(InsurancesConstants.SETTLE_ONE.equals(success.getPaySettleStatus()) ||
InsurancesConstants.SETTLE_TWO.equals(success.getPaySettleStatus())))){
sjFlag = false;
}
if ((Common.isNotNull(success.getYgSettleStatus()) &&
(InsurancesConstants.SETTLE_ONE.equals(success.getYgSettleStatus()) ||
InsurancesConstants.SETTLE_TWO.equals(success.getYgSettleStatus())))
|| (Common.isNotNull(success.getYgPaySettleStatus()) &&
(InsurancesConstants.SETTLE_ONE.equals(success.getYgPaySettleStatus()) ||
InsurancesConstants.SETTLE_TWO.equals(success.getYgPaySettleStatus())))){
ygFlag = false;
}
//新的结算信息 //新的结算信息
TInsuranceSettle newInsuranceSettle = new TInsuranceSettle(); TInsuranceSettle newInsuranceSettle = new TInsuranceSettle();
//实际保费 //实际保费
...@@ -5175,7 +5194,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -5175,7 +5194,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//如果变更前为单独结算 //如果变更前为单独结算
if(CommonConstants.ONE_INT == oldSettleType){ if(CommonConstants.ONE_INT == oldSettleType){
//登记了保单保费 //登记了保单保费
if (!BigDecimalUtils.isNullOrZero(actualPremium)) { if (!BigDecimalUtils.isNullOrZero(actualPremium) && sjFlag) {
newInsuranceSettle.setInsDetailId(insuranceDetailId); newInsuranceSettle.setInsDetailId(insuranceDetailId);
newInsuranceSettle.setSettleType(newSettleType); newInsuranceSettle.setSettleType(newSettleType);
newInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT); newInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT);
...@@ -5458,20 +5477,21 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -5458,20 +5477,21 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
TInsuranceSettle byId = tInsuranceSettleService.getById(oldDefaultSettleId); TInsuranceSettle byId = tInsuranceSettleService.getById(oldDefaultSettleId);
//如果已经登记保费 //如果已经登记保费
if (!BigDecimalUtils.isNullOrZero(actualPremium)){ if (!BigDecimalUtils.isNullOrZero(actualPremium)){
//新增新的结算信息
newInsuranceSettle.setInsDetailId(insuranceDetailId);
newInsuranceSettle.setSettleType(newSettleType);
newInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT);
newInsuranceSettle.setIsActualPush(CommonConstants.ZERO_INT);
newInsuranceSettle.setSettleHandleStatus(CommonConstants.ONE_STRING);
newInsuranceSettle.setCreateTime(LocalDateTime.now());
newInsuranceSettle.setActualPremium(success.getActualPremium());
newInsuranceSettle.setEstimatePremium(success.getEstimatePremium());
tInsuranceSettleService.save(newInsuranceSettle);
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,newInsuranceSettle.getId());
update(updateWrapper);
//如果预估和实缴都推送了 //如果预估和实缴都推送了
if(byId.getIsActualPush() == CommonConstants.ONE_INT && byId.getIsEstimatePush() == CommonConstants.ONE_INT){ if(byId.getIsActualPush() == CommonConstants.ONE_INT &&
byId.getIsEstimatePush() == CommonConstants.ONE_INT && (ygFlag || sjFlag)){
//新增新的结算信息
newInsuranceSettle.setInsDetailId(insuranceDetailId);
newInsuranceSettle.setSettleType(newSettleType);
newInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT);
newInsuranceSettle.setIsActualPush(CommonConstants.ZERO_INT);
newInsuranceSettle.setSettleHandleStatus(CommonConstants.ONE_STRING);
newInsuranceSettle.setCreateTime(LocalDateTime.now());
newInsuranceSettle.setActualPremium(success.getActualPremium());
newInsuranceSettle.setEstimatePremium(success.getEstimatePremium());
tInsuranceSettleService.save(newInsuranceSettle);
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,newInsuranceSettle.getId());
update(updateWrapper);
//推送作废结算信息至EKP //推送作废结算信息至EKP
interactiveParam.setCustomerCode(success.getOldCustomerCode()); interactiveParam.setCustomerCode(success.getOldCustomerCode());
interactiveParam.setCustomerName(success.getOldCustomerName()); interactiveParam.setCustomerName(success.getOldCustomerName());
...@@ -5601,7 +5621,20 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -5601,7 +5621,20 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
} }
} }
//如果预估已推送和实缴未推送 //如果预估已推送和实缴未推送
if(byId.getIsActualPush() == CommonConstants.ZERO_INT && byId.getIsEstimatePush() == CommonConstants.ONE_INT){ if(byId.getIsActualPush() == CommonConstants.ZERO_INT &&
byId.getIsEstimatePush() == CommonConstants.ONE_INT && ygFlag){
//新增新的结算信息
newInsuranceSettle.setInsDetailId(insuranceDetailId);
newInsuranceSettle.setSettleType(newSettleType);
newInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT);
newInsuranceSettle.setIsActualPush(CommonConstants.ZERO_INT);
newInsuranceSettle.setSettleHandleStatus(CommonConstants.ONE_STRING);
newInsuranceSettle.setCreateTime(LocalDateTime.now());
newInsuranceSettle.setActualPremium(success.getActualPremium());
newInsuranceSettle.setEstimatePremium(success.getEstimatePremium());
tInsuranceSettleService.save(newInsuranceSettle);
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,newInsuranceSettle.getId());
update(updateWrapper);
//推送作废结算信息至EKP //推送作废结算信息至EKP
interactiveParam.setCustomerCode(success.getOldCustomerCode()); interactiveParam.setCustomerCode(success.getOldCustomerCode());
interactiveParam.setCustomerName(success.getOldCustomerName()); interactiveParam.setCustomerName(success.getOldCustomerName());
...@@ -5676,7 +5709,20 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -5676,7 +5709,20 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
} }
} }
//如果预估和实缴均未推送 //如果预估和实缴均未推送
if(byId.getIsActualPush() == CommonConstants.ZERO_INT && byId.getIsEstimatePush() == CommonConstants.ONE_INT){ if(byId.getIsActualPush() == CommonConstants.ZERO_INT &&
byId.getIsEstimatePush() == CommonConstants.ONE_INT){
//新增新的结算信息
newInsuranceSettle.setInsDetailId(insuranceDetailId);
newInsuranceSettle.setSettleType(newSettleType);
newInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT);
newInsuranceSettle.setIsActualPush(CommonConstants.ZERO_INT);
newInsuranceSettle.setSettleHandleStatus(CommonConstants.ONE_STRING);
newInsuranceSettle.setCreateTime(LocalDateTime.now());
newInsuranceSettle.setActualPremium(success.getActualPremium());
newInsuranceSettle.setEstimatePremium(success.getEstimatePremium());
tInsuranceSettleService.save(newInsuranceSettle);
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,newInsuranceSettle.getId());
update(updateWrapper);
//先推送预估,再推送实际 //先推送预估,再推送实际
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId()); interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE); interactiveParam.setEstimateStatus(EkpConstants.HAVE);
...@@ -5722,7 +5768,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -5722,7 +5768,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
} }
//如果没有登记保费 //如果没有登记保费
if (BigDecimalUtils.isNullOrZero(actualPremium)){ if (BigDecimalUtils.isNullOrZero(actualPremium)){
if(byId.getIsEstimatePush() == CommonConstants.ONE_INT){ if(byId.getIsEstimatePush() == CommonConstants.ONE_INT && ygFlag){
interactiveParam.setCustomerCode(success.getOldCustomerCode()); interactiveParam.setCustomerCode(success.getOldCustomerCode());
interactiveParam.setCustomerName(success.getOldCustomerName()); interactiveParam.setCustomerName(success.getOldCustomerName());
interactiveParam.setDeptNo(success.getOldDeptNo()); interactiveParam.setDeptNo(success.getOldDeptNo());
...@@ -6965,8 +7011,19 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -6965,8 +7011,19 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
continue; continue;
} }
} }
DeptSettleVo deptSettleVo = deptUpdGetSettleStatusFromEkpInsuranceDetail(insuranceDetail.getId(), defaultSettleId);
if(Common.isNotNull(deptSettleVo)){
param.setSettleStatus(deptSettleVo.getSettleStatus());
param.setPaySettleStatus(deptSettleVo.getPaySettleStatus());
}
DeptSettleVo deptYgSettleVo = deptYgGetSettleStatusFromEkpInsuranceDetail(insuranceDetail.getId(), defaultSettleId);
if(Common.isNotNull(deptYgSettleVo)){
param.setYgSettleStatus(deptYgSettleVo.getSettleStatus());
param.setYgPaySettleStatus(deptYgSettleVo.getPaySettleStatus());
}
} }
} }
//预估 //预估
if (param.getNewSettleType() == CommonConstants.ZERO_INT){ if (param.getNewSettleType() == CommonConstants.ZERO_INT){
//按月 //按月
...@@ -7401,6 +7458,34 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -7401,6 +7458,34 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return ekpSettleService.getSettle(id); return ekpSettleService.getSettle(id);
} }
/**
* 获取当前保单的结算状态
*
* @author huyc
* @param
* @return {@link String}
*/
@Override
public DeptSettleVo deptUpdGetSettleStatusFromEkpInsuranceDetail(String detailId,String settleId){
String id = detailId+CommonConstants.DOWN_LINE_STRING+settleId;
//获取ekp结算信息
return ekpSettleService.getDeptSettle(id);
}
/**
* 获取当前保单的结算状态
*
* @author huyc
* @param
* @return {@link String}
*/
@Override
public DeptSettleVo deptYgGetSettleStatusFromEkpInsuranceDetail(String detailId,String settleId){
String id = detailId+CommonConstants.DOWN_LINE_STRING+settleId;
//获取ekp结算信息
return ekpSettleService.getDeptYgSettle(id);
}
/** /**
* 从商险订单明细中获取当前保单的结算状态 * 从商险订单明细中获取当前保单的结算状态
* *
......
...@@ -11,6 +11,13 @@ ...@@ -11,6 +11,13 @@
<result property="actualStatus" column="fd_3b05bd5ed0b976" jdbcType="VARCHAR"/> <result property="actualStatus" column="fd_3b05bd5ed0b976" jdbcType="VARCHAR"/>
</resultMap> </resultMap>
<resultMap id="BaseDeptResultMap" type="com.yifu.cloud.plus.v1.yifu.insurances.vo.DeptSettleVo">
<id property="id" column="fd_id" jdbcType="VARCHAR"/>
<result property="detailId" column="fd_3b0a5743acab7e" jdbcType="VARCHAR"/>
<result property="settleStatus" column="fd_3adfe6ec6a8cbe" jdbcType="VARCHAR"/>
<result property="paySettleStatus" column="fd_3adfe6eda67236" jdbcType="VARCHAR"/>
</resultMap>
<resultMap id="BaseResultStatusMap" type="com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpInsuranceViewVo"> <resultMap id="BaseResultStatusMap" type="com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpInsuranceViewVo">
<id property="id" column="detailsId" jdbcType="VARCHAR"/> <id property="id" column="detailsId" jdbcType="VARCHAR"/>
<result property="incomeSettleFlag" column="earningStatus" jdbcType="VARCHAR"/> <result property="incomeSettleFlag" column="earningStatus" jdbcType="VARCHAR"/>
...@@ -37,6 +44,10 @@ ...@@ -37,6 +44,10 @@
detailsId,earningStatus,receiptStatus,zhichuEarningStatus,payStatus,orderType detailsId,earningStatus,receiptStatus,zhichuEarningStatus,payStatus,orderType
</sql> </sql>
<sql id="Base_Column_Dept">
fd_id,fd_3b0a5743acab7e,fd_3adfe6ec6a8cbe,fd_3adfe6eda67236
</sql>
<select id="getSettle" resultMap="BaseResultMap"> <select id="getSettle" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"></include> <include refid="Base_Column_List"></include>
...@@ -55,6 +66,24 @@ ...@@ -55,6 +66,24 @@
fd_3b0a5743acab7e = #{id} limit 1 fd_3b0a5743acab7e = #{id} limit 1
</select> </select>
<select id="getDeptSettle" resultMap="BaseDeptResultMap">
select
<include refid="Base_Column_Dept"></include>
from
ekp_e96a0a28442447c81ec0
where
fd_3b0a5743acab7e = #{id} and fd_3adfe6af71a1cc = '实缴' limit 1
</select>
<select id="getDeptYgSettle" resultMap="BaseDeptResultMap">
select
<include refid="Base_Column_Dept"></include>
from
ekp_e96a0a28442447c81ec0
where
fd_3b0a5743acab7e = #{id} and fd_3adfe6af71a1cc = '预估' limit 1
</select>
<!-- 根据结算单编码获取视图信息 --> <!-- 根据结算单编码获取视图信息 -->
<select id="selectSettleStatusBySettleNo" resultMap="BaseResultStatusMap"> <select id="selectSettleStatusBySettleNo" resultMap="BaseResultStatusMap">
select select
......
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