|
@@ -2,12 +2,15 @@ package com.ydtech.modules.order.service.impl;
|
|
|
|
|
|
|
|
import cn.dev33.satoken.session.SaSession;
|
|
import cn.dev33.satoken.session.SaSession;
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
|
|
+import cn.hutool.core.collection.CollUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
+import com.ydtech.components.OrderComponents;
|
|
|
import com.ydtech.constants.InsuranceEnum;
|
|
import com.ydtech.constants.InsuranceEnum;
|
|
|
import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
|
|
import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
|
|
|
import com.ydtech.constants.enums.dict.insurance.NatureOfVehicleUse;
|
|
import com.ydtech.constants.enums.dict.insurance.NatureOfVehicleUse;
|
|
@@ -15,17 +18,17 @@ import com.ydtech.constants.sys.SystemConstant;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
import com.ydtech.exception.SystemException;
|
|
import com.ydtech.exception.SystemException;
|
|
|
import com.ydtech.modules.admin.constants.RoleConstants;
|
|
import com.ydtech.modules.admin.constants.RoleConstants;
|
|
|
|
|
+import com.ydtech.modules.admin.model.SysDept;
|
|
|
import com.ydtech.modules.admin.model.SysUser;
|
|
import com.ydtech.modules.admin.model.SysUser;
|
|
|
import com.ydtech.modules.admin.model.SysUserRole;
|
|
import com.ydtech.modules.admin.model.SysUserRole;
|
|
|
-import com.ydtech.modules.order.entity.po.InsOrdersCarInfo;
|
|
|
|
|
-import com.ydtech.modules.order.entity.po.InsOrdersCarUserInfo;
|
|
|
|
|
-import com.ydtech.modules.order.service.InsOrdersCarInfoService;
|
|
|
|
|
-import com.ydtech.modules.order.service.InsOrdersCarUserInfoService;
|
|
|
|
|
|
|
+import com.ydtech.modules.admin.service.SysDeptService;
|
|
|
import com.ydtech.modules.admin.service.SysUserRoleService;
|
|
import com.ydtech.modules.admin.service.SysUserRoleService;
|
|
|
import com.ydtech.modules.admin.service.SysUserService;
|
|
import com.ydtech.modules.admin.service.SysUserService;
|
|
|
|
|
+import com.ydtech.modules.esm.service.EsmUserReferrerService;
|
|
|
import com.ydtech.modules.fee.service.impl.FeeRuleSchemeServiceImpl;
|
|
import com.ydtech.modules.fee.service.impl.FeeRuleSchemeServiceImpl;
|
|
|
import com.ydtech.modules.fnc.entity.InsFeeAudit;
|
|
import com.ydtech.modules.fnc.entity.InsFeeAudit;
|
|
|
import com.ydtech.modules.fnc.service.InsFeeAuditService;
|
|
import com.ydtech.modules.fnc.service.InsFeeAuditService;
|
|
|
|
|
+import com.ydtech.modules.ins.dao.InsFileMapper;
|
|
|
import com.ydtech.modules.ins.model.InsOrdersExcel;
|
|
import com.ydtech.modules.ins.model.InsOrdersExcel;
|
|
|
import com.ydtech.modules.ins.model.InsOrdersExcelVo;
|
|
import com.ydtech.modules.ins.model.InsOrdersExcelVo;
|
|
|
import com.ydtech.modules.ins.model.vo.*;
|
|
import com.ydtech.modules.ins.model.vo.*;
|
|
@@ -38,31 +41,28 @@ import com.ydtech.modules.order.convert.MapToYaExtendInfoDto;
|
|
|
import com.ydtech.modules.order.dao.InsOrdersMapper;
|
|
import com.ydtech.modules.order.dao.InsOrdersMapper;
|
|
|
import com.ydtech.modules.order.entity.*;
|
|
import com.ydtech.modules.order.entity.*;
|
|
|
import com.ydtech.modules.order.entity.bo.InsOrdersBo;
|
|
import com.ydtech.modules.order.entity.bo.InsOrdersBo;
|
|
|
-import com.ydtech.modules.order.entity.BasePageResult;
|
|
|
|
|
-import com.ydtech.modules.order.entity.InsAreaCompany;
|
|
|
|
|
-import com.ydtech.modules.order.entity.InsOrders;
|
|
|
|
|
-import com.ydtech.modules.order.entity.InsOrdersTrack;
|
|
|
|
|
import com.ydtech.modules.order.entity.bo.UnderwritingRulesBo;
|
|
import com.ydtech.modules.order.entity.bo.UnderwritingRulesBo;
|
|
|
import com.ydtech.modules.order.entity.crawler.response.CrawlerVerifyPaymentResponse;
|
|
import com.ydtech.modules.order.entity.crawler.response.CrawlerVerifyPaymentResponse;
|
|
|
import com.ydtech.modules.order.entity.dto.DrivingInsuranceDto;
|
|
import com.ydtech.modules.order.entity.dto.DrivingInsuranceDto;
|
|
|
import com.ydtech.modules.order.entity.dto.InsAreaCompanyQueryDto;
|
|
import com.ydtech.modules.order.entity.dto.InsAreaCompanyQueryDto;
|
|
|
import com.ydtech.modules.order.entity.po.*;
|
|
import com.ydtech.modules.order.entity.po.*;
|
|
|
-import com.ydtech.modules.order.entity.vo.OrderVo;
|
|
|
|
|
import com.ydtech.modules.order.entity.vo.*;
|
|
import com.ydtech.modules.order.entity.vo.*;
|
|
|
|
|
+import com.ydtech.modules.order.entity.vo.OrderVo;
|
|
|
import com.ydtech.modules.order.entity.vo.ya.YaExtendInfoDto;
|
|
import com.ydtech.modules.order.entity.vo.ya.YaExtendInfoDto;
|
|
|
-import com.ydtech.modules.order.service.InsAreaCompanyService;
|
|
|
|
|
-import com.ydtech.modules.order.service.InsOrdersService;
|
|
|
|
|
-import com.ydtech.modules.order.service.InsOrdersTrackService;
|
|
|
|
|
-import com.ydtech.modules.protocol.entity.constants.PtlApiType;
|
|
|
|
|
import com.ydtech.modules.order.service.*;
|
|
import com.ydtech.modules.order.service.*;
|
|
|
|
|
+import com.ydtech.modules.protocol.entity.constants.PtlApiType;
|
|
|
import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
|
|
import com.ydtech.modules.protocol.entity.dto.PtlAgreementInsCompanyDto;
|
|
|
import com.ydtech.modules.protocol.service.PtlAgreementService;
|
|
import com.ydtech.modules.protocol.service.PtlAgreementService;
|
|
|
|
|
+import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
|
|
|
|
|
+import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
|
|
|
|
|
+import com.ydtech.utils.SnowFlakeUtil;
|
|
|
import com.ydtech.utils.idgen.IdGenerate;
|
|
import com.ydtech.utils.idgen.IdGenerate;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
|
|
+import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.util.ObjectUtils;
|
|
@@ -70,8 +70,11 @@ import org.springframework.util.ObjectUtils;
|
|
|
import javax.validation.constraints.NotBlank;
|
|
import javax.validation.constraints.NotBlank;
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
+import static com.ydtech.modules.order.constants.OrderCacheConstant.*;
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @author wenkaisen
|
|
* @author wenkaisen
|
|
|
* @description 针对表【ins_orders(保险订单表)】的数据库操作Service实现
|
|
* @description 针对表【ins_orders(保险订单表)】的数据库操作Service实现
|
|
@@ -80,10 +83,18 @@ import java.util.stream.Collectors;
|
|
|
@Service
|
|
@Service
|
|
|
public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders> implements InsOrdersService {
|
|
public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders> implements InsOrdersService {
|
|
|
|
|
|
|
|
|
|
+ private final OrderComponents orderComponents;
|
|
|
|
|
+
|
|
|
private final SysUserService sysUserService;
|
|
private final SysUserService sysUserService;
|
|
|
|
|
|
|
|
private final SysUserRoleService sysUserRoleService;
|
|
private final SysUserRoleService sysUserRoleService;
|
|
|
|
|
|
|
|
|
|
+ private final EsmUserReferrerService esmUserReferrerService;
|
|
|
|
|
+
|
|
|
|
|
+ private final SysDeptService sysDeptService;
|
|
|
|
|
+
|
|
|
|
|
+ private final StringRedisTemplate redisTemplate;
|
|
|
|
|
+
|
|
|
private final InsAreaCompanyService insAreaCompanyService;
|
|
private final InsAreaCompanyService insAreaCompanyService;
|
|
|
|
|
|
|
|
private final InsFeeAuditService insFeeAuditService;
|
|
private final InsFeeAuditService insFeeAuditService;
|
|
@@ -94,50 +105,61 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
|
|
|
|
|
private final InsOrdersTrackService insOrdersTrackService;
|
|
private final InsOrdersTrackService insOrdersTrackService;
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
- InsOrdersCarUserInfoService insOrdersCarUserInfoService;
|
|
|
|
|
|
|
+ private final InsFileMapper insFileMapper;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- InsOrdersCarInfoService insOrdersCarInfoService;
|
|
|
|
|
|
|
+ private InsFeeOrderNewService insFeeOrderNewService;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- InsAreaCompanyRiskService insAreaCompanyRiskService;
|
|
|
|
|
|
|
+ private InsOrdersCarInfoService insOrdersCarInfoService;
|
|
|
|
|
+
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private InsOrdersCarUserInfoService insOrdersCarUserInfoService;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- InsAreaCompanyKindService insAreaCompanyKindService;
|
|
|
|
|
|
|
+ private InsOrdersCustomerService insOrdersCustomerService;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- InsAreaCompanyTaxArrearsService insAreaCompanyTaxArrearsService;
|
|
|
|
|
|
|
+ private InsOrdersKindService insOrdersKindService;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- InsAreaCompanyCarInfoService insAreaCompanyCarInfoService;
|
|
|
|
|
|
|
+ private InsOrdersRiskService insOrdersRiskService;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- InsAreaCompanyCarUserInfoService insAreaCompanyCarUserInfoService;
|
|
|
|
|
|
|
+ private InsOrdersTaxService insOrdersTaxService;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- InsOrdersTaxService insOrdersTaxService;
|
|
|
|
|
|
|
+ private InsAreaCompanyRiskService insAreaCompanyRiskService;
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
- InsOrdersService insOrdersService;
|
|
|
|
|
|
|
+ private InsAreaCompanyKindService insAreaCompanyKindService;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
|
|
|
@Value("${upload.file.path}")
|
|
@Value("${upload.file.path}")
|
|
|
private String uploadFilePath;
|
|
private String uploadFilePath;
|
|
|
|
|
|
|
|
- public InsOrdersServiceImpl(SysUserService sysUserService,
|
|
|
|
|
|
|
+ public InsOrdersServiceImpl(OrderComponents orderComponents, SysUserService sysUserService,
|
|
|
SysUserRoleService sysUserRoleService,
|
|
SysUserRoleService sysUserRoleService,
|
|
|
- @Lazy InsAreaCompanyService insAreaCompanyService,
|
|
|
|
|
|
|
+ EsmUserReferrerService esmUserReferrerService, SysDeptService sysDeptService,
|
|
|
|
|
+ StringRedisTemplate redisTemplate, @Lazy InsAreaCompanyService insAreaCompanyService,
|
|
|
PtlAgreementService ptlAgreementService,
|
|
PtlAgreementService ptlAgreementService,
|
|
|
@Lazy FeeRuleSchemeServiceImpl feeRuleSchemeService,
|
|
@Lazy FeeRuleSchemeServiceImpl feeRuleSchemeService,
|
|
|
- InsFeeAuditService insFeeAuditService,
|
|
|
|
|
- InsOrdersTrackService insOrdersTrackService) {
|
|
|
|
|
|
|
+ InsFeeAuditService insFeeAuditService, InsOrdersTrackService insOrdersTrackService,
|
|
|
|
|
+ InsFileMapper insFileMapper) {
|
|
|
|
|
+
|
|
|
|
|
+ this.orderComponents = orderComponents;
|
|
|
this.sysUserService = sysUserService;
|
|
this.sysUserService = sysUserService;
|
|
|
this.sysUserRoleService = sysUserRoleService;
|
|
this.sysUserRoleService = sysUserRoleService;
|
|
|
|
|
+ this.esmUserReferrerService = esmUserReferrerService;
|
|
|
|
|
+ this.sysDeptService = sysDeptService;
|
|
|
|
|
+ this.redisTemplate = redisTemplate;
|
|
|
this.insAreaCompanyService = insAreaCompanyService;
|
|
this.insAreaCompanyService = insAreaCompanyService;
|
|
|
this.ptlAgreementService = ptlAgreementService;
|
|
this.ptlAgreementService = ptlAgreementService;
|
|
|
this.feeRuleSchemeService = feeRuleSchemeService;
|
|
this.feeRuleSchemeService = feeRuleSchemeService;
|
|
|
this.insFeeAuditService = insFeeAuditService;
|
|
this.insFeeAuditService = insFeeAuditService;
|
|
|
this.insOrdersTrackService = insOrdersTrackService;
|
|
this.insOrdersTrackService = insOrdersTrackService;
|
|
|
|
|
+ this.insFileMapper = insFileMapper;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -160,6 +182,8 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ String orderStatus = insAreaCompany.getOrderstatus();
|
|
|
|
|
+
|
|
|
if (!ObjectUtils.isEmpty(insAreaCompany)) {
|
|
if (!ObjectUtils.isEmpty(insAreaCompany)) {
|
|
|
InsOrders insOrders = getById(insAreaCompany.getOrderno());
|
|
InsOrders insOrders = getById(insAreaCompany.getOrderno());
|
|
|
String companyStatus = "";
|
|
String companyStatus = "";
|
|
@@ -211,6 +235,90 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
return insOrders;
|
|
return insOrders;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @param userId 当前登录人id
|
|
|
|
|
+ * @param quoteInfoVo 报价信息
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public InsOrders generateOrder(String userId, BaseQuoteInfoVo quoteInfoVo) {
|
|
|
|
|
+ String realUserId = userId;//实际跟单业务人默认登录人
|
|
|
|
|
+ boolean daikeFlag = false;//是否代客录单业务
|
|
|
|
|
+ //添加出单员报价的逻辑,
|
|
|
|
|
+ boolean isCdy = false;//是否出单员标志
|
|
|
|
|
+ if (StringUtils.isNotEmpty(userId)) {
|
|
|
|
|
+ SysUserRole userRole = sysUserRoleService.selectByUserId(userId);
|
|
|
|
|
+ if (19 == userRole.getRoleId()) {
|
|
|
|
|
+ isCdy = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isCdy) {
|
|
|
|
|
+ //如果是出单员 获取最终实际业务员
|
|
|
|
|
+ SysUser user = sysUserService.getById(realUserId);
|
|
|
|
|
+ realUserId = user.getOperatorCode();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //如果传递的业务归属人且与登录人不一致,则是代客录单业务
|
|
|
|
|
+ if (StringUtils.isNotEmpty(quoteInfoVo.getUserId()) && !userId.equals(quoteInfoVo.getUserId())) {
|
|
|
|
|
+ //实际跟单业务人变更为手工选择的人
|
|
|
|
|
+ realUserId = quoteInfoVo.getUserId();
|
|
|
|
|
+ daikeFlag = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 1. 验证订单参数
|
|
|
|
|
+ orderComponents.checkEmpty(quoteInfoVo);
|
|
|
|
|
+ SysUser user = sysUserService.getById(realUserId);
|
|
|
|
|
+ SysDept dept = sysDeptService.getById(user.getDeptId());
|
|
|
|
|
+ // 2 构造订单
|
|
|
|
|
+ InsOrders insOrders = new InsOrders(user, dept, quoteInfoVo);
|
|
|
|
|
+ if (daikeFlag) {//当时代客录单业务时,才需要赋值该字段
|
|
|
|
|
+ insOrders.setOperatorid(userId);//赋值代客录单操作人为登录人
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isCdy) {//赋值出单员 操作人为登录人
|
|
|
|
|
+ insOrders.setOperatorid(userId);
|
|
|
|
|
+ }
|
|
|
|
|
+ InsOrders insOrders1 = baseMapper.selectById(quoteInfoVo.getOrderNo());
|
|
|
|
|
+
|
|
|
|
|
+ //需要赋值代录单人ID
|
|
|
|
|
+
|
|
|
|
|
+ if (ObjectUtils.isEmpty(insOrders1)) {
|
|
|
|
|
+ insOrders1 = insOrders;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (!quoteInfoVo.getCarInfo().getLicenseNo().equals(insOrders1.getLicenseno())) {
|
|
|
|
|
+ throw new SystemException("1001", "车牌与此订单不符,请重新录单");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 3 订单操作
|
|
|
|
|
+ if (!realUserId.equals(insOrders1.getUserid()) || StringUtils.isEmpty(quoteInfoVo.getOrderNo())) {
|
|
|
|
|
+ // 存入订单
|
|
|
|
|
+ String orderno = IdGenerate.nextId();
|
|
|
|
|
+ insOrders.setOrderno(orderno);
|
|
|
|
|
+ // 将报价号返回
|
|
|
|
|
+ long l = new SnowFlakeUtil().nextId();
|
|
|
|
|
+ insOrders.setQuoteno(String.valueOf(l));
|
|
|
|
|
+ boolean save = this.saveAndTrajectories(insOrders);
|
|
|
|
|
+ if (!save) {
|
|
|
|
|
+ throw new SystemException("订单生成失败");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 修改订单
|
|
|
|
|
+ insOrders.setOrderno(quoteInfoVo.getOrderNo());
|
|
|
|
|
+ this.updateById(insOrders);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 4 将报价信息存入redis 中
|
|
|
|
|
+ String s = JSON.toJSONString(quoteInfoVo);
|
|
|
|
|
+ redisTemplate.opsForValue().set(QUOTE_INFO_KEY + insOrders.getOrderno(), s, QUOTE_INFO_KEY_TIME, TimeUnit.DAYS);
|
|
|
|
|
+
|
|
|
|
|
+ // 5 生成承包规则参数
|
|
|
|
|
+ UnderwritingRulesBo underwritingRulesBo = new UnderwritingRulesBo(quoteInfoVo);
|
|
|
|
|
+ String rules = JSON.toJSONString(underwritingRulesBo);
|
|
|
|
|
+ redisTemplate.opsForValue().set(QUOTE_RULES_KEY + insOrders.getOrderno(), rules, QUOTE_RULES_KEY_TIME,
|
|
|
|
|
+ TimeUnit.HOURS);
|
|
|
|
|
+
|
|
|
|
|
+ return insOrders;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 新的查询分页接口
|
|
* 新的查询分页接口
|
|
@@ -228,7 +336,8 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
boolean isCdy = false;
|
|
boolean isCdy = false;
|
|
|
if (StringUtils.isNotEmpty(orderQueryVo.getUserId())) {
|
|
if (StringUtils.isNotEmpty(orderQueryVo.getUserId())) {
|
|
|
SysUserRole userRole = sysUserRoleService.selectByUserId(orderQueryVo.getUserId());
|
|
SysUserRole userRole = sysUserRoleService.selectByUserId(orderQueryVo.getUserId());
|
|
|
- if (Arrays.asList(SystemConstant.getSysRoleTeamLeader()).contains(userRole.getRoleId().toString())) { //团队长可查询下面所有人员订单
|
|
|
|
|
|
|
+ if (Arrays.asList(SystemConstant.getSysRoleTeamLeader()).contains(userRole.getRoleId().toString())) {
|
|
|
|
|
+ //团队长可查询下面所有人员订单
|
|
|
isTeamLeader = true;
|
|
isTeamLeader = true;
|
|
|
}
|
|
}
|
|
|
if (19 == userRole.getRoleId()) {
|
|
if (19 == userRole.getRoleId()) {
|
|
@@ -240,7 +349,8 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
Page<InsOrders> orderVoPage = baseMapper.queryPageOrder(page, orderQueryVo, isTeamLeader, isCdy);
|
|
Page<InsOrders> orderVoPage = baseMapper.queryPageOrder(page, orderQueryVo, isTeamLeader, isCdy);
|
|
|
Long total = baseMapper.queryPageOrderCount(orderQueryVo, isTeamLeader, isCdy);
|
|
Long total = baseMapper.queryPageOrderCount(orderQueryVo, isTeamLeader, isCdy);
|
|
|
orderVoPage.setTotal(total);
|
|
orderVoPage.setTotal(total);
|
|
|
- return new BasePageResult<>(orderQueryVo.getPageNum(), orderQueryVo.getPageSize(), orderVoPage.getTotal(), orderVoPage.getPages()
|
|
|
|
|
|
|
+ return new BasePageResult<>(orderQueryVo.getPageNum(), orderQueryVo.getPageSize(), orderVoPage.getTotal(),
|
|
|
|
|
+ orderVoPage.getPages()
|
|
|
, orderVoPage.getRecords());
|
|
, orderVoPage.getRecords());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -255,7 +365,8 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
if (StringUtils.isNotEmpty(orderQueryVo.getUserId())) {
|
|
if (StringUtils.isNotEmpty(orderQueryVo.getUserId())) {
|
|
|
SysUserRole userRole = sysUserRoleService.selectByUserId(orderQueryVo.getUserId());
|
|
SysUserRole userRole = sysUserRoleService.selectByUserId(orderQueryVo.getUserId());
|
|
|
|
|
|
|
|
- if (Arrays.asList(SystemConstant.getSysRoleTeamLeader()).contains(userRole.getRoleId().toString())) { //团队长可查询下面所有人员订单
|
|
|
|
|
|
|
+ if (Arrays.asList(SystemConstant.getSysRoleTeamLeader()).contains(userRole.getRoleId().toString())) {
|
|
|
|
|
+ //团队长可查询下面所有人员订单
|
|
|
isTeamLeader = true;
|
|
isTeamLeader = true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -279,11 +390,9 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isCdy) {//如果是出单员查询时,只查自己的 与代客录单一致,查operatorid (手机前端userid传过来是出单用户,直接用该字段查询查operatorid)
|
|
if (isCdy) {//如果是出单员查询时,只查自己的 与代客录单一致,查operatorid (手机前端userid传过来是出单用户,直接用该字段查询查operatorid)
|
|
|
- wrapper.eq(StringUtils.isNotEmpty(orderQueryVo.getUserId()), InsOrders::getOperatorid,
|
|
|
|
|
- orderQueryVo.getUserId());
|
|
|
|
|
|
|
+ wrapper.eq(StringUtils.isNotEmpty(orderQueryVo.getUserId()), InsOrders::getOperatorid, orderQueryVo.getUserId());
|
|
|
} else {
|
|
} else {
|
|
|
- wrapper.eq(!isTeamLeader && StringUtils.isNotEmpty(orderQueryVo.getUserId()), InsOrders::getUserid,
|
|
|
|
|
- orderQueryVo.getUserId());
|
|
|
|
|
|
|
+ wrapper.eq(!isTeamLeader && StringUtils.isNotEmpty(orderQueryVo.getUserId()), InsOrders::getUserid, orderQueryVo.getUserId());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
Page<InsOrders> page = new Page<>(orderQueryVo.getPageNum(), orderQueryVo.getPageSize());
|
|
Page<InsOrders> page = new Page<>(orderQueryVo.getPageNum(), orderQueryVo.getPageSize());
|
|
@@ -291,8 +400,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
if (StringUtils.isNotEmpty(orderQueryVo.getCompanyId())) {
|
|
if (StringUtils.isNotEmpty(orderQueryVo.getCompanyId())) {
|
|
|
List<InsAreaCompany> list = insAreaCompanyService.query().select("DISTINCT orderno").eq("company_id",
|
|
List<InsAreaCompany> list = insAreaCompanyService.query().select("DISTINCT orderno").eq("company_id",
|
|
|
orderQueryVo.getCompanyId()).list();
|
|
orderQueryVo.getCompanyId()).list();
|
|
|
- List<String> collect =
|
|
|
|
|
- list.stream().map(InsAreaCompany::getOrderno).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
+ List<String> collect = list.stream().map(InsAreaCompany::getOrderno).distinct().collect(Collectors.toList());
|
|
|
if (!collect.isEmpty()) {
|
|
if (!collect.isEmpty()) {
|
|
|
wrapper.in(InsOrders::getOrderno, collect);
|
|
wrapper.in(InsOrders::getOrderno, collect);
|
|
|
}
|
|
}
|
|
@@ -308,8 +416,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (StringUtils.isNotEmpty(orderQueryVo.getAuditStatus()) && orderQueryVo.getAuditStatus().equals("0")) {
|
|
if (StringUtils.isNotEmpty(orderQueryVo.getAuditStatus()) && orderQueryVo.getAuditStatus().equals("0")) {
|
|
|
- List<InsFeeAudit> list =
|
|
|
|
|
- insFeeAuditService.query().select("DISTINCT orderno").eq("auditstatus", "1").list();
|
|
|
|
|
|
|
+ List<InsFeeAudit> list = insFeeAuditService.query().select("DISTINCT orderno").eq("auditstatus", "1").list();
|
|
|
List<String> collect = list.stream().map(InsFeeAudit::getOrderno).distinct().collect(Collectors.toList());
|
|
List<String> collect = list.stream().map(InsFeeAudit::getOrderno).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
if (!collect.isEmpty()) {
|
|
if (!collect.isEmpty()) {
|
|
@@ -390,12 +497,24 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
|
|
|
|
|
//非车
|
|
//非车
|
|
|
if (!ObjectUtils.isEmpty(insOrdersExcel.getCrossInsurance())) {
|
|
if (!ObjectUtils.isEmpty(insOrdersExcel.getCrossInsurance())) {
|
|
|
- List<DrivingInsuranceDto> drivingInsuranceDtos =
|
|
|
|
|
- insOrdersExcel.getCrossInsurance().toJavaList(DrivingInsuranceDto.class);
|
|
|
|
|
- if (!drivingInsuranceDtos.isEmpty()) {
|
|
|
|
|
- String policyNumber = drivingInsuranceDtos.get(0).getPolicyNumber();
|
|
|
|
|
- insOrdersExcel.setJyPolicyno(policyNumber);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if(String.valueOf(PtlApiType.PTL_API_2.getCode()).equals(insOrdersExcel.getApiType())){
|
|
|
|
|
+ List<CrawlerVerifyPaymentResponse.DrivingInsurancesDTO> drivingInsurancesDTOS =
|
|
|
|
|
+ insOrdersExcel.getCrossInsurance().toJavaList(CrawlerVerifyPaymentResponse.DrivingInsurancesDTO.class);
|
|
|
|
|
+ if (!drivingInsurancesDTOS.isEmpty()) {
|
|
|
|
|
+ String policyNumber = drivingInsurancesDTOS.get(0).getPolicy();
|
|
|
|
|
+ insOrdersExcel.setJyPolicyno(policyNumber);
|
|
|
|
|
+ }
|
|
|
|
|
+ }else {
|
|
|
|
|
+ List<DrivingInsuranceDto> drivingInsuranceDtos =
|
|
|
|
|
+ insOrdersExcel.getCrossInsurance().toJavaList(DrivingInsuranceDto.class);
|
|
|
|
|
+ if (!drivingInsuranceDtos.isEmpty()) {
|
|
|
|
|
+ String policyNumber = drivingInsuranceDtos.get(0).getPolicyNumber();
|
|
|
|
|
+ insOrdersExcel.setJyPolicyno(policyNumber);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 设置险种信息
|
|
// 设置险种信息
|
|
@@ -431,8 +550,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
return HttpResult.ok("", EasyExcelUtils.downExcel(uploadFilePath, InsOrdersExcel.class, insOrdersExcels));
|
|
return HttpResult.ok("", EasyExcelUtils.downExcel(uploadFilePath, InsOrdersExcel.class, insOrdersExcels));
|
|
|
} else {
|
|
} else {
|
|
|
if (folder.mkdirs()) {
|
|
if (folder.mkdirs()) {
|
|
|
- return HttpResult.ok("", EasyExcelUtils.downExcel(uploadFilePath, InsOrdersExcel.class,
|
|
|
|
|
- insOrdersExcels));
|
|
|
|
|
|
|
+ return HttpResult.ok("", EasyExcelUtils.downExcel(uploadFilePath, InsOrdersExcel.class, insOrdersExcels));
|
|
|
} else {
|
|
} else {
|
|
|
throw new SystemException("文件导出失败");
|
|
throw new SystemException("文件导出失败");
|
|
|
}
|
|
}
|
|
@@ -516,6 +634,9 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
|
|
|
|
|
//新增费用明细信息
|
|
//新增费用明细信息
|
|
|
// QueryOrderFeeVo queryOrderFeeVo = feeRuleSchemeService.queryFeeOrderInfo(companyId);
|
|
// QueryOrderFeeVo queryOrderFeeVo = feeRuleSchemeService.queryFeeOrderInfo(companyId);
|
|
|
|
|
+ //查询费用信息
|
|
|
|
|
+ InsFeeOrderNew insFeeOrderNew = insFeeOrderNewService.getOne(new LambdaQueryWrapper<InsFeeOrderNew>()
|
|
|
|
|
+ .eq(InsFeeOrderNew::getInsOrderNo, companyId));
|
|
|
// orderAndAreaCompany.setOrderCommissionVo(queryOrderFeeVo.getOrderCommissionVo());
|
|
// orderAndAreaCompany.setOrderCommissionVo(queryOrderFeeVo.getOrderCommissionVo());
|
|
|
// orderAndAreaCompany.setAdjustFeeDescVo(queryOrderFeeVo.getAdjustFeeDescVo());
|
|
// orderAndAreaCompany.setAdjustFeeDescVo(queryOrderFeeVo.getAdjustFeeDescVo());
|
|
|
boolean isShowOrderFee = false;
|
|
boolean isShowOrderFee = false;
|
|
@@ -542,7 +663,8 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
}
|
|
}
|
|
|
//add 解决返回null页面错误 lig 2023-09-14
|
|
//add 解决返回null页面错误 lig 2023-09-14
|
|
|
if (null == orderAndAreaCompany.getExtendInfo()) orderAndAreaCompany.setExtendInfo("");
|
|
if (null == orderAndAreaCompany.getExtendInfo()) orderAndAreaCompany.setExtendInfo("");
|
|
|
- if (null == orderAndAreaCompany.getCrossInsurance()) orderAndAreaCompany.setCrossInsurance(JSON.parseArray("[]"));
|
|
|
|
|
|
|
+ if (null == orderAndAreaCompany.getCrossInsurance())
|
|
|
|
|
+ orderAndAreaCompany.setCrossInsurance(JSON.parseArray("[]"));
|
|
|
if (null == orderAndAreaCompany.getKindinfo()) orderAndAreaCompany.setKindinfo(JSON.parseArray("[]"));
|
|
if (null == orderAndAreaCompany.getKindinfo()) orderAndAreaCompany.setKindinfo(JSON.parseArray("[]"));
|
|
|
if (null == orderAndAreaCompany.getFeeStatus()) orderAndAreaCompany.setFeeStatus("0");
|
|
if (null == orderAndAreaCompany.getFeeStatus()) orderAndAreaCompany.setFeeStatus("0");
|
|
|
|
|
|
|
@@ -553,6 +675,9 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
@Override
|
|
@Override
|
|
|
public InsOrdersEditingVo revise(String orderNo) {
|
|
public InsOrdersEditingVo revise(String orderNo) {
|
|
|
InsOrders insOrders = getById(orderNo);
|
|
InsOrders insOrders = getById(orderNo);
|
|
|
|
|
+ List<InsAreaCompany> insAreaCompanyList =
|
|
|
|
|
+ insAreaCompanyService.lambdaQuery().eq(InsAreaCompany::getOrderno, orderNo).orderByDesc(InsAreaCompany::getCreatetime).list();
|
|
|
|
|
+ insOrders.setInsAreaCompanyList(insAreaCompanyList);
|
|
|
InsOrdersEditingVo insOrdersEditingVo = new InsOrdersEditingVo();
|
|
InsOrdersEditingVo insOrdersEditingVo = new InsOrdersEditingVo();
|
|
|
|
|
|
|
|
|
|
|
|
@@ -766,7 +891,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
insOrdersTaxService.remove(new LambdaQueryWrapper<InsOrdersTax>().eq(InsOrdersTax::getOrderNo,insOrders.getOrderno()));
|
|
insOrdersTaxService.remove(new LambdaQueryWrapper<InsOrdersTax>().eq(InsOrdersTax::getOrderNo,insOrders.getOrderno()));
|
|
|
insOrdersTaxService.saveOrUpdate(insOrdersTax);
|
|
insOrdersTaxService.saveOrUpdate(insOrdersTax);
|
|
|
|
|
|
|
|
- insOrdersService.saveOrUpdate(insOrders);
|
|
|
|
|
|
|
+ this.saveOrUpdate(insOrders);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -800,17 +925,6 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private InsOrdersCustomerService insOrdersCustomerService;
|
|
|
|
|
-
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private InsOrdersKindService insOrdersKindService;
|
|
|
|
|
-
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private InsOrdersRiskService insOrdersRiskService;
|
|
|
|
|
-
|
|
|
|
|
- @Autowired
|
|
|
|
|
- private InsOrdersTaxService InsOrdersTaxService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional
|
|
@Transactional
|
|
@@ -888,7 +1002,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
// 3 车船税信息
|
|
// 3 车船税信息
|
|
|
VehicleAndVesselTax vehicleAndVesselTax = insOrdersBo.getVehicleAndVesselTax();
|
|
VehicleAndVesselTax vehicleAndVesselTax = insOrdersBo.getVehicleAndVesselTax();
|
|
|
InsOrdersTax insOrdersTax = new InsOrdersTax(orderNo, vehicleAndVesselTax);
|
|
InsOrdersTax insOrdersTax = new InsOrdersTax(orderNo, vehicleAndVesselTax);
|
|
|
- InsOrdersTaxService.save(insOrdersTax);
|
|
|
|
|
|
|
+ insOrdersTaxService.save(insOrdersTax);
|
|
|
// 4 交强商业信息表
|
|
// 4 交强商业信息表
|
|
|
List<KindInfoVo> kind = insOrdersBo.getKing();
|
|
List<KindInfoVo> kind = insOrdersBo.getKing();
|
|
|
List<InsOrdersKind> kindList = InsOrdersKind.buildKindList(orderNo, kind);
|
|
List<InsOrdersKind> kindList = InsOrdersKind.buildKindList(orderNo, kind);
|
|
@@ -901,6 +1015,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
|
|
|
SysUser sysUser = (SysUser) saSession.get(SaSession.USER);
|
|
SysUser sysUser = (SysUser) saSession.get(SaSession.USER);
|
|
|
final InsOrdersTrack insOrdersTrack = new InsOrdersTrack(insOrders, sysUser.getId(), sysUser.getName());
|
|
final InsOrdersTrack insOrdersTrack = new InsOrdersTrack(insOrders, sysUser.getId(), sysUser.getName());
|
|
|
insOrdersTrackService.save(insOrdersTrack);
|
|
insOrdersTrackService.save(insOrdersTrack);
|
|
|
|
|
+ this.baseMapper.insert(insOrders);
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|