Commit 891bebec authored by huyuchen's avatar huyuchen

商险优化修改

parent 58df8a5c
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* @author huyc
* @description 发票号更新VO
* @date 2022-11-29 10:23:17
*/
@Data
@Schema(description = "发票号更新VO")
public class InsuranceUpdateVO implements Serializable {
private static final long serialVersionUID = 628032758008497542L;
/**
* 主键
*/
@Schema(description = "主键")
private String id;
/**
* 发票号
*/
@Schema(description = "发票号")
private String invoiceNo;
/**
* 保单号
*/
@Schema(description = "保单号")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty(value = "保单号")
private String policyNo;
}
......@@ -83,7 +83,7 @@ public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> {
* @param details
* @return void
*/
void updatePolicyNoBatch(@Param("details") List<TInsuranceDetail> details);
void updatePolicyNoBatch(@Param("details") List<InsuranceUpdateVO> details);
/**
* 批量更新发票号
......@@ -92,7 +92,7 @@ public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> {
* @param details
* @return void
*/
void updateInvoiceNoBatch(@Param("details") List<TInsuranceDetail> details);
void updateInvoiceNoBatch(@Param("details") List<InsuranceUpdateVO> details);
/***********************减员办理********************************/
......@@ -246,4 +246,13 @@ public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> {
List<TInsuranceDetail> selectByIdCardList(@Param("idCardList") List<String> idCardList
, @Param("idList") List<String> idList);
/**
* @param ids
* @Description: 根据id查找所有商险
* @Author: huyc
* @Date: 2022/11/29 10:17
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail>
**/
List<InsuranceUpdateVO> selectByIds(@Param("ids") List<String> ids);
}
......@@ -4,6 +4,9 @@ package com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author licancan
......@@ -13,4 +16,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TInsuranceOperateMapper extends BaseMapper<TInsuranceOperate> {
int saveOperateInfo(@Param("list") List<TInsuranceOperate> list);
}
......@@ -4,6 +4,8 @@ package com.yifu.cloud.plus.v1.yifu.insurances.service.insurance;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate;
import java.util.List;
/**
* @author licancan
* @description 针对表【t_insurance_operate(商险操作表)】的数据库操作Service
......@@ -11,4 +13,5 @@ import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate;
*/
public interface TInsuranceOperateService extends IService<TInsuranceOperate> {
int saveOperateInfo(List<TInsuranceOperate> list);
}
......@@ -28,10 +28,8 @@ import com.yifu.cloud.plus.v1.yifu.insurances.entity.*;
import com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.TInsuranceDetailMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.service.ekp.EkpSettleService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.*;
import com.yifu.cloud.plus.v1.yifu.insurances.util.BeanCopyUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.util.BigDecimalUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.util.LocalDateUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.util.ValidityUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.util.*;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
import com.yifu.cloud.plus.v1.yifu.social.entity.TIncomeDetail;
import com.yifu.cloud.plus.v1.yifu.social.vo.ChangeDeptDetailVo;
......@@ -43,7 +41,6 @@ import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.web.jaasapi.JaasApiIntegrationFilter;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -113,6 +110,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
private MenuUtil menuUtil;
@Resource
private DaprArchivesProperties daprArchivesProperties;
@Resource
@Lazy
private DoJointInsuranceTask doJointInsuranceTask;
/***********************商险办理********************************/
/**
......@@ -1460,7 +1460,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detail.setDefaultSettleId(settle.getId());
successList.add(detail);
//生成收入数据
createInsuranceInfo(detail);
createInsuranceInfo(detail,null);
}else {
//按天
//计算起止时间的天数
......@@ -1495,7 +1495,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detail.setDefaultSettleId(settle.getId());
successList.add(detail);
//生成收入数据
createInsuranceInfo(detail);
createInsuranceInfo(detail,null);
}
}
//实缴
......@@ -1598,9 +1598,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (proStatus != null) {
if (proStatus != CommonConstants.TWO_INT && (status == CommonConstants.TWO_INT
|| status == CommonConstants.FOUR_INT
|| (status == CommonConstants.THREE_INT && proStatus != CommonConstants.FOUR_INT))) {
proStatus = status;
|| status == CommonConstants.FOUR_INT
|| (status == CommonConstants.THREE_INT && proStatus != CommonConstants.FOUR_INT))) {
proStatus = status;
}
} else {
proStatus = status;
......@@ -1714,7 +1714,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
public R<List<InsuranceRegisterParam>> registeredPolicyPremium(List<InsuranceRegisterParam> paramList) {
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(50, 50, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(10));
if (CollectionUtils.isEmpty(paramList)){
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
......@@ -1729,11 +1728,15 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//保存到数据库中的结果
List<InsuranceRegisterParam> listSuccess = operatList.stream().filter(e-> e.getErrorMessage().equals(CommonConstants.RESULT_DATA_SUCESS)).collect(Collectors.toList());
List<TInsuranceDetail> detailList = new ArrayList<>();
List<TSettleDomainSelectVo> settleDomainR;
R<TSettleDomainListVo> listVo;
BigDecimal actualMoney;
if (CollectionUtils.isNotEmpty(listSuccess)){
for (InsuranceRegisterParam success : listSuccess) {
//登记保单保费
//查数据:姓名 + 身份证号 + 保险公司 + 险种名称 + 保单开始时间 + 保单结束时间 + 购买标准
TInsuranceDetail detail = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
TInsuranceDetail detail = baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getEmpName, success.getEmpName())
.eq(TInsuranceDetail::getEmpIdcardNo, success.getEmpIdcardNo())
.eq(TInsuranceDetail::getInsuranceCompanyName, success.getInsuranceCompanyName())
......@@ -1745,7 +1748,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.orderByDesc(TInsuranceDetail::getUpdateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
BigDecimal actualMoney;
actualMoney = detail.getActualPremium();
if (StringUtils.isNotBlank(success.getInvoiceNo())){
detail.setInvoiceNo(success.getInvoiceNo());
......@@ -1754,9 +1756,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceReplace::getOriginInsuranceDetailId, detail.getId()));
if (CollectionUtils.isNotEmpty(list)){
List<String> collect = list.stream().map(TInsuranceReplace::getToInsuranceDetailId).distinct().collect(Collectors.toList());
List<TInsuranceDetail> details = this.baseMapper.selectBatchIds(collect);
List<InsuranceUpdateVO> details = baseMapper.selectByIds(collect);
if (CollectionUtils.isNotEmpty(details)){
details.stream().forEach(e -> e.setInvoiceNo(success.getInvoiceNo()));
details.forEach(e -> e.setInvoiceNo(success.getInvoiceNo()));
//这里自己写sql更新发票号,防止用mybatisPlus批量更新,把updateTime更新了(updateTime不能更新)
baseMapper.updateInvoiceNoBatch(details);
}
......@@ -1767,17 +1769,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//如果当前为合并结算,判断预估是否已发送
if(StringUtils.isNotBlank(detail.getDefaultSettleId()) && detail.getSettleType() == CommonConstants.ZERO_INT){
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
Integer isEstimatePush = settle.getIsEstimatePush();
//如果未推送则推送预估新增
if(isEstimatePush == CommonConstants.ZERO_INT){
String s = pushEstimate(detail, CommonConstants.ONE_INT);
if(StringUtils.isNotBlank(s)){
settle.setIsEstimatePush(CommonConstants.ONE_INT);
settle.setEstimatePushTime(LocalDateTime.now());
tInsuranceSettleService.updateById(settle);
}
if(CommonConstants.ZERO_INT == settle.getIsEstimatePush()){
doJointInsuranceTask.asynchronousEkpInfo(detail,settle,CommonConstants.ONE_INT);
}
}
if (StringUtils.isNotBlank(success.getPolicyNo())){
detail.setPolicyNo(success.getPolicyNo());
......@@ -1786,9 +1781,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.eq(TInsuranceReplace::getOriginInsuranceDetailId, detail.getId()));
if (CollectionUtils.isNotEmpty(list)){
List<String> collect = list.stream().map(TInsuranceReplace::getToInsuranceDetailId).distinct().collect(Collectors.toList());
List<TInsuranceDetail> details = this.baseMapper.selectBatchIds(collect);
List<InsuranceUpdateVO> details = baseMapper.selectByIds(collect);
if (CollectionUtils.isNotEmpty(details)){
details.stream().forEach(e -> e.setPolicyNo(success.getPolicyNo()));
details.forEach(e -> e.setPolicyNo(success.getPolicyNo()));
//这里自己写sql更新保单号,防止用mybatisPlus批量更新,把updateTime更新了(updateTime不能更新)
baseMapper.updatePolicyNoBatch(details);
}
......@@ -1796,119 +1791,68 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//如果保费不为空
if (StringUtils.isNotBlank(success.getActualPremium())){
BigDecimal bigDecimalAct = new BigDecimal(success.getActualPremium());
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()){
Integer isActualPush = settle.getIsActualPush();
//如果当前实缴信息未推送,则新增实缴单推送
if(CommonConstants.ZERO_INT == isActualPush){
//保费存储
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 (settleType == CommonConstants.ZERO_INT && StringUtils.isNotBlank(defaultSettleId)) {
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if (Optional.ofNullable(settle).isPresent()) {
Integer isActualPush = settle.getIsActualPush();
//如果当前实缴信息未推送,则新增实缴单推送
if (CommonConstants.ZERO_INT == isActualPush) {
//保费存储
settle.setActualPremium(bigDecimalAct);
settle.setIsActualPush(CommonConstants.ZERO_INT);
settle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(settle);
//调EKP新增实际保费
detail.setActualPremium(bigDecimalAct);
doJointInsuranceTask.asynchronousEkpInfo(detail,settle,CommonConstants.TWO_INT);
//如果当前实缴信息已推送,且金额与本次不一致,则推送实缴更新
BigDecimal bigDecimal = new BigDecimal(success.getActualPremium());
boolean c = !Common.isNotNull(detail.getActualPremium()) ||
bigDecimal.compareTo(detail.getActualPremium()) != 0;
if(CommonConstants.ONE_INT == isActualPush && c){
//推送保费更新
settle.setActualPremium(bigDecimal);
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{
//推送保费更新
settle.setActualPremium(bigDecimal);
settle.setIsActualPush(CommonConstants.ZERO_INT);
settle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(settle);
//调EKP更新实际保费
detail.setActualPremium(bigDecimal);
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 (detail.getActualPremium().compareTo(bigDecimalAct) != 0) {
//推送保费更新
settle.setActualPremium(bigDecimalAct);
settle.setIsActualPush(CommonConstants.ZERO_INT);
settle.setUpdateTime(LocalDateTime.now());
tInsuranceSettleService.updateById(settle);
//调EKP更新实际保费
detail.setActualPremium(bigDecimalAct);
doJointInsuranceTask.asynchronousEkpInfo(detail,settle,CommonConstants.FOUR_INT);
}
}
}
//如果当前保单为单独结算
if(settleType == CommonConstants.ONE_INT){
//如果当前保单为单独结算
} else if(settleType == CommonConstants.ONE_INT){
//推送过实缴信息且金额与本次不一致,则推送更新
boolean c = !Common.isNotNull(detail.getActualPremium()) ||
new BigDecimal(success.getActualPremium()).compareTo(detail.getActualPremium()) != 0;
bigDecimalAct.compareTo(detail.getActualPremium()) != 0;
if(StringUtils.isNotBlank(defaultSettleId) && c){
//推送保费更新
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
settle.setActualPremium(new BigDecimal(success.getActualPremium()));
settle.setActualPremium(bigDecimalAct);
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)){
detail.setActualPremium(bigDecimalAct);
doJointInsuranceTask.asynchronousEkpInfo(detail,settle,CommonConstants.FOUR_INT);
//未推送过实缴信息,则推送新增
} else if(StringUtils.isBlank(defaultSettleId)){
//保费存储
TInsuranceSettle settle = new TInsuranceSettle();
settle.setInsDetailId(detail.getId());
settle.setSettleType(detail.getSettleType());
settle.setSettleHandleStatus(CommonConstants.ONE_STRING);
settle.setActualPremium(new BigDecimal(success.getActualPremium()));
settle.setActualPremium(bigDecimalAct);
settle.setIsActualPush(CommonConstants.ZERO_INT);
//调完ekp接口才会是1
settle.setCreateTime(LocalDateTime.now());
tInsuranceSettleService.save(settle);
detail.setDefaultSettleId(settle.getId());
//调EKP新增实际保费
detail.setActualPremium(new BigDecimal(success.getActualPremium()));
threadPool.execute(() ->{
String s = pushEstimate(detail, CommonConstants.TWO_INT);
//如果推送成功则更改推送状态
if(StringUtils.isNotBlank(s)){
settle.setActualPushTime(LocalDateTime.now());
settle.setIsActualPush(CommonConstants.ONE_INT);
tInsuranceSettleService.updateById(settle);
}
});
detail.setActualPremium(bigDecimalAct);
doJointInsuranceTask.asynchronousEkpInfo(detail,settle,CommonConstants.TWO_INT);
}
}
}
......@@ -1918,125 +1862,112 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
boolean booleanPolicyNo = StringUtils.isNotBlank(policyNo) && !policyNo.equals(detail.getPolicyNo());
boolean isEquals = Common.isNotNull(detail.getActualPremium()) && Common.isNotNull(success.getActualPremium()) && new BigDecimal(success.getActualPremium()).compareTo(detail.getActualPremium()) == 0;
//如果当前保费为空,且保单号或发票号不一样
if((StringUtils.isBlank(success.getActualPremium()) || isEquals) && (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);
}
});
if ((StringUtils.isBlank(success.getActualPremium()) || isEquals) && (booleanInvoiceNo || booleanPolicyNo)
&& StringUtils.isNotBlank(detail.getDefaultSettleId())) {
TInsuranceSettle settle = tInsuranceSettleService.getById(detail.getDefaultSettleId());
if (Optional.ofNullable(settle).isPresent()) {
//如果当前实缴信息未推送,则新增实缴单推送
if (StringUtils.isNotBlank(invoiceNo)) {
detail.setInvoiceNo(invoiceNo);
}
if (StringUtils.isNotBlank(policyNo)) {
detail.setPolicyNo(policyNo);
}
doJointInsuranceTask.asynchronousEkpInfo(detail,settle,CommonConstants.FOUR_INT);
}
}
//可以改成批量更新
this.updateById(detail);
detailList.add(detail);
try {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
listVo = archivesDaprUtil.selectSettleDomainSelectVoByNo(detail.getDeptNo());
if (Common.isNotNull(listVo)) {
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
if (Common.isNotNull(tSettleDomainListVo) && Common.isNotEmpty(tSettleDomainListVo.getListSelectVO())) {
settleDomainR = tSettleDomainListVo.getListSelectVO();
for (TSettleDomainSelectVo vo : settleDomainR) {
BeanUtils.copyProperties(vo, settleDomain);
}
}
}
if (detail.getBuyType() != CommonConstants.FOUR_INT &&
CommonConstants.ONE_INT == detail.getSettleType() &&
new BigDecimal(success.getActualPremium()).compareTo(actualMoney) != 0) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
List<TSettleDomainSelectVo> settleDomainR = null;
R<TSettleDomainListVo> listVo = null;
listVo = archivesDaprUtil.selectSettleDomainSelectVoByNo(detail.getDeptNo());
if (Common.isNotNull(listVo)) {
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
if (Common.isNotNull(tSettleDomainListVo) && Common.isNotEmpty(tSettleDomainListVo.getListSelectVO())) {
settleDomainR = tSettleDomainListVo.getListSelectVO();
for (TSettleDomainSelectVo vo : settleDomainR) {
BeanUtils.copyProperties(vo, settleDomain);
}
}
}
BigDecimal gMoney = BigDecimal.ZERO;
boolean isBl = false;
if (Common.isNotNull(settleDomain)) {
if (Common.isNotNull(settleDomain) && settleDomain.getMrSettleType().equals(CommonConstants.TWO_STRING)) {
// 含有商险,则计算收入
if (settleDomain.getMrSettleType().equals(CommonConstants.TWO_STRING)) {
if (Common.isNotNull(settleDomain.getManageServerItem()) && settleDomain.getManageServerItem()
.contains(CommonConstants.THREE_STRING) && CommonConstants.ZERO_STRING.equals(settleDomain.getManagementTag())) {
if (CommonConstants.ONE_STRING.equals(settleDomain.getManagementType())) {
gMoney = BigDecimalUtils.safeMultiply(actualMoney,
settleDomain.getManagementFee().divide(new BigDecimal("100"),
CommonConstants.FIVE_INT, RoundingMode.HALF_UP));
isBl = true;
}
//判断是否存在当月的商险收入数据
TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setSourceId(detail.getId());
if (isBl) {
incomeDetail.setMoney(gMoney);
} else {
incomeDetail.setMoney(actualMoney);
}
incomeDetail.setFeeType(CommonConstants.ONE_STRING);
//判断是否存在当月的商险收入数据
R<TIncomeDetailReturnVo> detailInfoList = socialDaprUtils.getTIncomeDetailList(incomeDetail);
if (Common.isNotNull(detailInfoList) && detailInfoList.getCode() == CommonConstants.SUCCESS
&& !detailInfoList.getData().getDetailList().isEmpty()) {
//生成红冲数据
for (TIncomeDetail detailInfo : detailInfoList.getData().getDetailList()) {
TIncomeDetail detail1 = new TIncomeDetail();
BeanCopyUtils.copyProperties(detailInfo, detail1);
detail1.setId(CommonConstants.NULL);
detail1.setRedData(CommonConstants.ONE_STRING);
detail1.setMoney(detailInfo.getMoney().negate());
socialDaprUtils.createTIncomeDetail(detail1);
break;
}
}
if (Common.isNotNull(settleDomain.getManageServerItem()) && settleDomain.getManageServerItem()
.contains(CommonConstants.THREE_STRING) && CommonConstants.ZERO_STRING.equals(settleDomain.getManagementTag())) {
if (CommonConstants.ONE_STRING.equals(settleDomain.getManagementType())) {
gMoney = BigDecimalUtils.safeMultiply(actualMoney,
settleDomain.getManagementFee().divide(new BigDecimal("100"),
CommonConstants.FIVE_INT, RoundingMode.HALF_UP));
isBl = true;
}
if (Common.isNotNull(settleDomain.getRiskServerItem()) && settleDomain.getRiskServerItem()
.contains(CommonConstants.THREE_STRING) && CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
if (CommonConstants.ONE_STRING.equals(settleDomain.getRiskFundType())) {
gMoney = BigDecimalUtils.safeMultiply(actualMoney,
settleDomain.getRiskFundFee().divide(new BigDecimal("100"),
CommonConstants.FIVE_INT, RoundingMode.HALF_UP));
isBl = true;
}
//判断是否存在当月的商险收入数据
TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setSourceId(detail.getId());
incomeDetail.setFeeType(CommonConstants.TWO_STRING);
if (isBl) {
incomeDetail.setMoney(gMoney);
} else {
incomeDetail.setMoney(actualMoney);
//判断是否存在当月的商险收入数据
TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setSourceId(detail.getId());
if (isBl) {
incomeDetail.setMoney(gMoney);
} else {
incomeDetail.setMoney(actualMoney);
}
incomeDetail.setFeeType(CommonConstants.ONE_STRING);
//判断是否存在当月的商险收入数据
R<TIncomeDetailReturnVo> detailInfoList = socialDaprUtils.getTIncomeDetailList(incomeDetail);
if (Common.isNotNull(detailInfoList) && detailInfoList.getCode() == CommonConstants.SUCCESS
&& !detailInfoList.getData().getDetailList().isEmpty()) {
//生成红冲数据
for (TIncomeDetail detailInfo : detailInfoList.getData().getDetailList()) {
TIncomeDetail detail1 = new TIncomeDetail();
BeanCopyUtils.copyProperties(detailInfo, detail1);
detail1.setId(CommonConstants.NULL);
detail1.setRedData(CommonConstants.ONE_STRING);
detail1.setMoney(detailInfo.getMoney().negate());
socialDaprUtils.createTIncomeDetail(detail1);
break;
}
//判断是否存在当月的商险收入数据
R<TIncomeDetailReturnVo> detailInfoList = socialDaprUtils.getTIncomeDetailList(incomeDetail);
if (Common.isNotNull(detailInfoList) && detailInfoList.getCode() == CommonConstants.SUCCESS
&& !detailInfoList.getData().getDetailList().isEmpty()) {
//生成红冲数据
for (TIncomeDetail detailInfo : detailInfoList.getData().getDetailList()) {
TIncomeDetail detail1 = new TIncomeDetail();
BeanCopyUtils.copyProperties(detailInfo, detail1);
detail1.setId(CommonConstants.NULL);
detail1.setRedData(CommonConstants.ONE_STRING);
detail1.setMoney(detailInfo.getMoney().negate());
socialDaprUtils.createTIncomeDetail(detail1);
break;
}
}
}
if (Common.isNotNull(settleDomain.getRiskServerItem()) && settleDomain.getRiskServerItem()
.contains(CommonConstants.THREE_STRING) && CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
if (CommonConstants.ONE_STRING.equals(settleDomain.getRiskFundType())) {
gMoney = BigDecimalUtils.safeMultiply(actualMoney,
settleDomain.getRiskFundFee().divide(new BigDecimal("100"),
CommonConstants.FIVE_INT, RoundingMode.HALF_UP));
isBl = true;
}
//判断是否存在当月的商险收入数据
TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setSourceId(detail.getId());
incomeDetail.setFeeType(CommonConstants.TWO_STRING);
if (isBl) {
incomeDetail.setMoney(gMoney);
} else {
incomeDetail.setMoney(actualMoney);
}
//判断是否存在当月的商险收入数据
R<TIncomeDetailReturnVo> detailInfoList = socialDaprUtils.getTIncomeDetailList(incomeDetail);
if (Common.isNotNull(detailInfoList) && detailInfoList.getCode() == CommonConstants.SUCCESS
&& !detailInfoList.getData().getDetailList().isEmpty()) {
//生成红冲数据
for (TIncomeDetail detailInfo : detailInfoList.getData().getDetailList()) {
TIncomeDetail detail1 = new TIncomeDetail();
BeanCopyUtils.copyProperties(detailInfo, detail1);
detail1.setId(CommonConstants.NULL);
detail1.setRedData(CommonConstants.ONE_STRING);
detail1.setMoney(detailInfo.getMoney().negate());
socialDaprUtils.createTIncomeDetail(detail1);
break;
}
}
}
}
//生成收入数据
createInsuranceInfo(detail);
createInsuranceInfo(detail,settleDomain);
}
}catch (Exception e){
log.error("收入数据同步处理失败:"+e);
......@@ -3355,6 +3286,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
List<TInsuranceOperate> operateList = new ArrayList<>();
for (TInsuranceDetail detail : detailList) {
TInsuranceOperate operate = new TInsuranceOperate();
operate.setId(String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
operate.setRemark(remark);
operate.setDisplayFlag(displayFlag);
operate.setInsuranceDetailId(detail.getId());
......@@ -3364,7 +3296,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
operate.setCreateTime(LocalDateTime.now());
operateList.add(operate);
}
tInsuranceOperateService.saveBatch(operateList);
tInsuranceOperateService.saveOperateInfo(operateList);
}
}
......@@ -4177,7 +4109,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
socialDaprUtils.createTIncomeDetail(detail1);
}
//新项目下生成收入数据
createInsuranceInfo(income);
createInsuranceInfo(income,null);
}
}
}
......@@ -5704,7 +5636,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
String policyStart = param.getPolicyStart();
if(StringUtils.isBlank(policyStart)){
param.setErrorMessage(InsurancesConstants.POLICY_START_NOT_EMPTY);
errorList.add(param);
continue;
}
//保单结束日期
......@@ -5730,7 +5661,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
// 保单开始日期格式校验
if(!LocalDateUtil.isDate(policyStart,LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_START_PARSE_ERROR);
errorList.add(param);
continue;
}
// 保单结束日期格式校验
......@@ -6325,18 +6255,19 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//商险预估
public void createInsuranceInfo(TInsuranceDetail insuranceDetail) {
//获取项目信息
TSettleDomain settleDomain = new TSettleDomain();
List<TSettleDomainSelectVo> settleDomainR;
R<TSettleDomainListVo> listVo;
listVo = archivesDaprUtil.selectSettleDomainSelectVoByNo(insuranceDetail.getDeptNo());
if (Common.isNotNull(listVo)) {
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
if (Common.isNotNull(tSettleDomainListVo) && Common.isNotEmpty(tSettleDomainListVo.getListSelectVO())) {
settleDomainR = tSettleDomainListVo.getListSelectVO();
for (TSettleDomainSelectVo vo :settleDomainR) {
BeanUtils.copyProperties(vo,settleDomain);
public void createInsuranceInfo(TInsuranceDetail insuranceDetail,TSettleDomain settleDomain) {
if (Common.isEmpty(settleDomain)) {
//获取项目信息
List<TSettleDomainSelectVo> settleDomainR;
R<TSettleDomainListVo> listVo;
listVo = archivesDaprUtil.selectSettleDomainSelectVoByNo(insuranceDetail.getDeptNo());
if (Common.isNotNull(listVo)) {
TSettleDomainListVo tSettleDomainListVo = listVo.getData();
if (Common.isNotNull(tSettleDomainListVo) && Common.isNotEmpty(tSettleDomainListVo.getListSelectVO())) {
settleDomainR = tSettleDomainListVo.getListSelectVO();
for (TSettleDomainSelectVo vo : settleDomainR) {
BeanUtils.copyProperties(vo, settleDomain);
}
}
}
}
......@@ -6374,110 +6305,104 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (Common.isNotNull(settleDomain)) {
// 含有商险,则计算收入
if (Common.isNotNull(settleDomain.getManageServerItem()) && settleDomain.getManageServerItem()
.contains(CommonConstants.THREE_STRING)) {
.contains(CommonConstants.THREE_STRING) && CommonConstants.ZERO_STRING.equals(settleDomain.getManagementTag())) {
//预估模式
if (CommonConstants.ZERO_STRING.equals(settleDomain.getManagementTag())) {
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType())) {
//预估模式只有按人次和人数收费
if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
if (Common.isNotNull(incomeDetailList)) {
for (TIncomeDetail incomeDetailSum: incomeDetailList) {
if (!(incomeDetailSum.getSourceId().equals(insuranceDetail.getId()) &&
CommonConstants.ONE_STRING.equals(incomeDetailSum.getFeeType()) &&
CommonConstants.ONE_STRING.equals(incomeDetailSum.getMrSettleType()))) {
isSum = 1;
break;
}
}
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType())) {
//预估模式只有按人次和人数收费
if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType()) &&
Common.isNotNull(incomeDetailList)) {
for (TIncomeDetail incomeDetailSum : incomeDetailList) {
if (!(incomeDetailSum.getSourceId().equals(insuranceDetail.getId()) &&
CommonConstants.ONE_STRING.equals(incomeDetailSum.getFeeType()) &&
CommonConstants.ONE_STRING.equals(incomeDetailSum.getMrSettleType()))) {
isSum = 1;
break;
}
}
if (!isExist || isSum == 1) {
createIncomeInsurance(insuranceDetail, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
settleDomain.getManagementFee());
}
} else {
BigDecimal gMoney;
if (CommonConstants.TWO_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
if (Common.isNotNull(incomeDetailList)) {
for (TIncomeDetail incomeDetailSum: incomeDetailList) {
if (incomeDetailSum.getSourceId().equals(insuranceDetail.getId()) &&
CommonConstants.ONE_STRING.equals(incomeDetailSum.getFeeType()) &&
CommonConstants.TWO_STRING.equals(incomeDetailSum.getMrSettleType()) &&
CommonConstants.THREE_STRING.equals(incomeDetailSum.getFeeMode())) {
isSum = 6;
break;
} else {
isSum = 2;
}
}
if (!isExist || isSum == 1) {
createIncomeInsurance(insuranceDetail, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(),
settleDomain.getManagementFee());
}
} else {
BigDecimal gMoney;
if (CommonConstants.TWO_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
gMoney = settleDomain.getManagementFee();
if (Common.isNotNull(incomeDetailList)) {
for (TIncomeDetail incomeDetailSum : incomeDetailList) {
if (incomeDetailSum.getSourceId().equals(insuranceDetail.getId()) &&
CommonConstants.ONE_STRING.equals(incomeDetailSum.getFeeType()) &&
CommonConstants.TWO_STRING.equals(incomeDetailSum.getMrSettleType()) &&
CommonConstants.THREE_STRING.equals(incomeDetailSum.getFeeMode())) {
isSum = 6;
break;
} else {
isSum = 2;
}
}
} else {
isSum = 2;
gMoney = BigDecimalUtils.safeMultiply(fee, settleDomain.getManagementFee().divide(
new BigDecimal("100"), CommonConstants.FIVE_INT, BigDecimal.ROUND_HALF_UP));
}
if (!isExist || isSum == 2) {
createIncomeInsurance(insuranceDetail, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(), gMoney);
}
} else {
isSum = 2;
gMoney = BigDecimalUtils.safeMultiply(fee, settleDomain.getManagementFee().divide(
new BigDecimal("100"), CommonConstants.FIVE_INT, RoundingMode.HALF_UP));
}
if (!isExist || isSum == 2) {
createIncomeInsurance(insuranceDetail, settleDomain, CommonConstants.ONE_STRING,
settleDomain.getManagementFee().toString(), settleDomain.getManagementType(), gMoney);
}
}
}
if (Common.isNotNull(settleDomain.getRiskServerItem()) && settleDomain.getRiskServerItem()
.contains(CommonConstants.THREE_STRING)) {
.contains(CommonConstants.THREE_STRING) && CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
//预估模式
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType())) {
if (CommonConstants.THREE_STRING.equals(settleDomain.getRiskFundType())) {
if (CommonConstants.ONE_STRING.equals(settleDomain.getMrSettleType())) {
if (CommonConstants.THREE_STRING.equals(settleDomain.getRiskFundType()) &&
Common.isNotNull(incomeDetailList)) {
for (TIncomeDetail incomeDetailSum : incomeDetailList) {
if (!(incomeDetailSum.getSourceId().equals(insuranceDetail.getId()) &&
CommonConstants.TWO_STRING.equals(incomeDetailSum.getFeeType()) &&
CommonConstants.ONE_STRING.equals(incomeDetailSum.getMrSettleType()))) {
isSum = 3;
break;
}
}
}
if (!isExist || isSum == 3) {
createIncomeInsurance(insuranceDetail, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
settleDomain.getRiskFundFee());
}
} else {
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
BigDecimal money;
if (CommonConstants.TWO_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
if (Common.isNotNull(incomeDetailList)) {
for (TIncomeDetail incomeDetailSum: incomeDetailList) {
if (!(incomeDetailSum.getSourceId().equals(insuranceDetail.getId()) &&
for (TIncomeDetail incomeDetailSum : incomeDetailList) {
if (incomeDetailSum.getSourceId().equals(insuranceDetail.getId()) &&
CommonConstants.TWO_STRING.equals(incomeDetailSum.getFeeType()) &&
CommonConstants.ONE_STRING.equals(incomeDetailSum.getMrSettleType()))) {
isSum = 3;
CommonConstants.TWO_STRING.equals(incomeDetailSum.getMrSettleType()) &&
CommonConstants.THREE_STRING.equals(incomeDetailSum.getFeeMode())) {
isSum = 5;
break;
} else {
isSum = 4;
}
}
}
} else {
isSum = 4;
money = BigDecimalUtils.safeMultiply(fee, settleDomain.getRiskFundFee().divide(
new BigDecimal("100"), CommonConstants.FIVE_INT, RoundingMode.HALF_UP));
}
if (!isExist || isSum == 3) {
if (!isExist || isSum == 4) {
createIncomeInsurance(insuranceDetail, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(),
settleDomain.getRiskFundFee());
}
} else {
if (CommonConstants.ZERO_STRING.equals(settleDomain.getRiskFundTag())) {
BigDecimal money;
if (CommonConstants.TWO_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
if (Common.isNotNull(incomeDetailList)) {
for (TIncomeDetail incomeDetailSum: incomeDetailList) {
if (incomeDetailSum.getSourceId().equals(insuranceDetail.getId()) &&
CommonConstants.TWO_STRING.equals(incomeDetailSum.getFeeType()) &&
CommonConstants.TWO_STRING.equals(incomeDetailSum.getMrSettleType()) &&
CommonConstants.THREE_STRING.equals(incomeDetailSum.getFeeMode())) {
isSum = 5;
break;
} else {
isSum = 4;
}
}
}
} else {
isSum = 4;
money = BigDecimalUtils.safeMultiply(fee, settleDomain.getRiskFundFee().divide(
new BigDecimal("100"), CommonConstants.FIVE_INT, BigDecimal.ROUND_HALF_UP));
}
if (!isExist || isSum == 4) {
createIncomeInsurance(insuranceDetail, settleDomain, CommonConstants.TWO_STRING,
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(), money);
}
settleDomain.getRiskFundFee().toString(), settleDomain.getRiskFundType(), money);
}
}
}
......
......@@ -6,6 +6,8 @@ import com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.TInsuranceOperat
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceOperateService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author licancan
......@@ -15,4 +17,8 @@ import org.springframework.stereotype.Service;
@Service
public class TInsuranceOperateServiceImpl extends ServiceImpl<TInsuranceOperateMapper, TInsuranceOperate> implements TInsuranceOperateService {
@Override
public int saveOperateInfo(List<TInsuranceOperate> list) {
return baseMapper.saveOperateInfo(list);
}
}
package com.yifu.cloud.plus.v1.yifu.insurances.util;
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.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
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.insurances.constants.InsurancesConstants;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceEkp;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceSettle;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceSettleCancel;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceEkpService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceSettleCancelService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.TInsuranceSettleService;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpInteractiveParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.time.LocalDateTime;
/**
* 主要执行商险的异步推送
* @author huyc
* @Date 2022-11-30
* @Description 多线程的执行
*/
@Slf4j
@Component
public class DoJointInsuranceTask {
@Resource
private TInsuranceSettleService tInsuranceSettleService;
@Autowired
private EkpInsuranceUtil eKPInsuranceUtil;
@Autowired
private TInsuranceEkpService tInsuranceEkpService;
@Autowired
private ArchivesDaprUtil archivesDaprUtil;
@Autowired
private TInsuranceSettleCancelService tInsuranceSettleCancelService;
/**
* @Description: 商险明细推送
* @Author: huyc
* @Date: 2022-11-30
* @return: void
**/
@Async
public void asynchronousEkpInfo(TInsuranceDetail detail, TInsuranceSettle settle, Integer type) {
log.info("推送商险明细到EKP-线程开始");
try {
String s = pushEstimate(detail,type);
if(StringUtils.isNotBlank(s)){
if (type == CommonConstants.ONE_INT) {
settle.setIsEstimatePush(CommonConstants.ONE_INT);
settle.setEstimatePushTime(LocalDateTime.now());
} else {
settle.setIsActualPush(CommonConstants.ONE_INT);
settle.setActualPushTime(LocalDateTime.now());
}
tInsuranceSettleService.updateById(settle);
}
} catch (Exception e) {
log.error("推送商险明细到EKP错误", e);
}
log.info("推送商险明细到EKP结束");
}
/**
* 推送EKP
*
* @author zhaji
* @param
* @return {@link String}
*/
private String pushEstimate(TInsuranceDetail tInsuranceDetail,Integer type){
YifuUser user = SecurityUtils.getUser();
Integer pushType = null;
//1,推送预估保费,2,推送实际保费,3推送预估冲正保费,4更新实际保费
EkpInteractiveParam param = new EkpInteractiveParam();
TInsuranceSettleCancel cancel = new TInsuranceSettleCancel();
BeanCopyUtils.copyProperties(tInsuranceDetail,param);
param.setDetailId(tInsuranceDetail.getId());
Integer settleType = tInsuranceDetail.getSettleType();
if(CommonConstants.ZERO_INT == settleType){
param.setEstimateStatus(EkpConstants.HAVE);
}else {
param.setEstimateStatus(EkpConstants.NOTHING);
}
if (Common.isNotNull(tInsuranceDetail.getUnitName())) {
param.setCustomerName(tInsuranceDetail.getUnitName());
}
if (Common.isNotNull(tInsuranceDetail.getUnitNo())) {
param.setCustomerCode(tInsuranceDetail.getUnitNo());
}
//1,推送预估保费(用户办理成功,推送预估保费)
if(CommonConstants.ONE_INT == type){
param.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
param.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
pushType = CommonConstants.ONE_INT;
}
//2,推送实际保费(用于登记保单保费未推送过实缴保费)
if(CommonConstants.TWO_INT == type){
param.setInteractiveType(InsurancesConstants.NEW_SETTLE_BILL);
param.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
pushType = CommonConstants.TWO_INT;
}
//3推送预估冲正保费(用于投保退回场景)
if(CommonConstants.THREE_INT == type){
String defaultSettleId = tInsuranceDetail.getDefaultSettleId();
TInsuranceSettle byId = tInsuranceSettleService.getById(defaultSettleId);
//冲正取负数
if(null != byId.getEstimatePremium()){
param.setEstimatePremium(byId.getEstimatePremium());
}
param.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
param.setSettleType(InsurancesConstants.ESTIMATE_SETTLE_BILL);
pushType = CommonConstants.FIVE_INT;
}
//6推送实缴红冲(用于投保退回场景)
if(CommonConstants.SIX_INT == type){
String defaultSettleId = tInsuranceDetail.getDefaultSettleId();
TInsuranceSettle byId = tInsuranceSettleService.getById(defaultSettleId);
//冲正取负数
if(null != byId.getActualPremium()){
param.setActualPremium(byId.getActualPremium());
}
param.setInteractiveType(InsurancesConstants.CORRECT_SETTLE_BILL);
param.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
pushType = CommonConstants.SIX_INT;
}
//4更新实际保费(用于登记保单保费场景推送过实缴保费)
if(CommonConstants.FOUR_INT == type){
param.setInteractiveType(InsurancesConstants.UPDATE_SETTLE_BILL);
param.setSettleType(InsurancesConstants.ACTUAL_SETTLE_BILL);
pushType = CommonConstants.THREE_INT;
}
//作废
if(CommonConstants.FIVE_INT == type){
cancel.setDeptNo(tInsuranceDetail.getDeptNo());
cancel.setInsDetailId(tInsuranceDetail.getId());
cancel.setSettleId(tInsuranceDetail.getDefaultSettleId());
cancel.setCreateUesr(user.getId());
cancel.setCreateTime(LocalDateTime.now());
cancel.setDeptName(param.getDeptName());
cancel.setIsCancelPush(CommonConstants.ZERO_INT);
tInsuranceSettleCancelService.save(cancel);
param.setInteractiveType(InsurancesConstants.ABOLISH_SETTLE_BILL);
param.setSettleType(CommonConstants.EMPTY_STRING);
pushType = CommonConstants.FOUR_INT;
}
String s = eKPInsuranceUtil.sendToEkp(param);
if(StringUtils.isBlank(s)){
saveInsuranceEkp(param,pushType);
return null;
}else {
return s;
}
}
/**
* 保存失败信息
*
* @author zhaji
* @param
* @return {@link String}
*/
private void saveInsuranceEkp(EkpInteractiveParam param, Integer pushType){
TInsuranceEkp ekp = new TInsuranceEkp();
BeanCopyUtils.copyProperties(param,ekp);
ekp.setId(null);
ekp.setCreateTime(LocalDateTime.now());
ekp.setPushType(pushType);
tInsuranceEkpService.save(ekp);
}
}
......@@ -63,6 +63,11 @@
<result property="unitName" column="UNIT_NAME" jdbcType="VARCHAR"/>
<result property="unitNo" column="UNIT_NO" jdbcType="VARCHAR"/>
</resultMap>
<resultMap id="UpdateMap" type="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceUpdateVO">
<id property="id" column="ID" jdbcType="VARCHAR"/>
<result property="invoiceNo" column="INVOICE_NO" jdbcType="VARCHAR"/>
<result property="policyNo" column="POLICY_NO" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
ID,EMP_NAME,
EMP_IDCARD_NO,DEPT_NO,POST,INSURANCE_COMPANY_NAME,INSURANCE_TYPE_NAME,
......@@ -1209,4 +1214,18 @@
</if>
</select>
<select id="selectByIds" resultMap="UpdateMap">
SELECT
a.ID,
a.INVOICE_NO,
a.POLICY_NO
FROM
t_insurance_detail a
where
a.ID in
<foreach item="item" index="index" collection="ids" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
......@@ -19,4 +19,22 @@
ID,INSURANCE_DETAIL_ID,OPERATE_DESC,REMARK,
CREATE_BY,CREATE_NAME,CREATE_TIME
</sql>
<insert id="saveOperateInfo" parameterType="java.util.List">
insert into t_insurance_operate
(ID,REMARK,DISPLAY_FLAG,CREATE_BY,CREATE_TIME,CREATE_NAME,OPERATE_DESC,INSURANCE_DETAIL_ID)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.id,jdbcType=VARCHAR},
#{item.remark,jdbcType=VARCHAR},
#{item.displayFlag},
#{item.createBy,jdbcType=VARCHAR},
#{item.createTime},
#{item.createName,jdbcType=VARCHAR},
#{item.operateDesc,jdbcType=VARCHAR},
#{item.insuranceDetailId,jdbcType=VARCHAR},
)
</foreach>
</insert>
</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