|
@@ -23,16 +23,19 @@ import com.ydtech.modules.order.components.InsOrdersComponents;
|
|
|
import com.ydtech.modules.order.entity.InsAreaCompany;
|
|
import com.ydtech.modules.order.entity.InsAreaCompany;
|
|
|
import com.ydtech.modules.order.entity.InsAreaCompanyAccidentalDriving;
|
|
import com.ydtech.modules.order.entity.InsAreaCompanyAccidentalDriving;
|
|
|
import com.ydtech.modules.order.entity.InsOrders;
|
|
import com.ydtech.modules.order.entity.InsOrders;
|
|
|
|
|
+import com.ydtech.modules.order.entity.po.InsAreaCompanyError;
|
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
|
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
|
|
import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
|
|
|
import com.ydtech.modules.order.entity.vo.SubOrderExportFeeVo;
|
|
import com.ydtech.modules.order.entity.vo.SubOrderExportFeeVo;
|
|
|
import com.ydtech.modules.order.service.InsAreaCompanyAccidentalDrivingService;
|
|
import com.ydtech.modules.order.service.InsAreaCompanyAccidentalDrivingService;
|
|
|
|
|
+import com.ydtech.modules.order.service.InsAreaCompanyErrorService;
|
|
|
import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
|
import com.ydtech.modules.order.service.InsOrdersService;
|
|
import com.ydtech.modules.order.service.InsOrdersService;
|
|
|
import com.ydtech.modules.protocol.constants.TaxSourceStatusConstants;
|
|
import com.ydtech.modules.protocol.constants.TaxSourceStatusConstants;
|
|
|
import com.ydtech.modules.protocol.dao.PtlTaxSourceNewMapper;
|
|
import com.ydtech.modules.protocol.dao.PtlTaxSourceNewMapper;
|
|
|
import com.ydtech.modules.protocol.entity.dto.TaxSourceExcludeDto;
|
|
import com.ydtech.modules.protocol.entity.dto.TaxSourceExcludeDto;
|
|
|
import com.ydtech.modules.protocol.entity.po.PtlAgreement;
|
|
import com.ydtech.modules.protocol.entity.po.PtlAgreement;
|
|
|
|
|
+import com.ydtech.modules.protocol.entity.po.PtlAgreementDept;
|
|
|
import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNew;
|
|
import com.ydtech.modules.protocol.entity.po.PtlTaxSourceNew;
|
|
|
import com.ydtech.modules.protocol.service.ITaxSourceExcludeService;
|
|
import com.ydtech.modules.protocol.service.ITaxSourceExcludeService;
|
|
|
import com.ydtech.modules.protocol.service.PtlAgreementDeptService;
|
|
import com.ydtech.modules.protocol.service.PtlAgreementDeptService;
|
|
@@ -46,6 +49,7 @@ import com.ydtech.utils.idgen.IdGenerate;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.aspectj.lang.JoinPoint;
|
|
import org.aspectj.lang.JoinPoint;
|
|
|
import org.aspectj.lang.annotation.AfterReturning;
|
|
import org.aspectj.lang.annotation.AfterReturning;
|
|
|
|
|
+import org.aspectj.lang.annotation.AfterThrowing;
|
|
|
import org.aspectj.lang.annotation.Aspect;
|
|
import org.aspectj.lang.annotation.Aspect;
|
|
|
import org.aspectj.lang.annotation.Before;
|
|
import org.aspectj.lang.annotation.Before;
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
@@ -53,6 +57,7 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
@Aspect
|
|
@Aspect
|
|
@@ -97,6 +102,8 @@ public class QuoteVerificationAspect {
|
|
|
|
|
|
|
|
private final PtlAgreementService ptlAgreementService;
|
|
private final PtlAgreementService ptlAgreementService;
|
|
|
|
|
|
|
|
|
|
+ private final InsAreaCompanyErrorService insAreaCompanyErrorService;
|
|
|
|
|
+
|
|
|
@AfterReturning(pointcut = "@annotation(com.ydtech.modules.order.aop.QuoteVerification)", returning = "result")
|
|
@AfterReturning(pointcut = "@annotation(com.ydtech.modules.order.aop.QuoteVerification)", returning = "result")
|
|
|
public void doAfter(HttpResult<QuoteRespVo> result) {
|
|
public void doAfter(HttpResult<QuoteRespVo> result) {
|
|
|
//计算费用因子
|
|
//计算费用因子
|
|
@@ -152,20 +159,20 @@ public class QuoteVerificationAspect {
|
|
|
String orderno = ((BaseQuoteVo<?>) arg).getOrderNo();
|
|
String orderno = ((BaseQuoteVo<?>) arg).getOrderNo();
|
|
|
//由于前台未传userid判断不了,从主订单表获取用户id和机构id保证待客录单和录单员录单的信息一致
|
|
//由于前台未传userid判断不了,从主订单表获取用户id和机构id保证待客录单和录单员录单的信息一致
|
|
|
/**
|
|
/**
|
|
|
- String deptId = ((BaseQuoteVo<?>) arg).getDeptId();
|
|
|
|
|
- String userId = ((BaseQuoteVo<?>) arg).getUserId();
|
|
|
|
|
- //待客录单传入userId
|
|
|
|
|
- if (StringUtils.isNotEmpty(userId)) {
|
|
|
|
|
- //通过用户id查询所在的机构
|
|
|
|
|
- SysUser user = sysUserService.getById(userId);
|
|
|
|
|
- deptId = user.getDeptId();
|
|
|
|
|
- } else {
|
|
|
|
|
- // 判断协议是否可以报价(代客录单时,机构需要传过来 没传为空时,为车险录单进来的 直接取登录用户机构即可)
|
|
|
|
|
- //if (StringUtils.isEmpty(deptId)) {
|
|
|
|
|
- deptId = new BaseController().getDeptId();
|
|
|
|
|
- //}
|
|
|
|
|
- userId = new BaseController().getUserId();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ String deptId = ((BaseQuoteVo<?>) arg).getDeptId();
|
|
|
|
|
+ String userId = ((BaseQuoteVo<?>) arg).getUserId();
|
|
|
|
|
+ //待客录单传入userId
|
|
|
|
|
+ if (StringUtils.isNotEmpty(userId)) {
|
|
|
|
|
+ //通过用户id查询所在的机构
|
|
|
|
|
+ SysUser user = sysUserService.getById(userId);
|
|
|
|
|
+ deptId = user.getDeptId();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 判断协议是否可以报价(代客录单时,机构需要传过来 没传为空时,为车险录单进来的 直接取登录用户机构即可)
|
|
|
|
|
+ //if (StringUtils.isEmpty(deptId)) {
|
|
|
|
|
+ deptId = new BaseController().getDeptId();
|
|
|
|
|
+ //}
|
|
|
|
|
+ userId = new BaseController().getUserId();
|
|
|
|
|
+ }
|
|
|
**/
|
|
**/
|
|
|
//添加外部订单的限制 add by hxl 2024-07-12
|
|
//添加外部订单的限制 add by hxl 2024-07-12
|
|
|
List<InsAreaCompany> insAreaList = insAreaCompanyService.getBaseMapper().selectList(new LambdaQueryWrapper<InsAreaCompany>().eq(InsAreaCompany::getOrderno, orderno));
|
|
List<InsAreaCompany> insAreaList = insAreaCompanyService.getBaseMapper().selectList(new LambdaQueryWrapper<InsAreaCompany>().eq(InsAreaCompany::getOrderno, orderno));
|
|
@@ -173,13 +180,13 @@ public class QuoteVerificationAspect {
|
|
|
for(InsAreaCompany subOrder : insAreaList){
|
|
for(InsAreaCompany subOrder : insAreaList){
|
|
|
PtlAgreement ptlAgreement = ptlAgreementService.getById(subOrder.getAgreementId());
|
|
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("外部订单不允许报价,请到外部订单编辑页面进行编辑!!");
|
|
|
|
|
|
|
+ // throw new SystemException("外部订单不允许报价,请到外部订单编辑页面进行编辑!!");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
//税源查询
|
|
//税源查询
|
|
|
BaseQuoteInfoVo quoteInfo = insOrdersComponents.getQuoteInfo(orderno, agreementId);
|
|
BaseQuoteInfoVo quoteInfo = insOrdersComponents.getQuoteInfo(orderno, agreementId);
|
|
|
- //add by hxl 2024-06-12 改为从主订单表中获取数据用户id和部门id
|
|
|
|
|
|
|
+ //add by hxl 2024-06-12 改为从主订单表中获取数据用户id和部门id
|
|
|
SysUser user = sysUserService.getById(quoteInfo.getUserId());
|
|
SysUser user = sysUserService.getById(quoteInfo.getUserId());
|
|
|
String userId=quoteInfo.getUserId();
|
|
String userId=quoteInfo.getUserId();
|
|
|
String deptId = user.getDeptId();
|
|
String deptId = user.getDeptId();
|
|
@@ -190,12 +197,12 @@ public class QuoteVerificationAspect {
|
|
|
//
|
|
//
|
|
|
//注释之前的的税源判断 add by hxl
|
|
//注释之前的的税源判断 add by hxl
|
|
|
/**
|
|
/**
|
|
|
- String taxAgreementId = taxSourceService.getAgreementId(deptId, userId, companyId, quoteInfo.getCarInfo().getLicenseNo(),
|
|
|
|
|
- quoteInfo.getCarInfo().getEnginedesc(), insuranceRisk.getCode());
|
|
|
|
|
- if (!"".equals(taxAgreementId)) {
|
|
|
|
|
- ((BaseQuoteVo<?>) arg).setAgreementId(taxAgreementId);
|
|
|
|
|
- }
|
|
|
|
|
- **/
|
|
|
|
|
|
|
+ String taxAgreementId = taxSourceService.getAgreementId(deptId, userId, companyId, quoteInfo.getCarInfo().getLicenseNo(),
|
|
|
|
|
+ quoteInfo.getCarInfo().getEnginedesc(), insuranceRisk.getCode());
|
|
|
|
|
+ if (!"".equals(taxAgreementId)) {
|
|
|
|
|
+ ((BaseQuoteVo<?>) arg).setAgreementId(taxAgreementId);
|
|
|
|
|
+ }
|
|
|
|
|
+ **/
|
|
|
String isTaxSource = ((BaseQuoteVo<?>) arg).getIsTaxSource();
|
|
String isTaxSource = ((BaseQuoteVo<?>) arg).getIsTaxSource();
|
|
|
boolean isExclude = true;
|
|
boolean isExclude = true;
|
|
|
//排除的部门信息
|
|
//排除的部门信息
|
|
@@ -214,9 +221,9 @@ public class QuoteVerificationAspect {
|
|
|
if(StringUtils.isNotBlank(isTaxSource) && "1".equals(isTaxSource) && isExclude){
|
|
if(StringUtils.isNotBlank(isTaxSource) && "1".equals(isTaxSource) && isExclude){
|
|
|
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);
|
|
((BaseQuoteVo<?>) arg).setAgreementId(taxAgreementId);
|
|
|
- log.info("======================订单号"+orderno+"走默认协议判断逻辑!匹配协议为:"+taxAgreementId+"=======================");
|
|
|
|
|
- //throw new SystemException("订单号"+orderno+"走默认协议判断逻辑!匹配协议为:"+taxAgreementId);
|
|
|
|
|
- }else{
|
|
|
|
|
|
|
+ log.info("======================订单号"+orderno+"走默认协议判断逻辑!匹配协议为:"+taxAgreementId+"=======================");
|
|
|
|
|
+ //throw new SystemException("订单号"+orderno+"走默认协议判断逻辑!匹配协议为:"+taxAgreementId);
|
|
|
|
|
+ }else{
|
|
|
//不在排除部门内进行默认判断
|
|
//不在排除部门内进行默认判断
|
|
|
if(isExclude){
|
|
if(isExclude){
|
|
|
//走正常协议判断是错误的 判断是否有默认配置,如果有不可能进来,前台报错
|
|
//走正常协议判断是错误的 判断是否有默认配置,如果有不可能进来,前台报错
|
|
@@ -225,7 +232,7 @@ public class QuoteVerificationAspect {
|
|
|
.eq(PtlTaxSourceNew::getDefaultFlag,"1"));
|
|
.eq(PtlTaxSourceNew::getDefaultFlag,"1"));
|
|
|
if(taxSourceDtoList!=null && !taxSourceDtoList.isEmpty()){
|
|
if(taxSourceDtoList!=null && !taxSourceDtoList.isEmpty()){
|
|
|
//throw new SystemException("配置默认协议且部门未排除应走默认逻辑,操作错误,请联系管理员!!");
|
|
//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);
|
|
((BaseQuoteVo<?>) arg).setAgreementId(taxAgreementId);
|
|
|
}
|
|
}
|
|
@@ -234,7 +241,7 @@ public class QuoteVerificationAspect {
|
|
|
}
|
|
}
|
|
|
//else{
|
|
//else{
|
|
|
// throw new SystemException("走正常协议逻辑!");
|
|
// throw new SystemException("走正常协议逻辑!");
|
|
|
- // }
|
|
|
|
|
|
|
+ // }
|
|
|
SysUserRole userRole = sysUserRoleService.selectByUserId(userId);
|
|
SysUserRole userRole = sysUserRoleService.selectByUserId(userId);
|
|
|
if (Arrays.asList(SystemConstant.getSysRoleTeamLeader()).contains(userRole.getRoleId().toString())) { //团队长可查询下面所有人员订单
|
|
if (Arrays.asList(SystemConstant.getSysRoleTeamLeader()).contains(userRole.getRoleId().toString())) { //团队长可查询下面所有人员订单
|
|
|
return;
|
|
return;
|
|
@@ -252,7 +259,7 @@ public class QuoteVerificationAspect {
|
|
|
* @Date: 2024/4/27 15:18
|
|
* @Date: 2024/4/27 15:18
|
|
|
* @Description: 添加报价接口的报价失败状态的后置通知
|
|
* @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) {
|
|
public void after(JoinPoint point, HttpResult response) {
|
|
|
Object[] args = point.getArgs();
|
|
Object[] args = point.getArgs();
|
|
|
if (response.getCode() != 200) {
|
|
if (response.getCode() != 200) {
|
|
@@ -261,8 +268,9 @@ public class QuoteVerificationAspect {
|
|
|
if (arg instanceof BaseQuoteVo) {
|
|
if (arg instanceof BaseQuoteVo) {
|
|
|
String companyId = ((BaseQuoteVo<?>) arg).getCompanyId();
|
|
String companyId = ((BaseQuoteVo<?>) arg).getCompanyId();
|
|
|
String agreementId = ((BaseQuoteVo<?>) arg).getAgreementId();
|
|
String agreementId = ((BaseQuoteVo<?>) arg).getAgreementId();
|
|
|
|
|
+ String userId = ((BaseQuoteVo<?>) arg).getUserId();
|
|
|
String orderno = ((BaseQuoteVo<?>) arg).getOrderNo();
|
|
String orderno = ((BaseQuoteVo<?>) arg).getOrderNo();
|
|
|
- insertInsAreaCompany(companyId, orderno, agreementId);
|
|
|
|
|
|
|
+ insertInsAreaCompany(companyId, orderno, agreementId,response.getMsg(),userId);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -274,7 +282,7 @@ public class QuoteVerificationAspect {
|
|
|
* @Date: 2024/4/27 16:54
|
|
* @Date: 2024/4/27 16:54
|
|
|
* @Description: 添加报价接口的报价失败状态的异常通知
|
|
* @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) {
|
|
public void handleException(JoinPoint point, Exception ex) {
|
|
|
// 处理异常的逻辑
|
|
// 处理异常的逻辑
|
|
|
Object[] args = point.getArgs();
|
|
Object[] args = point.getArgs();
|
|
@@ -283,24 +291,41 @@ public class QuoteVerificationAspect {
|
|
|
if (arg instanceof BaseQuoteVo) {
|
|
if (arg instanceof BaseQuoteVo) {
|
|
|
String companyId = ((BaseQuoteVo<?>) arg).getCompanyId();
|
|
String companyId = ((BaseQuoteVo<?>) arg).getCompanyId();
|
|
|
String agreementId = ((BaseQuoteVo<?>) arg).getAgreementId();
|
|
String agreementId = ((BaseQuoteVo<?>) arg).getAgreementId();
|
|
|
|
|
+ String userId = ((BaseQuoteVo<?>) arg).getUserId();
|
|
|
String orderno = ((BaseQuoteVo<?>) arg).getOrderNo();
|
|
String orderno = ((BaseQuoteVo<?>) arg).getOrderNo();
|
|
|
- insertInsAreaCompany(companyId, orderno, agreementId);
|
|
|
|
|
|
|
+ insertInsAreaCompany(companyId, orderno, agreementId,ex.getMessage(),userId);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public void insertInsAreaCompany(String companyId, String orderno, String agreementId) {
|
|
|
|
|
|
|
+ public void insertInsAreaCompany(String companyId, String orderno, String agreementId,String msg,String userId) {
|
|
|
EsmInsCompany esmInsCompany = esmInsCompanyService.getById(companyId);
|
|
EsmInsCompany esmInsCompany = esmInsCompanyService.getById(companyId);
|
|
|
|
|
+ // agreement
|
|
|
|
|
+ PtlAgreement agreement = ptlAgreementService.getById(agreementId);
|
|
|
//保存订单信息
|
|
//保存订单信息
|
|
|
- InsAreaCompany insAreaCompany = new InsAreaCompany();
|
|
|
|
|
|
|
+ InsAreaCompanyError insAreaCompany = new InsAreaCompanyError();
|
|
|
insAreaCompany.setId(IdGenerate.nextId());
|
|
insAreaCompany.setId(IdGenerate.nextId());
|
|
|
insAreaCompany.setOrderno(orderno);
|
|
insAreaCompany.setOrderno(orderno);
|
|
|
insAreaCompany.setAgreementId(agreementId);
|
|
insAreaCompany.setAgreementId(agreementId);
|
|
|
- insAreaCompany.setOrderstatus(InsOrderStatusEnum.QUOTE_ING.getCode()); // "1"
|
|
|
|
|
|
|
+ insAreaCompany.setErrorMsg(msg);
|
|
|
insAreaCompany.setCompanyId(esmInsCompany.getId());
|
|
insAreaCompany.setCompanyId(esmInsCompany.getId());
|
|
|
- insAreaCompany.setInscompany(esmInsCompany.getNamesimple());
|
|
|
|
|
- //insAreaCompany.setErrorStatus(500);
|
|
|
|
|
- insAreaCompanyService.insertCompanyAndOrders(insAreaCompany);
|
|
|
|
|
|
|
+ insAreaCompany.setCompanyName(esmInsCompany.getNamesimple());
|
|
|
|
|
+ insAreaCompany.setPartnerCompaniesId(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 ){
|
|
|
|
|
+ userId = new BaseController().getUserId();
|
|
|
|
|
+ }
|
|
|
|
|
+ insAreaCompany.setUserId(userId);
|
|
|
|
|
+ SysUser user = sysUserService.getById(userId);
|
|
|
|
|
+ String deptId = user.getDeptId();
|
|
|
|
|
+ insAreaCompany.setDeptId(deptId);
|
|
|
|
|
+ insAreaCompany.setCreateTime(new Date());
|
|
|
|
|
+ insAreaCompanyErrorService.save(insAreaCompany);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|