Commit 782f669a authored by huyuchen's avatar huyuchen

生成收入接口修改

parent 7efd8f81
......@@ -1125,7 +1125,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//已投保退回,收入数据同步处理
try{
updateInsuranceInfo(detail,settle);
updateInsuranceInfo(detail);
}catch (Exception e){
log.error("收入数据同步处理失败:"+e);
}
......@@ -1611,9 +1611,79 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detailList.add(detail);
try {
if (detail.getBuyType() != CommonConstants.FOUR_INT) {
if (new BigDecimal(success.getActualPremium()).compareTo(detail.getActualPremium()) != 0) {
//判断是否存在当月的商险收入数据
TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setSourceId(detail.getId());
R<TIncomeDetailReturnVo> detailInfoList = socialDaprUtils.getTIncomeDetailList(incomeDetail);
if (Common.isNotNull(detailInfoList) && detailInfoList.getCode() == CommonConstants.SUCCESS
&& detailInfoList.getData().getDetailList().size() > 0) {
//生成红冲数据
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(detailInfo);
}
}
//生成收入数据
createInsuranceInfo(detail);
} else {
//获取项目信息
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 (settleDomain.getMrSettleType().equals(CommonConstants.TWO_STRING)) {
if (Common.isNotNull(settleDomain.getManageServerItem()) && settleDomain.getManageServerItem()
.contains(CommonConstants.THREE_STRING)) {
if (CommonConstants.ONE_STRING.equals(settleDomain.getManagementType())) {
gMoney = BigDecimalUtils.safeMultiply(detail.getActualPremium(),
settleDomain.getManagementFee().divide(new BigDecimal("100"),
CommonConstants.FIVE_INT, BigDecimal.ROUND_HALF_UP));
isBl = true;
}
} else if (Common.isNotNull(settleDomain.getRiskServerItem()) && settleDomain.getRiskServerItem()
.contains(CommonConstants.THREE_STRING)) {
if (CommonConstants.ONE_STRING.equals(settleDomain.getRiskFundType())) {
gMoney = BigDecimalUtils.safeMultiply(detail.getActualPremium(),
settleDomain.getRiskFundFee().divide(new BigDecimal("100"),
CommonConstants.FIVE_INT, BigDecimal.ROUND_HALF_UP));
isBl = true;
}
}
}
}
//判断是否存在当月的商险收入数据
TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setSourceId(detail.getId());
if (isBl) {
incomeDetail.setMoney(gMoney);
}else {
incomeDetail.setMoney(detail.getActualPremium());
}
R<TIncomeDetailReturnVo> detailInfoList = socialDaprUtils.getTIncomeDetailList(incomeDetail);
if (Common.isNotNull(detailInfoList) && detailInfoList.getData().getDetailList().size() == 0) {
//生成收入数据
createInsuranceInfo(detail);
}
}
}
}catch (Exception e){
log.error("收入数据同步处理失败:"+e);
}
......@@ -5960,6 +6030,14 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
isExist = true;
}
//预估或者实缴保费
BigDecimal fee;
if (CommonConstants.ONE_STRING.equals(insuranceDetail.getSettleType())) {
fee = insuranceDetail.getEstimatePremium();
} else {
fee = insuranceDetail.getActualPremium();
}
//判断是否为按人次收费
int isSum = 0;
if (Common.isNotNull(settleDomain)) {
......@@ -5986,9 +6064,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
gMoney = settleDomain.getManagementFee();
isSum = 2;
} else {
gMoney = BigDecimalUtils.safeMultiply(insuranceDetail.getActualPremium(),
settleDomain.getManagementFee().divide(new BigDecimal("100"),
CommonConstants.THREE_INT, BigDecimal.ROUND_HALF_UP));
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,
......@@ -6015,13 +6093,13 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
BigDecimal money = BigDecimal.ZERO;
if (CommonConstants.TWO_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getManagementType())) {
} else if (CommonConstants.THREE_STRING.equals(settleDomain.getRiskFundType())) {
money = settleDomain.getRiskFundFee();
isSum = 4;
} else {
money = BigDecimalUtils.safeMultiply(insuranceDetail.getActualPremium(),
settleDomain.getRiskFundFee().divide(new BigDecimal("100"),
CommonConstants.THREE_INT, BigDecimal.ROUND_HALF_UP));
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,
......@@ -6049,8 +6127,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
detail.setDataCreateMonth(DateUtil.addMonth(0));
detail.setSourceId(insuranceDetail.getId());
detail.setSourceType(CommonConstants.THREE_STRING);
detail.setCreateMonth(DateUtil.getYearAndMonth(insuranceDetail.getHandledTime(),0));
detail.setPayMonth(insuranceDetail.getSettleMonth().replace("-",""));
detail.setCreateMonth(DateUtil.addMonth(0));
detail.setPayMonth(DateUtil.addMonth(0));
detail.setMoney(money);
detail.setFeeType(feeType);
detail.setFeeMode(feeMode);
......@@ -6062,7 +6140,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//更新收入信息
public void updateInsuranceInfo(TInsuranceDetail insuranceDetail,TInsuranceSettle settle) {
public void updateInsuranceInfo(TInsuranceDetail insuranceDetail) {
TIncomeDetail incomeDetail = new TIncomeDetail();
incomeDetail.setSourceId(insuranceDetail.getId());
R<TIncomeDetailReturnVo> detailList = socialDaprUtils.getTIncomeDetailList(incomeDetail);
......
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