|
|
@@ -1,6 +1,7 @@
|
|
|
package com.ydtech.modules.order.aop.aspect;
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.ydtech.constants.enums.InsuranceRisk;
|
|
|
import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
|
|
|
import com.ydtech.constants.enums.dict.agreement.ProductsType;
|
|
|
@@ -28,6 +29,11 @@ import com.ydtech.modules.order.entity.vo.SubOrderExportFeeVo;
|
|
|
import com.ydtech.modules.order.service.InsAreaCompanyAccidentalDrivingService;
|
|
|
import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
|
import com.ydtech.modules.order.service.InsOrdersService;
|
|
|
+import com.ydtech.modules.protocol.constants.TaxSourceStatusConstants;
|
|
|
+import com.ydtech.modules.protocol.dao.PtlTaxSourceNewMapper;
|
|
|
+import com.ydtech.modules.protocol.entity.dto.TaxSourceExcludeDto;
|
|
|
+import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNew;
|
|
|
+import com.ydtech.modules.protocol.service.ITaxSourceExcludeService;
|
|
|
import com.ydtech.modules.protocol.service.PtlAgreementDeptService;
|
|
|
import com.ydtech.modules.protocol.service.PtlTaxSourceNewService;
|
|
|
import com.ydtech.modules.protocol.service.impl.TaxSourceServiceImpl;
|
|
|
@@ -81,6 +87,12 @@ public class QuoteVerificationAspect {
|
|
|
|
|
|
private final PtlTaxSourceNewService ptlTaxSourceNewService;
|
|
|
|
|
|
+
|
|
|
+ private final ITaxSourceExcludeService taxSourceExcludeService;
|
|
|
+
|
|
|
+
|
|
|
+ private final PtlTaxSourceNewMapper ptlTaxSourceNewMapper;
|
|
|
+
|
|
|
@AfterReturning(pointcut = "@annotation(com.ydtech.modules.order.aop.QuoteVerification)", returning = "result")
|
|
|
public void doAfter(HttpResult<QuoteRespVo> result) {
|
|
|
//计算费用因子
|
|
|
@@ -160,13 +172,37 @@ public class QuoteVerificationAspect {
|
|
|
}
|
|
|
**/
|
|
|
String isTaxSource = ((BaseQuoteVo<?>) arg).getIsTaxSource();
|
|
|
- //默认协议走逻辑判断
|
|
|
- if(StringUtils.isNotBlank(isTaxSource) && "1".equals(isTaxSource)){
|
|
|
+ boolean isExclude = true;
|
|
|
+ //排除的部门信息
|
|
|
+ List<TaxSourceExcludeDto> excludeDepts =
|
|
|
+ taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getExcludeInfo, deptId).eq(TaxSourceExcludeDto::getInsCompanyId, companyId).eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
|
|
|
+ //部门排除
|
|
|
+ String finalDeptId = deptId;
|
|
|
+ if (excludeDepts.stream().anyMatch(taxSourceDto -> taxSourceDto.getExcludeInfo().equals(finalDeptId))) {
|
|
|
+ isExclude = false;
|
|
|
+ }
|
|
|
+ //默认协议走逻辑判断 且不在排除部门中走默认判断逻辑
|
|
|
+ if(StringUtils.isNotBlank(isTaxSource) && "1".equals(isTaxSource) && isExclude){
|
|
|
String taxAgreementId = ptlTaxSourceNewService.getAgreementId(deptId, userId, companyId, quoteInfo,insuranceRisk.getCode(),orderno);
|
|
|
((BaseQuoteVo<?>) arg).setAgreementId(taxAgreementId);
|
|
|
log.info("======================订单号"+orderno+"走默认协议判断逻辑!匹配协议为:"+taxAgreementId+"=======================");
|
|
|
- // throw new SystemException("订单号"+orderno+"走默认协议判断逻辑!匹配协议为:"+taxAgreementId);
|
|
|
- }
|
|
|
+ //throw new SystemException("订单号"+orderno+"走默认协议判断逻辑!匹配协议为:"+taxAgreementId);
|
|
|
+ }else{
|
|
|
+ //不在排除部门内进行默认判断
|
|
|
+ if(isExclude){
|
|
|
+ //走正常协议判断是错误的 判断是否有默认配置,如果有不可能进来,前台报错
|
|
|
+ List<PtlTaxSourceNew> taxSourceDtoList = ptlTaxSourceNewMapper.selectList(new LambdaQueryWrapper<PtlTaxSourceNew>()
|
|
|
+ .eq(PtlTaxSourceNew::getInsCompanyId, companyId)
|
|
|
+ .eq(PtlTaxSourceNew::getDefaultFlag,"1"));
|
|
|
+ if(taxSourceDtoList!=null && taxSourceDtoList.size()>0){
|
|
|
+ //throw new SystemException("配置默认协议且部门未排除应走默认逻辑,操作错误,请联系管理员!!");
|
|
|
+ //强制走默认状态
|
|
|
+ String taxAgreementId = ptlTaxSourceNewService.getAgreementId(deptId, userId, companyId, quoteInfo,insuranceRisk.getCode(),orderno);
|
|
|
+ ((BaseQuoteVo<?>) arg).setAgreementId(taxAgreementId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
//else{
|
|
|
// throw new SystemException("走正常协议逻辑!");
|
|
|
// }
|