Commit 42750155 authored by hongguangwu's avatar hongguangwu

Merge remote-tracking branch 'origin/develop' into develop

parents 87f616d9 fbf6b6ef
......@@ -158,7 +158,7 @@ public class TInsuranceEkp implements Serializable {
/**
* EKP推送类型
*/
@Schema(description = "1推送预估费用,2推送实缴费用,3变更结算月,4推送作废信息,5推送红冲信息,6投保退回红冲,7变更保单保费")
@Schema(description = "推送类型(1推送预估费用,2推送实缴费用,3变更结算信息,4推送作废信息,5推送预估红冲信息,6推送实缴红冲信息)")
private Integer pushType;
private static final long serialVersionUID = 1L;
......
......@@ -168,7 +168,7 @@ public class EkpInteractiveParam implements Serializable {
/**
* EKP推送类型
*/
@Schema(description = "1推送预估费用,2推送实缴费用,3变更结算月,4推送作废信息,5推送红冲信息,6投保退回红冲,7变更保单保费")
@Schema(description = "1推送预估费用,2推送实缴费用,3变更结算月,4推送作废信息,5推送预估红冲信息,6投保退回红冲,7变更保单保费,8推送实缴红冲信息")
private Integer pushType;
/**
......
......@@ -181,7 +181,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
public IPage<InsuranceListVO> getInsuranceListPage(Page<InsuranceListVO> page, InsuranceListParam param) {
//todo 根据登录人获取数据权限
YifuUser user = SecurityUtils.getUser();
List<String> deptNoList = getDeptNoList(user);
IPage<InsuranceListVO> insuranceList = new Page<>();
......@@ -210,7 +209,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
public List<InsuranceListVO> getInsuranceList(InsuranceListParam param) {
//todo 根据登录人获取数据权限
YifuUser user = SecurityUtils.getUser();
List<String> deptList = getDeptNoList(user);
List<InsuranceListVO> insuranceList = new ArrayList<>();
......@@ -239,7 +237,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
public IPage<InsuranceListVO> getInsuranceHandleListPage(Page<InsuranceListVO> page, InsuranceListParam param) {
//todo 根据登录人获取数据权限
IPage<InsuranceListVO> iPage = new Page<>();
YifuUser user = SecurityUtils.getUser();
String regionSQL = getRegionSQL(user);
......@@ -851,7 +848,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
public R<List<InsuranceExportListVO>> getInsuranceExportList(InsuranceExportListParam param) {
YifuUser user = SecurityUtils.getUser();
List<InsuranceExportListVO> insuranceExportList = new ArrayList<>();
//todo 根据登录人获取数据权限
String regionSQL = getRegionSQL(user);
param.setRegionSql(regionSQL);
if(StringUtils.isBlank(regionSQL)){
......@@ -1373,7 +1369,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
);
if (StringUtils.isNotBlank(success.getInvoiceNo())){
detail.setInvoiceNo(success.getInvoiceNo());
//如果发票号不为空,将替换类型的发票号也全部更新
List<TInsuranceReplace> list = tInsuranceReplaceService.list(Wrappers.<TInsuranceReplace>query().lambda()
.eq(TInsuranceReplace::getOriginInsuranceDetailId, detail.getId()));
......@@ -1404,15 +1399,56 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
//如果保费不为空
if (StringUtils.isNotBlank(success.getActualPremium())){
//判断推送金额是否一致,不一致才推送ekp
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());
if(!Common.isEmpty(settleVo) && InsurancesConstants.SETTLE_ZERO.equals(settleVo.getActualStatus())){
Integer settleType = detail.getSettleType();
String defaultSettleId = detail.getDefaultSettleId();
//如果当前保单为合并结算
if(settleType == CommonConstants.ZERO_INT){
if(StringUtils.isNotBlank(defaultSettleId)){
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if (Optional.ofNullable(settle).isPresent()){
if(Optional.ofNullable(settle).isPresent()){
//如果当前实缴信息未推送,则新增实缴单推送
if(settle.getIsActualPush() == CommonConstants.ZERO_INT){
//保费存储
settle.setActualPremium(new BigDecimal(success.getActualPremium()));
settle.setIsActualPush(CommonConstants.ZERO_INT);
settle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(settle);
//调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);
}
});
}
//如果当前实缴信息已推送,且金额与本次不一致,则推送实缴更新
if(settle.getIsActualPush() == CommonConstants.ONE_INT
&& (new BigDecimal(success.getActualPremium()).compareTo(detail.getActualPremium()) != 0)){
//推送保费更新
settle.setActualPremium(new BigDecimal(success.getActualPremium()));
settle.setIsActualPush(CommonConstants.ZERO_INT);
settle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(settle);
//调EKP更新实际保费
detail.setActualPremium(new BigDecimal(success.getActualPremium()));
threadPool.execute(() ->{
String s = pushEstimate(detail,CommonConstants.FOUR_INT);
if(StringUtils.isNotBlank(s)){
settle.setActualPushTime(LocalDateTime.now());
settle.setIsActualPush(CommonConstants.ONE_INT);
tInsuranceSettleService.updateById(settle);
}
});
}else if(settle.getIsActualPush() == CommonConstants.ONE_INT
&& (new BigDecimal(success.getActualPremium()).compareTo(detail.getActualPremium()) == 0)){
//推送保费更新
settle.setActualPremium(new BigDecimal(success.getActualPremium()));
settle.setIsActualPush(CommonConstants.ZERO_INT);
settle.setUpdateTime(LocalDateTime.now());
......@@ -1429,7 +1465,32 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
});
}
}
}else {
}
}
//如果当前保单为单独结算
if(settleType == CommonConstants.ZERO_INT){
//推送过实缴信息且金额与本次不一致,则推送更新
if(StringUtils.isNotBlank(defaultSettleId)
&& (new BigDecimal(success.getActualPremium()).compareTo(detail.getActualPremium()) != 0)){
//推送保费更新
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
settle.setActualPremium(new BigDecimal(success.getActualPremium()));
settle.setIsActualPush(CommonConstants.ZERO_INT);
settle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(settle);
//调EKP更新实际保费
detail.setActualPremium(new BigDecimal(success.getActualPremium()));
threadPool.execute(() ->{
String s = pushEstimate(detail,CommonConstants.FOUR_INT);
if(StringUtils.isNotBlank(s)){
settle.setActualPushTime(LocalDateTime.now());
settle.setIsActualPush(CommonConstants.ONE_INT);
tInsuranceSettleService.updateById(settle);
}
});
}
//未推送过实缴信息,则推送新增
if(StringUtils.isBlank(defaultSettleId)){
//保费存储
TInsuranceSettle settle = new TInsuranceSettle();
settle.setInsDetailId(detail.getId());
......@@ -1455,6 +1516,34 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
String invoiceNo = success.getInvoiceNo();
String policyNo = success.getPolicyNo();
boolean booleanInvoiceNo = StringUtils.isNotBlank(invoiceNo) && !invoiceNo.equals(detail.getInvoiceNo());
boolean booleanPolicyNo = StringUtils.isNotBlank(policyNo) && !policyNo.equals(detail.getPolicyNo());
//如果当前保费为空,且保单号或发票号不一样
if(StringUtils.isBlank(success.getActualPremium()) && (!booleanInvoiceNo || !booleanPolicyNo)){
if(StringUtils.isNotBlank(detail.getDefaultSettleId())){
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if(Optional.ofNullable(settle).isPresent()){
//如果当前实缴信息未推送,则新增实缴单推送
threadPool.execute(() ->{
if(StringUtils.isNotBlank(invoiceNo)){
detail.setInvoiceNo(invoiceNo);
}
if(StringUtils.isNotBlank(policyNo)){
detail.setPolicyNo(policyNo);
}
String s = pushEstimate(detail, CommonConstants.FOUR_INT);
//如果推送成功则更改推送状态
if(StringUtils.isNotBlank(s)){
settle.setActualPushTime(LocalDateTime.now());
settle.setIsActualPush(CommonConstants.ONE_INT);
tInsuranceSettleService.updateById(settle);
}
});
}
}
}
//可以改成批量更新
this.updateById(detail);
detailList.add(detail);
......@@ -2615,7 +2704,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
if(!LocalDateUtil.isDate(param.getPolicyStart(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_START_PARSE_ERROR);
listResult.add(param);
......@@ -2753,24 +2841,74 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
if (StringUtils.isNotBlank(detail.getDefaultSettleId())){
//保单号是否更新
boolean booleanPolicyNo = StringUtils.isNotBlank(param.getPolicyNo()) && !param.getPolicyNo().equals(detail.getPolicyNo());
//发票号是否更新
boolean booleanInvoiceNo = StringUtils.isNotBlank(param.getInvoiceNo()) && !param.getInvoiceNo().equals(detail.getInvoiceNo());
//保费是否更新
boolean booleanActualPremium = StringUtils.isNotBlank(param.getActualPremium()) && detail.getActualPremium().compareTo(new BigDecimal(param.getActualPremium())) != 0;
//如果当前为合并结算
if (CommonConstants.ZERO_INT == detail.getSettleType() && StringUtils.isNotBlank(detail.getDefaultSettleId())){
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if (Optional.ofNullable(settle).isPresent()){
SettleVo settleVo = getInsuranceDetailSettleStatus(detail.getId(), detail.getDefaultSettleId());
if(!Common.isEmpty(settleVo)){
if (InsurancesConstants.SETTLE_ONE.equals(settleVo.getActualStatus())){
String estimateStatus = settleVo.getEstimateStatus();
String actualStatus = settleVo.getActualStatus();
//保费更新,保单号,发票号不更新
if(booleanActualPremium && !booleanPolicyNo && !booleanInvoiceNo){
if ( InsurancesConstants.SETTLE_TWO.equals(actualStatus)){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_THREE_NOT_REGISTERED);
listResult.add(param);
continue;
}
if (InsurancesConstants.SETTLE_ONE.equals(actualStatus)){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_TWO_NOT_REGISTERED);
listResult.add(param);
continue;
}
}
//
if(!booleanPolicyNo || !booleanInvoiceNo){
if (InsurancesConstants.SETTLE_TWO.equals(estimateStatus) || InsurancesConstants.SETTLE_TWO.equals(actualStatus)){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_THREE_NOT_REGISTERED);
listResult.add(param);
continue;
}
if (InsurancesConstants.SETTLE_ONE.equals(estimateStatus) || InsurancesConstants.SETTLE_ONE.equals(actualStatus)){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_TWO_NOT_REGISTERED);
listResult.add(param);
continue;
}
if (InsurancesConstants.SETTLE_TWO.equals(settleVo.getActualStatus())){
}
}
}
}
//如果当前为单独结算,判断实缴有没有结算
if (CommonConstants.ONE_INT == detail.getSettleType() && StringUtils.isNotBlank(detail.getDefaultSettleId())){
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if (Optional.ofNullable(settle).isPresent()){
SettleVo settleVo = getInsuranceDetailSettleStatus(detail.getId(), detail.getDefaultSettleId());
if(!Common.isEmpty(settleVo)){
String actualStatus = settleVo.getActualStatus();
//判断实缴是否结算中
if(booleanActualPremium && !booleanPolicyNo && !booleanInvoiceNo){
if ( InsurancesConstants.SETTLE_TWO.equals(actualStatus)){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_THREE_NOT_REGISTERED);
listResult.add(param);
continue;
}
if (InsurancesConstants.SETTLE_ONE.equals(actualStatus)){
param.setErrorMessage(InsurancesConstants.SETTLE_HANDLE_TWO_NOT_REGISTERED);
listResult.add(param);
continue;
}
}
}
}
}
}
listSuccess.add(param);
}
......@@ -2996,7 +3134,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
public IPage<InsuredListVo> getInsuredListPage(Page<InsuredListVo> page, InsuredParam param) {
//todo 根据登录人获取其项目权限列表
YifuUser user = SecurityUtils.getUser();
List<String> deptList = getDeptNoList(user);
IPage<InsuredListVo> insuranceList = new Page<>();
......@@ -3033,7 +3170,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
public List<InsuredListVo> getInsuredList(InsuredParam param) {
//todo 根据登录人获取其项目权限列表
YifuUser user = SecurityUtils.getUser();
List<String> deptList = getDeptNoList(user);
List<InsuredListVo> insuredList = new ArrayList<>();
......@@ -3072,7 +3208,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
public R getInsuranceRefundPageList(Page<InsuranceRefundParam> page, InsuranceRefundParam param) {
//todo 根据登录人获取其项目权限列表
YifuUser user = SecurityUtils.getUser();
List<String> deptList = getDeptNoList(user);
if (CollectionUtils.isEmpty(deptList)){
......@@ -3110,6 +3245,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
public List<InsuranceRefundListVo> getInsuranceRefundList(InsuranceRefundParam param) {
YifuUser user = SecurityUtils.getUser();
List<String> deptNoList = getDeptNoList(user);
List<InsuranceRefundListVo> pageList = new ArrayList<>();
if(CollectionUtils.isEmpty(deptNoList)){
return pageList;
}
param.setDeptNoList(deptNoList);
List<InsuranceRefundListVo> insuranceRefundList = this.baseMapper.getInsuranceRefundList(param);
if (CollectionUtils.isNotEmpty(insuranceRefundList)){
......@@ -3183,7 +3322,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
public R<List<RefundExportListVo>> getInsuranceRefundHandlingList(RefundExportListParam param){
YifuUser user = SecurityUtils.getUser();
List<RefundExportListVo> refundExportList;
//todo 根据登录人获取数据权限
String regionSQL = getRegionSQL(user);
param.setRegionSql(regionSQL);
//如勾选项不为空,则导出勾选记录;否则导出当前筛选条件下 && 「待减员」的结果集
......@@ -3559,6 +3697,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//变更后为单独结算
if (CommonConstants.ONE_INT == newSettleType) {
//推送新的结算信息至EKP
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.NOTHING);
interactiveParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
interactiveParam.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
......@@ -3567,6 +3706,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
interactiveParam.setDeptNo(success.getNewDeptNo());
interactiveParam.setDeptName(success.getNewDeptName());
interactiveParam.setActualPremium(success.getActualPremium());
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
String pushResult = eKPInsuranceUtil.sendToEkp(interactiveParam);
if (StringUtils.isNotBlank(pushResult)){
newInsuranceSettle.setActualPushTime(LocalDateTime.now());
......@@ -3581,6 +3721,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//变更后为合并结算
if (CommonConstants.ZERO_INT == newSettleType) {
//先推送预估,再推送实际
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
......@@ -3622,6 +3763,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//变更后为单独结算
if (CommonConstants.ONE_INT == newSettleType) {
//推送新的结算信息至EKP
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.NOTHING);
interactiveParam.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
interactiveParam.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
......@@ -3644,6 +3786,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//变更后为合并结算
if (CommonConstants.ZERO_INT == newSettleType) {
//先推送预估,再推送实际
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
......@@ -3704,6 +3847,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,tInsuranceSettle.getId());
update(updateWrapper);
//推送结算信息至EKP
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
......@@ -3776,6 +3920,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
updateWrapper.set(TInsuranceDetail ::getEstimatePremium,new BigDecimal("0.00"));
update(updateWrapper);
//推送新的结算信息至EKP,推实际保费
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.NOTHING);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
......@@ -3800,6 +3945,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//变更为合并结算
if (CommonConstants.ZERO_INT == newSettleType){
// 推送新的结算信息
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
......@@ -3842,6 +3988,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
String deleteBody = eKPInsuranceUtil.sendToEkp(interactiveParam);
if(StringUtils.isNotBlank(deleteBody)){
//先推送预估,再推送实际
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
......@@ -3882,6 +4029,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//如果预估和实缴均未推送
if(byId.getIsActualPush() == CommonConstants.ZERO_INT && byId.getIsEstimatePush() == CommonConstants.ONE_INT){
//先推送预估,再推送实际
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
......@@ -3944,6 +4092,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//变更为合并结算
if (CommonConstants.ZERO_INT == newSettleType){
//新增新的结算信息
newInsuranceSettle.setInsDetailId(insuranceDetailId);
newInsuranceSettle.setSettleType(newSettleType);
newInsuranceSettle.setIsEstimatePush(CommonConstants.ZERO_INT);
......@@ -3956,6 +4105,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
updateWrapper.set(TInsuranceDetail :: getDefaultSettleId,newInsuranceSettle.getId());
update(updateWrapper);
//推送新的结算信息至EKP
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
......@@ -3981,6 +4131,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}else{
//推送新的结算信息至EKP
interactiveParam.setDefaultSettleId(newInsuranceSettle.getId());
interactiveParam.setEstimateStatus(EkpConstants.HAVE);
interactiveParam.setCustomerCode(success.getNewCustomerCode());
interactiveParam.setCustomerName(success.getNewCustomerName());
......@@ -5146,7 +5297,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
public R getDeptListByUser(){
YifuUser user = SecurityUtils.getUser();
//根据当前登录人获取其拥有的项目列表权限
// TODO: 2022/8/5
List<String> deptNoList = getDeptNoList(user);
List<Dept> deptList = new ArrayList<>(16);
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(deptNoList);
......@@ -5298,6 +5448,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @return {@link List< String>}
*/
public List<String> getDeptNoList(YifuUser user){
//todo 根据登录人获取其项目权限列表
List<String> deptList = new ArrayList<>(16);
String id = user.getId();
//周日琴12,徐燕13
......@@ -5336,6 +5487,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @return {@link String}
*/
public String getRegionSQL(YifuUser user){
//todo 根据登录人获取其办理地SQL
String id = user.getId();
String sql ;
//user_id=14, 合肥办理1
......
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
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.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpInsuranceUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants;
......@@ -61,101 +62,178 @@ public class TInsuranceEkpServiceImpl extends ServiceImpl<TInsuranceEkpMapper, T
List<TInsuranceEkp> successLit = new ArrayList<>();
if (CollectionUtils.isNotEmpty(ekpRefundList)){
for (TInsuranceEkp tInsuranceEkp : ekpRefundList) {
//结算信息
TInsuranceDetail byId = tInsuranceDetailService.getById(tInsuranceEkp.getDetailId());
String defaultSettleId = byId.getDefaultSettleId();
if (tInsuranceEkp.getDefaultSettleId().equals(defaultSettleId)){
//ekp结算信息
SettleVo settleVo = tInsuranceDetailService.getInsuranceDetailSettleStatus(tInsuranceEkp.getDetailId(), tInsuranceEkp.getDefaultSettleId());
//商险结算信息
TInsuranceSettle insuranceSettle = tInsuranceSettleService.getById(tInsuranceEkp.getDefaultSettleId());
//预估推送状态
Integer isEstimatePush = insuranceSettle.getIsEstimatePush();
//实缴推送状态
Integer isActualPush = insuranceSettle.getIsActualPush();
//实缴结算状态
String actualStatus = settleVo.getActualStatus();
//预缴结算状态
String estimateStatus = settleVo.getEstimateStatus();
Integer pushType = tInsuranceEkp.getPushType();
LambdaQueryWrapper<TInsuranceSettle> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceSettle :: getId,tInsuranceEkp.getDefaultSettleId());
TInsuranceSettle insuranceSettle = tInsuranceSettleService.getOne(queryWrapper);
//如果当前需要重发预估保费的数据已发送,则过滤掉执行下一条数据
if(CommonConstants.ONE_INT == pushType && CommonConstants.ONE_INT == insuranceSettle.getIsEstimatePush()){
if(CommonConstants.ONE_INT == pushType && CommonConstants.ONE_INT == isEstimatePush){
tInsuranceEkp.setResendFlag(CommonConstants.THREE_INT);
failList.add(tInsuranceEkp);
continue;
}
//如果当前需要重发实际保费的数据已发送,则过滤掉执行下一条数据
if(CommonConstants.TWO_INT == pushType && CommonConstants.ONE_INT == insuranceSettle.getIsActualPush()){
if(CommonConstants.TWO_INT == pushType && CommonConstants.ONE_INT == isActualPush){
tInsuranceEkp.setResendFlag(CommonConstants.THREE_INT);
failList.add(tInsuranceEkp);
continue;
}
EkpInteractiveParam ekpParam = new EkpInteractiveParam();
BeanCopyUtils.copyProperties(tInsuranceEkp,ekpParam);
if(actualStatus.equals(InsurancesConstants.SETTLE_ZERO)){
String s = ekpInsuranceUtil.sendToEkp(ekpParam);
//如果发送成功
if (StringUtils.isNotBlank(s)){
//预估则更新预估保费
if(CommonConstants.ONE_INT == pushType){
//如果预估未结算
LambdaUpdateWrapper<TInsuranceSettle> updateWrapper = new LambdaUpdateWrapper<>();
String s = null;
if(InsurancesConstants.SETTLE_ZERO.equals(estimateStatus)){
//实缴未结算
if(InsurancesConstants.SETTLE_ZERO.equals(actualStatus)){
//如果是新增预估保费,则推送预估保费新增
if(CommonConstants.ONE_INT == pushType){
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)){
updateWrapper.eq(TInsuranceSettle :: getId,tInsuranceEkp.getDefaultSettleId())
.set(TInsuranceSettle :: getIsEstimatePush,CommonConstants.ONE_INT)
.set(TInsuranceSettle :: getEstimatePushTime, LocalDateTime.now());
tInsuranceSettleService.update(updateWrapper);
}
//预估则更新预估保费
}
//如果是新增实缴保费,则推送实缴保费新增
if(CommonConstants.TWO_INT == pushType){
LambdaUpdateWrapper<TInsuranceSettle> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceSettle :: getId,tInsuranceEkp.getDefaultSettleId())
.set(TInsuranceSettle :: getIsActualPush,CommonConstants.ONE_INT)
.set(TInsuranceSettle :: getActualPushTime, LocalDateTime.now());
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
updateWrapper.eq(TInsuranceSettle::getId, tInsuranceEkp.getDefaultSettleId())
.set(TInsuranceSettle::getIsActualPush, CommonConstants.ONE_INT)
.set(TInsuranceSettle::getActualPushTime, LocalDateTime.now());
tInsuranceSettleService.update(updateWrapper);
}
//结算月则变更结算月
}
//如果是变更结算信息,则推送变更结算信息
if(CommonConstants.THREE_INT == pushType){
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(TInsuranceDetail :: getId,tInsuranceEkp.getDetailId())
.set(TInsuranceDetail :: getSettleMonth,tInsuranceEkp.getSettleMonth())
.set(TInsuranceDetail :: getUpdateTime, LocalDateTime.now());
tInsuranceDetailService.update(updateWrapper);
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
updateWrapper.eq(TInsuranceSettle::getId, tInsuranceEkp.getDefaultSettleId())
.set(TInsuranceSettle::getIsActualPush, CommonConstants.ONE_INT)
.set(TInsuranceSettle::getActualPushTime, LocalDateTime.now());
tInsuranceSettleService.update(updateWrapper);
LambdaUpdateWrapper<TInsuranceDetail> detailLambdaUpdate = new LambdaUpdateWrapper<>();
detailLambdaUpdate.eq(TInsuranceDetail::getId, tInsuranceEkp.getDetailId())
.set(TInsuranceDetail::getSettleMonth, CommonConstants.ONE_INT);
tInsuranceSettleService.update(updateWrapper);
}
}
//如果是作废信息,则推送作废信息
if(CommonConstants.FOUR_INT == pushType){
s = ekpInsuranceUtil.sendToEkp(ekpParam);
}
if(CommonConstants.FIVE_INT == pushType || CommonConstants.SIX_INT == pushType){
tInsuranceEkp.setResendFlag(CommonConstants.TWO_INT);
failList.add(tInsuranceEkp);
continue;
}
//成功则更新,不成功则跳出循环
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
successLit.add(tInsuranceEkp);
updateById(tInsuranceEkp);
}else{
break;
}
}else{
//如果为作废信息,已结算和结算中发送红冲数据
}
//实缴结算中,已结算
if(InsurancesConstants.SETTLE_ONE.equals(actualStatus) || InsurancesConstants.SETTLE_TWO.equals(actualStatus)){
//如果是作废,则推送实缴红冲
if(CommonConstants.FOUR_INT == pushType){
//预估保费
BigDecimal estimatePremium = ekpParam.getEstimatePremium();
//实际保费
BigDecimal actualPremium = ekpParam.getActualPremium();
if(!BigDecimalUtils.isNullOrZero(estimatePremium)){
ekpParam.setEstimatePremium(estimatePremium.negate());
}
if(!BigDecimalUtils.isNullOrZero(actualPremium)){
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;
}
ekpParam.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
String s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)){
}
if(CommonConstants.SIX_INT == pushType){
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
successLit.add(tInsuranceEkp);
updateById(tInsuranceEkp);
}else{
break;
}
//如果为红冲数据则正常发送
}else if(CommonConstants.FIVE_INT == pushType || CommonConstants.SIX_INT == pushType){
String s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)){
}else{
//推送预估新增,实缴新增,变更结算信息,作废,则不进行重发
tInsuranceEkp.setResendFlag(CommonConstants.TWO_INT);
updateById(tInsuranceEkp);
}
}
}else{
//如果实缴未结算
if(InsurancesConstants.SETTLE_ZERO.equals(actualStatus)){
//如果是作废信息,则推送预估红冲信息
if(CommonConstants.FOUR_INT == pushType){
BigDecimal estimatePremium = ekpParam.getEstimatePremium();
ekpParam.setActualPremium(estimatePremium.negate());
ekpParam.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
ekpParam.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
s = ekpInsuranceUtil.sendToEkp(ekpParam);
if(StringUtils.isNotBlank(s)) {
tInsuranceEkp.setResendFlag(CommonConstants.ONE_INT);
successLit.add(tInsuranceEkp);
updateById(tInsuranceEkp);
}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);
failList.add(tInsuranceEkp);
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);
}
}
updateBatchById(successLit);
updateBatchById(failList);
return R.ok("发送成功");
}else{
......
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