Bläddra i källkod

Merge branch 'test' into test-dismantle

bifrons 2 år sedan
förälder
incheckning
340c7ce418

+ 53 - 96
src/main/java/com/ydtech/modules/admin/service/impl/SysUserAccountServiceImpl.java

@@ -47,55 +47,25 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
     @Override
     @Transactional
     public void addOrUpdate(SysUserAccount sysUserAccount) {
+        SysUserAccount newSysAccount = baseMapper.getById(sysUserAccount.getUserId());
+//         初始化
+        if(sysUserAccount.getHandlingFee()==null){
+            sysUserAccount.setHandlingFee(BigDecimal.ZERO);
+        }
+        if(sysUserAccount.getDocumentary()==null){
+            sysUserAccount.setDocumentary(BigDecimal.ZERO);
+        }
+        if(sysUserAccount.getPromotion()==null){
+            sysUserAccount.setPromotion(BigDecimal.ZERO);
+        }
 
 //      如果用户id有值则累加   没有则 新增
-        BigDecimal handlingFee = BigDecimal.ZERO;
-//      用户历史记录表金额
-        BigDecimal total = BigDecimal.ZERO;
-        BigDecimal remainingAmount = BigDecimal.ZERO;
-
-
         String userId = sysUserAccount.getUserId();
         SysUserAccount sysUserAccountEntity = super.getById(userId);
         SysUserAccount newAccount = new SysUserAccount();
-        if (sysUserAccount.getHandlingFee() == null) {
-            sysUserAccount.setHandlingFee(handlingFee);
-        } else {
-            total = total.add(sysUserAccount.getHandlingFee());
-
-        }
-        if (sysUserAccount.getDocumentary() == null) {
-            sysUserAccount.setDocumentary(handlingFee);
-        } else {
-            total = total.add(sysUserAccount.getDocumentary());
-
-        }
-        if (sysUserAccount.getPromotion() == null) {
-            sysUserAccount.setPromotion(handlingFee);
-        } else {
-            total = total.add(sysUserAccount.getPromotion());
-
-        }
-
 
         if (ObjectUtils.isNotEmpty(sysUserAccountEntity)) {
-            if (sysUserAccountEntity.getHandlingFee() == null) {
-                sysUserAccountEntity.setHandlingFee(handlingFee);
-            } else {
-                remainingAmount = remainingAmount.add(sysUserAccountEntity.getHandlingFee());
-            }
-            if (sysUserAccountEntity.getDocumentary() == null) {
-                sysUserAccountEntity.setDocumentary(handlingFee);
-            } else {
-                remainingAmount = remainingAmount.add(sysUserAccountEntity.getDocumentary());
-
-            }
-            if (sysUserAccountEntity.getPromotion() == null) {
-                sysUserAccountEntity.setPromotion(handlingFee);
-            } else {
-                remainingAmount = remainingAmount.add(sysUserAccountEntity.getPromotion());
 
-            }
             sysUserAccountEntity.setHandlingFee(sysUserAccount.getHandlingFee().add(sysUserAccountEntity.getHandlingFee()));
             sysUserAccountEntity.setDocumentary(sysUserAccount.getDocumentary().add(sysUserAccountEntity.getDocumentary()));
             sysUserAccountEntity.setPromotion(sysUserAccount.getPromotion().add(sysUserAccountEntity.getPromotion()));
@@ -116,7 +86,47 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
 
         if (StringUtils.isNotEmpty(sysUserAccount.getDocumentaryStatus())) {
 //          判断是否是一级二级三级
-            this.judgeLevel(userId, sysUserAccountEntity, newAccount);
+            SysUserAccountHistory sysUserAccountHistory = new SysUserAccountHistory();
+            sysUserAccountHistory.setUserId(sysUserAccount.getUserId());
+            sysUserAccountHistory.setDocumentary(Integer.valueOf(sysUserAccount.getDocumentaryStatus()));
+            sysUserAccountHistory.setSuborder(sysUserAccountEntity.getSuborderId());
+            if(sysUserAccount.getDocumentary()!=null && sysUserAccount.getDocumentary().compareTo(BigDecimal.ZERO)!=0){
+                sysUserAccountHistory.setAmount(sysUserAccount.getDocumentary());
+                sysUserAccountHistory.setProperty(2);
+                if("2".equals(sysUserAccount.getDocumentaryStatus())){ // 收入  相加
+                    sysUserAccountHistory.setSurplusAmount(sysUserAccount.getDocumentary().add(newSysAccount.getDocumentary()));
+                }else {
+                    BigDecimal subtract = newSysAccount.getDocumentary().subtract(sysUserAccount.getDocumentary());
+                    sysUserAccountHistory.setSurplusAmount(subtract);
+                }
+                sysUserAccountHistoryService.updayteByUserAccount(sysUserAccountHistory);
+            }
+            if(sysUserAccount.getHandlingFee()!=null  &&  sysUserAccount.getHandlingFee().compareTo(BigDecimal.ZERO) !=0){
+                sysUserAccountHistory.setId(null);
+                sysUserAccountHistory.setAmount(sysUserAccount.getHandlingFee());
+                sysUserAccountHistory.setProperty(1);
+                if("2".equals(sysUserAccount.getDocumentaryStatus())){ // 收入  相加
+                    sysUserAccountHistory.setSurplusAmount(sysUserAccount.getHandlingFee().add(newSysAccount.getHandlingFee()));
+                }else {
+                    BigDecimal subtract = newSysAccount.getHandlingFee().subtract(sysUserAccount.getHandlingFee());
+                    sysUserAccountHistory.setSurplusAmount(subtract);
+                }
+                sysUserAccountHistoryService.updayteByUserAccount(sysUserAccountHistory);
+            }
+            if(sysUserAccount.getPromotion() !=null && sysUserAccount.getPromotion().compareTo(BigDecimal.ZERO) !=0){
+                sysUserAccountHistory.setId(null);
+
+                sysUserAccountHistory.setAmount(sysUserAccount.getPromotion());
+                sysUserAccountHistory.setProperty(3);
+                if("2".equals(sysUserAccount.getDocumentaryStatus())){ // 收入  相加
+                    sysUserAccountHistory.setSurplusAmount(sysUserAccount.getPromotion().add(newSysAccount.getPromotion()));
+                }else {
+                    BigDecimal subtract = newSysAccount.getPromotion().subtract(sysUserAccount.getPromotion());
+                    sysUserAccountHistory.setSurplusAmount(subtract);
+                }
+                sysUserAccountHistoryService.updayteByUserAccount(sysUserAccountHistory);
+
+            }
         }
 
 
@@ -209,64 +219,11 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
     @Override
     public SysUserAccount getSysUserAmount(String userid) {
         SysUserAccount sysUserAccount = baseMapper.getById(userid);
+
         return sysUserAccount;
     }
 
 
-    private void judgeLevel(String userId, SysUserAccount sysUserAccountEntity, SysUserAccount newAccount) {
-        if (!ObjectUtils.isNotEmpty(sysUserAccountEntity)) {
-            sysUserAccountEntity = newAccount;
-        }
-        EsmUserReferrer esmUserReferrerServiceById = esmUserReferrerService.getById(userId);
-        if (ObjectUtils.isNotEmpty(esmUserReferrerServiceById)) {
-            String referrerId = esmUserReferrerServiceById.getReferrerId();
-//              如果相等则为一级
-            if (StringUtils.isNotEmpty(referrerId) && referrerId.equals(userId)) {
-                if (ObjectUtils.isNotEmpty(sysUserAccountEntity)) {
-                    for (int i = 1; i <= 3; i++) {
-                        SysUserAccountHistory sysUserAccountHistory = new SysUserAccountHistory();
-                        sysUserAccountHistory.setUserId(userId);
-                        sysUserAccountHistory.setDocumentary(Integer.valueOf(sysUserAccountEntity.getDocumentaryStatus()));
-                        sysUserAccountHistory.setProperty(i);
-                        sysUserAccountHistory.setSuborder(sysUserAccountEntity.getSuborderId());
-                        SysUserAccount byId = super.getById(userId);
-                        if (i == 1) {
-                            sysUserAccountHistory.setAmount(sysUserAccountEntity.getHandlingFee());
-//                            查询当前用户金额
-                            if (ObjectUtils.isNotEmpty(byId)) {
-                                sysUserAccountHistory.setSurplusAmount(byId.getHandlingFee() == null ? BigDecimal.ZERO.add(sysUserAccountEntity.getHandlingFee()) : byId.getHandlingFee().add(sysUserAccountEntity.getHandlingFee()));
-                            }
-                        } else if (i == 2) {
-                            sysUserAccountHistory.setAmount(sysUserAccountEntity.getDocumentary());   //非跟单佣金
-                            if (ObjectUtils.isNotEmpty(byId)) {
-                                sysUserAccountHistory.setSurplusAmount(byId.getDocumentary() == null ? BigDecimal.ZERO.add(sysUserAccountEntity.getDocumentary()) : byId.getDocumentary().add(sysUserAccountEntity.getDocumentary()));
-                            }
-
-                        } else {
-                            sysUserAccountHistory.setAmount(sysUserAccountEntity.getPromotion());  // 佣金
-                            if (ObjectUtils.isNotEmpty(byId)) {
-                                sysUserAccountHistory.setSurplusAmount(byId.getPromotion() == null ? BigDecimal.ZERO.add(sysUserAccountEntity.getPromotion()) : byId.getPromotion().add(sysUserAccountEntity.getPromotion()));
-                            }
-                        }
-                        if (sysUserAccountHistory.getAmount().compareTo(BigDecimal.ZERO) == 1) {
-                            sysUserAccountHistoryService.updayteByUserAccount(sysUserAccountHistory);
-                        }
-                    }
-                }
-            } else {
-//                其余都是推广金
-                SysUserAccountHistory sysUserAccountHistory = new SysUserAccountHistory();
-                sysUserAccountHistory.setAmount(sysUserAccountEntity.getPromotion());
-                sysUserAccountHistory.setProperty(3);
-                sysUserAccountHistory.setSuborder(sysUserAccountEntity.getSuborderId());
-                sysUserAccountHistory.setUserId(userId);
-                sysUserAccountHistory.setDocumentary(Integer.valueOf(sysUserAccountEntity.getDocumentaryStatus()));
-                SysUserAccount byId = super.getById(userId);
-                sysUserAccountHistory.setSurplusAmount(byId.getPromotion() == null ? BigDecimal.ZERO.add(sysUserAccountEntity.getPromotion()) : byId.getPromotion().add(sysUserAccountEntity.getPromotion()));
-                sysUserAccountHistoryService.updayteByUserAccount(sysUserAccountHistory);
-            }
-        }
-    }
 }
 
 

+ 114 - 18
src/main/java/com/ydtech/modules/fnc/service/impl/InsFeeAuditServiceImpl.java

@@ -37,6 +37,7 @@ import com.ydtech.utils.DateUtil;
 import com.ydtech.utils.StringUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.math.NumberUtils;
+import org.apache.poi.hpsf.Decimal;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -149,29 +150,32 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
             SysDeptAccountEntity sysDeptAccountEntity = new SysDeptAccountEntity();
             sysUserAccount.setUserId(order.getUserid());
             if (ObjectUtils.isNotEmpty(insFeeOrderNew) ) {
-                BigDecimal jqPremium = insFeeOrderNew.getJqSuperviseCostsPremiums(); //交强险保费
-                BigDecimal syPremium = insFeeOrderNew.getSySuperviseCostsPremiums(); //商业险保费
-                BigDecimal noPremium = insFeeOrderNew.getNoSuperviseCostsPremiums(); //非车险保费
+//                手续非佣金  =  交强监管费用 + 商业监管费用 + 非车监管费用
+//                非跟单费用  = 交强非跟单费用 + 商业非跟单费用 + 非车非跟单费用
 
-                if(jqPremium==null){
-                    jqPremium= BigDecimal.ZERO;
-                }
-                if(syPremium==null){
-                    syPremium= BigDecimal.ZERO;
-                }
-                if(noPremium==null){
-                    noPremium= BigDecimal.ZERO;
-                }
+
+                BigDecimal jqPremiumAmount = this.zeroBigdecimal(insFeeOrderNew.getJqSuperviseCostsPremiums());//交强监管费
+                BigDecimal syPremiumAmount = this.zeroBigdecimal(insFeeOrderNew.getSySuperviseCostsPremiums());//商业监管费
+                BigDecimal noPremiumAmount = this.zeroBigdecimal(insFeeOrderNew.getNoSuperviseCostsPremiums());//非车监管费用
+                BigDecimal totalPremiumAmount = jqPremiumAmount.add(syPremiumAmount).add(noPremiumAmount);    // 手续非佣金
+
+                BigDecimal jqOtherCostsPremiums  =this.zeroBigdecimal(insFeeOrderNew.getJqOtherCostsPremiums());//交强其他费用
+                BigDecimal syOtherCostsPremiums  =this.zeroBigdecimal(insFeeOrderNew.getSyOtherCostsPremiums()); //商业其他费用
+                BigDecimal noOtherCostsProportion = this.zeroBigdecimal(insFeeOrderNew.getNoOtherCostsPremiums());//非车其他费用
+
+
+                BigDecimal totalOtherPremiumAmount = jqOtherCostsPremiums.add(syOtherCostsPremiums).add(noOtherCostsProportion);  //非跟单费用
 //              用戶
-                sysUserAccount.setHandlingFee(jqPremium);
-                sysUserAccount.setDocumentary(syPremium);
-                sysUserAccount.setPromotion(noPremium);
+                sysUserAccount.setHandlingFee(totalPremiumAmount);
+                sysUserAccount.setDocumentary(totalOtherPremiumAmount);
+//              算佣金
+                this.countUserAmount(insFeeOrderNew,orderNo);
                 sysUserAccount.setDocumentaryStatus("2");  // 收入
                 sysUserAccount.setSuborderId(orderNo);  // 订单Id
 //              部门金额
-                sysDeptAccountEntity.setHandlingFee(jqPremium);
-                sysDeptAccountEntity.setDocumentary(syPremium);
-                sysDeptAccountEntity.setPromotion(noPremium);
+                sysDeptAccountEntity.setHandlingFee(totalPremiumAmount);
+                sysDeptAccountEntity.setDocumentary(totalOtherPremiumAmount);
+//                sysDeptAccountEntity.setPromotion(noPremium);
                 sysDeptAccountEntity.setDeptId(order.getDeptid());
                 sysUserAccountService.addOrUpdate(sysUserAccount);
                 sysDeptAccountService.addOrUpdate(sysDeptAccountEntity);
@@ -182,6 +186,98 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
 
     }
 
+        private void countUserAmount(InsFeeOrderNew insFeeOrderNew ,String orderNo) {
+            String distributionStatus = insFeeOrderNew.getDistributionStatus();
+            if(StringUtils.isNotEmpty(distributionStatus)){
+                if("3".equals(distributionStatus)){
+                    BigDecimal totalDept = BigDecimal.ZERO;
+                    if(StringUtils.isNotEmpty(insFeeOrderNew.getFirstLevelUserId())){
+                        String firstLevelUserId = insFeeOrderNew.getFirstLevelUserId();
+                        BigDecimal firstDetailPremiums = insFeeOrderNew.getFirstDetailPremiums();
+                        this.saveUpdateAccount(firstLevelUserId,firstDetailPremiums,orderNo);
+                    }else {
+                        totalDept =  totalDept.add(insFeeOrderNew.getFirstDetailPremiums());
+                    }
+                    if(StringUtils.isNotEmpty(insFeeOrderNew.getTwoLevelUserId())){
+                        String twoLevelUserId = insFeeOrderNew.getTwoLevelUserId();
+                        BigDecimal secondDetailProportion = insFeeOrderNew.getSecondDetailPremiums();
+                        this.saveUpdateAccount(twoLevelUserId,secondDetailProportion,orderNo);
+                    }else {
+                        totalDept =totalDept.add(insFeeOrderNew.getSecondDetailPremiums());
+                    }
+                    if(StringUtils.isNotEmpty(insFeeOrderNew.getThreeLevelUserId())){
+                        String threeLevelUserId = insFeeOrderNew.getThreeLevelUserId();
+                        BigDecimal threeDetailPremiums = insFeeOrderNew.getThirdDetailPremiums();
+                        this.saveUpdateAccount(threeLevelUserId,threeDetailPremiums,orderNo);
+                    }else {
+                        totalDept =totalDept.add(insFeeOrderNew.getThirdDetailPremiums());
+                    }
+//                     机构管理 费用给五级交钱机构管理费
+                    if(totalDept.compareTo(BigDecimal.ZERO) ==0){
+                        BigDecimal jqDeptPremiumsLevel5 = insFeeOrderNew.getJqDeptPremiumsLevel5();
+                        jqDeptPremiumsLevel5.add(totalDept);
+                        insFeeOrderNewService.updateById(insFeeOrderNew);
+                    }
+                } else if ("2".equals(distributionStatus)) {
+                    BigDecimal totalDept = BigDecimal.ZERO;
+                    if(StringUtils.isNotEmpty(insFeeOrderNew.getFirstLevelUserId())){
+                        String firstLevelUserId = insFeeOrderNew.getFirstLevelUserId();
+                        BigDecimal firstDetailPremiums = insFeeOrderNew.getFirstDetailPremiums();
+                        this.saveUpdateAccount(firstLevelUserId,firstDetailPremiums,orderNo);
+                    }else {
+                        totalDept =  totalDept.add(insFeeOrderNew.getFirstDetailPremiums());
+                    }
+                    if(StringUtils.isNotEmpty(insFeeOrderNew.getTwoLevelUserId())){
+                        String twoLevelUserId = insFeeOrderNew.getTwoLevelUserId();
+                        BigDecimal secondDetailProportion = insFeeOrderNew.getSecondDetailPremiums();
+                        this.saveUpdateAccount(twoLevelUserId,secondDetailProportion,orderNo);
+                    }else {
+                        totalDept =totalDept.add(insFeeOrderNew.getSecondDetailPremiums());
+                    }
+//                     机构管理 费用给五级交钱机构管理费
+                    if(totalDept.compareTo(BigDecimal.ZERO) ==0){
+                        BigDecimal jqDeptPremiumsLevel5 = insFeeOrderNew.getJqDeptPremiumsLevel5();
+                        jqDeptPremiumsLevel5.add(totalDept);
+                        insFeeOrderNewService.updateById(insFeeOrderNew);
+                    }
+                }else {
+//                    一级分销
+
+                    if(StringUtils.isNotEmpty(insFeeOrderNew.getFirstLevelUserId())){
+                        String firstLevelUserId = insFeeOrderNew.getFirstLevelUserId();
+                        BigDecimal firstDetailPremiums = insFeeOrderNew.getFirstDetailPremiums();
+                        this.saveUpdateAccount(firstLevelUserId,firstDetailPremiums,orderNo);
+                    }else {
+                        if(insFeeOrderNew.getFirstDetailPremiums().compareTo(BigDecimal.ZERO) ==0){
+                            BigDecimal jqDeptPremiumsLevel5 = insFeeOrderNew.getJqDeptPremiumsLevel5();
+                            jqDeptPremiumsLevel5.add(insFeeOrderNew.getFirstDetailPremiums());
+                            insFeeOrderNewService.updateById(insFeeOrderNew);
+                        }
+                    }
+                }
+            }
+
+        }
+
+    private void saveUpdateAccount(String userId, BigDecimal amount, String orderNo) {
+        SysUserAccount sysUserAccount = new SysUserAccount();
+        sysUserAccount.setUserId(userId);
+        sysUserAccount.setPromotion(amount);
+        sysUserAccount.setDocumentaryStatus("2");  // 收入
+        sysUserAccount.setSuborderId(orderNo);
+        sysUserAccountService.addOrUpdate(sysUserAccount);
+
+    }
+
+    private BigDecimal zeroBigdecimal(BigDecimal amount) {
+        if (amount == null) {
+            return amount = BigDecimal.ZERO;
+        } else {
+            return amount;
+
+        }
+    }
+
     /**
      * 生成保司费用(应收费用)
      * @param order

+ 1 - 1
src/main/java/com/ydtech/modules/order/dao/InsOrdersMapper.java

@@ -35,6 +35,6 @@ public interface InsOrdersMapper extends BaseMapper<InsOrders> {
 
     Long getPolicyInsuranceReportCount(@Param("policyReqVo") PolicyInsuranceReportReqVo policyInsuranceReportReqVo);
 
-
+    boolean updateStatus(@Param("orderno") String orderno, @Param("status") String status);
 
 }

+ 2 - 1
src/main/java/com/ydtech/modules/order/entity/api/bohai/response/UnderwritingResponse.java

@@ -183,9 +183,10 @@ public class UnderwritingResponse extends BoHaiBaseResponse {
             @JsonProperty("resultMsg")
             private String resultMsg;
 
+            private static final String MESSAGES = "核保成功";
 
             public DrivingInsuranceDto toDrivingInsuranceDto() {
-                if (StringUtils.isNotEmpty(this.getResultMsg())) {
+                if (!MESSAGES.equals(this.getResultMsg())) {
                     throw new SystemException(this.getResultMsg());
                 }
 

+ 2 - 2
src/main/java/com/ydtech/modules/order/service/impl/IdentifyServiceImpl.java

@@ -71,7 +71,7 @@ public class IdentifyServiceImpl implements IdentifyService {
             if (StringUtils.isNotBlank(s2) && !ObjectUtil.isAllFieldNull(redisTemplate.opsForValue().get(s2Key))) {
                 //走缓存
                 CustomerInfoVO customerInfoVO2 = new CustomerInfoVO();
-                BeanUtils.copyProperties(Objects.requireNonNull(redisTemplate.opsForValue().get(s2Key)), customerInfoVO);
+                BeanUtils.copyProperties(Objects.requireNonNull(redisTemplate.opsForValue().get(s2Key)), customerInfoVO2);
                 Idcard.conversionBack(customerInfoVO, customerInfoVO2);
             } else {
                 //识别身份证背面
@@ -97,7 +97,7 @@ public class IdentifyServiceImpl implements IdentifyService {
             if (StringUtils.isNotBlank(s1) && !ObjectUtil.isAllFieldNull(redisTemplate.opsForValue().get(s1Key))) {
                 //走缓存
                 CardUserInfo cardUserInfo1 = new CardUserInfo();
-                BeanUtils.copyProperties(Objects.requireNonNull(redisTemplate.opsForValue().get(s1Key)), cardUserInfo);
+                BeanUtils.copyProperties(Objects.requireNonNull(redisTemplate.opsForValue().get(s1Key)), cardUserInfo1);
                 MultiObjectDetect.conversionFront(cardUserInfo, cardUserInfo1);
 
             } else {

+ 52 - 20
src/main/java/com/ydtech/modules/xxl/handler/QueryStatusHandler.java

@@ -1,5 +1,6 @@
 package com.ydtech.modules.xxl.handler;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import com.ydtech.constants.enums.dict.InsOrderStatusEnum;
 import com.ydtech.modules.order.components.ConfigureParametersComponents;
@@ -10,6 +11,10 @@ import com.ydtech.modules.order.components.gouren.GuorenRequestApiComponent;
 import com.ydtech.modules.order.components.huatai.HuaTaiRequestApiComponents;
 import com.ydtech.modules.order.components.yongcheng.YongchengRequestApiComponents;
 import com.ydtech.modules.order.components.zijin.ZijinRequestApiComponents;
+import com.ydtech.modules.order.dao.InsOrdersMapper;
+import com.ydtech.modules.order.entity.InsOrders;
+import com.ydtech.modules.order.entity.InsOrdersTrack;
+import com.ydtech.modules.order.service.InsOrdersTrackService;
 import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
 import com.ydtech.modules.protocol.service.PtlCrawlerApiService;
 import com.ydtech.modules.xxl.mapper.XxlInsAreaCompanyMapper;
@@ -33,6 +38,9 @@ import java.util.Random;
 @Component
 public class QueryStatusHandler {
 
+    @Autowired
+    InsOrdersMapper insOrdersMapper;
+
     @Autowired
     XxlInsAreaCompanyMapper insAreaCompanyMapper;
 
@@ -66,16 +74,18 @@ public class QueryStatusHandler {
     @Autowired
     PtlAgreementAttributionService ptlAgreementAttributionService;
 
+    @Autowired
+    InsOrdersTrackService insOrdersTrackService;
 
     @XxlJob("queryStatusHandler")
     public void queryStatus() {
         Random random = new Random();
-        HashMap<String,Object> components = getComponents();
-        HashMap<String,String> time = get24HourTime();
+        HashMap<String, Object> components = getComponents();
+        HashMap<String, String> time = get24HourTime();
         //获取24小时内未支付的订单
         List<InsAreaCompany> noPayList = insAreaCompanyMapper.getNoPayList(time.get("startTime"), time.get("endTime"));
         noPayList.forEach(insAreaCompany -> {
-            if(insAreaCompany.getAgreementId() != null) {
+            if (insAreaCompany.getAgreementId() != null) {
                 //实例化
                 try {
                     //添加延迟
@@ -87,10 +97,32 @@ public class QueryStatusHandler {
                             //更新 ins_area_company
                             insAreaCompany.setInsideOrderStatus(Integer.parseInt(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode()));
                             insAreaCompany.setInsidePayTime(queryStatusResult.getPayTime());
+                            //设置支付时间
+                            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+                            LocalDateTime dateTime = LocalDateTime.parse(queryStatusResult.getPayTime(), formatter);
+                            insAreaCompany.setPayDate(dateTime);
+                            //设置状态为已承保
+                            insAreaCompany.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
                             insAreaCompanyMapper.updateInsideOrder(insAreaCompany);
+                            InsOrders insOrders = insOrdersMapper.selectOne(new LambdaQueryWrapper<InsOrders>().eq(InsOrders::getOrderno, insAreaCompany.getOrderno()));
+                            //设置主订单为已承保
+                            insOrders.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
+                            insOrdersMapper.updateStatus(insOrders.getOrderno(),InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
+
+                            //添加轨迹信息
+                            InsOrdersTrack insOrdersTrack = new InsOrdersTrack();
+                            insOrdersTrack.setOrderNo(insAreaCompany.getOrderno());
+                            insOrdersTrack.setInsCompany(insAreaCompany.getInscompany());
+                            insOrdersTrack.setCompanyId(insAreaCompany.getCompanyId());
+                            insOrdersTrack.setSuborder(insAreaCompany.getId());
+                            insOrdersTrack.setOrderStatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
+                            insOrdersTrack.setOperatorId("admin");
+                            insOrdersTrack.setOperator("自动操作");
+                            insOrdersTrack.setCreateTime(LocalDateTime.now());
+                            insOrdersTrackService.save(insOrdersTrack);
                         }
                     }
-                }catch(Exception e){
+                } catch (Exception e) {
                     e.printStackTrace();
                 }
             }
@@ -98,31 +130,31 @@ public class QueryStatusHandler {
     }
 
 
-    private HashMap<String,Object> getComponents(){
-        HashMap<String,Object> components = new HashMap<>();
-        components.put("configureParametersComponents",configureParametersComponents);
-        components.put("daJiaRequestApiComponents",daJiaRequestApiComponents);
-        components.put("yongchengRequestApiComponents",yongchengRequestApiComponents);
-        components.put("guorenRequestApiComponent",guorenRequestApiComponent);
-        components.put("huaTaiRequestApiComponents",huaTaiRequestApiComponents);
-        components.put("zhongmeiRequestApiComponents",zhongmeiRequestApiComponents);
-        components.put("zijinRequestApiComponents",zijinRequestApiComponents);
-        components.put("insCrawlerOrderComponents",insCrawlerOrderComponents);
-        components.put("ptlCrawlerApiService",ptlCrawlerApiService);
-        components.put("ptlAgreementAttributionService",ptlAgreementAttributionService);
+    private HashMap<String, Object> getComponents() {
+        HashMap<String, Object> components = new HashMap<>();
+        components.put("configureParametersComponents", configureParametersComponents);
+        components.put("daJiaRequestApiComponents", daJiaRequestApiComponents);
+        components.put("yongchengRequestApiComponents", yongchengRequestApiComponents);
+        components.put("guorenRequestApiComponent", guorenRequestApiComponent);
+        components.put("huaTaiRequestApiComponents", huaTaiRequestApiComponents);
+        components.put("zhongmeiRequestApiComponents", zhongmeiRequestApiComponents);
+        components.put("zijinRequestApiComponents", zijinRequestApiComponents);
+        components.put("insCrawlerOrderComponents", insCrawlerOrderComponents);
+        components.put("ptlCrawlerApiService", ptlCrawlerApiService);
+        components.put("ptlAgreementAttributionService", ptlAgreementAttributionService);
         return components;
     }
 
-    private HashMap<String,String> get24HourTime(){
-        HashMap<String,String> components = new HashMap<>();
+    private HashMap<String, String> get24HourTime() {
+        HashMap<String, String> components = new HashMap<>();
         // 获取当前时间
         LocalDateTime currentTime = LocalDateTime.now();
         // 获取前24小时的时间
         LocalDateTime previous24Hours = currentTime.minus(Duration.ofHours(24));
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         LocalDateTime current = LocalDateTime.now();
-        components.put("startTime",previous24Hours.format(formatter));
-        components.put("endTime",current.format(formatter));
+        components.put("startTime", previous24Hours.format(formatter));
+        components.put("endTime", current.format(formatter));
         return components;
     }
 }

+ 1 - 1
src/main/java/com/ydtech/utils/baidu/Idcard.java

@@ -145,7 +145,7 @@ public class Idcard {
     }
 
     public static void conversionBack(CustomerInfoVO customerInfo, CustomerInfoVO customerInfoNew) {
-        customerInfo.setIdentifyValidDate(customerInfoNew.getName());
+        customerInfo.setIdentifyValidDate(customerInfoNew.getIdentifyValidDate());
         customerInfo.setIdentifyValidEndDate(customerInfoNew.getIdentifyValidEndDate());
     }
 

+ 4 - 0
src/main/resources/mapper/modules/order/InsOrdersMapper.xml

@@ -677,4 +677,8 @@
         </if>
         ) as s
     </select>
+
+    <update id="updateStatus">
+        update ins_orders set orderstatus = #{status} where orderno = #{orderno}
+    </update>
 </mapper>