|
|
@@ -22,7 +22,6 @@ import com.ydtech.modules.ins.model.vo.KindInfoVo;
|
|
|
import com.ydtech.modules.ins.model.vo.QuoteRespVo;
|
|
|
import com.ydtech.modules.ins.model.vo.RiskInfoVo;
|
|
|
import com.ydtech.modules.order.components.InsOrdersComponents;
|
|
|
-import com.ydtech.modules.order.constants.QuoteNumberConstant;
|
|
|
import com.ydtech.modules.order.entity.InsAreaCompany;
|
|
|
import com.ydtech.modules.order.entity.InsAreaCompanyAccidentalDriving;
|
|
|
import com.ydtech.modules.order.entity.InsOrders;
|
|
|
@@ -104,7 +103,7 @@ public class QuoteVerificationAspect {
|
|
|
|
|
|
private final FeeDisplayService feeDisplayService;
|
|
|
|
|
|
- private final SysSwitchConfigService sysSwitchConfigService;
|
|
|
+ private final SysSwitchConfigService sysSwitchConfigService;
|
|
|
|
|
|
private final StringRedisTemplate redisTemplate;
|
|
|
|
|
|
@@ -121,6 +120,15 @@ public class QuoteVerificationAspect {
|
|
|
insAreaCompanyAccidentalDrivingService.getByCompanyId(insAreaCompany.getId());
|
|
|
insAreaCompany.setAccidentalDriving(insAreaCompanyAccidentalDriving);
|
|
|
InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
|
|
|
+ // 更新数据
|
|
|
+ if (StringUtils.isNotEmpty(insAreaCompany.getLeaderId())) {
|
|
|
+ SysUser sysUser = sysUserService.getById(insOrders.getUserid());
|
|
|
+ if (StringUtils.isNotEmpty(sysUser.getLeaderId())) {
|
|
|
+ insAreaCompany.setLeaderId(sysUser.getLeaderId());
|
|
|
+ insAreaCompany.setLeaderName(sysUser.getLeaderName());
|
|
|
+ insAreaCompanyService.updateById(insAreaCompany);
|
|
|
+ }
|
|
|
+ }
|
|
|
StringBuilder logs = new StringBuilder();
|
|
|
//再进行费用因子判断
|
|
|
try {
|
|
|
@@ -131,7 +139,7 @@ public class QuoteVerificationAspect {
|
|
|
//add by hxl 添加出单员不能查看优惠的限制 2024-07-11
|
|
|
String userId = BaseController.getUserId();
|
|
|
SysUserRole sysUserRole = sysUserRoleService.selectByUserId(userId);
|
|
|
- if(sysUserRole!=null && sysUserRole.getRoleId()!=19){
|
|
|
+ if (sysUserRole != null && sysUserRole.getRoleId() != 19) {
|
|
|
//出口
|
|
|
SubOrderExportFeeVo subOrderExportFeeVo = costsCalcService.getExportFee(insFeeOrderNew);
|
|
|
result.getData().setJqExportFee(subOrderExportFeeVo.getJqExportCosts());
|
|
|
@@ -146,9 +154,9 @@ public class QuoteVerificationAspect {
|
|
|
feeDisplayService.setQuote(result.getData());
|
|
|
}
|
|
|
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
//将匹配失败的费用日志存储
|
|
|
- insAreaCompanyService.updateFeeMatchErrMsg(result.getData().getCompanyId(),logs.toString());
|
|
|
+ insAreaCompanyService.updateFeeMatchErrMsg(result.getData().getCompanyId(), logs.toString());
|
|
|
|
|
|
//输出费用匹配失败日志
|
|
|
result.getData().setFeeNoDescription(logs.toString());
|
|
|
@@ -177,26 +185,30 @@ public class QuoteVerificationAspect {
|
|
|
//获取用户在保险公司的报价次数
|
|
|
boolean checkQuoteLimitation = sysQuoteConfigService.checkQuoteLimitation(insOrders.getUserid(), companyId, insOrders.getLicenseno());
|
|
|
BigDecimal quoteRatio = sysQuoteRedisService.getQuoteRatio(companyId, insOrders.getUserid());
|
|
|
- if(Objects.isNull(quoteRatio)){
|
|
|
+ if (Objects.isNull(quoteRatio)) {
|
|
|
quoteRatio = new BigDecimal(BigInteger.ZERO);
|
|
|
}
|
|
|
- if(checkQuoteLimitation){
|
|
|
+ if (checkQuoteLimitation) {
|
|
|
Integer maxQuoteNum = sysQuoteRedisService.getMaxQuoteNum(companyId, insOrders.getUserid(), insOrders.getLicenseno());
|
|
|
System.out.printf("返回可报价次数:" + maxQuoteNum.toString());
|
|
|
//设置最大报价次数
|
|
|
((BaseQuoteVo<?>) arg).setMaxQuoteNum(maxQuoteNum);
|
|
|
((BaseQuoteVo<?>) arg).setQuoteRatio(quoteRatio);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
//如果次数为0 则 获取出单比
|
|
|
QuoteNumRedisVo quoteNumberRedisData = sysQuoteRedisService.getQuoteNumberRedisData(insOrders.getUserid());
|
|
|
- QuoteNumRedisVo.QuoteNumberCompanyVo quoteNumberCompanyVo = quoteNumberRedisData.getOriginalCompanyList().stream().filter(item -> item.getCompanyId().equals(companyId)).findFirst().orElse(null);
|
|
|
- if(!Objects.isNull(quoteNumberCompanyVo) && (quoteRatio.equals(BigDecimal.ZERO) || quoteNumberCompanyVo.getOrderRatio().compareTo(quoteRatio) < 0))
|
|
|
- {
|
|
|
+ QuoteNumRedisVo.QuoteNumberCompanyVo quoteNumberCompanyVo = quoteNumberRedisData.getOriginalCompanyList()
|
|
|
+ .stream()
|
|
|
+ .filter(item -> item.getCompanyId().equals(companyId))
|
|
|
+ .findFirst()
|
|
|
+ .orElse(null);
|
|
|
+ if (!Objects.isNull(quoteNumberCompanyVo) && (quoteRatio.equals(BigDecimal.ZERO) || quoteNumberCompanyVo.getOrderRatio()
|
|
|
+ .compareTo(quoteRatio) < 0)) {
|
|
|
System.out.printf("报价比例成功:");
|
|
|
//还可以报价 设置最大报价次数为5 报价比例为100%
|
|
|
((BaseQuoteVo<?>) arg).setMaxQuoteNum(5);
|
|
|
((BaseQuoteVo<?>) arg).setQuoteRatio(new BigDecimal(100));
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
throw new SystemException("报价次数限制!");
|
|
|
}
|
|
|
}
|
|
|
@@ -220,11 +232,12 @@ public class QuoteVerificationAspect {
|
|
|
}
|
|
|
**/
|
|
|
//添加外部订单的限制 add by hxl 2024-07-12
|
|
|
- List<InsAreaCompany> insAreaList = insAreaCompanyService.getBaseMapper().selectList(new LambdaQueryWrapper<InsAreaCompany>().eq(InsAreaCompany::getOrderno, orderno));
|
|
|
- if(insAreaList!=null && !insAreaList.isEmpty()){
|
|
|
- for(InsAreaCompany subOrder : insAreaList){
|
|
|
+ List<InsAreaCompany> insAreaList = insAreaCompanyService.getBaseMapper()
|
|
|
+ .selectList(new LambdaQueryWrapper<InsAreaCompany>().eq(InsAreaCompany::getOrderno, orderno));
|
|
|
+ if (insAreaList != null && !insAreaList.isEmpty()) {
|
|
|
+ for (InsAreaCompany subOrder : insAreaList) {
|
|
|
PtlAgreement ptlAgreement = ptlAgreementService.getById(subOrder.getAgreementId());
|
|
|
- if(ptlAgreement!=null && ptlAgreement.getIsExternal()!=null && ptlAgreement.getIsExternal()==1){
|
|
|
+ if (ptlAgreement != null && ptlAgreement.getIsExternal() != null && ptlAgreement.getIsExternal() == 1) {
|
|
|
// throw new SystemException("外部订单不允许报价,请到外部订单编辑页面进行编辑!!");
|
|
|
}
|
|
|
}
|
|
|
@@ -233,7 +246,7 @@ public class QuoteVerificationAspect {
|
|
|
BaseQuoteInfoVo quoteInfo = insOrdersComponents.getQuoteInfo(orderno, ((BaseQuoteVo<?>) arg).getKinds());
|
|
|
//add by hxl 2024-06-12 改为从主订单表中获取数据用户id和部门id
|
|
|
SysUser user = sysUserService.getById(quoteInfo.getUserid());
|
|
|
- String userId=quoteInfo.getUserid();
|
|
|
+ String userId = quoteInfo.getUserid();
|
|
|
String deptId = user.getDeptId();
|
|
|
List<KindInfoVo> kinds = Objects.isNull(quoteInfo.getKindList()) ? new ArrayList<>() : quoteInfo.getKindList();
|
|
|
List<RiskInfoVo> risks = quoteInfo.getRiskList();
|
|
|
@@ -263,22 +276,22 @@ public class QuoteVerificationAspect {
|
|
|
isExclude = false;
|
|
|
}
|
|
|
//默认协议走逻辑判断 且不在排除部门中走默认判断逻辑
|
|
|
- if(StringUtils.isNotBlank(isTaxSource) && "1".equals(isTaxSource) && isExclude){
|
|
|
- String taxAgreementId = ptlTaxSourceNewService.getAgreementId(deptId, userId, companyId, quoteInfo, insuranceRisk.getCode(),orderno);
|
|
|
+ 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+"=======================");
|
|
|
+ log.info("======================订单号" + orderno + "走默认协议判断逻辑!匹配协议为:" + taxAgreementId + "=======================");
|
|
|
//throw new SystemException("订单号"+orderno+"走默认协议判断逻辑!匹配协议为:"+taxAgreementId);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
//不在排除部门内进行默认判断
|
|
|
- if(isExclude){
|
|
|
+ if (isExclude) {
|
|
|
//走正常协议判断是错误的 判断是否有默认配置,如果有不可能进来,前台报错
|
|
|
List<PtlTaxSourceNew> taxSourceDtoList = ptlTaxSourceNewMapper.selectList(new LambdaQueryWrapper<PtlTaxSourceNew>()
|
|
|
.eq(PtlTaxSourceNew::getInsCompanyId, companyId)
|
|
|
- .eq(PtlTaxSourceNew::getDefaultFlag,"1"));
|
|
|
- if(taxSourceDtoList!=null && !taxSourceDtoList.isEmpty()){
|
|
|
+ .eq(PtlTaxSourceNew::getDefaultFlag, "1"));
|
|
|
+ if (taxSourceDtoList != null && !taxSourceDtoList.isEmpty()) {
|
|
|
//throw new SystemException("配置默认协议且部门未排除应走默认逻辑,操作错误,请联系管理员!!");
|
|
|
//强制走默认状态
|
|
|
- String taxAgreementId = ptlTaxSourceNewService.getAgreementId(deptId, userId, companyId, quoteInfo,insuranceRisk.getCode(),orderno);
|
|
|
+ String taxAgreementId = ptlTaxSourceNewService.getAgreementId(deptId, userId, companyId, quoteInfo, insuranceRisk.getCode(), orderno);
|
|
|
((BaseQuoteVo<?>) arg).setAgreementId(taxAgreementId);
|
|
|
}
|
|
|
}
|
|
|
@@ -288,9 +301,10 @@ public class QuoteVerificationAspect {
|
|
|
// throw new SystemException("走正常协议逻辑!");
|
|
|
// }
|
|
|
boolean flag = sysSwitchConfigService.xysqDisplaySwitches();
|
|
|
- if(!flag){
|
|
|
+ if (!flag) {
|
|
|
SysUserRole userRole = sysUserRoleService.selectByUserId(userId);
|
|
|
- if (Arrays.asList(SystemConstant.getSysRoleTeamLeader()).contains(userRole.getRoleId().toString())) { //团队长可查询下面所有人员订单
|
|
|
+ if (Arrays.asList(SystemConstant.getSysRoleTeamLeader())
|
|
|
+ .contains(userRole.getRoleId().toString())) { //团队长可查询下面所有人员订单
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
@@ -307,7 +321,7 @@ public class QuoteVerificationAspect {
|
|
|
* @Date: 2024/4/27 15:18
|
|
|
* @Description: 添加报价接口的报价失败状态的后置通知
|
|
|
*/
|
|
|
- @AfterReturning(value="@annotation(com.ydtech.modules.order.aop.QuoteVerification)", returning="response")
|
|
|
+ @AfterReturning(value = "@annotation(com.ydtech.modules.order.aop.QuoteVerification)", returning = "response")
|
|
|
public void after(JoinPoint point, HttpResult response) {
|
|
|
Object[] args = point.getArgs();
|
|
|
if (response.getCode() != 200) {
|
|
|
@@ -318,7 +332,7 @@ public class QuoteVerificationAspect {
|
|
|
String agreementId = ((BaseQuoteVo<?>) arg).getAgreementId();
|
|
|
String userId = ((BaseQuoteVo<?>) arg).getUserId();
|
|
|
String orderno = ((BaseQuoteVo<?>) arg).getOrderNo();
|
|
|
- insertInsAreaCompany(companyId, orderno, agreementId,response.getMsg(),userId);
|
|
|
+ insertInsAreaCompany(companyId, orderno, agreementId, response.getMsg(), userId);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -330,7 +344,7 @@ public class QuoteVerificationAspect {
|
|
|
* @Date: 2024/4/27 16:54
|
|
|
* @Description: 添加报价接口的报价失败状态的异常通知
|
|
|
*/
|
|
|
- @AfterThrowing(pointcut="@annotation(com.ydtech.modules.order.aop.QuoteVerification)", throwing="ex")
|
|
|
+ @AfterThrowing(pointcut = "@annotation(com.ydtech.modules.order.aop.QuoteVerification)", throwing = "ex")
|
|
|
public void handleException(JoinPoint point, Exception ex) {
|
|
|
// 处理异常的逻辑
|
|
|
Object[] args = point.getArgs();
|
|
|
@@ -341,12 +355,12 @@ public class QuoteVerificationAspect {
|
|
|
String agreementId = ((BaseQuoteVo<?>) arg).getAgreementId();
|
|
|
String userId = ((BaseQuoteVo<?>) arg).getUserId();
|
|
|
String orderno = ((BaseQuoteVo<?>) arg).getOrderNo();
|
|
|
- insertInsAreaCompany(companyId, orderno, agreementId,ex.getMessage(),userId);
|
|
|
+ insertInsAreaCompany(companyId, orderno, agreementId, ex.getMessage(), userId);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void insertInsAreaCompany(String companyId, String orderno, String agreementId,String msg,String userId) {
|
|
|
+ public void insertInsAreaCompany(String companyId, String orderno, String agreementId, String msg, String userId) {
|
|
|
EsmInsCompany esmInsCompany = esmInsCompanyService.getById(companyId);
|
|
|
// agreement
|
|
|
PtlAgreement agreement = ptlAgreementService.getById(agreementId);
|
|
|
@@ -359,13 +373,13 @@ public class QuoteVerificationAspect {
|
|
|
insAreaCompany.setCompanyId(esmInsCompany.getId());
|
|
|
insAreaCompany.setCompanyName(esmInsCompany.getNamesimple());
|
|
|
insAreaCompany.setPartnerCompaniesId(agreement.getPartnerCompaniesId());
|
|
|
- if(StringUtils.isNotBlank(agreement.getPartnerCompaniesId())){
|
|
|
+ if (StringUtils.isNotBlank(agreement.getPartnerCompaniesId())) {
|
|
|
EsmInsCompany partnerCompany = esmInsCompanyService.getById(agreement.getPartnerCompaniesId());
|
|
|
insAreaCompany.setPartnerCompaniesName(partnerCompany.getNamesimple());
|
|
|
}
|
|
|
insAreaCompany.setCompanyName(esmInsCompany.getNamesimple());
|
|
|
insAreaCompany.setPartnerCompaniesId(agreement.getPartnerCompaniesId());
|
|
|
- if(userId ==null ){
|
|
|
+ if (userId == null) {
|
|
|
userId = new BaseController().getUserId();
|
|
|
}
|
|
|
insAreaCompany.setUserId(userId);
|