Эх сурвалжийг харах

Merge remote-tracking branch 'origin/test' into test

785834757 2 жил өмнө
parent
commit
9da4122185
69 өөрчлөгдсөн 3902 нэмэгдсэн , 586 устгасан
  1. 35 4
      src/main/java/com/ydtech/modules/admin/controller/CompanyDataReportConroller.java
  2. 11 2
      src/main/java/com/ydtech/modules/admin/controller/SysDeptController.java
  3. 4 29
      src/main/java/com/ydtech/modules/admin/controller/SysTelemarketingController.java
  4. 18 13
      src/main/java/com/ydtech/modules/admin/controller/websocket/SysGeographyPositionController.java
  5. 3 1
      src/main/java/com/ydtech/modules/admin/controller/websocket/WebSocketServer.java
  6. 3 1
      src/main/java/com/ydtech/modules/admin/dao/DeptBalanceMapper.java
  7. 11 0
      src/main/java/com/ydtech/modules/admin/dao/SysAgencyLeaderMapper.java
  8. 8 0
      src/main/java/com/ydtech/modules/admin/dao/SysRelationPersonMapper.java
  9. 17 3
      src/main/java/com/ydtech/modules/admin/dao/SysUserMapper.java
  10. 7 1
      src/main/java/com/ydtech/modules/admin/model/SysAgencyLeader.java
  11. 11 1
      src/main/java/com/ydtech/modules/admin/model/SysGeographyPosition.java
  12. 11 1
      src/main/java/com/ydtech/modules/admin/model/SysGeographyPositionRecord.java
  13. 30 2
      src/main/java/com/ydtech/modules/admin/model/dto/DeptBalanceDto.java
  14. 21 2
      src/main/java/com/ydtech/modules/admin/model/dto/QxFrontlineAgentDto.java
  15. 17 0
      src/main/java/com/ydtech/modules/admin/model/dto/SysGeographyPositionPageDto.java
  16. 2 1
      src/main/java/com/ydtech/modules/admin/model/dto/SysPartnerConsoleDto.java
  17. 33 0
      src/main/java/com/ydtech/modules/admin/model/report/company/CompanyQutationCountDataDto.java
  18. 32 0
      src/main/java/com/ydtech/modules/admin/model/report/company/OrdersDataDto.java
  19. 3 0
      src/main/java/com/ydtech/modules/admin/model/report/profitAnalysis/ProfitAnalysisQueryDto.java
  20. 59 0
      src/main/java/com/ydtech/modules/admin/model/vo/OrdersDataVo.java
  21. 6 0
      src/main/java/com/ydtech/modules/admin/model/vo/QxFrontlineAgentVo.java
  22. 5 0
      src/main/java/com/ydtech/modules/admin/model/vo/SysUserBaseVO.java
  23. 17 4
      src/main/java/com/ydtech/modules/admin/service/CompanyDataReportService.java
  24. 4 2
      src/main/java/com/ydtech/modules/admin/service/SysGeographyPositionService.java
  25. 25 1
      src/main/java/com/ydtech/modules/admin/service/SysTelemarketingWechatDataService.java
  26. 1 1
      src/main/java/com/ydtech/modules/admin/service/SysUserService.java
  27. 90 4
      src/main/java/com/ydtech/modules/admin/service/impl/CompanyDataReportServiceImpl.java
  28. 95 50
      src/main/java/com/ydtech/modules/admin/service/impl/DeptBalanceServiceImpl.java
  29. 22 12
      src/main/java/com/ydtech/modules/admin/service/impl/SysGeographyPositionServiceImpl.java
  30. 50 5
      src/main/java/com/ydtech/modules/admin/service/impl/SysTelemarketingWechatDataServiceImpl.java
  31. 2 3
      src/main/java/com/ydtech/modules/admin/service/impl/SysUserServiceImpl.java
  32. 4 0
      src/main/java/com/ydtech/modules/admin/service/impl/TaskStatisticsServiceImpl.java
  33. 307 297
      src/main/java/com/ydtech/modules/admin/service/impl/UserReportServiceImpl.java
  34. 18 0
      src/main/java/com/ydtech/modules/esm/dao/EsmUserReferrerMapper.java
  35. 18 0
      src/main/java/com/ydtech/modules/fee/dao/InsFeeOrderNewHistoryMapper.java
  36. 1151 0
      src/main/java/com/ydtech/modules/fee/entity/po/InsFeeOrderNewHistory.java
  37. 8 0
      src/main/java/com/ydtech/modules/fee/service/FeeRuleSchemeNewService.java
  38. 38 0
      src/main/java/com/ydtech/modules/fee/service/InsFeeOrderNewHistoryService.java
  39. 470 0
      src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java
  40. 53 0
      src/main/java/com/ydtech/modules/fee/service/impl/InsFeeOrderNewHistoryServiceImpl.java
  41. 62 37
      src/main/java/com/ydtech/modules/order/aop/aspect/QuoteVerificationAspect.java
  42. 4 4
      src/main/java/com/ydtech/modules/order/controller/InsTelemarketingOrderController.java
  43. 18 0
      src/main/java/com/ydtech/modules/order/dao/InsAreaCompanyErrorMapper.java
  44. 48 4
      src/main/java/com/ydtech/modules/order/dao/InsAreaCompanyMapper.java
  45. 3 1
      src/main/java/com/ydtech/modules/order/entity/InsAreaCompany.java
  46. 12 0
      src/main/java/com/ydtech/modules/order/entity/crawler/response/CrawlerQuoteResponse.java
  47. 141 0
      src/main/java/com/ydtech/modules/order/entity/po/InsAreaCompanyError.java
  48. 13 0
      src/main/java/com/ydtech/modules/order/entity/vo/SubmitExportFeesVo.java
  49. 1 0
      src/main/java/com/ydtech/modules/order/entity/vo/telemarketing/TelemarketingAuditOrderEditVo.java
  50. 2 0
      src/main/java/com/ydtech/modules/order/entity/vo/telemarketing/TelemarketingAuditOrderQueryVo.java
  51. 24 0
      src/main/java/com/ydtech/modules/order/entity/vo/telemarketing/TelemarketingQueryExpensesVo.java
  52. 13 0
      src/main/java/com/ydtech/modules/order/service/InsAreaCompanyErrorService.java
  53. 7 1
      src/main/java/com/ydtech/modules/order/service/InsAreaCompanyService.java
  54. 3 2
      src/main/java/com/ydtech/modules/order/service/InsTelemarketingOrderService.java
  55. 22 0
      src/main/java/com/ydtech/modules/order/service/impl/InsAreaCompanyErrorServiceImpl.java
  56. 10 0
      src/main/java/com/ydtech/modules/order/service/impl/InsAreaCompanyServiceImpl.java
  57. 3 0
      src/main/java/com/ydtech/modules/order/service/impl/InsCrawlerOrderServiceImpl.java
  58. 1 1
      src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java
  59. 31 18
      src/main/java/com/ydtech/modules/order/service/impl/InsTelemarketingOrderServiceImpl.java
  60. 13 13
      src/main/resources/mapper/modules/admin/DeptBalanceMapper.xml
  61. 35 0
      src/main/resources/mapper/modules/admin/SysAgencyLeaderMapper.xml
  62. 2 5
      src/main/resources/mapper/modules/admin/SysPartnerMapper.xml
  63. 10 0
      src/main/resources/mapper/modules/admin/SysRelationPersonMapper.xml
  64. 51 4
      src/main/resources/mapper/modules/admin/SysUserMapper.xml
  65. 43 0
      src/main/resources/mapper/modules/esm/EsmUserReferrerMapper.xml
  66. 175 0
      src/main/resources/mapper/modules/fee/InsFeeOrderNewHistoryMapper.xml
  67. 27 0
      src/main/resources/mapper/modules/order/InsAreaCompanyErrorMapper.xml
  68. 404 56
      src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml
  69. 4 0
      src/main/resources/mapper/modules/order/InsOrdersMapper.xml

+ 35 - 4
src/main/java/com/ydtech/modules/admin/controller/CompanyDataReportConroller.java

@@ -1,10 +1,8 @@
 package com.ydtech.modules.admin.controller;
 package com.ydtech.modules.admin.controller;
 
 
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.HttpResult;
-import com.ydtech.modules.admin.model.report.company.CompanyPremiumDataDto;
-import com.ydtech.modules.admin.model.report.company.CompanyPremiumDataQueryDto;
-import com.ydtech.modules.admin.model.report.company.CompanyQutationCountDataDto;
-import com.ydtech.modules.admin.model.report.company.CompanyQutationCountDataQueryDto;
+import com.ydtech.modules.admin.model.report.company.*;
+import com.ydtech.modules.admin.model.vo.OrdersDataVo;
 import com.ydtech.modules.admin.service.CompanyDataReportService;
 import com.ydtech.modules.admin.service.CompanyDataReportService;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.order.entity.BasePageResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
@@ -61,4 +59,37 @@ public class CompanyDataReportConroller {
             return HttpResult.error("查询错误"+e.getMessage());
             return HttpResult.error("查询错误"+e.getMessage());
         }
         }
     }
     }
+
+    /**
+     *  @version
+     *  @author: whp
+     *  @Date: 2024/8/31 15:35
+     *  @Description:   查询控制台大订单
+     */
+    @PostMapping("querOrdersDataPage")
+    @ApiOperation(value = "查询控制台大订单")
+    public HttpResult<BasePageResult<OrdersDataDto>> querOrdersDataPage(@RequestBody OrdersDataVo ordersDataVo) {
+        try{
+            BasePageResult<OrdersDataDto> result = companyDataReportService.querOrdersDataPage(ordersDataVo);
+            return HttpResult.ok("查询数据成功", result);
+        }catch (Exception e){
+            return HttpResult.error("查询错误"+e.getMessage());
+        }
+    }
+    /**
+     *  @version
+     *  @author: whp
+     *  @Date: 2024/8/31 15:35
+     *  @Description:   查询控制台大订合计
+     */
+    @PostMapping("querOrdersamountTo")
+    @ApiOperation(value = "查询控制台大订单合计")
+    public HttpResult<OrdersDataDto> querOrdersamountTo(@RequestBody OrdersDataVo ordersDataVo) {
+        try{
+            OrdersDataDto result = companyDataReportService.querOrdersamountTo(ordersDataVo);
+            return HttpResult.ok("查询数据成功", result);
+        }catch (Exception e){
+            return HttpResult.error("查询错误"+e.getMessage());
+        }
+    }
 }
 }

+ 11 - 2
src/main/java/com/ydtech/modules/admin/controller/SysDeptController.java

@@ -154,10 +154,19 @@ public class SysDeptController extends BaseController {
      */
      */
     @ApiOperation(value = "获取所有的树结构")
     @ApiOperation(value = "获取所有的树结构")
     @GetMapping(value = "/findAllTree")
     @GetMapping(value = "/findAllTree")
-    public HttpResult<List<SysDept>> findAllTree() {
+    public HttpResult<List<SysDept>> findAllTree(String deptId) {
+        if(deptId==null || "".equals(deptId)){
+            deptId="9";
+        }else{
+            //如果是平台下判断包含D的查询上级id
+            if(deptId.contains("D")){
+               SysDept dept = sysDeptService.getById(deptId);
+                deptId =dept==null?"":dept.getParentId();
+            }
+        }
         LambdaQueryWrapper<SysDept> queryWrapper = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<SysDept> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(SysDept::getDelFlag, 0);
         queryWrapper.eq(SysDept::getDelFlag, 0);
-        return HttpResult.ok(sysDeptService.findTree("9",null));
+        return HttpResult.ok(sysDeptService.findTree(deptId,null));
     }
     }
     @ApiOperation(value = "省市区门店列表查询 省级parentId=99 市县传值上级id,level传值省市县门店1,2,3,4")
     @ApiOperation(value = "省市区门店列表查询 省级parentId=99 市县传值上级id,level传值省市县门店1,2,3,4")
     @GetMapping(value = "/queryListByParentId/{level}/{parentId}")
     @GetMapping(value = "/queryListByParentId/{level}/{parentId}")

+ 4 - 29
src/main/java/com/ydtech/modules/admin/controller/SysTelemarketingController.java

@@ -29,46 +29,21 @@ public class SysTelemarketingController {
     @PostMapping("/page")
     @PostMapping("/page")
     @ApiOperation("电销数据分页查询")
     @ApiOperation("电销数据分页查询")
     public HttpResult<BasePageResult<SysTelemarketingWechatData>> page(@RequestBody SysTelemarketingWechatDataVo sysTelemarketingWechatDataVo) {
     public HttpResult<BasePageResult<SysTelemarketingWechatData>> page(@RequestBody SysTelemarketingWechatDataVo sysTelemarketingWechatDataVo) {
-        Page<SysTelemarketingWechatData> page = new Page<>(sysTelemarketingWechatDataVo.getPageNum(), sysTelemarketingWechatDataVo.getPageSize());
-        String userId = BaseController.getUserId();
-        Page<SysTelemarketingWechatData> sysTelemarketingWechatDataPage = sysTelemarketingWechatDataService
-                .lambdaQuery()
-                .eq(SysTelemarketingWechatData::getUserId, userId)
-                .page(page);
-
-        BasePageResult<SysTelemarketingWechatData> basePageResult = new BasePageResult<>(
-                sysTelemarketingWechatDataVo.getPageNum(),
-                sysTelemarketingWechatDataVo.getPageSize(),
-                sysTelemarketingWechatDataPage.getTotal(),
-                sysTelemarketingWechatDataPage.getPages(),
-                sysTelemarketingWechatDataPage.getRecords());
-
+        BasePageResult<SysTelemarketingWechatData> basePageResult = sysTelemarketingWechatDataService.pageQuery(sysTelemarketingWechatDataVo);
         return HttpResult.ok(basePageResult);
         return HttpResult.ok(basePageResult);
     }
     }
 
 
     @PostMapping
     @PostMapping
     @ApiOperation("电销数据添加")
     @ApiOperation("电销数据添加")
     public HttpResult<Object> add(@RequestBody SysTelemarketingWechatDataSaveVo sysTelemarketingWechatDataSaveVo) {
     public HttpResult<Object> add(@RequestBody SysTelemarketingWechatDataSaveVo sysTelemarketingWechatDataSaveVo) {
-
-        sysTelemarketingWechatDataService.checkData(sysTelemarketingWechatDataSaveVo.getCreateTime());
-
-        SysTelemarketingWechatData sysTelemarketingWechatData = new SysTelemarketingWechatData();
-        BeanUtils.copyProperties(sysTelemarketingWechatDataSaveVo, sysTelemarketingWechatData);
-        String userId = BaseController.getUserId();
-        sysTelemarketingWechatData.setUserId(userId);
-        boolean save = sysTelemarketingWechatDataService.save(sysTelemarketingWechatData);
-        AssertionUtils.isSucceed(save, "添加失败");
+        sysTelemarketingWechatDataService.add(sysTelemarketingWechatDataSaveVo);
         return HttpResult.ok("添加成功");
         return HttpResult.ok("添加成功");
     }
     }
 
 
     @PutMapping("{telemarketingId}")
     @PutMapping("{telemarketingId}")
-    @ApiOperation("电销数据添加")
+    @ApiOperation("电销数据修改")
     public HttpResult<Object> revise(@RequestBody SysTelemarketingWechatDataSaveVo sysTelemarketingWechatDataSaveVo, @PathVariable String telemarketingId) {
     public HttpResult<Object> revise(@RequestBody SysTelemarketingWechatDataSaveVo sysTelemarketingWechatDataSaveVo, @PathVariable String telemarketingId) {
-        SysTelemarketingWechatData sysTelemarketingWechatData = sysTelemarketingWechatDataService.getByIdExist(telemarketingId, "查询不到此数据");
-        BeanUtils.copyProperties(sysTelemarketingWechatDataSaveVo, sysTelemarketingWechatData);
-        sysTelemarketingWechatData.setUpdateTime(new Date());
-        boolean b = sysTelemarketingWechatDataService.updateById(sysTelemarketingWechatData);
-        AssertionUtils.isSucceed(b, "修改失败");
+        sysTelemarketingWechatDataService.revise(telemarketingId, sysTelemarketingWechatDataSaveVo);
         return HttpResult.ok("修改成功");
         return HttpResult.ok("修改成功");
     }
     }
 
 

+ 18 - 13
src/main/java/com/ydtech/modules/admin/controller/websocket/SysGeographyPositionController.java

@@ -4,14 +4,12 @@ package com.ydtech.modules.admin.controller.websocket;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.admin.model.SysGeographyPosition;
 import com.ydtech.modules.admin.model.SysGeographyPosition;
 import com.ydtech.modules.admin.model.SysGeographyPositionRecord;
 import com.ydtech.modules.admin.model.SysGeographyPositionRecord;
+import com.ydtech.modules.admin.model.dto.SysGeographyPositionPageDto;
 import com.ydtech.modules.admin.service.SysGeographyPositionService;
 import com.ydtech.modules.admin.service.SysGeographyPositionService;
+import com.ydtech.modules.order.entity.BasePageResult;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.util.List;
 import java.util.List;
@@ -24,16 +22,23 @@ public class SysGeographyPositionController {
     @Resource
     @Resource
     private SysGeographyPositionService sysGeographyPositionService;
     private SysGeographyPositionService sysGeographyPositionService;
 
 
-    @GetMapping("/queryPosition/{userId}")
-    @ApiOperation(value = "查询用户的最新位置")
-    public HttpResult<SysGeographyPosition> queryPosition(@PathVariable("userId") @ApiParam("用户id") String userId) {
-        return HttpResult.ok("success", this.sysGeographyPositionService.queryPosition(userId));
+    @GetMapping("/queryPosition")
+    @ApiOperation(value = "查询所有用户的位置列表")
+    public HttpResult<List<SysGeographyPosition>> queryPosition() {
+
+        return HttpResult.ok("success", this.sysGeographyPositionService.queryPosition());
     }
     }
 
 
-    @GetMapping("/queryPositionList/{userId}")
-    @ApiOperation(value = "查询用户的所有位置")
-    public HttpResult<List<SysGeographyPositionRecord>> queryPositionList(@PathVariable("userId") @ApiParam("用户id") String userId) {
-        return HttpResult.ok("success", this.sysGeographyPositionService.queryPositionList(userId));
+    @PostMapping("/queryPositionList")
+    @ApiOperation(value = "查询单个用户的所有位置")
+    public HttpResult<BasePageResult<SysGeographyPositionRecord>> queryPositionList(@RequestBody SysGeographyPositionPageDto sysGeographyPositionPageDto) {
+        if (sysGeographyPositionPageDto.getPageNum() == 0) {
+            sysGeographyPositionPageDto.setPageNum(1);
+        }
+        if (sysGeographyPositionPageDto.getPageSize() == 0) {
+            sysGeographyPositionPageDto.setPageSize(10);
+        }
+        return HttpResult.ok("success", this.sysGeographyPositionService.queryPositionList(sysGeographyPositionPageDto));
     }
     }
 
 
 
 

+ 3 - 1
src/main/java/com/ydtech/modules/admin/controller/websocket/WebSocketServer.java

@@ -68,14 +68,16 @@ public class WebSocketServer {
         String address = jsonObject.getString("address");
         String address = jsonObject.getString("address");
         saveLocationData(userId, latitude, longitude,address);
         saveLocationData(userId, latitude, longitude,address);
         log.info("服务端收到消息:{} ,主体:{}", message, userId);
         log.info("服务端收到消息:{} ,主体:{}", message, userId);
-        session.getAsyncRemote().sendText("服务端已收到信息:" + message);
+        sendMessage("服务端已收到信息:" +message);
     }
     }
 
 
+
     @OnClose
     @OnClose
     public void onClose(@PathParam("userId") String userId, Session session) {
     public void onClose(@PathParam("userId") String userId, Session session) {
         delStatus(userId);
         delStatus(userId);
         sessionClientMap.remove(userId);
         sessionClientMap.remove(userId);
         log.info("断联成功!");
         log.info("断联成功!");
+        sendMessage("断联成功!");
     }
     }
 
 
     @OnError
     @OnError

+ 3 - 1
src/main/java/com/ydtech/modules/admin/dao/DeptBalanceMapper.java

@@ -9,6 +9,7 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.HashMap;
 
 
 @Mapper
 @Mapper
@@ -27,7 +28,8 @@ public interface DeptBalanceMapper {
      *  @Date: 2024/08/23 9:04
      *  @Date: 2024/08/23 9:04
      *  @Description:  合伙人保费金额
      *  @Description:  合伙人保费金额
      */
      */
-    HashMap<String, BigDecimal> getByDeptId(String deptId);
+    HashMap<String, BigDecimal> getByDeptId(@Param("deptId") String deptId, @Param("createTime")  String createTime);
+
     /**
     /**
      * @version
      * @version
      * @author: whp
      * @author: whp

+ 11 - 0
src/main/java/com/ydtech/modules/admin/dao/SysAgencyLeaderMapper.java

@@ -1,7 +1,11 @@
 package com.ydtech.modules.admin.dao;
 package com.ydtech.modules.admin.dao;
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.modules.admin.model.SysAgencyLeader;
 import com.ydtech.modules.admin.model.SysAgencyLeader;
+import com.ydtech.modules.admin.model.dto.DeptBalanceDto;
+import com.ydtech.modules.admin.model.vo.DeptBalanceVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 
 
@@ -17,5 +21,12 @@ import java.util.List;
 public interface SysAgencyLeaderMapper extends BaseMapper<SysAgencyLeader> {
 public interface SysAgencyLeaderMapper extends BaseMapper<SysAgencyLeader> {
 
 
     List<SysAgencyLeader> getByUserIdList( @Param("userIds") List<String> collect);
     List<SysAgencyLeader> getByUserIdList( @Param("userIds") List<String> collect);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/31 12:42
+     *  @Description: 分页查询机构负责人
+     */
+    IPage<DeptBalanceDto> queryPage(Page page, @Param("vo") DeptBalanceVo deptBalanceVo);
 }
 }
 
 

+ 8 - 0
src/main/java/com/ydtech/modules/admin/dao/SysRelationPersonMapper.java

@@ -2,6 +2,7 @@ package com.ydtech.modules.admin.dao;
 
 
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.admin.model.SysAgencyLeader;
 import com.ydtech.modules.admin.model.SysRelationPerson;
 import com.ydtech.modules.admin.model.SysRelationPerson;
 import com.ydtech.modules.admin.model.dto.SysPartnerConsoleDto;
 import com.ydtech.modules.admin.model.dto.SysPartnerConsoleDto;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Mapper;
@@ -23,5 +24,12 @@ public interface SysRelationPersonMapper extends BaseMapper<SysRelationPerson> {
 
 
     List<SysRelationPerson> getByAgencyLeaderId(String userId);
     List<SysRelationPerson> getByAgencyLeaderId(String userId);
     List<SysPartnerConsoleDto> getBySuggestId( @Param("vo") SysPartnerConsoleDto sysPartnerConsoleDto);
     List<SysPartnerConsoleDto> getBySuggestId( @Param("vo") SysPartnerConsoleDto sysPartnerConsoleDto);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/31 11:24
+     *  @Description:  通过合伙人id和类型查询机构负责人数据
+     */
+    List<SysAgencyLeader> selectListByLeaderId(@Param("userId") String userId, @Param("type") int type);
 }
 }
 
 

+ 17 - 3
src/main/java/com/ydtech/modules/admin/dao/SysUserMapper.java

@@ -27,7 +27,7 @@ import java.util.List;
 @Repository
 @Repository
 public interface SysUserMapper extends BaseMapper<SysUser> {
 public interface SysUserMapper extends BaseMapper<SysUser> {
 
 
-    String userSql = "select t1.id as userId,t1.name as name,t1.mobile as mobile,t1.`status` as `status`,t2.id as deptId,t2.`name` as deptName,sd2.id as pDeptId,sd2.`name` as pDeptName,t4.id as roleId,t4.`name` as roleName " +
+    String userSql = "select t1.id as userId,t1.name as name,t1.mobile as mobile,t1.`status` as `status`,t2.id as deptId,t2.`name` as deptName,sd2.id as pDeptId,sd2.`name` as pDeptName,t4.id as roleId,t4.`name` as roleName ,t1.create_time as createTime " +
             "            from sys_user t1 " +
             "            from sys_user t1 " +
             "			 left join sys_dept t2 on t1.dept_id=t2.id " +
             "			 left join sys_dept t2 on t1.dept_id=t2.id " +
             "            left join sys_dept sd2 on sd2.id=t2.parent_id  " +
             "            left join sys_dept sd2 on sd2.id=t2.parent_id  " +
@@ -438,10 +438,24 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
     /**
     /**
      * 获取电销人员的用户名
      * 获取电销人员的用户名
      *
      *
-     * @param userId 用户名
      * @return 电销人员工号列表
      * @return 电销人员工号列表
      */
      */
-    List<String> getTelemarketingPersonnelUserId(@Param("userId") String userId);
+    List<String> getTelemarketingPersonnelUserId();
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/29 17:52
+     *  @Description: 按照省市区查询数据
+     */
+    List<QxFrontlineAgentDto> queryQxFrontlineAgentList(@Param("vo") QxFrontlineAgentVo qxFrontlineAgentVo);
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/30 18:47
+     *  @Description: 分页查询人员数据
+     */
+    Page<QxFrontlineAgentDto> findUserListByParam(@Param("page") Page page, @Param("vo") QxFrontlineAgentVo qxFrontlineAgentVo);
 }
 }
 
 
 
 

+ 7 - 1
src/main/java/com/ydtech/modules/admin/model/SysAgencyLeader.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.admin.model;
 package com.ydtech.modules.admin.model;
 
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
@@ -65,6 +66,7 @@ public class SysAgencyLeader implements Serializable {
      */
      */
     @ApiModelProperty(value = "抽成比例(总保费抽成)")
     @ApiModelProperty(value = "抽成比例(总保费抽成)")
     private String proportional;
     private String proportional;
+
     @ApiModelProperty(value = "推荐人id")
     @ApiModelProperty(value = "推荐人id")
     private String suggestId;
     private String suggestId;
 
 
@@ -92,6 +94,10 @@ public class SysAgencyLeader implements Serializable {
     private String updateBy;
     private String updateBy;
 
 
 
 
-
+    /***
+     * 机构地址
+     */
+    @TableField(exist = false)
+    private String deptAddress;
 }
 }
 
 

+ 11 - 1
src/main/java/com/ydtech/modules/admin/model/SysGeographyPosition.java

@@ -2,6 +2,8 @@ package com.ydtech.modules.admin.model;
 
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
@@ -19,30 +21,38 @@ public class SysGeographyPosition implements Serializable {
     /**
     /**
      * 员工编号
      * 员工编号
      */
      */
+    @ApiModelProperty(value = "员工编号")
     private String id;
     private String id;
     /**
     /**
      * 员工姓名
      * 员工姓名
      */
      */
+    @ApiModelProperty(value = "员工姓名")
     private String userName;
     private String userName;
     /**
     /**
      * 经度
      * 经度
      */
      */
+    @ApiModelProperty(value = "经度")
     private String longitude;
     private String longitude;
     /**
     /**
      * 纬度
      * 纬度
      */
      */
+    @ApiModelProperty(value = "纬度")
     private String latitude;
     private String latitude;
     /**
     /**
      * 地址
      * 地址
      */
      */
+    @ApiModelProperty(value = "地址")
     private String address;
     private String address;
     /**
     /**
-     * 地址
+     * 在线状态
      */
      */
+    @ApiModelProperty(value = "在线状态")
     private Integer status;
     private Integer status;
     /**
     /**
      * 创建时间
      * 创建时间
      */
      */
+    @ApiModelProperty(value = "创建时间")
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
     private Date createTime;
     private Date createTime;
     /**
     /**
      * 创建人
      * 创建人

+ 11 - 1
src/main/java/com/ydtech/modules/admin/model/SysGeographyPositionRecord.java

@@ -2,6 +2,8 @@ package com.ydtech.modules.admin.model;
 
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
@@ -19,31 +21,39 @@ public class SysGeographyPositionRecord implements Serializable {
     /**
     /**
      * 自增id
      * 自增id
      */
      */
+    @ApiModelProperty(value = "自增id")
     @TableId(value = "id", type= IdType.AUTO)
     @TableId(value = "id", type= IdType.AUTO)
-    private String id;
+    private Integer id;
     /**
     /**
      * 员工编号
      * 员工编号
      */
      */
+    @ApiModelProperty(value = "员工编号")
     private String userId;
     private String userId;
     /**
     /**
      * 员工姓名
      * 员工姓名
      */
      */
+    @ApiModelProperty(value = "员工姓名")
     private String userName;
     private String userName;
     /**
     /**
      * 经度
      * 经度
      */
      */
+    @ApiModelProperty(value = "经度")
     private String longitude;
     private String longitude;
     /**
     /**
      * 纬度
      * 纬度
      */
      */
+    @ApiModelProperty(value = "纬度")
     private String latitude;
     private String latitude;
     /**
     /**
      * 地址
      * 地址
      */
      */
+    @ApiModelProperty(value = "地址")
     private String address;
     private String address;
     /**
     /**
      * 创建时间
      * 创建时间
      */
      */
+    @ApiModelProperty(value = "创建时间")
+    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
     private Date createTime;
     private Date createTime;
     /**
     /**
      * 创建人
      * 创建人

+ 30 - 2
src/main/java/com/ydtech/modules/admin/model/dto/DeptBalanceDto.java

@@ -8,13 +8,13 @@ import lombok.NoArgsConstructor;
 
 
 import java.io.Serializable;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
+import java.util.Date;
 
 
 /**
 /**
  *  机构管理费统计dto
  *  机构管理费统计dto
  */
  */
 @Data
 @Data
 @ApiModel("机构管理费")
 @ApiModel("机构管理费")
-@NoArgsConstructor
 public class DeptBalanceDto implements Serializable {
 public class DeptBalanceDto implements Serializable {
 
 
     @ApiModelProperty(value = "机构名称")
     @ApiModelProperty(value = "机构名称")
@@ -39,5 +39,33 @@ public class DeptBalanceDto implements Serializable {
     private BigDecimal notWithdrawn;
     private BigDecimal notWithdrawn;
 
 
     @ApiModelProperty(value = "机构级别")
     @ApiModelProperty(value = "机构级别")
-    private BigDecimal comLevel;
+    private String comLevel;
+    /***
+     *  用戶id
+     */
+    private String userId;
+    /***
+     *  机构id
+     */
+    private String  deptId;
+
+    private  String proportional;
+
+    private Date  createTime;
+
+    private Date updateTime;
+
+    public DeptBalanceDto() {
+    }
+
+    public DeptBalanceDto(String deptName, String deptLeader, String deptAddress, BigDecimal deptManagementFee, BigDecimal totalIncome, BigDecimal withdrawn, BigDecimal notWithdrawn, String comLevel) {
+        this.deptName = deptName;
+        this.deptLeader = deptLeader;
+        this.deptAddress = deptAddress;
+        this.deptManagementFee = deptManagementFee;
+        this.totalIncome = totalIncome;
+        this.withdrawn = withdrawn;
+        this.notWithdrawn = notWithdrawn;
+        this.comLevel = comLevel;
+    }
 }
 }

+ 21 - 2
src/main/java/com/ydtech/modules/admin/model/dto/QxFrontlineAgentDto.java

@@ -79,10 +79,10 @@ public class QxFrontlineAgentDto implements Serializable {
     private List<String>  ids;
     private List<String>  ids;
 
 
 
 
-    @ApiModelProperty(value = "开始时间")
+    @ApiModelProperty(value = "结束时间")
     private String createtimeEnd;
     private String createtimeEnd;
 
 
-    @ApiModelProperty(value = "结束时间")
+    @ApiModelProperty(value = "开始时间")
     private String createtimeStart;
     private String createtimeStart;
 
 
     /***
     /***
@@ -90,5 +90,24 @@ public class QxFrontlineAgentDto implements Serializable {
      */
      */
     private String roleId;
     private String roleId;
 
 
+    @ApiModelProperty(value = "已认证")
+    private String isFactorVerify;
+
+    @ApiModelProperty(value = "未认证")
+    private String isNotFactorVerify;
+
+    @ApiModelProperty(value = "时间筛选开始")
+    private String beginDate;
+
+    @ApiModelProperty(value = "时间筛选结束")
+    private String endDate;
+
+
+    private Integer totalManpowerNum;
+
+    private Double totalPremiumNum;
+
+    private String status;
+
 }
 }
 
 

+ 17 - 0
src/main/java/com/ydtech/modules/admin/model/dto/SysGeographyPositionPageDto.java

@@ -0,0 +1,17 @@
+package com.ydtech.modules.admin.model.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class SysGeographyPositionPageDto {
+    @ApiModelProperty(value = "页数")
+    private int pageNum;
+
+    @ApiModelProperty(value = "每页条数")
+    private int pageSize;
+
+    @ApiModelProperty(value = "工号")
+    private String id;
+
+}

+ 2 - 1
src/main/java/com/ydtech/modules/admin/model/dto/SysPartnerConsoleDto.java

@@ -66,5 +66,6 @@ public class SysPartnerConsoleDto implements Serializable {
     @ApiModelProperty(value = "性别")
     @ApiModelProperty(value = "性别")
     private String sex;
     private String sex;
 
 
-
+    //用户创建时间
+    private String createTime;
 }
 }

+ 33 - 0
src/main/java/com/ydtech/modules/admin/model/report/company/CompanyQutationCountDataDto.java

@@ -76,4 +76,37 @@ public class CompanyQutationCountDataDto {
      */
      */
     @ApiModelProperty("缴费率")
     @ApiModelProperty("缴费率")
     private BigDecimal contributionRate;
     private BigDecimal contributionRate;
+
+    /***
+     *  承保数/核保书=缴费率
+     */
+    @ApiModelProperty("失败数")
+    private BigDecimal areaCompanyErrNumber;
+
+
+    /***
+     *  总报价
+     */
+    @ApiModelProperty("总报价")
+    private BigDecimal allNumber;
+
+
+    /***
+     *  成功报价数
+     */
+    @ApiModelProperty("成功报价数")
+    private BigDecimal orderSuccessNumber;
+
+    /***
+     *  成功报价数
+     */
+    @ApiModelProperty("人工审核数")
+    private BigDecimal numberManual;
+
+    /***
+     *  成功报价率
+     */
+    @ApiModelProperty("成功报价率")
+    private BigDecimal orderSuccessNumberRate;
+
 }
 }

+ 32 - 0
src/main/java/com/ydtech/modules/admin/model/report/company/OrdersDataDto.java

@@ -0,0 +1,32 @@
+package com.ydtech.modules.admin.model.report.company;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+@ApiModel("控制台大订单")
+
+public class OrdersDataDto  implements Serializable {
+
+
+    @ApiModelProperty("车牌号")
+    private String licenseno;
+
+    @ApiModelProperty("车架号")
+    private String frameno;
+
+    @ApiModelProperty("订单数")
+    private String orderNumber;
+
+    @ApiModelProperty("成交率")
+    private String closeRate;
+
+    @ApiModelProperty("合作公司")
+    private String namesimple;
+
+}

+ 3 - 0
src/main/java/com/ydtech/modules/admin/model/report/profitAnalysis/ProfitAnalysisQueryDto.java

@@ -31,4 +31,7 @@ public class ProfitAnalysisQueryDto {
     @ApiModelProperty("结束时间不用赋值")
     @ApiModelProperty("结束时间不用赋值")
     private  String endDate;
     private  String endDate;
 
 
+    @ApiModelProperty("时间天数")
+    private  String days;
+
 }
 }

+ 59 - 0
src/main/java/com/ydtech/modules/admin/model/vo/OrdersDataVo.java

@@ -0,0 +1,59 @@
+package com.ydtech.modules.admin.model.vo;
+
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ *  @version
+ *  @author: whp
+ *  @Date: 2024/8/31
+ *  @Description:  查询控制台大订单
+ */
+@Data
+@ApiModel("查询控制台大订单查询对象")
+
+public class OrdersDataVo {
+
+    /***
+     *  开始时间
+     */
+    @ApiModelProperty("开始时间")
+    private String  beginDate;
+    /***
+     *  结束时间
+     */
+    @ApiModelProperty("结束时间")
+    private String endDate;
+
+    @ApiModelProperty("页码")
+    private int pageNum;
+
+    @ApiModelProperty("页数")
+    private int pageSize;
+
+    /***
+     *  时间类型  1.近1月 2.近3月  3.近半年
+     */
+    @ApiModelProperty("时间类型  1.近1月 2.近3月  3.近半年")
+    private String  dateType;
+
+
+    @ApiModelProperty("车牌号")
+    private String licenseno;
+
+    @ApiModelProperty("业务员工号")
+    private String userId;
+
+    @ApiModelProperty("业务员名称")
+    private String userName;
+
+    @ApiModelProperty("手机号")
+    private String mobile;
+
+    @ApiModelProperty("车架号")
+    private String frameno;
+    @ApiModelProperty("所属机构")
+    private String deptId;
+}

+ 6 - 0
src/main/java/com/ydtech/modules/admin/model/vo/QxFrontlineAgentVo.java

@@ -72,5 +72,11 @@ public class QxFrontlineAgentVo implements Serializable {
     private String days;
     private String days;
 
 
 
 
+    @ApiModelProperty(value = "月份")
+    private String month;
+
+    @ApiModelProperty(value = "层级类型  0 汇总  1.本人  2. 一级团队 3. 二级团队  4 三级团队  5 临时团队")
+    private String type;
+
 
 
 }
 }

+ 5 - 0
src/main/java/com/ydtech/modules/admin/model/vo/SysUserBaseVO.java

@@ -1,5 +1,6 @@
 package com.ydtech.modules.admin.model.vo;
 package com.ydtech.modules.admin.model.vo;
 
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
@@ -79,4 +80,8 @@ public class SysUserBaseVO {
     @ApiModelProperty(value = "四级机构名称")
     @ApiModelProperty(value = "四级机构名称")
     private String levelFourDeptName;
     private String levelFourDeptName;
 
 
+    @ApiModelProperty(value = "注冊时间")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
 }
 }

+ 17 - 4
src/main/java/com/ydtech/modules/admin/service/CompanyDataReportService.java

@@ -1,10 +1,8 @@
 package com.ydtech.modules.admin.service;
 package com.ydtech.modules.admin.service;
 
 
 
 
-import com.ydtech.modules.admin.model.report.company.CompanyPremiumDataDto;
-import com.ydtech.modules.admin.model.report.company.CompanyPremiumDataQueryDto;
-import com.ydtech.modules.admin.model.report.company.CompanyQutationCountDataDto;
-import com.ydtech.modules.admin.model.report.company.CompanyQutationCountDataQueryDto;
+import com.ydtech.modules.admin.model.report.company.*;
+import com.ydtech.modules.admin.model.vo.OrdersDataVo;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.order.entity.BasePageResult;
 
 
 /**
 /**
@@ -29,6 +27,21 @@ public interface CompanyDataReportService {
      *  @Description: 查询报价次数对象
      *  @Description: 查询报价次数对象
      */
      */
     BasePageResult<CompanyQutationCountDataDto> queryCompanyQutationCountDataPage(CompanyQutationCountDataQueryDto companyQutationCountDataQueryDto);
     BasePageResult<CompanyQutationCountDataDto> queryCompanyQutationCountDataPage(CompanyQutationCountDataQueryDto companyQutationCountDataQueryDto);
+    /**
+     *  @version
+     *  @author: whp
+     *  @Date: 2024/8/31 15:35
+     *  @Description:   查询控制台大订单
+     */
+    BasePageResult<OrdersDataDto> querOrdersDataPage(OrdersDataVo ordersDataVo);
+
+    /**
+     *  @version
+     *  @author: whp
+     *  @Date: 2024/8/31 15:35
+     *  @Description:   查询控制台大订合计
+     */
+    OrdersDataDto querOrdersamountTo(OrdersDataVo ordersDataVo);
 }
 }
 
 
 
 

+ 4 - 2
src/main/java/com/ydtech/modules/admin/service/SysGeographyPositionService.java

@@ -3,12 +3,14 @@ package com.ydtech.modules.admin.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ydtech.modules.admin.model.SysGeographyPosition;
 import com.ydtech.modules.admin.model.SysGeographyPosition;
 import com.ydtech.modules.admin.model.SysGeographyPositionRecord;
 import com.ydtech.modules.admin.model.SysGeographyPositionRecord;
+import com.ydtech.modules.admin.model.dto.SysGeographyPositionPageDto;
+import com.ydtech.modules.order.entity.BasePageResult;
 
 
 import java.util.List;
 import java.util.List;
 
 
 public interface SysGeographyPositionService extends IService<SysGeographyPosition> {
 public interface SysGeographyPositionService extends IService<SysGeographyPosition> {
 
 
-    SysGeographyPosition queryPosition(String userId);
+    List<SysGeographyPosition> queryPosition();
 
 
-    List<SysGeographyPositionRecord> queryPositionList(String userId);
+    BasePageResult<SysGeographyPositionRecord> queryPositionList(SysGeographyPositionPageDto sysGeographyPositionPageDto);
 }
 }

+ 25 - 1
src/main/java/com/ydtech/modules/admin/service/SysTelemarketingWechatDataService.java

@@ -2,6 +2,9 @@ package com.ydtech.modules.admin.service;
 
 
 import com.ydtech.extension.BaseIService;
 import com.ydtech.extension.BaseIService;
 import com.ydtech.modules.admin.model.po.SysTelemarketingWechatData;
 import com.ydtech.modules.admin.model.po.SysTelemarketingWechatData;
+import com.ydtech.modules.admin.model.vo.SysTelemarketingWechatDataSaveVo;
+import com.ydtech.modules.admin.model.vo.SysTelemarketingWechatDataVo;
+import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
 
 
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
@@ -20,13 +23,34 @@ public interface SysTelemarketingWechatDataService extends BaseIService<SysTelem
      *
      *
      * @param date 添加日期
      * @param date 添加日期
      */
      */
-    default void checkData(Date date) {
+    default void checkData(Date date, String userId) {
         List<SysTelemarketingWechatData> list = lambdaQuery()
         List<SysTelemarketingWechatData> list = lambdaQuery()
                 .eq(SysTelemarketingWechatData::getCreateTime, date)
                 .eq(SysTelemarketingWechatData::getCreateTime, date)
+                .eq(SysTelemarketingWechatData::getUserId, userId)
                 .list();
                 .list();
         String dateStr = new SimpleDateFormat("yyyy-MM-dd").format(date);
         String dateStr = new SimpleDateFormat("yyyy-MM-dd").format(date);
         AssertionUtils.isSucceed(!list.isEmpty(), "日期为:" + dateStr + "添加了日期");
         AssertionUtils.isSucceed(!list.isEmpty(), "日期为:" + dateStr + "添加了日期");
 
 
     }
     }
 
 
+    /**
+     * 分页查询微信数据
+     *
+     * @param sysTelemarketingWechatDataVo 微信数据实体
+     * @return 分页微信数据
+     */
+    BasePageResult<SysTelemarketingWechatData> pageQuery(SysTelemarketingWechatDataVo sysTelemarketingWechatDataVo);
+
+    /**
+     * 电销数据添加
+     *
+     * @param sysTelemarketingWechatDataSaveVo 微信数据实体
+     */
+    void add(SysTelemarketingWechatDataSaveVo sysTelemarketingWechatDataSaveVo);
+
+    /**
+     * @param telemarketingId 电销id
+     * @param sysTelemarketingWechatDataSaveVo 微信数据实体
+     */
+    void revise(String telemarketingId, SysTelemarketingWechatDataSaveVo sysTelemarketingWechatDataSaveVo);
 }
 }

+ 1 - 1
src/main/java/com/ydtech/modules/admin/service/SysUserService.java

@@ -229,7 +229,7 @@ public interface SysUserService extends BaseIService<SysUser> {
      * @param userId 用户id
      * @param userId 用户id
      * @return
      * @return
      */
      */
-    List<String> getTelemarketingPersonnelData(String userId);
+    List<String> getTelemarketingPersonnelData();
 }
 }
 
 
 
 

+ 90 - 4
src/main/java/com/ydtech/modules/admin/service/impl/CompanyDataReportServiceImpl.java

@@ -1,22 +1,23 @@
 package com.ydtech.modules.admin.service.impl;
 package com.ydtech.modules.admin.service.impl;
 
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.ydtech.modules.admin.model.report.company.CompanyPremiumDataDto;
-import com.ydtech.modules.admin.model.report.company.CompanyPremiumDataQueryDto;
-import com.ydtech.modules.admin.model.report.company.CompanyQutationCountDataDto;
-import com.ydtech.modules.admin.model.report.company.CompanyQutationCountDataQueryDto;
+import com.ydtech.modules.admin.model.report.company.*;
 import com.ydtech.modules.admin.model.report.opetationData.QuotationCountDataDto;
 import com.ydtech.modules.admin.model.report.opetationData.QuotationCountDataDto;
+import com.ydtech.modules.admin.model.vo.OrdersDataVo;
 import com.ydtech.modules.admin.service.CompanyDataReportService;
 import com.ydtech.modules.admin.service.CompanyDataReportService;
 import com.ydtech.modules.admin.utils.SliceUpDateUtil;
 import com.ydtech.modules.admin.utils.SliceUpDateUtil;
 import com.ydtech.modules.order.dao.InsAreaCompanyMapper;
 import com.ydtech.modules.order.dao.InsAreaCompanyMapper;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.order.entity.BasePageResult;
+import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.math.BigDecimal;
 import java.util.Calendar;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashMap;
+import java.util.List;
 
 
 /**
 /**
  *  @version
  *  @version
@@ -59,7 +60,29 @@ public class CompanyDataReportServiceImpl implements CompanyDataReportService {
         HashMap<String, String> dateMapByType = getDateMapByType(companyQutationCountDataQueryDto.getDateType(), companyQutationCountDataQueryDto.getBeginDate(), companyQutationCountDataQueryDto.getEndDate());
         HashMap<String, String> dateMapByType = getDateMapByType(companyQutationCountDataQueryDto.getDateType(), companyQutationCountDataQueryDto.getBeginDate(), companyQutationCountDataQueryDto.getEndDate());
         companyQutationCountDataQueryDto.setBeginDate(dateMapByType.get("startDate"));
         companyQutationCountDataQueryDto.setBeginDate(dateMapByType.get("startDate"));
         companyQutationCountDataQueryDto.setEndDate(dateMapByType.get("endDate"));
         companyQutationCountDataQueryDto.setEndDate(dateMapByType.get("endDate"));
+        page.setSearchCount(false).setOptimizeCountSql(false);//关闭count查询
+
         Page<CompanyQutationCountDataDto> resultSubOrder = insAreaCompanyMapper.queryCompanyQutationCountDataPage(companyQutationCountDataQueryDto, page);
         Page<CompanyQutationCountDataDto> resultSubOrder = insAreaCompanyMapper.queryCompanyQutationCountDataPage(companyQutationCountDataQueryDto, page);
+        Long total = this.insAreaCompanyMapper.queryCompanyQutationCountDataPageTotal(companyQutationCountDataQueryDto);
+
+        List<CompanyQutationCountDataDto> records = resultSubOrder.getRecords();
+        for (CompanyQutationCountDataDto  item :records){
+            String companyId = item.getCompanyId();
+            String parterCompanyId = item.getParterCompanyId();
+
+            companyQutationCountDataQueryDto.setCompanyId(companyId);
+            companyQutationCountDataQueryDto.setParterCompanyId(parterCompanyId);
+            CompanyQutationCountDataDto   errItem=  insAreaCompanyMapper.getInsAreaCompanyError(companyQutationCountDataQueryDto);
+            if(ObjectUtils.isNotEmpty(errItem)){
+                BigDecimal areaCompanyErrNumber = errItem.getAreaCompanyErrNumber();  //失败报价数
+                BigDecimal orderSuccessNumber = item.getOrderSuccessNumber();//成功报价数
+                BigDecimal allNumber = this.calculateTotal(areaCompanyErrNumber, orderSuccessNumber, null);
+                item.setAllNumber(allNumber);
+                item.setAreaCompanyErrNumber(areaCompanyErrNumber);
+                item.setOrderSuccessNumberRate(item.getOrderSuccessNumber().divide(item.getAllNumber()));
+            }
+        }
+        resultSubOrder.setTotal(total);
         return new BasePageResult<>(companyQutationCountDataQueryDto.getPageNum(), page.getSize(), resultSubOrder.getTotal(), page.getPages(),
         return new BasePageResult<>(companyQutationCountDataQueryDto.getPageNum(), page.getSize(), resultSubOrder.getTotal(), page.getPages(),
                 resultSubOrder.getRecords());
                 resultSubOrder.getRecords());
     }
     }
@@ -96,6 +119,69 @@ public class CompanyDataReportServiceImpl implements CompanyDataReportService {
         map.put("endDate",endDateStr);
         map.put("endDate",endDateStr);
         return map;
         return map;
     }
     }
+
+    /**
+     *  @version
+     *  @author: whp
+     *  @Date: 2024/8/31 15:35
+     *  @Description:   查询控制台大订单
+     */
+    @Override
+    public BasePageResult<OrdersDataDto> querOrdersDataPage(OrdersDataVo ordersDataVo) {
+        Page<OrdersDataDto> page = new Page<>(ordersDataVo.getPageNum(), ordersDataVo.getPageSize());
+
+
+        //判断开始时间和结束时间是否为空,如果为空的走时间类型逻辑
+        HashMap<String, String> dateMapByType = getDateMapByType(ordersDataVo.getDateType(), ordersDataVo.getBeginDate(), ordersDataVo.getEndDate());
+
+        ordersDataVo.setBeginDate(dateMapByType.get("startDate"));
+        ordersDataVo.setEndDate(dateMapByType.get("endDate"));
+        Page<OrdersDataDto> resultSubOrder = insAreaCompanyMapper.querOrdersDataPage(ordersDataVo, page);
+        return new BasePageResult<>(ordersDataVo.getPageNum(), page.getSize(), resultSubOrder.getTotal(), page.getPages(),
+                resultSubOrder.getRecords());
+    }
+
+    /**
+     *  @version
+     *  @author: whp
+     *  @Date: 2024/8/31 15:35
+     *  @Description:   查询控制台大订合计
+     */
+    @Override
+    public OrdersDataDto querOrdersamountTo(OrdersDataVo ordersDataVo) {
+        OrdersDataDto ordersDataDto = new OrdersDataDto();
+        //判断开始时间和结束时间是否为空,如果为空的走时间类型逻辑
+        HashMap<String, String> dateMapByType = getDateMapByType(ordersDataVo.getDateType(), ordersDataVo.getBeginDate(), ordersDataVo.getEndDate());
+        ordersDataVo.setBeginDate(dateMapByType.get("startDate"));
+        ordersDataVo.setEndDate(dateMapByType.get("endDate"));
+        OrdersDataDto resultSubOrder = insAreaCompanyMapper.querOrdersamountTo(ordersDataVo);
+        if(ObjectUtils.isNotEmpty(resultSubOrder) && StringUtils.isNotEmpty(resultSubOrder.getFrameno())){
+            ordersDataDto.setFrameno(resultSubOrder.getFrameno());
+        }
+        OrdersDataDto resultOrderNumber = insAreaCompanyMapper.querResultOrderNumber(ordersDataVo);
+
+        if(ObjectUtils.isNotEmpty(resultOrderNumber) && StringUtils.isNotEmpty(resultOrderNumber.getOrderNumber()) &&   StringUtils.isNotEmpty(resultOrderNumber.getCloseRate())){
+            ordersDataDto.setOrderNumber(resultOrderNumber.getOrderNumber());
+            ordersDataDto.setCloseRate(resultOrderNumber.getCloseRate());
+        }
+        return ordersDataDto;
+    }
+    private BigDecimal calculateTotal(BigDecimal value1, BigDecimal value2, BigDecimal value3) {
+        BigDecimal total = BigDecimal.ZERO;
+
+        if (value1 != null) {
+            total = total.add(value1);
+        }
+
+        if (value2 != null) {
+            total = total.add(value2);
+        }
+        if (value3 != null) {
+            total = total.add(value3);
+        }
+
+        return total;
+    }
 }
 }
 
 
 
 

+ 95 - 50
src/main/java/com/ydtech/modules/admin/service/impl/DeptBalanceServiceImpl.java

@@ -1,34 +1,33 @@
 package com.ydtech.modules.admin.service.impl;
 package com.ydtech.modules.admin.service.impl;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.HttpResult;
-import com.ydtech.modules.admin.dao.DeptBalanceMapper;
-import com.ydtech.modules.admin.dao.SysPartnerMapper;
-import com.ydtech.modules.admin.dao.SysRelationPersonMapper;
-import com.ydtech.modules.admin.model.SysAgencyLeader;
-import com.ydtech.modules.admin.model.SysPartner;
-import com.ydtech.modules.admin.model.SysRelationPerson;
-import com.ydtech.modules.admin.model.SysUser;
+import com.ydtech.modules.admin.dao.*;
+import com.ydtech.modules.admin.model.*;
 import com.ydtech.modules.admin.model.dto.DeptBalanceDto;
 import com.ydtech.modules.admin.model.dto.DeptBalanceDto;
 import com.ydtech.modules.admin.model.dto.MySumAmountQueryDto;
 import com.ydtech.modules.admin.model.dto.MySumAmountQueryDto;
 import com.ydtech.modules.admin.model.dto.SysPartnerConsoleDto;
 import com.ydtech.modules.admin.model.dto.SysPartnerConsoleDto;
 import com.ydtech.modules.admin.model.po.SysUserAccount;
 import com.ydtech.modules.admin.model.po.SysUserAccount;
-import com.ydtech.modules.admin.model.vo.DeptBalanceVo;
-import com.ydtech.modules.admin.model.vo.PartnerBalanceVo;
-import com.ydtech.modules.admin.model.vo.SysAmountAuditingVo;
-import com.ydtech.modules.admin.model.vo.SysUserVO;
+import com.ydtech.modules.admin.model.vo.*;
 import com.ydtech.modules.admin.service.*;
 import com.ydtech.modules.admin.service.*;
 import com.ydtech.modules.base.model.vo.PageVo;
 import com.ydtech.modules.base.model.vo.PageVo;
+import com.ydtech.modules.order.entity.InsAreaCompany;
+import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
 import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
 import com.ydtech.utils.StringUtils;
 import com.ydtech.utils.StringUtils;
+import io.swagger.annotations.ApiModelProperty;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
@@ -55,7 +54,11 @@ public class DeptBalanceServiceImpl implements DeptBalanceService {
     private InsFeeOrderNewService insFeeOrderNewService;
     private InsFeeOrderNewService insFeeOrderNewService;
     @Autowired
     @Autowired
     private SysUserAccountService sysUserAccountService;
     private SysUserAccountService sysUserAccountService;
+    @Resource
+    private SysAgencyLeaderMapper sysAgencyLeaderMapper;
 
 
+    @Autowired
+    private SysAgencyFeeApprovalMapper sysAgencyFeeApprovalMapper;
     /**
     /**
      * @version
      * @version
      * @author: whp
      * @author: whp
@@ -69,8 +72,53 @@ public class DeptBalanceServiceImpl implements DeptBalanceService {
             Page page = new Page(deptBalanceVo.getPageNum(), deptBalanceVo.getPageSize());
             Page page = new Page(deptBalanceVo.getPageNum(), deptBalanceVo.getPageSize());
             pageVo.setPageNum(deptBalanceVo.getPageNum());
             pageVo.setPageNum(deptBalanceVo.getPageNum());
             pageVo.setPageSize(deptBalanceVo.getPageSize());
             pageVo.setPageSize(deptBalanceVo.getPageSize());
-            IPage<DeptBalanceDto> sysUserListPage = deptBalanceMapper.queryDeptLeaderStatistics(page, deptBalanceVo);
-            return HttpResult.ok(sysUserListPage);
+            //通过机构id 用户等条件机构负责人集合
+            IPage<DeptBalanceDto> sysLeaderPage = sysAgencyLeaderMapper.queryPage(page, deptBalanceVo);
+            List<DeptBalanceDto> records = sysLeaderPage.getRecords();
+            List<DeptBalanceDto>  newList =new ArrayList<>();
+            if (records !=null && records.size()>0) {
+                for (DeptBalanceDto itemLeader : records) {
+                    BigDecimal allTotalIncome = BigDecimal.ZERO;  // 总保费
+                    BigDecimal allDeptManagementFee = BigDecimal.ZERO;//机构管理费
+                    BigDecimal allWithdrawn = BigDecimal.ZERO;//已体现
+                    BigDecimal allNotWithdrawn = BigDecimal.ZERO;//未提现
+                    String deptId = itemLeader.getDeptId();
+                    String proportional = itemLeader.getProportional();
+                    Date updateTime = itemLeader.getUpdateTime();
+                    Date createTime = itemLeader.getCreateTime();
+                    String dateStr = "";
+                    if (updateTime != null) {
+                        dateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(updateTime);
+                    } else {
+                        dateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTime);
+                    }
+                    HashMap<String, BigDecimal> orderAmount = deptBalanceMapper.getByDeptId(deptId, dateStr);
+                    if (orderAmount != null && !orderAmount.isEmpty()) {
+                        BigDecimal totalIncome = orderAmount.get("totalIncome")==null ? BigDecimal.ZERO : orderAmount.get("totalIncome");
+                        allTotalIncome = totalIncome.multiply(new BigDecimal(proportional))
+                                .divide(new BigDecimal("100")).setScale(2, RoundingMode.DOWN);
+                        allDeptManagementFee = this.calculateTotal(orderAmount.get("deptManagementFee"), allDeptManagementFee, null);//机构管理费
+                    }
+                    // 填充 已提现抽成费用和可提现抽成费用
+                    List<SysAgencyFeeApproval> sysAgencyFeeApprovals = sysAgencyFeeApprovalMapper.selectList(new LambdaQueryWrapper<SysAgencyFeeApproval>()
+                            .eq(SysAgencyFeeApproval::getUserId, itemLeader.getUserId())
+                            .eq(SysAgencyFeeApproval::getStatus, 1));
+                    if (sysAgencyFeeApprovals.size() > 0) {
+                        for (SysAgencyFeeApproval sysAgencyFeeApproval : sysAgencyFeeApprovals) {
+                            allWithdrawn = allWithdrawn.add(sysAgencyFeeApproval.getHistoryFee());
+                        }
+                    }
+                    //可提现 = 总抽成-已提现
+                    allNotWithdrawn = allTotalIncome.subtract(allWithdrawn);
+                    itemLeader.setDeptManagementFee(allTotalIncome);
+                    itemLeader.setTotalIncome(allDeptManagementFee);
+                    itemLeader.setWithdrawn(allWithdrawn);
+                    itemLeader.setNotWithdrawn(allNotWithdrawn);
+                    newList.add(itemLeader);
+                }
+            }
+            sysLeaderPage.setRecords(newList);
+            return HttpResult.ok(sysLeaderPage);
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();
             return HttpResult.error("查询异常");
             return HttpResult.error("查询异常");
@@ -90,14 +138,7 @@ public class DeptBalanceServiceImpl implements DeptBalanceService {
             Page page = new Page(deptBalanceVo.getPageNum(), deptBalanceVo.getPageSize());
             Page page = new Page(deptBalanceVo.getPageNum(), deptBalanceVo.getPageSize());
             pageVo.setPageNum(deptBalanceVo.getPageNum());
             pageVo.setPageNum(deptBalanceVo.getPageNum());
             pageVo.setPageSize(deptBalanceVo.getPageSize());
             pageVo.setPageSize(deptBalanceVo.getPageSize());
-            SysUser sysUserQuery = new SysUser();
-            sysUserQuery.setDeptId(deptBalanceVo.getDeptId());
-            List<SysUserVO> listByDeptIdUser = this.sysUserService.findListByDeptIdNew(sysUserQuery);
-            List<String> userListDept = listByDeptIdUser.stream().map(SysUserVO::getId).collect(Collectors.toList());
-            if (userListDept.isEmpty()) {
-                userListDept.add("0");
-            }
-            deptBalanceVo.setUserIdList(userListDept);
+            //通过机构id 用户等条件查询合伙人集合
             IPage<SysPartnerConsoleDto> sysPartnersPage = sysPartnerMapper.queryPage(page, deptBalanceVo);
             IPage<SysPartnerConsoleDto> sysPartnersPage = sysPartnerMapper.queryPage(page, deptBalanceVo);
 
 
             List<SysPartnerConsoleDto> sysPartners = sysPartnersPage.getRecords();
             List<SysPartnerConsoleDto> sysPartners = sysPartnersPage.getRecords();
@@ -106,40 +147,44 @@ public class DeptBalanceServiceImpl implements DeptBalanceService {
                 BigDecimal allDeptManagementFee = BigDecimal.ZERO;//机构管理费
                 BigDecimal allDeptManagementFee = BigDecimal.ZERO;//机构管理费
                 BigDecimal allWithdrawn = BigDecimal.ZERO;//已体现
                 BigDecimal allWithdrawn = BigDecimal.ZERO;//已体现
                 BigDecimal allNotWithdrawn = BigDecimal.ZERO;//未提现
                 BigDecimal allNotWithdrawn = BigDecimal.ZERO;//未提现
-//              查询机构负责人
-                List<SysRelationPerson> byUserIdList = this.sysRelationPersonMapper.getByAgencyLeaderId(item.getUserId());
-                List<String> collect = byUserIdList.stream().map(SysRelationPerson::getAgencyLeaderId).collect(Collectors.toList());
-                if (!collect.isEmpty()) {
+
+                List<SysAgencyLeader> deptLeader = sysRelationPersonMapper.selectListByLeaderId(item.getUserId(),1);
 //                  机构负责人
 //                  机构负责人
-                    List<SysAgencyLeader> deptLeader = sysAgencyLeaderService.getByUserIdList(collect);
-                    for (SysAgencyLeader itemLeader : deptLeader) {
-                        String deptId = itemLeader.getDeptId();
-                        if (StringUtils.isNotEmpty(deptId)) {
-                            HashMap<String, BigDecimal> orderAmount = deptBalanceMapper.getByDeptId(deptId);
-                            if (orderAmount != null && !orderAmount.isEmpty()) {
-                                allTotalIncome = this.calculateTotal(orderAmount.get("totalIncome"), allTotalIncome, null);  // 总保费
-                                allDeptManagementFee = this.calculateTotal(orderAmount.get("deptManagementFee"), allDeptManagementFee, null);//机构管理费
+                for (SysAgencyLeader itemLeader : deptLeader) {
+                    String deptId = itemLeader.getDeptId();
+                    if (StringUtils.isNotEmpty(deptId)) {
+                        String proportional = item.getProportional();
+                        Date updateTime = itemLeader.getUpdateTime();
+                        Date createTime = itemLeader.getCreateTime();
+                        String dateStr="";
+                        if(updateTime!=null){
+                            dateStr=  new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(updateTime);
+                        }else{
+                            dateStr=  new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(createTime);
+                        }
+                        HashMap<String, BigDecimal> orderAmount = deptBalanceMapper.getByDeptId(deptId,dateStr);
+
+                        if (orderAmount != null && !orderAmount.isEmpty()) {
+                            BigDecimal totalIncome = orderAmount.get("totalIncome")==null ? BigDecimal.ZERO : orderAmount.get("totalIncome");
+                            allTotalIncome = totalIncome.multiply(new BigDecimal(proportional))
+                                    .divide(new BigDecimal("100")).setScale(2, RoundingMode.DOWN);
+                            allDeptManagementFee = this.calculateTotal(orderAmount.get("deptManagementFee"), allDeptManagementFee, null);//机构管理费
+                        }
+                        // 填充 已提现抽成费用和可提现抽成费用
+                        List<SysAgencyFeeApproval> sysAgencyFeeApprovals = sysAgencyFeeApprovalMapper.selectList(new LambdaQueryWrapper<SysAgencyFeeApproval>()
+                                .eq(SysAgencyFeeApproval::getUserId, item.getUserId())
+                                .eq(SysAgencyFeeApproval::getStatus, 1));
+                        if (sysAgencyFeeApprovals.size() > 0) {
+                            for (SysAgencyFeeApproval sysAgencyFeeApproval : sysAgencyFeeApprovals) {
+                                allWithdrawn = allWithdrawn.add(sysAgencyFeeApproval.getHistoryFee());
                             }
                             }
-                            SysUser sysUser = new SysUser();
-                            sysUser.setDeptId(deptId);
-//                          机构下的userId
-                            List<SysUserVO> listByDeptId = sysUserService.findListByDeptId(sysUser);
-                            List<String> institutionId = listByDeptId.stream().map(SysUserVO::getId).collect(Collectors.toList());
-//                          已提现
-                            SysAmountAuditingVo sysAmountAuditingVo = new SysAmountAuditingVo();
-                            sysAmountAuditingVo.setUserIdList(institutionId);
-                            sysAmountAuditingVo.setAuditingStatus("3");
-                            BigDecimal withdrawn = sysAmountAuditingService.querySumAmount(sysAmountAuditingVo);
-                            allWithdrawn = this.calculateTotal(withdrawn, allWithdrawn, null);
-//                          未提现
-                            sysAmountAuditingVo.setAuditingStatus("2");
-                            BigDecimal notWithdrawn = sysAmountAuditingService.querySumAmount(sysAmountAuditingVo);
-                            allNotWithdrawn = this.calculateTotal(notWithdrawn, allNotWithdrawn, null);
                         }
                         }
+                        //可提现 = 总抽成-已提现
+                        allNotWithdrawn = allTotalIncome.subtract(allWithdrawn);
                     }
                     }
                 }
                 }
-                item.setTotalIncome(allTotalIncome);
-                item.setDeptManagementFee(allDeptManagementFee);
+                item.setTotalIncome(allDeptManagementFee);
+                item.setDeptManagementFee(allTotalIncome);
                 item.setWithdrawn(allWithdrawn);
                 item.setWithdrawn(allWithdrawn);
                 item.setNotWithdrawn(allNotWithdrawn);
                 item.setNotWithdrawn(allNotWithdrawn);
             }
             }

+ 22 - 12
src/main/java/com/ydtech/modules/admin/service/impl/SysGeographyPositionServiceImpl.java

@@ -1,21 +1,20 @@
 package com.ydtech.modules.admin.service.impl;
 package com.ydtech.modules.admin.service.impl;
 
 
-import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+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.modules.admin.dao.SysGeographyPositionMapper;
 import com.ydtech.modules.admin.dao.SysGeographyPositionMapper;
 import com.ydtech.modules.admin.dao.SysGeographyPositionRecordMapper;
 import com.ydtech.modules.admin.dao.SysGeographyPositionRecordMapper;
-import com.ydtech.modules.admin.dao.SysUserMapper;
 import com.ydtech.modules.admin.model.SysGeographyPosition;
 import com.ydtech.modules.admin.model.SysGeographyPosition;
 import com.ydtech.modules.admin.model.SysGeographyPositionRecord;
 import com.ydtech.modules.admin.model.SysGeographyPositionRecord;
-import com.ydtech.modules.admin.model.SysUser;
+import com.ydtech.modules.admin.model.dto.SysGeographyPositionPageDto;
+import com.ydtech.modules.admin.service.SysGeographyPositionRecordService;
 import com.ydtech.modules.admin.service.SysGeographyPositionService;
 import com.ydtech.modules.admin.service.SysGeographyPositionService;
-import org.springframework.beans.factory.annotation.Autowired;
+import com.ydtech.modules.order.entity.BasePageResult;
+import com.ydtech.utils.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
-import java.util.Date;
 import java.util.List;
 import java.util.List;
 
 
 @Service("SysGeographyPositionService")
 @Service("SysGeographyPositionService")
@@ -26,18 +25,29 @@ public class SysGeographyPositionServiceImpl extends ServiceImpl<SysGeographyPos
     @Resource
     @Resource
     private SysGeographyPositionRecordMapper sysGeographyPositionRecordMapper;
     private SysGeographyPositionRecordMapper sysGeographyPositionRecordMapper;
 
 
+    @Resource
+    private SysGeographyPositionRecordService sysGeographyPositionRecordService;
+
 
 
 
 
     @Override
     @Override
-    public SysGeographyPosition queryPosition(String userId) {
-        return  sysGeographyPositionMapper.selectOne(new LambdaQueryWrapper<SysGeographyPosition>()
-                .eq(SysGeographyPosition::getId,userId));
+    public List<SysGeographyPosition> queryPosition() {
+        return  list();
     }
     }
 
 
     @Override
     @Override
-    public List<SysGeographyPositionRecord> queryPositionList(String userId) {
-        return sysGeographyPositionRecordMapper.selectList(new LambdaQueryWrapper<SysGeographyPositionRecord>()
-                .eq(SysGeographyPositionRecord::getUserId, userId).orderByDesc(SysGeographyPositionRecord::getCreateTime));
+    public BasePageResult<SysGeographyPositionRecord> queryPositionList(SysGeographyPositionPageDto sysGeographyPositionPageDto) {
+        Page<SysGeographyPositionRecord> page = new Page<>(sysGeographyPositionPageDto.getPageNum(), sysGeographyPositionPageDto.getPageSize());
+
+        LambdaQueryWrapper<SysGeographyPositionRecord> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(StringUtils.isNotEmpty(sysGeographyPositionPageDto.getId()),SysGeographyPositionRecord::getUserId, sysGeographyPositionPageDto.getId());
+        wrapper.orderByDesc(SysGeographyPositionRecord::getCreateTime);
+
+        Page<SysGeographyPositionRecord> insOrdersPage = sysGeographyPositionRecordService.page(page, wrapper);
+
+        return new BasePageResult<>(sysGeographyPositionPageDto.getPageNum(), page.getSize(), insOrdersPage.getTotal(), page.getPages(),
+                insOrdersPage.getRecords());
+
     }
     }
 
 
 
 

+ 50 - 5
src/main/java/com/ydtech/modules/admin/service/impl/SysTelemarketingWechatDataServiceImpl.java

@@ -1,19 +1,64 @@
 package com.ydtech.modules.admin.service.impl;
 package com.ydtech.modules.admin.service.impl;
 
 
+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.modules.admin.dao.SysTelemarketingWechatDataMapper;
 import com.ydtech.modules.admin.dao.SysTelemarketingWechatDataMapper;
 import com.ydtech.modules.admin.model.po.SysTelemarketingWechatData;
 import com.ydtech.modules.admin.model.po.SysTelemarketingWechatData;
+import com.ydtech.modules.admin.model.vo.SysTelemarketingWechatDataSaveVo;
+import com.ydtech.modules.admin.model.vo.SysTelemarketingWechatDataVo;
 import com.ydtech.modules.admin.service.SysTelemarketingWechatDataService;
 import com.ydtech.modules.admin.service.SysTelemarketingWechatDataService;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.order.entity.BasePageResult;
+import com.ydtech.modules.protocol.utils.AssertionUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.util.Date;
+
 /**
 /**
-* @author Administrator
-* @description 针对表【sys_telemarketing_wechat_data(微信提交数据)】的数据库操作Service实现
-* @createDate 2024-08-29 17:23:42
-*/
+ * @author Administrator
+ * @description 针对表【sys_telemarketing_wechat_data(微信提交数据)】的数据库操作Service实现
+ * @createDate 2024-08-29 17:23:42
+ */
 @Service
 @Service
 public class SysTelemarketingWechatDataServiceImpl extends ServiceImpl<SysTelemarketingWechatDataMapper, SysTelemarketingWechatData>
 public class SysTelemarketingWechatDataServiceImpl extends ServiceImpl<SysTelemarketingWechatDataMapper, SysTelemarketingWechatData>
-    implements SysTelemarketingWechatDataService {
+        implements SysTelemarketingWechatDataService {
+
+    @Override
+    public BasePageResult<SysTelemarketingWechatData> pageQuery(SysTelemarketingWechatDataVo sysTelemarketingWechatDataVo) {
+        Page<SysTelemarketingWechatData> page = new Page<>(sysTelemarketingWechatDataVo.getPageNum(), sysTelemarketingWechatDataVo.getPageSize());
+        String userId = BaseController.getUserId();
+        Page<SysTelemarketingWechatData> sysTelemarketingWechatDataPage = lambdaQuery()
+                .eq(SysTelemarketingWechatData::getUserId, userId)
+                .page(page);
+
+        return new BasePageResult<>(
+                sysTelemarketingWechatDataVo.getPageNum(),
+                sysTelemarketingWechatDataVo.getPageSize(),
+                sysTelemarketingWechatDataPage.getTotal(),
+                sysTelemarketingWechatDataPage.getPages(),
+                sysTelemarketingWechatDataPage.getRecords());
+    }
+
+    @Override
+    public void add(SysTelemarketingWechatDataSaveVo sysTelemarketingWechatDataSaveVo) {
+        String userId = BaseController.getUserId();
+        checkData(sysTelemarketingWechatDataSaveVo.getCreateTime(), userId);
+        SysTelemarketingWechatData sysTelemarketingWechatData = new SysTelemarketingWechatData();
+        BeanUtils.copyProperties(sysTelemarketingWechatDataSaveVo, sysTelemarketingWechatData);
+        sysTelemarketingWechatData.setUserId(userId);
+        boolean save = save(sysTelemarketingWechatData);
+        AssertionUtils.isSucceed(save, "添加失败");
+    }
+
+    @Override
+    public void revise(String telemarketingId, SysTelemarketingWechatDataSaveVo sysTelemarketingWechatDataSaveVo) {
+        SysTelemarketingWechatData sysTelemarketingWechatData = getByIdExist(telemarketingId, "查询不到此数据");
+        BeanUtils.copyProperties(sysTelemarketingWechatDataSaveVo, sysTelemarketingWechatData);
+        sysTelemarketingWechatData.setUpdateTime(new Date());
+        boolean b = updateById(sysTelemarketingWechatData);
+        AssertionUtils.isSucceed(b, "修改失败");
+    }
 
 
 }
 }
 
 

+ 2 - 3
src/main/java/com/ydtech/modules/admin/service/impl/SysUserServiceImpl.java

@@ -1604,8 +1604,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     }
     }
 
 
     @Override
     @Override
-    public List<String> getTelemarketingPersonnelData(String userId) {
-        baseMapper.getTelemarketingPersonnelUserId(userId);
-        return Collections.emptyList();
+    public List<String> getTelemarketingPersonnelData() {
+        return baseMapper.getTelemarketingPersonnelUserId();
     }
     }
 }
 }

+ 4 - 0
src/main/java/com/ydtech/modules/admin/service/impl/TaskStatisticsServiceImpl.java

@@ -86,7 +86,11 @@ public class TaskStatisticsServiceImpl  implements TaskStatisticsService {
         Page page = new Page(taskStatisticsVo.getPageNum(), taskStatisticsVo.getPageSize());
         Page page = new Page(taskStatisticsVo.getPageNum(), taskStatisticsVo.getPageSize());
         pageVo.setPageNum(taskStatisticsVo.getPageNum());
         pageVo.setPageNum(taskStatisticsVo.getPageNum());
         pageVo.setPageSize(taskStatisticsVo.getPageSize());
         pageVo.setPageSize(taskStatisticsVo.getPageSize());
+        page.setSearchCount(false).setOptimizeCountSql(false);//关闭count查询
+
         IPage<TaskStatisticsDto> list = this.insAreaCompanyMapper.agentStatisticsQueryPage(page,taskStatisticsVo);
         IPage<TaskStatisticsDto> list = this.insAreaCompanyMapper.agentStatisticsQueryPage(page,taskStatisticsVo);
+        Long total = this.insAreaCompanyMapper.agentStatisticsQueryPageTotal(taskStatisticsVo);
+        list.setTotal(total);
         return list;
         return list;
     }
     }
     /**
     /**

+ 307 - 297
src/main/java/com/ydtech/modules/admin/service/impl/UserReportServiceImpl.java

@@ -17,6 +17,7 @@ import com.ydtech.modules.admin.model.SysUserRole;
 import com.ydtech.modules.admin.model.SysUserRoleKzt;
 import com.ydtech.modules.admin.model.SysUserRoleKzt;
 import com.ydtech.modules.admin.model.dto.*;
 import com.ydtech.modules.admin.model.dto.*;
 import com.ydtech.modules.admin.model.report.user.*;
 import com.ydtech.modules.admin.model.report.user.*;
+import com.ydtech.modules.admin.model.vo.AppCustomerManagementQueryVo;
 import com.ydtech.modules.admin.model.vo.HouLinePersonnelReportVo;
 import com.ydtech.modules.admin.model.vo.HouLinePersonnelReportVo;
 import com.ydtech.modules.admin.model.vo.QxFrontlineAgentVo;
 import com.ydtech.modules.admin.model.vo.QxFrontlineAgentVo;
 import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
 import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
@@ -32,6 +33,7 @@ import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesSumEntity;
 import com.ydtech.modules.order.dao.InsAreaCompanyMapper;
 import com.ydtech.modules.order.dao.InsAreaCompanyMapper;
 import com.ydtech.modules.order.service.InsAreaCompanyService;
 import com.ydtech.modules.order.service.InsAreaCompanyService;
 import com.ydtech.utils.StringUtils;
 import com.ydtech.utils.StringUtils;
+import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -160,7 +162,7 @@ public class UserReportServiceImpl implements UserReportService {
                 SysUser level2=null;
                 SysUser level2=null;
                 SysUser level3=null;
                 SysUser level3=null;
                 if(level1!=null){
                 if(level1!=null){
-                   level2 = getBottomByUserId(sysUser.getId());
+                    level2 = getBottomByUserId(sysUser.getId());
                 }
                 }
                 if(level2!=null){
                 if(level2!=null){
                     level3 = getBottomByUserId(sysUser.getId());
                     level3 = getBottomByUserId(sysUser.getId());
@@ -250,40 +252,34 @@ public class UserReportServiceImpl implements UserReportService {
     }
     }
 
 
     private void agentPerson(List<QxFrontlineAgentDto> sysUserList,QxFrontlineAgentVo qxFrontlineAgentVo) {
     private void agentPerson(List<QxFrontlineAgentDto> sysUserList,QxFrontlineAgentVo qxFrontlineAgentVo) {
-        HashMap<String, Integer> humanResources = new HashMap<>();
-        HashMap<String, List<String>> humanResourcesIdList = new HashMap<>();
-//              关系表
-        List<EsmUserReferrerDTO> employeeIncreaseReportDtos = esmUserReferrerMapper.getbyUserNextLevel(null);
-        Map<String, EsmUserReferrerDTO> collect = employeeIncreaseReportDtos.stream().collect(Collectors.toMap(EsmUserReferrerDTO::getId, Function.identity()));
-        Set<String> visited = new HashSet<>();
-        for (EsmUserReferrerDTO item : employeeIncreaseReportDtos) {
-            Integer count = this.nextLevelUser(item.getId(), collect, visited);
-            humanResources.put(item.getId(), count);
-            List<String> ids = new ArrayList<>();
-            humanResourcesIdList.put(item.getId(), this.nextLevelUserList(item.getId(), collect, visited, ids));
-        }
         for (QxFrontlineAgentDto userItem : sysUserList) {
         for (QxFrontlineAgentDto userItem : sysUserList) {
             String userId = userItem.getUserId();
             String userId = userItem.getUserId();
-//                  总人力
-            if (humanResources.containsKey(userId)) {
-                if (ObjectUtils.isNotEmpty(humanResources.get(userId))) {
-                    userItem.setTotalManpower(humanResources.get(userId).toString());
-                }
-            }
-            List<String> ids = new ArrayList<>();
-            //出单人力 +  总保费  +单均保费
-            if (humanResourcesIdList.containsKey(userId)) {
-                //出单人力
-                ids = humanResourcesIdList.get(userId);
+            List<SysUserTeamDto> users = esmUserReferrerMapper.getUserIdsByUserId(userId);
+            //总人力
+            long authenticationStatusCount=0;
+            long authenticationStatusNoCount=0;
+            List<String> userIds =new ArrayList<String>();
+            //已认证  1
+            //未认证  2
+            if(users!=null && users.size()>0){
+                userIds = users.stream().map(SysUserTeamDto::getId).collect(Collectors.toList());
+                // authenticationStatusCount = users.stream().filter(user -> user.getStatus() ==1).count();
+                // authenticationStatusNoCount  = users.stream().filter(user -> user.getStatus() ==2).count();
             }
             }
-            ids.add(userId);
+            userIds.add(userId);
+            userItem.setIds(userIds);
+            userItem.setTotalManpower(userIds.size()+"");
+            //出单人力
             QxFrontlineAgentDto qxFrontlineAgentDto = new QxFrontlineAgentDto();
             QxFrontlineAgentDto qxFrontlineAgentDto = new QxFrontlineAgentDto();
-            qxFrontlineAgentDto.setIds(ids);
+            qxFrontlineAgentDto.setIds(userIds);
             qxFrontlineAgentDto.setCreatetimeStart(qxFrontlineAgentVo.getCreatetimeStart());
             qxFrontlineAgentDto.setCreatetimeStart(qxFrontlineAgentVo.getCreatetimeStart());
             qxFrontlineAgentDto.setCreatetimeEnd(qxFrontlineAgentVo.getCreatetimeEnd());
             qxFrontlineAgentDto.setCreatetimeEnd(qxFrontlineAgentVo.getCreatetimeEnd());
             QxFrontlineAgentDto orderManpower = insAreaCompanyService.getOrderManpowerNew(qxFrontlineAgentDto);
             QxFrontlineAgentDto orderManpower = insAreaCompanyService.getOrderManpowerNew(qxFrontlineAgentDto);
+            //出单人力
             userItem.setOrderManpower(orderManpower.getOrderManpower());
             userItem.setOrderManpower(orderManpower.getOrderManpower());
+            //总保费
             userItem.setTotalPremium(orderManpower.getTotalPremium());
             userItem.setTotalPremium(orderManpower.getTotalPremium());
+            //单均保费
             userItem.setAveragePremium(orderManpower.getAveragePremium());
             userItem.setAveragePremium(orderManpower.getAveragePremium());
         }
         }
     }
     }
@@ -327,7 +323,7 @@ public class UserReportServiceImpl implements UserReportService {
     @Override
     @Override
     public List<QxFrontlineAgentDto> queryQxFrontlineAgentRanking(QxFrontlineAgentVo qxFrontlineAgentVo) {
     public List<QxFrontlineAgentDto> queryQxFrontlineAgentRanking(QxFrontlineAgentVo qxFrontlineAgentVo) {
         if(StringUtils.isNotEmpty(qxFrontlineAgentVo.getProvinceId())){
         if(StringUtils.isNotEmpty(qxFrontlineAgentVo.getProvinceId())){
-         String provinceId =   this.removeTrailingZeros(qxFrontlineAgentVo.getProvinceId());
+            String provinceId =   this.removeTrailingZeros(qxFrontlineAgentVo.getProvinceId());
             qxFrontlineAgentVo.setProvinceId(provinceId);
             qxFrontlineAgentVo.setProvinceId(provinceId);
 
 
         }
         }
@@ -339,63 +335,73 @@ public class UserReportServiceImpl implements UserReportService {
             String countyId =   this.removeTrailingZeros(qxFrontlineAgentVo.getCountyId());
             String countyId =   this.removeTrailingZeros(qxFrontlineAgentVo.getCountyId());
             qxFrontlineAgentVo.setCountyId(countyId);
             qxFrontlineAgentVo.setCountyId(countyId);
         }
         }
+        //按照条件重新查询数据
+        List<QxFrontlineAgentDto> list = sysUserMapper.queryQxFrontlineAgentList(qxFrontlineAgentVo);
+        List<QxFrontlineAgentDto> listNew =new ArrayList<>();
+        String orderSort = qxFrontlineAgentVo.getOrderSort();
+        int limit =10;
+        //暂时先取数据的前10条数据
+        if(list!=null && list.size()>0){
+            if("1".equals(orderSort)){
+                List<QxFrontlineAgentDto> listNews =new ArrayList<>();
+                for(QxFrontlineAgentDto  dto : list){
+                    //查询总人力
+                    List<SysUserTeamDto> users = esmUserReferrerMapper.getUserIdsByUserId(dto.getUserId());
+                    List<String> userIds =new ArrayList<String>();
+                    if(users!=null && users.size()>0){
+                        userIds = users.stream().map(SysUserTeamDto::getId).collect(Collectors.toList());
+                    }
+                    userIds.add(dto.getUserId());
+                    dto.setIds(userIds);
+                    dto.setTotalManpower(userIds.size()+"");
+                    dto.setTotalManpowerNum(userIds.size());
+                    listNews.add(dto);
+                }
 
 
-        if(StringUtils.isNotEmpty(qxFrontlineAgentVo.getHouseId())){
-            String houseId =   this.removeTrailingZeros(qxFrontlineAgentVo.getHouseId());
-            qxFrontlineAgentVo.setHouseId(houseId);
-        }
-
-        PageVo<SettlementDocumentaryFeesSumEntity> pageVo = new PageVo<>();
-        Page page = new Page(1, 50);
-
-        pageVo.setPageNum(1);
-        pageVo.setPageSize(50);
-
-        IPage<QxFrontlineAgentDto> sysUserListPage = sysUserMapper.queryQxFrontlineAgent(page, qxFrontlineAgentVo);
-        List<QxFrontlineAgentDto> sysUserList = sysUserListPage.getRecords();
-
-        HashMap<String, Integer> humanResources = new HashMap<>();
-        HashMap<String, List<String>> humanResourcesIdList = new HashMap<>();
-
-//         关系表
-        List<EsmUserReferrerDTO> employeeIncreaseReportDtos = esmUserReferrerMapper.getbyUserNextLevel(null);
-        Map<String, EsmUserReferrerDTO> collect = employeeIncreaseReportDtos.stream().collect(Collectors.toMap(EsmUserReferrerDTO::getId, Function.identity()));
-        Set<String> visited = new HashSet<>();
-        for (EsmUserReferrerDTO item : employeeIncreaseReportDtos) {
-            Integer count = this.nextLevelUser(item.getId(), collect, visited);
-            humanResources.put(item.getId(), count);
-            List<String> ids = new ArrayList<>();
-            humanResourcesIdList.put(item.getId(), this.nextLevelUserList(item.getId(), collect, visited, ids));
-
-        }
-        for (QxFrontlineAgentDto userItem : sysUserList) {
-            String userId = userItem.getUserId();
-//            总人力
-            if (humanResources.containsKey(userId)) {
-                if (ObjectUtils.isNotEmpty(humanResources.get(userId))) {
-                    userItem.setTotalManpower(humanResources.get(userId).toString());
+                if(listNews.size()<limit){
+                    limit = listNews.size();
                 }
                 }
-            }
-            //出单人力 +  总保费  +单均保费
-            if (humanResourcesIdList.containsKey(userId)) {
-                if (!CollectionUtils.isEmpty(humanResourcesIdList.get(userId))) {
-                    //出单人力
-                    List<String> ids = humanResourcesIdList.get(userId);
-                    QxFrontlineAgentDto orderManpower = insAreaCompanyService.getOrderManpower(ids);
-                    userItem.setOrderManpower(orderManpower.getOrderManpower());
-                    userItem.setTotalPremium(orderManpower.getTotalPremium());
-                    userItem.setAveragePremium(orderManpower.getAveragePremium());
+                List<QxFrontlineAgentDto> limitList = listNews.stream()
+                        .sorted(Comparator.comparing(QxFrontlineAgentDto::getTotalManpowerNum).reversed())
+                        .limit(limit)
+                        .collect(Collectors.toList());
+                if(limitList!=null &&  limitList.size()>0){
+                    for(QxFrontlineAgentDto  dto : limitList){
+                        //查询出单人力
+                        Double  sumAmount  = insAreaCompanyService.getOrderPremiumByUserIds(dto.getIds());
+                        dto.setTotalPremium(sumAmount.toString());
+                        listNew.add(dto);
+                    }
+                }
+            }else{
+                List<QxFrontlineAgentDto> listNews =new ArrayList<>();
+                for(QxFrontlineAgentDto  dto : list){
+                    //查询出单人力
+                    List<SysUserTeamDto> users = esmUserReferrerMapper.getUserIdsByUserId(dto.getUserId());
+                    List<String> userIds =new ArrayList<String>();
+                    if(users!=null && users.size()>0){
+                        userIds = users.stream().map(SysUserTeamDto::getId).collect(Collectors.toList());
+                    }
+                    userIds.add(dto.getUserId());
+                    dto.setIds(userIds);
+                    dto.setTotalManpower(userIds.size()+"");
+                    Double  sumAmount  = insAreaCompanyService.getOrderPremiumByUserIds(dto.getIds());
+                    dto.setTotalPremium(sumAmount.toString());
+                    dto.setTotalPremiumNum(sumAmount);
+                    listNews.add(dto);
                 }
                 }
+                if(listNews.size()<limit){
+                    limit = listNews.size();
+                }
+                listNew = listNews.stream()
+                        .sorted(Comparator.comparing(QxFrontlineAgentDto::getTotalPremiumNum).reversed())
+                        .limit(limit)
+                        .collect(Collectors.toList());
             }
             }
-        }
-        //排序
-        if(StringUtils.isNotEmpty(qxFrontlineAgentVo.getOrderSort())){
-//            人员
-                this.sortBy(qxFrontlineAgentVo.getOrderSort(),sysUserList);
 
 
         }
         }
 
 
-        return sysUserList;
+        return listNew;
     }
     }
     private String removeTrailingZeros(String value) {
     private String removeTrailingZeros(String value) {
         int len = value.length();
         int len = value.length();
@@ -417,48 +423,48 @@ public class UserReportServiceImpl implements UserReportService {
 
 
 
 
     private void sortBy(String orderSort,List<QxFrontlineAgentDto> sysUserList) {
     private void sortBy(String orderSort,List<QxFrontlineAgentDto> sysUserList) {
-            Collections.sort(sysUserList, new Comparator<QxFrontlineAgentDto>() {
-                @Override
-                public int compare(QxFrontlineAgentDto o1, QxFrontlineAgentDto o2) {
-                    // 假设name是String类型,直接使用String的compareTo方法
-
-                    if("1".equals(orderSort)) { // 人员
-                        String manpower1 = o1.getTotalManpower();
-                        String manpower2 = o2.getTotalManpower();
-
-                        // 如果两个值都为null,则认为它们相等
-                        if (manpower1 == null && manpower2 == null) {
-                            return 0;
-                        }
-                        // 如果第一个值为null,则排在第二个值之后
-                        if (manpower1 == null) {
-                            return 1;
-                        }
-                        // 如果第二个值为null,则排在第一个值之前
-                        if (manpower2 == null) {
-                            return -1;
-                        }
+        Collections.sort(sysUserList, new Comparator<QxFrontlineAgentDto>() {
+            @Override
+            public int compare(QxFrontlineAgentDto o1, QxFrontlineAgentDto o2) {
+                // 假设name是String类型,直接使用String的compareTo方法
+
+                if("1".equals(orderSort)) { // 人员
+                    String manpower1 = o1.getTotalManpower();
+                    String manpower2 = o2.getTotalManpower();
+
+                    // 如果两个值都为null,则认为它们相等
+                    if (manpower1 == null && manpower2 == null) {
+                        return 0;
+                    }
+                    // 如果第一个值为null,则排在第二个值之后
+                    if (manpower1 == null) {
+                        return 1;
+                    }
+                    // 如果第二个值为null,则排在第一个值之前
+                    if (manpower2 == null) {
+                        return -1;
+                    }
 
 
-                        return o1.getTotalManpower().compareTo(o2.getTotalManpower());
-                    }else {
+                    return o1.getTotalManpower().compareTo(o2.getTotalManpower());
+                }else {
 
 
-                        String premium1 = o1.getTotalPremium();
-                        String premium2 = o2.getTotalPremium();
+                    String premium1 = o1.getTotalPremium();
+                    String premium2 = o2.getTotalPremium();
 
 
-                        // 同样的逻辑来处理null值
-                        if (premium1 == null && premium2 == null) {
-                            return 0;
-                        }
-                        if (premium1 == null) {
-                            return 1;
-                        }
-                        if (premium2 == null) {
-                            return -1;
-                        }
-                        return o1.getTotalPremium().compareTo(o2.getTotalPremium());
+                    // 同样的逻辑来处理null值
+                    if (premium1 == null && premium2 == null) {
+                        return 0;
+                    }
+                    if (premium1 == null) {
+                        return 1;
+                    }
+                    if (premium2 == null) {
+                        return -1;
                     }
                     }
+                    return o1.getTotalPremium().compareTo(o2.getTotalPremium());
                 }
                 }
-            });
+            }
+        });
     }
     }
 
 
     /**
     /**
@@ -525,125 +531,58 @@ public class UserReportServiceImpl implements UserReportService {
     public HttpResult<EsmUserCountVO> queryQxFrontlineDetails(QxFrontlineAgentVo qxFrontlineAgentVo) {
     public HttpResult<EsmUserCountVO> queryQxFrontlineDetails(QxFrontlineAgentVo qxFrontlineAgentVo) {
         try {
         try {
             EsmUserCountVO esmUserCountVO = new EsmUserCountVO();
             EsmUserCountVO esmUserCountVO = new EsmUserCountVO();
-            List<EsmTeamPolicyVO> hzList = new ArrayList<>();
-            List<EsmUserPolicyVO> userPolicyList = new ArrayList<>();
-            List<EsmUserPolicyVO> userPolicyList0 = new ArrayList<>();
-            List<EsmUserPolicyVO> userPolicyList1 = new ArrayList<>();
-            List<EsmUserPolicyVO> userPolicyList2 = new ArrayList<>();
-            List<EsmUserPolicyVO> userPolicyList3 = new ArrayList<>();
-            EsmUserReferrer esmUserReferrer = esmUserReferrerMapper.selectById(qxFrontlineAgentVo.getUserId());
-            if (esmUserReferrer != null) {
-                List<String> userList1 = new ArrayList<>();
-                List<String> userList2 = new ArrayList<>();
-                List<String> userList3 = new ArrayList<>();
-                //本级信息
-                //明细数据加工
-                List<String> userList0 = new ArrayList<>();
-                userList0.add(esmUserReferrer.getId());
-                userPolicyList0 = esmUserReferrerMapper.queryOrderCount(userList0, null, null);
-                //汇总数据加工
-                EsmTeamPolicyVO esmTeamPolicyVO0 = esmUserReferrerMapper.queryOrderCountHzNew(userList0, null, null);
-                EsmTeamPolicyVO esmTeamPolicyVO1 = new EsmTeamPolicyVO();
-                EsmTeamPolicyVO esmTeamPolicyVO2 = new EsmTeamPolicyVO();
-                EsmTeamPolicyVO esmTeamPolicyVO3 = new EsmTeamPolicyVO();
-                esmTeamPolicyVO2.setTeamlevel("二级团队");
-                esmTeamPolicyVO3.setTeamlevel("三级团队");
-                if (esmTeamPolicyVO0 == null) {
-                    esmTeamPolicyVO0 = new EsmTeamPolicyVO();
-                    esmTeamPolicyVO0.setSumpremium(0);
-                    esmTeamPolicyVO0.setUsernum(0);
-                } else {
-                    esmTeamPolicyVO0.setUsernum(1);
-                }
-                esmTeamPolicyVO0.setTeamlevel("本人");
-                esmTeamPolicyVO0.setTeamnum(1);
-
-                // 一级团队信息
-                userList1 = esmUserReferrerMapper.getIdDown_1(esmUserReferrer.getId());
-                esmTeamPolicyVO1.setTeamlevel("一级团队");
-                if (userList1 != null && userList1.size() > 0) {
-                    userPolicyList1 = esmUserReferrerMapper.queryOrderCount(userList1, null, null);
-                    EsmTeamPolicyVO esmTeamPolicyVO1_t = esmUserReferrerMapper.queryOrderCountHzNew(userList1, null,
-                            null);
-                    if (esmTeamPolicyVO1_t != null) {
-                        esmTeamPolicyVO1.setSumpremium(esmTeamPolicyVO1_t.getSumpremium());
-                        esmTeamPolicyVO1.setUsernum(userPolicyList1.size());//出单人力
-                    }
-                    esmTeamPolicyVO1.setTeamnum(userList1.size());//团队人数
-                    // 二级团队信息
-                    userList2 = esmUserReferrerMapper.getIdDown_2(esmUserReferrer.getId());
-
-                    esmTeamPolicyVO2.setTeamlevel("二级团队");
-                    if (userList2 != null && userList2.size() > 0) {
-                        userPolicyList2 = esmUserReferrerMapper.queryOrderCount(userList2, null, null);
-                        EsmTeamPolicyVO esmTeamPolicyVO2_t = esmUserReferrerMapper.queryOrderCountHzNew(userList2, null,
-                                null);
-                        if (esmTeamPolicyVO2_t != null) {
-                            esmTeamPolicyVO2.setSumpremium(esmTeamPolicyVO2_t.getSumpremium());
-                            esmTeamPolicyVO2.setUsernum(userPolicyList2.size());
-                        }
-                        esmTeamPolicyVO2.setTeamnum(userList2.size());
-                        // 三级团队信息
-                        userList3 = esmUserReferrerMapper.getIdDown_3(esmUserReferrer.getId());
-                        if(userList3!=null && userList3.size()>0){
-                            userPolicyList3=esmUserReferrerMapper.queryOrderCount(userList3,null, null);
-                            EsmTeamPolicyVO esmTeamPolicyVO3_t=esmUserReferrerMapper.queryOrderCountHzNew(userList3,null, null);
-                            esmTeamPolicyVO3.setTeamlevel("三级团队");
-                            esmTeamPolicyVO3.setTeamnum(userList3.size());
-                            if (esmTeamPolicyVO2_t != null) {
-                                esmTeamPolicyVO3.setSumpremium(esmTeamPolicyVO3_t.getSumpremium());
-                                esmTeamPolicyVO3.setUsernum(userPolicyList3.size());
-                            }
+            List<EsmTeamPolicyVO>  list =new ArrayList<>();
+            qxFrontlineAgentVo.setType("0");
+            EsmTeamPolicyVO  vo_0 = getVo(getStrings(qxFrontlineAgentVo), "汇总");
+            list.add(vo_0);
 
 
-                        }
-                    }
+            qxFrontlineAgentVo.setType("1");
+            EsmTeamPolicyVO  vo_1 =  getVo(getStrings(qxFrontlineAgentVo), "本人");
+            list.add(vo_1);
 
 
-                }
+            qxFrontlineAgentVo.setType("2");
+            EsmTeamPolicyVO  vo_2 = getVo(getStrings(qxFrontlineAgentVo), "一级团队");
+            list.add(vo_2);
 
 
-                //临时团队
-                List<String> registList = esmUserReferrerMapper.getIdDown3_regist(qxFrontlineAgentVo.getUserId());
-                EsmTeamPolicyVO esmTeamPolicyVO9 = new EsmTeamPolicyVO();
-                esmTeamPolicyVO9.setTeamlevel("临时团队");
-                esmTeamPolicyVO9.setTeamnum(registList == null ? 0 : registList.size());
-
-                //汇总
-                List<String> userList = new ArrayList<>();
-                userList.addAll(userList0);
-                userList.addAll(userList1);
-                userList.addAll(userList2);
-                userList.addAll(userList3);
-                userList.addAll(registList);
-                userPolicyList = esmUserReferrerMapper.queryOrderCount(userList, null, null);
-                EsmTeamPolicyVO esmTeamPolicyVO = new EsmTeamPolicyVO();
-                EsmTeamPolicyVO esmTeamPolicyVO_t = esmUserReferrerMapper.queryOrderCountHzNew(userList, null, null);
-                if (esmTeamPolicyVO_t != null) {
-                    esmTeamPolicyVO.setSumpremium(esmTeamPolicyVO_t.getSumpremium());
-                    esmTeamPolicyVO.setUsernum(userPolicyList.size());
-                }
-                esmTeamPolicyVO.setTeamlevel("汇总");
-                esmTeamPolicyVO.setTeamnum(userList.size());
-                hzList.add(esmTeamPolicyVO);
-                hzList.add(esmTeamPolicyVO0);
-                hzList.add(esmTeamPolicyVO1);
-                hzList.add(esmTeamPolicyVO2);
-                hzList.add(esmTeamPolicyVO3);
-                hzList.add(esmTeamPolicyVO9);
-                esmUserCountVO.setHzList(hzList);
-                esmUserCountVO.setUserPolicyList(userPolicyList);
-                esmUserCountVO.setUserPolicyList0(userPolicyList0);
-                esmUserCountVO.setUserPolicyList1(userPolicyList1);
-                esmUserCountVO.setUserPolicyList2(userPolicyList2);
-                esmUserCountVO.setUserPolicyList3(userPolicyList3);
-            } else {
-                throw new SystemException("内部错误");
-            }
+            qxFrontlineAgentVo.setType("3");
+            EsmTeamPolicyVO  vo_3 =  getVo(getStrings(qxFrontlineAgentVo), "二级团队");
+            list.add(vo_3);
+
+            qxFrontlineAgentVo.setType("4");
+            EsmTeamPolicyVO  vo_4 =  getVo(getStrings(qxFrontlineAgentVo), "三级团队");
+            list.add(vo_4);
+
+            qxFrontlineAgentVo.setType("5");
+            EsmTeamPolicyVO  vo_5 =  getVo(getStrings(qxFrontlineAgentVo), "临时团队");
+            list.add(vo_5);
+
+            esmUserCountVO.setHzList(list);
             return   HttpResult.ok(esmUserCountVO);
             return   HttpResult.ok(esmUserCountVO);
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();
             return HttpResult.error("查询异常");
             return HttpResult.error("查询异常");
         }
         }
     }
     }
+    public EsmTeamPolicyVO  getVo(List<String> userIds,String levelName){
+        EsmTeamPolicyVO  vo =new EsmTeamPolicyVO();
+        vo.setTeamlevel(levelName);
+        vo.setTeamnum(userIds.size());
+        if(userIds!=null && userIds.size()>0){
+            TaskStatisticsDto taskStatisticsDto = insAreaCompanyMapper.numberQuotationsByUserIds(userIds,null);
+            if(taskStatisticsDto==null){
+                vo.setSumpremium(0);
+                vo.setUsernum(0);
+            }else{
+                vo.setSumpremium(Double.valueOf(taskStatisticsDto.getTotalPremium()==null?"0":taskStatisticsDto.getTotalPremium()));
+                vo.setUsernum(Integer.valueOf(taskStatisticsDto.getUnderwritingCount() ==null?"0":taskStatisticsDto.getUnderwritingCount().toString()));
+            }
 
 
+        }else{
+            vo.setSumpremium(0);
+            vo.setUsernum(0);
+        }
+        return vo;
+    }
 
 
     private void qxFrontlineDetails(TeamManagementDto thisLevelDto, EsmUserReferrerDTO item, Map<String, EsmUserReferrerDTO> collect, Set<String> visited, List<String> ids,List<TeamManagementDto> teamManagementDtoList) {
     private void qxFrontlineDetails(TeamManagementDto thisLevelDto, EsmUserReferrerDTO item, Map<String, EsmUserReferrerDTO> collect, Set<String> visited, List<String> ids,List<TeamManagementDto> teamManagementDtoList) {
         visited.clear();
         visited.clear();
@@ -666,76 +605,126 @@ public class UserReportServiceImpl implements UserReportService {
     @Override
     @Override
     public HttpResult<IPage<QxFrontlineAgentDto>> queryQxFrontlineDetailsUser(QxFrontlineAgentVo qxFrontlineAgentVo) {
     public HttpResult<IPage<QxFrontlineAgentDto>> queryQxFrontlineDetailsUser(QxFrontlineAgentVo qxFrontlineAgentVo) {
         try {
         try {
-
-            PageVo<SettlementDocumentaryFeesSumEntity> pageVo = new PageVo<>();
-            Page page = new Page(qxFrontlineAgentVo.getPageNum(), qxFrontlineAgentVo.getPageSize());
+            PageVo<QxFrontlineAgentDto> pageVo = new PageVo<>();
+            Page<QxFrontlineAgentDto> page = new Page(qxFrontlineAgentVo.getPageNum(), qxFrontlineAgentVo.getPageSize());
             pageVo.setPageNum(qxFrontlineAgentVo.getPageNum());
             pageVo.setPageNum(qxFrontlineAgentVo.getPageNum());
             pageVo.setPageSize(qxFrontlineAgentVo.getPageSize());
             pageVo.setPageSize(qxFrontlineAgentVo.getPageSize());
-            HashMap<String, List<String>> humanResourcesIdList = new HashMap<>();
-            IPage<QxFrontlineAgentDto> userResultPage = new Page<>();
-            //关系表
-            List<EsmUserReferrerDTO> employeeIncreaseReportDtos = esmUserReferrerMapper.getbyUserNextLevel(null);
-            Map<String, EsmUserReferrerDTO> collect = employeeIncreaseReportDtos.stream().collect(Collectors.toMap(EsmUserReferrerDTO::getId, Function.identity()));
-            Set<String> visited = new HashSet<>();
-            List<String> strings = new ArrayList<>();
-            for (EsmUserReferrerDTO item : employeeIncreaseReportDtos) {
-                List<String> ids = new ArrayList<>();
-                humanResourcesIdList.put(item.getId(), this.nextLevelUserList(item.getId(), collect, visited, ids));
-            }
-            if (humanResourcesIdList.containsKey(qxFrontlineAgentVo.getUserId())) {
-                strings = humanResourcesIdList.get(qxFrontlineAgentVo.getUserId());
-            }
-            if(!CollectionUtils.isEmpty(strings)){
-                qxFrontlineAgentVo.setIds(strings);
-                 userResultPage = sysUserMapper.getByIdsList(page, qxFrontlineAgentVo);
-                List<QxFrontlineAgentDto> records = userResultPage.getRecords();
-                for (QxFrontlineAgentDto userItem : records) {
-                    TaskStatisticsDto taskStatisticsDto = insAreaCompanyMapper.NumberQuotations(userItem.getUserId());
-                    userItem.setUnderwritingCount(taskStatisticsDto.getUnderwritingCount().toString());
-                    userItem.setOrderNumber(taskStatisticsDto.getOrderNumber());
-                    userItem.setQutationInsureCount(taskStatisticsDto.getQutationInsureCount());
-                    userItem.setTotalPremium(taskStatisticsDto.getTotalPremium());
+            //通过查询条件查询代理人数据
+            List<String> userIds = getStrings(qxFrontlineAgentVo);
+            qxFrontlineAgentVo.setIds(userIds);
+            //查詢所有的人员数据
+            Page<QxFrontlineAgentDto>  pages  =new Page<QxFrontlineAgentDto>();
+            if(userIds!=null && userIds.size()>0){
+                pages =  sysUserMapper.findUserListByParam(page,qxFrontlineAgentVo);
+                List<QxFrontlineAgentDto> newList = new ArrayList<QxFrontlineAgentDto>();
+                List<QxFrontlineAgentDto> records = pages.getRecords();
+                if(records!=null && records.size()>0){
+                    for(QxFrontlineAgentDto  dto : records){
+                        int rzCount=0;
+                        int wrzCount=0;
+                        List<SysUserTeamDto> users = esmUserReferrerMapper.getUserIdsByUserId(dto.getUserId());
+                        for(SysUserTeamDto vo :users){
+                            if("1".equals(vo.getStatus())){
+                                rzCount++;
+                            }else if("2".equals(vo.getStatus())){
+                                wrzCount++;
+                            }
+                        }
+                        if("1".equals(dto.getStatus())){
+                            rzCount++;
+                        }else if("2".equals(dto.getStatus())){
+                            wrzCount++;
+                        }
+                        if(users!=null && users.size()>0){
+                            userIds = users.stream().map(SysUserTeamDto::getId).collect(Collectors.toList());
+                        }
+                        userIds.add(dto.getUserId());
+                        dto.setIsFactorVerify(rzCount+"");
+                        dto.setIsNotFactorVerify(wrzCount+"");
+                        dto.setTotalManpower(userIds.size()+"");
+                        userIds.add(dto.getUserId());
+                        TaskStatisticsDto taskStatisticsDto = insAreaCompanyMapper.numberQuotationsByUserIds(userIds,qxFrontlineAgentVo.getMonth());
+                        dto.setOrderNumber(taskStatisticsDto.getOrderNumber());
+                        dto.setUnderwritingCount(taskStatisticsDto.getUnderwritingCount().toString());
+                        dto.setQutationInsureCount(taskStatisticsDto.getQutationInsureCount());
+                        dto.setTotalPremium(taskStatisticsDto.getTotalPremium());
+                        newList.add(dto);
+                    }
                 }
                 }
+                pages.setRecords(newList);
             }
             }
-            return HttpResult.ok(userResultPage);
+
+            return HttpResult.ok(pages);
         } catch (Exception e) {
         } catch (Exception e) {
             e.printStackTrace();
             e.printStackTrace();
             return HttpResult.error("查询异常");
             return HttpResult.error("查询异常");
         }
         }
     }
     }
 
 
+    private List<String> getStrings(QxFrontlineAgentVo qxFrontlineAgentVo) {
+        String type = qxFrontlineAgentVo.getType();
+        String status ="";
+        String level ="";
+        if("0".equals(type)){
+            //汇总  查询所有的代理人数据
+            status =null;
+            level =null;
+        }else if("1".equals(type)){
+            status ="1";
+            level ="0";
+        }
+        else if("2".equals(type)){
+            status ="1";
+            level ="1";
+        }
+        else if("3".equals(type)){
+            status ="1";
+            level ="2";
+        }
+        else if("4".equals(type)){
+            status ="1";
+            level ="3";
+        }
+        else if("5".equals(type)){
+            status ="2";
+            level =null;
+        }
+        List<String> userIds=new ArrayList<String>();
+        List<SysUserTeamDto> userList = esmUserReferrerMapper.getByTeamByLevel(qxFrontlineAgentVo.getUserId(), level, status);
+        if(userList!=null && userList.size()>0) {
+            userIds = userList.stream().map(SysUserTeamDto::getId).collect(Collectors.toList());
+        }
+        if ("0".equals(type)) {
+            userIds.add(qxFrontlineAgentVo.getUserId());
+        } else if ("1".equals(type)) {
+            userIds.add(qxFrontlineAgentVo.getUserId());
+        }
+        return userIds;
+    }
     @Override
     @Override
     public QxFrontlineAgentDto getByUserId(String userId) {
     public QxFrontlineAgentDto getByUserId(String userId) {
         SysUserBaseVO sysUserBaseVO = sysUserMapper.selectUserById(userId);
         SysUserBaseVO sysUserBaseVO = sysUserMapper.selectUserById(userId);
         QxFrontlineAgentDto qxFrontlineAgentDto = new QxFrontlineAgentDto();
         QxFrontlineAgentDto qxFrontlineAgentDto = new QxFrontlineAgentDto();
-
-        HashMap<String, List<String>> humanResourcesIdList = new HashMap<>();
-        HashMap<String, Integer> humanResources = new HashMap<>();
-
         if(ObjectUtils.isNotEmpty(sysUserBaseVO)){
         if(ObjectUtils.isNotEmpty(sysUserBaseVO)){
             qxFrontlineAgentDto.setName(sysUserBaseVO.getName());
             qxFrontlineAgentDto.setName(sysUserBaseVO.getName());
             qxFrontlineAgentDto.setUserId(sysUserBaseVO.getUserId());
             qxFrontlineAgentDto.setUserId(sysUserBaseVO.getUserId());
-            qxFrontlineAgentDto.setUserPhone(sysUserBaseVO.getPDeptId());
-            qxFrontlineAgentDto.setUserDate(sysUserBaseVO.getSubmitTime());
-        }
-        List<EsmUserReferrerDTO> employeeIncreaseReportDtos = esmUserReferrerMapper.getbyUserNextLevel(null);
-        Map<String, EsmUserReferrerDTO> collect = employeeIncreaseReportDtos.stream().collect(Collectors.toMap(EsmUserReferrerDTO::getId, Function.identity()));
-        Set<String> visited = new HashSet<>();
-        for (EsmUserReferrerDTO item : employeeIncreaseReportDtos) {
-            Integer count = this.nextLevelUser(item.getId(), collect, visited);
-            humanResources.put(item.getId(), count);
-            List<String> ids = new ArrayList<>();
-            humanResourcesIdList.put(item.getId(), this.nextLevelUserList(item.getId(), collect, visited, ids));
-        }
-
-        if (humanResourcesIdList.containsKey(userId)) {
-            if (!CollectionUtils.isEmpty(humanResourcesIdList.get(userId))) {
-                //出单人力
-                List<String> ids = humanResourcesIdList.get(userId);
-                QxFrontlineAgentDto orderManpower = insAreaCompanyService.getOrderManpower(ids);
-                String orderManpower1 = orderManpower.getOrderManpower();//出单人力
-                qxFrontlineAgentDto.setOrderManpower(orderManpower1);
-            }
+            qxFrontlineAgentDto.setUserPhone(sysUserBaseVO.getMobile());
+            qxFrontlineAgentDto.setUserDate(sysUserBaseVO.getCreateTime());
+        }
+        //查询出单人力
+        List<SysUserTeamDto> users = esmUserReferrerMapper.getUserIdsByUserId(userId);
+        List<String> userIds =new ArrayList<String>();
+        if(users!=null && users.size()>0){
+            userIds = users.stream().map(SysUserTeamDto::getId).collect(Collectors.toList());
+        }
+        userIds.add(userId);
+        QxFrontlineAgentDto orderManpower = insAreaCompanyService.getOrderManpower(userIds);
+        if(orderManpower==null){
+            qxFrontlineAgentDto.setOrderManpower("0");
+            qxFrontlineAgentDto.setTotalPremium("0");
+        }else{
+            qxFrontlineAgentDto.setOrderManpower(orderManpower.getOrderManpower());
+            qxFrontlineAgentDto.setTotalPremium(orderManpower.getTotalPremium());
         }
         }
         return qxFrontlineAgentDto;
         return qxFrontlineAgentDto;
     }
     }
@@ -761,39 +750,60 @@ public class UserReportServiceImpl implements UserReportService {
     @Override
     @Override
     public HttpResult<List<QxFrontlineAgentDto>> queryChannelDetails(QxFrontlineAgentVo qxFrontlineAgentVo) {
     public HttpResult<List<QxFrontlineAgentDto>> queryChannelDetails(QxFrontlineAgentVo qxFrontlineAgentVo) {
         List<QxFrontlineAgentDto> resultList = new ArrayList<>();
         List<QxFrontlineAgentDto> resultList = new ArrayList<>();
+        HashMap<String, String> map = getDateMapByType(qxFrontlineAgentVo.getDays(), qxFrontlineAgentVo.getCreatetimeStart(), qxFrontlineAgentVo.getCreatetimeEnd());
         String userId = qxFrontlineAgentVo.getUserId();
         String userId = qxFrontlineAgentVo.getUserId();
-//        SysUser sysUserItem = sysUserMapper.getByUserId(userId);
-//        if(sysUserItem.getManagementSource().equals("2")){  //2为代理人
-//            return HttpResult.error("该用户不是渠道");
-//        }
-//      判断是否是团队长
+        qxFrontlineAgentVo.setCreatetimeStart(map.get("startDate"));
+        qxFrontlineAgentVo.setCreatetimeEnd(map.get("endDate"));
+        //      判断是否是团队长
         QueryWrapper<SysUserRole> queryWrapper = new QueryWrapper<>();
         QueryWrapper<SysUserRole> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("user_id", userId);
         queryWrapper.eq("user_id", userId);
         SysUserRole sysUserRole = sysUserRoleMapper.selectOne(queryWrapper);
         SysUserRole sysUserRole = sysUserRoleMapper.selectOne(queryWrapper);
+        SysUser sysUser = sysUserMapper.selectById(userId);
         if (ObjectUtils.isNotEmpty(sysUserRole) && StringUtils.isNotEmpty(sysUserRole.getRoleId().toString()) && "21".equals(sysUserRole.getRoleId().toString())) { //负责人
         if (ObjectUtils.isNotEmpty(sysUserRole) && StringUtils.isNotEmpty(sysUserRole.getRoleId().toString()) && "21".equals(sysUserRole.getRoleId().toString())) { //负责人
             QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
             QueryWrapper<SysUser> wrapper = new QueryWrapper<>();
             wrapper.eq("operatorCode", userId);
             wrapper.eq("operatorCode", userId);
             wrapper.eq("status", "1");
             wrapper.eq("status", "1");
             List<SysUser> sysUsers = sysUserMapper.selectList(wrapper);
             List<SysUser> sysUsers = sysUserMapper.selectList(wrapper);
-            if (!sysUsers.isEmpty()) {
-                for (SysUser  itemUser  :sysUsers){
-                    QxFrontlineAgentDto qxFrontlineAgentDto = new QxFrontlineAgentDto();
-                    qxFrontlineAgentDto.setIds(new ArrayList<>());
-                    qxFrontlineAgentDto.setCreatetimeEnd(qxFrontlineAgentVo.getCreatetimeEnd());
-                    qxFrontlineAgentDto.setCreatetimeStart(qxFrontlineAgentVo.getCreatetimeStart());
-                    qxFrontlineAgentDto.getIds().add(itemUser.getId());
-                    QxFrontlineAgentDto taskStatisticsDto = insAreaCompanyMapper.getOrderManpowerNew(qxFrontlineAgentDto);
-                    resultList.add(taskStatisticsDto);
+            if(sysUsers==null){
+                sysUsers =new ArrayList<>();
+            }
+            sysUsers.add(sysUser);
+            for (SysUser  user  :sysUsers){
+                QxFrontlineAgentDto qxFrontlineAgentDto = new QxFrontlineAgentDto();
+                qxFrontlineAgentDto.setIds(new ArrayList<>());
+                qxFrontlineAgentDto.setCreatetimeEnd(qxFrontlineAgentVo.getCreatetimeEnd());
+                qxFrontlineAgentDto.setCreatetimeStart(qxFrontlineAgentVo.getCreatetimeStart());
+                qxFrontlineAgentDto.getIds().add(user.getId());
+                QxFrontlineAgentDto taskStatisticsDto = insAreaCompanyMapper.getChannelOrderManpowerNew(qxFrontlineAgentDto);
+                if(taskStatisticsDto==null){
+                    taskStatisticsDto =new QxFrontlineAgentDto();
+                    taskStatisticsDto.setName(user.getName());
+                    taskStatisticsDto.setUserId(user.getId());
+                    taskStatisticsDto.setUnderwritingCount("0");
+                    taskStatisticsDto.setOrderNumber("0");
+                    taskStatisticsDto.setQutationInsureCount(new BigDecimal("0"));
+                    taskStatisticsDto.setTotalPremium("0");
                 }
                 }
+                resultList.add(taskStatisticsDto);
             }
             }
+        } else{
+            QxFrontlineAgentDto qxFrontlineAgentDto = new QxFrontlineAgentDto();
+            qxFrontlineAgentDto.setIds(new ArrayList<>());
+            qxFrontlineAgentDto.setCreatetimeEnd(qxFrontlineAgentVo.getCreatetimeEnd());
+            qxFrontlineAgentDto.setCreatetimeStart(qxFrontlineAgentVo.getCreatetimeStart());
+            qxFrontlineAgentDto.getIds().add(userId);
+            QxFrontlineAgentDto taskStatisticsDto = insAreaCompanyMapper.getChannelOrderManpowerNew(qxFrontlineAgentDto);
+            if(taskStatisticsDto==null){
+                taskStatisticsDto =new QxFrontlineAgentDto();
+                taskStatisticsDto.setName(sysUser.getName());
+                taskStatisticsDto.setUserId(sysUser.getId());
+                taskStatisticsDto.setUnderwritingCount("0");
+                taskStatisticsDto.setOrderNumber("0");
+                taskStatisticsDto.setQutationInsureCount(new BigDecimal("0"));
+                taskStatisticsDto.setTotalPremium("0");
+            }
+            resultList.add(taskStatisticsDto);
         }
         }
-        QxFrontlineAgentDto qxFrontlineAgentDto = new QxFrontlineAgentDto();
-        qxFrontlineAgentDto.setCreatetimeEnd(qxFrontlineAgentVo.getCreatetimeEnd());
-        qxFrontlineAgentDto.setCreatetimeStart(qxFrontlineAgentVo.getCreatetimeStart());
-        qxFrontlineAgentDto.setIds(new ArrayList<>());
-        qxFrontlineAgentDto.getIds().add(userId);
-        QxFrontlineAgentDto taskStatisticsDto = insAreaCompanyMapper.getOrderManpowerNew(qxFrontlineAgentDto);
-        resultList.add(taskStatisticsDto);
         return HttpResult.ok(resultList);
         return HttpResult.ok(resultList);
     }
     }
 
 

+ 18 - 0
src/main/java/com/ydtech/modules/esm/dao/EsmUserReferrerMapper.java

@@ -238,4 +238,22 @@ public interface EsmUserReferrerMapper extends BaseMapper<EsmUserReferrer> {
     List<EsmUserReferrerDTO> getUserLevel(@Param("vo") QxFrontlineAgentVo qxFrontlineAgentVo);
     List<EsmUserReferrerDTO> getUserLevel(@Param("vo") QxFrontlineAgentVo qxFrontlineAgentVo);
 
 
     EsmTeamPolicyVO queryOrderCountHzNew(List<String> userList, String startDate, String endDate);
     EsmTeamPolicyVO queryOrderCountHzNew(List<String> userList, String startDate, String endDate);
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/29 19:22
+     *  @Description: 通过代理人查询下级的所有代理人信息
+     */
+    List<SysUserTeamDto>  getUserIdsByUserId(@Param("userId") String userId);
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/29 19:22
+     *  @Description: 通过代理人 层级、认证和未认证 信息查询 查询下级的所有代理人信息
+     */
+    List<SysUserTeamDto>  getByTeamByLevel(@Param("userId") String userId,@Param("level") String level,@Param("status") String status);
+
+
 }
 }

+ 18 - 0
src/main/java/com/ydtech/modules/fee/dao/InsFeeOrderNewHistoryMapper.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.fee.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.fee.entity.po.InsFeeOrderNewHistory;
+
+/**
+* @author Administrator
+* @description 针对表【ins_fee_order_new_history】的数据库操作Mapper
+* @createDate 2024-08-30 18:08:47
+* @Entity generator.domain.InsFeeOrderNewHistory
+*/
+public interface InsFeeOrderNewHistoryMapper extends BaseMapper<InsFeeOrderNewHistory> {
+
+}
+
+
+
+

+ 1151 - 0
src/main/java/com/ydtech/modules/fee/entity/po/InsFeeOrderNewHistory.java

@@ -0,0 +1,1151 @@
+package com.ydtech.modules.fee.entity.po;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 
+ * @TableName ins_fee_order_new_history
+ */
+@TableName(value ="ins_fee_order_new_history")
+@Data
+public class InsFeeOrderNewHistory implements Serializable {
+    /**
+     * 主键
+     */
+    @TableId(value = "id")
+    private String id;
+
+    /**
+     * 关联ins_are_company表id
+     */
+    @TableField(value = "ins_order_no")
+    private String insOrderNo;
+
+    /**
+     * 协议id
+     */
+    @TableField(value = "agreement_id")
+    private Long agreementId;
+
+    /**
+     * 使用费用id
+     */
+    @TableField(value = "costs_id")
+    private String costsId;
+
+    /**
+     * 部门id
+     */
+    @TableField(value = "dept_id")
+    private String deptId;
+
+    /**
+     * 用户id
+     */
+    @TableField(value = "user_id")
+    private String userId;
+
+    /**
+     * 交强险保费
+     */
+    @TableField(value = "jq_premium")
+    private BigDecimal jqPremium;
+
+    /**
+     * 商业险保费
+     */
+    @TableField(value = "sy_premium")
+    private BigDecimal syPremium;
+
+    /**
+     * 非车险保费
+     */
+    @TableField(value = "no_premium")
+    private BigDecimal noPremium;
+
+    /**
+     * 交强险不含税保费
+     */
+    @TableField(value = "jq_no_tax_premium")
+    private BigDecimal jqNoTaxPremium;
+
+    /**
+     * 商业险不含税保费
+     */
+    @TableField(value = "sy_no_tax_premium")
+    private BigDecimal syNoTaxPremium;
+
+    /**
+     * 非车险不含税保费
+     */
+    @TableField(value = "no_no_tax_premium")
+    private BigDecimal noNoTaxPremium;
+
+    /**
+     * 交强险费用比例
+     */
+    @TableField(value = "jq_costs_proportion")
+    private BigDecimal jqCostsProportion;
+
+    /**
+     * 交强险总费用
+     */
+    @TableField(value = "jq_costs_premiums")
+    private BigDecimal jqCostsPremiums;
+
+    /**
+     * 商业险费用比例
+     */
+    @TableField(value = "sy_costs_proportion")
+    private BigDecimal syCostsProportion;
+
+    /**
+     * 商业险总费用
+     */
+    @TableField(value = "sy_costs_premiums")
+    private BigDecimal syCostsPremiums;
+
+    /**
+     * 非车险费用比例
+     */
+    @TableField(value = "no_costs_proportion")
+    private BigDecimal noCostsProportion;
+
+    /**
+     * 非车险总费用
+     */
+    @TableField(value = "no_costs_premiums")
+    private BigDecimal noCostsPremiums;
+
+    /**
+     * 交强监管费比例
+     */
+    @TableField(value = "jq_supervise_costs_proportion")
+    private BigDecimal jqSuperviseCostsProportion;
+
+    /**
+     * 交强监管费
+     */
+    @TableField(value = "jq_supervise_costs_premiums")
+    private BigDecimal jqSuperviseCostsPremiums;
+
+    /**
+     * 商业监管费比例
+     */
+    @TableField(value = "sy_supervise_costs_proportion")
+    private BigDecimal sySuperviseCostsProportion;
+
+    /**
+     * 商业监管费
+     */
+    @TableField(value = "sy_supervise_costs_premiums")
+    private BigDecimal sySuperviseCostsPremiums;
+
+    /**
+     * 非车监管费比例
+     */
+    @TableField(value = "no_supervise_costs_proportion")
+    private BigDecimal noSuperviseCostsProportion;
+
+    /**
+     * 非车监管费
+     */
+    @TableField(value = "no_supervise_costs_premiums")
+    private BigDecimal noSuperviseCostsPremiums;
+
+    /**
+     * 交强其他费用比例
+     */
+    @TableField(value = "jq_other_costs_proportion")
+    private BigDecimal jqOtherCostsProportion;
+
+    /**
+     * 交强其他费
+     */
+    @TableField(value = "jq_other_costs_premiums")
+    private BigDecimal jqOtherCostsPremiums;
+
+    /**
+     * 商业其他费用比例
+     */
+    @TableField(value = "sy_other_costs_proportion")
+    private BigDecimal syOtherCostsProportion;
+
+    /**
+     * 商业其他费
+     */
+    @TableField(value = "sy_other_costs_premiums")
+    private BigDecimal syOtherCostsPremiums;
+
+    /**
+     * 非车其他费用比例
+     */
+    @TableField(value = "no_other_costs_proportion")
+    private BigDecimal noOtherCostsProportion;
+
+    /**
+     * 非车其他费
+     */
+    @TableField(value = "no_other_costs_premiums")
+    private BigDecimal noOtherCostsPremiums;
+
+    /**
+     * 交强加投费用比例
+     */
+    @TableField(value = "jq_investment_costs_proportion")
+    private BigDecimal jqInvestmentCostsProportion;
+
+    /**
+     * 交强加投费
+     */
+    @TableField(value = "jq_investment_costs_premiums")
+    private BigDecimal jqInvestmentCostsPremiums;
+
+    /**
+     * 商业加投费用比例
+     */
+    @TableField(value = "sy_investment_costs_proportion")
+    private BigDecimal syInvestmentCostsProportion;
+
+    /**
+     * 商业加投费
+     */
+    @TableField(value = "sy_investment_costs_premiums")
+    private BigDecimal syInvestmentCostsPremiums;
+
+    /**
+     * 交强一级机构管理费比例
+     */
+    @TableField(value = "jq_dept_proportion_level_1")
+    private BigDecimal jqDeptProportionLevel1;
+
+    /**
+     * 交强一级机构管理费
+     */
+    @TableField(value = "jq_dept_premiums_level_1")
+    private BigDecimal jqDeptPremiumsLevel1;
+
+    /**
+     * 商业一级机构管理费比例
+     */
+    @TableField(value = "sy_dept_proportion_level_1")
+    private BigDecimal syDeptProportionLevel1;
+
+    /**
+     * 商业一级机构管理费
+     */
+    @TableField(value = "sy_dept_premiums_level_1")
+    private BigDecimal syDeptPremiumsLevel1;
+
+    /**
+     * 非车一级机构管理费比例
+     */
+    @TableField(value = "no_dept_proportion_level_1")
+    private BigDecimal noDeptProportionLevel1;
+
+    /**
+     * 非车一级机构管理费
+     */
+    @TableField(value = "no_dept_premiums_level_1")
+    private BigDecimal noDeptPremiumsLevel1;
+
+    /**
+     * 交强二级机构管理费比例
+     */
+    @TableField(value = "jq_dept_proportion_level_2")
+    private BigDecimal jqDeptProportionLevel2;
+
+    /**
+     * 交强二级机构管理费
+     */
+    @TableField(value = "jq_dept_premiums_level_2")
+    private BigDecimal jqDeptPremiumsLevel2;
+
+    /**
+     * 商业二级机构管理费比例
+     */
+    @TableField(value = "sy_dept_proportion_level_2")
+    private BigDecimal syDeptProportionLevel2;
+
+    /**
+     * 商业二级机构管理费
+     */
+    @TableField(value = "sy_dept_premiums_level_2")
+    private BigDecimal syDeptPremiumsLevel2;
+
+    /**
+     * 非车二级机构管理费比例
+     */
+    @TableField(value = "no_dept_proportion_level_2")
+    private BigDecimal noDeptProportionLevel2;
+
+    /**
+     * 非车二级机构管理费
+     */
+    @TableField(value = "no_dept_premiums_level_2")
+    private BigDecimal noDeptPremiumsLevel2;
+
+    /**
+     * 交强三级机构管理费比例
+     */
+    @TableField(value = "jq_dept_proportion_level_3")
+    private BigDecimal jqDeptProportionLevel3;
+
+    /**
+     * 交强三级机构管理费
+     */
+    @TableField(value = "jq_dept_premiums_level_3")
+    private BigDecimal jqDeptPremiumsLevel3;
+
+    /**
+     * 商业三级机构管理费比例
+     */
+    @TableField(value = "sy_dept_proportion_level_3")
+    private BigDecimal syDeptProportionLevel3;
+
+    /**
+     * 商业三级机构管理费
+     */
+    @TableField(value = "sy_dept_premiums_level_3")
+    private BigDecimal syDeptPremiumsLevel3;
+
+    /**
+     * 非车三级机构管理费比例
+     */
+    @TableField(value = "no_dept_proportion_level_3")
+    private BigDecimal noDeptProportionLevel3;
+
+    /**
+     * 非车三级机构管理费
+     */
+    @TableField(value = "no_dept_premiums_level_3")
+    private BigDecimal noDeptPremiumsLevel3;
+
+    /**
+     * 交强四级机构管理费比例
+     */
+    @TableField(value = "jq_dept_proportion_level_4")
+    private BigDecimal jqDeptProportionLevel4;
+
+    /**
+     * 交强四级机构管理费
+     */
+    @TableField(value = "jq_dept_premiums_level_4")
+    private BigDecimal jqDeptPremiumsLevel4;
+
+    /**
+     * 商业四级机构管理费比例
+     */
+    @TableField(value = "sy_dept_proportion_level_4")
+    private BigDecimal syDeptProportionLevel4;
+
+    /**
+     * 商业四级机构管理费
+     */
+    @TableField(value = "sy_dept_premiums_level_4")
+    private BigDecimal syDeptPremiumsLevel4;
+
+    /**
+     * 非车四级机构管理费比例
+     */
+    @TableField(value = "no_dept_proportion_level_4")
+    private BigDecimal noDeptProportionLevel4;
+
+    /**
+     * 非车四级机构管理费
+     */
+    @TableField(value = "no_dept_premiums_level_4")
+    private BigDecimal noDeptPremiumsLevel4;
+
+    /**
+     * 交强五级机构管理费比例
+     */
+    @TableField(value = "jq_dept_proportion_level_5")
+    private BigDecimal jqDeptProportionLevel5;
+
+    /**
+     * 交强五级机构管理费
+     */
+    @TableField(value = "jq_dept_premiums_level_5")
+    private BigDecimal jqDeptPremiumsLevel5;
+
+    /**
+     * 商业五级机构管理费比例
+     */
+    @TableField(value = "sy_dept_proportion_level_5")
+    private BigDecimal syDeptProportionLevel5;
+
+    /**
+     * 商业五级机构管理费
+     */
+    @TableField(value = "sy_dept_premiums_level_5")
+    private BigDecimal syDeptPremiumsLevel5;
+
+    /**
+     * 非车五级机构管理费比例
+     */
+    @TableField(value = "no_dept_proportion_level_5")
+    private BigDecimal noDeptProportionLevel5;
+
+    /**
+     * 非车五级机构管理费
+     */
+    @TableField(value = "no_dept_premiums_level_5")
+    private BigDecimal noDeptPremiumsLevel5;
+
+    /**
+     * 交强出口手续费比例
+     */
+    @TableField(value = "jq_costs_export_proportion")
+    private BigDecimal jqCostsExportProportion;
+
+    /**
+     * 商业出口手续费比例
+     */
+    @TableField(value = "sy_costs_export_proportion")
+    private BigDecimal syCostsExportProportion;
+
+    /**
+     * 非车出口手续费比例
+     */
+    @TableField(value = "no_costs_export_proportion")
+    private BigDecimal noCostsExportProportion;
+
+    /**
+     * 交强出口加投比例
+     */
+    @TableField(value = "jq_export_investment_proportion")
+    private BigDecimal jqExportInvestmentProportion;
+
+    /**
+     * 交强出口加投费用
+     */
+    @TableField(value = "jq_export_investment_premiums")
+    private BigDecimal jqExportInvestmentPremiums;
+
+    /**
+     * 商业出口加投比例
+     */
+    @TableField(value = "sy_export_investment_proportion")
+    private BigDecimal syExportInvestmentProportion;
+
+    /**
+     * 商业出口加投费用
+     */
+    @TableField(value = "sy_export_investment_premiums")
+    private BigDecimal syExportInvestmentPremiums;
+
+    /**
+     * 一级分销比例
+     */
+    @TableField(value = "first_detail_proportion")
+    private BigDecimal firstDetailProportion;
+
+    /**
+     * 一级分销费
+     */
+    @TableField(value = "first_detail_premiums")
+    private BigDecimal firstDetailPremiums;
+
+    /**
+     * 二级分销比例
+     */
+    @TableField(value = "second_detail_proportion")
+    private BigDecimal secondDetailProportion;
+
+    /**
+     * 二级分销费
+     */
+    @TableField(value = "second_detail_premiums")
+    private BigDecimal secondDetailPremiums;
+
+    /**
+     * 三级分销比例
+     */
+    @TableField(value = "third_detail_proportion")
+    private BigDecimal thirdDetailProportion;
+
+    /**
+     * 三级分销费
+     */
+    @TableField(value = "third_detail_premiums")
+    private BigDecimal thirdDetailPremiums;
+
+    /**
+     * 一级交强分销比例
+     */
+    @TableField(value = "jq_retail_proportion_level_1")
+    private BigDecimal jqRetailProportionLevel1;
+
+    /**
+     * 一级交强分销费
+     */
+    @TableField(value = "jq_retail_premiums_level_1")
+    private BigDecimal jqRetailPremiumsLevel1;
+
+    /**
+     * 一级商业分销比例
+     */
+    @TableField(value = "sy_retail_proportion_level_1")
+    private BigDecimal syRetailProportionLevel1;
+
+    /**
+     * 一级商业分销费
+     */
+    @TableField(value = "sy_retail_premiums_level_1")
+    private BigDecimal syRetailPremiumsLevel1;
+
+    /**
+     * 一级非车分销比例
+     */
+    @TableField(value = "no_retail_proportion_level_1")
+    private BigDecimal noRetailProportionLevel1;
+
+    /**
+     * 一级非车分销费
+     */
+    @TableField(value = "no_retail_premiums_level_1")
+    private BigDecimal noRetailPremiumsLevel1;
+
+    /**
+     * 二级交强分销比例
+     */
+    @TableField(value = "jq_retail_proportion_level_2")
+    private BigDecimal jqRetailProportionLevel2;
+
+    /**
+     * 二级交强分销费
+     */
+    @TableField(value = "jq_retail_premiums_level_2")
+    private BigDecimal jqRetailPremiumsLevel2;
+
+    /**
+     * 二级商业分销比例
+     */
+    @TableField(value = "sy_retail_proportion_level_2")
+    private BigDecimal syRetailProportionLevel2;
+
+    /**
+     * 二级商业分销费
+     */
+    @TableField(value = "sy_retail_premiums_level_2")
+    private BigDecimal syRetailPremiumsLevel2;
+
+    /**
+     * 二级非车分销比例
+     */
+    @TableField(value = "no_retail_proportion_level_2")
+    private BigDecimal noRetailProportionLevel2;
+
+    /**
+     * 二级非车分销费
+     */
+    @TableField(value = "no_retail_premiums_level_2")
+    private BigDecimal noRetailPremiumsLevel2;
+
+    /**
+     * 三级交强分销比例
+     */
+    @TableField(value = "jq_retail_proportion_level_3")
+    private BigDecimal jqRetailProportionLevel3;
+
+    /**
+     * 三级交强分销费
+     */
+    @TableField(value = "jq_retail_premiums_level_3")
+    private BigDecimal jqRetailPremiumsLevel3;
+
+    /**
+     * 三级商业分销比例
+     */
+    @TableField(value = "sy_retail_proportion_level_3")
+    private BigDecimal syRetailProportionLevel3;
+
+    /**
+     * 三级商业分销费
+     */
+    @TableField(value = "sy_retail_premiums_level_3")
+    private BigDecimal syRetailPremiumsLevel3;
+
+    /**
+     * 三级非车分销比例
+     */
+    @TableField(value = "no_retail_proportion_level_3")
+    private BigDecimal noRetailProportionLevel3;
+
+    /**
+     * 三级非车分销费
+     */
+    @TableField(value = "no_retail_premiums_level_3")
+    private BigDecimal noRetailPremiumsLevel3;
+
+    /**
+     * 创建时间
+     */
+    @TableField(value = "create_time")
+    private Date createTime;
+
+    /**
+     * 一级分销用户id
+     */
+    @TableField(value = "first_level_user_id")
+    private String firstLevelUserId;
+
+    /**
+     * 二级分销用户id
+     */
+    @TableField(value = "two_level_user_id")
+    private String twoLevelUserId;
+
+    /**
+     * 三级分销用户id
+     */
+    @TableField(value = "three_level_user_id")
+    private String threeLevelUserId;
+
+    /**
+     * 分销等级
+     */
+    @TableField(value = "distribution_status")
+    private String distributionStatus;
+
+    /**
+     * 机构分销费用
+     */
+    @TableField(value = "dept_distribution")
+    private BigDecimal deptDistribution;
+
+    /**
+     * 交强手续费出口金额
+     */
+    @TableField(value = "jq_export_supervise_costs_premiums")
+    private BigDecimal jqExportSuperviseCostsPremiums;
+
+    /**
+     * 商业手续费出口金额
+     */
+    @TableField(value = "sy_export_supervise_costs_premiums")
+    private BigDecimal syExportSuperviseCostsPremiums;
+
+    /**
+     * 非车手续费出口金额
+     */
+    @TableField(value = "no_export_supervise_costs_premiums")
+    private BigDecimal noExportSuperviseCostsPremiums;
+
+    /**
+     * 交强其他费用出口比例
+     */
+    @TableField(value = "jq_export_other_costs_proportion")
+    private BigDecimal jqExportOtherCostsProportion;
+
+    /**
+     * 商业其他费用出口比例
+     */
+    @TableField(value = "sy_export_other_costs_proportion")
+    private BigDecimal syExportOtherCostsProportion;
+
+    /**
+     * 非车其他费用出口比例
+     */
+    @TableField(value = "no_export_other_costs_proportion")
+    private BigDecimal noExportOtherCostsProportion;
+
+    /**
+     * 交强其他费用出口金额
+     */
+    @TableField(value = "jq_export_other_costs_premiums")
+    private BigDecimal jqExportOtherCostsPremiums;
+
+    /**
+     * 商业其他费用出口金额
+     */
+    @TableField(value = "sy_export_other_costs_premiums")
+    private BigDecimal syExportOtherCostsPremiums;
+
+    /**
+     * 非车其他费用出口金额
+     */
+    @TableField(value = "no_export_other_costs_premiums")
+    private BigDecimal noExportOtherCostsPremiums;
+
+    /**
+     * 交强利润差值
+     */
+    @TableField(value = "jq_profit_margin_premiums")
+    private BigDecimal jqProfitMarginPremiums;
+
+    /**
+     * 商业利润差值
+     */
+    @TableField(value = "sy_profit_margin_premiums")
+    private BigDecimal syProfitMarginPremiums;
+
+    /**
+     * 非车利润差值
+     */
+    @TableField(value = "no_profit_margin_premiums")
+    private BigDecimal noProfitMarginPremiums;
+
+    /**
+     * 交强外部比例
+     */
+    @TableField(value = "jq_external_proportion")
+    private BigDecimal jqExternalProportion;
+
+    /**
+     * 商业外部比例
+     */
+    @TableField(value = "sy_external_proportion")
+    private BigDecimal syExternalProportion;
+
+    /**
+     * 飞车外部比例
+     */
+    @TableField(value = "no_external_proportion")
+    private BigDecimal noExternalProportion;
+
+    /**
+     * 交强外部金额
+     */
+    @TableField(value = "jq_external_premiums")
+    private BigDecimal jqExternalPremiums;
+
+    /**
+     * 交强外部金额
+     */
+    @TableField(value = "sy_external_premiums")
+    private BigDecimal syExternalPremiums;
+
+    /**
+     * 交强外部金额
+     */
+    @TableField(value = "no_external_premiums")
+    private BigDecimal noExternalPremiums;
+
+    /**
+     * 操作人id
+     */
+    @TableField(value = "operator_id")
+    private String operatorId;
+
+    /**
+     * 操作时间
+     */
+    @TableField(value = "operator_time")
+    private Date operatorTime;
+
+    /**
+     * 0 不是首次 1 为首次
+     */
+    @TableField(value = "is_first")
+    private Integer isFirst;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        InsFeeOrderNewHistory other = (InsFeeOrderNewHistory) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getInsOrderNo() == null ? other.getInsOrderNo() == null : this.getInsOrderNo().equals(other.getInsOrderNo()))
+            && (this.getAgreementId() == null ? other.getAgreementId() == null : this.getAgreementId().equals(other.getAgreementId()))
+            && (this.getCostsId() == null ? other.getCostsId() == null : this.getCostsId().equals(other.getCostsId()))
+            && (this.getDeptId() == null ? other.getDeptId() == null : this.getDeptId().equals(other.getDeptId()))
+            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
+            && (this.getJqPremium() == null ? other.getJqPremium() == null : this.getJqPremium().equals(other.getJqPremium()))
+            && (this.getSyPremium() == null ? other.getSyPremium() == null : this.getSyPremium().equals(other.getSyPremium()))
+            && (this.getNoPremium() == null ? other.getNoPremium() == null : this.getNoPremium().equals(other.getNoPremium()))
+            && (this.getJqNoTaxPremium() == null ? other.getJqNoTaxPremium() == null : this.getJqNoTaxPremium().equals(other.getJqNoTaxPremium()))
+            && (this.getSyNoTaxPremium() == null ? other.getSyNoTaxPremium() == null : this.getSyNoTaxPremium().equals(other.getSyNoTaxPremium()))
+            && (this.getNoNoTaxPremium() == null ? other.getNoNoTaxPremium() == null : this.getNoNoTaxPremium().equals(other.getNoNoTaxPremium()))
+            && (this.getJqCostsProportion() == null ? other.getJqCostsProportion() == null : this.getJqCostsProportion().equals(other.getJqCostsProportion()))
+            && (this.getJqCostsPremiums() == null ? other.getJqCostsPremiums() == null : this.getJqCostsPremiums().equals(other.getJqCostsPremiums()))
+            && (this.getSyCostsProportion() == null ? other.getSyCostsProportion() == null : this.getSyCostsProportion().equals(other.getSyCostsProportion()))
+            && (this.getSyCostsPremiums() == null ? other.getSyCostsPremiums() == null : this.getSyCostsPremiums().equals(other.getSyCostsPremiums()))
+            && (this.getNoCostsProportion() == null ? other.getNoCostsProportion() == null : this.getNoCostsProportion().equals(other.getNoCostsProportion()))
+            && (this.getNoCostsPremiums() == null ? other.getNoCostsPremiums() == null : this.getNoCostsPremiums().equals(other.getNoCostsPremiums()))
+            && (this.getJqSuperviseCostsProportion() == null ? other.getJqSuperviseCostsProportion() == null : this.getJqSuperviseCostsProportion().equals(other.getJqSuperviseCostsProportion()))
+            && (this.getJqSuperviseCostsPremiums() == null ? other.getJqSuperviseCostsPremiums() == null : this.getJqSuperviseCostsPremiums().equals(other.getJqSuperviseCostsPremiums()))
+            && (this.getSySuperviseCostsProportion() == null ? other.getSySuperviseCostsProportion() == null : this.getSySuperviseCostsProportion().equals(other.getSySuperviseCostsProportion()))
+            && (this.getSySuperviseCostsPremiums() == null ? other.getSySuperviseCostsPremiums() == null : this.getSySuperviseCostsPremiums().equals(other.getSySuperviseCostsPremiums()))
+            && (this.getNoSuperviseCostsProportion() == null ? other.getNoSuperviseCostsProportion() == null : this.getNoSuperviseCostsProportion().equals(other.getNoSuperviseCostsProportion()))
+            && (this.getNoSuperviseCostsPremiums() == null ? other.getNoSuperviseCostsPremiums() == null : this.getNoSuperviseCostsPremiums().equals(other.getNoSuperviseCostsPremiums()))
+            && (this.getJqOtherCostsProportion() == null ? other.getJqOtherCostsProportion() == null : this.getJqOtherCostsProportion().equals(other.getJqOtherCostsProportion()))
+            && (this.getJqOtherCostsPremiums() == null ? other.getJqOtherCostsPremiums() == null : this.getJqOtherCostsPremiums().equals(other.getJqOtherCostsPremiums()))
+            && (this.getSyOtherCostsProportion() == null ? other.getSyOtherCostsProportion() == null : this.getSyOtherCostsProportion().equals(other.getSyOtherCostsProportion()))
+            && (this.getSyOtherCostsPremiums() == null ? other.getSyOtherCostsPremiums() == null : this.getSyOtherCostsPremiums().equals(other.getSyOtherCostsPremiums()))
+            && (this.getNoOtherCostsProportion() == null ? other.getNoOtherCostsProportion() == null : this.getNoOtherCostsProportion().equals(other.getNoOtherCostsProportion()))
+            && (this.getNoOtherCostsPremiums() == null ? other.getNoOtherCostsPremiums() == null : this.getNoOtherCostsPremiums().equals(other.getNoOtherCostsPremiums()))
+            && (this.getJqInvestmentCostsProportion() == null ? other.getJqInvestmentCostsProportion() == null : this.getJqInvestmentCostsProportion().equals(other.getJqInvestmentCostsProportion()))
+            && (this.getJqInvestmentCostsPremiums() == null ? other.getJqInvestmentCostsPremiums() == null : this.getJqInvestmentCostsPremiums().equals(other.getJqInvestmentCostsPremiums()))
+            && (this.getSyInvestmentCostsProportion() == null ? other.getSyInvestmentCostsProportion() == null : this.getSyInvestmentCostsProportion().equals(other.getSyInvestmentCostsProportion()))
+            && (this.getSyInvestmentCostsPremiums() == null ? other.getSyInvestmentCostsPremiums() == null : this.getSyInvestmentCostsPremiums().equals(other.getSyInvestmentCostsPremiums()))
+            && (this.getJqDeptProportionLevel1() == null ? other.getJqDeptProportionLevel1() == null : this.getJqDeptProportionLevel1().equals(other.getJqDeptProportionLevel1()))
+            && (this.getJqDeptPremiumsLevel1() == null ? other.getJqDeptPremiumsLevel1() == null : this.getJqDeptPremiumsLevel1().equals(other.getJqDeptPremiumsLevel1()))
+            && (this.getSyDeptProportionLevel1() == null ? other.getSyDeptProportionLevel1() == null : this.getSyDeptProportionLevel1().equals(other.getSyDeptProportionLevel1()))
+            && (this.getSyDeptPremiumsLevel1() == null ? other.getSyDeptPremiumsLevel1() == null : this.getSyDeptPremiumsLevel1().equals(other.getSyDeptPremiumsLevel1()))
+            && (this.getNoDeptProportionLevel1() == null ? other.getNoDeptProportionLevel1() == null : this.getNoDeptProportionLevel1().equals(other.getNoDeptProportionLevel1()))
+            && (this.getNoDeptPremiumsLevel1() == null ? other.getNoDeptPremiumsLevel1() == null : this.getNoDeptPremiumsLevel1().equals(other.getNoDeptPremiumsLevel1()))
+            && (this.getJqDeptProportionLevel2() == null ? other.getJqDeptProportionLevel2() == null : this.getJqDeptProportionLevel2().equals(other.getJqDeptProportionLevel2()))
+            && (this.getJqDeptPremiumsLevel2() == null ? other.getJqDeptPremiumsLevel2() == null : this.getJqDeptPremiumsLevel2().equals(other.getJqDeptPremiumsLevel2()))
+            && (this.getSyDeptProportionLevel2() == null ? other.getSyDeptProportionLevel2() == null : this.getSyDeptProportionLevel2().equals(other.getSyDeptProportionLevel2()))
+            && (this.getSyDeptPremiumsLevel2() == null ? other.getSyDeptPremiumsLevel2() == null : this.getSyDeptPremiumsLevel2().equals(other.getSyDeptPremiumsLevel2()))
+            && (this.getNoDeptProportionLevel2() == null ? other.getNoDeptProportionLevel2() == null : this.getNoDeptProportionLevel2().equals(other.getNoDeptProportionLevel2()))
+            && (this.getNoDeptPremiumsLevel2() == null ? other.getNoDeptPremiumsLevel2() == null : this.getNoDeptPremiumsLevel2().equals(other.getNoDeptPremiumsLevel2()))
+            && (this.getJqDeptProportionLevel3() == null ? other.getJqDeptProportionLevel3() == null : this.getJqDeptProportionLevel3().equals(other.getJqDeptProportionLevel3()))
+            && (this.getJqDeptPremiumsLevel3() == null ? other.getJqDeptPremiumsLevel3() == null : this.getJqDeptPremiumsLevel3().equals(other.getJqDeptPremiumsLevel3()))
+            && (this.getSyDeptProportionLevel3() == null ? other.getSyDeptProportionLevel3() == null : this.getSyDeptProportionLevel3().equals(other.getSyDeptProportionLevel3()))
+            && (this.getSyDeptPremiumsLevel3() == null ? other.getSyDeptPremiumsLevel3() == null : this.getSyDeptPremiumsLevel3().equals(other.getSyDeptPremiumsLevel3()))
+            && (this.getNoDeptProportionLevel3() == null ? other.getNoDeptProportionLevel3() == null : this.getNoDeptProportionLevel3().equals(other.getNoDeptProportionLevel3()))
+            && (this.getNoDeptPremiumsLevel3() == null ? other.getNoDeptPremiumsLevel3() == null : this.getNoDeptPremiumsLevel3().equals(other.getNoDeptPremiumsLevel3()))
+            && (this.getJqDeptProportionLevel4() == null ? other.getJqDeptProportionLevel4() == null : this.getJqDeptProportionLevel4().equals(other.getJqDeptProportionLevel4()))
+            && (this.getJqDeptPremiumsLevel4() == null ? other.getJqDeptPremiumsLevel4() == null : this.getJqDeptPremiumsLevel4().equals(other.getJqDeptPremiumsLevel4()))
+            && (this.getSyDeptProportionLevel4() == null ? other.getSyDeptProportionLevel4() == null : this.getSyDeptProportionLevel4().equals(other.getSyDeptProportionLevel4()))
+            && (this.getSyDeptPremiumsLevel4() == null ? other.getSyDeptPremiumsLevel4() == null : this.getSyDeptPremiumsLevel4().equals(other.getSyDeptPremiumsLevel4()))
+            && (this.getNoDeptProportionLevel4() == null ? other.getNoDeptProportionLevel4() == null : this.getNoDeptProportionLevel4().equals(other.getNoDeptProportionLevel4()))
+            && (this.getNoDeptPremiumsLevel4() == null ? other.getNoDeptPremiumsLevel4() == null : this.getNoDeptPremiumsLevel4().equals(other.getNoDeptPremiumsLevel4()))
+            && (this.getJqDeptProportionLevel5() == null ? other.getJqDeptProportionLevel5() == null : this.getJqDeptProportionLevel5().equals(other.getJqDeptProportionLevel5()))
+            && (this.getJqDeptPremiumsLevel5() == null ? other.getJqDeptPremiumsLevel5() == null : this.getJqDeptPremiumsLevel5().equals(other.getJqDeptPremiumsLevel5()))
+            && (this.getSyDeptProportionLevel5() == null ? other.getSyDeptProportionLevel5() == null : this.getSyDeptProportionLevel5().equals(other.getSyDeptProportionLevel5()))
+            && (this.getSyDeptPremiumsLevel5() == null ? other.getSyDeptPremiumsLevel5() == null : this.getSyDeptPremiumsLevel5().equals(other.getSyDeptPremiumsLevel5()))
+            && (this.getNoDeptProportionLevel5() == null ? other.getNoDeptProportionLevel5() == null : this.getNoDeptProportionLevel5().equals(other.getNoDeptProportionLevel5()))
+            && (this.getNoDeptPremiumsLevel5() == null ? other.getNoDeptPremiumsLevel5() == null : this.getNoDeptPremiumsLevel5().equals(other.getNoDeptPremiumsLevel5()))
+            && (this.getJqCostsExportProportion() == null ? other.getJqCostsExportProportion() == null : this.getJqCostsExportProportion().equals(other.getJqCostsExportProportion()))
+            && (this.getSyCostsExportProportion() == null ? other.getSyCostsExportProportion() == null : this.getSyCostsExportProportion().equals(other.getSyCostsExportProportion()))
+            && (this.getNoCostsExportProportion() == null ? other.getNoCostsExportProportion() == null : this.getNoCostsExportProportion().equals(other.getNoCostsExportProportion()))
+            && (this.getJqExportInvestmentProportion() == null ? other.getJqExportInvestmentProportion() == null : this.getJqExportInvestmentProportion().equals(other.getJqExportInvestmentProportion()))
+            && (this.getJqExportInvestmentPremiums() == null ? other.getJqExportInvestmentPremiums() == null : this.getJqExportInvestmentPremiums().equals(other.getJqExportInvestmentPremiums()))
+            && (this.getSyExportInvestmentProportion() == null ? other.getSyExportInvestmentProportion() == null : this.getSyExportInvestmentProportion().equals(other.getSyExportInvestmentProportion()))
+            && (this.getSyExportInvestmentPremiums() == null ? other.getSyExportInvestmentPremiums() == null : this.getSyExportInvestmentPremiums().equals(other.getSyExportInvestmentPremiums()))
+            && (this.getFirstDetailProportion() == null ? other.getFirstDetailProportion() == null : this.getFirstDetailProportion().equals(other.getFirstDetailProportion()))
+            && (this.getFirstDetailPremiums() == null ? other.getFirstDetailPremiums() == null : this.getFirstDetailPremiums().equals(other.getFirstDetailPremiums()))
+            && (this.getSecondDetailProportion() == null ? other.getSecondDetailProportion() == null : this.getSecondDetailProportion().equals(other.getSecondDetailProportion()))
+            && (this.getSecondDetailPremiums() == null ? other.getSecondDetailPremiums() == null : this.getSecondDetailPremiums().equals(other.getSecondDetailPremiums()))
+            && (this.getThirdDetailProportion() == null ? other.getThirdDetailProportion() == null : this.getThirdDetailProportion().equals(other.getThirdDetailProportion()))
+            && (this.getThirdDetailPremiums() == null ? other.getThirdDetailPremiums() == null : this.getThirdDetailPremiums().equals(other.getThirdDetailPremiums()))
+            && (this.getJqRetailProportionLevel1() == null ? other.getJqRetailProportionLevel1() == null : this.getJqRetailProportionLevel1().equals(other.getJqRetailProportionLevel1()))
+            && (this.getJqRetailPremiumsLevel1() == null ? other.getJqRetailPremiumsLevel1() == null : this.getJqRetailPremiumsLevel1().equals(other.getJqRetailPremiumsLevel1()))
+            && (this.getSyRetailProportionLevel1() == null ? other.getSyRetailProportionLevel1() == null : this.getSyRetailProportionLevel1().equals(other.getSyRetailProportionLevel1()))
+            && (this.getSyRetailPremiumsLevel1() == null ? other.getSyRetailPremiumsLevel1() == null : this.getSyRetailPremiumsLevel1().equals(other.getSyRetailPremiumsLevel1()))
+            && (this.getNoRetailProportionLevel1() == null ? other.getNoRetailProportionLevel1() == null : this.getNoRetailProportionLevel1().equals(other.getNoRetailProportionLevel1()))
+            && (this.getNoRetailPremiumsLevel1() == null ? other.getNoRetailPremiumsLevel1() == null : this.getNoRetailPremiumsLevel1().equals(other.getNoRetailPremiumsLevel1()))
+            && (this.getJqRetailProportionLevel2() == null ? other.getJqRetailProportionLevel2() == null : this.getJqRetailProportionLevel2().equals(other.getJqRetailProportionLevel2()))
+            && (this.getJqRetailPremiumsLevel2() == null ? other.getJqRetailPremiumsLevel2() == null : this.getJqRetailPremiumsLevel2().equals(other.getJqRetailPremiumsLevel2()))
+            && (this.getSyRetailProportionLevel2() == null ? other.getSyRetailProportionLevel2() == null : this.getSyRetailProportionLevel2().equals(other.getSyRetailProportionLevel2()))
+            && (this.getSyRetailPremiumsLevel2() == null ? other.getSyRetailPremiumsLevel2() == null : this.getSyRetailPremiumsLevel2().equals(other.getSyRetailPremiumsLevel2()))
+            && (this.getNoRetailProportionLevel2() == null ? other.getNoRetailProportionLevel2() == null : this.getNoRetailProportionLevel2().equals(other.getNoRetailProportionLevel2()))
+            && (this.getNoRetailPremiumsLevel2() == null ? other.getNoRetailPremiumsLevel2() == null : this.getNoRetailPremiumsLevel2().equals(other.getNoRetailPremiumsLevel2()))
+            && (this.getJqRetailProportionLevel3() == null ? other.getJqRetailProportionLevel3() == null : this.getJqRetailProportionLevel3().equals(other.getJqRetailProportionLevel3()))
+            && (this.getJqRetailPremiumsLevel3() == null ? other.getJqRetailPremiumsLevel3() == null : this.getJqRetailPremiumsLevel3().equals(other.getJqRetailPremiumsLevel3()))
+            && (this.getSyRetailProportionLevel3() == null ? other.getSyRetailProportionLevel3() == null : this.getSyRetailProportionLevel3().equals(other.getSyRetailProportionLevel3()))
+            && (this.getSyRetailPremiumsLevel3() == null ? other.getSyRetailPremiumsLevel3() == null : this.getSyRetailPremiumsLevel3().equals(other.getSyRetailPremiumsLevel3()))
+            && (this.getNoRetailProportionLevel3() == null ? other.getNoRetailProportionLevel3() == null : this.getNoRetailProportionLevel3().equals(other.getNoRetailProportionLevel3()))
+            && (this.getNoRetailPremiumsLevel3() == null ? other.getNoRetailPremiumsLevel3() == null : this.getNoRetailPremiumsLevel3().equals(other.getNoRetailPremiumsLevel3()))
+            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
+            && (this.getFirstLevelUserId() == null ? other.getFirstLevelUserId() == null : this.getFirstLevelUserId().equals(other.getFirstLevelUserId()))
+            && (this.getTwoLevelUserId() == null ? other.getTwoLevelUserId() == null : this.getTwoLevelUserId().equals(other.getTwoLevelUserId()))
+            && (this.getThreeLevelUserId() == null ? other.getThreeLevelUserId() == null : this.getThreeLevelUserId().equals(other.getThreeLevelUserId()))
+            && (this.getDistributionStatus() == null ? other.getDistributionStatus() == null : this.getDistributionStatus().equals(other.getDistributionStatus()))
+            && (this.getDeptDistribution() == null ? other.getDeptDistribution() == null : this.getDeptDistribution().equals(other.getDeptDistribution()))
+            && (this.getJqExportSuperviseCostsPremiums() == null ? other.getJqExportSuperviseCostsPremiums() == null : this.getJqExportSuperviseCostsPremiums().equals(other.getJqExportSuperviseCostsPremiums()))
+            && (this.getSyExportSuperviseCostsPremiums() == null ? other.getSyExportSuperviseCostsPremiums() == null : this.getSyExportSuperviseCostsPremiums().equals(other.getSyExportSuperviseCostsPremiums()))
+            && (this.getNoExportSuperviseCostsPremiums() == null ? other.getNoExportSuperviseCostsPremiums() == null : this.getNoExportSuperviseCostsPremiums().equals(other.getNoExportSuperviseCostsPremiums()))
+            && (this.getJqExportOtherCostsProportion() == null ? other.getJqExportOtherCostsProportion() == null : this.getJqExportOtherCostsProportion().equals(other.getJqExportOtherCostsProportion()))
+            && (this.getSyExportOtherCostsProportion() == null ? other.getSyExportOtherCostsProportion() == null : this.getSyExportOtherCostsProportion().equals(other.getSyExportOtherCostsProportion()))
+            && (this.getNoExportOtherCostsProportion() == null ? other.getNoExportOtherCostsProportion() == null : this.getNoExportOtherCostsProportion().equals(other.getNoExportOtherCostsProportion()))
+            && (this.getJqExportOtherCostsPremiums() == null ? other.getJqExportOtherCostsPremiums() == null : this.getJqExportOtherCostsPremiums().equals(other.getJqExportOtherCostsPremiums()))
+            && (this.getSyExportOtherCostsPremiums() == null ? other.getSyExportOtherCostsPremiums() == null : this.getSyExportOtherCostsPremiums().equals(other.getSyExportOtherCostsPremiums()))
+            && (this.getNoExportOtherCostsPremiums() == null ? other.getNoExportOtherCostsPremiums() == null : this.getNoExportOtherCostsPremiums().equals(other.getNoExportOtherCostsPremiums()))
+            && (this.getJqProfitMarginPremiums() == null ? other.getJqProfitMarginPremiums() == null : this.getJqProfitMarginPremiums().equals(other.getJqProfitMarginPremiums()))
+            && (this.getSyProfitMarginPremiums() == null ? other.getSyProfitMarginPremiums() == null : this.getSyProfitMarginPremiums().equals(other.getSyProfitMarginPremiums()))
+            && (this.getNoProfitMarginPremiums() == null ? other.getNoProfitMarginPremiums() == null : this.getNoProfitMarginPremiums().equals(other.getNoProfitMarginPremiums()))
+            && (this.getJqExternalProportion() == null ? other.getJqExternalProportion() == null : this.getJqExternalProportion().equals(other.getJqExternalProportion()))
+            && (this.getSyExternalProportion() == null ? other.getSyExternalProportion() == null : this.getSyExternalProportion().equals(other.getSyExternalProportion()))
+            && (this.getNoExternalProportion() == null ? other.getNoExternalProportion() == null : this.getNoExternalProportion().equals(other.getNoExternalProportion()))
+            && (this.getJqExternalPremiums() == null ? other.getJqExternalPremiums() == null : this.getJqExternalPremiums().equals(other.getJqExternalPremiums()))
+            && (this.getSyExternalPremiums() == null ? other.getSyExternalPremiums() == null : this.getSyExternalPremiums().equals(other.getSyExternalPremiums()))
+            && (this.getNoExternalPremiums() == null ? other.getNoExternalPremiums() == null : this.getNoExternalPremiums().equals(other.getNoExternalPremiums()))
+            && (this.getOperatorId() == null ? other.getOperatorId() == null : this.getOperatorId().equals(other.getOperatorId()))
+            && (this.getOperatorTime() == null ? other.getOperatorTime() == null : this.getOperatorTime().equals(other.getOperatorTime()))
+            && (this.getIsFirst() == null ? other.getIsFirst() == null : this.getIsFirst().equals(other.getIsFirst()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getInsOrderNo() == null) ? 0 : getInsOrderNo().hashCode());
+        result = prime * result + ((getAgreementId() == null) ? 0 : getAgreementId().hashCode());
+        result = prime * result + ((getCostsId() == null) ? 0 : getCostsId().hashCode());
+        result = prime * result + ((getDeptId() == null) ? 0 : getDeptId().hashCode());
+        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
+        result = prime * result + ((getJqPremium() == null) ? 0 : getJqPremium().hashCode());
+        result = prime * result + ((getSyPremium() == null) ? 0 : getSyPremium().hashCode());
+        result = prime * result + ((getNoPremium() == null) ? 0 : getNoPremium().hashCode());
+        result = prime * result + ((getJqNoTaxPremium() == null) ? 0 : getJqNoTaxPremium().hashCode());
+        result = prime * result + ((getSyNoTaxPremium() == null) ? 0 : getSyNoTaxPremium().hashCode());
+        result = prime * result + ((getNoNoTaxPremium() == null) ? 0 : getNoNoTaxPremium().hashCode());
+        result = prime * result + ((getJqCostsProportion() == null) ? 0 : getJqCostsProportion().hashCode());
+        result = prime * result + ((getJqCostsPremiums() == null) ? 0 : getJqCostsPremiums().hashCode());
+        result = prime * result + ((getSyCostsProportion() == null) ? 0 : getSyCostsProportion().hashCode());
+        result = prime * result + ((getSyCostsPremiums() == null) ? 0 : getSyCostsPremiums().hashCode());
+        result = prime * result + ((getNoCostsProportion() == null) ? 0 : getNoCostsProportion().hashCode());
+        result = prime * result + ((getNoCostsPremiums() == null) ? 0 : getNoCostsPremiums().hashCode());
+        result = prime * result + ((getJqSuperviseCostsProportion() == null) ? 0 : getJqSuperviseCostsProportion().hashCode());
+        result = prime * result + ((getJqSuperviseCostsPremiums() == null) ? 0 : getJqSuperviseCostsPremiums().hashCode());
+        result = prime * result + ((getSySuperviseCostsProportion() == null) ? 0 : getSySuperviseCostsProportion().hashCode());
+        result = prime * result + ((getSySuperviseCostsPremiums() == null) ? 0 : getSySuperviseCostsPremiums().hashCode());
+        result = prime * result + ((getNoSuperviseCostsProportion() == null) ? 0 : getNoSuperviseCostsProportion().hashCode());
+        result = prime * result + ((getNoSuperviseCostsPremiums() == null) ? 0 : getNoSuperviseCostsPremiums().hashCode());
+        result = prime * result + ((getJqOtherCostsProportion() == null) ? 0 : getJqOtherCostsProportion().hashCode());
+        result = prime * result + ((getJqOtherCostsPremiums() == null) ? 0 : getJqOtherCostsPremiums().hashCode());
+        result = prime * result + ((getSyOtherCostsProportion() == null) ? 0 : getSyOtherCostsProportion().hashCode());
+        result = prime * result + ((getSyOtherCostsPremiums() == null) ? 0 : getSyOtherCostsPremiums().hashCode());
+        result = prime * result + ((getNoOtherCostsProportion() == null) ? 0 : getNoOtherCostsProportion().hashCode());
+        result = prime * result + ((getNoOtherCostsPremiums() == null) ? 0 : getNoOtherCostsPremiums().hashCode());
+        result = prime * result + ((getJqInvestmentCostsProportion() == null) ? 0 : getJqInvestmentCostsProportion().hashCode());
+        result = prime * result + ((getJqInvestmentCostsPremiums() == null) ? 0 : getJqInvestmentCostsPremiums().hashCode());
+        result = prime * result + ((getSyInvestmentCostsProportion() == null) ? 0 : getSyInvestmentCostsProportion().hashCode());
+        result = prime * result + ((getSyInvestmentCostsPremiums() == null) ? 0 : getSyInvestmentCostsPremiums().hashCode());
+        result = prime * result + ((getJqDeptProportionLevel1() == null) ? 0 : getJqDeptProportionLevel1().hashCode());
+        result = prime * result + ((getJqDeptPremiumsLevel1() == null) ? 0 : getJqDeptPremiumsLevel1().hashCode());
+        result = prime * result + ((getSyDeptProportionLevel1() == null) ? 0 : getSyDeptProportionLevel1().hashCode());
+        result = prime * result + ((getSyDeptPremiumsLevel1() == null) ? 0 : getSyDeptPremiumsLevel1().hashCode());
+        result = prime * result + ((getNoDeptProportionLevel1() == null) ? 0 : getNoDeptProportionLevel1().hashCode());
+        result = prime * result + ((getNoDeptPremiumsLevel1() == null) ? 0 : getNoDeptPremiumsLevel1().hashCode());
+        result = prime * result + ((getJqDeptProportionLevel2() == null) ? 0 : getJqDeptProportionLevel2().hashCode());
+        result = prime * result + ((getJqDeptPremiumsLevel2() == null) ? 0 : getJqDeptPremiumsLevel2().hashCode());
+        result = prime * result + ((getSyDeptProportionLevel2() == null) ? 0 : getSyDeptProportionLevel2().hashCode());
+        result = prime * result + ((getSyDeptPremiumsLevel2() == null) ? 0 : getSyDeptPremiumsLevel2().hashCode());
+        result = prime * result + ((getNoDeptProportionLevel2() == null) ? 0 : getNoDeptProportionLevel2().hashCode());
+        result = prime * result + ((getNoDeptPremiumsLevel2() == null) ? 0 : getNoDeptPremiumsLevel2().hashCode());
+        result = prime * result + ((getJqDeptProportionLevel3() == null) ? 0 : getJqDeptProportionLevel3().hashCode());
+        result = prime * result + ((getJqDeptPremiumsLevel3() == null) ? 0 : getJqDeptPremiumsLevel3().hashCode());
+        result = prime * result + ((getSyDeptProportionLevel3() == null) ? 0 : getSyDeptProportionLevel3().hashCode());
+        result = prime * result + ((getSyDeptPremiumsLevel3() == null) ? 0 : getSyDeptPremiumsLevel3().hashCode());
+        result = prime * result + ((getNoDeptProportionLevel3() == null) ? 0 : getNoDeptProportionLevel3().hashCode());
+        result = prime * result + ((getNoDeptPremiumsLevel3() == null) ? 0 : getNoDeptPremiumsLevel3().hashCode());
+        result = prime * result + ((getJqDeptProportionLevel4() == null) ? 0 : getJqDeptProportionLevel4().hashCode());
+        result = prime * result + ((getJqDeptPremiumsLevel4() == null) ? 0 : getJqDeptPremiumsLevel4().hashCode());
+        result = prime * result + ((getSyDeptProportionLevel4() == null) ? 0 : getSyDeptProportionLevel4().hashCode());
+        result = prime * result + ((getSyDeptPremiumsLevel4() == null) ? 0 : getSyDeptPremiumsLevel4().hashCode());
+        result = prime * result + ((getNoDeptProportionLevel4() == null) ? 0 : getNoDeptProportionLevel4().hashCode());
+        result = prime * result + ((getNoDeptPremiumsLevel4() == null) ? 0 : getNoDeptPremiumsLevel4().hashCode());
+        result = prime * result + ((getJqDeptProportionLevel5() == null) ? 0 : getJqDeptProportionLevel5().hashCode());
+        result = prime * result + ((getJqDeptPremiumsLevel5() == null) ? 0 : getJqDeptPremiumsLevel5().hashCode());
+        result = prime * result + ((getSyDeptProportionLevel5() == null) ? 0 : getSyDeptProportionLevel5().hashCode());
+        result = prime * result + ((getSyDeptPremiumsLevel5() == null) ? 0 : getSyDeptPremiumsLevel5().hashCode());
+        result = prime * result + ((getNoDeptProportionLevel5() == null) ? 0 : getNoDeptProportionLevel5().hashCode());
+        result = prime * result + ((getNoDeptPremiumsLevel5() == null) ? 0 : getNoDeptPremiumsLevel5().hashCode());
+        result = prime * result + ((getJqCostsExportProportion() == null) ? 0 : getJqCostsExportProportion().hashCode());
+        result = prime * result + ((getSyCostsExportProportion() == null) ? 0 : getSyCostsExportProportion().hashCode());
+        result = prime * result + ((getNoCostsExportProportion() == null) ? 0 : getNoCostsExportProportion().hashCode());
+        result = prime * result + ((getJqExportInvestmentProportion() == null) ? 0 : getJqExportInvestmentProportion().hashCode());
+        result = prime * result + ((getJqExportInvestmentPremiums() == null) ? 0 : getJqExportInvestmentPremiums().hashCode());
+        result = prime * result + ((getSyExportInvestmentProportion() == null) ? 0 : getSyExportInvestmentProportion().hashCode());
+        result = prime * result + ((getSyExportInvestmentPremiums() == null) ? 0 : getSyExportInvestmentPremiums().hashCode());
+        result = prime * result + ((getFirstDetailProportion() == null) ? 0 : getFirstDetailProportion().hashCode());
+        result = prime * result + ((getFirstDetailPremiums() == null) ? 0 : getFirstDetailPremiums().hashCode());
+        result = prime * result + ((getSecondDetailProportion() == null) ? 0 : getSecondDetailProportion().hashCode());
+        result = prime * result + ((getSecondDetailPremiums() == null) ? 0 : getSecondDetailPremiums().hashCode());
+        result = prime * result + ((getThirdDetailProportion() == null) ? 0 : getThirdDetailProportion().hashCode());
+        result = prime * result + ((getThirdDetailPremiums() == null) ? 0 : getThirdDetailPremiums().hashCode());
+        result = prime * result + ((getJqRetailProportionLevel1() == null) ? 0 : getJqRetailProportionLevel1().hashCode());
+        result = prime * result + ((getJqRetailPremiumsLevel1() == null) ? 0 : getJqRetailPremiumsLevel1().hashCode());
+        result = prime * result + ((getSyRetailProportionLevel1() == null) ? 0 : getSyRetailProportionLevel1().hashCode());
+        result = prime * result + ((getSyRetailPremiumsLevel1() == null) ? 0 : getSyRetailPremiumsLevel1().hashCode());
+        result = prime * result + ((getNoRetailProportionLevel1() == null) ? 0 : getNoRetailProportionLevel1().hashCode());
+        result = prime * result + ((getNoRetailPremiumsLevel1() == null) ? 0 : getNoRetailPremiumsLevel1().hashCode());
+        result = prime * result + ((getJqRetailProportionLevel2() == null) ? 0 : getJqRetailProportionLevel2().hashCode());
+        result = prime * result + ((getJqRetailPremiumsLevel2() == null) ? 0 : getJqRetailPremiumsLevel2().hashCode());
+        result = prime * result + ((getSyRetailProportionLevel2() == null) ? 0 : getSyRetailProportionLevel2().hashCode());
+        result = prime * result + ((getSyRetailPremiumsLevel2() == null) ? 0 : getSyRetailPremiumsLevel2().hashCode());
+        result = prime * result + ((getNoRetailProportionLevel2() == null) ? 0 : getNoRetailProportionLevel2().hashCode());
+        result = prime * result + ((getNoRetailPremiumsLevel2() == null) ? 0 : getNoRetailPremiumsLevel2().hashCode());
+        result = prime * result + ((getJqRetailProportionLevel3() == null) ? 0 : getJqRetailProportionLevel3().hashCode());
+        result = prime * result + ((getJqRetailPremiumsLevel3() == null) ? 0 : getJqRetailPremiumsLevel3().hashCode());
+        result = prime * result + ((getSyRetailProportionLevel3() == null) ? 0 : getSyRetailProportionLevel3().hashCode());
+        result = prime * result + ((getSyRetailPremiumsLevel3() == null) ? 0 : getSyRetailPremiumsLevel3().hashCode());
+        result = prime * result + ((getNoRetailProportionLevel3() == null) ? 0 : getNoRetailProportionLevel3().hashCode());
+        result = prime * result + ((getNoRetailPremiumsLevel3() == null) ? 0 : getNoRetailPremiumsLevel3().hashCode());
+        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
+        result = prime * result + ((getFirstLevelUserId() == null) ? 0 : getFirstLevelUserId().hashCode());
+        result = prime * result + ((getTwoLevelUserId() == null) ? 0 : getTwoLevelUserId().hashCode());
+        result = prime * result + ((getThreeLevelUserId() == null) ? 0 : getThreeLevelUserId().hashCode());
+        result = prime * result + ((getDistributionStatus() == null) ? 0 : getDistributionStatus().hashCode());
+        result = prime * result + ((getDeptDistribution() == null) ? 0 : getDeptDistribution().hashCode());
+        result = prime * result + ((getJqExportSuperviseCostsPremiums() == null) ? 0 : getJqExportSuperviseCostsPremiums().hashCode());
+        result = prime * result + ((getSyExportSuperviseCostsPremiums() == null) ? 0 : getSyExportSuperviseCostsPremiums().hashCode());
+        result = prime * result + ((getNoExportSuperviseCostsPremiums() == null) ? 0 : getNoExportSuperviseCostsPremiums().hashCode());
+        result = prime * result + ((getJqExportOtherCostsProportion() == null) ? 0 : getJqExportOtherCostsProportion().hashCode());
+        result = prime * result + ((getSyExportOtherCostsProportion() == null) ? 0 : getSyExportOtherCostsProportion().hashCode());
+        result = prime * result + ((getNoExportOtherCostsProportion() == null) ? 0 : getNoExportOtherCostsProportion().hashCode());
+        result = prime * result + ((getJqExportOtherCostsPremiums() == null) ? 0 : getJqExportOtherCostsPremiums().hashCode());
+        result = prime * result + ((getSyExportOtherCostsPremiums() == null) ? 0 : getSyExportOtherCostsPremiums().hashCode());
+        result = prime * result + ((getNoExportOtherCostsPremiums() == null) ? 0 : getNoExportOtherCostsPremiums().hashCode());
+        result = prime * result + ((getJqProfitMarginPremiums() == null) ? 0 : getJqProfitMarginPremiums().hashCode());
+        result = prime * result + ((getSyProfitMarginPremiums() == null) ? 0 : getSyProfitMarginPremiums().hashCode());
+        result = prime * result + ((getNoProfitMarginPremiums() == null) ? 0 : getNoProfitMarginPremiums().hashCode());
+        result = prime * result + ((getJqExternalProportion() == null) ? 0 : getJqExternalProportion().hashCode());
+        result = prime * result + ((getSyExternalProportion() == null) ? 0 : getSyExternalProportion().hashCode());
+        result = prime * result + ((getNoExternalProportion() == null) ? 0 : getNoExternalProportion().hashCode());
+        result = prime * result + ((getJqExternalPremiums() == null) ? 0 : getJqExternalPremiums().hashCode());
+        result = prime * result + ((getSyExternalPremiums() == null) ? 0 : getSyExternalPremiums().hashCode());
+        result = prime * result + ((getNoExternalPremiums() == null) ? 0 : getNoExternalPremiums().hashCode());
+        result = prime * result + ((getOperatorId() == null) ? 0 : getOperatorId().hashCode());
+        result = prime * result + ((getOperatorTime() == null) ? 0 : getOperatorTime().hashCode());
+        result = prime * result + ((getIsFirst() == null) ? 0 : getIsFirst().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", insOrderNo=").append(insOrderNo);
+        sb.append(", agreementId=").append(agreementId);
+        sb.append(", costsId=").append(costsId);
+        sb.append(", deptId=").append(deptId);
+        sb.append(", userId=").append(userId);
+        sb.append(", jqPremium=").append(jqPremium);
+        sb.append(", syPremium=").append(syPremium);
+        sb.append(", noPremium=").append(noPremium);
+        sb.append(", jqNoTaxPremium=").append(jqNoTaxPremium);
+        sb.append(", syNoTaxPremium=").append(syNoTaxPremium);
+        sb.append(", noNoTaxPremium=").append(noNoTaxPremium);
+        sb.append(", jqCostsProportion=").append(jqCostsProportion);
+        sb.append(", jqCostsPremiums=").append(jqCostsPremiums);
+        sb.append(", syCostsProportion=").append(syCostsProportion);
+        sb.append(", syCostsPremiums=").append(syCostsPremiums);
+        sb.append(", noCostsProportion=").append(noCostsProportion);
+        sb.append(", noCostsPremiums=").append(noCostsPremiums);
+        sb.append(", jqSuperviseCostsProportion=").append(jqSuperviseCostsProportion);
+        sb.append(", jqSuperviseCostsPremiums=").append(jqSuperviseCostsPremiums);
+        sb.append(", sySuperviseCostsProportion=").append(sySuperviseCostsProportion);
+        sb.append(", sySuperviseCostsPremiums=").append(sySuperviseCostsPremiums);
+        sb.append(", noSuperviseCostsProportion=").append(noSuperviseCostsProportion);
+        sb.append(", noSuperviseCostsPremiums=").append(noSuperviseCostsPremiums);
+        sb.append(", jqOtherCostsProportion=").append(jqOtherCostsProportion);
+        sb.append(", jqOtherCostsPremiums=").append(jqOtherCostsPremiums);
+        sb.append(", syOtherCostsProportion=").append(syOtherCostsProportion);
+        sb.append(", syOtherCostsPremiums=").append(syOtherCostsPremiums);
+        sb.append(", noOtherCostsProportion=").append(noOtherCostsProportion);
+        sb.append(", noOtherCostsPremiums=").append(noOtherCostsPremiums);
+        sb.append(", jqInvestmentCostsProportion=").append(jqInvestmentCostsProportion);
+        sb.append(", jqInvestmentCostsPremiums=").append(jqInvestmentCostsPremiums);
+        sb.append(", syInvestmentCostsProportion=").append(syInvestmentCostsProportion);
+        sb.append(", syInvestmentCostsPremiums=").append(syInvestmentCostsPremiums);
+        sb.append(", jqDeptProportionLevel1=").append(jqDeptProportionLevel1);
+        sb.append(", jqDeptPremiumsLevel1=").append(jqDeptPremiumsLevel1);
+        sb.append(", syDeptProportionLevel1=").append(syDeptProportionLevel1);
+        sb.append(", syDeptPremiumsLevel1=").append(syDeptPremiumsLevel1);
+        sb.append(", noDeptProportionLevel1=").append(noDeptProportionLevel1);
+        sb.append(", noDeptPremiumsLevel1=").append(noDeptPremiumsLevel1);
+        sb.append(", jqDeptProportionLevel2=").append(jqDeptProportionLevel2);
+        sb.append(", jqDeptPremiumsLevel2=").append(jqDeptPremiumsLevel2);
+        sb.append(", syDeptProportionLevel2=").append(syDeptProportionLevel2);
+        sb.append(", syDeptPremiumsLevel2=").append(syDeptPremiumsLevel2);
+        sb.append(", noDeptProportionLevel2=").append(noDeptProportionLevel2);
+        sb.append(", noDeptPremiumsLevel2=").append(noDeptPremiumsLevel2);
+        sb.append(", jqDeptProportionLevel3=").append(jqDeptProportionLevel3);
+        sb.append(", jqDeptPremiumsLevel3=").append(jqDeptPremiumsLevel3);
+        sb.append(", syDeptProportionLevel3=").append(syDeptProportionLevel3);
+        sb.append(", syDeptPremiumsLevel3=").append(syDeptPremiumsLevel3);
+        sb.append(", noDeptProportionLevel3=").append(noDeptProportionLevel3);
+        sb.append(", noDeptPremiumsLevel3=").append(noDeptPremiumsLevel3);
+        sb.append(", jqDeptProportionLevel4=").append(jqDeptProportionLevel4);
+        sb.append(", jqDeptPremiumsLevel4=").append(jqDeptPremiumsLevel4);
+        sb.append(", syDeptProportionLevel4=").append(syDeptProportionLevel4);
+        sb.append(", syDeptPremiumsLevel4=").append(syDeptPremiumsLevel4);
+        sb.append(", noDeptProportionLevel4=").append(noDeptProportionLevel4);
+        sb.append(", noDeptPremiumsLevel4=").append(noDeptPremiumsLevel4);
+        sb.append(", jqDeptProportionLevel5=").append(jqDeptProportionLevel5);
+        sb.append(", jqDeptPremiumsLevel5=").append(jqDeptPremiumsLevel5);
+        sb.append(", syDeptProportionLevel5=").append(syDeptProportionLevel5);
+        sb.append(", syDeptPremiumsLevel5=").append(syDeptPremiumsLevel5);
+        sb.append(", noDeptProportionLevel5=").append(noDeptProportionLevel5);
+        sb.append(", noDeptPremiumsLevel5=").append(noDeptPremiumsLevel5);
+        sb.append(", jqCostsExportProportion=").append(jqCostsExportProportion);
+        sb.append(", syCostsExportProportion=").append(syCostsExportProportion);
+        sb.append(", noCostsExportProportion=").append(noCostsExportProportion);
+        sb.append(", jqExportInvestmentProportion=").append(jqExportInvestmentProportion);
+        sb.append(", jqExportInvestmentPremiums=").append(jqExportInvestmentPremiums);
+        sb.append(", syExportInvestmentProportion=").append(syExportInvestmentProportion);
+        sb.append(", syExportInvestmentPremiums=").append(syExportInvestmentPremiums);
+        sb.append(", firstDetailProportion=").append(firstDetailProportion);
+        sb.append(", firstDetailPremiums=").append(firstDetailPremiums);
+        sb.append(", secondDetailProportion=").append(secondDetailProportion);
+        sb.append(", secondDetailPremiums=").append(secondDetailPremiums);
+        sb.append(", thirdDetailProportion=").append(thirdDetailProportion);
+        sb.append(", thirdDetailPremiums=").append(thirdDetailPremiums);
+        sb.append(", jqRetailProportionLevel1=").append(jqRetailProportionLevel1);
+        sb.append(", jqRetailPremiumsLevel1=").append(jqRetailPremiumsLevel1);
+        sb.append(", syRetailProportionLevel1=").append(syRetailProportionLevel1);
+        sb.append(", syRetailPremiumsLevel1=").append(syRetailPremiumsLevel1);
+        sb.append(", noRetailProportionLevel1=").append(noRetailProportionLevel1);
+        sb.append(", noRetailPremiumsLevel1=").append(noRetailPremiumsLevel1);
+        sb.append(", jqRetailProportionLevel2=").append(jqRetailProportionLevel2);
+        sb.append(", jqRetailPremiumsLevel2=").append(jqRetailPremiumsLevel2);
+        sb.append(", syRetailProportionLevel2=").append(syRetailProportionLevel2);
+        sb.append(", syRetailPremiumsLevel2=").append(syRetailPremiumsLevel2);
+        sb.append(", noRetailProportionLevel2=").append(noRetailProportionLevel2);
+        sb.append(", noRetailPremiumsLevel2=").append(noRetailPremiumsLevel2);
+        sb.append(", jqRetailProportionLevel3=").append(jqRetailProportionLevel3);
+        sb.append(", jqRetailPremiumsLevel3=").append(jqRetailPremiumsLevel3);
+        sb.append(", syRetailProportionLevel3=").append(syRetailProportionLevel3);
+        sb.append(", syRetailPremiumsLevel3=").append(syRetailPremiumsLevel3);
+        sb.append(", noRetailProportionLevel3=").append(noRetailProportionLevel3);
+        sb.append(", noRetailPremiumsLevel3=").append(noRetailPremiumsLevel3);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", firstLevelUserId=").append(firstLevelUserId);
+        sb.append(", twoLevelUserId=").append(twoLevelUserId);
+        sb.append(", threeLevelUserId=").append(threeLevelUserId);
+        sb.append(", distributionStatus=").append(distributionStatus);
+        sb.append(", deptDistribution=").append(deptDistribution);
+        sb.append(", jqExportSuperviseCostsPremiums=").append(jqExportSuperviseCostsPremiums);
+        sb.append(", syExportSuperviseCostsPremiums=").append(syExportSuperviseCostsPremiums);
+        sb.append(", noExportSuperviseCostsPremiums=").append(noExportSuperviseCostsPremiums);
+        sb.append(", jqExportOtherCostsProportion=").append(jqExportOtherCostsProportion);
+        sb.append(", syExportOtherCostsProportion=").append(syExportOtherCostsProportion);
+        sb.append(", noExportOtherCostsProportion=").append(noExportOtherCostsProportion);
+        sb.append(", jqExportOtherCostsPremiums=").append(jqExportOtherCostsPremiums);
+        sb.append(", syExportOtherCostsPremiums=").append(syExportOtherCostsPremiums);
+        sb.append(", noExportOtherCostsPremiums=").append(noExportOtherCostsPremiums);
+        sb.append(", jqProfitMarginPremiums=").append(jqProfitMarginPremiums);
+        sb.append(", syProfitMarginPremiums=").append(syProfitMarginPremiums);
+        sb.append(", noProfitMarginPremiums=").append(noProfitMarginPremiums);
+        sb.append(", jqExternalProportion=").append(jqExternalProportion);
+        sb.append(", syExternalProportion=").append(syExternalProportion);
+        sb.append(", noExternalProportion=").append(noExternalProportion);
+        sb.append(", jqExternalPremiums=").append(jqExternalPremiums);
+        sb.append(", syExternalPremiums=").append(syExternalPremiums);
+        sb.append(", noExternalPremiums=").append(noExternalPremiums);
+        sb.append(", operatorId=").append(operatorId);
+        sb.append(", operatorTime=").append(operatorTime);
+        sb.append(", isFirst=").append(isFirst);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 8 - 0
src/main/java/com/ydtech/modules/fee/service/FeeRuleSchemeNewService.java

@@ -107,4 +107,12 @@ public interface FeeRuleSchemeNewService {
      * @param insAreaCompany
      * @param insAreaCompany
      */
      */
     void calcCostsExternal(PtlAgreementProductCostsNew costsNew, InsAreaCompany insAreaCompany);
     void calcCostsExternal(PtlAgreementProductCostsNew costsNew, InsAreaCompany insAreaCompany);
+
+    /**
+     * 电销计算费用
+     *
+     * @param ptlAgreementProductCostsExport
+     * @param insAreaCompany
+     */
+    void calcCostsExternalTelemarketing( PtlAgreementProductCostsExport ptlAgreementProductCostsExport , InsAreaCompany insAreaCompany);
 }
 }

+ 38 - 0
src/main/java/com/ydtech/modules/fee/service/InsFeeOrderNewHistoryService.java

@@ -0,0 +1,38 @@
+package com.ydtech.modules.fee.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.fee.entity.po.InsFeeOrderNewHistory;
+import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
+
+/**
+* @author Administrator
+* @description 针对表【ins_fee_order_new_history】的数据库操作Service
+* @createDate 2024-08-30 18:08:47
+*/
+public interface InsFeeOrderNewHistoryService extends IService<InsFeeOrderNewHistory> {
+
+    /**
+     * 首次添加历史记录
+     * @param insFeeOrderNew
+     */
+    void saveInsFeeOrderNewHistory(InsFeeOrderNew insFeeOrderNew);
+
+    /**
+     * 转换
+     * @param insFeeOrderNew
+     * @return
+     */
+    InsFeeOrderNewHistory toInsFeeOrderNewHistory(InsFeeOrderNew insFeeOrderNew);
+
+    /**
+     * 获取最新订单信息
+     * @param id 子订单
+     * @return
+     */
+    default InsFeeOrderNewHistory getByInsOrderNo(String id){
+        return lambdaQuery()
+                .eq(InsFeeOrderNewHistory::getInsOrderNo, id)
+                .eq(InsFeeOrderNewHistory::getIsFirst, "1")
+                .one();
+    }
+}

+ 470 - 0
src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java

@@ -19,6 +19,7 @@ import com.ydtech.modules.fee.dto.vo.RuleAttrMappingVo;
 import com.ydtech.modules.fee.service.FeeRuleSchemeNewService;
 import com.ydtech.modules.fee.service.FeeRuleSchemeNewService;
 import com.ydtech.modules.fee.service.FeeRuleSchemeService;
 import com.ydtech.modules.fee.service.FeeRuleSchemeService;
 import com.ydtech.modules.fee.service.InsFeeOrderConfigService;
 import com.ydtech.modules.fee.service.InsFeeOrderConfigService;
+import com.ydtech.modules.fee.service.InsFeeOrderNewHistoryService;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.vo.FeeOrderNewVo;
 import com.ydtech.modules.order.entity.vo.FeeOrderNewVo;
@@ -101,6 +102,9 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
     @Autowired
     @Autowired
     private SysSwitchConfigService sysSwitchConfigService;
     private SysSwitchConfigService sysSwitchConfigService;
 
 
+    @Autowired
+    private InsFeeOrderNewHistoryService insFeeOrderNewHistoryService;
+
     @Override
     @Override
     public QueryOrderFeeVo queryFeeOrderInfo(String companyId) {
     public QueryOrderFeeVo queryFeeOrderInfo(String companyId) {
         return null;
         return null;
@@ -753,6 +757,7 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
     }
     }
 
 
 
 
+
     /**
     /**
      * 计算费用测试方法 没有数据库保存操作 只带入值进行计算核对
      * 计算费用测试方法 没有数据库保存操作 只带入值进行计算核对
      *
      *
@@ -1516,6 +1521,471 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
         insFeeOrderNewService.saveOrUpdate(insFeeOrderNew);
         insFeeOrderNewService.saveOrUpdate(insFeeOrderNew);
     }
     }
 
 
+    @Override
+    public void calcCostsExternalTelemarketing(PtlAgreementProductCostsExport ptlAgreementProductCostsExport, InsAreaCompany insAreaCompany) {
+        //获取协议信息
+        PtlAgreement ptlAgreement = ptlAgreementService.getById(insAreaCompany.getAgreementId());
+        InsOrders insOrders = insOrdersService.getById(insAreaCompany.getOrderno());
+        SysUser sysUser = sysUserService.findByUserId(insOrders.getUserid());
+        //入口配置
+        PtlAgreementProductCostsNew ptlAgreementProductCostsNew = ptlAgreementProductCostsNewService.getById(ptlAgreementProductCostsExport.getCostsId());
+
+        BigDecimal taxRadio = new BigDecimal("1.00");
+        //如果是外部订单则 不含税
+        if (ptlAgreement.getWithTax().equals("否") && ptlAgreement.getIsExternal() == 0) {
+            taxRadio = new BigDecimal("1.06");
+        }
+
+        InsFeeOrderNew insFeeOrderNew = new InsFeeOrderNew();
+        insFeeOrderNew.setId(IdGenerate.nextId());
+        insFeeOrderNew.setCostsId(ptlAgreementProductCostsNew.getId());
+        insFeeOrderNew.setAgreementId(insAreaCompany.getAgreementId());
+
+        //存储部门id与用户id
+        InsOrders order = insOrdersService.getById(insAreaCompany.getOrderno());
+        InsFeeOrderNew insFeeOrderNewByCompanyId = insFeeOrderNewService.getInsFeeOrderNewByCompanyId(insAreaCompany.getId());
+        if (insFeeOrderNewByCompanyId != null) {
+            insFeeOrderNew.setId(insFeeOrderNewByCompanyId.getId());
+        }
+        insFeeOrderNew.setDeptId(order.getDeptid());
+        insFeeOrderNew.setUserId(order.getUserid());
+        insFeeOrderNew.setInsOrderNo(insAreaCompany.getId());
+        insFeeOrderNew.setJqPremium(insAreaCompany.getJqpremium());
+        insFeeOrderNew.setSyPremium(insAreaCompany.getSypremium());
+        insFeeOrderNew.setNoPremium(insAreaCompany.getJypremium());
+        //不含税
+        BigDecimal bigDecimal = new BigDecimal("1.06");
+        insFeeOrderNew.setJqNoTaxPremium(insAreaCompany.getJqpremium().divide(bigDecimal, 2));
+        insFeeOrderNew.setSyNoTaxPremium(insAreaCompany.getSypremium().divide(bigDecimal, 2));
+        insFeeOrderNew.setNoNoTaxPremium(insAreaCompany.getJypremium().divide(bigDecimal, 2));
+
+        //region 计算入口费用
+
+        //交强入口信息
+        FeeOrderNewVo.EntranceFee jqEntranceFee = feeRuleSchemeService.calcEntranceFee(
+                insFeeOrderNew.getJqPremium(),
+                new BigDecimal(ptlAgreementProductCostsNew.getJqCarCostsProportion()),
+                new BigDecimal(ptlAgreementProductCostsNew.getJqCarOtherCostsProportion()),
+                taxRadio);
+
+        insFeeOrderNew.setJqCostsProportion(jqEntranceFee.getTotalProportion());
+        insFeeOrderNew.setJqSuperviseCostsProportion(jqEntranceFee.getSuperviseCosts());
+        insFeeOrderNew.setJqSuperviseCostsPremiums(jqEntranceFee.getSuperviseCostsPremiums());
+        insFeeOrderNew.setJqOtherCostsProportion(jqEntranceFee.getOtherCostsProportion());
+        insFeeOrderNew.setJqOtherCostsPremiums(jqEntranceFee.getOtherCostsPremiums());
+        insFeeOrderNew.setJqCostsPremiums(insFeeOrderNew.getJqSuperviseCostsPremiums().add(insFeeOrderNew.getJqOtherCostsPremiums()));
+
+        //商业入口信息
+        FeeOrderNewVo.EntranceFee syEntranceFee = feeRuleSchemeService.calcEntranceFee(insFeeOrderNew.getSyPremium(),
+                new BigDecimal(ptlAgreementProductCostsNew.getSyCarCostsProportion()),
+                new BigDecimal(ptlAgreementProductCostsNew.getSyCarOtherCostsProportion()), taxRadio);
+        insFeeOrderNew.setSyCostsProportion(syEntranceFee.getTotalProportion());
+        insFeeOrderNew.setSySuperviseCostsProportion(syEntranceFee.getSuperviseCosts());
+        insFeeOrderNew.setSySuperviseCostsPremiums(syEntranceFee.getSuperviseCostsPremiums());
+        insFeeOrderNew.setSyOtherCostsProportion(syEntranceFee.getOtherCostsProportion());
+        insFeeOrderNew.setSyOtherCostsPremiums(syEntranceFee.getOtherCostsPremiums());
+        insFeeOrderNew.setSyCostsPremiums(insFeeOrderNew.getSySuperviseCostsPremiums().add(insFeeOrderNew.getSyOtherCostsPremiums()));
+
+        //非车入口信息
+        FeeOrderNewVo.EntranceFee noEntranceFee = feeRuleSchemeService.calcEntranceFee(insFeeOrderNew.getNoPremium(),
+                new BigDecimal(ptlAgreementProductCostsNew.getNoCarCostsProportion()),
+                new BigDecimal(ptlAgreementProductCostsNew.getNoCarOtherCostsProportion()), taxRadio);
+        insFeeOrderNew.setNoCostsProportion(noEntranceFee.getTotalProportion());
+        insFeeOrderNew.setNoSuperviseCostsProportion(noEntranceFee.getSuperviseCosts());
+        insFeeOrderNew.setNoSuperviseCostsPremiums(noEntranceFee.getSuperviseCostsPremiums());
+        insFeeOrderNew.setNoOtherCostsProportion(noEntranceFee.getOtherCostsProportion());
+        insFeeOrderNew.setNoOtherCostsPremiums(noEntranceFee.getOtherCostsPremiums());
+        insFeeOrderNew.setNoCostsPremiums(insFeeOrderNew.getNoSuperviseCostsPremiums().add(insFeeOrderNew.getNoOtherCostsPremiums()));
+        //endregion
+
+
+        //region 重新计算管理费比例和分销比例
+
+        List<EsmRetail> esmRetailList = esmRetailService.selectList(" where t.deptid=? and t.status = '1' ",
+                new Object[]{sysUser.getDeptId()});
+
+        Integer retailLevel = 0;
+
+        //默认分销比例设置
+        RetailProportion retailProportion = new RetailProportion();
+        if (!Objects.isNull(esmRetailList) && !esmRetailList.isEmpty()) {
+            retailLevel = Integer.parseInt(esmRetailList.get(0).getRetailtype());
+            //赋值默认的分销比例
+            retailProportion.setProportion(esmRetailList.get(0).getDisrate1(), esmRetailList.get(0).getDisrate2(), esmRetailList.get(0).getDisrate3());
+        }
+
+        //获取交强机构管理费总比例
+        BigDecimal jqDeptProportion = ptlAgreementProductCostsExport.getJqExportRadioLevel1()
+                .add(ptlAgreementProductCostsExport.getJqExportRadioLevel2())
+                .add(ptlAgreementProductCostsExport.getJqExportRadioLevel3())
+                .add(ptlAgreementProductCostsExport.getJqExportRadioLevel4())
+                .add(ptlAgreementProductCostsExport.getJqExportRadioLevel5());
+        //获取商业机构管理费总比例
+        BigDecimal syDeptProportion = ptlAgreementProductCostsExport.getSyExportRadioLevel1()
+                .add(ptlAgreementProductCostsExport.getSyExportRadioLevel2())
+                .add(ptlAgreementProductCostsExport.getSyExportRadioLevel3())
+                .add(ptlAgreementProductCostsExport.getSyExportRadioLevel4())
+                .add(ptlAgreementProductCostsExport.getSyExportRadioLevel5());
+        //获取非车机构管理费总比例
+        BigDecimal noDeptProportion = ptlAgreementProductCostsExport.getNoCarExportRadioLevel1()
+                .add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel2())
+                .add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel3())
+                .add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel4())
+                .add(ptlAgreementProductCostsExport.getNoCarExportRadioLevel5());
+
+        //获取交强分销总比例
+        BigDecimal jqRetailProportion = retailProportion.getJqRetailLevel1Proportion()
+                .add(retailProportion.getJqRetailLevel2Proportion())
+                .add(retailProportion.getJqRetailLevel3Proportion());
+
+        //获取商业分销总比例
+        BigDecimal syRetailProportion = retailProportion.getSyRetailLevel1Proportion()
+                .add(retailProportion.getSyRetailLevel2Proportion())
+                .add(retailProportion.getSyRetailLevel3Proportion());
+
+        //获取非车分销总比例
+        BigDecimal noRetailProportion = retailProportion.getNoRetailLevel1Proportion()
+                .add(retailProportion.getNoRetailLevel2Proportion())
+                .add(retailProportion.getNoRetailLevel3Proportion());
+
+        // 外部订单比例
+        BigDecimal enterProportion = sysSwitchConfigService.getEnterProportion(insOrders.getDeptid(), insOrders.getEntryStatus());
+
+        //重新计算比例  入口是否超出支付的比例
+        ReCalcuLateProportion jqReCalcuLateProportion = recalculateProportion(
+                new BigDecimal(ptlAgreementProductCostsNew.getJqCostsProportion()),
+                jqDeptProportion,
+                jqRetailProportion,
+                taxRadio,
+                retailLevel,
+                ptlAgreementProductCostsExport,
+                retailProportion,
+                "jq",
+                enterProportion
+        );
+
+        ReCalcuLateProportion syReCalcuLateProportion = recalculateProportion(
+                new BigDecimal(ptlAgreementProductCostsNew.getSyCostsProportion()),
+                syDeptProportion,
+                syRetailProportion,
+                taxRadio,
+                retailLevel,
+                ptlAgreementProductCostsExport,
+                retailProportion,
+                "sy",
+                enterProportion
+        );
+
+        ReCalcuLateProportion noReCalcuLateProportion = recalculateProportion(
+                new BigDecimal(ptlAgreementProductCostsNew.getNoCostsProportion()),
+                noDeptProportion,
+                noRetailProportion,
+                taxRadio,
+                retailLevel,
+                ptlAgreementProductCostsExport,
+                retailProportion,
+                "no",
+                enterProportion
+        );
+
+        retailProportion.setProportion(jqReCalcuLateProportion, syReCalcuLateProportion, noReCalcuLateProportion);
+        //endregion
+
+
+        //region 计算分销费用
+        //获取分销比例
+        //分销总比例
+        BigDecimal jqRetailRadio = new BigDecimal("0");
+        BigDecimal syRetailRadio = new BigDecimal("0");
+        BigDecimal noRetailRadio = new BigDecimal("0");
+
+        FeeOrderNewVo.RetailFee retailFeeLevel3 = new FeeOrderNewVo.RetailFee();
+        FeeOrderNewVo.RetailFee retailFeeLevel2 = new FeeOrderNewVo.RetailFee();
+        FeeOrderNewVo.RetailFee retailFeeLevel1 = new FeeOrderNewVo.RetailFee();
+
+        if (esmRetailList != null && !esmRetailList.isEmpty()) {
+            EsmRetail esmRetail = esmRetailList.get(0);
+            //分销等级
+            insFeeOrderNew.setDistributionStatus(esmRetailList.get(0).getRetailtype());
+            //用户分销人员id
+            List<EsmUserReferrer> parents = esmUserReferrerService.findParents(sysUser.getId());
+
+            if (esmRetail != null) {
+                if (Integer.parseInt(esmRetail.getRetailtype()) >= 3) {
+                    insFeeOrderNew.setThirdDetailProportion(retailProportion.getJqRetailLevel3Proportion());
+                    retailFeeLevel3 = feeRuleSchemeService.calcRetail(insFeeOrderNew.getJqPremium(),
+                            insFeeOrderNew.getJqCostsProportion(),
+                            insFeeOrderNew.getSyPremium(),
+                            insFeeOrderNew.getSyCostsProportion().add(insFeeOrderNew.getSyOtherCostsProportion()),
+                            insFeeOrderNew.getNoPremium(),
+                            insFeeOrderNew.getNoCostsProportion().add(insFeeOrderNew.getNoOtherCostsProportion()),
+                            retailProportion.getJqRetailLevel3Proportion(),
+                            retailProportion.getSyRetailLevel3Proportion(),
+                            retailProportion.getNoRetailLevel3Proportion());
+
+                    insFeeOrderNew.setThirdDetailPremiums(retailFeeLevel3.getTotalRetailPremiums());
+                    if (parents != null && parents.size() > 2) {
+                        insFeeOrderNew.setThreeLevelUserId(parents.get(2).getId());
+                    }
+                } else {
+                    insFeeOrderNew.setThirdDetailProportion(new BigDecimal(0));
+                }
+                if (Integer.parseInt(esmRetail.getRetailtype()) >= 2) {
+                    insFeeOrderNew.setSecondDetailProportion(retailProportion.getJqRetailLevel2Proportion());
+                    retailFeeLevel2 = feeRuleSchemeService.calcRetail(insFeeOrderNew.getJqPremium(),
+                            insFeeOrderNew.getJqCostsProportion(),
+                            insFeeOrderNew.getSyPremium(),
+                            insFeeOrderNew.getSyCostsProportion(),
+                            insFeeOrderNew.getNoPremium(),
+                            insFeeOrderNew.getNoCostsProportion(),
+                            retailProportion.getJqRetailLevel2Proportion(),
+                            retailProportion.getSyRetailLevel2Proportion(),
+                            retailProportion.getNoRetailLevel2Proportion());
+
+                    insFeeOrderNew.setSecondDetailPremiums(retailFeeLevel2.getTotalRetailPremiums());
+
+                    if (parents != null && parents.size() > 1) {
+                        insFeeOrderNew.setTwoLevelUserId(parents.get(1).getId());
+                    }
+                } else {
+                    insFeeOrderNew.setSecondDetailProportion(new BigDecimal(0));
+                }
+                if (Integer.parseInt(esmRetail.getRetailtype()) >= 1) {
+                    insFeeOrderNew.setFirstDetailProportion(retailProportion.getJqRetailLevel1Proportion());
+                    retailFeeLevel1 = feeRuleSchemeService.calcRetail(insFeeOrderNew.getJqPremium(),
+                            insFeeOrderNew.getJqCostsProportion(),
+                            insFeeOrderNew.getSyPremium(),
+                            insFeeOrderNew.getSyCostsProportion(),
+                            insFeeOrderNew.getNoPremium(),
+                            insFeeOrderNew.getNoCostsProportion(),
+                            retailProportion.getJqRetailLevel1Proportion(),
+                            retailProportion.getSyRetailLevel1Proportion(),
+                            retailProportion.getNoRetailLevel1Proportion());
+
+                    insFeeOrderNew.setFirstDetailPremiums(retailFeeLevel1.getTotalRetailPremiums());
+
+                    if (parents != null && !parents.isEmpty()) {
+                        insFeeOrderNew.setFirstLevelUserId(parents.get(0).getId());
+                    }
+
+                } else {
+                    insFeeOrderNew.setFirstDetailProportion(new BigDecimal(0));
+                }
+            } else {
+                insFeeOrderNew.setFirstDetailPremiums(new BigDecimal(0));
+                insFeeOrderNew.setSecondDetailPremiums(new BigDecimal(0));
+                insFeeOrderNew.setThirdDetailPremiums(new BigDecimal(0));
+            }
+        } else {
+            insFeeOrderNew.setFirstDetailProportion(new BigDecimal(0));
+            insFeeOrderNew.setSecondDetailProportion(new BigDecimal(0));
+            insFeeOrderNew.setThirdDetailProportion(new BigDecimal(0));
+        }
+        jqRetailRadio = jqRetailRadio.add(retailFeeLevel1.getJqRetailProportion())
+                .add(retailFeeLevel2.getJqRetailProportion())
+                .add(retailFeeLevel3.getJqRetailProportion());
+
+        syRetailRadio = syRetailRadio.add(retailFeeLevel1.getSyRetailProportion())
+                .add(retailFeeLevel2.getSyRetailProportion())
+                .add(retailFeeLevel3.getSyRetailProportion());
+
+        noRetailRadio = noRetailRadio.add(retailFeeLevel1.getNoRetailProportion())
+                .add(retailFeeLevel2.getNoRetailProportion())
+                .add(retailFeeLevel3.getNoRetailProportion());
+
+        insFeeOrderNew.assignRetail(retailFeeLevel1, retailFeeLevel2, retailFeeLevel3);
+
+        //endregion
+
+        //region 设置机构管理费
+
+        //交强机构管理费
+        BigDecimal jqDeptRadio =
+                jqReCalcuLateProportion.getDept_level_1_proportion()
+                        .add(jqReCalcuLateProportion.getDept_level_2_proportion())
+                        .add(jqReCalcuLateProportion.getDept_level_3_proportion())
+                        .add(jqReCalcuLateProportion.getDept_level_4_proportion())
+                        .add(jqReCalcuLateProportion.getDept_level_5_proportion());
+
+        FeeOrderNewVo.DeptManagerFee jqDeptManagerFee = feeRuleSchemeService.calcDeptManagerFee(
+                insFeeOrderNew.getJqPremium(),
+                jqReCalcuLateProportion.getDept_level_1_proportion(),
+                jqReCalcuLateProportion.getDept_level_2_proportion(),
+                jqReCalcuLateProportion.getDept_level_3_proportion(),
+                jqReCalcuLateProportion.getDept_level_4_proportion(),
+                jqReCalcuLateProportion.getDept_level_5_proportion());
+
+        BigDecimal syDeptRadio =
+                syReCalcuLateProportion.getDept_level_1_proportion()
+                        .add(syReCalcuLateProportion.getDept_level_2_proportion())
+                        .add(syReCalcuLateProportion.getDept_level_3_proportion())
+                        .add(syReCalcuLateProportion.getDept_level_4_proportion())
+                        .add(syReCalcuLateProportion.getDept_level_5_proportion());
+
+        FeeOrderNewVo.DeptManagerFee syDeptManagerFee = feeRuleSchemeService.calcDeptManagerFee(
+                insFeeOrderNew.getSyPremium(),
+                syReCalcuLateProportion.getDept_level_1_proportion(),
+                syReCalcuLateProportion.getDept_level_2_proportion(),
+                syReCalcuLateProportion.getDept_level_3_proportion(),
+                syReCalcuLateProportion.getDept_level_4_proportion(),
+                syReCalcuLateProportion.getDept_level_5_proportion());
+
+        BigDecimal noDeptRadio =
+                noReCalcuLateProportion.getDept_level_1_proportion()
+                        .add(noReCalcuLateProportion.getDept_level_2_proportion())
+                        .add(noReCalcuLateProportion.getDept_level_3_proportion())
+                        .add(noReCalcuLateProportion.getDept_level_4_proportion())
+                        .add(noReCalcuLateProportion.getDept_level_5_proportion());
+
+        FeeOrderNewVo.DeptManagerFee noDeptManagerFee = feeRuleSchemeService.calcDeptManagerFee(
+                insFeeOrderNew.getNoPremium(),
+                noReCalcuLateProportion.getDept_level_1_proportion(),
+                noReCalcuLateProportion.getDept_level_2_proportion(),
+                noReCalcuLateProportion.getDept_level_3_proportion(),
+                noReCalcuLateProportion.getDept_level_4_proportion(),
+                noReCalcuLateProportion.getDept_level_5_proportion());
+
+        insFeeOrderNew.assignDept(jqDeptManagerFee, syDeptManagerFee, noDeptManagerFee);
+
+        //endregion
+
+        //region 出口费用
+
+        //交强出口手续费比例
+        FeeOrderNewVo.ExportFee jqExportFee = feeRuleSchemeService.calcExportFee(
+                insFeeOrderNew.getJqPremium(),
+                new BigDecimal(ptlAgreementProductCostsNew.getJqCostsExportProportion()),
+                insFeeOrderNew.getJqCostsProportion(),
+                jqDeptRadio,
+                jqRetailRadio,
+                taxRadio,
+                jqReCalcuLateProportion.getProxyProportion()
+        );
+
+        //商业出口手续费比例
+        FeeOrderNewVo.ExportFee syExportFee = feeRuleSchemeService.calcExportFee(
+                insFeeOrderNew.getSyPremium(),
+                new BigDecimal(ptlAgreementProductCostsNew.getSyCostsExportProportion()),
+                insFeeOrderNew.getSyCostsProportion(),
+                syDeptRadio,
+                syRetailRadio,
+                taxRadio,
+                syReCalcuLateProportion.getProxyProportion()
+        );
+
+        //非车出口手续费比例
+        FeeOrderNewVo.ExportFee noExportFee = feeRuleSchemeService.calcExportFee(
+                insFeeOrderNew.getNoPremium(),
+                new BigDecimal(ptlAgreementProductCostsNew.getNoCostsExportProportion()),
+                insFeeOrderNew.getNoCostsProportion(),
+                noDeptRadio,
+                noRetailRadio,
+                taxRadio,
+                noReCalcuLateProportion.getProxyProportion()
+        );
+
+        //出口手续费用
+        insFeeOrderNew.setJqExportSuperviseCostsPremiums(twoPeople(jqExportFee.getSuperviseCostsPremiums()));
+        insFeeOrderNew.setSyExportSuperviseCostsPremiums(twoPeople(syExportFee.getSuperviseCostsPremiums()));
+        insFeeOrderNew.setNoExportSuperviseCostsPremiums(twoPeople(noExportFee.getSuperviseCostsPremiums()));
+
+        //出口其他费用比例
+        insFeeOrderNew.setJqExportOtherCostsProportion(twoPeople(jqExportFee.getOtherCostsProportion()));
+        insFeeOrderNew.setSyExportOtherCostsProportion(twoPeople(syExportFee.getOtherCostsProportion()));
+        insFeeOrderNew.setNoExportOtherCostsProportion(twoPeople(noExportFee.getOtherCostsProportion()));
+
+        //出口其他费用
+        insFeeOrderNew.setJqExportOtherCostsPremiums(twoPeople(jqExportFee.getOtherCostsPremiums()));
+        insFeeOrderNew.setSyExportOtherCostsPremiums(twoPeople(syExportFee.getOtherCostsPremiums()));
+        insFeeOrderNew.setNoExportOtherCostsPremiums(twoPeople(noExportFee.getOtherCostsPremiums()));
+
+        //设置出口手续费比例
+        insFeeOrderNew.setJqCostsExportProportion(twoPeople(jqExportFee.getSuperviseCosts()));
+        insFeeOrderNew.setSyCostsExportProportion(twoPeople(syExportFee.getSuperviseCosts()));
+        insFeeOrderNew.setNoCostsExportProportion(twoPeople(noExportFee.getSuperviseCosts()));
+
+        // 外部费用
+        insFeeOrderNew.setJqExternalProportion(jqExportFee.getExternalProportion());
+        insFeeOrderNew.setJqExternalPremiums(jqExportFee.getExternalPremiums());
+
+        insFeeOrderNew.setSyExternalProportion(syExportFee.getExternalProportion());
+        insFeeOrderNew.setSyExternalPremiums(syExportFee.getExternalPremiums());
+
+        insFeeOrderNew.setNoExternalProportion(noExportFee.getExternalProportion());
+        insFeeOrderNew.setNoExternalPremiums(noExportFee.getExternalPremiums());
+
+        //endregion
+
+        //region 计算利润差值
+        //入口 - 出口 - 机构管理费 1-5级 - 分销费  = 差值
+
+        //分销交强费用
+        //分开算  1  2 3 级
+        BigDecimal jqFirst = insFeeOrderNew.getJqPremium().multiply(insFeeOrderNew.getJqRetailProportionLevel1().divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_DOWN);
+        BigDecimal jqSecond = insFeeOrderNew.getJqPremium().multiply(insFeeOrderNew.getJqRetailProportionLevel2().divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_DOWN);
+        BigDecimal jqThird = insFeeOrderNew.getJqPremium().multiply(insFeeOrderNew.getJqRetailProportionLevel3().divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_DOWN);
+        BigDecimal jqFenXiao = jqFirst.add(jqSecond).add(jqThird);
+        //分销商业费用
+        BigDecimal syFirst = insFeeOrderNew.getSyPremium().multiply(insFeeOrderNew.getSyRetailProportionLevel1().divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_DOWN);
+        BigDecimal sySecond = insFeeOrderNew.getSyPremium().multiply(insFeeOrderNew.getSyRetailProportionLevel2().divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_DOWN);
+        BigDecimal syThird = insFeeOrderNew.getSyPremium().multiply(insFeeOrderNew.getSyRetailProportionLevel3().divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_DOWN);
+        BigDecimal syFenXiao = syFirst.add(sySecond).add(syThird);
+        //分销非车费用
+        BigDecimal noFirst = insFeeOrderNew.getNoPremium().multiply(insFeeOrderNew.getNoRetailProportionLevel1().divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_DOWN);
+        BigDecimal noSecond = insFeeOrderNew.getNoPremium().multiply(insFeeOrderNew.getNoRetailProportionLevel2().divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_DOWN);
+        BigDecimal noThird = insFeeOrderNew.getNoPremium().multiply(insFeeOrderNew.getNoRetailProportionLevel3().divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_DOWN);
+        BigDecimal noFenXiao = noFirst.add(noSecond).add(noThird);
+
+        BigDecimal jqDifference = jqEntranceFee.getTotalAmount()
+                .subtract(jqExportFee.getExternalPremiums())
+                .subtract(
+                        (jqExportFee.getSuperviseCostsPremiums().add(jqExportFee.getOtherCostsPremiums())))
+                .subtract(
+                        (jqDeptManagerFee.getDeptPremiumsLevelOne().add(jqDeptManagerFee.getDeptPremiumsLevelTwo().add(jqDeptManagerFee.getDeptPremiumsLevelThree()).add(jqDeptManagerFee.getDeptPremiumsLevelFoure()).add(jqDeptManagerFee.getDeptPremiumsLevelFive())))
+                )
+                .subtract(jqFenXiao)
+                .setScale(5, BigDecimal.ROUND_HALF_DOWN);
+        insFeeOrderNew.setJqProfitMarginPremiums(jqDifference);
+
+        BigDecimal syDifference = syEntranceFee.getTotalAmount()
+                .subtract(syExportFee.getExternalPremiums())
+                .subtract(
+                        (syExportFee.getSuperviseCostsPremiums().add(syExportFee.getOtherCostsPremiums())))
+                .subtract(
+                        (syDeptManagerFee.getDeptPremiumsLevelOne().add(syDeptManagerFee.getDeptPremiumsLevelTwo().add(syDeptManagerFee.getDeptPremiumsLevelThree()).add(syDeptManagerFee.getDeptPremiumsLevelFoure()).add(syDeptManagerFee.getDeptPremiumsLevelFive())))
+                )
+                .subtract(syFenXiao)
+                .setScale(5, BigDecimal.ROUND_HALF_DOWN);
+        insFeeOrderNew.setSyProfitMarginPremiums(syDifference);
+
+        BigDecimal noDifference = noEntranceFee.getTotalAmount()
+                .subtract(noExportFee.getExternalPremiums())
+                .subtract(
+                        (noExportFee.getSuperviseCostsPremiums().add(noExportFee.getOtherCostsPremiums())))
+                .subtract(
+                        (noDeptManagerFee.getDeptPremiumsLevelOne().add(noDeptManagerFee.getDeptPremiumsLevelTwo().add(noDeptManagerFee.getDeptPremiumsLevelThree()).add(noDeptManagerFee.getDeptPremiumsLevelFoure()).add(noDeptManagerFee.getDeptPremiumsLevelFive())))
+                )
+                .subtract(noFenXiao)
+                .setScale(5, BigDecimal.ROUND_HALF_DOWN);
+        insFeeOrderNew.setNoProfitMarginPremiums(noDifference);
+
+        //endregion
+
+        //region 比例逆推是否等于0
+
+        if (!feeRuleSchemeService.calculateProportion(jqEntranceFee, jqDeptManagerFee, jqExportFee, jqRetailRadio, taxRadio, insFeeOrderNew.getJqPremium()))
+            throw new SystemException("交强比例异常");
+
+        if (!feeRuleSchemeService.calculateProportion(syEntranceFee, syDeptManagerFee, syExportFee, syRetailRadio, taxRadio, insFeeOrderNew.getSyPremium()))
+            throw new SystemException("商业比例异常");
+
+        if (!feeRuleSchemeService.calculateProportion(noEntranceFee, noDeptManagerFee, noExportFee, noRetailRadio, taxRadio, insFeeOrderNew.getNoPremium()))
+            throw new SystemException("非车比例异常");
+
+        //endregion
+        insFeeOrderNewHistoryService.saveInsFeeOrderNewHistory(insFeeOrderNew);
+        insFeeOrderNewService.saveOrUpdate(insFeeOrderNew);
+    }
 
 
     /**
     /**
      * 判断是否包含非车险
      * 判断是否包含非车险

+ 53 - 0
src/main/java/com/ydtech/modules/fee/service/impl/InsFeeOrderNewHistoryServiceImpl.java

@@ -0,0 +1,53 @@
+package com.ydtech.modules.fee.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.fee.dao.InsFeeOrderNewHistoryMapper;
+import com.ydtech.modules.fee.entity.po.InsFeeOrderNewHistory;
+import com.ydtech.modules.fee.service.InsFeeOrderNewHistoryService;
+import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+
+/**
+* @author Administrator
+* @description 针对表【ins_fee_order_new_history】的数据库操作Service实现
+* @createDate 2024-08-30 18:08:47
+*/
+@Service
+public class InsFeeOrderNewHistoryServiceImpl extends ServiceImpl<InsFeeOrderNewHistoryMapper, InsFeeOrderNewHistory>
+    implements InsFeeOrderNewHistoryService {
+
+    @Override
+    public void saveInsFeeOrderNewHistory(InsFeeOrderNew insFeeOrderNew) {
+        final Integer isFirst = 1;
+        InsFeeOrderNewHistory one = lambdaQuery()
+                .eq(InsFeeOrderNewHistory::getInsOrderNo, insFeeOrderNew.getInsOrderNo())
+                .eq(InsFeeOrderNewHistory::getIsFirst, isFirst)
+                .one();
+
+        InsFeeOrderNewHistory insFeeOrderNewHistory = toInsFeeOrderNewHistory(insFeeOrderNew);
+        if (ObjectUtils.isEmpty(one)) {
+            insFeeOrderNewHistory.setIsFirst(isFirst);
+        }
+        save(insFeeOrderNewHistory);
+    }
+
+    @Override
+    public InsFeeOrderNewHistory toInsFeeOrderNewHistory(InsFeeOrderNew insFeeOrderNew) {
+        InsFeeOrderNewHistory insFeeOrderNewHistory = new InsFeeOrderNewHistory();
+        BeanUtils.copyProperties(insFeeOrderNew, insFeeOrderNewHistory);
+        insFeeOrderNewHistory.setId(null);
+        insFeeOrderNewHistory.setOperatorId(BaseController.getUserId());
+        insFeeOrderNewHistory.setOperatorTime(new Date());
+        return insFeeOrderNewHistory;
+    }
+
+}
+
+
+
+

+ 62 - 37
src/main/java/com/ydtech/modules/order/aop/aspect/QuoteVerificationAspect.java

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

+ 4 - 4
src/main/java/com/ydtech/modules/order/controller/InsTelemarketingOrderController.java

@@ -7,6 +7,7 @@ import com.ydtech.modules.order.entity.dto.TelemarketingAuditOrderDTO;
 import com.ydtech.modules.order.entity.vo.SubmitExportFeesVo;
 import com.ydtech.modules.order.entity.vo.SubmitExportFeesVo;
 import com.ydtech.modules.order.entity.vo.telemarketing.TelemarketingAuditOrderEditVo;
 import com.ydtech.modules.order.entity.vo.telemarketing.TelemarketingAuditOrderEditVo;
 import com.ydtech.modules.order.entity.vo.telemarketing.TelemarketingAuditOrderQueryVo;
 import com.ydtech.modules.order.entity.vo.telemarketing.TelemarketingAuditOrderQueryVo;
+import com.ydtech.modules.order.entity.vo.telemarketing.TelemarketingQueryExpensesVo;
 import com.ydtech.modules.order.service.InsTelemarketingOrderService;
 import com.ydtech.modules.order.service.InsTelemarketingOrderService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
@@ -42,12 +43,11 @@ public class InsTelemarketingOrderController {
         return HttpResult.ok();
         return HttpResult.ok();
     }
     }
 
 
-    @GetMapping("/queryExpenses/{subOrderNo}")
+    @PostMapping("/queryExpenses")
     @ApiOperation(value = "编辑查询")
     @ApiOperation(value = "编辑查询")
-    public HttpResult<TelemarketingAuditOrderEditVo> queryExpenses(@PathVariable String subOrderNo){
-        TelemarketingAuditOrderEditVo telemarketingAuditOrderEditVo = insTelemarketingOrderService.queryExpenses(subOrderNo);
+    public HttpResult<TelemarketingAuditOrderEditVo> queryExpenses(@RequestBody TelemarketingQueryExpensesVo telemarketingQueryExpensesVo){
+        TelemarketingAuditOrderEditVo telemarketingAuditOrderEditVo = insTelemarketingOrderService.queryExpenses(telemarketingQueryExpensesVo);
         return HttpResult.ok(telemarketingAuditOrderEditVo);
         return HttpResult.ok(telemarketingAuditOrderEditVo);
     }
     }
 
 
-
 }
 }

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

@@ -0,0 +1,18 @@
+package com.ydtech.modules.order.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.order.entity.po.InsAreaCompanyError;
+
+/**
+* @author Administrator
+* @description 针对表【ins_area_company_error(报价信息错误记录表)】的数据库操作Mapper
+* @createDate 2024-08-31 15:05:08
+* @Entity generator.domain.InsAreaCompanyError
+*/
+public interface InsAreaCompanyErrorMapper extends BaseMapper<InsAreaCompanyError> {
+
+}
+
+
+
+

+ 48 - 4
src/main/java/com/ydtech/modules/order/dao/InsAreaCompanyMapper.java

@@ -7,14 +7,12 @@ import com.ydtech.modules.admin.model.dto.AllpremiumDto;
 import com.ydtech.modules.admin.model.dto.PremiumReportDto;
 import com.ydtech.modules.admin.model.dto.PremiumReportDto;
 import com.ydtech.modules.admin.model.dto.QxFrontlineAgentDto;
 import com.ydtech.modules.admin.model.dto.QxFrontlineAgentDto;
 import com.ydtech.modules.admin.model.dto.TaskStatisticsDto;
 import com.ydtech.modules.admin.model.dto.TaskStatisticsDto;
-import com.ydtech.modules.admin.model.report.company.CompanyPremiumDataDto;
-import com.ydtech.modules.admin.model.report.company.CompanyPremiumDataQueryDto;
-import com.ydtech.modules.admin.model.report.company.CompanyQutationCountDataDto;
-import com.ydtech.modules.admin.model.report.company.CompanyQutationCountDataQueryDto;
+import com.ydtech.modules.admin.model.report.company.*;
 import com.ydtech.modules.admin.model.report.opetationData.BusinessDataDto;
 import com.ydtech.modules.admin.model.report.opetationData.BusinessDataDto;
 import com.ydtech.modules.admin.model.report.opetationData.BusinessDataQueryDto;
 import com.ydtech.modules.admin.model.report.opetationData.BusinessDataQueryDto;
 import com.ydtech.modules.admin.model.report.opetationData.QuotationCountDataDto;
 import com.ydtech.modules.admin.model.report.opetationData.QuotationCountDataDto;
 import com.ydtech.modules.admin.model.report.opetationData.QuotationCountQueryDto;
 import com.ydtech.modules.admin.model.report.opetationData.QuotationCountQueryDto;
+import com.ydtech.modules.admin.model.vo.OrdersDataVo;
 import com.ydtech.modules.admin.model.vo.SubOrder;
 import com.ydtech.modules.admin.model.vo.SubOrder;
 import com.ydtech.modules.admin.model.vo.TaskStatisticsVo;
 import com.ydtech.modules.admin.model.vo.TaskStatisticsVo;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsAreaCompany;
@@ -239,6 +237,52 @@ public interface InsAreaCompanyMapper extends BaseMapper<InsAreaCompany> {
 
 
     QxFrontlineAgentDto getOrderManpowerNew( @Param("vo") QxFrontlineAgentDto qxFrontlineAgentDto);
     QxFrontlineAgentDto getOrderManpowerNew( @Param("vo") QxFrontlineAgentDto qxFrontlineAgentDto);
 
 
+    QxFrontlineAgentDto getChannelOrderManpowerNew(@Param("vo") QxFrontlineAgentDto qxFrontlineAgentDto);
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/30 10:22
+     *  @Description:  通过用户id查询金额数据
+     */
+    Double  getOrderPremiumByUserIds(@Param("ids") List<String>  ids);
+    /**
+     *  @version
+     *  @author: whp
+     *  @Date: 2024/8/31 15:35
+     *  @Description:   查询控制台大订单
+     */
+    Page<OrdersDataDto> querOrdersDataPage(@Param("vo") OrdersDataVo ordersDataVo,@Param("page") Page<OrdersDataDto> page);
+    /**
+     *  @version
+     *  @author: whp
+     *  @Date: 2024/8/31 15:35
+     *  @Description:   查询控制台大订合计
+     */
+    OrdersDataDto querOrdersamountTo( @Param("vo") OrdersDataVo ordersDataVo);
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/30 10:22
+     *  @Description:  通过用户id查询金额数据
+     */
+    TaskStatisticsDto numberQuotationsByUserIds(@Param("ids") List<String>  ids,@Param("month") String month);
+
+    OrdersDataDto querResultOrderNumber(@Param("vo") OrdersDataVo ordersDataVo);
+
+    /**
+     *   代理人统计查询
+     * @param taskStatisticsVo
+     * @return
+     */
+    Long agentStatisticsQueryPageTotal(@Param("taskStatisticsVo") TaskStatisticsVo taskStatisticsVo);
+
+    Long queryCompanyQutationCountDataPageTotal(@Param("vo") CompanyQutationCountDataQueryDto companyQutationCountDataQueryDto);
+
+
+    CompanyQutationCountDataDto getInsAreaCompanyError(@Param("vo") CompanyQutationCountDataQueryDto companyQutationCountDataQueryDto);
+
 
 
 }
 }
 
 

+ 3 - 1
src/main/java/com/ydtech/modules/order/entity/InsAreaCompany.java

@@ -541,7 +541,9 @@ public class InsAreaCompany implements Serializable {
         this.syRenewal = StringUtils.isEmpty(quoteRespVo.getSyRenewal()) ? null : quoteRespVo.getSyRenewal();
         this.syRenewal = StringUtils.isEmpty(quoteRespVo.getSyRenewal()) ? null : quoteRespVo.getSyRenewal();
         this.jqClaims = quoteRespVo.getJqClaims();
         this.jqClaims = quoteRespVo.getJqClaims();
         this.syClaims = quoteRespVo.getSyClaims();
         this.syClaims = quoteRespVo.getSyClaims();
-
+        if(StringUtils.isNotEmpty(quoteRespVo.getIszdj())){
+            this.isDjq = quoteRespVo.getIszdj();
+        }
     }
     }
 
 
     public void setPaymentLink(String paymentLink) {
     public void setPaymentLink(String paymentLink) {

+ 12 - 0
src/main/java/com/ydtech/modules/order/entity/crawler/response/CrawlerQuoteResponse.java

@@ -283,6 +283,18 @@ public class CrawlerQuoteResponse extends CrawlerBaseResponse {
         @JsonProperty("errorCodeMap")
         @JsonProperty("errorCodeMap")
         private List<String> errorCodeMap;
         private List<String> errorCodeMap;
 
 
+        /**
+         * 真假单交
+         */
+        @JsonProperty("isCIFlag")
+        private String isCIFlag;
+
+        /**
+         * 平台返回的期望折扣
+         */
+        @JsonProperty("hope_discount")
+        private String hopeDiscount;
+
         /**
         /**
          * 报价提示
          * 报价提示
          */
          */

+ 141 - 0
src/main/java/com/ydtech/modules/order/entity/po/InsAreaCompanyError.java

@@ -0,0 +1,141 @@
+package com.ydtech.modules.order.entity.po;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 报价信息错误记录表
+ * @TableName ins_area_company_error
+ */
+@TableName(value ="ins_area_company_error")
+@Data
+public class InsAreaCompanyError implements Serializable {
+    /**
+     * 主键
+     */
+    @TableId
+    private String id;
+
+    /**
+     * 大订单号
+     */
+    private String orderno;
+
+    /**
+     * 协议id
+     */
+    private String agreementId;
+
+    /**
+     * 保险公司id
+     */
+    private String companyId;
+
+    /**
+     * 保险公司名称
+     */
+    private String companyName;
+
+    /**
+     * 合作公司id
+     */
+    private String partnerCompaniesId;
+
+    /**
+     * 合作公司名称
+     */
+    private String partnerCompaniesName;
+
+    /**
+     * 错误信息
+     */
+    private String errorMsg;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 用户id
+     */
+    private String userId;
+
+    /**
+     * 机构id
+     */
+    private String deptId;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public boolean equals(Object that) {
+        if (this == that) {
+            return true;
+        }
+        if (that == null) {
+            return false;
+        }
+        if (getClass() != that.getClass()) {
+            return false;
+        }
+        InsAreaCompanyError other = (InsAreaCompanyError) that;
+        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
+            && (this.getOrderno() == null ? other.getOrderno() == null : this.getOrderno().equals(other.getOrderno()))
+            && (this.getAgreementId() == null ? other.getAgreementId() == null : this.getAgreementId().equals(other.getAgreementId()))
+            && (this.getCompanyId() == null ? other.getCompanyId() == null : this.getCompanyId().equals(other.getCompanyId()))
+            && (this.getCompanyName() == null ? other.getCompanyName() == null : this.getCompanyName().equals(other.getCompanyName()))
+            && (this.getPartnerCompaniesId() == null ? other.getPartnerCompaniesId() == null : this.getPartnerCompaniesId().equals(other.getPartnerCompaniesId()))
+            && (this.getPartnerCompaniesName() == null ? other.getPartnerCompaniesName() == null : this.getPartnerCompaniesName().equals(other.getPartnerCompaniesName()))
+            && (this.getErrorMsg() == null ? other.getErrorMsg() == null : this.getErrorMsg().equals(other.getErrorMsg()))
+            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
+            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
+            && (this.getDeptId() == null ? other.getDeptId() == null : this.getDeptId().equals(other.getDeptId()));
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
+        result = prime * result + ((getOrderno() == null) ? 0 : getOrderno().hashCode());
+        result = prime * result + ((getAgreementId() == null) ? 0 : getAgreementId().hashCode());
+        result = prime * result + ((getCompanyId() == null) ? 0 : getCompanyId().hashCode());
+        result = prime * result + ((getCompanyName() == null) ? 0 : getCompanyName().hashCode());
+        result = prime * result + ((getPartnerCompaniesId() == null) ? 0 : getPartnerCompaniesId().hashCode());
+        result = prime * result + ((getPartnerCompaniesName() == null) ? 0 : getPartnerCompaniesName().hashCode());
+        result = prime * result + ((getErrorMsg() == null) ? 0 : getErrorMsg().hashCode());
+        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
+        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
+        result = prime * result + ((getDeptId() == null) ? 0 : getDeptId().hashCode());
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", orderno=").append(orderno);
+        sb.append(", agreementId=").append(agreementId);
+        sb.append(", companyId=").append(companyId);
+        sb.append(", companyName=").append(companyName);
+        sb.append(", partnerCompaniesId=").append(partnerCompaniesId);
+        sb.append(", partnerCompaniesName=").append(partnerCompaniesName);
+        sb.append(", errorMsg=").append(errorMsg);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", userId=").append(userId);
+        sb.append(", deptId=").append(deptId);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 13 - 0
src/main/java/com/ydtech/modules/order/entity/vo/SubmitExportFeesVo.java

@@ -1,10 +1,12 @@
 package com.ydtech.modules.order.entity.vo;
 package com.ydtech.modules.order.entity.vo;
 
 
 
 
+import com.ydtech.utils.ObjectUtil;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.NoArgsConstructor;
+import org.springframework.util.ObjectUtils;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 
 
@@ -31,4 +33,15 @@ public class SubmitExportFeesVo {
     @ApiModelProperty("使用状态 0 使用最开始的费用 1 使用修改状态下的费用")
     @ApiModelProperty("使用状态 0 使用最开始的费用 1 使用修改状态下的费用")
     private String state;
     private String state;
 
 
+    public BigDecimal getJqExportProportion() {
+        return ObjectUtils.isEmpty(jqExportProportion) ? BigDecimal.ZERO : jqExportProportion;
+    }
+
+    public BigDecimal getSyExportProportion() {
+        return ObjectUtils.isEmpty(syExportProportion)  ? BigDecimal.ZERO : syExportProportion;
+    }
+
+    public BigDecimal getNoCarExportProportion() {
+        return ObjectUtils.isEmpty(noCarExportProportion)  ? BigDecimal.ZERO : noCarExportProportion;
+    }
 }
 }

+ 1 - 0
src/main/java/com/ydtech/modules/order/entity/vo/telemarketing/TelemarketingAuditOrderEditVo.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.order.entity.vo.telemarketing;
 package com.ydtech.modules.order.entity.vo.telemarketing;
 
 
 
 
+import com.ydtech.modules.fee.entity.po.InsFeeOrderNewHistory;
 import com.ydtech.modules.order.entity.vo.FeeOrderNewVo;
 import com.ydtech.modules.order.entity.vo.FeeOrderNewVo;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiModelProperty;

+ 2 - 0
src/main/java/com/ydtech/modules/order/entity/vo/telemarketing/TelemarketingAuditOrderQueryVo.java

@@ -43,4 +43,6 @@ public class TelemarketingAuditOrderQueryVo extends BasePageVO implements Serial
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private LocalDate endDate;
     private LocalDate endDate;
 
 
+    @ApiModelProperty(value = "审核状态")
+    private String auditStatus;
 }
 }

+ 24 - 0
src/main/java/com/ydtech/modules/order/entity/vo/telemarketing/TelemarketingQueryExpensesVo.java

@@ -0,0 +1,24 @@
+package com.ydtech.modules.order.entity.vo.telemarketing;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class TelemarketingQueryExpensesVo implements Serializable {
+
+    private static final long serialVersionUID = 387376536336427502L;
+
+    @ApiModelProperty("子订单")
+    private String subOrderId;
+
+    @ApiModelProperty("状态 1 初始  2 修改后 ")
+    private String state;
+
+}

+ 13 - 0
src/main/java/com/ydtech/modules/order/service/InsAreaCompanyErrorService.java

@@ -0,0 +1,13 @@
+package com.ydtech.modules.order.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.order.entity.po.InsAreaCompanyError;
+
+/**
+* @author Administrator
+* @description 针对表【ins_area_company_error(报价信息错误记录表)】的数据库操作Service
+* @createDate 2024-08-31 15:05:08
+*/
+public interface InsAreaCompanyErrorService extends IService<InsAreaCompanyError> {
+
+}

+ 7 - 1
src/main/java/com/ydtech/modules/order/service/InsAreaCompanyService.java

@@ -183,5 +183,11 @@ public interface InsAreaCompanyService extends IService<InsAreaCompany> {
     QxFrontlineAgentDto getOrderManpowerByUserId(String id);
     QxFrontlineAgentDto getOrderManpowerByUserId(String id);
 
 
     QxFrontlineAgentDto getOrderManpowerNew(@Param("vo") QxFrontlineAgentDto qxFrontlineAgentDto);
     QxFrontlineAgentDto getOrderManpowerNew(@Param("vo") QxFrontlineAgentDto qxFrontlineAgentDto);
-
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/30 10:23
+     *  @Description:  通过用户id查询到导出的数据
+     */
+    Double getOrderPremiumByUserIds(List<String> ids);
 }
 }

+ 3 - 2
src/main/java/com/ydtech/modules/order/service/InsTelemarketingOrderService.java

@@ -5,6 +5,7 @@ import com.ydtech.modules.order.entity.dto.TelemarketingAuditOrderDTO;
 import com.ydtech.modules.order.entity.vo.SubmitExportFeesVo;
 import com.ydtech.modules.order.entity.vo.SubmitExportFeesVo;
 import com.ydtech.modules.order.entity.vo.telemarketing.TelemarketingAuditOrderEditVo;
 import com.ydtech.modules.order.entity.vo.telemarketing.TelemarketingAuditOrderEditVo;
 import com.ydtech.modules.order.entity.vo.telemarketing.TelemarketingAuditOrderQueryVo;
 import com.ydtech.modules.order.entity.vo.telemarketing.TelemarketingAuditOrderQueryVo;
+import com.ydtech.modules.order.entity.vo.telemarketing.TelemarketingQueryExpensesVo;
 
 
 public interface InsTelemarketingOrderService {
 public interface InsTelemarketingOrderService {
 
 
@@ -32,8 +33,8 @@ public interface InsTelemarketingOrderService {
 
 
     /**
     /**
      * 修改编辑
      * 修改编辑
-     * @param subOrderNo 子订单编号
+     * @param telemarketingQueryExpensesVo 子订单编号
      */
      */
-    TelemarketingAuditOrderEditVo queryExpenses(String subOrderNo);
+    TelemarketingAuditOrderEditVo queryExpenses(TelemarketingQueryExpensesVo telemarketingQueryExpensesVo);
 
 
 }
 }

+ 22 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsAreaCompanyErrorServiceImpl.java

@@ -0,0 +1,22 @@
+package com.ydtech.modules.order.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.order.dao.InsAreaCompanyErrorMapper;
+import com.ydtech.modules.order.entity.po.InsAreaCompanyError;
+import com.ydtech.modules.order.service.InsAreaCompanyErrorService;
+import org.springframework.stereotype.Service;
+
+/**
+* @author Administrator
+* @description 针对表【ins_area_company_error(报价信息错误记录表)】的数据库操作Service实现
+* @createDate 2024-08-31 15:05:08
+*/
+@Service
+public class InsAreaCompanyErrorServiceImpl extends ServiceImpl<InsAreaCompanyErrorMapper, InsAreaCompanyError>
+    implements InsAreaCompanyErrorService {
+
+}
+
+
+
+

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

@@ -981,6 +981,16 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
         return baseMapper.getOrderManpowerNew(qxFrontlineAgentDto);
         return baseMapper.getOrderManpowerNew(qxFrontlineAgentDto);
 
 
     }
     }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/8/30 10:27
+     *  @Description:  通过用户id查询总保费
+     */
+    @Override
+    public Double getOrderPremiumByUserIds(List<String> ids) {
+        return baseMapper.getOrderPremiumByUserIds(ids);
+    }
 
 
 }
 }
 
 

+ 3 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsCrawlerOrderServiceImpl.java

@@ -352,6 +352,9 @@ public class InsCrawlerOrderServiceImpl implements InsCrawlerOrderService {
         quoteRespVo.setSyAdjustRate(other.getSyDiscount());
         quoteRespVo.setSyAdjustRate(other.getSyDiscount());
         quoteRespVo.setOrderno(orderNo); //订单号
         quoteRespVo.setOrderno(orderNo); //订单号
 
 
+        quoteRespVo.setIszdj(other.getIsCIFlag());
+        quoteRespVo.setInitialProposalDiscount(other.getHopeDiscount());
+
         if (!ObjectUtils.isEmpty(other.getPredictInfo())) {
         if (!ObjectUtils.isEmpty(other.getPredictInfo())) {
             quoteRespVo.setPredictInfo(other.getPredictInfo().stream().map(QuoteRespVo.PreUnderwritingInfoDTO::new).collect(Collectors.toList()));
             quoteRespVo.setPredictInfo(other.getPredictInfo().stream().map(QuoteRespVo.PreUnderwritingInfoDTO::new).collect(Collectors.toList()));
         }
         }

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

@@ -1000,7 +1000,7 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
                 }
                 }
             }
             }
         }else if (type == 4) {
         }else if (type == 4) {
-            agentUserIds = sysUserService.getTelemarketingPersonnelData(orderQueryVo.getUserId());
+            agentUserIds = sysUserService.getTelemarketingPersonnelData();
         }
         }
 
 
         Long total = 0L;
         Long total = 0L;

+ 31 - 18
src/main/java/com/ydtech/modules/order/service/impl/InsTelemarketingOrderServiceImpl.java

@@ -2,8 +2,10 @@ package com.ydtech.modules.order.service.impl;
 
 
 
 
 import com.ydtech.constants.enums.dict.FeeAuditAuditstatus;
 import com.ydtech.constants.enums.dict.FeeAuditAuditstatus;
+import com.ydtech.modules.fee.entity.po.InsFeeOrderNewHistory;
 import com.ydtech.modules.fee.entity.po.InsFeeTelemarketing;
 import com.ydtech.modules.fee.entity.po.InsFeeTelemarketing;
 import com.ydtech.modules.fee.service.FeeRuleSchemeNewService;
 import com.ydtech.modules.fee.service.FeeRuleSchemeNewService;
+import com.ydtech.modules.fee.service.InsFeeOrderNewHistoryService;
 import com.ydtech.modules.fee.service.InsFeeTelemarketingService;
 import com.ydtech.modules.fee.service.InsFeeTelemarketingService;
 import com.ydtech.modules.fnc.service.InsFeeAuditService;
 import com.ydtech.modules.fnc.service.InsFeeAuditService;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.order.entity.BasePageResult;
@@ -13,15 +15,19 @@ import com.ydtech.modules.order.entity.dto.TelemarketingAuditOrderDTO;
 import com.ydtech.modules.order.entity.vo.SubmitExportFeesVo;
 import com.ydtech.modules.order.entity.vo.SubmitExportFeesVo;
 import com.ydtech.modules.order.entity.vo.telemarketing.TelemarketingAuditOrderEditVo;
 import com.ydtech.modules.order.entity.vo.telemarketing.TelemarketingAuditOrderEditVo;
 import com.ydtech.modules.order.entity.vo.telemarketing.TelemarketingAuditOrderQueryVo;
 import com.ydtech.modules.order.entity.vo.telemarketing.TelemarketingAuditOrderQueryVo;
+import com.ydtech.modules.order.entity.vo.telemarketing.TelemarketingQueryExpensesVo;
 import com.ydtech.modules.order.service.InsAreaCompanyService;
 import com.ydtech.modules.order.service.InsAreaCompanyService;
 import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.modules.order.service.InsTelemarketingOrderService;
 import com.ydtech.modules.order.service.InsTelemarketingOrderService;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsExport;
 import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew;
 import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew;
 import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
 import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
+import com.ydtech.modules.protocols.service.PtlAgreementProductCostsExportService;
 import com.ydtech.modules.protocols.service.PtlAgreementProductCostsNewService;
 import com.ydtech.modules.protocols.service.PtlAgreementProductCostsNewService;
 import com.ydtech.utils.BigDecimalUtils;
 import com.ydtech.utils.BigDecimalUtils;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
@@ -38,14 +44,16 @@ public class InsTelemarketingOrderServiceImpl implements InsTelemarketingOrderSe
 
 
     private final FeeRuleSchemeNewService feeRuleSchemeNewService;
     private final FeeRuleSchemeNewService feeRuleSchemeNewService;
 
 
-    private final PtlAgreementProductCostsNewService ptlAgreementProductCostsNewService;
-
     private final InsFeeOrderNewService insFeeOrderNewService;
     private final InsFeeOrderNewService insFeeOrderNewService;
 
 
+    private final InsFeeOrderNewHistoryService insFeeOrderNewHistoryService;
+
     private final InsFeeAuditService insFeeAuditService;
     private final InsFeeAuditService insFeeAuditService;
 
 
     private final InsFeeTelemarketingService insFeeTelemarketingService;
     private final InsFeeTelemarketingService insFeeTelemarketingService;
 
 
+    private final PtlAgreementProductCostsExportService ptlAgreementProductCostsExportService;
+
     @Override
     @Override
     public BasePageResult<TelemarketingAuditOrderDTO> getOrderList(TelemarketingAuditOrderQueryVo telemarketingAuditOrderQueryVo) {
     public BasePageResult<TelemarketingAuditOrderDTO> getOrderList(TelemarketingAuditOrderQueryVo telemarketingAuditOrderQueryVo) {
         return insOrdersService.getTelemarketingAudit(telemarketingAuditOrderQueryVo);
         return insOrdersService.getTelemarketingAudit(telemarketingAuditOrderQueryVo);
@@ -59,10 +67,8 @@ public class InsTelemarketingOrderServiceImpl implements InsTelemarketingOrderSe
         // 费用信息
         // 费用信息
         InsFeeOrderNew insFeeOrderNew = insFeeOrderNewService.getByInsOrderNo(insAreaCompany.getId());
         InsFeeOrderNew insFeeOrderNew = insFeeOrderNewService.getByInsOrderNo(insAreaCompany.getId());
 
 
-        // 协议费用信息
-        PtlAgreementProductCostsNew ptlAgreementProductCostsNew = ptlAgreementProductCostsNewService.lambdaQuery()
-                .eq(PtlAgreementProductCostsNew::getId, insFeeOrderNew.getCostsId())
-                .one();
+        // 出口费用
+        PtlAgreementProductCostsExport ptlAgreementProductCostsExport = ptlAgreementProductCostsExportService.lambdaQuery().eq(PtlAgreementProductCostsExport::getCostsId, insFeeOrderNew.getCostsId()).one();
 
 
         String state = submitExportFeesVo.getState();
         String state = submitExportFeesVo.getState();
         boolean equals = "0".equals(state);
         boolean equals = "0".equals(state);
@@ -72,22 +78,22 @@ public class InsTelemarketingOrderServiceImpl implements InsTelemarketingOrderSe
         insFeeTelemarketingService.save(insFeeTelemarketing);
         insFeeTelemarketingService.save(insFeeTelemarketing);
 
 
         // 交强一级管理比例
         // 交强一级管理比例
-        BigDecimal jqExportRadioLevel1 = getTheScaleBasedOnTheStatus(equals, ptlAgreementProductCostsNew.getJqExportRadioLevel1(), insFeeOrderNew.getJqDeptProportionLevel1());
+        BigDecimal jqExportRadioLevel1 = getTheScaleBasedOnTheStatus(equals, String.valueOf(ptlAgreementProductCostsExport.getJqExportRadioLevel1()), insFeeOrderNew.getJqDeptProportionLevel1());
         BigDecimal jq = jqExportRadioLevel1.add(submitExportFeesVo.getJqExportProportion());
         BigDecimal jq = jqExportRadioLevel1.add(submitExportFeesVo.getJqExportProportion());
-        ptlAgreementProductCostsNew.setJqExportRadioLevel1(String.valueOf(jq));
+        ptlAgreementProductCostsExport.setJqExportRadioLevel1(jq);
 
 
         // 商业一级管理比例
         // 商业一级管理比例
-        BigDecimal syExportRadioLevel1 = getTheScaleBasedOnTheStatus(equals, ptlAgreementProductCostsNew.getSyExportRadioLevel1(), insFeeOrderNew.getSyDeptProportionLevel1());
+        BigDecimal syExportRadioLevel1 = getTheScaleBasedOnTheStatus(equals, String.valueOf(ptlAgreementProductCostsExport.getSyExportRadioLevel1()), insFeeOrderNew.getSyDeptProportionLevel1());
         BigDecimal sy = syExportRadioLevel1.add(submitExportFeesVo.getSyExportProportion());
         BigDecimal sy = syExportRadioLevel1.add(submitExportFeesVo.getSyExportProportion());
-        ptlAgreementProductCostsNew.setSyExportRadioLevel1(String.valueOf(sy));
+        ptlAgreementProductCostsExport.setSyExportRadioLevel1(sy);
 
 
         // 非车一级管理比例
         // 非车一级管理比例
-        BigDecimal noCarExportRadioLevel1 = getTheScaleBasedOnTheStatus(equals, ptlAgreementProductCostsNew.getNoCarExportRadioLevel1(), insFeeOrderNew.getNoDeptProportionLevel1());
+        BigDecimal noCarExportRadioLevel1 = getTheScaleBasedOnTheStatus(equals, String.valueOf(ptlAgreementProductCostsExport.getNoCarExportRadioLevel1()), insFeeOrderNew.getNoDeptProportionLevel1());
         BigDecimal no = noCarExportRadioLevel1.add(submitExportFeesVo.getNoCarExportProportion());
         BigDecimal no = noCarExportRadioLevel1.add(submitExportFeesVo.getNoCarExportProportion());
-        ptlAgreementProductCostsNew.setNoCarExportRadioLevel1(String.valueOf(no));
+        ptlAgreementProductCostsExport.setNoCarExportRadioLevel1(no);
 
 
         // 重新计算比例
         // 重新计算比例
-        feeRuleSchemeNewService.calcCostsExternal(ptlAgreementProductCostsNew, insAreaCompany);
+        feeRuleSchemeNewService.calcCostsExternalTelemarketing(ptlAgreementProductCostsExport, insAreaCompany);
         // 改完之后到待提交
         // 改完之后到待提交
         insFeeAuditService.saveDefaultInsFeeAuditAndHistory(insAreaCompany.getOrderno(), insAreaCompany.getId(), FeeAuditAuditstatus.TELEMARKETING_TO_BE_SUBMITTED.getCode(), null);
         insFeeAuditService.saveDefaultInsFeeAuditAndHistory(insAreaCompany.getOrderno(), insAreaCompany.getId(), FeeAuditAuditstatus.TELEMARKETING_TO_BE_SUBMITTED.getCode(), null);
     }
     }
@@ -107,12 +113,19 @@ public class InsTelemarketingOrderServiceImpl implements InsTelemarketingOrderSe
     }
     }
 
 
     @Override
     @Override
-    public TelemarketingAuditOrderEditVo queryExpenses(String subOrderNo) {
-        InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(subOrderNo);
-        // 费用信息
-        InsFeeOrderNew insFeeOrderNew = insFeeOrderNewService.getByInsOrderNo(insAreaCompany.getId());
+    public TelemarketingAuditOrderEditVo queryExpenses(TelemarketingQueryExpensesVo telemarketingQueryExpensesVo) {
+        String state = telemarketingQueryExpensesVo.getState();
+        InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(telemarketingQueryExpensesVo.getSubOrderId());
+        InsFeeOrderNew insFeeOrderNew = new InsFeeOrderNew();
+        if ("2".equals(state)) {
+            // 费用信息
+            insFeeOrderNew = insFeeOrderNewService.getByInsOrderNo(insAreaCompany.getId());
+            return new TelemarketingAuditOrderEditVo(insFeeOrderNew);
+        } else {
+            InsFeeOrderNewHistory insFeeOrderNewHistory = insFeeOrderNewHistoryService.getByInsOrderNo(insAreaCompany.getId());
+            BeanUtils.copyProperties(insFeeOrderNewHistory, insFeeOrderNew);
+        }
         return new TelemarketingAuditOrderEditVo(insFeeOrderNew);
         return new TelemarketingAuditOrderEditVo(insFeeOrderNew);
     }
     }
 
 
-
 }
 }

+ 13 - 13
src/main/resources/mapper/modules/admin/DeptBalanceMapper.xml

@@ -16,10 +16,10 @@
         IFNULL(c.sumHistoryFee,0) as "withdrawn"
         IFNULL(c.sumHistoryFee,0) as "withdrawn"
         FROM
         FROM
         sys_agency_leader sa
         sys_agency_leader sa
-        LEFT JOIN sys_dept sd ON sd.id = sa.dept_id
+        LEFT JOIN sys_dept sd ON sd.parent_id = sa.dept_id
         LEFT JOIN (
         LEFT JOIN (
         SELECT
         SELECT
-        io.userid AS "userId",
+        io.deptid AS "deptId",
         sum( IFNULL( iac.jqpremium, 0 ) )+ sum(
         sum( IFNULL( iac.jqpremium, 0 ) )+ sum(
         IFNULL( sypremium, 0 )) + sum(
         IFNULL( sypremium, 0 )) + sum(
         IFNULL( jypremium, 0 )) AS "sumPremium"
         IFNULL( jypremium, 0 )) AS "sumPremium"
@@ -30,8 +30,8 @@
         iac.orderstatus = '3'
         iac.orderstatus = '3'
         AND io.orderstatus = '3'
         AND io.orderstatus = '3'
         GROUP BY
         GROUP BY
-        io.userid
-        ) b ON b.userId = sa.user_id
+        io.deptid
+        ) b ON b.deptId = sd.id
         LEFT JOIN (
         LEFT JOIN (
         SELECT
         SELECT
         sum( safa.history_fee ) AS "sumHistoryFee",
         sum( safa.history_fee ) AS "sumHistoryFee",
@@ -91,20 +91,20 @@
 
 
     <select id="getByDeptId" resultType="java.util.HashMap">
     <select id="getByDeptId" resultType="java.util.HashMap">
         SELECT
         SELECT
-        sum(IFNULL(iac.jqpremium,0) + IFNULL(iac.sypremium,0) + IFNULL(iac.jypremium,0)) * (sal.proportional /100) as
+        sum(IFNULL(iac.jqpremium,0) + IFNULL(iac.sypremium,0) + IFNULL(iac.jypremium,0))  as
         "totalIncome",
         "totalIncome",
-        sum(IFNULL(iac.jqpremium,0) + IFNULL(iac.sypremium,0) + IFNULL(iac.jypremium,0)) * (sal.proportional /100) as
+        sum(IFNULL(iac.jqpremium,0) + IFNULL(iac.sypremium,0) + IFNULL(iac.jypremium,0)) as
         "deptManagementFee"
         "deptManagementFee"
         FROM
         FROM
-        ins_orders io
-        left join ins_area_company iac on iac.orderno =io.orderno
-        left join sys_agency_leader sal on sal.dept_id = iac.deptid
+        ins_area_company iac
+        left join ins_orders io on iac.orderno = io.orderno
         <where>
         <where>
-            io.orderstatus ='3'
-            and iac.orderstatus ='3'
-            and sal.del_flag ='1'
+             iac.orderstatus ='3'
             <if test="deptId  != null  and  deptId !=''">
             <if test="deptId  != null  and  deptId !=''">
-                iac.deptid =#{deptId}
+               and io.deptid like CONCAT( #{deptId}, '%' )
+            </if>
+            <if test="createTime  != null  and  createTime !=''">
+                and io.createtime >= #{createTime}
             </if>
             </if>
         </where>
         </where>
     </select>
     </select>

+ 35 - 0
src/main/resources/mapper/modules/admin/SysAgencyLeaderMapper.xml

@@ -38,6 +38,41 @@
         </where>
         </where>
 
 
     </select>
     </select>
+    <select id="queryPage" resultType="com.ydtech.modules.admin.model.dto.DeptBalanceDto">
+        select
+            sal.user_id AS "userId",
+            sal.user_name AS "deptLeader",
+            sd.address AS "deptAddress",
+            sd.comlevel AS "comlevel",
+            sal.dept_id AS deptId,
+            sal.proportional AS "proportional",
+            sal.create_time AS "createTime",
+            sal.update_time AS "updateTime"
+        from sys_agency_leader sal
+        left  join  sys_user   su  on  sal.user_id = su.id
+        left  join  sys_dept   sd  on  sal.dept_id   =sd.id
+        <where>
+            sal.del_flag =1
+            <if test="vo.deptId !=null  and  vo.deptId !=''">
+                and su.dept_id like  concat('%',#{vo.deptId},'%')
+            </if>
+            <if test="vo.phoneNumber !=null  and  vo.phoneNumber !=''">
+                and su.mobile =#{vo.phoneNumber}
+            </if>
+            <if test="vo.name !=null  and  vo.name !=''">
+                and su.name =#{vo.name}
+            </if>
+            <if test="vo.userCode !=null  and  vo.userCode !=''">
+                and su.id= #{vo.userCode}
+            </if>
+            <if test="vo.days !=null  and vo.days !='' ">
+                and su.create_time >= DATE_SUB(NOW(), INTERVAL #{vo.days} DAY)
+            </if>
+            <if test="vo.beginDate !=null and vo.beginDate != '' and vo.endDate !=null and vo.endDate != ''">
+                AND   DATE_FORMAT( su.create_time, '%Y-%m-%d')   BETWEEN #{vo.beginDate} AND #{vo.endDate}
+            </if>
+        </where>
+    </select>
 
 
 </mapper>
 </mapper>
 
 

+ 2 - 5
src/main/resources/mapper/modules/admin/SysPartnerMapper.xml

@@ -33,11 +33,8 @@
         <where>
         <where>
             1=1
             1=1
             and sp.del_flag ='1'
             and sp.del_flag ='1'
-            <if test="vo.userIdList !=null and  vo.userIdList!=''  and vo.userIdList.size() >0">
-                and sp.user_id IN
-                <foreach item="item" index="index" collection="vo.userIdList" open="(" separator="," close=")">
-                    #{item}
-                </foreach>
+            <if test="vo.deptId !=null and  vo.deptId!=''  ">
+                and sd.id  LIKE concat('%', #{vo.deptId}, '%')
             </if>
             </if>
             <if test="vo.phoneNumber !=null  and  vo.phoneNumber !=''">
             <if test="vo.phoneNumber !=null  and  vo.phoneNumber !=''">
                 and su.mobile =#{vo.phoneNumber}
                 and su.mobile =#{vo.phoneNumber}

+ 10 - 0
src/main/resources/mapper/modules/admin/SysRelationPersonMapper.xml

@@ -62,5 +62,15 @@
         </where>
         </where>
 
 
     </select>
     </select>
+    <select id="selectListByLeaderId" resultType="com.ydtech.modules.admin.model.SysAgencyLeader">
+        select
+            sal.*
+        from sys_relation_person a
+        left  join  sys_user  su  on su.id = a.agency_leader_id
+        left  join  sys_agency_leader  sal  on a.agency_leader_id  = sal.user_id
+       where
+            a.suggest_id =#{userId}
+            and a.type =#{type}
+    </select>
 </mapper>
 </mapper>
 
 

+ 51 - 4
src/main/resources/mapper/modules/admin/SysUserMapper.xml

@@ -1366,7 +1366,6 @@
             <if test="vo.phoneNumber != null and vo.phoneNumber != ''">
             <if test="vo.phoneNumber != null and vo.phoneNumber != ''">
                 and su.mobile   =#{vo.phoneNumber}
                 and su.mobile   =#{vo.phoneNumber}
             </if>
             </if>
-
         </where>
         </where>
     </select>
     </select>
 
 
@@ -1413,9 +1412,57 @@
         LEFT JOIN sys_dept d ON u.dept_id = d.id
         LEFT JOIN sys_dept d ON u.dept_id = d.id
         WHERE
         WHERE
         d.management_source = '3'
         d.management_source = '3'
-        <if test="userId != null and userId != ''">
-            and u.id =#{userId}
-        </if>
     </select>
     </select>
 
 
+    <select id="queryQxFrontlineAgentList" resultType="com.ydtech.modules.admin.model.dto.QxFrontlineAgentDto">
+        SELECT
+        su.name as "name",
+        su.id  as "userId"
+        FROM
+        sys_user su
+        LEFT JOIN sys_dept sd ON sd.id = su.dept_id
+        <where>
+            su.id  LIKE '%M%'
+            and su.status = '1'
+            AND sd.management_source =2
+            <if test="vo.provinceId != null and vo.provinceId != ''">
+                and sd.id like  concat('%',#{vo.provinceId},'%')
+            </if>
+            <if test="vo.cityId != null and vo.cityId != ''">
+                and sd.id like concat('%',#{vo.cityId},'%')
+            </if>
+            <if test="vo.countyId != null and vo.countyId != ''">
+                and sd.id like concat('%',#{vo.countyId},'%')
+            </if>
+        </where>
+    </select>
+
+    <select id="findUserListByParam" resultType="com.ydtech.modules.admin.model.dto.QxFrontlineAgentDto">
+        SELECT
+        su.name as "name",
+        su.id  as "userId",
+        su.status as status
+        FROM
+        sys_user su
+        LEFT JOIN sys_dept sd ON sd.id = su.dept_id
+        LEFT JOIN  ins_upload_files   inf on  su.head_sculpture  =inf.id
+        LEFT JOIN sys_user_role sur ON sur.user_id = su.id
+        <where>
+            <if test="vo.ids  != null  and  vo.ids.size()>0 ">
+                AND su.id IN
+                <foreach item="item" collection="vo.ids" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="vo.name != null and vo.name != ''">
+                and su.name   =#{vo.name}
+            </if>
+            <if test="vo.userCode != null and vo.userCode != ''">
+                and su.id   =#{vo.userCode}
+            </if>
+            <if test="vo.phoneNumber != null and vo.phoneNumber != ''">
+                and su.mobile   =#{vo.phoneNumber}
+            </if>
+        </where>
+    </select>
 </mapper>
 </mapper>

+ 43 - 0
src/main/resources/mapper/modules/esm/EsmUserReferrerMapper.xml

@@ -376,4 +376,47 @@
             </if>
             </if>
         </where>
         </where>
     </select>
     </select>
+
+    <select id="getUserIdsByUserId" resultType="com.ydtech.modules.admin.model.dto.SysUserTeamDto">
+        with recursive t1 as (select *
+        from esm_user_referrer
+        WHERE referrer_id =#{userId}
+        and id !=#{userId}
+        union all
+        select r1.*
+        from esm_user_referrer r1
+        INNER JOIN t1 on t1.id = r1.referrer_id
+        )
+        select u.id as id , u.name as name , u.mobile as mobile, u.status as status
+        from t1
+        LEFT JOIN sys_user u on t1.id = u.id
+        WHERE  u.id is not  null
+    </select>
+
+
+    <select id="getByTeamByLevel" resultType="com.ydtech.modules.admin.model.dto.SysUserTeamDto">
+        with recursive t1 as (select *
+        from esm_user_referrer
+        WHERE referrer_id = #{userId}
+        and id !=#{userId}
+        union all
+        select r1.*
+        from esm_user_referrer r1
+        INNER JOIN t1 on t1.id = r1.referrer_id
+        <where>
+            <if test="level != null and level != ''">
+                r1.level = #{level}
+            </if>
+        </where>
+        )
+        select u.id as id , u.name as name , u.mobile as mobile, u.status as status
+        from t1
+        LEFT JOIN sys_user u on t1.id = u.id
+        <where>
+            u.id is not  null
+            <if test="status != null and status != ''">
+                AND u.status = #{status}
+            </if>
+        </where>
+    </select>
 </mapper>
 </mapper>

+ 175 - 0
src/main/resources/mapper/modules/fee/InsFeeOrderNewHistoryMapper.xml

@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ydtech.modules.fee.dao.InsFeeOrderNewHistoryMapper">
+
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.fee.entity.po.InsFeeOrderNewHistory">
+            <id property="id" column="id" jdbcType="VARCHAR"/>
+            <result property="insOrderNo" column="ins_order_no" jdbcType="VARCHAR"/>
+            <result property="agreementId" column="agreement_id" jdbcType="BIGINT"/>
+            <result property="costsId" column="costs_id" jdbcType="VARCHAR"/>
+            <result property="deptId" column="dept_id" jdbcType="VARCHAR"/>
+            <result property="userId" column="user_id" jdbcType="VARCHAR"/>
+            <result property="jqPremium" column="jq_premium" jdbcType="DECIMAL"/>
+            <result property="syPremium" column="sy_premium" jdbcType="DECIMAL"/>
+            <result property="noPremium" column="no_premium" jdbcType="DECIMAL"/>
+            <result property="jqNoTaxPremium" column="jq_no_tax_premium" jdbcType="DECIMAL"/>
+            <result property="syNoTaxPremium" column="sy_no_tax_premium" jdbcType="DECIMAL"/>
+            <result property="noNoTaxPremium" column="no_no_tax_premium" jdbcType="DECIMAL"/>
+            <result property="jqCostsProportion" column="jq_costs_proportion" jdbcType="DECIMAL"/>
+            <result property="jqCostsPremiums" column="jq_costs_premiums" jdbcType="DECIMAL"/>
+            <result property="syCostsProportion" column="sy_costs_proportion" jdbcType="DECIMAL"/>
+            <result property="syCostsPremiums" column="sy_costs_premiums" jdbcType="DECIMAL"/>
+            <result property="noCostsProportion" column="no_costs_proportion" jdbcType="DECIMAL"/>
+            <result property="noCostsPremiums" column="no_costs_premiums" jdbcType="DECIMAL"/>
+            <result property="jqSuperviseCostsProportion" column="jq_supervise_costs_proportion" jdbcType="DECIMAL"/>
+            <result property="jqSuperviseCostsPremiums" column="jq_supervise_costs_premiums" jdbcType="DECIMAL"/>
+            <result property="sySuperviseCostsProportion" column="sy_supervise_costs_proportion" jdbcType="DECIMAL"/>
+            <result property="sySuperviseCostsPremiums" column="sy_supervise_costs_premiums" jdbcType="DECIMAL"/>
+            <result property="noSuperviseCostsProportion" column="no_supervise_costs_proportion" jdbcType="DECIMAL"/>
+            <result property="noSuperviseCostsPremiums" column="no_supervise_costs_premiums" jdbcType="DECIMAL"/>
+            <result property="jqOtherCostsProportion" column="jq_other_costs_proportion" jdbcType="DECIMAL"/>
+            <result property="jqOtherCostsPremiums" column="jq_other_costs_premiums" jdbcType="DECIMAL"/>
+            <result property="syOtherCostsProportion" column="sy_other_costs_proportion" jdbcType="DECIMAL"/>
+            <result property="syOtherCostsPremiums" column="sy_other_costs_premiums" jdbcType="DECIMAL"/>
+            <result property="noOtherCostsProportion" column="no_other_costs_proportion" jdbcType="DECIMAL"/>
+            <result property="noOtherCostsPremiums" column="no_other_costs_premiums" jdbcType="DECIMAL"/>
+            <result property="jqInvestmentCostsProportion" column="jq_investment_costs_proportion" jdbcType="DECIMAL"/>
+            <result property="jqInvestmentCostsPremiums" column="jq_investment_costs_premiums" jdbcType="DECIMAL"/>
+            <result property="syInvestmentCostsProportion" column="sy_investment_costs_proportion" jdbcType="DECIMAL"/>
+            <result property="syInvestmentCostsPremiums" column="sy_investment_costs_premiums" jdbcType="DECIMAL"/>
+            <result property="jqDeptProportionLevel1" column="jq_dept_proportion_level_1" jdbcType="DECIMAL"/>
+            <result property="jqDeptPremiumsLevel1" column="jq_dept_premiums_level_1" jdbcType="DECIMAL"/>
+            <result property="syDeptProportionLevel1" column="sy_dept_proportion_level_1" jdbcType="DECIMAL"/>
+            <result property="syDeptPremiumsLevel1" column="sy_dept_premiums_level_1" jdbcType="DECIMAL"/>
+            <result property="noDeptProportionLevel1" column="no_dept_proportion_level_1" jdbcType="DECIMAL"/>
+            <result property="noDeptPremiumsLevel1" column="no_dept_premiums_level_1" jdbcType="DECIMAL"/>
+            <result property="jqDeptProportionLevel2" column="jq_dept_proportion_level_2" jdbcType="DECIMAL"/>
+            <result property="jqDeptPremiumsLevel2" column="jq_dept_premiums_level_2" jdbcType="DECIMAL"/>
+            <result property="syDeptProportionLevel2" column="sy_dept_proportion_level_2" jdbcType="DECIMAL"/>
+            <result property="syDeptPremiumsLevel2" column="sy_dept_premiums_level_2" jdbcType="DECIMAL"/>
+            <result property="noDeptProportionLevel2" column="no_dept_proportion_level_2" jdbcType="DECIMAL"/>
+            <result property="noDeptPremiumsLevel2" column="no_dept_premiums_level_2" jdbcType="DECIMAL"/>
+            <result property="jqDeptProportionLevel3" column="jq_dept_proportion_level_3" jdbcType="DECIMAL"/>
+            <result property="jqDeptPremiumsLevel3" column="jq_dept_premiums_level_3" jdbcType="DECIMAL"/>
+            <result property="syDeptProportionLevel3" column="sy_dept_proportion_level_3" jdbcType="DECIMAL"/>
+            <result property="syDeptPremiumsLevel3" column="sy_dept_premiums_level_3" jdbcType="DECIMAL"/>
+            <result property="noDeptProportionLevel3" column="no_dept_proportion_level_3" jdbcType="DECIMAL"/>
+            <result property="noDeptPremiumsLevel3" column="no_dept_premiums_level_3" jdbcType="DECIMAL"/>
+            <result property="jqDeptProportionLevel4" column="jq_dept_proportion_level_4" jdbcType="DECIMAL"/>
+            <result property="jqDeptPremiumsLevel4" column="jq_dept_premiums_level_4" jdbcType="DECIMAL"/>
+            <result property="syDeptProportionLevel4" column="sy_dept_proportion_level_4" jdbcType="DECIMAL"/>
+            <result property="syDeptPremiumsLevel4" column="sy_dept_premiums_level_4" jdbcType="DECIMAL"/>
+            <result property="noDeptProportionLevel4" column="no_dept_proportion_level_4" jdbcType="DECIMAL"/>
+            <result property="noDeptPremiumsLevel4" column="no_dept_premiums_level_4" jdbcType="DECIMAL"/>
+            <result property="jqDeptProportionLevel5" column="jq_dept_proportion_level_5" jdbcType="DECIMAL"/>
+            <result property="jqDeptPremiumsLevel5" column="jq_dept_premiums_level_5" jdbcType="DECIMAL"/>
+            <result property="syDeptProportionLevel5" column="sy_dept_proportion_level_5" jdbcType="DECIMAL"/>
+            <result property="syDeptPremiumsLevel5" column="sy_dept_premiums_level_5" jdbcType="DECIMAL"/>
+            <result property="noDeptProportionLevel5" column="no_dept_proportion_level_5" jdbcType="DECIMAL"/>
+            <result property="noDeptPremiumsLevel5" column="no_dept_premiums_level_5" jdbcType="DECIMAL"/>
+            <result property="jqCostsExportProportion" column="jq_costs_export_proportion" jdbcType="DECIMAL"/>
+            <result property="syCostsExportProportion" column="sy_costs_export_proportion" jdbcType="DECIMAL"/>
+            <result property="noCostsExportProportion" column="no_costs_export_proportion" jdbcType="DECIMAL"/>
+            <result property="jqExportInvestmentProportion" column="jq_export_investment_proportion" jdbcType="DECIMAL"/>
+            <result property="jqExportInvestmentPremiums" column="jq_export_investment_premiums" jdbcType="DECIMAL"/>
+            <result property="syExportInvestmentProportion" column="sy_export_investment_proportion" jdbcType="DECIMAL"/>
+            <result property="syExportInvestmentPremiums" column="sy_export_investment_premiums" jdbcType="DECIMAL"/>
+            <result property="firstDetailProportion" column="first_detail_proportion" jdbcType="DECIMAL"/>
+            <result property="firstDetailPremiums" column="first_detail_premiums" jdbcType="DECIMAL"/>
+            <result property="secondDetailProportion" column="second_detail_proportion" jdbcType="DECIMAL"/>
+            <result property="secondDetailPremiums" column="second_detail_premiums" jdbcType="DECIMAL"/>
+            <result property="thirdDetailProportion" column="third_detail_proportion" jdbcType="DECIMAL"/>
+            <result property="thirdDetailPremiums" column="third_detail_premiums" jdbcType="DECIMAL"/>
+            <result property="jqRetailProportionLevel1" column="jq_retail_proportion_level_1" jdbcType="DECIMAL"/>
+            <result property="jqRetailPremiumsLevel1" column="jq_retail_premiums_level_1" jdbcType="DECIMAL"/>
+            <result property="syRetailProportionLevel1" column="sy_retail_proportion_level_1" jdbcType="DECIMAL"/>
+            <result property="syRetailPremiumsLevel1" column="sy_retail_premiums_level_1" jdbcType="DECIMAL"/>
+            <result property="noRetailProportionLevel1" column="no_retail_proportion_level_1" jdbcType="DECIMAL"/>
+            <result property="noRetailPremiumsLevel1" column="no_retail_premiums_level_1" jdbcType="DECIMAL"/>
+            <result property="jqRetailProportionLevel2" column="jq_retail_proportion_level_2" jdbcType="DECIMAL"/>
+            <result property="jqRetailPremiumsLevel2" column="jq_retail_premiums_level_2" jdbcType="DECIMAL"/>
+            <result property="syRetailProportionLevel2" column="sy_retail_proportion_level_2" jdbcType="DECIMAL"/>
+            <result property="syRetailPremiumsLevel2" column="sy_retail_premiums_level_2" jdbcType="DECIMAL"/>
+            <result property="noRetailProportionLevel2" column="no_retail_proportion_level_2" jdbcType="DECIMAL"/>
+            <result property="noRetailPremiumsLevel2" column="no_retail_premiums_level_2" jdbcType="DECIMAL"/>
+            <result property="jqRetailProportionLevel3" column="jq_retail_proportion_level_3" jdbcType="DECIMAL"/>
+            <result property="jqRetailPremiumsLevel3" column="jq_retail_premiums_level_3" jdbcType="DECIMAL"/>
+            <result property="syRetailProportionLevel3" column="sy_retail_proportion_level_3" jdbcType="DECIMAL"/>
+            <result property="syRetailPremiumsLevel3" column="sy_retail_premiums_level_3" jdbcType="DECIMAL"/>
+            <result property="noRetailProportionLevel3" column="no_retail_proportion_level_3" jdbcType="DECIMAL"/>
+            <result property="noRetailPremiumsLevel3" column="no_retail_premiums_level_3" jdbcType="DECIMAL"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="firstLevelUserId" column="first_level_user_id" jdbcType="VARCHAR"/>
+            <result property="twoLevelUserId" column="two_level_user_id" jdbcType="VARCHAR"/>
+            <result property="threeLevelUserId" column="three_level_user_id" jdbcType="VARCHAR"/>
+            <result property="distributionStatus" column="distribution_status" jdbcType="VARCHAR"/>
+            <result property="deptDistribution" column="dept_distribution" jdbcType="DECIMAL"/>
+            <result property="jqExportSuperviseCostsPremiums" column="jq_export_supervise_costs_premiums" jdbcType="DECIMAL"/>
+            <result property="syExportSuperviseCostsPremiums" column="sy_export_supervise_costs_premiums" jdbcType="DECIMAL"/>
+            <result property="noExportSuperviseCostsPremiums" column="no_export_supervise_costs_premiums" jdbcType="DECIMAL"/>
+            <result property="jqExportOtherCostsProportion" column="jq_export_other_costs_proportion" jdbcType="DECIMAL"/>
+            <result property="syExportOtherCostsProportion" column="sy_export_other_costs_proportion" jdbcType="DECIMAL"/>
+            <result property="noExportOtherCostsProportion" column="no_export_other_costs_proportion" jdbcType="DECIMAL"/>
+            <result property="jqExportOtherCostsPremiums" column="jq_export_other_costs_premiums" jdbcType="DECIMAL"/>
+            <result property="syExportOtherCostsPremiums" column="sy_export_other_costs_premiums" jdbcType="DECIMAL"/>
+            <result property="noExportOtherCostsPremiums" column="no_export_other_costs_premiums" jdbcType="DECIMAL"/>
+            <result property="jqProfitMarginPremiums" column="jq_profit_margin_premiums" jdbcType="DECIMAL"/>
+            <result property="syProfitMarginPremiums" column="sy_profit_margin_premiums" jdbcType="DECIMAL"/>
+            <result property="noProfitMarginPremiums" column="no_profit_margin_premiums" jdbcType="DECIMAL"/>
+            <result property="jqExternalProportion" column="jq_external_proportion" jdbcType="DECIMAL"/>
+            <result property="syExternalProportion" column="sy_external_proportion" jdbcType="DECIMAL"/>
+            <result property="noExternalProportion" column="no_external_proportion" jdbcType="DECIMAL"/>
+            <result property="jqExternalPremiums" column="jq_external_premiums" jdbcType="DECIMAL"/>
+            <result property="syExternalPremiums" column="sy_external_premiums" jdbcType="DECIMAL"/>
+            <result property="noExternalPremiums" column="no_external_premiums" jdbcType="DECIMAL"/>
+            <result property="operatorId" column="operator_id" jdbcType="VARCHAR"/>
+            <result property="operatorTime" column="operator_time" jdbcType="DATE"/>
+            <result property="isFirst" column="is_first" jdbcType="TINYINT"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,ins_order_no,agreement_id,
+        costs_id,dept_id,user_id,
+        jq_premium,sy_premium,no_premium,
+        jq_no_tax_premium,sy_no_tax_premium,no_no_tax_premium,
+        jq_costs_proportion,jq_costs_premiums,sy_costs_proportion,
+        sy_costs_premiums,no_costs_proportion,no_costs_premiums,
+        jq_supervise_costs_proportion,jq_supervise_costs_premiums,sy_supervise_costs_proportion,
+        sy_supervise_costs_premiums,no_supervise_costs_proportion,no_supervise_costs_premiums,
+        jq_other_costs_proportion,jq_other_costs_premiums,sy_other_costs_proportion,
+        sy_other_costs_premiums,no_other_costs_proportion,no_other_costs_premiums,
+        jq_investment_costs_proportion,jq_investment_costs_premiums,sy_investment_costs_proportion,
+        sy_investment_costs_premiums,jq_dept_proportion_level_1,jq_dept_premiums_level_1,
+        sy_dept_proportion_level_1,sy_dept_premiums_level_1,no_dept_proportion_level_1,
+        no_dept_premiums_level_1,jq_dept_proportion_level_2,jq_dept_premiums_level_2,
+        sy_dept_proportion_level_2,sy_dept_premiums_level_2,no_dept_proportion_level_2,
+        no_dept_premiums_level_2,jq_dept_proportion_level_3,jq_dept_premiums_level_3,
+        sy_dept_proportion_level_3,sy_dept_premiums_level_3,no_dept_proportion_level_3,
+        no_dept_premiums_level_3,jq_dept_proportion_level_4,jq_dept_premiums_level_4,
+        sy_dept_proportion_level_4,sy_dept_premiums_level_4,no_dept_proportion_level_4,
+        no_dept_premiums_level_4,jq_dept_proportion_level_5,jq_dept_premiums_level_5,
+        sy_dept_proportion_level_5,sy_dept_premiums_level_5,no_dept_proportion_level_5,
+        no_dept_premiums_level_5,jq_costs_export_proportion,sy_costs_export_proportion,
+        no_costs_export_proportion,jq_export_investment_proportion,jq_export_investment_premiums,
+        sy_export_investment_proportion,sy_export_investment_premiums,first_detail_proportion,
+        first_detail_premiums,second_detail_proportion,second_detail_premiums,
+        third_detail_proportion,third_detail_premiums,jq_retail_proportion_level_1,
+        jq_retail_premiums_level_1,sy_retail_proportion_level_1,sy_retail_premiums_level_1,
+        no_retail_proportion_level_1,no_retail_premiums_level_1,jq_retail_proportion_level_2,
+        jq_retail_premiums_level_2,sy_retail_proportion_level_2,sy_retail_premiums_level_2,
+        no_retail_proportion_level_2,no_retail_premiums_level_2,jq_retail_proportion_level_3,
+        jq_retail_premiums_level_3,sy_retail_proportion_level_3,sy_retail_premiums_level_3,
+        no_retail_proportion_level_3,no_retail_premiums_level_3,create_time,
+        first_level_user_id,two_level_user_id,three_level_user_id,
+        distribution_status,dept_distribution,jq_export_supervise_costs_premiums,
+        sy_export_supervise_costs_premiums,no_export_supervise_costs_premiums,jq_export_other_costs_proportion,
+        sy_export_other_costs_proportion,no_export_other_costs_proportion,jq_export_other_costs_premiums,
+        sy_export_other_costs_premiums,no_export_other_costs_premiums,jq_profit_margin_premiums,
+        sy_profit_margin_premiums,no_profit_margin_premiums,jq_external_proportion,
+        sy_external_proportion,no_external_proportion,jq_external_premiums,
+        sy_external_premiums,no_external_premiums,operator_id,
+        operator_time,is_first
+    </sql>
+</mapper>

+ 27 - 0
src/main/resources/mapper/modules/order/InsAreaCompanyErrorMapper.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ydtech.modules.order.dao.InsAreaCompanyErrorMapper">
+
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.order.entity.po.InsAreaCompanyError">
+            <id property="id" column="id" jdbcType="VARCHAR"/>
+            <result property="orderno" column="orderno" jdbcType="VARCHAR"/>
+            <result property="agreementId" column="agreement_id" jdbcType="VARCHAR"/>
+            <result property="companyId" column="company_id" jdbcType="VARCHAR"/>
+            <result property="companyName" column="company_name" jdbcType="VARCHAR"/>
+            <result property="partnerCompaniesId" column="partner_companies_id" jdbcType="VARCHAR"/>
+            <result property="partnerCompaniesName" column="partner_companies_name" jdbcType="VARCHAR"/>
+            <result property="errorMsg" column="error_msg" jdbcType="VARCHAR"/>
+            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+            <result property="userId" column="user_id" jdbcType="VARCHAR"/>
+            <result property="deptId" column="dept_id" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id,orderno,agreement_id,
+        company_id,company_name,partner_companies_id,
+        partner_companies_name,error_msg,create_time,
+        user_id,dept_id
+    </sql>
+</mapper>

+ 404 - 56
src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

@@ -846,41 +846,107 @@
     <select id="queryCompanyQutationCountDataPage"
     <select id="queryCompanyQutationCountDataPage"
             resultType="com.ydtech.modules.admin.model.report.company.CompanyQutationCountDataDto">
             resultType="com.ydtech.modules.admin.model.report.company.CompanyQutationCountDataDto">
         SELECT
         SELECT
-            agree.insurance_company_id AS companyId,
-            agree.insurance_company AS companyName,
-            agree.partner_companies_id AS parterCompanyId,
-            ins.NAME AS parterCompanyName,
-            count(iac.orderstatus) AS qutationCount,
-            COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) AS underwritingCount,
-            COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) AS qutationInsureCount,
-            COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END )/ count(iac.orderstatus) AS passRate,
-            COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END )/ count(iac.orderstatus) AS closeRate,
-            COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END )/ COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) AS contributionRate
+        a.* ,
+        (select ins.namesimple from esm_ins_company
+        ins where a.parterCompanyId = ins.id) as "parterCompanyName"
         FROM
         FROM
-            ins_area_company iac
-                LEFT JOIN ptl_agreement agree ON iac.agreement_id = agree.id
-                LEFT JOIN esm_ins_company ins ON agree.partner_companies_id = ins.id
-                LEFT JOIN ins_orders io on iac.orderno = io.orderno
-                LEFT JOIN sys_dept sd on sd.id = io.deptid
+        (
+        SELECT
+        count(agree.partner_companies_id) as "orderSuccessNumber",
+        agree.insurance_company AS companyName,
+        agree.partner_companies_id AS parterCompanyId,
+        iac.company_id as "companId",
+        count( iac.orderstatus ) AS qutationCount,
+        count( iac.id ) AS orderSuccessNumberRate,
+        COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) AS underwritingCount,
+        COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) AS qutationInsureCount,
+        COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END )/ count( iac.orderstatus ) AS passRate,
+        COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END )/ count( iac.orderstatus ) AS closeRate,
+        COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END )/ count( iac.orderstatus ) AS contributionRate,
+        COUNT(CASE WHEN  agree.audit_type =1 and ifa.auditstatus =1 and iac.orderstatus =3 THEN 1 END) as "numberManual"
+        FROM
+        ins_area_company iac
+        LEFT JOIN ptl_agreement agree ON iac.agreement_id = agree.id
+        LEFT JOIN ins_orders io ON iac.orderno = io.orderno
+        LEFT JOIN sys_dept sd ON sd.id = io.deptid
+        LEFT JOIN ins_fee_audit ifa  on ifa.ins_order_no =iac.id
         WHERE
         WHERE
-            agree.id IS NOT NULL
-            <if test="vo.companyId  != null  and  vo.companyId!='' ">
-                agree.insurance_company_id = #{vo.companyId}
-            </if>
-            <if test="vo.parterCompanyId  != null  and  vo.parterCompanyId!='' ">
-                agree.partner_companies_id = #{vo.parterCompanyId}
-            </if>
-            <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
-                AND  iac.signing_time  BETWEEN #{vo.beginDate} AND #{vo.endDate}
-            </if>
-            <if test="vo.managementSource  != null  and  vo.managementSource!=''">
-                AND  sd.management_source  =#{vo.managementSource}
-            </if>
+        agree.id IS NOT NULL
+        <if test="vo.companyId  != null  and  vo.companyId!='' ">
+            AND agree.insurance_company_id = #{vo.companyId}
+        </if>
+        <if test="vo.parterCompanyId  != null  and  vo.parterCompanyId!='' ">
+            AND agree.partner_companies_id = #{vo.parterCompanyId}
+        </if>
+        <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+            AND iac.createtime BETWEEN #{vo.beginDate} AND #{vo.endDate}
+        </if>
+        <if test="vo.managementSource  != null  and  vo.managementSource!=''">
+            AND sd.management_source =#{vo.managementSource}
+        </if>
         GROUP BY
         GROUP BY
-            agree.insurance_company_id,
-            agree.insurance_company,
-            agree.partner_companies_id,
-            ins.NAME
+        agree.insurance_company,
+        iac.company_id,
+        agree.partner_companies_id
+        ) a
+    </select>
+
+    <select id="getInsAreaCompanyError"
+            resultType="com.ydtech.modules.admin.model.report.company.CompanyQutationCountDataDto">
+        SELECT
+        count(iace.id) as "areaCompanyErrNumber"
+        FROM
+        ins_area_company_error iace
+        LEFT JOIN ins_orders io ON iace.orderno = io.orderno
+        LEFT JOIN sys_dept sd ON sd.id = io.deptid
+        LEFT JOIN ptl_agreement agree ON iace.agreement_id = agree.id
+
+        WHERE
+        agree.id IS NOT NULL
+        <if test="vo.companyId  != null  and  vo.companyId!='' ">
+            AND agree.insurance_company_id = #{vo.companyId}
+        </if>
+        <if test="vo.parterCompanyId  != null  and  vo.parterCompanyId!='' ">
+            AND agree.partner_companies_id = #{vo.parterCompanyId}
+        </if>
+        <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+            AND iace.create_time BETWEEN #{vo.beginDate} AND #{vo.endDate}
+        </if>
+        <if test="vo.managementSource  != null  and  vo.managementSource!=''">
+            AND sd.management_source =#{vo.managementSource}
+        </if>
+    </select>
+
+    <select id="queryCompanyQutationCountDataPageTotal"
+            resultType="java.lang.Long">
+        SELECT
+        count(0)
+        FROM
+        (
+        SELECT
+        agree.partner_companies_id
+        FROM
+        ins_area_company iac
+        LEFT JOIN ptl_agreement agree ON iac.agreement_id = agree.id
+        LEFT JOIN ins_orders io ON iac.orderno = io.orderno
+        LEFT JOIN sys_dept sd ON sd.id = io.deptid
+        WHERE
+        agree.id IS NOT NULL
+        <if test="vo.companyId  != null  and  vo.companyId!='' ">
+            AND  agree.insurance_company_id = #{vo.companyId}
+        </if>
+        <if test="vo.parterCompanyId  != null  and  vo.parterCompanyId!='' ">
+            AND agree.partner_companies_id = #{vo.parterCompanyId}
+        </if>
+        <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+            AND  iac.createtime  BETWEEN #{vo.beginDate} AND #{vo.endDate}
+        </if>
+        <if test="vo.managementSource  != null  and  vo.managementSource!=''">
+            AND  sd.management_source  =#{vo.managementSource}
+        </if>
+        GROUP BY
+        agree.partner_companies_id
+        ) a
     </select>
     </select>
 
 
     <select id="getStageOrder" resultType="com.ydtech.modules.order.entity.InsAreaCompany">
     <select id="getStageOrder" resultType="com.ydtech.modules.order.entity.InsAreaCompany">
@@ -926,7 +992,7 @@
         COUNT( CASE WHEN iac.orderstatus = 4 THEN 1 END ) AS underwritingReturn,
         COUNT( CASE WHEN iac.orderstatus = 4 THEN 1 END ) AS underwritingReturn,
         COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS "passingRate",
         COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS "passingRate",
         COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS "closeRate",
         COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS "closeRate",
-        COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) AS "contributionRate",
+        COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) / COUNT( iac.orderstatus ) AS "contributionRate",
         COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) / COUNT( iac.orderstatus ) AS "quotationRate",
         COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) / COUNT( iac.orderstatus ) AS "quotationRate",
         COUNT( CASE WHEN ifa.auditstatus = '0' THEN 1 END ) AS "auditOrder"
         COUNT( CASE WHEN ifa.auditstatus = '0' THEN 1 END ) AS "auditOrder"
         FROM
         FROM
@@ -953,10 +1019,10 @@
                 AND   DATE_FORMAT( io.createtime, '%Y-%m-%d')   BETWEEN #{taskStatisticsVo.createtimeStart} AND #{taskStatisticsVo.createtimeEnd}
                 AND   DATE_FORMAT( io.createtime, '%Y-%m-%d')   BETWEEN #{taskStatisticsVo.createtimeStart} AND #{taskStatisticsVo.createtimeEnd}
             </if>
             </if>
             <if test="taskStatisticsVo.beginDate !=null and taskStatisticsVo.beginDate != '' and taskStatisticsVo.endDate !=null and taskStatisticsVo.endDate != ''">
             <if test="taskStatisticsVo.beginDate !=null and taskStatisticsVo.beginDate != '' and taskStatisticsVo.endDate !=null and taskStatisticsVo.endDate != ''">
-                AND   DATE_FORMAT( iac.signing_time, '%Y-%m-%d')   BETWEEN #{taskStatisticsVo.beginDate} AND #{taskStatisticsVo.endDate}
+                AND   DATE_FORMAT( iac.createtime, '%Y-%m-%d')   BETWEEN  DATE_FORMAT( #{taskStatisticsVo.beginDate}, '%Y-%m-%d') AND  DATE_FORMAT( #{taskStatisticsVo.endDate}, '%Y-%m-%d')
             </if>
             </if>
             <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
             <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
-                and iac.signing_time >= DATE_SUB(NOW(), INTERVAL #{taskStatisticsVo.days} DAY)
+                and iac.createtime >= DATE_SUB(NOW(), INTERVAL #{taskStatisticsVo.days} DAY)
             </if>
             </if>
 
 
             <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
             <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
@@ -1047,9 +1113,9 @@
         COUNT( CASE WHEN iac.orderstatus = 4 THEN 1 END ) AS underwritingReturn,
         COUNT( CASE WHEN iac.orderstatus = 4 THEN 1 END ) AS underwritingReturn,
         COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS "passingRate",
         COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS "passingRate",
         COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS "closeRate",
         COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) AS "closeRate",
-        COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) / COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) AS "contributionRate",
+        COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) / COUNT( iac.orderstatus ) AS "contributionRate",
         COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) / COUNT( iac.orderstatus ) AS "quotationRate",
         COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) / COUNT( iac.orderstatus ) AS "quotationRate",
-        COUNT( CASE WHEN ifa.auditstatus = '0' THEN 1 END ) AS "auditOrder"
+        COUNT( CASE WHEN iac.orderstatus = 1 THEN 1 END ) AS "auditOrder"
         FROM
         FROM
         ins_area_company iac
         ins_area_company iac
         LEFT JOIN ins_fee_audit ifa ON ifa.ins_order_no = iac.id
         LEFT JOIN ins_fee_audit ifa ON ifa.ins_order_no = iac.id
@@ -1072,11 +1138,15 @@
                 AND   DATE_FORMAT( io.createtime, '%Y-%m-%d')   BETWEEN #{taskStatisticsVo.createtimeStart} AND #{taskStatisticsVo.createtimeEnd}
                 AND   DATE_FORMAT( io.createtime, '%Y-%m-%d')   BETWEEN #{taskStatisticsVo.createtimeStart} AND #{taskStatisticsVo.createtimeEnd}
             </if>
             </if>
             <if test="taskStatisticsVo.beginDate !=null and taskStatisticsVo.beginDate != '' and taskStatisticsVo.endDate !=null and taskStatisticsVo.endDate != ''">
             <if test="taskStatisticsVo.beginDate !=null and taskStatisticsVo.beginDate != '' and taskStatisticsVo.endDate !=null and taskStatisticsVo.endDate != ''">
-                AND   DATE_FORMAT( iac.signing_time, '%Y-%m-%d')   BETWEEN #{taskStatisticsVo.beginDate} AND #{taskStatisticsVo.endDate}
+                AND   DATE_FORMAT( iac.createtime, '%Y-%m-%d')   BETWEEN DATE_FORMAT( #{taskStatisticsVo.beginDate}, '%Y-%m-%d')  AND DATE_FORMAT( #{taskStatisticsVo.endDate}, '%Y-%m-%d')
+            </if>
+
+            <if test="taskStatisticsVo.companyId !=null and taskStatisticsVo.companyId != ''">
+                AND  iac.company_id =#{taskStatisticsVo.companyId}
             </if>
             </if>
 
 
             <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
             <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
-                and iac.signing_time >= DATE_SUB(NOW(), INTERVAL #{taskStatisticsVo.days} DAY)
+                and iac.createtime >= DATE_SUB(NOW(), INTERVAL #{taskStatisticsVo.days} DAY)
             </if>
             </if>
         </where>
         </where>
         GROUP BY
         GROUP BY
@@ -1113,14 +1183,14 @@
                 and io.deptid like "${taskStatisticsVo.houseId}%"
                 and io.deptid like "${taskStatisticsVo.houseId}%"
             </if>
             </if>
             <if test="taskStatisticsVo.createtimeStart !=null and taskStatisticsVo.createtimeStart != '' and taskStatisticsVo.createtimeEnd !=null and taskStatisticsVo.createtimeEnd != ''">
             <if test="taskStatisticsVo.createtimeStart !=null and taskStatisticsVo.createtimeStart != '' and taskStatisticsVo.createtimeEnd !=null and taskStatisticsVo.createtimeEnd != ''">
-                AND   DATE_FORMAT( io.createtime, '%Y-%m-%d')   BETWEEN #{taskStatisticsVo.createtimeStart} AND #{taskStatisticsVo.createtimeEnd}
+                AND   io.createtime   BETWEEN #{taskStatisticsVo.createtimeStart} AND #{taskStatisticsVo.createtimeEnd}
             </if>
             </if>
             <if test="taskStatisticsVo.beginDate !=null and taskStatisticsVo.beginDate != '' and taskStatisticsVo.endDate !=null and taskStatisticsVo.endDate != ''">
             <if test="taskStatisticsVo.beginDate !=null and taskStatisticsVo.beginDate != '' and taskStatisticsVo.endDate !=null and taskStatisticsVo.endDate != ''">
-                AND   DATE_FORMAT( iac.signing_time, '%Y-%m-%d')   BETWEEN #{taskStatisticsVo.beginDate} AND #{taskStatisticsVo.endDate}
+                AND   iac.createtime   BETWEEN #{taskStatisticsVo.beginDate} AND #{taskStatisticsVo.endDate}
             </if>
             </if>
 
 
             <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
             <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
-                and iac.signing_time >= DATE_SUB(NOW(), INTERVAL #{taskStatisticsVo.days} DAY)
+                and iac.createtime >= DATE_SUB(NOW(), INTERVAL #{taskStatisticsVo.days} DAY)
             </if>
             </if>
         </where>
         </where>
         GROUP BY
         GROUP BY
@@ -1140,7 +1210,7 @@
         COUNT( CASE WHEN iac.orderstatus = 4 THEN 1 END ) AS underwritingReturn,
         COUNT( CASE WHEN iac.orderstatus = 4 THEN 1 END ) AS underwritingReturn,
         COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END )  /  COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) as "passingRate",
         COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END )  /  COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END ) as "passingRate",
         COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END )  /  COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END )  as "closeRate",
         COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END )  /  COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END )  as "closeRate",
-        COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END )  /  COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END )  as  "contributionRate",
+        COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END )  /  COUNT(iac.orderstatus)  as  "contributionRate",
         COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END )  /  COUNT(iac.orderstatus)  as "quotationRate",
         COUNT( CASE WHEN iac.orderstatus = 0 THEN 1 END )  /  COUNT(iac.orderstatus)  as "quotationRate",
         COUNT( CASE WHEN ifa.auditstatus = '0' THEN 1 END  )   as  "auditOrder"
         COUNT( CASE WHEN ifa.auditstatus = '0' THEN 1 END  )   as  "auditOrder"
         FROM
         FROM
@@ -1169,11 +1239,11 @@
             </if>
             </if>
 
 
             <if test="taskStatisticsVo.beginDate !=null and taskStatisticsVo.beginDate != '' and taskStatisticsVo.endDate !=null and taskStatisticsVo.endDate != ''">
             <if test="taskStatisticsVo.beginDate !=null and taskStatisticsVo.beginDate != '' and taskStatisticsVo.endDate !=null and taskStatisticsVo.endDate != ''">
-                AND   DATE_FORMAT( iac.signing_time, '%Y-%m-%d')   BETWEEN #{taskStatisticsVo.beginDate} AND #{taskStatisticsVo.endDate}
+                AND   DATE_FORMAT( iac.createtime, '%Y-%m-%d')   BETWEEN DATE_FORMAT( #{taskStatisticsVo.beginDate}, '%Y-%m-%d')  AND DATE_FORMAT( #{taskStatisticsVo.endDate}, '%Y-%m-%d')
             </if>
             </if>
 
 
             <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
             <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
-                and iac.signing_time >= DATE_SUB(NOW(), INTERVAL #{taskStatisticsVo.days} DAY)
+                and iac.createtime >= DATE_SUB(NOW(), INTERVAL #{taskStatisticsVo.days} DAY)
             </if>
             </if>
 
 
             <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
             <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
@@ -1195,6 +1265,63 @@
         GROUP BY io.userid , su.name, sd.id , sd.name
         GROUP BY io.userid , su.name, sd.id , sd.name
     </select>
     </select>
 
 
+
+    <select id="agentStatisticsQueryPageTotal"  resultType="java.lang.Long">
+       select  count(0)  from  (
+        SELECT
+        io.userid as "userId"
+        FROM
+        ins_area_company iac
+        left  join   ins_orders  io  on  io.orderno  = iac.orderno
+        left  join   sys_dept sd  on sd.id=io.deptid
+        <where>
+            sd.management_source = '2'
+            <if test="taskStatisticsVo.provinceId != null and taskStatisticsVo.provinceId != ''">
+                and io.deptid like "${taskStatisticsVo.provinceId}%"
+            </if>
+            <if test="taskStatisticsVo.cityId != null and taskStatisticsVo.cityId != ''">
+                and io.deptid like "${taskStatisticsVo.cityId}%"
+            </if>
+            <if test="taskStatisticsVo.countyId != null and taskStatisticsVo.countyId != ''">
+                and io.deptid like "${taskStatisticsVo.countyId}%"
+            </if>
+            <if test="taskStatisticsVo.houseId != null and taskStatisticsVo.houseId != ''">
+                and io.deptid like "${taskStatisticsVo.houseId}%"
+            </if>
+
+            <if test="taskStatisticsVo.createtimeStart !=null and taskStatisticsVo.createtimeStart != '' and taskStatisticsVo.createtimeEnd !=null and taskStatisticsVo.createtimeEnd != ''">
+                AND   DATE_FORMAT( io.createtime, '%Y-%m-%d')   BETWEEN #{taskStatisticsVo.createtimeStart} AND #{taskStatisticsVo.createtimeEnd}
+            </if>
+
+            <if test="taskStatisticsVo.beginDate !=null and taskStatisticsVo.beginDate != '' and taskStatisticsVo.endDate !=null and taskStatisticsVo.endDate != ''">
+                AND   DATE_FORMAT( iac.createtime, '%Y-%m-%d')   BETWEEN DATE_FORMAT( #{taskStatisticsVo.beginDate}, '%Y-%m-%d')  AND DATE_FORMAT( #{taskStatisticsVo.endDate}, '%Y-%m-%d')
+            </if>
+
+            <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
+                and iac.createtime >= DATE_SUB(NOW(), INTERVAL #{taskStatisticsVo.days} DAY)
+            </if>
+
+            <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
+                <choose>
+                    <when test="taskStatisticsVo.days =='1'">
+                        and io.createtime >= DATE_SUB(NOW(), INTERVAL 1 DAY)
+                    </when>
+
+                    <when test="taskStatisticsVo.days =='7'">
+                        and io.createtime >= DATE_SUB(NOW(), INTERVAL 7 DAY)
+                    </when>
+
+                    <when test="taskStatisticsVo.days =='30'">
+                        and io.createtime >= DATE_SUB(NOW(), INTERVAL 30 DAY)
+                    </when>
+                </choose>
+            </if>
+        </where>
+        GROUP BY io.userid
+        ) a
+    </select>
+
+
     <select id="costCenter" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
     <select id="costCenter" resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
         SELECT
         SELECT
             iac.company_id,
             iac.company_id,
@@ -1215,11 +1342,11 @@
             </if>
             </if>
 
 
             <if test="taskStatisticsVo.beginDate !=null and taskStatisticsVo.beginDate != '' and taskStatisticsVo.endDate !=null and taskStatisticsVo.endDate != ''">
             <if test="taskStatisticsVo.beginDate !=null and taskStatisticsVo.beginDate != '' and taskStatisticsVo.endDate !=null and taskStatisticsVo.endDate != ''">
-                AND   DATE_FORMAT( iac.signing_time, '%Y-%m-%d')   BETWEEN #{taskStatisticsVo.beginDate} AND #{taskStatisticsVo.endDate}
+                AND   DATE_FORMAT( iac.signing_time, '%Y-%m-%d')   BETWEEN  DATE_FORMAT( #{taskStatisticsVo.beginDate}, '%Y-%m-%d')   AND  DATE_FORMAT( #{taskStatisticsVo.endDate}, '%Y-%m-%d')
             </if>
             </if>
 
 
             <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
             <if test="taskStatisticsVo.days !=null  and taskStatisticsVo.days !='' ">
-                and iac.signing_time >= DATE_SUB(NOW(), INTERVAL #{taskStatisticsVo.days} DAY)
+                and iac.createtime >= DATE_SUB(NOW(), INTERVAL #{taskStatisticsVo.days} DAY)
             </if>
             </if>
 
 
             <choose>
             <choose>
@@ -1268,15 +1395,16 @@
     <select id="getOrderManpowerNew" resultType="com.ydtech.modules.admin.model.dto.QxFrontlineAgentDto">
     <select id="getOrderManpowerNew" resultType="com.ydtech.modules.admin.model.dto.QxFrontlineAgentDto">
         SELECT
         SELECT
         count( a.numberUserId ) as "orderManpower",
         count( a.numberUserId ) as "orderManpower",
-        sum( a.orderAmount ) as "totalPremium",
-        TRIM(TRAILING '0' FROM sum( a.orderAmount )/ count( a.numberUserId )) AS "averagePremium"
+        IFNULL(sum( a.orderAmount ),0) as "totalPremium",
+        ROUND(sum( a.orderAmount )/ count( a.numberUserId ),2) AS "averagePremium"
         FROM
         FROM
         (
         (
         SELECT
         SELECT
         count( io.userid ) AS "numberUserId",
         count( io.userid ) AS "numberUserId",
-        SUM(IFNULL(iac.jqpremium, 0)) +
-        SUM(IFNULL(iac.sypremium, 0)) +
-        SUM(IFNULL(iac.jypremium, 0)) AS "orderAmount"
+        SUM(IFNULL(iac.jqpremium, 0)
+        +IFNULL(iac.sypremium, 0)
+        +IFNULL(iac.jypremium, 0)
+        )  AS "orderAmount"
         FROM
         FROM
         `ins_area_company` iac
         `ins_area_company` iac
         LEFT JOIN ins_orders io ON io.orderno = iac.orderno
         LEFT JOIN ins_orders io ON io.orderno = iac.orderno
@@ -1289,7 +1417,7 @@
                 </foreach>
                 </foreach>
             </if>
             </if>
             <if test="vo.createtimeStart  != null  and  vo.createtimeStart!=''  and vo.createtimeEnd  != null  and  vo.createtimeEnd!=''">
             <if test="vo.createtimeStart  != null  and  vo.createtimeStart!=''  and vo.createtimeEnd  != null  and  vo.createtimeEnd!=''">
-                AND iac.signing_time BETWEEN #{vo.createtimeStart} AND #{vo.createtimeEnd}
+                AND iac.createtime BETWEEN #{vo.createtimeStart} AND #{vo.createtimeEnd}
             </if>
             </if>
         </where>
         </where>
         GROUP BY
         GROUP BY
@@ -1299,12 +1427,58 @@
     </select>
     </select>
 
 
 
 
+    <select id="getChannelOrderManpowerNew" resultType="com.ydtech.modules.admin.model.dto.QxFrontlineAgentDto">
+        SELECT
+        a.userId as "userId",
+        a.orderNumber as "orderNumber",
+        a.underwritingCount as "underwritingCount",
+        a.qutationInsureCount as "qutationInsureCount",
+        IFNULL(a.jqpremium,0) + IFNULL(a.sypremium,0) + IFNULL(a.jypremium,0) as "totalPremium",
+        a.isFactorVerify as "isFactorVerify",
+        a.isNotFactorVerify as "isNotFactorVerify"
+        FROM
+        (
+        SELECT
+        io.userid as "userId",
+        count( iac.orderno ) AS "orderNumber",
+        sum(CASE WHEN iac.orderstatus = 3 THEN iac.jqpremium END  ) AS jqpremium,
+        sum(CASE WHEN iac.orderstatus = 3 THEN iac.sypremium END )  AS sypremium,
+        sum(CASE WHEN iac.orderstatus = 3 THEN iac.jypremium END )  AS jypremium,
+        COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) AS underwritingCount,
+        COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) AS qutationInsureCount,
+        COUNT( CASE WHEN su.factor_verify = 1 THEN 1 END ) AS isFactorVerify,
+        COUNT( CASE WHEN su.factor_verify = 0 THEN 1 END ) AS isNotFactorVerify
+        FROM
+        `ins_area_company` iac
+        LEFT JOIN ins_orders io ON io.orderno = iac.orderno
+        left join sys_user su  on su.id=io.userid
+        <where>
+            <if test="vo.ids  != null  and  vo.ids.size()>0 ">
+                AND io.userid IN
+                <foreach item="item"  collection="vo.ids" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="vo.createtimeStart  != null  and  vo.createtimeStart!=''  and vo.createtimeEnd  != null  and  vo.createtimeEnd!=''">
+                AND iac.createtime BETWEEN #{vo.createtimeStart} AND #{vo.createtimeEnd}
+            </if>
+        <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                AND iac.createtime BETWEEN #{vo.beginDate} AND #{vo.endDate}
+            </if>
+        </where>
+        GROUP BY
+        io.userid
+        ) a
+        left join sys_user su  on su.id=a.userId
+    </select>
+
+
     <select id="NumberQuotations"  resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
     <select id="NumberQuotations"  resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
         SELECT
         SELECT
         count(iac.id) as "orderNumber",
         count(iac.id) as "orderNumber",
         COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) AS underwritingCount,
         COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) AS underwritingCount,
         COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) AS qutationInsureCount,
         COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) AS qutationInsureCount,
-        sum( CASE WHEN iac.orderstatus = 3 THEN iac.sumpremium END ) AS totalPremium
+        sum( CASE WHEN iac.orderstatus = 3 THEN IFNULL(iac.jqpremium, 0) + IFNULL(iac.sypremium, 0) + IFNULL(iac.jypremium, 0) END ) AS totalPremium
         FROM
         FROM
         ins_area_company iac
         ins_area_company iac
         left  join   ins_orders  io  on  io.orderno  = iac.orderno
         left  join   ins_orders  io  on  io.orderno  = iac.orderno
@@ -1410,10 +1584,10 @@
             and agree.partner_companies_id = #{vo.parterCompanyId}
             and agree.partner_companies_id = #{vo.parterCompanyId}
         </if>
         </if>
         <if test="vo.createtimeStart  != null  and  vo.createtimeStart!=''  and vo.createtimeEnd  != null  and  vo.createtimeEnd!=''">
         <if test="vo.createtimeStart  != null  and  vo.createtimeStart!=''  and vo.createtimeEnd  != null  and  vo.createtimeEnd!=''">
-            AND iac.signing_time BETWEEN #{vo.createtimeStart} AND #{vo.createtimeStart}
+            AND   DATE_FORMAT( iac.createtime, '%Y-%m-%d')   BETWEEN DATE_FORMAT( #{vo.createtimeStart}, '%Y-%m-%d')  AND DATE_FORMAT( #{vo.createtimeEnd}, '%Y-%m-%d')
         </if>
         </if>
         <if test="vo.days !=null  and vo.days !='' ">
         <if test="vo.days !=null  and vo.days !='' ">
-            and iac.signing_time >= DATE_SUB(NOW(), INTERVAL #{vo.days} DAY)
+            and iac.createtime >= DATE_SUB(NOW(), INTERVAL #{vo.days} DAY)
         </if>
         </if>
         <if test="vo.provinceId != null and vo.provinceId != ''">
         <if test="vo.provinceId != null and vo.provinceId != ''">
             and io.deptid like "${vo.provinceId}%"
             and io.deptid like "${vo.provinceId}%"
@@ -1498,4 +1672,178 @@
         agree.partner_companies_id,
         agree.partner_companies_id,
         ins.namesimple
         ins.namesimple
     </select>
     </select>
+
+    <select id="getOrderPremiumByUserIds" resultType="Double">
+        SELECT
+        IFNULL(
+        SUM( IFNULL( iac.jqpremium, 0 ) + IFNULL( iac.sypremium, 0 ) + IFNULL( iac.jypremium, 0 ) ),
+        0
+        ) AS "totalPremium"
+        FROM
+        `ins_area_company` iac
+        LEFT JOIN ins_orders io ON io.orderno = iac.orderno
+        <where>
+            iac.orderstatus = '3'
+            <if test="ids  != null  and  ids.size()>0 ">
+                AND io.userid IN
+                <foreach item="item"  collection="ids" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+    </select>
+    <select id="querOrdersDataPage"  resultType="com.ydtech.modules.admin.model.report.company.OrdersDataDto">
+        SELECT
+            io.licenseno AS "licenseno",
+            io.frameno AS "frameno",
+            pa.partner_companies_id  as 'partnerCompaniesId',
+            count(io.orderno) as "orderNumber",
+            eic.namesimple as "namesimple",
+            IFNULL(count(CASE WHEN iac.orderstatus = '3' THEN 1 ELSE 0 END),0) / (IFNULL(count(CASE WHEN iac.orderstatus = '2' THEN 1 ELSE 0 END),0) +  IFNULL(count(CASE WHEN iac.orderstatus = '3' THEN 1 ELSE 0 END),0))  AS "closeRate"
+        FROM
+        ins_area_company iac
+                LEFT JOIN ins_orders io ON iac.orderno = io.orderno
+                LEFT JOIN ptl_agreement pa ON pa.id = iac.agreement_id
+                LEFT JOIN esm_ins_company eic ON eic.id = pa.insurance_company_id
+                LEFT JOIN sys_user  su  on io.userid=su.id
+        <where>
+            1=1
+            <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                AND io.createtime BETWEEN #{vo.beginDate} AND #{vo.endDate}
+            </if>
+
+            <if test="vo.licenseno  != null  and  vo.licenseno!=''  ">
+                AND io.licenseno =#{vo.licenseno}
+            </if>
+
+            <if test="vo.userId  != null  and  vo.userId!=''  ">
+                AND io.userId =#{vo.userId}
+            </if>
+
+            <if test="vo.userName  != null  and  vo.userName!=''  ">
+                AND su.name =#{vo.userName}
+            </if>
+
+            <if test="vo.mobile  != null  and  vo.mobile!=''  ">
+                AND su.mobile =#{vo.mobile}
+            </if>
+
+            <if test="vo.frameno  != null  and  vo.frameno!=''  ">
+                AND su.frameno =#{vo.frameno}
+            </if>
+            <if test="vo.deptId  != null  and  vo.deptId!=''  ">
+                and io.deptid like concat('%', #{vo.deptId}, '%')
+            </if>
+        </where>
+        GROUP BY
+            io.licenseno,
+            io.frameno,
+            pa.partner_companies_id,
+            eic.namesimple
+
+    </select>
+    <select id="querOrdersamountTo" resultType="com.ydtech.modules.admin.model.report.company.OrdersDataDto">
+       select count(a.frameno)   as "frameno" from  (
+
+        SELECT
+        io.frameno AS "frameno"
+        FROM
+        ins_orders io
+        LEFT JOIN ins_area_company iac ON iac.orderno = io.orderno
+        LEFT JOIN sys_user su ON io.userid = su.id
+        <where>
+            1=1
+            <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                AND io.createtime BETWEEN #{vo.beginDate} AND #{vo.endDate}
+            </if>
+
+            <if test="vo.licenseno  != null  and  vo.licenseno!=''  ">
+                AND io.licenseno =#{vo.licenseno}
+            </if>
+
+            <if test="vo.userId  != null  and  vo.userId!=''  ">
+                AND io.userId =#{vo.userId}
+            </if>
+
+            <if test="vo.userName  != null  and  vo.userName!=''  ">
+                AND su.name =#{vo.userName}
+            </if>
+
+            <if test="vo.mobile  != null  and  vo.mobile!=''  ">
+                AND su.mobile =#{vo.mobile}
+            </if>
+
+            <if test="vo.frameno  != null  and  vo.frameno!=''  ">
+                AND su.frameno =#{vo.frameno}
+            </if>
+            <if test="vo.deptId  != null  and  vo.deptId!=''  ">
+                and io.deptid like concat('%', #{vo.deptId}, '%')
+            </if>
+
+        </where>
+        GROUP BY
+        io.frameno
+                       ) a
+    </select>
+
+    <select id="querResultOrderNumber" resultType="com.ydtech.modules.admin.model.report.company.OrdersDataDto">
+        SELECT
+            count( io.orderno ) AS "orderNumber",
+        IFNULL(count(CASE WHEN io.orderstatus = '3' THEN 1 ELSE 0 END),0) / (IFNULL(count(CASE WHEN io.orderstatus = '2' THEN 1 ELSE 0 END),0) +  IFNULL(count(CASE WHEN io.orderstatus = '3' THEN 1 ELSE 0 END),0))  AS "closeRate"
+        FROM
+            ins_orders io
+                LEFT JOIN ins_area_company iac ON iac.orderno = io.orderno
+                LEFT JOIN sys_user su ON io.userid = su.id
+        <where>
+            1=1
+            <if test="vo.beginDate  != null  and  vo.beginDate!=''  and vo.endDate  != null  and  vo.endDate!=''">
+                AND io.createtime BETWEEN #{vo.beginDate} AND #{vo.endDate}
+            </if>
+
+            <if test="vo.licenseno  != null  and  vo.licenseno!=''  ">
+                AND io.licenseno =#{vo.licenseno}
+            </if>
+
+            <if test="vo.userId  != null  and  vo.userId!=''  ">
+                AND io.userId =#{vo.userId}
+            </if>
+
+            <if test="vo.userName  != null  and  vo.userName!=''  ">
+                AND su.name =#{vo.userName}
+            </if>
+
+            <if test="vo.mobile  != null  and  vo.mobile!=''  ">
+                AND su.mobile =#{vo.mobile}
+            </if>
+
+            <if test="vo.frameno  != null  and  vo.frameno!=''  ">
+                AND su.frameno =#{vo.frameno}
+            </if>
+            <if test="vo.deptId  != null  and  vo.deptId!=''  ">
+                and io.deptid like concat('%', #{vo.deptId}, '%')
+            </if>
+        </where>
+
+    </select>
+    <select id="numberQuotationsByUserIds"  resultType="com.ydtech.modules.admin.model.dto.TaskStatisticsDto">
+        SELECT
+        count(iac.id) as "orderNumber",
+        COUNT( CASE WHEN iac.orderstatus = 2 THEN 1 END ) AS underwritingCount,
+        COUNT( CASE WHEN iac.orderstatus = 3 THEN 1 END ) AS qutationInsureCount,
+        sum( CASE WHEN iac.orderstatus = 3 THEN IFNULL(iac.jqpremium, 0) + IFNULL(iac.sypremium, 0) + IFNULL(iac.jypremium, 0) END ) AS totalPremium
+        FROM
+        ins_area_company iac
+        left  join   ins_orders  io  on  io.orderno  = iac.orderno
+        <where>
+            <if test="ids  != null  and  ids.size()>0 ">
+                AND io.userid IN
+                <foreach item="item"  collection="ids" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="month  != null  and  month!='' ">
+                AND  DATE_FORMAT(iac.createtime, '%Y-%m')  =#{month}
+            </if>
+        </where>
+    </select>
 </mapper>
 </mapper>

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

@@ -1648,6 +1648,10 @@
             AND iac.orderno = #{telemarketingAuditOrderQueryVo.orderNo}
             AND iac.orderno = #{telemarketingAuditOrderQueryVo.orderNo}
         </if>
         </if>
 
 
+        <if test="telemarketingAuditOrderQueryVo.auditStatus != null and telemarketingAuditOrderQueryVo.auditStatus != '' ">
+            AND ifa.auditstatus = #{telemarketingAuditOrderQueryVo.auditStatus}
+        </if>
+
         <if test="telemarketingAuditOrderQueryVo.companyId != null and telemarketingAuditOrderQueryVo.companyId != '' ">
         <if test="telemarketingAuditOrderQueryVo.companyId != null and telemarketingAuditOrderQueryVo.companyId != '' ">
             AND iac.company_id = #{telemarketingAuditOrderQueryVo.companyId}
             AND iac.company_id = #{telemarketingAuditOrderQueryVo.companyId}
         </if>
         </if>