Parcourir la source

1.支付码根据协议的状态置为失效。
2.[任务池-渠道]新增导出功能

wks il y a 1 an
Parent
commit
5c7d8f0c6b

+ 18 - 4
src/main/java/com/ydtech/modules/inv/utils/EasyExcelUtils.java

@@ -16,6 +16,7 @@ import com.ydtech.modules.inv.utils.excel.InvSettlementSourceDataListener;
 import com.ydtech.modules.inv.utils.excel.InvSourceDataListener;
 import lombok.SneakyThrows;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
 import java.io.*;
@@ -40,13 +41,27 @@ public class EasyExcelUtils {
 
     //通用写入
     public static String downExcel(String uploadFilePath, Class clz, List<?> list) {
-
         String file = System.currentTimeMillis() + ".xlsx";
         String fileName = uploadFilePath + file;
         EasyExcel.write(fileName, clz).sheet("1").doWrite(list);
         return file;
     }
 
+    /**
+     * @param uploadFilePath 路劲
+     * @param fileName       文件名称
+     * @param sheetName      sheet 名称
+     * @param clz            写入类型
+     * @param list           写入数据类型
+     * @return 文件路劲
+     */
+    public static String downExcel(String uploadFilePath, String fileName, String sheetName, Class<?> clz, List<?> list) {
+        String file = fileName + System.currentTimeMillis() + ".xlsx";
+        String filePath = uploadFilePath + file;
+        EasyExcel.write(filePath, clz).sheet(sheetName).doWrite(list);
+        return filePath;
+    }
+
     /**
      * 不创建对象的写
      */
@@ -202,7 +217,6 @@ public class EasyExcelUtils {
         return list;
     }
 
-
     public static String downExcel(String uploadFilePath, String fileName, Class clz, List<?> list) {
 
         String file = fileName + System.currentTimeMillis() + ".xlsx";
@@ -342,10 +356,10 @@ public class EasyExcelUtils {
 
 
     //保存流对象(输入流在第二次使用的时候会失效)
-    public byte[] saveIns(InputStream ins){
+    public byte[] saveIns(InputStream ins) {
         byte[] buf = null;
         try {
-            if(ins!=null){
+            if (ins != null) {
                 buf = org.apache.commons.io.IOUtils.toByteArray(ins);//ins为InputStream流
             }
         } catch (IOException e) {

+ 7 - 0
src/main/java/com/ydtech/modules/order/controller/InsOrdersController.java

@@ -294,6 +294,13 @@ public class InsOrdersController extends BaseController {
         }
     }
 
+    @PostMapping("/exportHospitalityByChannel")
+    @ApiOperation(value = "导出用户id和订单状态查询关联渠道的订单数据")
+    public HttpResult<String> exportHospitalityByChannel(@RequestBody OrderQueryVo orderQueryVo) {
+        String downloadLink = this.insOrdersService.exportTaskPoolData(orderQueryVo, OrderLinkTypeConstants.ORDER_LINK_TYPE_CONSTANTS_1);
+        return HttpResult.ok("success", downloadLink);
+    }
+
     /**
      * @version
      * @author: hxl

+ 41 - 16
src/main/java/com/ydtech/modules/order/controller/QrCodeController.java

@@ -2,17 +2,14 @@ package com.ydtech.modules.order.controller;
 
 import cn.dev33.satoken.annotation.SaIgnore;
 import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.admin.constants.UserConstants;
 import com.ydtech.modules.admin.model.po.SysBarcodeConfig;
 import com.ydtech.modules.admin.service.SysBarcodeConfigService;
 import com.ydtech.modules.admin.service.SysQRCodeRelationService;
-import com.ydtech.modules.admin.service.impl.SysBarcodeConfigServiceImpl;
 import com.ydtech.modules.esm.model.EsmInsCompany;
 import com.ydtech.modules.esm.service.EsmInsCompanyService;
-import com.ydtech.modules.esm.service.impl.EsmInsCompanyServiceImpl;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrderQrCode;
 import com.ydtech.modules.order.entity.InsOrders;
@@ -20,7 +17,9 @@ import com.ydtech.modules.order.entity.vo.QrCodeVo;
 import com.ydtech.modules.order.service.InsAreaCompanyService;
 import com.ydtech.modules.order.service.InsOrderQrCodeService;
 import com.ydtech.modules.order.service.InsOrdersService;
-import com.ydtech.modules.protocol.entity.constants.PtlApiType;
+import com.ydtech.modules.protocol.entity.po.PtlAgreement;
+import com.ydtech.modules.protocol.service.PtlAgreementService;
+import com.ydtech.utils.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -34,10 +33,10 @@ import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
 
 import javax.annotation.Resource;
 import java.io.IOException;
-import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Objects;
 
@@ -61,6 +60,9 @@ public class QrCodeController {
     @Resource
     InsOrdersService insOrdersService;
 
+    @Resource
+    private PtlAgreementService ptlAgreementService;
+
     //二维码生成地址
     @Value("${qrcode.genAddress}")
     private String qrCodeGenAddress;
@@ -133,21 +135,32 @@ public class QrCodeController {
     public Object index(String areaCompanyId) throws IOException {
         InsOrderQrCode insOrderQrCode = insOrderQrCodeService.getOne(areaCompanyId);
         InsAreaCompany insAreaCompany = insAreaCompanyService.getById(areaCompanyId);
+        PtlAgreement ptlAgreement = ptlAgreementService.getById(insAreaCompany.getAgreementId());
+
+        if ("0".equals(ptlAgreement.getValidStatus())) {
+            //重定向到错误页面中
+            return getModelAndView("");
+        }
+
+        LocalDateTime endDate = ptlAgreement.getEndDate();
+        // 订单创建时间在协议失效时间之后提示错误
+        if (insAreaCompany.getCreatetime().isAfter(endDate)) {
+            return getModelAndView("");
+        }
+
         // 根据保险公司获取二维码配置方式
         LambdaQueryWrapper<SysBarcodeConfig> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(SysBarcodeConfig::getCompanyId, insAreaCompany.getCompanyId())
                 .eq(SysBarcodeConfig::getApiType, insAreaCompany.getApiType());
         List<SysBarcodeConfig> configs = sysBarcodeConfigService.list(wrapper);
-        if (CollUtil.isEmpty(configs) || configs.size() > 1) {
+        if (CollUtil.isEmpty(getConfigs(configs)) || configs.size() > 1) {
             //重定向到错误页面中
-            ModelAndView modelAndView = new ModelAndView("qrcode_error");
-            return modelAndView;
+            return getModelAndView("配置已失效,请联系客服处理");
         }
         Integer configType = configs.get(0).getType();
         if (insOrderQrCode == null) {
             //重定向到错误页面中
-            ModelAndView modelAndView = new ModelAndView("qrcode_error");
-            return modelAndView;
+            return getModelAndView("");
         }
 
         //更新二维码扫描时间
@@ -158,8 +171,7 @@ public class QrCodeController {
         LocalDate currentDate = LocalDate.now();
         if (Math.abs(currentDate.toEpochDay() - qrcodeCreateTime.toEpochDay()) >= 1) {
             //重定向到错误页面中
-            ModelAndView modelAndView = new ModelAndView("qrcode_error");
-            return modelAndView;
+            return getModelAndView("");
         }
 
         if (UserConstants.CONFIG_TYPE_2.equals(configType) || UserConstants.CONFIG_TYPE_1.equals(configType)) {
@@ -199,12 +211,26 @@ public class QrCodeController {
         } else if (UserConstants.CONFIG_TYPE_0.equals(configType)) {
             return "redirect:" + insOrderQrCode.getJumpUrl();
         } else {
-            //重定向到错误页面中
-            ModelAndView modelAndView = new ModelAndView("qrcode_error");
-            return modelAndView;
+            return getModelAndView("配置已失效,请联系客服处理");
         }
     }
 
+    private static List<SysBarcodeConfig> getConfigs(List<SysBarcodeConfig> configs) {
+        return configs;
+    }
+
+    private static ModelAndView getModelAndView(String message) {
+        //重定向到错误页面中
+        ModelAndView modelAndView = new ModelAndView("qrcode_error");
+        HashMap<String, Object> map = new HashMap<>();
+        if(StringUtils.isNotEmpty(message)) {
+            map.put("message", message);
+        }else {
+            map.put("message", "协议已失效,请联系客服处理");
+        }
+        modelAndView.addAllObjects(map);
+        return modelAndView;
+    }
 
     @GetMapping(value = "/error")
     @ApiOperation(value = "错误页面显示")
@@ -212,5 +238,4 @@ public class QrCodeController {
         return "qrcode_error";
     }
 
-
 }

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

@@ -135,6 +135,7 @@ public interface InsOrdersMapper extends BaseMapper<InsOrders> {
 
     /**
      * 查找未删除的外部订单
+     *
      * @param insOrdersEditingVo
      * @return
      */
@@ -165,4 +166,21 @@ public interface InsOrdersMapper extends BaseMapper<InsOrders> {
      * @return 被保人列表
      */
     List<String> queryInsured(@Param("queryInsuredInOrderVo") QueryLicenseInOrderVo queryInsuredInOrderVo, String userId);
+
+    /**
+     * 根据业务类型查询数据
+     *
+     * @param orderQueryVo 订单查询信息
+     * @param agentUserIds 管理人员列表
+     * @param agreeIds     管理区域
+     * @param code         业务类型
+     * @return
+     */
+    List<InsOrders> queryOrderByLinkType(
+            @Param("orderQueryVo") OrderQueryVo orderQueryVo,
+            @Param("agentUserIds") List<String> agentUserIds,
+            @Param("agreeIds") List<String> agreeIds,
+            @Param("type") Integer code,
+            @Param("flag") Boolean flag
+    );
 }

+ 109 - 0
src/main/java/com/ydtech/modules/order/entity/dto/TaskPoolDataExcelDto.java

@@ -0,0 +1,109 @@
+package com.ydtech.modules.order.entity.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.ydtech.modules.admin.constants.ManagementSource;
+import com.ydtech.modules.order.constants.OrderEntryStatus;
+import com.ydtech.modules.order.constants.UnderwritingStatus;
+import com.ydtech.modules.order.entity.InsOrders;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class TaskPoolDataExcelDto {
+
+    @ExcelProperty("订单号")
+    private String orderNo;
+
+    @ExcelProperty("投保险种")
+    private String product;
+
+    @ExcelProperty("归属信息")
+    private String areaInfo;
+
+    @ExcelProperty("业务员姓名")
+    private String username;
+
+    @ExcelProperty("管理人")
+    private String leaderName;
+
+    @ExcelProperty("业务来源")
+    private String managementSource;
+
+    @ExcelProperty("录入来源")
+    private String entryStatus;
+
+    @ExcelProperty("已承保公司")
+    private String partnerCompaniesName;
+
+    @ExcelProperty("车牌号")
+    private String licenseNo;
+
+    @ExcelProperty("交强险保费")
+    private String jqPremium;
+
+    @ExcelProperty("商业险保费")
+    private String syPremium;
+
+    @ExcelProperty("车船税")
+    private String taxAmount;
+
+    @ExcelProperty("驾意险保费")
+    private String jyPremium;
+
+    @ExcelProperty("投保人姓名")
+    private String insuredName;
+
+    @ExcelProperty("核保通过方式")
+    private String underwritingStatus;
+
+    @ExcelProperty("业务员工号")
+    private String userid;
+
+    @ExcelProperty("报价时间")
+    private String createTime;
+
+    public TaskPoolDataExcelDto(InsOrders insOrder) {
+        this.orderNo = insOrder.getOrderno();
+        this.product = insOrder.getProduct();
+        this.areaInfo = insOrder.getAreaInfo();
+        this.username = insOrder.getUsername();
+        this.leaderName = insOrder.getLeaderName();
+
+        try {
+            ManagementSource source = ManagementSource.valueOf("MS_0" + insOrder.getManagementSource());
+            this.managementSource = source.getDesc();
+        } catch (Exception e) {
+            this.managementSource = "";
+        }
+
+        try {
+            OrderEntryStatus orderEntryStatus = OrderEntryStatus.valueOf("OES_" + insOrder.getEntryStatus());
+            this.entryStatus = orderEntryStatus.getDesc();
+        } catch (Exception e) {
+            this.entryStatus = "";
+        }
+
+        this.partnerCompaniesName = insOrder.getPartnerCompaniesName();
+        this.licenseNo = insOrder.getLicenseno();
+        this.jqPremium = insOrder.getJqpremium();
+        this.syPremium = insOrder.getSypremium();
+        this.taxAmount = insOrder.getTaxamount();
+        this.jyPremium = insOrder.getJypremium();
+        this.insuredName = insOrder.getInsuredname();
+
+        try {
+            UnderwritingStatus status = UnderwritingStatus.valueOf("US_S" + insOrder.getUnderwritingStatus());
+            this.underwritingStatus = status.getDesc();
+        } catch (Exception e) {
+            this.underwritingStatus = "";
+        }
+
+        this.userid = insOrder.getUserid();
+        this.createTime = insOrder.getCreatetime().toString();
+    }
+
+
+}

+ 10 - 0
src/main/java/com/ydtech/modules/order/service/InsOrdersService.java

@@ -8,6 +8,7 @@ import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.admin.model.SysUser;
 import com.ydtech.modules.ins.model.InsOrdersExcelVo;
 import com.ydtech.modules.ins.model.ya.CarModelDTO;
+import com.ydtech.modules.order.constants.OrderLinkTypeConstants;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrders;
@@ -302,4 +303,13 @@ public interface InsOrdersService extends IService<InsOrders> {
      * @return
      */
     boolean delExternalOrder(InsOrdersEditingVo insOrdersEditingVo);
+
+    /**
+     * 导出任务池数据-渠道
+     * @author: wks
+     * @param orderQueryVo 任务池查询项
+     * @param orderLinkTypeConstants  用户订单关联类型
+     * @return 下载链接
+     */
+    String exportTaskPoolData(OrderQueryVo orderQueryVo, OrderLinkTypeConstants orderLinkTypeConstants);
 }

+ 111 - 44
src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.order.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
+import com.alibaba.excel.EasyExcel;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -47,13 +48,12 @@ import com.ydtech.modules.ins.model.ya.ResponseDataC2;
 import com.ydtech.modules.inv.utils.EasyExcelUtils;
 import com.ydtech.modules.order.constants.BusinessConstant;
 import com.ydtech.modules.order.constants.JqInsuranceType;
+import com.ydtech.modules.order.constants.OrderEntryStatus;
+import com.ydtech.modules.order.constants.OrderLinkTypeConstants;
 import com.ydtech.modules.order.dao.InsOrdersMapper;
 import com.ydtech.modules.order.entity.*;
 import com.ydtech.modules.order.entity.crawler.response.CrawlerVerifyPaymentResponse;
-import com.ydtech.modules.order.entity.dto.DrivingInsuranceDto;
-import com.ydtech.modules.order.entity.dto.InquiryDetalsQueryDto;
-import com.ydtech.modules.order.entity.dto.InsAreaCompanyQueryDto;
-import com.ydtech.modules.order.entity.dto.TelemarketingAuditOrderDTO;
+import com.ydtech.modules.order.entity.dto.*;
 import com.ydtech.modules.order.entity.vo.*;
 import com.ydtech.modules.order.entity.vo.OrderVo;
 import com.ydtech.modules.order.entity.vo.bohai.BoHaiQuoteAccidentVo;
@@ -97,6 +97,7 @@ import javax.validation.constraints.NotBlank;
 import java.io.File;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.time.temporal.ChronoUnit;
@@ -156,6 +157,9 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
     @Value("${upload.file.path}")
     private String uploadFilePath;
 
+    @Value("${upload.file.url}")
+    private String uploadUrlPath;
+
     @Autowired
     private SysUserLinkPtlAgreementMapper sysUserLinkPtlAgreementMapper;
 
@@ -201,7 +205,6 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
     private SysProportionConfigMapper sysProportionConfigMapper;
 
 
-
     public InsOrdersServiceImpl(OrderComponents orderComponents, SysUserService sysUserService,
                                 SysUserRoleService sysUserRoleService,
                                 EsmUserReferrerService esmUserReferrerService, SysDeptService sysDeptService,
@@ -295,10 +298,10 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                 sysPremiumDetailsInfo.setLicenseno(insOrders.getLicenseno());
                 sysPremiumDetailsMapper.insert(sysPremiumDetailsInfo);
 
-                String deptId=getFiveDeptId(sysDept);
+                String deptId = getFiveDeptId(sysDept);
                 //工作室管理员抽层费用记录
                 SysAgencyLeader sysAgencyLeader = sysAgencyLeaderMapper.selectOne(new LambdaQueryWrapper<SysAgencyLeader>()
-                        .eq(SysAgencyLeader::getDeptId, deptId).eq(SysAgencyLeader::getDelFlag,1));
+                        .eq(SysAgencyLeader::getDeptId, deptId).eq(SysAgencyLeader::getDelFlag, 1));
                 if (sysAgencyLeader != null) {
                     //工作室分钱
                     String proportional = sysAgencyLeader.getProportional();
@@ -341,7 +344,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                         BigDecimal bigDecimal1 = bigDecimal.multiply(new BigDecimal(sysProportionConfig.getOneProportion())
                                 .divide(new BigDecimal("100"))).setScale(2, RoundingMode.DOWN);
                         map.put(1, bigDecimal1);
-                    }else {
+                    } else {
                         map.put(1, null);
                     }
                     String twoProportion = sysProportionConfig.getTwoProportion();
@@ -349,7 +352,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                         BigDecimal bigDecimal2 = bigDecimal.multiply(new BigDecimal(sysProportionConfig.getTwoProportion())
                                 .divide(new BigDecimal("100"))).setScale(2, RoundingMode.DOWN);
                         map.put(2, bigDecimal2);
-                    }else {
+                    } else {
                         map.put(2, null);
                     }
 
@@ -359,7 +362,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                         BigDecimal bigDecimal3 = bigDecimal.multiply(new BigDecimal(sysProportionConfig.getThreeProportion())
                                 .divide(new BigDecimal("100"))).setScale(2, RoundingMode.DOWN);
                         map.put(3, bigDecimal3);
-                    }else {
+                    } else {
                         map.put(3, null);
                     }
 
@@ -369,7 +372,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                         BigDecimal bigDecimal4 = bigDecimal.multiply(new BigDecimal(sysProportionConfig.getFourProportion())
                                 .divide(new BigDecimal("100"))).setScale(2, RoundingMode.DOWN);
                         map.put(4, bigDecimal4);
-                    }else {
+                    } else {
                         map.put(4, null);
                     }
 
@@ -378,7 +381,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                         BigDecimal bigDecimal5 = bigDecimal.multiply(new BigDecimal(sysProportionConfig.getFiveProportion())
                                 .divide(new BigDecimal("100"))).setScale(2, RoundingMode.DOWN);
                         map.put(5, bigDecimal5);
-                    }else {
+                    } else {
                         map.put(5, null);
                     }
 
@@ -387,24 +390,24 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                     List<SysRelationPerson> sysRelationPersonList = sysRelationPersonMapper.selectList(new LambdaQueryWrapper<SysRelationPerson>()
                             .eq(SysRelationPerson::getAgencyLeaderId, sysAgencyLeader.getUserId()).eq(SysRelationPerson::getType, 1));
 
-                    Map<Integer, SysRelationPerson> collect = sysRelationPersonList.stream().collect(Collectors.toMap(SysRelationPerson::getSuggestLevel, x->x));
+                    Map<Integer, SysRelationPerson> collect = sysRelationPersonList.stream().collect(Collectors.toMap(SysRelationPerson::getSuggestLevel, x -> x));
 
                     for (Integer integer : collect1) {
                         SysPremiumDetails sysPremiumDetail = new SysPremiumDetails();
                         BigDecimal bigDecimal6 = map.get(integer);
-                        if(bigDecimal6 == null){
+                        if (bigDecimal6 == null) {
                             continue;
                         }
 
                         if (integer == 1) {
                             sysPremiumDetail.setProportional(oneProportion);
-                        }else if (integer == 2) {
+                        } else if (integer == 2) {
                             sysPremiumDetail.setProportional(twoProportion);
-                        }else if (integer == 3) {
+                        } else if (integer == 3) {
                             sysPremiumDetail.setProportional(threeProportion);
-                        }else if (integer == 4) {
+                        } else if (integer == 4) {
                             sysPremiumDetail.setProportional(fourProportion);
-                        }else if (integer == 5) {
+                        } else if (integer == 5) {
                             sysPremiumDetail.setProportional(fiveProportion);
                         }
                         sysPremiumDetail.setSource(integer);
@@ -413,7 +416,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                         int c = integer;
                         if (sysRelationPerson == null) {
 
-                            for(int a = collect1.indexOf(integer); a < collect1.size(); a++ ){
+                            for (int a = collect1.indexOf(integer); a < collect1.size(); a++) {
                                 System.out.println(a);
                                 Integer integer1 = collect1.get(a);
 
@@ -451,7 +454,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                     }
                 }
             }
-        }catch (Exception e){
+        } catch (Exception e) {
 
         }
 
@@ -461,7 +464,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         String comlevel = sysDept.getComlevel();
         if (StringUtils.isNotEmpty(comlevel) && comlevel.equals("5")) {
             return sysDept.getId();
-        }else {
+        } else {
             SysDept sysDept1 = sysDeptService.getById(sysDept.getParentId());
             return getFiveDeptId(sysDept1);
         }
@@ -1026,15 +1029,15 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             if (accidentInfo.isEmpty()) {
 
                 InsDrivingIntentionInsurance one = insDrivingIntentionInsuranceService.getOne(new LambdaQueryWrapper<InsDrivingIntentionInsurance>()
-                        .and(wrapper-> wrapper
-                            .eq(InsDrivingIntentionInsurance::getProjectCode, insAreaCompanyAccidentalDriving.getRideRiskCode())
-                            .or()
-                            .eq(InsDrivingIntentionInsurance::getRiskCode, insAreaCompanyAccidentalDriving.getRideRiskCode())
+                        .and(wrapper -> wrapper
+                                .eq(InsDrivingIntentionInsurance::getProjectCode, insAreaCompanyAccidentalDriving.getRideRiskCode())
+                                .or()
+                                .eq(InsDrivingIntentionInsurance::getRiskCode, insAreaCompanyAccidentalDriving.getRideRiskCode())
                         )
                         .and(wrapper ->
-                        wrapper.isNull(InsDrivingIntentionInsurance::getSeatNum)
-                            .or()
-                            .eq(InsDrivingIntentionInsurance::getSeatNum, orderAndAreaCompany.getCarinfo().getString("seatCount"))));
+                                wrapper.isNull(InsDrivingIntentionInsurance::getSeatNum)
+                                        .or()
+                                        .eq(InsDrivingIntentionInsurance::getSeatNum, orderAndAreaCompany.getCarinfo().getString("seatCount"))));
                 if (!Objects.isNull(one)) {
                     JSONObject accidentInfoObject = new JSONObject();
                     accidentInfoObject.put("name", one.getProjectName());
@@ -1614,7 +1617,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         if (InsuranceEnum.YAIC.getCode().equals(orderAndAreaCompany.getCompanyId().substring(0, 4))) {
             JSONObject reptxt = orderAndAreaCompany.getReptxt();
             // add by  hxl  2024-10-14   处理永安财险查询报错
-            if(reptxt!=null){
+            if (reptxt != null) {
                 ResponseDataC2 responseDataC2 = JSON.toJavaObject(reptxt, ResponseDataC2.class);
                 List<ExtendInfoDto> extendInfoDtos = responseDataC2.getResponseBody().getExtendInfo();
                 Map<String, String> stringStringMap = extendInfoDtos.stream().collect(LinkedHashMap::new,
@@ -1622,7 +1625,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                                 v.getValue()), LinkedHashMap::putAll);
                 yaExtendInfoDto = new YaExtendInfoDto(stringStringMap);
                 orderAndAreaCompany.setExtendInfo(yaExtendInfoDto);
-            }else{
+            } else {
                 orderAndAreaCompany.setExtendInfo(new HashMap<String, String>());
             }
 
@@ -1732,11 +1735,11 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             return baseQuoteVo;
         }
 
-        if(baseQuoteVo.getAccidentalDrivingVo().getParentId()!= null && !baseQuoteVo.getAccidentalDrivingVo().getParentId().equals("")
-            && !baseQuoteVo.getAccidentalDrivingVo().getParentId().equals("0")){
+        if (baseQuoteVo.getAccidentalDrivingVo().getParentId() != null && !baseQuoteVo.getAccidentalDrivingVo().getParentId().equals("")
+                && !baseQuoteVo.getAccidentalDrivingVo().getParentId().equals("0")) {
             //查父级属性
             InsDrivingIntentionInsurance byProjectCode = insDrivingIntentionInsuranceService.getById(baseQuoteVo.getAccidentalDrivingVo().getParentId());
-            if(!Objects.isNull(byProjectCode)) {
+            if (!Objects.isNull(byProjectCode)) {
                 baseQuoteVo.getAccidentalDrivingVo().setParentCode(byProjectCode.getProjectCode());
                 baseQuoteVo.getAccidentalDrivingVo().setParentName(byProjectCode.getProjectName());
             }
@@ -1755,7 +1758,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             guoRenBaseQuoteVo.getAccidentalDrivingVo().setProdCode(baseQuoteVo.getAccidentalDrivingVo().getProjectCode());
             guoRenBaseQuoteVo.getAccidentalDrivingVo().setGoodsCode(baseQuoteVo.getAccidentalDrivingVo().getParentCode());
             guoRenBaseQuoteVo.getAccidentalDrivingVo().setGoodsName(baseQuoteVo.getAccidentalDrivingVo().getParentName());
-            InsDrivingIntentionInsurance byProjectCode = insDrivingIntentionInsuranceService.getByProjectCode(baseQuoteVo.getCompanyId(), baseQuoteVo.getAccidentalDrivingVo().getProjectCode(),baseQuoteVo.getSeatNum());
+            InsDrivingIntentionInsurance byProjectCode = insDrivingIntentionInsuranceService.getByProjectCode(baseQuoteVo.getCompanyId(), baseQuoteVo.getAccidentalDrivingVo().getProjectCode(), baseQuoteVo.getSeatNum());
             guoRenBaseQuoteVo.getAccidentalDrivingVo().setRiskCode(byProjectCode.getRiskCode());
             guoRenBaseQuoteVo.getAccidentalDrivingVo().setQuantity(baseQuoteVo.getAccidentalDrivingVo().getQuantity());
             return guoRenBaseQuoteVo;
@@ -1887,7 +1890,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             InsDrivingIntentionInsurance byProjectCode = insDrivingIntentionInsuranceService.getByProjectCode(baseQuoteVo.getCompanyId(), baseQuoteVo.getAccidentalDrivingVo().getProjectCode(), baseQuoteVo.getSeatNum());
             chengtaiBaseQuoteVo.setAccidentalDrivingVo(JSONObject.parseObject(byProjectCode.getRequestData()));
             return chengtaiBaseQuoteVo;
-        } else if(baseQuoteVo.getCompanyId().equals("CPIC1000000")){
+        } else if (baseQuoteVo.getCompanyId().equals("CPIC1000000")) {
             // 太平洋财险
             BaseQuoteVo<Object> taiPingYangBaseQuoteVo = new BaseQuoteVo<>();
             BeanUtils.copyProperties(baseQuoteVo, taiPingYangBaseQuoteVo);
@@ -2324,11 +2327,12 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         insAreaCompanyService.insertCompanyAndOrders(insAreaCompany, insAreaCompanyAccidentalDriving);
         return true;
     }
+
     /**
-     *  @version
-     *  @author: hxl
-     *  @Date: 2024/10/17 10:53
-     *  @Description:  查詢已承保
+     * @version
+     * @author: hxl
+     * @Date: 2024/10/17 10:53
+     * @Description: 查詢已承保
      */
     @Override
     public BasePageResult<InsOrders> queryPageOrderCB(OrderQueryVo orderQueryVo) {
@@ -2357,12 +2361,12 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
     @Override
     public boolean delExternalOrder(InsOrdersEditingVo insOrdersEditingVo) {
         InsOrders externalOrder = baseMapper.selectOne(new LambdaQueryWrapper<InsOrders>()
-                .eq(InsOrders::getOrderno,insOrdersEditingVo.getOrderno())
+                .eq(InsOrders::getOrderno, insOrdersEditingVo.getOrderno())
                 .isNull(InsOrders::getDelFlag)
-                .eq(InsOrders::getOrderstatus,"0")
-                .eq(InsOrders::getEntryStatus,"3"));
+                .eq(InsOrders::getOrderstatus, "0")
+                .eq(InsOrders::getEntryStatus, "3"));
 
-        if(externalOrder == null){
+        if (externalOrder == null) {
             throw new SystemException("未找到暂存订单");
         }
         //设置删除标识
@@ -2380,7 +2384,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
 
         // 更新维护人
         String s = Optional.ofNullable(sysUser).map(SysUser::getLeaderId).orElse(null);
-        if(StringUtils.isNotEmpty(s)){
+        if (StringUtils.isNotEmpty(s)) {
             insAreaCompany.setLeaderId(sysUser.getLeaderId());
             insAreaCompany.setLeaderName(sysUser.getLeaderName());
         }
@@ -2426,4 +2430,67 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         newOrderObj.remove("createtime");
         return oldOrderObj.equals(newOrderObj);
     }
+
+    @Override
+    public String exportTaskPoolData(OrderQueryVo orderQueryVo, OrderLinkTypeConstants orderLinkTypeConstants) {
+        //添加收回按钮的操作
+        Boolean flag = false;
+
+        List<String> agentUserIds = new ArrayList<>();
+        List<String> agreeIds = new ArrayList<>();
+        String signStartDateStr = orderQueryVo.getSignStartDateStr();
+        String signEndDateStr = orderQueryVo.getSignEndDateStr();
+
+        if (!InsOrderStatusEnum.ACCEPT_INSURANCE.getCode().equals(orderQueryVo.getOrderStatus())) {
+            throw new SystemException("只允许导出已承保数据");
+        }
+
+        if (StringUtils.isEmpty(signStartDateStr) || StringUtils.isEmpty(signEndDateStr)) {
+            throw new SystemException("1.导出数据时,签单时间必填;2.选择的签单时间(开始日期-结束日期)>30天,导出时,按结束时间往前+30天的数据做导出");
+        }
+
+        final int day = 30;
+        DateTimeFormatter pattern = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        LocalDate startDate = LocalDate.parse(signStartDateStr, pattern);
+        LocalDate endDate = LocalDate.parse(signStartDateStr, pattern);
+        long between = ChronoUnit.DAYS.between(startDate, endDate);
+        if (between > day) {
+            LocalDate localDate = endDate.minusDays(day);
+            orderQueryVo.setSignStartDateStr(localDate.format(pattern));
+        }
+
+        switch (orderLinkTypeConstants) {
+            case ORDER_LINK_TYPE_CONSTANTS_1:
+                agentUserIds = sysUserService.getUserIdsByLeaderId(orderQueryVo.getUserId());
+                break;
+            case ORDER_LINK_TYPE_CONSTANTS_2:
+                //查询所有的代理人
+                //查询绑定的区域的代理人信息
+                List<String> areaCodes = sysUserLinkAreaMapper.findAreaCodeByUserId(orderQueryVo.getUserId());
+                if (areaCodes != null && !areaCodes.isEmpty()) {
+                    agentUserIds = sysUserLinkAreaMapper.findAreaIdsByAgentUserId(orderQueryVo.getUserId(), areaCodes);
+                }
+                break;
+            case ORDER_LINK_TYPE_CONSTANTS_3:
+                //查询用户关联的协议
+                List<SysUserLinkPtlAgreementDto> ptlAgreementListByUserIds =
+                        sysUserLinkPtlAgreementMapper.findPtlAgreementListByUserId(orderQueryVo.getUserId());
+                if (ptlAgreementListByUserIds != null && !ptlAgreementListByUserIds.isEmpty()) {
+                    agreeIds = ptlAgreementListByUserIds.stream().map(sysUserLinkPtlAgreementDto -> sysUserLinkPtlAgreementDto.getPtlAgreement().getId()).collect(Collectors.toList());
+                }
+                break;
+            case ORDER_LINK_TYPE_CONSTANTS_4:
+                agentUserIds = sysUserService.getTelemarketingPersonnelData();
+                break;
+        }
+
+        if (agentUserIds != null && !agentUserIds.isEmpty() || !agreeIds.isEmpty()) {
+            List<InsOrders> insOrders = baseMapper.queryOrderByLinkType(orderQueryVo, agentUserIds, agreeIds, orderLinkTypeConstants.getCode(), flag);
+            List<TaskPoolDataExcelDto> collect = insOrders.stream().map(TaskPoolDataExcelDto::new).collect(Collectors.toList());
+            String s = EasyExcelUtils.downExcel(uploadFilePath + "task-pool/", orderLinkTypeConstants.getDesc(), orderLinkTypeConstants.getDesc(), TaskPoolDataExcelDto.class, collect);
+            return s.replace(uploadFilePath, uploadUrlPath);
+        }
+
+        throw new SystemException("文件导出失败");
+    }
 }

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

@@ -1828,4 +1828,219 @@
         </if>
     </select>
 
+    <select id="queryOrderByLinkType" resultType="com.ydtech.modules.order.entity.InsOrders">
+        select
+        io.orderno as orderno,
+        io.quoteno as quoteno,
+        iac.orderstatus as orderstatus,
+        io.carinfo as carinfo,
+        io.userid as userid,
+        io.username as username,
+        io.deptid as deptid,
+        io.deptname as deptname,
+        io.ownerinfo as ownerinfo,
+        io.applyinfo as applyinfo,
+        io.insureinfo as insureinfo,
+        io.agreeid as agreeid,
+        iac.productid as productid,
+        iac.product as product,
+        iac.createtime as createtime,
+        io.frameno as frameno,
+        io.licenseno as licenseno,
+        REPLACE(JSON_EXTRACT(io.applyinfo, '$.name'),'"','') as insuredname,
+        iac.jq_start_date as jqstartdate,
+        iac.jq_end_date as jqenddate,
+        iac.sy_start_date as systartdate,
+        iac.sy_end_date as syenddate,
+        iac.jqpremium as jqpremium,
+        iac.sypremium as sypremium,
+        iac.jypremium as jypremium,
+        iac.taxamount as taxamount,
+        io.risk as risk,
+        io.king as king,
+        io.vehicle_and_vessel_tax as vehicleAndVesselTax,
+        iac.id as subOrderId,
+        iac.underwriting_status as underwritingStatus,
+        iac.company_id as company_id,
+        iac.inscompany as ins_company,
+        agree.agreement_code as agreementCode,
+        agree.agreement_name as agreementName,
+        company.namesimple as partnerCompaniesName,
+        dept.province,
+        dept.city,
+        dept.area,
+        d1.area_cname as province_name,
+        d2.area_cname as city_name,
+        d3.area_cname as area_name,
+        concat(d1.area_cname,d2.area_cname,d3.area_cname) as area_info,
+        iac.api_type,
+        io.is_external,
+        u.leader_name,
+        u.leader_id,
+        CASE dept.management_source
+        WHEN '1' THEN '渠道'
+        WHEN '2' THEN '个代'
+        WHEN '3' THEN '电销'
+        ELSE '' END
+        AS managementSource,
+        io.entry_status as entryStatus,
+        iac.underwriting_time as underwritingTime,
+        iac.pay_date as payDate,
+        iac.update_status AS updateStatus,
+        iac.update_status_time AS updateStatusTime,
+        iac.signing_time as signingTime
+        from
+        ins_area_company iac
+        left JOIN
+        ins_orders io on iac.orderno = io.orderno
+        left join
+        ptl_agreement agree on iac.agreement_id= agree.id
+        left join
+        esm_ins_company company on agree.partner_companies_id= company.id
+        LEFT JOIN
+        sys_dept dept ON dept.id = io.deptid
+        LEFT JOIN sys_dept pdept on dept.parent_id = pdept.id
+        LEFT JOIN sys_area d1 ON d1.area_code = pdept.province
+        LEFT JOIN sys_area d2 ON d2.area_code = pdept.city
+        LEFT JOIN sys_area d3 ON d3.area_code = pdept.area
+        LEFT JOIN
+        sys_user u on io.userid = u.id
+        <where>
+            <if test="agentUserIds != null and agentUserIds.size>0">
+                AND (
+                (io.userid in
+                <foreach collection="agentUserIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+                AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} )
+                )
+                <if test="flag">
+                    OR iac.operator_id = #{orderQueryVo.userId}
+                </if>
+                )
+            </if>
+            <if test="agreeIds != null and agreeIds.size>0">
+                AND (
+                (iac.agreement_id in
+                <foreach collection="agreeIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+                AND ( iac.new_operator_id IS NULL OR iac.new_operator_id = #{orderQueryVo.userId} ) )
+                <if test="flag">
+                    OR iac.operator_id = #{orderQueryVo.userId}
+                </if>
+                )
+            </if>
+            <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
+                and iac.id = #{orderQueryVo.orderNo}
+            </if>
+            <if test="orderQueryVo.managementSource != null and orderQueryVo.managementSource != ''">
+                and dept.management_source = #{orderQueryVo.managementSource}
+            </if>
+            <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
+                and io.deptid like "${orderQueryVo.deptId}%"
+            </if>
+            <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
+                and iac.orderstatus= #{orderQueryVo.orderStatus}
+            </if>
+            <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
+                and io.frameno = #{orderQueryVo.frameNo}
+            </if>
+            <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
+                and io.licenseno = #{orderQueryVo.licenseNo}
+            </if>
+            <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
+                and REPLACE(JSON_EXTRACT(io.applyinfo, '$.name'),'"','') = #{orderQueryVo.insuredName}
+            </if>
+            <if test="orderQueryVo.quoteStartDateStr != null and orderQueryVo.quoteEndDateStr != null">
+                and DATE_FORMAT(iac.createtime, '%Y-%m-%d') between #{orderQueryVo.quoteStartDateStr} AND
+                #{orderQueryVo.quoteEndDateStr}
+            </if>
+            <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
+                and iac.company_id = #{orderQueryVo.companyId}
+            </if>
+            <if test="orderQueryVo.operatorId != null and orderQueryVo.operatorId != ''">
+                and io.userid = #{orderQueryVo.operatorId}
+            </if>
+            <if test="orderQueryVo.operatorName != null and orderQueryVo.operatorName != ''">
+                and io.username = #{orderQueryVo.operatorName}
+            </if>
+            <if test="orderQueryVo.engineNo != null and orderQueryVo.engineNo != ''">
+                and JSON_EXTRACT( io.carinfo, '$.engineNo' ) = #{orderQueryVo.engineNo}
+            </if>
+            <if test="orderQueryVo.provinceId != null and orderQueryVo.provinceId != ''">
+                and io.deptid like "${orderQueryVo.provinceId}%"
+            </if>
+            <if test="orderQueryVo.cityId != null and orderQueryVo.cityId != ''">
+                and io.deptid like "${orderQueryVo.cityId}%"
+            </if>
+            <if test="orderQueryVo.countyId != null and orderQueryVo.countyId != ''">
+                and io.deptid like "${orderQueryVo.countyId}%"
+            </if>
+            <if test="orderQueryVo.houseId != null and orderQueryVo.houseId != ''">
+                and io.deptid like "${orderQueryVo.houseId}%"
+            </if>
+            <if test="orderQueryVo.agreeId != null and orderQueryVo.agreeId != ''">
+                and iac.agreement_id = #{orderQueryVo.agreeId}
+            </if>
+            <if test="orderQueryVo.taskNo != null and orderQueryVo.taskNo != ''">
+                and io.orderno = #{orderQueryVo.taskNo}
+            </if>
+            <if test="orderQueryVo.riskCode != null and orderQueryVo.riskCode != ''">
+                and iac.product = #{orderQueryVo.riskCode}
+            </if>
+            <if test="orderQueryVo.auditId != null and orderQueryVo.auditId != ''">
+                and IFNULL( iac.new_operator_id, '' ) = #{orderQueryVo.auditId}
+            </if>
+            <if test="orderQueryVo.leaderId != null and orderQueryVo.leaderId != ''">
+                and u.leader_id = #{orderQueryVo.leaderId}
+            </if>
+            <if test="orderQueryVo.leaderName != null and orderQueryVo.leaderName != ''">
+                and u.leader_name = #{orderQueryVo.leaderName}
+            </if>
+            <if test="orderQueryVo.attachStartDateStr != null and orderQueryVo.attachEndDateStr != ''">
+                and ((
+                DATE_FORMAT(iac.jq_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr}
+                AND #{orderQueryVo.attachEndDateStr}
+                )
+                OR ( DATE_FORMAT(iac.sy_start_date, '%Y-%m-%d') BETWEEN #{orderQueryVo.attachStartDateStr} AND
+                #{orderQueryVo.attachEndDateStr} )
+                )
+            </if>
+            <choose>
+                <when test="type==1">
+                    and dept.management_source=1
+                </when>
+                <when test="type==2">
+                    and dept.management_source=2
+                </when>
+            </choose>
+            <if test="orderQueryVo.signStartDateStr != null and orderQueryVo.signEndDateStr != null">
+                and DATE_FORMAT(iac.signing_time, '%Y-%m-%d') between #{orderQueryVo.signStartDateStr} AND
+                #{orderQueryVo.signEndDateStr}
+            </if>
+            <if test="orderQueryVo.entryStatus != null and orderQueryVo.entryStatus != ''">
+                and io.entry_status = #{orderQueryVo.entryStatus }
+            </if>
+            <if test="orderQueryVo.payStartDateStr != null and orderQueryVo.payEndDateStr != null">
+                and DATE_FORMAT(iac.pay_date, '%Y-%m-%d') between #{orderQueryVo.payStartDateStr} AND
+                #{orderQueryVo.payEndDateStr}
+            </if>
+
+            <if test="orderQueryVo.auditStartDateStr != null and orderQueryVo.auditEndDateStr != null">
+                and DATE_FORMAT(iac.underwriting_time, '%Y-%m-%d') between #{orderQueryVo.auditStartDateStr} AND
+                #{orderQueryVo.auditEndDateStr}
+            </if>
+            <if test="orderQueryVo.updateStartDateStr != null and orderQueryVo.updateEndDateStr != null">
+                and DATE_FORMAT( iac.update_status_time, '%Y-%m-%d') between #{orderQueryVo.updateStartDateStr} AND
+                #{orderQueryVo.updateEndDateStr}
+            </if>
+            <if test="orderQueryVo.updateStatus != null and orderQueryVo.updateStatus != null">
+                and iac.update_status = #{orderQueryVo.updateStatus}
+            </if>
+            and (iac.del_flag = '1' or io.del_flag IS NULL or io.del_flag = 1)
+        </where>
+        order by io.createtime desc
+    </select>
+
 </mapper>

+ 3 - 4
src/main/resources/template/html/qrcode_error.html

@@ -2,13 +2,12 @@
 <html lang="en">
 <head>
     <meta charset="UTF-8">
-    <title>二维码不存在</title>
+    <title>二维码异常</title>
     <div style="display: flex;">
-        二维码错误
+        <span th:if="${message != '' && message != null}" th:text="${message}"></span>
+        <span th:unless="${message != '' || message != null}">二维码异常</span>
     </div>
-
 </head>
 <body>
-
 </body>
 </html>