Commit 1fbd0173 authored by huyuchen's avatar huyuchen

优化修改

parent 91114bde
......@@ -110,9 +110,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Resource
private SocialDaprUtils socialDaprUtils;
@Resource
private SalaryDaprUtil salaryDaprUtil;
@Resource
private MenuUtil menuUtil;
@Resource
......@@ -7230,41 +7227,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (Common.isEmpty(vo)) {
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
List<EkpInsuranceViewVo> viewVoList;
TInsuranceDetail detail;
try {
//根据结算单号获取明细id和结算状态
viewVoList = ekpSettleService.selectViewBySettleNo(vo.getSettleNo(),vo.getPayFlag());
if (!viewVoList.isEmpty()) {
String insuranceId;
for (EkpInsuranceViewVo viewVo : viewVoList) {
//获取所有的明细id
insuranceId = viewVo.getId().substring(0,19);
detail = baseMapper.selectById(insuranceId);
if (Common.isNotNull(detail)) {
//判断订单类型是预估还是实缴
if (InsurancesConstants.ACTUAL_SETTLE_BILL.equals(viewVo.getOrderType())) {
//判断是收入还是支出结算单号
if (CommonConstants.ZERO_STRING.equals(vo.getPayFlag())) {
detail.setSincomeSettleFlag(viewVo.getIncomeSettleFlag());
detail.setSincomeCollectFlag(viewVo.getIncomeCollectFlag());
} else {
detail.setSpaySettleFlag(viewVo.getPaySettleFlag());
detail.setSpayCollectFlag(viewVo.getPayCollectFlag());
}
} else {
if (CommonConstants.ZERO_STRING.equals(vo.getPayFlag())) {
detail.setIncomeSettleFlag(viewVo.getIncomeSettleFlag());
detail.setIncomeCollectFlag(viewVo.getIncomeCollectFlag());
} else {
detail.setPaySettleFlag(viewVo.getPaySettleFlag());
detail.setPayCollectFlag(viewVo.getPayCollectFlag());
}
}
baseMapper.updateById(detail);
}
}
}
doJointInsuranceTask.updateInsuranceSettleStatus(vo);
}catch (Exception e) {
log.error("商险结算状态更新异常", e);
return R.failed("商险结算状态更新异常");
......@@ -7276,19 +7240,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (Common.isEmpty(vo)) {
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
List<EkpSocialViewVo> viewVo;
try {
//根据结算单号获取明细id和结算状态
if (CommonConstants.ZERO_STRING.equals(vo.getTypeFlag())) {
viewVo = ekpSettleService.selectSocialViewBySettleNo(vo.getSettleNo(),vo.getPayFlag());
} else {
viewVo = ekpSettleService.selectFundViewBySettleNo(vo.getSettleNo(),vo.getPayFlag());
}
if (!viewVo.isEmpty()) {
viewVo.forEach(e ->{
e.setPayFlag(vo.getPayFlag());});
socialDaprUtils.updateSocialSettleStatus(viewVo);
}
doJointInsuranceTask.updateSocialSettleStatus(vo);
}catch (Exception e) {
log.error("社保结算状态更新异常", e);
return R.failed("社保结算状态更新异常");
......@@ -7300,17 +7253,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (Common.isEmpty(vo)) {
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
List<EkpInsuranceViewVo> viewVo;
try {
//根据结算单号获取明细id和结算状态;判断是管理费还是风险金
if (CommonConstants.ZERO_STRING.equals(vo.getTypeFlag())) {
viewVo = ekpSettleService.selectIncomelViewBySettleNo(vo.getSettleNo());
}else {
viewVo = ekpSettleService.selectFIncomelViewBySettleNo(vo.getSettleNo());
}
if (!viewVo.isEmpty()) {
socialDaprUtils.updateIncomeSettleStatus(viewVo);
}
doJointInsuranceTask.updateIncomeSettleStatus(vo);
}catch (Exception e) {
log.error("收入结算状态更新异常", e);
return R.failed("收入结算状态更新异常");
......@@ -7323,15 +7267,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (Common.isEmpty(vo)) {
return R.failed(CommonConstants.PARAM_IS_NOT_ERROR);
}
List<EkpSocialViewVo> viewVo;
try {
//根据结算单号获取明细id和结算状态
viewVo = ekpSettleService.selectSalarylViewBySettleNo(vo.getSettleNo(),vo.getPayFlag());
if (!viewVo.isEmpty()) {
viewVo.forEach(e ->{
e.setPayFlag(vo.getPayFlag());});
salaryDaprUtil.updateSalarySettleStatus(viewVo);
}
doJointInsuranceTask.updateSalarySettleStatus(vo);
}catch (Exception e) {
log.error("薪资结算状态更新异常", e);
return R.failed("薪资结算状态更新异常");
......
......@@ -3,7 +3,8 @@ 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.dapr.util.SalaryDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.SocialDaprUtils;
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;
......@@ -12,10 +13,15 @@ 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.mapper.insurances.TInsuranceDetailMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.service.ekp.EkpSettleService;
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.EkpInsuranceViewVo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpInteractiveParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpSocialViewVo;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpStatusParamVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -24,6 +30,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
/**
* 主要执行商险的异步推送
......@@ -45,10 +52,19 @@ public class DoJointInsuranceTask {
private TInsuranceEkpService tInsuranceEkpService;
@Autowired
private ArchivesDaprUtil archivesDaprUtil;
private TInsuranceSettleCancelService tInsuranceSettleCancelService;
@Autowired
private TInsuranceSettleCancelService tInsuranceSettleCancelService;
private EkpSettleService ekpSettleService;
@Autowired
private TInsuranceDetailMapper insuranceDetailMapper;
@Autowired
private SocialDaprUtils socialDaprUtils;
@Autowired
private SalaryDaprUtil salaryDaprUtil;
/**
* @Description: 商险明细推送
......@@ -184,4 +200,86 @@ public class DoJointInsuranceTask {
ekp.setPushType(pushType);
tInsuranceEkpService.save(ekp);
}
@Async
public void updateInsuranceSettleStatus(EkpStatusParamVo vo) {
//根据结算单号获取明细id和结算状态
List<EkpInsuranceViewVo> viewVoList;
TInsuranceDetail detail;
viewVoList = ekpSettleService.selectViewBySettleNo(vo.getSettleNo(),vo.getPayFlag());
if (!viewVoList.isEmpty()) {
String insuranceId;
for (EkpInsuranceViewVo viewVo : viewVoList) {
//获取所有的明细id
insuranceId = viewVo.getId().substring(0,19);
detail = insuranceDetailMapper.selectById(insuranceId);
if (Common.isNotNull(detail)) {
//判断订单类型是预估还是实缴
if (InsurancesConstants.ACTUAL_SETTLE_BILL.equals(viewVo.getOrderType())) {
//判断是收入还是支出结算单号
if (CommonConstants.ZERO_STRING.equals(vo.getPayFlag())) {
detail.setSincomeSettleFlag(viewVo.getIncomeSettleFlag());
detail.setSincomeCollectFlag(viewVo.getIncomeCollectFlag());
} else {
detail.setSpaySettleFlag(viewVo.getPaySettleFlag());
detail.setSpayCollectFlag(viewVo.getPayCollectFlag());
}
} else {
if (CommonConstants.ZERO_STRING.equals(vo.getPayFlag())) {
detail.setIncomeSettleFlag(viewVo.getIncomeSettleFlag());
detail.setIncomeCollectFlag(viewVo.getIncomeCollectFlag());
} else {
detail.setPaySettleFlag(viewVo.getPaySettleFlag());
detail.setPayCollectFlag(viewVo.getPayCollectFlag());
}
}
insuranceDetailMapper.updateById(detail);
}
}
}
}
@Async
public void updateSocialSettleStatus(EkpStatusParamVo vo) {
List<EkpSocialViewVo> viewVo;
//根据结算单号获取明细id和结算状态
if (CommonConstants.ZERO_STRING.equals(vo.getTypeFlag())) {
viewVo = ekpSettleService.selectSocialViewBySettleNo(vo.getSettleNo(),vo.getPayFlag());
} else {
viewVo = ekpSettleService.selectFundViewBySettleNo(vo.getSettleNo(),vo.getPayFlag());
}
if (!viewVo.isEmpty()) {
viewVo.forEach(e ->{
e.setPayFlag(vo.getPayFlag());});
socialDaprUtils.updateSocialSettleStatus(viewVo);
}
}
@Async
public void updateIncomeSettleStatus(EkpStatusParamVo vo) {
List<EkpInsuranceViewVo> viewVo;
//根据结算单号获取明细id和结算状态
//根据结算单号获取明细id和结算状态;判断是管理费还是风险金
if (CommonConstants.ZERO_STRING.equals(vo.getTypeFlag())) {
viewVo = ekpSettleService.selectIncomelViewBySettleNo(vo.getSettleNo());
}else {
viewVo = ekpSettleService.selectFIncomelViewBySettleNo(vo.getSettleNo());
}
if (!viewVo.isEmpty()) {
socialDaprUtils.updateIncomeSettleStatus(viewVo);
}
}
@Async
public void updateSalarySettleStatus(EkpStatusParamVo vo) {
List<EkpSocialViewVo> viewVo;
//根据结算单号获取明细id和结算状态
viewVo = ekpSettleService.selectSalarylViewBySettleNo(vo.getSettleNo(),vo.getPayFlag());
if (!viewVo.isEmpty()) {
viewVo.forEach(e ->{
e.setPayFlag(vo.getPayFlag());});
salaryDaprUtil.updateSalarySettleStatus(viewVo);
}
}
}
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