|
|
@@ -0,0 +1,779 @@
|
|
|
+package com.ydtech.modules.protocol.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.ydtech.constants.enums.InsuranceRisk;
|
|
|
+import com.ydtech.exception.SystemException;
|
|
|
+import com.ydtech.modules.admin.model.dto.SysUserLinkPtlAgreementDto;
|
|
|
+import com.ydtech.modules.base.controller.BaseController;
|
|
|
+import com.ydtech.modules.ins.model.vo.KindInfoVo;
|
|
|
+import com.ydtech.modules.ins.model.vo.RiskInfoVo;
|
|
|
+import com.ydtech.modules.order.entity.BasePageResult;
|
|
|
+import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
|
|
|
+import com.ydtech.modules.protocol.constants.DispatchTypeConstants;
|
|
|
+import com.ydtech.modules.protocol.constants.TaxSourceStatusConstants;
|
|
|
+import com.ydtech.modules.protocol.dao.PtlTaxSourceNewMapper;
|
|
|
+import com.ydtech.modules.protocol.entity.dto.PtlTaxSourceNewDto;
|
|
|
+import com.ydtech.modules.protocol.entity.dto.TaxSourceExcludeDto;
|
|
|
+import com.ydtech.modules.protocol.entity.po.PtlAreaLicense;
|
|
|
+import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNew;
|
|
|
+import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNewHistory;
|
|
|
+import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNewRecord;
|
|
|
+import com.ydtech.modules.protocol.entity.vo.PtlTaxSourceNewAddDeptIdsVo;
|
|
|
+import com.ydtech.modules.protocol.entity.vo.PtlTaxSourceNewAddVo;
|
|
|
+import com.ydtech.modules.protocol.entity.vo.PtlTaxSourceNewSaveVo;
|
|
|
+import com.ydtech.modules.protocol.entity.vo.PtlTaxSourceNewVo;
|
|
|
+import com.ydtech.modules.protocol.service.*;
|
|
|
+import com.ydtech.modules.protocol.utils.RulesMergeStrUtils;
|
|
|
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttr;
|
|
|
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttrLink;
|
|
|
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesAttrLinkHistory;
|
|
|
+import com.ydtech.modules.protocols.entity.po.PtlAgreementDispatchRulesDictLabal;
|
|
|
+import com.ydtech.modules.protocols.service.PtlAgreementDispatchRulesAttrLinkHistoryService;
|
|
|
+import com.ydtech.modules.protocols.service.PtlAgreementDispatchRulesAttrLinkService;
|
|
|
+import com.ydtech.modules.protocols.service.PtlAgreementDispatchRulesAttrService;
|
|
|
+import com.ydtech.utils.idgen.IdGenerate;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import java.time.LocalDateTime;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+import static com.ydtech.modules.order.utils.InsuranceLog.logger;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class PtlTaxSourceServiceImpl extends ServiceImpl<PtlTaxSourceNewMapper, PtlTaxSourceNew> implements PtlTaxSourceNewService {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ITaxSourceExcludeService taxSourceExcludeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PtlTaxSourceNewMapper ptlTaxSourceNewMapper;
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PtlTaxSourceNewHistoryService ptlTaxSourceNewHistoryService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PtlAgreementDispatchRulesAttrService ptlAgreementDispatchRulesAttrService;
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PtlAgreementDispatchRulesAttrLinkService ptlAgreementDispatchRulesAttrLinkService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PtlAgreementDispatchRulesAttrLinkHistoryService ptlAgreementDispatchRulesAttrLinkHistoryService;
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PtlAreaLicenseService ptlAreaLicenseService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private PtlTaxSourceNewRecordService ptlTaxSourceNewRecordService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/5/22 15:44
|
|
|
+ * @Description: 协议调度分页
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public BasePageResult<PtlTaxSourceNewVo> queryPage(PtlTaxSourceNewDto ptlTaxSourceNewDto) {
|
|
|
+ Page<SysUserLinkPtlAgreementDto> page = new Page<>(ptlTaxSourceNewDto.getPageNum(),
|
|
|
+ ptlTaxSourceNewDto.getPageSize());
|
|
|
+ Page<PtlTaxSourceNewVo> ptlTaxSourceNewVoBasePageResult = ptlTaxSourceNewMapper.queryPage(page, ptlTaxSourceNewDto);
|
|
|
+ return new BasePageResult<>(ptlTaxSourceNewDto.getPageNum(), page.getSize(), ptlTaxSourceNewVoBasePageResult.getTotal(), page.getPages(),
|
|
|
+ ptlTaxSourceNewVoBasePageResult.getRecords());
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/5/22 15:44
|
|
|
+ * @Description: 协议调度保存或修改
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public void add(PtlTaxSourceNewAddVo ptlTaxSourceNewAddVo) {
|
|
|
+ //添加
|
|
|
+ // int count= ptlTaxSourceNewMapper.findListByParams(ptlTaxSourceNewAddVo);
|
|
|
+ // if(count>0){
|
|
|
+ // throw new SystemException("该协议已经存在,不允许再次添加!!");
|
|
|
+ // }
|
|
|
+ //查询定义的规则表
|
|
|
+ List<PtlAgreementDispatchRulesAttr> dispatchRulesAttrList = ptlAgreementDispatchRulesAttrService.getDispatchRulesAttrList();
|
|
|
+ List<PtlAgreementDispatchRulesAttrLink> attrLinks = ptlTaxSourceNewAddVo.getAttrLinks();
|
|
|
+ String content = RulesMergeStrUtils.getRulesMergeStr(attrLinks, dispatchRulesAttrList);
|
|
|
+ if(content==null || "".equals(content)){
|
|
|
+ throw new SystemException("规则列表未填写,请添加规则!!");
|
|
|
+ }
|
|
|
+ //判断有没有默认值
|
|
|
+ PtlTaxSourceNew ptlTaxSourceNewDefault= ptlTaxSourceNewMapper.findDefaultAttrLinkByInsCompanyId(ptlTaxSourceNewAddVo.getInsCompanyId());
|
|
|
+ //新增
|
|
|
+ PtlTaxSourceNew ptlTaxSourceNew=new PtlTaxSourceNew();
|
|
|
+ ptlTaxSourceNew =ptlTaxSourceNew.getNewEntity(ptlTaxSourceNewAddVo,ptlTaxSourceNew);
|
|
|
+ ptlTaxSourceNew.setDispatchContent(content);
|
|
|
+ ptlTaxSourceNew.setCreateTime(new Date());
|
|
|
+ ptlTaxSourceNew.setCreateUser(BaseController.getUser().getId());
|
|
|
+ if(ptlTaxSourceNewDefault==null){
|
|
|
+ if("0".equals(ptlTaxSourceNew.getDefaultFlag())){
|
|
|
+ //设置数据为默认
|
|
|
+ throw new SystemException("该保险公司不存在默认数据,请设置为默认");
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ //当前数据为默认的话,将之前的数据设置为非默认
|
|
|
+ if("1".equals(ptlTaxSourceNew.getDefaultFlag()) ){
|
|
|
+ //将旧数据设置数据为非默认
|
|
|
+ ptlTaxSourceNewDefault.setDefaultFlag("0");
|
|
|
+ ptlTaxSourceNewMapper.updateById(ptlTaxSourceNewDefault);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ptlTaxSourceNewMapper.insert(ptlTaxSourceNew);
|
|
|
+ //生成批次ID
|
|
|
+ String uuid = IdGenerate.nextId();
|
|
|
+ //插入规则表
|
|
|
+ List<PtlAgreementDispatchRulesAttrLink> allAttrLink = new ArrayList<>();
|
|
|
+ List<PtlAgreementDispatchRulesAttrLinkHistory> dispatchAttrLinkHistories = new ArrayList<>();
|
|
|
+ PtlTaxSourceNew finalPtlTaxSourceNew = ptlTaxSourceNew;
|
|
|
+ attrLinks.forEach(x -> {
|
|
|
+ PtlAgreementDispatchRulesAttrLinkHistory dispatchAttrLinkHistory = new PtlAgreementDispatchRulesAttrLinkHistory();
|
|
|
+ //处理中文逗号
|
|
|
+ if (x.getMin() != null && x.getMin().contains(",")) {
|
|
|
+ x.setMin(x.getMin().replace(",", ","));
|
|
|
+ }
|
|
|
+ PtlAgreementDispatchRulesAttrLink finalX = x;
|
|
|
+ PtlAgreementDispatchRulesAttr ptlAgreementDispatchRulesAttr = dispatchRulesAttrList.stream().filter(y -> y.getAttrCode().equals(finalX.getAttrCode())).findFirst().orElse(new PtlAgreementDispatchRulesAttr());
|
|
|
+
|
|
|
+ //单独处理车牌号
|
|
|
+ if ("LicenseNo".equals(x.getAttrCode()) && (x.getMin() != null && !x.getMin().equals(""))) {
|
|
|
+ x.setOperator("0");
|
|
|
+ x.setId("0");
|
|
|
+ x.setRulesId(finalPtlTaxSourceNew.getId()+"");
|
|
|
+ allAttrLink.add(x);
|
|
|
+ BeanUtils.copyProperties(x, dispatchAttrLinkHistory);
|
|
|
+ //设置产品费用因子历史记录
|
|
|
+ dispatchAttrLinkHistory.setId(null);
|
|
|
+ dispatchAttrLinkHistory.setBatch(uuid);
|
|
|
+ dispatchAttrLinkHistory.setOperatorType("add");
|
|
|
+ dispatchAttrLinkHistory.setModifier(BaseController.getUser().getId());
|
|
|
+ dispatchAttrLinkHistory.setOperatorTime(LocalDateTime.now());
|
|
|
+ dispatchAttrLinkHistories.add(dispatchAttrLinkHistory);
|
|
|
+ } else {
|
|
|
+
|
|
|
+ if (ptlAgreementDispatchRulesAttr.getAttrType().equals("radio")|| "checkbox".equals(ptlAgreementDispatchRulesAttr.getAttrType())) {
|
|
|
+ if ( null != x.getMin() && !"".equals(x.getMin())) {
|
|
|
+ x.setId("0");
|
|
|
+ x.setRulesId(finalPtlTaxSourceNew.getId()+"");
|
|
|
+ x=getAttrLink(x);
|
|
|
+ allAttrLink.add(x);
|
|
|
+ BeanUtils.copyProperties(x, dispatchAttrLinkHistory);
|
|
|
+ //设置产品费用因子历史记录
|
|
|
+ dispatchAttrLinkHistory.setId(null);
|
|
|
+ dispatchAttrLinkHistory.setBatch(uuid);
|
|
|
+
|
|
|
+ dispatchAttrLinkHistory.setOperatorType("add");
|
|
|
+ dispatchAttrLinkHistory.setModifier(BaseController.getUser().getId());
|
|
|
+ dispatchAttrLinkHistory.setOperatorTime(LocalDateTime.now());
|
|
|
+ dispatchAttrLinkHistory=getAttrLinkHistory(dispatchAttrLinkHistory);
|
|
|
+ dispatchAttrLinkHistories.add(dispatchAttrLinkHistory);
|
|
|
+ }
|
|
|
+ }else if( ( null != x.getMin() && !"0".equals(x.getMin()) && null != x.getOperator() && !"".equals(x.getOperator() )) || ( null != x.getMax() && !"0".equals(x.getMax()) && null != x.getOperator() && !"".equals(x.getOperator()) ) ) {
|
|
|
+ x.setId("0");
|
|
|
+ x.setRulesId(finalPtlTaxSourceNew.getId()+"");
|
|
|
+ x=getAttrLink(x);
|
|
|
+ allAttrLink.add(x);
|
|
|
+ BeanUtils.copyProperties(x, dispatchAttrLinkHistory);
|
|
|
+ //设置产品费用因子历史记录
|
|
|
+ dispatchAttrLinkHistory.setId(null);
|
|
|
+ dispatchAttrLinkHistory.setBatch(uuid);
|
|
|
+ dispatchAttrLinkHistory.setOperatorType("add");
|
|
|
+ dispatchAttrLinkHistory.setModifier(BaseController.getUser().getId());
|
|
|
+ dispatchAttrLinkHistory.setOperatorTime(LocalDateTime.now());
|
|
|
+ dispatchAttrLinkHistory=getAttrLinkHistory(dispatchAttrLinkHistory);
|
|
|
+ dispatchAttrLinkHistories.add(dispatchAttrLinkHistory);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //插入调度历史记录表
|
|
|
+ //历史记录表
|
|
|
+ PtlTaxSourceNewHistory ptlTaxSourceNewHistory=new PtlTaxSourceNewHistory();
|
|
|
+ BeanUtils.copyProperties(ptlTaxSourceNew, ptlTaxSourceNewHistory);
|
|
|
+ ptlTaxSourceNewHistory.setId(null);
|
|
|
+ ptlTaxSourceNewHistory.setBatchId(uuid);
|
|
|
+ ptlTaxSourceNewHistory.setBatchType("add");
|
|
|
+ ptlTaxSourceNewHistory.setModifier(BaseController.getUser().getId());
|
|
|
+ ptlTaxSourceNewHistory.setOperatorTime(LocalDateTime.now());
|
|
|
+ ptlTaxSourceNewHistory.setPtlTaxSourceNewId(ptlTaxSourceNew.getId());
|
|
|
+ //插入调度规则记录表
|
|
|
+ ptlTaxSourceNewHistoryService.save(ptlTaxSourceNewHistory);
|
|
|
+ //保存产品费用因子历史记录
|
|
|
+ ptlAgreementDispatchRulesAttrLinkHistoryService.saveBatch(dispatchAttrLinkHistories);
|
|
|
+ ptlAgreementDispatchRulesAttrLinkService.saveBatch(allAttrLink);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/5/29 10:37
|
|
|
+ * @Description: 获取前台的值防止回显错误
|
|
|
+ */
|
|
|
+ private PtlAgreementDispatchRulesAttrLink getAttrLink(PtlAgreementDispatchRulesAttrLink x) {
|
|
|
+ if ("1".equals(x.getOperator())) {
|
|
|
+ //不处理
|
|
|
+ //范围不处理
|
|
|
+ } else if ("2".equals(x.getOperator())) {
|
|
|
+ //将大于的值替换为null
|
|
|
+ x.setMax(null);
|
|
|
+ } else if ("3".equals(x.getOperator())) {
|
|
|
+ //将大于的值替换为null
|
|
|
+ x.setMax(null);
|
|
|
+ } else if ("4".equals(x.getOperator())) {
|
|
|
+ //将小于的值替换为null
|
|
|
+ x.setMin(null);
|
|
|
+ } else if ("5".equals(x.getOperator())) {
|
|
|
+ //将小于的值替换为null
|
|
|
+ x.setMin(null);
|
|
|
+ }
|
|
|
+ return x;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/5/29 10:37
|
|
|
+ * @Description: 获取前台的值防止回显错误
|
|
|
+ */
|
|
|
+ private PtlAgreementDispatchRulesAttrLinkHistory getAttrLinkHistory(PtlAgreementDispatchRulesAttrLinkHistory x) {
|
|
|
+ if ("1".equals(x.getOperator())) {
|
|
|
+ //不处理
|
|
|
+ //范围不处理
|
|
|
+ } else if ("2".equals(x.getOperator())) {
|
|
|
+ //将大于的值替换为null
|
|
|
+ x.setMax(null);
|
|
|
+ } else if ("3".equals(x.getOperator())) {
|
|
|
+ //将大于的值替换为null
|
|
|
+ x.setMax(null);
|
|
|
+ } else if ("4".equals(x.getOperator())) {
|
|
|
+ //将小于的值替换为null
|
|
|
+ x.setMin(null);
|
|
|
+ } else if ("5".equals(x.getOperator())) {
|
|
|
+ //将小于的值替换为null
|
|
|
+ x.setMin(null);
|
|
|
+ }
|
|
|
+ return x;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public void update(PtlTaxSourceNewAddVo ptlTaxSourceNewAddVo) {
|
|
|
+ // int count= ptlTaxSourceNewMapper.findListByParams(ptlTaxSourceNewAddVo);
|
|
|
+ // if(count>0){
|
|
|
+ // throw new SystemException("该协议已经存在,不允许再次添加!!");
|
|
|
+ // }
|
|
|
+ //查询定义的规则表
|
|
|
+ List<PtlAgreementDispatchRulesAttr> dispatchRulesAttrList = ptlAgreementDispatchRulesAttrService.getDispatchRulesAttrList();
|
|
|
+ List<PtlAgreementDispatchRulesAttrLink> attrLinks = ptlTaxSourceNewAddVo.getAttrLinks();
|
|
|
+ String content = RulesMergeStrUtils.getRulesMergeStr(attrLinks, dispatchRulesAttrList);
|
|
|
+ if(content==null || "".equals(content)){
|
|
|
+ throw new SystemException("规则列表未填写,请添加规则!!");
|
|
|
+ }
|
|
|
+
|
|
|
+ PtlTaxSourceNew ptlTaxSourceNewDefault= ptlTaxSourceNewMapper.findDefaultAttrLinkByInsCompanyId(ptlTaxSourceNewAddVo.getInsCompanyId());
|
|
|
+ //修改
|
|
|
+ PtlTaxSourceNew ptlTaxSourceNew = ptlTaxSourceNewMapper.selectById(ptlTaxSourceNewAddVo.getId());
|
|
|
+ ptlTaxSourceNew =ptlTaxSourceNew.getNewEntity(ptlTaxSourceNewAddVo,ptlTaxSourceNew);
|
|
|
+ if(ptlTaxSourceNewDefault!=null){
|
|
|
+ //当前数据为默认的话,将之前的数据设置为非默认
|
|
|
+ if("1".equals(ptlTaxSourceNew.getDefaultFlag()) ){
|
|
|
+ //将旧数据设置数据为非默认
|
|
|
+ ptlTaxSourceNewDefault.setDefaultFlag("0");
|
|
|
+ ptlTaxSourceNewMapper.updateById(ptlTaxSourceNewDefault);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ptlTaxSourceNew.setDispatchContent(content);
|
|
|
+ ptlTaxSourceNew.setUpdateTime(new Date());
|
|
|
+ ptlTaxSourceNew.setUpdateUser(BaseController.getUser().getId());
|
|
|
+ ptlTaxSourceNewMapper.updateById(ptlTaxSourceNew);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //先删除调度规则表信息
|
|
|
+ ptlAgreementDispatchRulesAttrLinkService.remove(new LambdaQueryWrapper<PtlAgreementDispatchRulesAttrLink>()
|
|
|
+ .eq(PtlAgreementDispatchRulesAttrLink::getRulesId, ptlTaxSourceNew.getId()));
|
|
|
+ //插入规则表
|
|
|
+ List<PtlAgreementDispatchRulesAttrLink> allAttrLink = new ArrayList<>();
|
|
|
+ List<PtlAgreementDispatchRulesAttrLinkHistory> dispatchAttrLinkHistories = new ArrayList<>();
|
|
|
+ PtlTaxSourceNew finalPtlTaxSourceNew = ptlTaxSourceNew;
|
|
|
+ //生成批次ID
|
|
|
+ String uuid = IdGenerate.nextId();
|
|
|
+ attrLinks.forEach(x -> {
|
|
|
+ //转换数组
|
|
|
+ if(x.getMinArray() != null && x.getMinArray().length > 0){
|
|
|
+ x.setMin(String.join(",",x.getMinArray()));
|
|
|
+ }
|
|
|
+ //处理中文逗号
|
|
|
+ if(x.getMin() != null && x.getMin().contains(",")) {
|
|
|
+ x.setMin(x.getMin().replace(",",","));
|
|
|
+ }
|
|
|
+ //单独处理车牌号
|
|
|
+ if ("LicenseNo".equals(x.getAttrCode()) && (x.getMin() != null && x.getMin() != "")) {
|
|
|
+ x.setRulesId(finalPtlTaxSourceNew.getId()+"");
|
|
|
+ x.setId("0");
|
|
|
+ allAttrLink.add(x);
|
|
|
+ //设置产品费用因子历史记录
|
|
|
+ PtlAgreementDispatchRulesAttrLinkHistory dispatchAttrLinkHistory = new PtlAgreementDispatchRulesAttrLinkHistory();
|
|
|
+ BeanUtils.copyProperties(x, dispatchAttrLinkHistory);
|
|
|
+ dispatchAttrLinkHistory.setId(null);
|
|
|
+ dispatchAttrLinkHistory.setBatch(uuid);
|
|
|
+ dispatchAttrLinkHistory.setOperatorType("update");
|
|
|
+ dispatchAttrLinkHistory.setModifier(BaseController.getUser().getId());
|
|
|
+ dispatchAttrLinkHistory.setOperatorTime(LocalDateTime.now());
|
|
|
+ dispatchAttrLinkHistories.add(dispatchAttrLinkHistory);
|
|
|
+ } else {
|
|
|
+ PtlAgreementDispatchRulesAttrLink finalX = x;
|
|
|
+ PtlAgreementDispatchRulesAttr ptlAgreementDispatchRulesAttr = dispatchRulesAttrList.stream().filter(y -> y.getAttrCode().equals(finalX.getAttrCode())).findFirst().orElse(new PtlAgreementDispatchRulesAttr());
|
|
|
+ //单独判断radio radio中存在0的属性值
|
|
|
+ if ("radio".equals(ptlAgreementDispatchRulesAttr.getAttrType()) || "checkbox".equals(ptlAgreementDispatchRulesAttr.getAttrType())) {
|
|
|
+ if (null != x.getMin() && !"".equals(x.getMin())) {
|
|
|
+ x.setRulesId(finalPtlTaxSourceNew.getId()+"");
|
|
|
+ x.setId("0");
|
|
|
+ x=getAttrLink(x);
|
|
|
+ allAttrLink.add(x);
|
|
|
+ //设置产品费用因子历史记录
|
|
|
+ PtlAgreementDispatchRulesAttrLinkHistory dispatchAttrLinkHistory = new PtlAgreementDispatchRulesAttrLinkHistory();
|
|
|
+ BeanUtils.copyProperties(x, dispatchAttrLinkHistory);
|
|
|
+ dispatchAttrLinkHistory.setId(null);
|
|
|
+ dispatchAttrLinkHistory.setBatch(uuid);
|
|
|
+ dispatchAttrLinkHistory.setOperatorType("update");
|
|
|
+ dispatchAttrLinkHistory.setModifier(BaseController.getUser().getId());
|
|
|
+ dispatchAttrLinkHistory.setOperatorTime(LocalDateTime.now());
|
|
|
+ dispatchAttrLinkHistory=getAttrLinkHistory(dispatchAttrLinkHistory);
|
|
|
+ dispatchAttrLinkHistories.add(dispatchAttrLinkHistory);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if ( ( null != x.getMin() && !"0".equals(x.getMin()) && null != x.getOperator() && !"".equals(x.getOperator() )) || ( null != x.getMax() && !"0".equals(x.getMax()) && null != x.getOperator() && !"".equals(x.getOperator()) ) ) {
|
|
|
+ x.setRulesId(finalPtlTaxSourceNew.getId()+"");
|
|
|
+ x.setId("0");
|
|
|
+ x=getAttrLink(x);
|
|
|
+ allAttrLink.add(x);
|
|
|
+ //设置产品费用因子历史记录
|
|
|
+ PtlAgreementDispatchRulesAttrLinkHistory dispatchAttrLinkHistory = new PtlAgreementDispatchRulesAttrLinkHistory();
|
|
|
+ BeanUtils.copyProperties(x, dispatchAttrLinkHistory);
|
|
|
+ dispatchAttrLinkHistory.setId(null);
|
|
|
+ dispatchAttrLinkHistory.setBatch(uuid);
|
|
|
+ dispatchAttrLinkHistory.setOperatorType("update");
|
|
|
+ dispatchAttrLinkHistory.setModifier(BaseController.getUser().getId());
|
|
|
+ dispatchAttrLinkHistory.setOperatorTime(LocalDateTime.now());
|
|
|
+ dispatchAttrLinkHistory=getAttrLinkHistory(dispatchAttrLinkHistory);
|
|
|
+ dispatchAttrLinkHistories.add(dispatchAttrLinkHistory);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //插入调度历史记录表
|
|
|
+ //历史记录表
|
|
|
+ PtlTaxSourceNewHistory ptlTaxSourceNewHistory=new PtlTaxSourceNewHistory();
|
|
|
+ BeanUtils.copyProperties(ptlTaxSourceNew, ptlTaxSourceNewHistory);
|
|
|
+ ptlTaxSourceNewHistory.setId(null);
|
|
|
+ ptlTaxSourceNewHistory.setBatchId(uuid);
|
|
|
+ ptlTaxSourceNewHistory.setBatchType("update");
|
|
|
+ ptlTaxSourceNewHistory.setModifier(BaseController.getUser().getId());
|
|
|
+ ptlTaxSourceNewHistory.setOperatorTime(LocalDateTime.now());
|
|
|
+ ptlTaxSourceNewHistory.setPtlTaxSourceNewId(ptlTaxSourceNew.getId());
|
|
|
+ //插入调度规则记录表
|
|
|
+ ptlTaxSourceNewHistoryService.save(ptlTaxSourceNewHistory);
|
|
|
+ //保存产品费用因子历史记录
|
|
|
+ ptlAgreementDispatchRulesAttrLinkHistoryService.saveBatch(dispatchAttrLinkHistories);
|
|
|
+ ptlAgreementDispatchRulesAttrLinkService.saveBatch(allAttrLink);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/5/22 15:44
|
|
|
+ * @Description: 协议调度的删除
|
|
|
+ */
|
|
|
+ @Transactional
|
|
|
+ @Override
|
|
|
+ public void deleteByIds(List<Long> ids) {
|
|
|
+ //通过ids查询到数据执行
|
|
|
+ List<String> allLinkIds =new ArrayList<>();
|
|
|
+ List<PtlAgreementDispatchRulesAttrLinkHistory> dispatchAttrLinkHistories =new ArrayList<>();
|
|
|
+ List<PtlTaxSourceNewHistory> ptlTaxSourceNewHistorys =new ArrayList<>();
|
|
|
+ if(ids!=null && ids.size()>0){
|
|
|
+ //通过ids查询数据
|
|
|
+ List<PtlTaxSourceNew> list= ptlTaxSourceNewMapper.findListByIds(ids);
|
|
|
+ if(list!=null && list.size()>0){
|
|
|
+ for(PtlTaxSourceNew ptlTaxSourceNew :list){
|
|
|
+ String uuid = IdGenerate.nextId();
|
|
|
+ List<PtlAgreementDispatchRulesAttrLink> linkList = ptlAgreementDispatchRulesAttrLinkService.list(new LambdaQueryWrapper<PtlAgreementDispatchRulesAttrLink>()
|
|
|
+ .eq(PtlAgreementDispatchRulesAttrLink::getRulesId, ptlTaxSourceNew.getId()));
|
|
|
+ if(linkList!=null && linkList.size()>0) {
|
|
|
+ for (PtlAgreementDispatchRulesAttrLink ptlAgreementDispatchRulesAttrLink : linkList) {
|
|
|
+ //放入删除的规则表ids
|
|
|
+ allLinkIds.add(ptlAgreementDispatchRulesAttrLink.getId());
|
|
|
+ //添加规则历史表
|
|
|
+ PtlAgreementDispatchRulesAttrLinkHistory dispatchAttrLinkHistory = new PtlAgreementDispatchRulesAttrLinkHistory();
|
|
|
+ BeanUtils.copyProperties(ptlAgreementDispatchRulesAttrLink, dispatchAttrLinkHistory);
|
|
|
+ dispatchAttrLinkHistory.setId(null);
|
|
|
+ dispatchAttrLinkHistory.setBatch(uuid);
|
|
|
+ dispatchAttrLinkHistory.setOperatorType("delete");
|
|
|
+ dispatchAttrLinkHistory.setModifier(BaseController.getUser().getId());
|
|
|
+ dispatchAttrLinkHistory.setOperatorTime(LocalDateTime.now());
|
|
|
+ dispatchAttrLinkHistories.add(dispatchAttrLinkHistory);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //主表历史记录表
|
|
|
+ PtlTaxSourceNewHistory ptlTaxSourceNewHistory=new PtlTaxSourceNewHistory();
|
|
|
+ BeanUtils.copyProperties(ptlTaxSourceNew, ptlTaxSourceNewHistory);
|
|
|
+ ptlTaxSourceNewHistory.setId(null);
|
|
|
+ ptlTaxSourceNewHistory.setBatchId(uuid);
|
|
|
+ ptlTaxSourceNewHistory.setBatchType("delete");
|
|
|
+ ptlTaxSourceNewHistory.setModifier(BaseController.getUser().getId());
|
|
|
+ ptlTaxSourceNewHistory.setOperatorTime(LocalDateTime.now());
|
|
|
+ ptlTaxSourceNewHistory.setPtlTaxSourceNewId(ptlTaxSourceNew.getId());
|
|
|
+ ptlTaxSourceNewHistorys.add(ptlTaxSourceNewHistory);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ //插入历史记录表
|
|
|
+ ptlTaxSourceNewHistoryService.saveBatch(ptlTaxSourceNewHistorys);
|
|
|
+ ptlAgreementDispatchRulesAttrLinkHistoryService.saveBatch(dispatchAttrLinkHistories);
|
|
|
+ //删除主表
|
|
|
+ ptlTaxSourceNewMapper.deleteBatchIds(ids);
|
|
|
+ //删除规则表
|
|
|
+ ptlAgreementDispatchRulesAttrLinkService.removeByIds(allLinkIds);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/5/22 15:37
|
|
|
+ * @Description: 保存排除部门信息
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public void saveDeptIds(PtlTaxSourceNewAddDeptIdsVo taxSourceVo) {
|
|
|
+ //删除排除的信息
|
|
|
+ taxSourceExcludeService.remove(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getInsCompanyId, taxSourceVo.getInsCompanyId()));
|
|
|
+ List<TaxSourceExcludeDto> excludeDtos = new ArrayList<>();
|
|
|
+ //组装排除的部门信息
|
|
|
+ if(taxSourceVo.getAgreementTaxExcludeDeptList()!=null && taxSourceVo.getAgreementTaxExcludeDeptList().size()>0){
|
|
|
+ for (String agreementTaxExclude : taxSourceVo.getAgreementTaxExcludeDeptList()) {
|
|
|
+ TaxSourceExcludeDto dto = new TaxSourceExcludeDto();
|
|
|
+ dto.setType(Integer.parseInt(TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
|
|
|
+ dto.setInsCompanyId(taxSourceVo.getInsCompanyId());
|
|
|
+ dto.setExcludeInfo(agreementTaxExclude);
|
|
|
+ excludeDtos.add(dto);
|
|
|
+ }
|
|
|
+ taxSourceExcludeService.saveBatch(excludeDtos);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/5/22 15:57
|
|
|
+ * @Description: 通过保险公司id查询绑定的排除部门id
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<String> getDeptIdsByCompanyId(String companyId) {
|
|
|
+ //排除的部门信息
|
|
|
+ List<TaxSourceExcludeDto> taxSourceExcludeDepts =
|
|
|
+ taxSourceExcludeService.list(new LambdaQueryWrapper<TaxSourceExcludeDto>().eq(TaxSourceExcludeDto::getInsCompanyId, companyId).eq(TaxSourceExcludeDto::getType, TaxSourceStatusConstants.EXCLUDE_TYPE_DEPT));
|
|
|
+ //部门信息转换
|
|
|
+ List<String> agreementTaxExcludeDepts = new ArrayList<>();
|
|
|
+ taxSourceExcludeDepts.forEach(item -> {
|
|
|
+ agreementTaxExcludeDepts.add(item.getExcludeInfo());
|
|
|
+ });
|
|
|
+ PtlTaxSourceNewAddDeptIdsVo vo=new PtlTaxSourceNewAddDeptIdsVo();
|
|
|
+ vo.setAgreementTaxExcludeDeptList(agreementTaxExcludeDepts);
|
|
|
+ return agreementTaxExcludeDepts;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据税源获取协议id
|
|
|
+ * @param deptId
|
|
|
+ * @param userId
|
|
|
+ * @param companyId
|
|
|
+ * @param quoteInfo 报价信息
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public String getAgreementId(String deptId, String userId, String companyId, BaseQuoteInfoVo quoteInfo, String riskCode,String orderno) {
|
|
|
+ List<PtlAgreementDispatchRulesAttr> dispatchRulesAttrList = ptlAgreementDispatchRulesAttrService.getDispatchRulesAttrList();
|
|
|
+ String resultId = "";
|
|
|
+ //查找配置的默认项,匹配不到赋值默认的协议Id
|
|
|
+ List<PtlTaxSourceNew> taxSourceDtoList = baseMapper.selectList(new LambdaQueryWrapper<PtlTaxSourceNew>()
|
|
|
+ .eq(PtlTaxSourceNew::getInsCompanyId,companyId)
|
|
|
+ .eq(PtlTaxSourceNew::getDefaultFlag,"1"));
|
|
|
+ if(taxSourceDtoList.isEmpty()){
|
|
|
+ throw new SystemException("没有匹配到默认协议,请添加!");
|
|
|
+ }
|
|
|
+ //默认协议
|
|
|
+ String agreeId = taxSourceDtoList.get(0).getAgreementId();
|
|
|
+ logger.info("======================默认协议为:"+agreeId+"==================================");
|
|
|
+ //通过公司id按优先级排序获取协议规则
|
|
|
+ List<PtlTaxSourceNew> prioritySortList = baseMapper.selectList(new LambdaQueryWrapper<PtlTaxSourceNew>()
|
|
|
+ .eq(PtlTaxSourceNew::getInsCompanyId,companyId)
|
|
|
+ .orderByAsc(PtlTaxSourceNew::getPriority));
|
|
|
+ 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));
|
|
|
+
|
|
|
+ //部门排除
|
|
|
+ if (excludeDepts.stream().anyMatch(taxSourceDto -> taxSourceDto.getExcludeInfo().equals(deptId))) {
|
|
|
+ isExclude = false;
|
|
|
+ }
|
|
|
+ if(prioritySortList!=null && prioritySortList.size()>0){
|
|
|
+ int size = prioritySortList.size();
|
|
|
+ for (int i = 0; i < size; i++) {
|
|
|
+ //判断是否为空,如果不为空直接跳出
|
|
|
+ String checkAgreementId = getAgreementId(prioritySortList.get(i), quoteInfo, dispatchRulesAttrList, isExclude,orderno,userId);
|
|
|
+ if(!"".equals(checkAgreementId)){
|
|
|
+ resultId=checkAgreementId;
|
|
|
+ logger.info("匹配的协议为:"+resultId);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //如果没有匹配上协议,直接赋值默认协议
|
|
|
+ if("".equals(resultId)){
|
|
|
+ resultId= agreeId;
|
|
|
+ }
|
|
|
+ return resultId;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/5/28 14:27
|
|
|
+ * @Description: 通过规则判断是否匹配
|
|
|
+ */
|
|
|
+ public String getAgreementId(PtlTaxSourceNew ptlTaxSourceNew,BaseQuoteInfoVo quoteInfo, List<PtlAgreementDispatchRulesAttr> dispatchRulesAttrList,boolean isExclude,String orderno,String userId){
|
|
|
+ String quoteInfoErorMsg="";
|
|
|
+ String msg="";
|
|
|
+ String agreementId="";
|
|
|
+ //1.车牌号
|
|
|
+ String licenseNo = quoteInfo.getCarInfo().getLicenseNo();
|
|
|
+ //2 座位数
|
|
|
+ String seats = quoteInfo.getCarInfo().getSeatCount();
|
|
|
+ // 3.排量
|
|
|
+ String exhaustScale = quoteInfo.getCarInfo().getEnginedesc();
|
|
|
+ // 4.车辆大类
|
|
|
+ String cimodelclass = quoteInfo.getCarInfo().getCimodelclass();
|
|
|
+ //5.使用性质
|
|
|
+ String vehicleUse = quoteInfo.getCarInfo().getVehicleUse();
|
|
|
+ //code变为name
|
|
|
+ String cimodelclassVal = getPtlAgreementDispatchRulesAttr(dispatchRulesAttrList, DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_4.getCode(),cimodelclass);
|
|
|
+ String vehicleUseVal = getPtlAgreementDispatchRulesAttr(dispatchRulesAttrList, DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_5.getCode(),vehicleUse);
|
|
|
+
|
|
|
+ List<KindInfoVo> kinds = quoteInfo.getKindList();
|
|
|
+ List<RiskInfoVo> risks = quoteInfo.getRiskList();
|
|
|
+ //6.交强投保
|
|
|
+ String yqInsureFlag = !InsuranceRisk.getFlagByTRAFFIC(risks) ?"0":"1";
|
|
|
+ //7.车损投保
|
|
|
+ String cxInsureFlag = !InsuranceRisk.getFlagByA(kinds) ?"0":"1";
|
|
|
+ //8.第三者责任险
|
|
|
+ String thirdPartyLiabilityInsurance =InsuranceRisk.getStringByB(kinds);
|
|
|
+ //报价信息
|
|
|
+ msg = getString(msg, licenseNo,seats,exhaustScale,cimodelclassVal,vehicleUseVal,yqInsureFlag,cxInsureFlag,thirdPartyLiabilityInsurance);
|
|
|
+ //通过调度id查询调度规则是否包含车牌、排量
|
|
|
+ boolean isExcludeLicense = false;
|
|
|
+ boolean isExcludeSeats = false;
|
|
|
+ boolean isExcludeVolume= false;
|
|
|
+ boolean isExcludeCimodelclass= false;
|
|
|
+ boolean isExcludeVehicleUse= false;
|
|
|
+ boolean isExcludeYqInsureFlag= false;
|
|
|
+ boolean isExcludeCxInsureFlag= false;
|
|
|
+ boolean isExcludeThirdPartyLiabilityInsurance= false;
|
|
|
+ //通过默认公司id查询所有的协议按优先级排序
|
|
|
+ Long ptlTaxSourceNewId = ptlTaxSourceNew.getId();
|
|
|
+ List<PtlAgreementDispatchRulesAttrLink> list = ptlAgreementDispatchRulesAttrLinkService.list(new LambdaQueryWrapper<PtlAgreementDispatchRulesAttrLink>()
|
|
|
+ .eq(PtlAgreementDispatchRulesAttrLink::getRulesId, ptlTaxSourceNewId));
|
|
|
+ //为匹配信息拼接
|
|
|
+ if(list!=null && list.size()>0 ){
|
|
|
+ isExcludeLicense = judgeIsExcludeFlag(licenseNo, list, dispatchRulesAttrList,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_1.getCode());
|
|
|
+ if(!isExcludeLicense){
|
|
|
+ quoteInfoErorMsg+=DispatchTypeConstants.matchKey(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_1.getCode())+"的值为"+licenseNo+"未匹配"+"\n";
|
|
|
+ }
|
|
|
+ isExcludeSeats = judgeIsExcludeFlag(seats, list, dispatchRulesAttrList,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_2.getCode());
|
|
|
+ if(!isExcludeSeats){
|
|
|
+ quoteInfoErorMsg+=DispatchTypeConstants.matchKey(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_2.getCode())+"的值为"+seats+"未匹配"+"\n";
|
|
|
+ }
|
|
|
+ isExcludeVolume =judgeIsExcludeFlag(exhaustScale, list, dispatchRulesAttrList,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_3.getCode());
|
|
|
+ if(!isExcludeVolume){
|
|
|
+ quoteInfoErorMsg+=DispatchTypeConstants.matchKey(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_3.getCode())+"的值为"+exhaustScale+"未匹配"+"\n";
|
|
|
+ }
|
|
|
+ isExcludeCimodelclass = judgeIsExcludeFlag(cimodelclassVal, list, dispatchRulesAttrList,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_4.getCode());
|
|
|
+ if(!isExcludeCimodelclass){
|
|
|
+ quoteInfoErorMsg+=DispatchTypeConstants.matchKey(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_4.getCode())+"的值为"+cimodelclassVal+"未匹配"+"\n";
|
|
|
+ }
|
|
|
+ isExcludeVehicleUse = judgeIsExcludeFlag(vehicleUseVal, list, dispatchRulesAttrList,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_5.getCode());
|
|
|
+ if(!isExcludeVehicleUse){
|
|
|
+ quoteInfoErorMsg+=DispatchTypeConstants.matchKey(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_5.getCode())+"的值为"+vehicleUseVal+"未匹配"+"\n";
|
|
|
+ }
|
|
|
+ isExcludeYqInsureFlag = judgeIsExcludeFlag(yqInsureFlag, list, dispatchRulesAttrList,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_6.getCode());
|
|
|
+ if(!isExcludeYqInsureFlag){
|
|
|
+ quoteInfoErorMsg+=DispatchTypeConstants.matchKey(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_6.getCode())+"的值为"+("1".equals(yqInsureFlag)?"是":"否")+"未匹配"+"\n";
|
|
|
+ }
|
|
|
+ isExcludeCxInsureFlag = judgeIsExcludeFlag(cxInsureFlag, list, dispatchRulesAttrList,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_7.getCode());
|
|
|
+ if(!isExcludeCxInsureFlag){
|
|
|
+ quoteInfoErorMsg+=DispatchTypeConstants.matchKey(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_7.getCode())+"的值为"+("1".equals(cxInsureFlag)?"是":"否")+"未匹配"+"\n";
|
|
|
+ }
|
|
|
+ isExcludeThirdPartyLiabilityInsurance = judgeIsExcludeFlag(thirdPartyLiabilityInsurance, list, dispatchRulesAttrList,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_8.getCode());
|
|
|
+ if(!isExcludeThirdPartyLiabilityInsurance){
|
|
|
+ quoteInfoErorMsg+= DispatchTypeConstants.matchKey(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_8.getCode())+"的值为"+(thirdPartyLiabilityInsurance==null?"不投保":thirdPartyLiabilityInsurance)+"未匹配"+"\n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ logger.info("==============================="+ptlTaxSourceNew.getAgreementId()+"协议调度规则对象为:"+ptlTaxSourceNew.toString()+"=====================================");
|
|
|
+ logger.info("==============================="+ptlTaxSourceNew.getAgreementId()+"协议调度规则内容为:"+ptlTaxSourceNew.getDispatchContent()+"===============================");
|
|
|
+ logger.info("==============================="+ptlTaxSourceNew.getAgreementId()+"报价参数信息为:"+msg+"===============================");
|
|
|
+ logger.info("==============================="+ptlTaxSourceNew.getAgreementId()+"未匹配信息为:"+quoteInfoErorMsg+"===============================");
|
|
|
+ if (isExclude && isExcludeLicense && isExcludeSeats && isExcludeVolume && isExcludeCimodelclass && isExcludeVehicleUse && isExcludeYqInsureFlag && isExcludeCxInsureFlag && isExcludeThirdPartyLiabilityInsurance ) {
|
|
|
+ agreementId = ptlTaxSourceNew.getAgreementId();
|
|
|
+ }
|
|
|
+ PtlTaxSourceNewRecord ptlTaxSourceNewRecord=new PtlTaxSourceNewRecord(orderno, ptlTaxSourceNew.toString(), ptlTaxSourceNew.getDispatchContent(), msg, quoteInfoErorMsg,new Date(), userId);
|
|
|
+ ptlTaxSourceNewRecordService.save(ptlTaxSourceNewRecord);
|
|
|
+ return agreementId;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/5/28 11:51
|
|
|
+ * @Description: 根据code获取名称值
|
|
|
+ */
|
|
|
+ private static String getPtlAgreementDispatchRulesAttr(List<PtlAgreementDispatchRulesAttr> dispatchRulesAttrList, String code,String
|
|
|
+ val) {
|
|
|
+ String val_new="";
|
|
|
+ PtlAgreementDispatchRulesAttr ptlAgreementDispatchRulesAttr = dispatchRulesAttrList.stream().filter(y -> y.getAttrCode().equals(code)).findFirst().orElse(new PtlAgreementDispatchRulesAttr());
|
|
|
+ List<PtlAgreementDispatchRulesDictLabal> dictLabal = ptlAgreementDispatchRulesAttr.getDictLabal();
|
|
|
+ if(dictLabal!=null && dictLabal.size()>0){
|
|
|
+ for(PtlAgreementDispatchRulesDictLabal ptlAgreementDispatchRulesDictLabal: dictLabal){
|
|
|
+ if(val.equals(ptlAgreementDispatchRulesDictLabal.getCode())){
|
|
|
+ val_new=ptlAgreementDispatchRulesDictLabal.getName();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ptlAgreementDispatchRulesAttr.getDictLabal()==null?"":val_new;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/5/28 9:12
|
|
|
+ * @Description: 前台信息拼接
|
|
|
+ */
|
|
|
+ private static String getString(String allMag, String val1,String val2,String val3,String val4,String val5,String val6,String val7,String val8) {
|
|
|
+ String msg="";
|
|
|
+ allMag += getAllString(msg, val1,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_1.getCode());
|
|
|
+ allMag +=getAllString(msg, val2,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_2.getCode());
|
|
|
+ allMag +=getAllString(msg, val3,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_3.getCode());
|
|
|
+ allMag +=getAllString(msg, val4,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_4.getCode());
|
|
|
+ allMag +=getAllString(msg, val5,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_5.getCode());
|
|
|
+ allMag +=getAllString(msg, "1".equals(val6)?"是":"否",DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_6.getCode());
|
|
|
+ allMag +=getAllString(msg, "1".equals(val7)?"是":"否",DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_7.getCode());
|
|
|
+ allMag +=getAllString(msg, val8,DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_8.getCode());
|
|
|
+ return allMag;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/5/28 9:08
|
|
|
+ * @Description: 信息拼接
|
|
|
+ */
|
|
|
+ private static String getAllString(String msg, String val,String code) {
|
|
|
+ if(DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_8.getCode().equals(code)){
|
|
|
+ val= val==null?"不投保":val;
|
|
|
+ }else{
|
|
|
+ val= val==null?"空":val;
|
|
|
+ }
|
|
|
+ msg +=DispatchTypeConstants.matchKey(code)+"的值为" +val+"\n";
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/5/28 8:43
|
|
|
+ * @Description: 判断值是否和规则匹配
|
|
|
+ */
|
|
|
+ private static boolean judgeIsExcludeFlag(String val, List<PtlAgreementDispatchRulesAttrLink> list, List<PtlAgreementDispatchRulesAttr> dispatchRulesAttrList,String code) {
|
|
|
+ boolean isExcludeFlag;
|
|
|
+ if(StringUtils.isBlank(val)){
|
|
|
+ if(!DispatchTypeConstants.removalOfCode().contains(code)){
|
|
|
+ throw new SystemException(DispatchTypeConstants.matchKey(code)+"不能为空");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ isExcludeFlag = RulesMergeStrUtils.judgeVal(list, (DispatchTypeConstants.DISPATCH_TYPE_CONSTANTS_1.getCode().equals(code))?val.substring(0, 2):val, code, dispatchRulesAttrList);
|
|
|
+ return isExcludeFlag;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2024/5/24 18:06
|
|
|
+ * @Description: 通过id查询对象
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public PtlTaxSourceNewSaveVo rulesGet(Long id, List<PtlAgreementDispatchRulesAttr> dispatchRulesAttrList) {
|
|
|
+ //设置费用因子属性
|
|
|
+ List<PtlAgreementDispatchRulesAttr> ptlAgreementDispatchRulesAttrs = new ArrayList<>();
|
|
|
+ List<PtlAgreementDispatchRulesAttrLink> list = ptlAgreementDispatchRulesAttrLinkService.list(new LambdaQueryWrapper<PtlAgreementDispatchRulesAttrLink>()
|
|
|
+ .eq(PtlAgreementDispatchRulesAttrLink::getRulesId, id));
|
|
|
+
|
|
|
+ dispatchRulesAttrList.stream().forEach(x -> {
|
|
|
+ //处理多选和下拉
|
|
|
+ if ("checkbox".equals(x.getAttrType()) || "select".equals(x.getAttrType())) {
|
|
|
+ //处理车牌
|
|
|
+ if ("select".equals(x.getAttrType()) && "LicenseNo".equals(x.getAttrCode())) {
|
|
|
+ PtlAgreementDispatchRulesAttrLink licenseNo = list.stream().filter(l -> l.getAttrCode().equals("LicenseNo")).findFirst().orElse(new PtlAgreementDispatchRulesAttrLink());
|
|
|
+ if (licenseNo != null) {
|
|
|
+ //根据operator 获取车牌的地区id
|
|
|
+ List<PtlAreaLicense> byParentNumber = ptlAreaLicenseService.getByParentNumber("14");
|
|
|
+ //ptlAreaLicenseService.getByParentNumber()
|
|
|
+ List<PtlAgreementDispatchRulesDictLabal> dictLabal = byParentNumber.stream().map(y -> {
|
|
|
+ PtlAgreementDispatchRulesDictLabal ptlAgreementDispatchRulesDictLabal = new PtlAgreementDispatchRulesDictLabal();
|
|
|
+ ptlAgreementDispatchRulesDictLabal.setDictId(y.getId());
|
|
|
+ ptlAgreementDispatchRulesDictLabal.setCode(y.getAreaNumber());
|
|
|
+ ptlAgreementDispatchRulesDictLabal.setName(y.getLicense());
|
|
|
+ return ptlAgreementDispatchRulesDictLabal;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ x.setDictLabal(dictLabal);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ x.setMinArray(new String[]{});
|
|
|
+ list.stream().filter(y -> y.getAttrCode().equals(x.getAttrCode())).findFirst().ifPresent(z -> {
|
|
|
+ if (null != z.getMin()) {
|
|
|
+ x.setId(z.getId());
|
|
|
+ x.setMinArray(z.getMin().split(","));
|
|
|
+ x.setMax(z.getMax());
|
|
|
+ x.setOperator(z.getOperator());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ list.stream().filter(y -> y.getAttrCode().equals(x.getAttrCode())).findFirst().ifPresent(z -> {
|
|
|
+ x.setId(z.getId());
|
|
|
+ x.setMin(z.getMin());
|
|
|
+ x.setMax(z.getMax());
|
|
|
+ x.setOperator(z.getOperator());
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ ptlAgreementDispatchRulesAttrs.add(x);
|
|
|
+ });
|
|
|
+ PtlTaxSourceNew ptlTaxSourceNew = this.getById(id);
|
|
|
+ PtlTaxSourceNewSaveVo ptlTaxSourceNewSaveVo =new PtlTaxSourceNewSaveVo(ptlTaxSourceNew);
|
|
|
+ ptlTaxSourceNewSaveVo.setAttrLinks(ptlAgreementDispatchRulesAttrs);
|
|
|
+
|
|
|
+ return ptlTaxSourceNewSaveVo;
|
|
|
+ }
|
|
|
+}
|