Browse Source

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

Qchen 2 years ago
parent
commit
65bb275c02
43 changed files with 1535 additions and 132 deletions
  1. 44 9
      src/main/java/com/ydtech/modules/admin/controller/SysUserAccountController.java
  2. 64 0
      src/main/java/com/ydtech/modules/admin/model/vo/SubOrder.java
  3. 13 2
      src/main/java/com/ydtech/modules/admin/model/vo/SysUserAccountVo.java
  4. 8 3
      src/main/java/com/ydtech/modules/admin/service/SysUserAccountService.java
  5. 1 0
      src/main/java/com/ydtech/modules/admin/service/impl/AppCustomerManagementImpl.java
  6. 134 32
      src/main/java/com/ydtech/modules/admin/service/impl/SysUserAccountServiceImpl.java
  7. 22 19
      src/main/java/com/ydtech/modules/esm/dao/EsmUserReferrerMapper.java
  8. 4 0
      src/main/java/com/ydtech/modules/esm/model/vo/EsmUserPolicyVO.java
  9. 1 1
      src/main/java/com/ydtech/modules/esm/service/impl/EsmUserReferrerServiceImpl.java
  10. 1 1
      src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceImpl.java
  11. 27 10
      src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java
  12. 21 1
      src/main/java/com/ydtech/modules/fnc/controller/InsPlyIncomeController.java
  13. 9 0
      src/main/java/com/ydtech/modules/fnc/controller/SettlementDocumentaryFeesController.java
  14. 2 0
      src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java
  15. 41 0
      src/main/java/com/ydtech/modules/fnc/entity/InsPlyIncome.java
  16. 17 0
      src/main/java/com/ydtech/modules/fnc/entity/SettlementDocumentaryFeesEntity.java
  17. 6 0
      src/main/java/com/ydtech/modules/fnc/service/InsPlyIncomeService.java
  18. 2 0
      src/main/java/com/ydtech/modules/fnc/service/SettlementDocumentaryFeesService.java
  19. 263 32
      src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java
  20. 13 0
      src/main/java/com/ydtech/modules/fnc/service/impl/SettlementDocumentaryFeesServiceImpl.java
  21. 39 0
      src/main/java/com/ydtech/modules/fnc/vo/InsPlyIncomeVo.java
  22. 4 1
      src/main/java/com/ydtech/modules/fnc/vo/SettlementDocumentaryFeesVo.java
  23. 22 0
      src/main/java/com/ydtech/modules/inv/model/dto/InsBxNoPlyIncomeExcelDto.java
  24. 42 0
      src/main/java/com/ydtech/modules/inv/model/dto/InsBxPlyIncomeExcelDto.java
  25. 1 1
      src/main/java/com/ydtech/modules/message/service/impl/MessageSecretaryServiceImpl.java
  26. 6 0
      src/main/java/com/ydtech/modules/order/controller/OrderTaskImageController.java
  27. 15 0
      src/main/java/com/ydtech/modules/order/dao/InsAreaCompanyMapper.java
  28. 7 0
      src/main/java/com/ydtech/modules/order/service/InsAreaCompanyService.java
  29. 2 0
      src/main/java/com/ydtech/modules/order/service/InsUploadFilesService.java
  30. 24 4
      src/main/java/com/ydtech/modules/order/service/impl/InsAreaCompanyServiceImpl.java
  31. 7 0
      src/main/java/com/ydtech/modules/order/service/impl/InsUploadFilesServiceImpl.java
  32. 21 0
      src/main/java/com/ydtech/modules/protocols/dao/InsFeeOrderNewMapper.java
  33. 4 2
      src/main/java/com/ydtech/modules/protocols/entity/po/InsFeeOrderNew.java
  34. 21 1
      src/main/java/com/ydtech/modules/protocols/service/InsFeeOrderNewService.java
  35. 20 0
      src/main/java/com/ydtech/modules/protocols/service/impl/InsFeeOrderNewServiceImpl.java
  36. 75 0
      src/main/resources/mapper/modules/esm/EsmUserReferrerMapper.xml
  37. 261 8
      src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml
  38. 5 0
      src/main/resources/mapper/modules/fnc/SettlementDocumentaryFeesMapper.xml
  39. 182 2
      src/main/resources/mapper/modules/ins/InsFeeOrderNewMapper.xml
  40. 82 1
      src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml
  41. 2 2
      src/main/resources/mapper/modules/order/InsOrdersMapper.xml
  42. BIN
      src/main/resources/template/handlingFeeTemplate.xlsx
  43. BIN
      src/main/resources/template/noHandlingFeeTemplate.xlsx

+ 44 - 9
src/main/java/com/ydtech/modules/admin/controller/SysUserAccountController.java

@@ -3,13 +3,14 @@ package com.ydtech.modules.admin.controller;
 
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.admin.model.po.SysUserAccount;
+import com.ydtech.modules.admin.model.vo.SubOrder;
 import com.ydtech.modules.admin.model.vo.SysUserAccountVo;
 import com.ydtech.modules.admin.service.SysUserAccountService;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.order.entity.BasePageResult;
 import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -44,20 +45,54 @@ public class SysUserAccountController extends BaseController {
     }
 
     @GetMapping(value = "/getSysAllAmount")
-    @ApiModelProperty("用户余额new")
+    @ApiOperation("用户余额new")
     public HttpResult<SysUserAccountVo>  getSysAllAmount (){
-
         String   userId = BaseController.getUser().getId();
-
         SysUserAccountVo result = sysUserAccountService.getSysAllAmount(userId);
         return  HttpResult.ok("success", result);
     }
     @PostMapping("getInsOrders")
-    @ApiOperation("获取子订单号")
+    @ApiOperation("获取预收实收列表数据")
     public HttpResult<SysUserAccountVo>  getInsOrders(@RequestBody SysUserAccountVo sysUserAccountVo){
-        SysUserAccountVo result =sysUserAccountService.getInsOrders(sysUserAccountVo);
-        return  HttpResult.ok("success", result);
-    }
-
 
+        if(StringUtils.isBlank(sysUserAccountVo.getAmountType())){
+            return HttpResult.error("金额类型(手续费金额1跟单金额2推广金额3)amountType不能为空");
+        }
+        //预收实收类型
+        if(StringUtils.isBlank(sysUserAccountVo.getSearchType())){
+            return HttpResult.error("预收实收类型(预收1实收2)searchType不能为空");
+        }
+        //查询时间
+        if(StringUtils.isBlank(sysUserAccountVo.getTimeFiltering())){
+            return HttpResult.error("查询时间timeFiltering不能为空");
+        }
+        try{
+            SysUserAccountVo result =sysUserAccountService.getInsOrders(sysUserAccountVo);
+            return  HttpResult.ok("success", result);
+        }catch (Exception e){
+            return HttpResult.error("查询失败"+e.getMessage());
+        }
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/3 15:03
+     *  @Description: 通过子订单编号查询订单的详情页面
+     */
+    @GetMapping("getSubOrderDetails")
+    @ApiOperation("获取订单详情")
+    public HttpResult<SubOrder>  getSubOrderDetails(String subOrderId,String userId){
+        if(StringUtils.isBlank(subOrderId)){
+            return HttpResult.error("订单号subOrderId不能为空");
+        }
+        if(StringUtils.isBlank(userId)){
+            return HttpResult.error("用户编码userId不能为空");
+        }
+        try{
+            SubOrder subOrder =sysUserAccountService.getSubOrderDetails(subOrderId,userId);
+            return  HttpResult.ok("success", subOrder);
+        }catch (Exception e){
+            return HttpResult.error("操作失败"+e.getMessage());
+        }
+    }
 }

+ 64 - 0
src/main/java/com/ydtech/modules/admin/model/vo/SubOrder.java

@@ -0,0 +1,64 @@
+package com.ydtech.modules.admin.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2024/6/3 15:04
+ *  @Description: 订单详情
+ */
+@Data
+@ApiModel("订单详情数据")
+public class SubOrder {
+
+    @ApiModelProperty("订单号")
+    private String subOrderId;
+
+    @ApiModelProperty("承保时间")
+    private String  signingTime;
+
+    @ApiModelProperty("车牌号")
+    private String licenseNo;
+
+    @ApiModelProperty("交强险费用")
+    private String jqpremium;
+
+    @ApiModelProperty("商业险费用")
+    private String sypremium;
+
+    @ApiModelProperty("驾意险费用")
+    private String jypremium;
+    /**
+    @ApiModelProperty("一级分销人名称")
+    private String firstLevelUserName;
+    @ApiModelProperty("一级分销比例")
+    private BigDecimal firstDetailProportion;
+    @ApiModelProperty("一级分销金额")
+    private BigDecimal firstDetailPremiums;
+
+    @ApiModelProperty("二级分销人名称")
+    private String twoLevelUserName;
+    @ApiModelProperty("二级分销比例")
+    private BigDecimal twoDetailProportion;
+    @ApiModelProperty("二级分销金额")
+    private BigDecimal twoDetailPremiums;
+    @ApiModelProperty("三级分销人名称")
+    private String threeLevelUserName;
+    @ApiModelProperty("三级分销比例")
+    private BigDecimal threeDetailProportion;
+    @ApiModelProperty("三级分销金额")
+    private BigDecimal threeDetailPremiums;
+    **/
+
+    @ApiModelProperty("用户id")
+    private String userId;
+
+    @ApiModelProperty("代理人名称")
+    private String agentName;
+
+    @ApiModelProperty("代理人级别")
+    private String agentLevel;
+}

+ 13 - 2
src/main/java/com/ydtech/modules/admin/model/vo/SysUserAccountVo.java

@@ -3,7 +3,6 @@ package com.ydtech.modules.admin.model.vo;
 
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
 import io.swagger.annotations.ApiModel;
@@ -111,6 +110,14 @@ public class SysUserAccountVo {
     @ApiModelProperty(value = "预收推广费")
     private BigDecimal willPromotion;
 
+    //  add by  hxl  2024-06-03   添加实收的手续费佣金、预收非跟单佣金、预收推广费
+    @ApiModelProperty(value = "实收手续费佣金")
+    private BigDecimal receivedWillHalding;
+    @ApiModelProperty(value = "实收非跟单佣金")
+    private BigDecimal receivedWillDocumentary;
+    @ApiModelProperty(value = "实收推广费")
+    private BigDecimal receivedWillPromotion;
+
 
     @ApiModelProperty(value = "提现中手续费佣金")
     private BigDecimal withdrawalHalding;
@@ -131,7 +138,11 @@ public class SysUserAccountVo {
     private String  timeFiltering;
     @ApiModelProperty("子订单数组")
     private List<InsFeeOrderNew> insFeeOrderNewList;
-    @ApiModelProperty("金额类型")
+    @ApiModelProperty("金额类型 1. 手续费金额 2. 跟单金额  3. 推广金额")
     private String  amountType;
+    //添加预收和实收前台逻辑的判断  add by hxl   2024-06-03
+    @ApiModelProperty("预收和实收的判断区分 预收是1  实收是2")
+    private String  searchType;
+
 
 }

+ 8 - 3
src/main/java/com/ydtech/modules/admin/service/SysUserAccountService.java

@@ -3,11 +3,10 @@ package com.ydtech.modules.admin.service;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.admin.model.po.SysUserAccount;
+import com.ydtech.modules.admin.model.vo.SubOrder;
 import com.ydtech.modules.admin.model.vo.SysUserAccountVo;
 import com.ydtech.modules.order.entity.BasePageResult;
 
-import java.util.List;
-
 /**
 * @author Administrator
 * @description 针对表【sys_user_account(用户账户表)】的数据库操作Service
@@ -27,5 +26,11 @@ public interface SysUserAccountService extends IService<SysUserAccount> {
     SysUserAccountVo getSysAllAmount(String userId);
 
     SysUserAccountVo getInsOrders(SysUserAccountVo sysUserAccountVo);
-
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/3 15:16
+     *  @Description: 查询子订单的详情页面
+     */
+    SubOrder getSubOrderDetails(String subOrderId,String userId);
 }

+ 1 - 0
src/main/java/com/ydtech/modules/admin/service/impl/AppCustomerManagementImpl.java

@@ -45,6 +45,7 @@ public class AppCustomerManagementImpl implements AppCustomerManagementService {
                     .eq(StringUtils.isEmpty(managementQueryVo.getPhoneNumber()), SysUser::getMobile, managementQueryVo.getPhoneNumber())
                     .eq(StringUtils.isEmpty(managementQueryVo.getUserId()), SysUser::getId, managementQueryVo.getUserId())
                     .eq(StringUtils.isEmpty(managementQueryVo.getUsername()), SysUser::getName, managementQueryVo.getUsername())
+                    .eq(StringUtils.isEmpty(managementQueryVo.getAuthenticationStatus()), SysUser::getName, managementQueryVo.getAuthenticationStatus())
                     .page(page);
 
             List<SysUserTeamDto> sysUserTeamDtos = sysUserPage.getRecords().stream().map(SysUserTeamDto::new).collect(Collectors.toList());

+ 134 - 32
src/main/java/com/ydtech/modules/admin/service/impl/SysUserAccountServiceImpl.java

@@ -1,24 +1,25 @@
 package com.ydtech.modules.admin.service.impl;
 
+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.ydtech.core.page.HttpResult;
 import com.ydtech.modules.admin.constants.MoneyAttrConstants;
 import com.ydtech.modules.admin.constants.WithdrawTypeConstants;
 import com.ydtech.modules.admin.dao.SysUserAccountMapper;
+import com.ydtech.modules.admin.model.SysUser;
 import com.ydtech.modules.admin.model.po.SysAmountAuditingEntity;
 import com.ydtech.modules.admin.model.po.SysUserAccount;
 import com.ydtech.modules.admin.model.po.SysUserAccountHistory;
 import com.ydtech.modules.admin.model.po.SysUserBankCard;
+import com.ydtech.modules.admin.model.vo.SubOrder;
 import com.ydtech.modules.admin.model.vo.SysUserAccountVo;
-import com.ydtech.modules.admin.service.SysAmountAuditingService;
-import com.ydtech.modules.admin.service.SysUserAccountHistoryService;
-import com.ydtech.modules.admin.service.SysUserAccountService;
-import com.ydtech.modules.admin.service.SysUserBankCardService;
+import com.ydtech.modules.admin.service.*;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.esm.service.EsmUserReferrerService;
 import com.ydtech.modules.message.constants.MessageTypeConstants;
 import com.ydtech.modules.message.service.MessageSecretaryService;
+import com.ydtech.modules.order.dao.InsAreaCompanyMapper;
 import com.ydtech.modules.order.dao.InsOrdersMapper;
 import com.ydtech.modules.order.entity.BasePageResult;
 import com.ydtech.modules.order.entity.InsOrders;
@@ -71,6 +72,11 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
     @Autowired
     private MessageSecretaryService messageSecretaryService;
 
+    @Autowired
+    private InsAreaCompanyMapper insAreaCompanyMapper;
+
+    @Autowired
+    private SysUserService sysUserService;
 
     @Override
     @Transactional
@@ -281,30 +287,47 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
         if (ObjectUtils.isEmpty(sysUserAccount)) {
             return sysUserAccountVo;
         }
-
         BeanUtils.copyProperties(sysUserAccount, sysUserAccountVo);
-
         BigDecimal willHalding = BigDecimal.ZERO;        //预收手续费佣金
         BigDecimal willDocumentary = BigDecimal.ZERO;   //预收 非跟单佣金
         BigDecimal willPromotion = BigDecimal.ZERO;   //预收 推广
-        StringBuffer stringBuffer = new StringBuffer();
-
-        willPromotion = this.willPromotion(willPromotion, userId);  // 佣金
+        BigDecimal receivedWillHalding = BigDecimal.ZERO;        //实收手续费佣金
+        BigDecimal receivedWillDocumentary = BigDecimal.ZERO;   //实收非跟单佣金
+        BigDecimal receivedWillPromotion = BigDecimal.ZERO;   //实收推广费
+        // 预收手续费佣金
+        willPromotion = this.willPromotionAll(willPromotion, userId,"1");
+        // 实收手续费佣金
+        receivedWillPromotion = this.willPromotionAll(willPromotion, userId,"2");
         // add by   hxl  修改sql 添加承保状态和不在审核表中的条件   begin ===============
-        //List<InsFeeOrderNew> willList = insFeeOrderNewService.getByUserId(userId);
-        List<InsFeeOrderNew> willList = insFeeOrderNewService.getByUserIdAndOrderStatusAndNoCheck(userId);
-        //  add by  hxl   end ==========================
+        List<InsFeeOrderNew> willList = insFeeOrderNewService.getByUserIdAndOrderStatusAndNoCheckType(userId,"1");
+        List<InsFeeOrderNew> willListnew = insFeeOrderNewService.getByUserIdAndOrderStatusAndNoCheckType(userId,"2");
         if (!CollectionUtils.isEmpty(willList)) {
             for (InsFeeOrderNew item : willList) {
-                String quoteno = item.getInsOrderNo();
-                stringBuffer.append(quoteno).append(",");
                 if (ObjectUtils.isNotEmpty(item)) {
-                    this.willAmount(item, willHalding, willDocumentary, sysUserAccountVo);  // 推广 非跟单
+                    //1.预收手续费佣金  2. 预收非跟单佣金
+                    willHalding = willHalding.add(this.willAmountNew(item,1));
+                    willDocumentary = willDocumentary.add(this.willAmountNew(item,2));
                 }
             }
-
         }
-//        提现现中
+        if (!CollectionUtils.isEmpty(willListnew)) {
+            for (InsFeeOrderNew item : willListnew) {
+                if (ObjectUtils.isNotEmpty(item)) {
+                    //1.实收手续费佣金  2. 实收非跟单佣金
+                    receivedWillHalding = willHalding.add(this.willAmountNew(item,1));
+                    receivedWillDocumentary = willDocumentary.add(this.willAmountNew(item,2));
+                }
+            }
+        }
+        //预收手续费佣金
+        sysUserAccountVo.setWillHalding(willPromotion);
+        //预收非跟单佣金
+        sysUserAccountVo.setWillDocumentary(willDocumentary);
+        //实收手续费佣金
+        sysUserAccountVo.setReceivedWillHalding(receivedWillHalding);
+        //实收非跟单佣金
+        sysUserAccountVo.setReceivedWillDocumentary(receivedWillDocumentary);
+        //提现现中 手续费、非跟单、推广费
         HashMap<String, Object> params = new HashMap<>();
         params.put("auditingStatus", "2");  // 待审核
         params.put("userId", userId);
@@ -313,14 +336,13 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
         params.clear();
         params.put("auditingStatus", "3");  // 已审核审核
         params.put("userId", userId);
+        //已提现 手续费、非跟单、推广费
         List<SysAmountAuditingEntity> sysAmountAuditingApproved = sysAmountAuditingService.getProgressIng(params);
         this.judgeSysAmountAuditing(sysAmountAuditingApproved, sysUserAccountVo);
+        //预收手续费佣金
         sysUserAccountVo.setWillPromotion(willPromotion);
-        String ids = stringBuffer.toString();
-        if (ids.endsWith(",")) {
-            ids = ids.substring(0, ids.length() - 1);  // 去掉末尾的逗号
-        }
-        sysUserAccountVo.setIds(ids);
+        //实收手续费佣金
+        sysUserAccountVo.setReceivedWillPromotion(receivedWillPromotion);
         return sysUserAccountVo;
     }
 
@@ -329,25 +351,26 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
         ArrayList<InsFeeOrderNew> resultList = new ArrayList<>();
         HashMap<String, Object> params = new HashMap<>();
         params.put("userId", BaseController.getUser().getId());
+        //日期
         params.put("timeFiltering", sysUserAccountVo.getTimeFiltering());
-
+        //1预收2.实收
+        params.put("type",sysUserAccountVo.getSearchType());
+        sysUserAccountVo.setInsFeeOrderNewList(null);
+        //金额类型 1. 手续费金额 2. 跟单金额  3. 推广金额
         if ("3".equals(sysUserAccountVo.getAmountType())) {
-            List<InsFeeOrderNew> sumWillAmountGeneralization = insFeeOrderNewService.getSumWillAmountGeneralization(params);
+            List<InsFeeOrderNew> sumWillAmountGeneralization = insFeeOrderNewService.getSumWillAmountGeneralizationNew(params);
             sysUserAccountVo.setInsFeeOrderNewList(sumWillAmountGeneralization);
         } else {
-            List<InsFeeOrderNew> resultInsFeeOrderNew = insFeeOrderNewService.getSumWillAmount(params);
-            if (!resultInsFeeOrderNew.isEmpty()) {
+            List<InsFeeOrderNew> resultInsFeeOrderNew = insFeeOrderNewService.getSumWillAmountNew(params);
+            if (resultInsFeeOrderNew!=null && resultInsFeeOrderNew.size()>0) {
                 for (InsFeeOrderNew item : resultInsFeeOrderNew) {
                     BigDecimal willPromotion = BigDecimal.ZERO;
                     if ("1".equals(sysUserAccountVo.getAmountType())) {
                         //手续费出口预收
-                        willPromotion =
-                                willPromotion.add(item.getJqExportSuperviseCostsPremiums()).add(item.getSyExportSuperviseCostsPremiums()).add(item.getNoExportSuperviseCostsPremiums());
+                        willPromotion = willPromotion.add(item.getJqExportSuperviseCostsPremiums()).add(item.getSyExportSuperviseCostsPremiums()).add(item.getNoExportSuperviseCostsPremiums());
                     } else if ("2".equals(sysUserAccountVo.getAmountType())) {
-                        willPromotion =
-                                willPromotion.add(item.getJqExportOtherCostsPremiums()).add(item.getSyExportOtherCostsPremiums()).add(item.getNoExportOtherCostsPremiums());
+                        willPromotion = willPromotion.add(item.getJqExportOtherCostsPremiums()).add(item.getSyExportOtherCostsPremiums()).add(item.getNoExportOtherCostsPremiums());
                     }
-
                     item.setWillAmount(willPromotion);
                     if (willPromotion.compareTo(BigDecimal.ZERO) != 0) {
                         resultList.add(item);
@@ -356,7 +379,6 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
                 sysUserAccountVo.setInsFeeOrderNewList(resultList);
             }
         }
-
         return sysUserAccountVo;
     }
 
@@ -531,6 +553,86 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
             sysUserAccountVo.setWillDocumentary(sysUserAccountVo.getWillDocumentary().add(jqExportOtherCostsPremiums).add(syExportOtherCostsPremiums).add(noExportOtherCostsPremiums));
         }
     }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/3 11:20
+     *  @Description:  通过类型查询预收、实收的金额
+     */
+    private BigDecimal willPromotionAll(BigDecimal willPromotion, String userId,String type) {
+        InsFeeOrderNew insFeeOrderNew = new InsFeeOrderNew();
+        insFeeOrderNew.setUserId(userId);
+        InsOrders InsOrders = insAreaCompanyService.selectByInFeeOrderNewByType(insFeeOrderNew,type);
+        if (ObjectUtils.isNotEmpty(InsOrders)) {
+            BigDecimal willFirstPremiums = ObjectUtils.defaultIfNull(InsOrders.getWillFirstPremiums(), BigDecimal.ZERO);
+            // 累加保费
+            willPromotion = willPromotion.add(willFirstPremiums);
+        }
+        return willPromotion;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/4 11:51
+     *  @Description:  获取费用
+     */
+    private BigDecimal willAmountNew(InsFeeOrderNew insFeeOrderNew, int type) {
+        BigDecimal  val= BigDecimal.ZERO;
+        if (ObjectUtils.isNotEmpty(insFeeOrderNew)) {
+            if(type==1){
+                // 交强手续费+商业手续费+非车手续费
+                val= val.add(insFeeOrderNew.getJqExportSuperviseCostsPremiums()).add(insFeeOrderNew.getSyExportSuperviseCostsPremiums()).add(insFeeOrderNew.getNoExportSuperviseCostsPremiums());
+            }else{
+                // 交强跟单出口费用+商业跟单出口费用+非车跟单出口费用
+                val= val.add(insFeeOrderNew.getJqExportOtherCostsPremiums()).add(insFeeOrderNew.getSyExportOtherCostsPremiums()).add(insFeeOrderNew.getNoExportOtherCostsPremiums());
+            }
+        }
+        return val;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/3 15:16
+     *  @Description: 查询子订单的详细信息
+     */
+    @Override
+    public SubOrder getSubOrderDetails(String subOrderId, String userId) {
+        SubOrder subOrder=insAreaCompanyMapper.getSubOrderDetails(subOrderId);
+        subOrder.setAgentName("");
+        subOrder.setAgentLevel("");
+        //根据用户id查询分销等级
+        InsFeeOrderNew insFeeOrderNew = insFeeOrderNewService.getOne(new LambdaQueryWrapper<InsFeeOrderNew>()
+                .eq(InsFeeOrderNew::getInsOrderNo, subOrder.getSubOrderId()));
+        if(userId.equals(insFeeOrderNew.getFirstLevelUserId())){
+            subOrder.setAgentName(this.getUserName(insFeeOrderNew.getFirstLevelUserId()));
+            subOrder.setAgentLevel("一级分销代理");
+        }
+        if(userId.equals(insFeeOrderNew.getTwoLevelUserId())){
+            subOrder.setAgentName(this.getUserName(insFeeOrderNew.getTwoLevelUserId()));
+            subOrder.setAgentLevel("二级分销代理");
+        }
+        if(userId.equals(insFeeOrderNew.getThreeLevelUserId())){
+            subOrder.setAgentName(this.getUserName(insFeeOrderNew.getThreeLevelUserId()));
+            subOrder.setAgentLevel("三级分销代理");
+        }
+        return subOrder;
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/3 16:34
+     *  @Description: 查询分销人名称
+     */
+    private String getUserName(String userId) {
+        if(StringUtils.isNotEmpty(userId)){
+            SysUser sysUser = sysUserService.getBaseMapper().selectById(userId);
+            if(ObjectUtils.isNotEmpty(sysUser)){
+                return sysUser.getName();
+            }
+        }
+        return "";
+    }
 }
 
 

+ 22 - 19
src/main/java/com/ydtech/modules/esm/dao/EsmUserReferrerMapper.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.modules.admin.model.SysUser;
 import com.ydtech.modules.admin.model.dto.SysUserDto;
 import com.ydtech.modules.admin.model.dto.SysUserTeamDto;
+import com.ydtech.modules.admin.model.vo.AppCustomerManagementQueryVo;
 import com.ydtech.modules.admin.model.vo.SysReferrerVo;
 import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
 import com.ydtech.modules.admin.model.vo.SysUserVO;
@@ -169,26 +170,28 @@ public interface EsmUserReferrerMapper extends BaseMapper<EsmUserReferrer> {
     @Select("select id,referrer_id,referrer_name,`level`,affiliation from esm_user_referrer t where t.affiliation=#{affiliation}")
     List<EsmUserReferrer> queryList(@Param("affiliation") String affiliation);
 
-    @Select({"<script>","select a.userid,a.username,sum(a.ordernum) ordernum,sum(a.policynum) policynum,sum(a.sumpremium) sumpremium from  v_user_order2 a " +
-            "where DATE_FORMAT(orderdate, '%Y-%m-%d') " +
-            "between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')" +
-            "and userid in " +
-            "<foreach item='item' index='index' collection='userList'  open='(' separator=',' close=')'> " +
-            " #{item}" +
-            "</foreach > " +
-            "group by a.userid,a.username"
-            , "</script>"})
+//    @Select({"<script>","select a.userid,a.username,sum(a.ordernum) ordernum,sum(a.policynum) policynum,sum(a.sumpremium) sumpremium from  v_user_order2 a " +
+//            "where DATE_FORMAT(orderdate, '%Y-%m-%d') " +
+//            "between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')" +
+//            "and userid in " +
+//            "<foreach item='item' index='index' collection='userList'  open='(' separator=',' close=')'> " +
+//            " #{item}" +
+//            "</foreach > " +
+//            "group by a.userid,a.username"
+//            , "</script>"})
     List<EsmUserPolicyVO> queryOrderCount(List<String> userList, String startDate, String endDate);
 
-    @Select({"<script>","select sum(sumpremium) sumpremium " +
-            "from  v_user_order2 a " +
-            "where DATE_FORMAT(orderdate, '%Y-%m-%d') " +
-            "between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')" +
-            "and userid in " +
-            "<foreach item='item' index='index' collection='userList'  open='(' separator=',' close=')'> " +
-            " #{item}" +
-            "</foreach > "
-            , "</script>"})
+//    @Select({"<script>","select sum(sumpremium) sumpremium " +
+//            "from  v_user_order2 a " +
+//            "where DATE_FORMAT(orderdate, '%Y-%m-%d') " +
+//            "between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')" +
+//            "and userid in " +
+//            "<foreach item='item' index='index' collection='userList'  open='(' separator=',' close=')'> " +
+//            " #{item}" +
+//            "</foreach > "
+//            , "</script>"})
+//    EsmTeamPolicyVO queryOrderCountHz(List<String> userList, String startDate, String endDate);
+
     EsmTeamPolicyVO queryOrderCountHz(List<String> userList, String startDate, String endDate);
 
     Page<SysUser> getUserPage(Page page, SysUserDto dto);
@@ -196,7 +199,7 @@ public interface EsmUserReferrerMapper extends BaseMapper<EsmUserReferrer> {
     Page<QueryChannel> getQueryChannelPage(Page page, QueryChannel queryChannel);
 
 
-    List<SysUserTeamDto> getByTeam(@Param("userId") String userId, @Param("level") int level);
+    List<SysUserTeamDto> getByTeam(@Param("managementQueryVo") AppCustomerManagementQueryVo managementQueryVo, @Param("userId") String userId, @Param("level") int level);
 
 
 

+ 4 - 0
src/main/java/com/ydtech/modules/esm/model/vo/EsmUserPolicyVO.java

@@ -23,6 +23,10 @@ public class EsmUserPolicyVO implements Serializable {
     private int policynum;//核保笔数
     @ApiModelProperty(value = "签单保费")
     private double sumpremium;//签单保费
+    @ApiModelProperty(value = "报价次数")
+    private int bjpolicynum;//报价次数
+    @ApiModelProperty(value = "报价金额")
+    private double bjsumpremium;//报价金额
 
 
 }

+ 1 - 1
src/main/java/com/ydtech/modules/esm/service/impl/EsmUserReferrerServiceImpl.java

@@ -447,7 +447,7 @@ public class EsmUserReferrerServiceImpl extends ServiceImpl<EsmUserReferrerMappe
         }
         int i = esmUserReferrers.get(0).getLevel() + 3;
         PageHelper.startPage(managementQueryVo.getPageNum(), managementQueryVo.getPageSize());
-        List<SysUserTeamDto> byTeam = baseMapper.getByTeam(userId, i);
+        List<SysUserTeamDto> byTeam = baseMapper.getByTeam(managementQueryVo, userId, i);
         PageResult<SysUserTeamDto> sysUserPageResult = new PageResult<>(byTeam);
         return new BasePageResult<>(managementQueryVo.getPageNum(), managementQueryVo.getPageSize(), sysUserPageResult.getTotalPages(),
                 sysUserPageResult.getPageSize(), sysUserPageResult.getContent());

+ 1 - 1
src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceImpl.java

@@ -2879,7 +2879,7 @@ BigDecimal.ROUND_DOWN));
         String threeUserName = this.getUserName(insFeeOrderNew.getThreeLevelUserId());
         levelThree.setUserName(threeUserName);  //分销人
         levelThree.setDistributionRatio(insFeeOrderNew.getThirdDetailProportion());  // 分销比例
-        BigDecimal thirdDetailPremiums = Optional.ofNullable(insFeeOrderNew.getSecondDetailPremiums()).orElse(new BigDecimal(0));
+        BigDecimal thirdDetailPremiums = Optional.ofNullable(insFeeOrderNew.getThirdDetailPremiums()).orElse(new BigDecimal(0));
         levelThree.setAmount(thirdDetailPremiums);   // 分销金额
         resultList.add(levelThree);
         return resultList;

+ 27 - 10
src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java

@@ -881,11 +881,20 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
         //将值进行分割
         String[] split = ptlAgreementProductCostsAttrLink.getMin().split(",");
         AtomicBoolean returnBool = new AtomicBoolean(false);
-        Arrays.stream(split).forEach(x -> {
-            if (value.contains(x)) {
-                returnBool.set(true);
-            }
-        });
+        if(ptlAgreementProductCostsAttrLink.getAttrCode().equals("NatureOfUse")){
+            Arrays.stream(split).forEach(x -> {
+                if (value.equals(x)) {
+                    returnBool.set(true);
+                }
+            });
+        }else{
+            Arrays.stream(split).forEach(x -> {
+                if (value.contains(x)) {
+                    returnBool.set(true);
+                }
+            });
+        }
+
         return returnBool.get();
     }
 
@@ -893,11 +902,19 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
         //将值进行分割
         String[] split = ptlAgreementUndwrtRulesAttrLink.getMin().split(",");
         AtomicBoolean returnBool = new AtomicBoolean(true);
-        Arrays.stream(split).forEach(x -> {
-            if (!x.equals("") && value.contains(x)) {
-                returnBool.set(false);
-            }
-        });
+        if(ptlAgreementUndwrtRulesAttrLink.getAttrCode().equals("NatureOfUse")) {
+            Arrays.stream(split).forEach(x -> {
+                if (!x.equals("") && value.equals(x)) {
+                    returnBool.set(false);
+                }
+            });
+        }else{
+            Arrays.stream(split).forEach(x -> {
+                if (!x.equals("") && value.contains(x)) {
+                    returnBool.set(false);
+                }
+            });
+        }
         return returnBool.get();
     }
 

+ 21 - 1
src/main/java/com/ydtech/modules/fnc/controller/InsPlyIncomeController.java

@@ -119,11 +119,17 @@ public class InsPlyIncomeController extends BaseController {
     }
 
     @PutMapping("/batchInvoic")
-    @ApiModelProperty(value = "批量开票跟单费")
+    @ApiModelProperty(value = "开票跟单费")
     public HttpResult<Object> batchInvoic(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
 
         return   insPlyIncomeService.batchInvoic(insPlyIncomeVo);
     }
+
+    @PutMapping("/singleInvoic")
+    @ApiModelProperty(value = "批量开票跟单费")
+    public HttpResult<Object> singleInvoic(@RequestBody  InsPlyIncomeVo  insPlyIncomeVo) {
+        return   insPlyIncomeService.singleInvoic(insPlyIncomeVo);
+    }
     @PutMapping("/batchBalance")
     @ApiModelProperty(value = "批量结算跟单费")
     public HttpResult<Object> batchBalance(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
@@ -186,6 +192,12 @@ public class InsPlyIncomeController extends BaseController {
         insPlyIncomeService.updateByEntity(insPlyIncomeVo);
         return HttpResult.ok("修改成功");
     }
+    @PutMapping("/batchUpdate")
+    @ApiModelProperty(value = "批量修改")
+    public HttpResult<Object> batchUpdate(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        insPlyIncomeService.batchUpdate(insPlyIncomeVo);
+        return HttpResult.ok("批量修改成功");
+    }
     @PostMapping("/insert")
     @ApiModelProperty(value = "新增")
     public HttpResult<InsPlyIncome> insertByEntity(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
@@ -283,6 +295,14 @@ public class InsPlyIncomeController extends BaseController {
     public HttpResult<List<HashMap<String,Object>>>   otherSettldetail (@RequestBody  InsPlyIncomeVo insPlyIncomeVo){
         return  insPlyIncomeService.otherSettldetail(insPlyIncomeVo);
     }
+    @PostMapping("/otherTimeDetail")
+    @ApiOperation(value = "非跟单明细查询")
+    public HttpResult<List<HashMap<String,Object>>>   otherTimeDetail (@RequestBody  InsPlyIncomeVo insPlyIncomeVo){
+        return  insPlyIncomeService.otherTimeDetail(insPlyIncomeVo);
+    }
+
+
+
 
 }
 

+ 9 - 0
src/main/java/com/ydtech/modules/fnc/controller/SettlementDocumentaryFeesController.java

@@ -5,9 +5,11 @@ import com.ydtech.modules.admin.model.vo.SysUserAccountVo;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity;
 import com.ydtech.modules.fnc.service.SettlementDocumentaryFeesService;
+import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
 import com.ydtech.modules.fnc.vo.SettlementDocumentaryFeesVo;
 import com.ydtech.modules.order.entity.BasePageResult;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -39,4 +41,11 @@ public class SettlementDocumentaryFeesController extends BaseController {
       return   settlementDocumentaryFeesService.documentarySettle(settlementDocumentaryFeesVo);
     }
 
+    @PutMapping("/voidInvoicing")
+    @ApiModelProperty(value = "作废开票")
+    public HttpResult<Object> voidInvoicing(@RequestBody SettlementDocumentaryFeesVo settlementDocumentaryFeesVo) {
+        settlementDocumentaryFeesService.voidInvoicing(settlementDocumentaryFeesVo);
+        return HttpResult.ok("作废成功");
+    }
+
 }

+ 2 - 0
src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java

@@ -120,4 +120,6 @@ public interface InsPlyIncomeMapper extends BaseMapper<InsPlyIncome> {
     InsPlyIncome getEntityById(@Param("id") String id);
 
     void updateByIds(String[] split);
+
+    List<HashMap<String,Object>> otherTimeDetail(HashMap<String, Object> params);
 }

+ 41 - 0
src/main/java/com/ydtech/modules/fnc/entity/InsPlyIncome.java

@@ -7,6 +7,8 @@ import java.io.Serializable;
 import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.util.Date;
+
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
@@ -301,6 +303,34 @@ public class InsPlyIncome implements Serializable {
     @TableField("insured_name")
     private String insuredName;
 
+    @ApiModelProperty("备注")
+    @TableField("remarks")
+    private String remarks;
+
+    @ApiModelProperty("交强险起期")
+    @TableField("jq_start_date")
+    private String jqStartDate;
+
+    @ApiModelProperty("交强险止期")
+    @TableField("jq_end_date")
+    private String jqEndDate;
+
+    @ApiModelProperty("商业险起期")
+    @TableField("sy_start_date")
+    private String syStartDate;
+
+    @ApiModelProperty("商业险止期")
+    @TableField("sy_end_date")
+    private String syEndDate;
+
+    @ApiModelProperty("跟单结算")
+    @TableField("settle_other_status")
+    private String settleOtherStatus;
+
+    @ApiModelProperty("跟单结算")
+    @TableField("settle_other_status")
+    private String settlementImageId;
+
 
     @ApiModelProperty("总单数")
     @TableField(exist = false)
@@ -397,6 +427,17 @@ public class InsPlyIncome implements Serializable {
     @TableField(exist = false)
     private String dockingPerson;
 
+    @ApiModelProperty("进账金额")
+    @TableField(exist = false)
+    private BigDecimal expendAmount;
+
+    @ApiModelProperty("税点")
+    @TableField(exist = false)
+    private BigDecimal taxPoints;
+
+    @ApiModelProperty("税费")
+    @TableField(exist = false)
+    private BigDecimal taxesFees;
 
     public InsPlyIncome(String orderno, String policyno, String syPolicyno, String noPolicyno, String settleno, String deptId, String deptName, String riskcode, LocalDateTime payDate, LocalDateTime signDate, String companyId, String companyName, String agreementId, String licenseno, BigDecimal taxamount, BigDecimal noTaxPremium, BigDecimal commissionFeerate, BigDecimal otherFeerate, BigDecimal commissionFeevalue, BigDecimal otherFeevalue, BigDecimal allFeeValue, BigDecimal finalFeeValue, BigDecimal doingFeeValue, LocalDate createTime, String voucherNumber, String contractId, String contractFileId, String handlingFeesStatus, String documentaryFeesStatus, String isNotCar, String isNotDocumentary) {
         this.orderno = orderno;

+ 17 - 0
src/main/java/com/ydtech/modules/fnc/entity/SettlementDocumentaryFeesEntity.java

@@ -109,6 +109,10 @@ public class SettlementDocumentaryFeesEntity implements Serializable {
     @TableField("expend_amount")
     private BigDecimal expendAmount;
 
+    @ApiModelProperty("签订日期")
+    @TableField("signing_time")
+    private LocalDate signingTime;
+
     @ApiModelProperty("开票id")
     @TableField("parent_id")
     private String parentId;
@@ -122,5 +126,18 @@ public class SettlementDocumentaryFeesEntity implements Serializable {
     @TableField("agreement_type")
     private String agreementType;
 
+    @ApiModelProperty("结算凭证")
+    @TableField("settlement_image_id")
+    private String settlementImageId;
+
+
+    @ApiModelProperty("图片路径")
+    @TableField(exist = false)
+    private String imageUrl;
+
+    @ApiModelProperty("税费")
+    @TableField(exist = false)
+    private String taxesFees;
+
 
 }

+ 6 - 0
src/main/java/com/ydtech/modules/fnc/service/InsPlyIncomeService.java

@@ -121,4 +121,10 @@ public interface InsPlyIncomeService extends IService<InsPlyIncome> {
 
     InsPlyIncome getEntityById(String id);
 
+    HttpResult<List<HashMap<String,Object>>> otherTimeDetail(InsPlyIncomeVo insPlyIncomeVo);
+
+    HttpResult<Object> singleInvoic(InsPlyIncomeVo insPlyIncomeVo);
+
+    void batchUpdate(InsPlyIncomeVo insPlyIncomeVo);
+
 }

+ 2 - 0
src/main/java/com/ydtech/modules/fnc/service/SettlementDocumentaryFeesService.java

@@ -27,4 +27,6 @@ public interface SettlementDocumentaryFeesService extends IService<SettlementDoc
     List<HashMap<String, Object>> getInvoicIds(HashMap<String, Object> params);
 
     SettlementDocumentaryFeesEntity getByParentSettlementAmount(String id);
+
+    void voidInvoicing(SettlementDocumentaryFeesVo settlementDocumentaryFeesVo);
 }

+ 263 - 32
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -14,6 +14,7 @@ import com.github.pagehelper.PageInfo;
 import com.ydtech.constants.enums.dict.agreement.ProductsType;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
+import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.esm.model.EsmInsCompany;
 import com.ydtech.modules.esm.service.EsmInsCompanyService;
 import com.ydtech.modules.fnc.entity.InsAreaCompany;
@@ -73,6 +74,7 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.time.YearMonth;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -184,6 +186,10 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         insPlyIncome.setNoPremium(insPlyIncome.getNoPremium());
         insPlyIncome.setIsNotCar("1");
         insPlyIncome.setIsNotDocumentary("1");
+        insPlyIncome.setJqStartDate(insAreaCompany.getJqStartDate());
+        insPlyIncome.setJqEndDate(insAreaCompany.getJqEndDate());
+        insPlyIncome.setSyStartDate(insAreaCompany.getSyStartDate());
+        insPlyIncome.setSyEndDate(insAreaCompany.getSyEndDate());
         insPlyIncome.setAllFeeValue(insFeeOrderNew.getNoOtherCostsPremiums());
         this.saveByCompanyId(insFeeOrderNew ,insAreaCompany.getCompanyId(),insPlyIncome);
         baseMapper.insert(insPlyIncome);
@@ -217,6 +223,10 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         insPlyIncome.setInsuredName(order.getInsuredname());
         insPlyIncome.setNoPremium(insFeeOrderNew.getNoPremium()); //非车保费
         insPlyIncome.setNoNoTaxPremium(insFeeOrderNew.getNoNoTaxPremium());  //非车不含税保费
+        insPlyIncome.setJqStartDate(insAreaCompany.getJqStartDate());
+        insPlyIncome.setJqEndDate(insAreaCompany.getJqEndDate());
+        insPlyIncome.setSyStartDate(insAreaCompany.getSyStartDate());
+        insPlyIncome.setSyEndDate(insAreaCompany.getSyEndDate());
         this.saveByCompanyId(insFeeOrderNew ,insAreaCompany.getCompanyId(),insPlyIncome);
 
         baseMapper.insert(insPlyIncome);
@@ -261,6 +271,10 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         insPlyIncome.setSyOtherCostsProportion(insFeeOrderNew.getSyOtherCostsProportion());   //商业跟单费比例
         insPlyIncome.setSyOtherCostsPremium(insFeeOrderNew.getSyOtherCostsPremiums());
         insPlyIncome.setJqOtherCostsPremium(insFeeOrderNew.getJqOtherCostsPremiums());
+        insPlyIncome.setJqStartDate(insAreaCompany.getJqStartDate());
+        insPlyIncome.setJqEndDate(insAreaCompany.getJqEndDate());
+        insPlyIncome.setSyStartDate(insAreaCompany.getSyStartDate());
+        insPlyIncome.setSyEndDate(insAreaCompany.getSyEndDate());
         insPlyIncome.setUserId(insFeeOrderNew.getUserId());
         insPlyIncome.setInsuredName(order.getInsuredname());
         this.saveByCompanyId(insFeeOrderNew ,insAreaCompany.getCompanyId(),insPlyIncome);
@@ -288,6 +302,10 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         insPlyIncome.setTaxPremium(allTaxPremium);
         insPlyIncome.setUserId(insFeeOrderNew.getUserId());
         insPlyIncome.setInsuredName(order.getInsuredname());
+        insPlyIncome.setJqStartDate(insAreaCompany.getJqStartDate());
+        insPlyIncome.setJqEndDate(insAreaCompany.getJqEndDate());
+        insPlyIncome.setSyStartDate(insAreaCompany.getSyStartDate());
+        insPlyIncome.setSyEndDate(insAreaCompany.getSyEndDate());
         this.saveByCompanyId(insFeeOrderNew ,insAreaCompany.getCompanyId(),insPlyIncome);
         baseMapper.insert(insPlyIncome);
     }
@@ -357,6 +375,10 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         insPlyIncome.setSyNoTaxPremium(insFeeOrderNew.getSyNoTaxPremium());
         insPlyIncome.setNoNoTaxPremium(insFeeOrderNew.getNoNoTaxPremium());
         insPlyIncome.setUserId(insFeeOrderNew.getUserId());
+        insPlyIncome.setJqStartDate(insAreaCompany.getJqStartDate());
+        insPlyIncome.setJqEndDate(insAreaCompany.getJqEndDate());
+        insPlyIncome.setSyStartDate(insAreaCompany.getSyStartDate());
+        insPlyIncome.setSyEndDate(insAreaCompany.getSyEndDate());
         this.saveRiskCode(order.getProductid(),insPlyIncome);
         insPlyIncome.setInsuredName(order.getInsuredname());
         this.saveByCompanyId(insFeeOrderNew ,insAreaCompany.getCompanyId(),insPlyIncome);
@@ -426,7 +448,11 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
             params.put("pageNum",insPlyIncomeVo.getPageNum());
             params.put("pageSize",insPlyIncomeVo.getPageSize());
             params =this.saveParams(insPlyIncomeVo,params);
+            if(StringUtils.isNotEmpty(insPlyIncomeVo.getIds())){
+                params.put("ids",insPlyIncomeVo.getIds().split(","));
+            }
             List<InsPlyIncome> list= this.baseMapper.queryNew(params);
+
             pageHelper=new PageInfo(list);
             BasePageResult<InsPlyIncome> pageResult=new BasePageResult<InsPlyIncome>(insPlyIncomeVo.getPageNum(), insPlyIncomeVo.getPageSize(), pageHelper.getTotal(), pageHelper.getPages(), list);
             return HttpResult.ok(pageResult);
@@ -556,6 +582,32 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         if(StringUtils.isNotEmpty(insPlyIncomeVo.getDockingPerson())){
             params.put("dockingPerson",insPlyIncomeVo.getDockingPerson());
         }
+        if(StringUtils.isNotEmpty(insPlyIncomeVo.getYeartsStart()) &&  StringUtils.isNotEmpty(insPlyIncomeVo.getYeartsEnd())){
+            params.put("yeartsStart",insPlyIncomeVo.getYeartsStart());
+            params.put("yeartsEnd",insPlyIncomeVo.getYeartsEnd());
+        }
+        if(insPlyIncomeVo.getJqStartDate() !=null){
+            params.put("jqStartDate",insPlyIncomeVo.getJqStartDate());
+        }
+        if(insPlyIncomeVo.getJqStartDate() !=null){
+            params.put("jqEndDate",insPlyIncomeVo.getJqEndDate());
+        }
+        if(insPlyIncomeVo.getJqStartDate() !=null){
+            params.put("syStartDate",insPlyIncomeVo.getSyStartDate());
+        }
+        if(insPlyIncomeVo.getJqStartDate() !=null){
+            params.put("syEndDate",insPlyIncomeVo.getSyEndDate());
+        }
+        if( StringUtils.isNotEmpty(insPlyIncomeVo.getDeptId())){
+            params.put("deptId",insPlyIncomeVo.getDeptId());
+        }
+        if(!CollectionUtils.isEmpty(insPlyIncomeVo.getSelectIds())){
+            params.put("selectIds",insPlyIncomeVo.getSelectIds());
+        }
+        if(!CollectionUtils.isEmpty(insPlyIncomeVo.getPartnerCompaniesIdList())){
+            params.put("partnerCompaniesIdList",insPlyIncomeVo.getPartnerCompaniesIdList());
+        }
+
         return params;
     }
 
@@ -689,32 +741,92 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         ArrayList<HashMap<String, Object>> resultList = new ArrayList<>();
         HashMap<String, Object> resultMap = new HashMap<>();
         StringBuffer strBuilder = new StringBuffer();
+        boolean   open=true;
         String ids="";
         try {
             List<InsBxPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsBxPlyIncomeExcelDto.class, 0, 1, 1);
             Integer i=0;
             if(!CollectionUtils.isEmpty(dtoList)){
                 for (InsBxPlyIncomeExcelDto excelItem : dtoList) {
+                    String reason  ="";
                     i=i+1;
                     params.clear();
                     if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
                         String licenseno = excelItem.getLicenseno();//车牌号
                         params.put("licenseno",licenseno);
+                        InsPlyIncome byBxLicenseno = baseMapper.findByBxLicenseno(params);
+                        if(ObjectUtils.isEmpty(byBxLicenseno)){
+                            reason="该数据车牌号有问题";
+                        }
                     }
                     if(StringUtils.isNotEmpty(excelItem.getPolicyno())){
                         String policyno = excelItem.getPolicyno(); //交强保单号
                         params.put("policyno",policyno);
+                        InsPlyIncome byBxLicenseno = baseMapper.findByBxLicenseno(params);
+                        if(ObjectUtils.isEmpty(byBxLicenseno)){
+                            reason="该数据交强保单号有问题";
+                        }
                     }
 
                     if(StringUtils.isNotEmpty(excelItem.getSyPolicyno())){
                         String syPolicyno = excelItem.getSyPolicyno(); //商业保单号
                         params.put("syPolicyno",syPolicyno);
+                        InsPlyIncome byBxLicenseno = baseMapper.findByBxLicenseno(params);
+                        if(ObjectUtils.isEmpty(byBxLicenseno)){
+                            reason="该数据商业保单号有问题";
+                        }
                     }
+
+                    if(excelItem.getJqSuperviseCostsPremiums() !=null &&  excelItem.getJqSuperviseCostsPremiums().compareTo(BigDecimal.ZERO)!=0){
+                        params.put("jqSuperviseCostsPremiums",excelItem.getJqSuperviseCostsPremiums());
+                        InsPlyIncome byBxLicenseno = baseMapper.findByBxLicenseno(params);
+                        if(ObjectUtils.isEmpty(byBxLicenseno)){
+                            reason="该数据交强手续费金额有问题";
+                        }
+                    }
+                    if(excelItem.getJqSuperviseCostsProportion() !=null &&  excelItem.getJqSuperviseCostsProportion().compareTo(BigDecimal.ZERO)!=0){
+                        params.put("jqSuperviseCostsProportion",excelItem.getJqSuperviseCostsProportion());
+                        InsPlyIncome byBxLicenseno = baseMapper.findByBxLicenseno(params);
+                        if(ObjectUtils.isEmpty(byBxLicenseno)){
+                            reason="该数据交强手续费比例有问题";
+                        }
+                    }
+                    if(excelItem.getSySuperviseCostsProportion() !=null && excelItem.getSySuperviseCostsProportion().compareTo(BigDecimal.ZERO)!=0){
+                        params.put("sySuperviseCostsProportion",excelItem.getSySuperviseCostsProportion());
+                        InsPlyIncome byBxLicenseno = baseMapper.findByBxLicenseno(params);
+                        if(ObjectUtils.isEmpty(byBxLicenseno)){
+                            reason="该数据商业手续费比例有问题";
+                        }
+                    }
+
+                    if(excelItem.getSySuperviseCostsPremiums() !=null  && excelItem.getSySuperviseCostsPremiums().compareTo(BigDecimal.ZERO)!=0){
+                        params.put("sySuperviseCostsPremiums",excelItem.getSySuperviseCostsPremiums());
+                        InsPlyIncome byBxLicenseno = baseMapper.findByBxLicenseno(params);
+                        if(ObjectUtils.isEmpty(byBxLicenseno)){
+                            reason="该数据商业手续费金额有问题";
+                        }
+                    }
+                    if(excelItem.getJqPremium() !=null  && excelItem.getJqPremium().compareTo(BigDecimal.ZERO)!=0){
+                        params.put("jqPremium",excelItem.getJqPremium());
+                        InsPlyIncome byBxLicenseno = baseMapper.findByBxLicenseno(params);
+                        if(ObjectUtils.isEmpty(byBxLicenseno)){
+                            reason="该数据交强保费有问题";
+                        }
+                    }
+                    if(excelItem.getSyPremium()  !=null && excelItem.getSyPremium().compareTo(BigDecimal.ZERO)!=0){
+                        params.put("syPremium",excelItem.getSyPremium());
+                        InsPlyIncome byBxLicenseno = baseMapper.findByBxLicenseno(params);
+                        if(ObjectUtils.isEmpty(byBxLicenseno)){
+                            reason="该数据商业保费有问题";
+                        }
+                    }
+
 //                  只查手续费
                     params.put("isOther","0");
                     params.put("isNotCar",isNotCar);
                     InsPlyIncome insPlyIncome = baseMapper.findByBxLicenseno(params);
-                    if(i==dtoList.size()){
+                    if(ObjectUtils.isNotEmpty(insPlyIncome)  && open){
+                        open=false;
                         resultMap.put("companyId",insPlyIncome.getCompanyId()); // 保险公司id
                         resultMap.put("partnerCompaniesId",insPlyIncome.getPartnerCompaniesId()); //合作公司id
                         resultMap.put("agreementId",insPlyIncome.getAgreementId());  //协议id
@@ -737,6 +849,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                         }
                         resultList.add(noMatching);
                     }
+                    resultMap.put("reason",reason);
                 }
             }
             if(strBuilder.length() >0){
@@ -765,21 +878,53 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
             List<InsBxNoPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsBxNoPlyIncomeExcelDto.class, 0, 1, 1);
             if(!CollectionUtils.isEmpty(dtoList)){
                 for (InsBxNoPlyIncomeExcelDto excelItem : dtoList) {
+                    String  reason ="";
                     i=i+1;
                     params.clear();
                     if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
                         String licenseno = excelItem.getLicenseno();//车牌号
                         params.put("licenseno",licenseno);
+                        InsPlyIncome byBxLicenseno = baseMapper.findByBxLicenseno(params);
+                        if(ObjectUtils.isEmpty(byBxLicenseno)){
+                            reason="该数据车牌号有问题";
+                        }
                     }
                     if(StringUtils.isNotEmpty(excelItem.getNoPolicyno())){
                         String policyno = excelItem.getNoPolicyno(); //非车保单号
                         params.put("NoPolicyno",policyno);
+                        InsPlyIncome byBxLicenseno = baseMapper.findByBxLicenseno(params);
+                        if(ObjectUtils.isEmpty(byBxLicenseno)){
+                            reason="该数据非车保单号有问题";
+                        }
+                    }
+
+                    if(excelItem.getNoPremium() !=null && excelItem.getNoPremium().compareTo(BigDecimal.ZERO)!=0){
+                        params.put("noPolicyno",excelItem.getNoPremium());
+                        InsPlyIncome byBxLicenseno = baseMapper.findByBxLicenseno(params);
+                        if(ObjectUtils.isEmpty(byBxLicenseno)){
+                            reason="该数据非车保费有问题";
+                        }
+                    }
+
+                    if( excelItem.getNoSuperviseCostsPremiums()  !=null  && excelItem.getNoSuperviseCostsPremiums().compareTo(BigDecimal.ZERO)!=0){
+                        params.put("noSuperviseCostsPremiums",excelItem.getNoSuperviseCostsPremiums());
+                        InsPlyIncome byBxLicenseno = baseMapper.findByBxLicenseno(params);
+                        if(ObjectUtils.isEmpty(byBxLicenseno)){
+                            reason="该数据非车手续费有问题";
+                        }
+                    }
+                    if(excelItem.getNoSuperviseCostsProportion() != null   && excelItem.getNoSuperviseCostsProportion().compareTo(BigDecimal.ZERO)!=0){
+                        params.put("noSuperviseCostsProportion",excelItem.getNoSuperviseCostsProportion());
+                        InsPlyIncome byBxLicenseno = baseMapper.findByBxLicenseno(params);
+                        if(ObjectUtils.isEmpty(byBxLicenseno)){
+                            reason="该数据非车手续费比例有问题";
+                        }
                     }
 //                只查手续费
                     params.put("isOther","0");
                     params.put("isNotCar",isNotCar);
                     InsPlyIncome insPlyIncome = baseMapper.findByBxLicenseno(params);
-                    if(i==dtoList.size()){
+                    if(i==dtoList.size() && ObjectUtils.isNotEmpty(insPlyIncome)){
                         resultMap.put("companyId",insPlyIncome.getCompanyId()); // 保险公司id
                         resultMap.put("partnerCompaniesId",insPlyIncome.getPartnerCompaniesId()); //合作公司id
                         resultMap.put("agreementId",insPlyIncome.getAgreementId());  //协议id
@@ -799,6 +944,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                         }
                         resultList.add(noMatching);
                     }
+                    resultMap.put("reason",reason);
                 }
                 if(strBuilder.length() >0){
                     ids = strBuilder.deleteCharAt(strBuilder.length() - 1).toString();
@@ -919,6 +1065,8 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         return    baseMapper.getEntityById(id);
     }
 
+
+
     @Override
     @Transactional
     public void updateByEntity(InsPlyIncomeVo insPlyIncomeVo) {
@@ -1074,35 +1222,37 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         InsPlyIncome insPlyIncome = new InsPlyIncome();
         insPlyIncomeVo.setOrderno(id.toString());
         BeanUtils.copyProperties(insPlyIncomeVo, insPlyIncome);
+        insPlyIncome.setUserId(BaseController.getUser().getId());
         insPlyIncome.setDocumentaryFeesStatus("0");
         insPlyIncome.setHandlingFeesStatus("0");
-        insPlyIncome.setIsNotCar("0");
-        insPlyIncome.setIsNotDocumentary("1");
-        baseMapper.insert(insPlyIncome);
-        insPlyIncomeVo.setId(insPlyIncome.getId());
-        insPlyIncomeVo.setCrudStatus("1");
-        this.saveLog(insPlyIncomeVo);   //添加日志
-
-        HashMap<String, Object> params = new HashMap<>();
+        insPlyIncome.setIsNotCar(insPlyIncomeVo.getIsNotCar());   // 是否是非车
+        insPlyIncome.setIsNotDocumentary(insPlyIncomeVo.getIsNotDocumentary());  //是否是跟单
 
-        if(StringUtils.isNotEmpty(insPlyIncomeVo.getIsNotCar())){
-            params.put("isNotCar",insPlyIncomeVo.getIsNotCar());
-        }
-        params.put("isOther","1");
-        if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
-            params.put("year",insPlyIncomeVo.getYear());
-        }
-        if(StringUtils.isNotEmpty(insPlyIncomeVo.getCompanyId())){
-            params.put("companyId",insPlyIncomeVo.getCompanyId());
-        }
-
-        List<InsPlyIncome> list= this.baseMapper.NonSettlementQuery(params);
-        if(!CollectionUtils.isEmpty(list)){
-            for (InsPlyIncome item :list){
-                return HttpResult.ok(item.getIds());
-            }
-        }
-        return null;
+        baseMapper.insert(insPlyIncome);
+//        insPlyIncomeVo.setId(insPlyIncome.getId());
+//        insPlyIncomeVo.setCrudStatus("1");
+//        this.saveLog(insPlyIncomeVo);   //添加日志
+//
+//        HashMap<String, Object> params = new HashMap<>();
+//
+//        if(StringUtils.isNotEmpty(insPlyIncomeVo.getIsNotCar())){
+//            params.put("isNotCar",insPlyIncomeVo.getIsNotCar());
+//        }
+//        params.put("isOther","1");
+//        if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
+//            params.put("year",insPlyIncomeVo.getYear());
+//        }
+//        if(StringUtils.isNotEmpty(insPlyIncomeVo.getCompanyId())){
+//            params.put("companyId",insPlyIncomeVo.getCompanyId());
+//        }
+//
+//        List<InsPlyIncome> list= this.baseMapper.NonSettlementQuery(params);
+//        if(!CollectionUtils.isEmpty(list)){
+//            for (InsPlyIncome item :list){
+//                return HttpResult.ok(item.getIds());
+//            }
+//        }
+        return HttpResult.ok();
     }
 
     @Override
@@ -1347,10 +1497,11 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         settlementDocumentaryFeesVo.setIsNotCar(insPlyIncomeVo.getIsNotCar()); // 是否是非车
         settlementDocumentaryFeesVo.setInvoicingMethod(insPlyIncomeVo.getInvoicingMethod());  //开票方式
         settlementDocumentaryFeesVo.setTaxPoints(insPlyIncomeVo.getTaxPoints());  //税点
-        settlementDocumentaryFeesVo.setExpendAmount(insPlyIncomeVo.getExpendAmount()); //税点支出
+//        settlementDocumentaryFeesVo.setExpendAmount(insPlyIncomeVo.getExpendAmount()); //税点支出
         settlementDocumentaryFeesVo.setTotalAmount(insPlyIncomeVo.getInvoicCommissionFeevalue());
         settlementDocumentaryFeesVo.setHandlingFeesStatus("0");
         settlementDocumentaryFeesVo.setParentId(insPlyIncomeVo.getId());
+        settlementDocumentaryFeesVo.setSettlementImageId(insPlyIncomeVo.getSettlementImageId());
         settlementDocumentaryFeesVo.setCreateTime(LocalDate.now());
         settlementDocumentaryFeesVo.setAgreementType("2");  //1平台 2  保险
         settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
@@ -1444,8 +1595,8 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
     @Override
     @Transactional
     public HttpResult<Object> batchInvoic(InsPlyIncomeVo insPlyIncomeVo) {
-        //  通过ids 查出跟单非结算单
-        String ids = insPlyIncomeVo.getIds();
+                //  通过ids 查出跟单非结算单
+            String ids = insPlyIncomeVo.getIds();
 //        if(StringUtils.isNotEmpty(ids)){
 //            String[] split = ids.split(",");
 //            for (int i =0; i <split.length ; i++) {
@@ -1462,6 +1613,15 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
             settlementDocumentaryFeesVo.setTimeFrame(insPlyIncomeVo.getYear());//年度
         }
+        if(!CollectionUtils.isEmpty(insPlyIncomeVo.getMultipleSelection())){
+            InsPlyIncomeVo insPlyIncomeVo1 = insPlyIncomeVo.getMultipleSelection().get(0);
+            insPlyIncomeVo.setSettlementAmount(insPlyIncomeVo1.getSettlementAmount());
+            insPlyIncomeVo.setOtherFeevalue(insPlyIncomeVo1.getAllTotalOtherFeevalue());
+            YearMonth yearMonth = YearMonth.parse(insPlyIncomeVo1.getMonthYear());
+            LocalDate signingTime = yearMonth.atDay(1);
+            settlementDocumentaryFeesVo.setSigningTime(signingTime);
+
+        }
         if(StringUtils.isNotEmpty(insPlyIncomeVo.getYear())){
             settlementDocumentaryFeesVo.setYear(insPlyIncomeVo.getYear());
         }
@@ -1488,7 +1648,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         settlementDocumentaryFeesVo.setTaxPoints(insPlyIncomeVo.getTaxPoints()); //税点
         settlementDocumentaryFeesVo.setIds(insPlyIncomeVo.getIds());
         //  税点支出
-        if(BigDecimalUtils.nullToZero(insPlyIncomeVo.getTaxPoints()) !=null   && BigDecimalUtils.nullToZero(insPlyIncomeVo.getSettlementAmount()) !=null){
+        if(BigDecimalUtils.nullToZero(insPlyIncomeVo.getTaxPoints()) !=null && insPlyIncomeVo.getTaxPoints().compareTo(BigDecimal.ZERO) != 0   && BigDecimalUtils.nullToZero(insPlyIncomeVo.getSettlementAmount()) !=null){
             BigDecimal settlementAmount = insPlyIncomeVo.getSettlementAmount();
             settlementDocumentaryFeesVo.setExpendAmount(settlementAmount.multiply(BigDecimal.ONE.subtract(insPlyIncomeVo.getTaxPoints().divide(new BigDecimal(100)))));
         }
@@ -1592,7 +1752,78 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         InsPlyIncome totalledAmount =baseMapper.bxTotalAmount(params);  //总金额
         return totalledAmount;
     }
+    @Override
+    public HttpResult<List<HashMap<String,Object>>> otherTimeDetail(InsPlyIncomeVo insPlyIncomeVo) {
+        HashMap<String, Object> params = new HashMap<>();
+        this.saveParams(insPlyIncomeVo,params);
+        List<HashMap<String,Object>>  resultMap=baseMapper.otherTimeDetail(params);
+        return HttpResult.ok(resultMap);
+    }
+
+    @Override
+    public HttpResult<Object> singleInvoic(InsPlyIncomeVo insPlyIncomeVo) {
 
+        //  通过ids 查出跟单非结算单
+        SettlementDocumentaryFeesVo settlementDocumentaryFeesVo = new SettlementDocumentaryFeesVo();  // 生成跟单费结算表
+        if (!CollectionUtils.isEmpty(insPlyIncomeVo.getMultipleSelection())) {
+            for (InsPlyIncomeVo insPlyIncomeVo1 : insPlyIncomeVo.getMultipleSelection()) {
+                insPlyIncomeVo.setSettlementAmount(insPlyIncomeVo1.getSettlementAmount());
+                insPlyIncomeVo.setOtherFeevalue(insPlyIncomeVo1.getAllTotalOtherFeevalue());
+                YearMonth yearMonth = YearMonth.parse(insPlyIncomeVo1.getMonthYear());
+                LocalDate signingTime = yearMonth.atDay(1);
+                settlementDocumentaryFeesVo.setSigningTime(signingTime);
 
+            }
+        }
+        if (StringUtils.isNotEmpty(insPlyIncomeVo.getYear())) {
+            settlementDocumentaryFeesVo.setTimeFrame(insPlyIncomeVo.getYear());//年度
+        }
+        if (StringUtils.isNotEmpty(insPlyIncomeVo.getYear())) {
+            settlementDocumentaryFeesVo.setYear(insPlyIncomeVo.getYear());
+        }
+        if (StringUtils.isNotEmpty(insPlyIncomeVo.getMonth())) {
+            settlementDocumentaryFeesVo.setMonth(insPlyIncomeVo.getMonth());
+        }
+        if (StringUtils.isNotEmpty(insPlyIncomeVo.getDay())) {
+            settlementDocumentaryFeesVo.setDay(insPlyIncomeVo.getDay());
+        }
+        settlementDocumentaryFeesVo.setCompanyId(insPlyIncomeVo.getCompanyId());// 保险公司id
+        settlementDocumentaryFeesVo.setPartnerCompaniesId(insPlyIncomeVo.getPartnerCompaniesId());  //合作公司id
+        settlementDocumentaryFeesVo.setTotalAmount(insPlyIncomeVo.getOtherFeevalue());  //其他费用金额
+        settlementDocumentaryFeesVo.setUnsettledAmount(insPlyIncomeVo.getNoInvoicCommissionFeevalue().subtract(insPlyIncomeVo.getSettlementAmount())); //未结算
+        settlementDocumentaryFeesVo.setSettlementAmount(insPlyIncomeVo.getSettlementAmount());//已经开票
+        settlementDocumentaryFeesVo.setCreateTime(LocalDate.now());
+        settlementDocumentaryFeesVo.setIds(insPlyIncomeVo.getIncomeIds());
+        settlementDocumentaryFeesVo.setSettlementStatus("1");
+        settlementDocumentaryFeesVo.setIsNotCar(insPlyIncomeVo.getIsNotCar());
+        if (StringUtils.isNotEmpty(insPlyIncomeVo.getContractId())) {
+            settlementDocumentaryFeesVo.setInvoiceId(insPlyIncomeVo.getContractId());  //开票号
+        }
+        settlementDocumentaryFeesVo.setHandlingFeesStatus(insPlyIncomeVo.getHandlingFeesStatus());
+        settlementDocumentaryFeesVo.setInvoicingMethod(insPlyIncomeVo.getInvoicingMethod()); //开票方式
+        settlementDocumentaryFeesVo.setTaxPoints(insPlyIncomeVo.getTaxPoints()); //税点
+        settlementDocumentaryFeesVo.setIds(insPlyIncomeVo.getIds());
+        settlementDocumentaryFeesVo.setSigningTime(insPlyIncomeVo.getSettlementTime());   //签单日期
+        //  税点支出
+        if (BigDecimalUtils.nullToZero(insPlyIncomeVo.getTaxPoints()) != null && BigDecimalUtils.nullToZero(insPlyIncomeVo.getSettlementAmount()) != null) {
+            BigDecimal settlementAmount = insPlyIncomeVo.getSettlementAmount();
+            settlementDocumentaryFeesVo.setExpendAmount(settlementAmount.multiply(BigDecimal.ONE.subtract(insPlyIncomeVo.getTaxPoints().divide(new BigDecimal(100)))));
+        }
+        settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
+
+        return HttpResult.ok();
+    }
+
+    @Override
+    public void batchUpdate(InsPlyIncomeVo insPlyIncomeVo) {
+        HashMap<String, Object> params = new HashMap<>();
+        params=  this.saveParams(insPlyIncomeVo,params);
+        List<InsPlyIncome> list= this.baseMapper.queryNew(params);
+        for ( InsPlyIncome  item    : list){
+            item.setContractFileId( insPlyIncomeVo.getContractFileId());
+            item.setSettleOtherStatus("1");
+            baseMapper.updateById(item);
+        }
+    }
 
 }

+ 13 - 0
src/main/java/com/ydtech/modules/fnc/service/impl/SettlementDocumentaryFeesServiceImpl.java

@@ -169,6 +169,19 @@ public class SettlementDocumentaryFeesServiceImpl extends ServiceImpl<Settlement
         return baseMapper.getByParentSettlementAmount(id);
     }
 
+    /**
+     *  作废开票  settlementStatus  为3表示为作废开票
+     * @param settlementDocumentaryFeesVo
+     */
+    @Override
+    public void voidInvoicing(SettlementDocumentaryFeesVo settlementDocumentaryFeesVo) {
+        SettlementDocumentaryFeesEntity settlementDocumentaryFeesEntity = new SettlementDocumentaryFeesEntity();
+        BeanUtils.copyProperties(settlementDocumentaryFeesVo,settlementDocumentaryFeesEntity);
+        settlementDocumentaryFeesEntity.setSettlementStatus("3");  // 3  为作废
+        baseMapper.updateById(settlementDocumentaryFeesEntity);
+
+    }
+
     private int compareAmount(BigDecimal settlementAmount, BigDecimal settlementAmount1) {
 
         return settlementAmount.compareTo(settlementAmount1);

+ 39 - 0
src/main/java/com/ydtech/modules/fnc/vo/InsPlyIncomeVo.java

@@ -281,5 +281,44 @@ public class InsPlyIncomeVo implements Serializable {
 
     @ApiModelProperty("结算状态")
     private String settlementStatus;
+    @ApiModelProperty("签单日期年度开始")
+    private String yeartsStart;
+    @ApiModelProperty("签单日期年度结束")
+    private String yeartsEnd;
 
+    @ApiModelProperty("备注")
+    private String remarks;
+
+    @ApiModelProperty("交强险起期")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private String jqStartDate;
+
+    @ApiModelProperty("交强险止期")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private String jqEndDate;
+
+    @ApiModelProperty("商业险起期")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private String syStartDate;
+
+    @ApiModelProperty("商业险止期")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private String syEndDate;
+
+    @ApiModelProperty("月结开票")
+    private List<InsPlyIncomeVo> multipleSelection;
+
+    @ApiModelProperty("开票总额")
+    private BigDecimal allTotalOtherFeevalue;
+
+    @ApiModelProperty("签订日期")
+    private  String monthYear;
+
+    @ApiModelProperty("结算凭证")
+    private String settlementImageId;
+
+    @ApiModelProperty("跟单结算")
+    private String settleOtherStatus;
+    @ApiModelProperty("合作公司idList")
+    private List<String> partnerCompaniesIdList;
 }

+ 4 - 1
src/main/java/com/ydtech/modules/fnc/vo/SettlementDocumentaryFeesVo.java

@@ -64,7 +64,7 @@ public class SettlementDocumentaryFeesVo implements Serializable {
     @ApiModelProperty("签单日期")
     @JsonFormat(pattern = "yyyy-MM-dd")
     private LocalDate signingTime;
-    @ApiModelProperty("是否是开票 结算")
+    @ApiModelProperty("状态  1 开票 2结算 3作废")
     private String settlementStatus;
 
     @ApiModelProperty("结算ids")
@@ -108,4 +108,7 @@ public class SettlementDocumentaryFeesVo implements Serializable {
 
     @ApiModelProperty("协议类型")
     private String agreementType;
+
+    @ApiModelProperty("结算凭证")
+    private String settlementImageId;
 }

+ 22 - 0
src/main/java/com/ydtech/modules/inv/model/dto/InsBxNoPlyIncomeExcelDto.java

@@ -3,6 +3,8 @@ package com.ydtech.modules.inv.model.dto;
 import cn.afterturn.easypoi.excel.annotation.Excel;
 import lombok.Data;
 
+import java.math.BigDecimal;
+
 @Data
 public class InsBxNoPlyIncomeExcelDto {
     /**
@@ -15,4 +17,24 @@ public class InsBxNoPlyIncomeExcelDto {
      */
     @Excel(name = "非车保单号")
     private String noPolicyno;
+
+    /**
+     * 非车保费
+     */
+    @Excel(name = "非车保费")
+    private BigDecimal noPremium;
+
+    /**
+     * 非车手续费金额
+     */
+    @Excel(name = "非车手续费金额")
+    private BigDecimal noSuperviseCostsPremiums;
+
+    /**
+     * 非车手续费比例
+     */
+    @Excel(name = "非车手续费比例")
+    private BigDecimal noSuperviseCostsProportion;
+
+
 }

+ 42 - 0
src/main/java/com/ydtech/modules/inv/model/dto/InsBxPlyIncomeExcelDto.java

@@ -3,6 +3,8 @@ package com.ydtech.modules.inv.model.dto;
 import cn.afterturn.easypoi.excel.annotation.Excel;
 import lombok.Data;
 
+import java.math.BigDecimal;
+
 @Data
 public class InsBxPlyIncomeExcelDto {
     /**
@@ -22,4 +24,44 @@ public class InsBxPlyIncomeExcelDto {
     @Excel(name = "商业保单号")
     private String syPolicyno;
 
+
+    /**
+     * 交强手续费金额
+     */
+    @Excel(name = "交强手续费金额")
+    private BigDecimal jqSuperviseCostsPremiums;
+
+    /**
+     * 交强手续费比例
+     */
+    @Excel(name = "交强手续费比例")
+    private BigDecimal jqSuperviseCostsProportion;
+
+
+    /**
+     * 商业手续费金额
+     */
+    @Excel(name = "商业手续费金额")
+    private BigDecimal sySuperviseCostsPremiums;
+
+    /**
+     * 商业手续费比例
+     */
+    @Excel(name = "商业手续费比例")
+    private BigDecimal sySuperviseCostsProportion;
+
+    /**
+     * 交强保费
+     */
+    @Excel(name = "交强保费")
+    private BigDecimal jqPremium;
+
+
+    /**
+     * 商业保费
+     */
+    @Excel(name = "商业保费")
+    private BigDecimal syPremium;
+
+
 }

+ 1 - 1
src/main/java/com/ydtech/modules/message/service/impl/MessageSecretaryServiceImpl.java

@@ -65,7 +65,7 @@ public class MessageSecretaryServiceImpl extends ServiceImpl<MessageSecretaryMap
     @Override
     public boolean addMessage(MessageTypeConstants messageTypeConstants,String toUser,String content) {
         MessageSecretary messageSecretary = new MessageSecretary();
-        messageSecretary.setMsgType(messageTypeConstants.getDesc());
+        messageSecretary.setMsgType(messageTypeConstants.getCode().toString());
         messageSecretary.setFromUser("admin");
         messageSecretary.setToUser(toUser);
         messageSecretary.setContent(content);

+ 6 - 0
src/main/java/com/ydtech/modules/order/controller/OrderTaskImageController.java

@@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import javax.validation.constraints.NotBlank;
 import java.io.IOException;
 import java.util.Base64;
@@ -129,4 +130,9 @@ public class OrderTaskImageController extends BaseController {
         return HttpResult.ok(insUploadFiles);
     }
 
+
+
+
+
+
 }

+ 15 - 0
src/main/java/com/ydtech/modules/order/dao/InsAreaCompanyMapper.java

@@ -2,6 +2,7 @@ package com.ydtech.modules.order.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.modules.admin.model.vo.SubOrder;
 import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.dto.InsAreaCompanyQueryDto;
@@ -76,6 +77,20 @@ public interface InsAreaCompanyMapper extends BaseMapper<InsAreaCompany> {
      *  @Description: 通过子订单查询订单id
      */
     List<InsAreaCompany> selectListById(@Param("id") String id);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/3 11:44
+     *  @Description:  通过状态查询预收和实收的金额
+     */
+    InsOrders selectSecondPromotionByNew(HashMap<String, Object> params);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/3 15:25
+     *  @Description: 获取订单详情页面
+     */
+    SubOrder getSubOrderDetails(String subOrderId);
 }
 
 

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

@@ -120,4 +120,11 @@ public interface InsAreaCompanyService extends IService<InsAreaCompany> {
     *  @Description: 批量更新险种状态
     */
     HttpResult updateBatchPruductById(String subOrderId);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/3 11:41
+     *  @Description:  通过类型查询数据
+     */
+    InsOrders selectByInFeeOrderNewByType(InsFeeOrderNew insFeeOrderNew, String type);
 }

+ 2 - 0
src/main/java/com/ydtech/modules/order/service/InsUploadFilesService.java

@@ -2,11 +2,13 @@ package com.ydtech.modules.order.service;
 
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.order.entity.po.InsUploadFiles;
 import com.ydtech.modules.protocol.utils.AssertionUtils;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 
 /**

+ 24 - 4
src/main/java/com/ydtech/modules/order/service/impl/InsAreaCompanyServiceImpl.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
+import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.fnc.service.InsFeeAuditService;
 import com.ydtech.modules.ins.model.vo.KindInfoVo;
 import com.ydtech.modules.ins.model.vo.RiskInfoVo;
@@ -101,13 +102,13 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
         }
         //添加订单消息
         if(insAreaCompany.getOrderstatus().equals("1")){
-            messageSecretaryService.addMessage(MessageTypeConstants.M_3,insAreaCompany.getUserId(),"订单号"+insAreaCompany.getOrderno()+"待核保");
+            messageSecretaryService.addMessage(MessageTypeConstants.M_3, BaseController.getUser().getId(),"订单号"+insAreaCompany.getOrderno()+"待核保");
         }else if(insAreaCompany.getOrderstatus().equals("2")){
-            messageSecretaryService.addMessage(MessageTypeConstants.M_3,insAreaCompany.getUserId(),"订单号"+insAreaCompany.getOrderno()+"已核保待缴费");
+            messageSecretaryService.addMessage(MessageTypeConstants.M_3,BaseController.getUser().getId(),"订单号"+insAreaCompany.getOrderno()+"已核保待缴费");
         }else if(insAreaCompany.getOrderstatus().equals("3")){
-            messageSecretaryService.addMessage(MessageTypeConstants.M_3,insAreaCompany.getUserId(),"订单号"+insAreaCompany.getOrderno()+"已经承保成功");
+            messageSecretaryService.addMessage(MessageTypeConstants.M_3,BaseController.getUser().getId(),"订单号"+insAreaCompany.getOrderno()+"已经承保成功");
         }else if(insAreaCompany.getOrderstatus().equals("4")) {
-            messageSecretaryService.addMessage(MessageTypeConstants.M_3, insAreaCompany.getUserId(), "订单号" + insAreaCompany.getOrderno() + "核保退回");
+            messageSecretaryService.addMessage(MessageTypeConstants.M_3, BaseController.getUser().getId(), "订单号" + insAreaCompany.getOrderno() + "核保退回");
         }
         insOrdersTrackService.addingTrajectories(insAreaCompany);
         insOrdersService.updateByOrderStatus(insAreaCompany);
@@ -352,6 +353,25 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
         company.setProduct(insOrders.getProduct());
         return company;
     }
+
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/3 11:42
+     *  @Description: 通过状态查询预收和实收金额
+     */
+    @Override
+    public InsOrders selectByInFeeOrderNewByType(InsFeeOrderNew insFeeOrderNew, String type) {
+        HashMap<String, Object> params = new HashMap<>();
+        String userId = insFeeOrderNew.getUserId();
+        params.put("userId", userId);
+        if(StringUtils.isNotEmpty(insFeeOrderNew.getIsDetail())){
+            params.put("id",insFeeOrderNew.getId());
+        }
+        params.put("type", type);
+        return baseMapper.selectSecondPromotionByNew(params);
+    }
 }
 
 

+ 7 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsUploadFilesServiceImpl.java

@@ -1,9 +1,12 @@
 package com.ydtech.modules.order.service.impl;
 
 import cn.hutool.core.date.DateTime;
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.io.IoUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.constants.enums.FileType;
+import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.order.dao.InsUploadFilesMapper;
 import com.ydtech.modules.order.entity.po.InsUploadFiles;
@@ -19,11 +22,15 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
 
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.net.URI;
 import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.text.SimpleDateFormat;

+ 21 - 0
src/main/java/com/ydtech/modules/protocols/dao/InsFeeOrderNewMapper.java

@@ -29,6 +29,27 @@ public interface InsFeeOrderNewMapper extends BaseMapper<InsFeeOrderNew> {
     List<InsFeeOrderNew> getSumWillAmount(HashMap<String, Object> params);
 
     List<InsFeeOrderNew> getSumWillAmountGeneralization(HashMap<String, Object> params);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/3 12:01
+     *  @Description: 查询预收和实收的金额数据
+     */
+    List<InsFeeOrderNew> getByUserIdAndOrderStatusAndNoCheckType(String userId, String type);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/3 14:35
+     *  @Description: 查询订单数据
+     */
+    List<InsFeeOrderNew> getSumWillAmountGeneralizationNew(HashMap<String, Object> params);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/3 14:42
+     *  @Description: 查询订单数据
+     */
+    List<InsFeeOrderNew> getSumWillAmountNew(HashMap<String, Object> params);
 }
 
 

+ 4 - 2
src/main/java/com/ydtech/modules/protocols/entity/po/InsFeeOrderNew.java

@@ -3,6 +3,7 @@ package com.ydtech.modules.protocols.entity.po;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.AllArgsConstructor;
 import lombok.Data;
@@ -10,7 +11,7 @@ import lombok.NoArgsConstructor;
 import org.springframework.util.ObjectUtils;
 
 import java.math.BigDecimal;
-import java.time.LocalDate;
+import java.util.Date;
 
 /**
  * @author: tz
@@ -416,7 +417,8 @@ public class InsFeeOrderNew {
 
     @ApiModelProperty(value = "签单日期")
     @TableField(exist = false)
-    private LocalDate signingTime;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date signingTime;
 
     @ApiModelProperty(value = "车牌号")
     @TableField(exist = false)

+ 21 - 1
src/main/java/com/ydtech/modules/protocols/service/InsFeeOrderNewService.java

@@ -47,5 +47,25 @@ public interface InsFeeOrderNewService extends IService<InsFeeOrderNew> {
 
 
     List<InsFeeOrderNew> getSumWillAmountGeneralization(HashMap<String, Object> params);
-
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/3 12:00
+     *  @Description: 通过类型查询数据
+     */
+    List<InsFeeOrderNew> getByUserIdAndOrderStatusAndNoCheckType(String userId, String number);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/3 14:32
+     *  @Description:  查询跟单明细的数据
+     */
+    List<InsFeeOrderNew> getSumWillAmountGeneralizationNew(HashMap<String, Object> params);
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/3 14:41
+     *  @Description: 推广费
+     */
+    List<InsFeeOrderNew> getSumWillAmountNew(HashMap<String, Object> params);
 }

+ 20 - 0
src/main/java/com/ydtech/modules/protocols/service/impl/InsFeeOrderNewServiceImpl.java

@@ -82,4 +82,24 @@ public class InsFeeOrderNewServiceImpl extends ServiceImpl<InsFeeOrderNewMapper,
         return baseMapper.getSumWillAmountGeneralization(params);
 
     }
+
+    @Override
+    public List<InsFeeOrderNew> getByUserIdAndOrderStatusAndNoCheckType(String userId, String type) {
+        return baseMapper.getByUserIdAndOrderStatusAndNoCheckType(userId,type);
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2024/6/3 14:32
+     *  @Description: 获取跟单费用列表
+     */
+    @Override
+    public List<InsFeeOrderNew> getSumWillAmountGeneralizationNew(HashMap<String, Object> params) {
+        return baseMapper.getSumWillAmountGeneralizationNew(params);
+    }
+
+    @Override
+    public List<InsFeeOrderNew> getSumWillAmountNew(HashMap<String, Object> params) {
+        return baseMapper.getSumWillAmountNew(params);
+    }
 }

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

@@ -9,6 +9,69 @@
 
     <resultMap id="QueryChannelMap" type="com.ydtech.modules.esm.model.QueryChannel">
     </resultMap>
+
+    <select id="queryOrderCount" resultType="com.ydtech.modules.esm.model.vo.EsmUserPolicyVO">
+        select a.*,b.policynum as bjpolicynum,b.sumpremium as bjsumpremium from (
+
+        SELECT
+        su.id,
+        su.NAME as username,
+        count( iac.id ) AS policynum,
+        sum( iac.sumpremium ) AS sumpremium
+        FROM
+        ins_orders io
+        LEFT JOIN ins_area_company iac ON io.orderno = iac.orderno
+        LEFT JOIN sys_user su ON io.userid = su.id
+        WHERE
+        iac.orderstatus = 3
+        AND io.orderstatus = 3
+        AND io.createtime BETWEEN #{startDate} AND #{endDate}
+        AND io.userid in
+        <foreach item="item" index="index" collection="userList" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        GROUP BY
+        io.userid
+        ) a,
+        (SELECT
+        su.id,
+        su.NAME as username,
+        count( iac.id ) AS policynum,
+        sum( iac.sumpremium ) AS sumpremium
+        FROM
+        ins_orders io
+        LEFT JOIN ins_area_company iac ON io.orderno = iac.orderno
+        LEFT JOIN sys_user su ON io.userid = su.id
+        WHERE
+
+        io.createtime BETWEEN #{startDate} AND #{endDate}
+        AND io.userid in
+        <foreach item="item" index="index" collection="userList" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        GROUP BY
+        io.userid
+        )b
+        where a.id = b.id
+    </select>
+
+    <select id="queryOrderCountHz" resultType="com.ydtech.modules.esm.model.vo.EsmTeamPolicyVO">
+        SELECT
+            sum(sumpremium) sumpremium
+        FROM
+            ins_orders io
+                LEFT JOIN ins_area_company iac ON io.orderno = iac.orderno
+                LEFT JOIN sys_user su ON io.userid = su.id
+        WHERE
+            iac.orderstatus = 3
+          AND io.orderstatus = 3
+          AND io.createtime BETWEEN #{startDate} AND #{endDate}
+          AND io.userid in
+              <foreach item="item" index="index" collection="userList" open="(" separator="," close=")">
+                  #{item}
+              </foreach>
+    </select>
+
     <select id="getUserPage" resultMap="SysUserMap">
         SELECT
             su.*
@@ -63,6 +126,18 @@
         select u.id, u.name, u.mobile, u.status
         from t1
                  LEFT JOIN sys_user u on t1.id = u.id
+        <if test="managementQueryVo.userId != null and managementQueryVo.userId != ''">
+            AND sd.id = #{managementQueryVo.userId}
+        </if>
+        <if test="managementQueryVo.username != null and managementQueryVo.username != ''">
+            AND sd.id = #{managementQueryVo.username}
+        </if>
+        <if test="managementQueryVo.phoneNumber != null and managementQueryVo.phoneNumber != ''">
+            AND sd.id = #{managementQueryVo.phoneNumber}
+        </if>
+        <if test="managementQueryVo.authenticationStatus != null and managementQueryVo.authenticationStatus != ''">
+            AND sd.id = #{managementQueryVo.authenticationStatus}
+        </if>
     </select>
 
 

+ 261 - 8
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -69,6 +69,12 @@
         <result column="receivable_amount" property="receivableAmount"/>
         <result column="insured_name" property="insuredName"/>
         <result column="invoicing_method" property="invoicingMethod"/>
+        <result column="remarks" property="remarks"/>
+        <result column="jq_start_date" property="jqStartDate"/>
+        <result column="jq_end_date" property="jqEndDate"/>
+        <result column="sy_start_date" property="syStartDate"/>
+        <result column="sy_end_date" property="syEndDate"/>
+        <result column="settle_other_status" property="settleOtherStatus"/>
     </resultMap>
     <sql id="income_com">
                 a.id      as  "id",
@@ -133,6 +139,12 @@
                 a.receivable_amount  as  "receivableAmount",
                 a.invoic_time  as  "invoicTime",
                 a.insured_name  as  "insuredName",
+                a.remarks  as  "remarks",
+                a.jq_start_date  as  "jqStartDate",
+                a.jq_end_date  as  "jqEndDate",
+                a.sy_start_date  as  "syStartDate",
+                a.sy_end_date  as  "syEndDate",
+                a.settle_other_status  as  "settleOtherStatus",
                 a.user_id  as  "userId",
                 a.invoicing_method  as  "invoicingMethod",
                 a.create_time  as  "createTime"
@@ -186,6 +198,32 @@
                     and a.is_not_car =#{isNotCar}
                 </if>
 
+                <if test="deptId !=null  and  deptId  !=''">
+                    and pa.dept_id =#{deptId}
+                </if>
+
+
+                <if test="ids != null and ids != '' and ids.length > 0">
+                    and a.id in
+                    <foreach collection="ids" item="item" open="(" separator="," close=")">
+                        #{item}
+                    </foreach>
+                </if>
+
+                <if test="selectIds != null and selectIds != '' and selectIds.size() > 0">
+                    and a.id in
+                    <foreach collection="selectIds" item="item" open="(" separator="," close=")">
+                        #{item}
+                    </foreach>
+                </if>
+
+                <if test="partnerCompaniesIdList != null and partnerCompaniesIdList != '' and partnerCompaniesIdList.size() > 0">
+                    and a.partner_companies_id in
+                    <foreach collection="partnerCompaniesIdList" item="item" open="(" separator="," close=")">
+                        #{item}
+                    </foreach>
+                </if>
+
                 <if test="isOther !=null  and  isOther  !=''">
                     and a.is_not_documentary   =#{isOther}
                 </if>
@@ -238,6 +276,13 @@
                 <if test="insuredName !=null  and  insuredName !=''">
                   AND  a.insured_name =#{insuredName}
                 </if>
+                <if test="jqStartDate  !=null  and  jqStartDate  != ''  and  jqEndDate   != null  and  jqEndDate   !=''">
+                   AND a.jq_end_date BETWEEN #{jqStartDate} AND #{jqEndDate}  AND a.jq_start_date &gt; = #{jqStartDate}
+                </if>
+                <if test="syStartDate  !=null  and  syStartDate  != ''  and  syEndDate   != null  and  syEndDate   !=''">
+                   AND a.sy_start_date BETWEEN #{syStartDate} AND #{syEndDate}  AND a.sy_start_date &gt; = #{syStartDate}
+                </if>
+
             </where>
             ORDER  BY  a.create_time  desc
 
@@ -387,24 +432,52 @@
         <where>
             1=1
             <if test="licenseno !=null  and  licenseno !=''">
-                AND  a.licenseno=#{licenseno}
+                AND a.licenseno=#{licenseno}
             </if>
             <if test="policyno !=null  and  policyno !=''">
-              AND  a.policyno=#{policyno}
+                AND a.policyno=#{policyno}
             </if>
             <if test="syPolicyno !=null  and  syPolicyno !=''">
                 AND a.sy_policyno=#{syPolicyno}
             </if>
             <if test="noPolicyno !=null  and  noPolicyno !=''">
-               AND a.no_policyno=#{noPolicyno}
+                AND a.no_policyno=#{noPolicyno}
             </if>
             <if test="isOther !=null  and  isOther  !=''">
-                and a.is_not_documentary   =#{isOther}
+                and a.is_not_documentary =#{isOther}
             </if>
             <if test="isNotCar !=null  and  isNotCar  !=''">
                 and a.is_not_car =#{isNotCar}
             </if>
+            <if test="jqSuperviseCostsPremiums !=null  and  jqSuperviseCostsPremiums  !=''">
+                and a.jq_supervise_costs_premiums =#{jqSuperviseCostsPremiums}
+            </if>
+            <if test="jqSuperviseCostsProportion !=null  and  jqSuperviseCostsProportion  !=''">
+                and a.jq_supervise_costs_proportion =#{jqSuperviseCostsProportion}
+            </if>
+            <if test="sySuperviseCostsPremiums !=null  and  sySuperviseCostsPremiums  !=''">
+                and a.sy_supervise_costs_premiums =#{sySuperviseCostsPremiums}
+            </if>
+            <if test="sySuperviseCostsProportion !=null  and  sySuperviseCostsProportion  !=''">
+                and a.sy_supervise_costs_proportion =#{sySuperviseCostsProportion}
+            </if>
+            <if test="noSuperviseCostsPremiums !=null  and  noSuperviseCostsPremiums  !=''">
+                and a.no_supervise_costs_premiums =#{noSuperviseCostsPremiums}
+            </if>
+            <if test="noSuperviseCostsProportion !=null  and  noSuperviseCostsProportion  !=''">
+                and a.no_supervise_costs_proportion =#{noSuperviseCostsProportion}
+            </if>
+            <if test="jqPremium !=null  and  jqPremium  !=''">
+                and a.jq_premium =#{jqPremium}
+            </if>
+            <if test="syPremium !=null  and  syPremium  !=''">
+                and a.sy_premium =#{jqPremium}
+            </if>
+            <if test="noPremium !=null  and  noPremium  !=''">
+                and a.no_premium =#{noPremium}
+            </if>
         </where>
+        limit 1
     </select>
 
     <select id="totalAmount" resultType="java.util.HashMap">
@@ -552,6 +625,12 @@
                 <if test="isNotCar !=null  and  isNotCar  !=''">
                     and a.is_not_car =#{isNotCar}
                 </if>
+                <if test="jqStartDate  !=null  and  jqStartDate  != ''  and  jqEndDate   != null  and  jqEndDate   !=''">
+                    AND a.jq_end_date BETWEEN #{jqStartDate} AND #{jqEndDate}  AND a.jq_start_date &gt; = #{jqStartDate}
+                </if>
+                <if test="syStartDate  !=null  and  syStartDate  != ''  and  syEndDate   != null  and  syEndDate   !=''">
+                    AND a.sy_start_date BETWEEN #{syStartDate} AND #{syEndDate}  AND a.sy_start_date &gt; = #{syStartDate}
+                </if>
 
                 <if test="isOther !=null  and  isOther  !=''">
                     and a.is_not_documentary   =#{isOther}
@@ -560,6 +639,24 @@
                     and a.licenseno  =#{licenseno}
                 </if>
 
+                <if test="deptId !=null  and  deptId  !=''">
+                    and pa.dept_id =#{deptId}
+                </if>
+
+
+                <if test="ids != null and ids != '' and ids.length > 0">
+                    and a.id in
+                    <foreach collection="ids" item="item" open="(" separator="," close=")">
+                        #{item}
+                    </foreach>
+                </if>
+
+                <if test="selectIds != null and selectIds != '' and selectIds.size() > 0">
+                    and a.id in
+                    <foreach collection="selectIds" item="item" open="(" separator="," close=")">
+                        #{item}
+                    </foreach>
+                </if>
                 <if test="syPolicyno != null and syPolicyno != ''  ">
                     and a.sy_policyno =#{syPolicyno}
                 </if>
@@ -606,6 +703,12 @@
                 <if test="insuredName !=null  and  insuredName !=''">
                     AND  a.insured_name =#{insuredName}
                 </if>
+                <if test="partnerCompaniesIdList != null and partnerCompaniesIdList != '' and partnerCompaniesIdList.size() > 0">
+                    and a.partner_companies_id in
+                    <foreach collection="partnerCompaniesIdList" item="item" open="(" separator="," close=")">
+                        #{item}
+                    </foreach>
+                </if>
             </where>
     </select>
 
@@ -737,11 +840,17 @@
         MAX( a.company_name ) AS "companyName",
         MAX( a.company_id ) AS "companyId",
         MAX( a.partner_companies_name ) AS "partnerCompaniesName",
-        IFNULL ( max(c.settleMentAmount),0.00) as  "allInvoicCommissionFeevalue",
+        CASE
+        WHEN (IFNULL(MAX(d.settleMentAmount), 0.00) - IFNULL(MAX(f.settleMentAmount), 0.00)) = 0.00
+        THEN   IFNULL ( MAX(d.settleMentAmount) ,0.00)
+        ELSE (IFNULL(MAX(d.settleMentAmount), 0.00) - IFNULL(MAX(f.settleMentAmount), 0.00))
+        END AS "allInvoicCommissionFeevalue",
         IFNULL(max(f.settleMentAmount) , 0.00)  as  "readyCommissionFeevalue",
         IFNULL ( max(d.settleMentAmount),0.00) as "invoicCommissionFeevalue",
-        sum(COALESCE( a.commission_feevalue,0.00) )-COALESCE(max(c.settleMentAmount),0.00)  as "noInvoicCommissionFeevalue",
+        sum(COALESCE( a.commission_feevalue,0.00) )-IFNULL ( max(d.settleMentAmount),0.00)  as "noInvoicCommissionFeevalue",
         sum(COALESCE( a.commission_feevalue,0.00) )-COALESCE(max(c.settleMentAmount),0.00)+IFNULL ( max(d.settleMentAmount),0.00)  AS "unSettledAmount",
+        IFNULL(MAX(f.expendAmount),0.00) as   "expendAmount",
+        MAX(COALESCE( f.settleMentAmount,0.00) )-IFNULL ( max(f.expendAmount),0.00)  as "taxesFees",
         sum( a.commission_feevalue ) AS "commissionFeevalue"
         FROM
         ins_ply_income a
@@ -765,7 +874,7 @@
         GROUP BY partner_companies_id
         ) d ON d.partnerCompaniesId = a.partner_companies_id
         LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId",sum(
-        settlement_amount ) AS "settleMentAmount" FROM settlement_documentary_fees a
+        settlement_amount ) AS "settleMentAmount" , sum(a.expend_amount) as  "expendAmount", sum(a.tax_points ) as "taxPoints" FROM settlement_documentary_fees a
         WHERE a.settlement_status = '2'
         and  a.handling_fees_status ='0'
         <if test="isNotCar !=null  and  isNotCar  !=''">
@@ -848,6 +957,8 @@
         IFNULL ( max(d.settleMentAmount),0.00)-IFNULL(max(f.settleMentAmount) , 0.00)  as "invoicCommissionFeevalue",
         sum(COALESCE( a.other_feevalue,0.00) )-IFNULL ( max(d.settleMentAmount),0.00)  as "noInvoicCommissionFeevalue",
         sum(COALESCE( a.other_feevalue,0.00) )-COALESCE(max(c.settleMentAmount),0.00)+IFNULL ( max(d.settleMentAmount),0.00)  AS "unSettledAmount",
+        MAX( f.expendAmount ) AS "expendAmount",
+        MAX( f.taxPoints ) AS "taxPoints",
         sum( a.other_feevalue ) AS "otherFeevalue"
         FROM
         ins_ply_income a
@@ -871,7 +982,7 @@
         GROUP BY partner_companies_id
         ) d ON d.partnerCompaniesId = a.partner_companies_id
         LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId",sum(
-        settlement_amount ) AS "settleMentAmount" FROM settlement_documentary_fees a
+        settlement_amount ) AS "settleMentAmount",  sum(a.expend_amount) as  "expendAmount"  , sum(a.tax_points) as "taxPoints"  FROM settlement_documentary_fees a
         WHERE a.settlement_status = '2'
           and  a.handling_fees_status ='1'
         <if test="isNotCar !=null  and  isNotCar  !=''">
@@ -1084,5 +1195,147 @@
             </if>
         </where>
     </update>
+    <select id="otherTimeDetail"  resultType="java.util.HashMap">
+        WITH RECURSIVE months AS (
+        SELECT 1 AS month_num
+        UNION ALL
+        SELECT month_num + 1 FROM months WHERE month_num &lt; 12
+        )
+        SELECT
+        m.month_num AS monthNumber,
+        DATE_FORMAT(STR_TO_DATE(CONCAT(YEAR(CURDATE()), '-', LPAD(m.month_num, 2, '0'), '-01'), '%Y-%m-%d'), '%Y-%m') AS monthYear,
+        COALESCE(other_fees.total_other_feevalue, 0) AS "allTotalOtherFeevalue",
+        COALESCE(settlement_fees.total_settlement_amount, 0) AS "invoicCommissionFeevalue",
+        COALESCE(other_fees.total_other_feevalue, 0) -  COALESCE(settlement_fees.total_settlement_amount, 0) AS "noInvoicCommissionFeevalue"
+        FROM
+        months m
+        LEFT JOIN (
+        SELECT
+        MONTH(a.signdate) AS month_num,
+        SUM(a.other_feevalue) AS total_other_feevalue
+        FROM
+        `ins_ply_income` a
+        INNER JOIN ptl_agreement pa ON a.agreement_id = pa.id
+        <where>
+            1=1
+            <if test="startDate !=null  and  startDate!='' and  endDate !=null and endDate !=''">
+                and DATE_FORMAT( a.signdate, '%Y-%m-%d')  between DATE_FORMAT(#{startDate}, '%Y-%m-%d') and DATE_FORMAT(#{endDate}, '%Y-%m-%d')
+            </if>
+            <if test="agreementType !=null  and  agreementType  !=''">
+                and pa.agreement_type =#{agreementType}
+            </if>
+
+            <if test="signDateEnd !=null  and  signDateEnd!='' and  signDateStart !=null and signDateStart !=''">
+                and a.signdate   between #{signDateStart} and #{signDateEnd}
+            </if>
+
+            <if test="handlingFeesStatus !=null  and  handlingFeesStatus  !=''">
+                and a.handling_fees_status =#{handlingFeesStatus}
+            </if>
+
+            <if test="dockingPerson !=null  and  dockingPerson  !=''">
+                and  pa.docking_person  =#{dockingPerson}
+            </if>
+
+            <if test="orderno !=null  and  orderno  !=''">
+                and a.orderno =#{orderno}
+            </if>
+            <if test="companyName !=null  and  companyName  !=''">
+                and a.company_id =#{companyName}
+            </if>
+
+            <if test="policyno !=null  and  policyno  !=''">
+                and a.policyno =#{policyno}
+            </if>
+            <if test="documentaryFeesStatus !=null  and  documentaryFeesStatus  !=''">
+                and a.documentary_fees_status =#{documentaryFeesStatus}
+            </if>
+
+            <if test="isNotCar !=null  and  isNotCar  !=''">
+                and a.is_not_car =#{isNotCar}
+            </if>
+
+            <if test="isOther !=null  and  isOther  !=''">
+                and a.is_not_documentary   =#{isOther}
+            </if>
+            <if test="licenseno != null and licenseno != ''">
+                and a.licenseno  =#{licenseno}
+            </if>
+            <if test="syPolicyno != null and syPolicyno != ''">
+                and a.sy_policyno  =#{syPolicyno}
+            </if>
+
+            <if test="noPolicyno != null and noPolicyno != ''">
+                and a.no_policyno =#{noPolicyno}
+            </if>
+            <if test="signdate !=null  and  signdate  !=''">
+                AND  a.signdate =#{signdate}
+            </if>
+            <if test="partnerCompaniesId !=null  and  partnerCompaniesId  !=''">
+                AND a.partner_companies_id =#{partnerCompaniesId}
+            </if>
+
+            <if test="partnerCompaniesName !=null  and  partnerCompaniesName  !=''">
+                AND   a.partner_companies_name =#{partnerCompaniesName}
+            </if>
+
+            <if test="createTime !=null  and  createTime  !=''">
+                AND  a.create_time =#{createTime}
+            </if>
+            <if test="settlementTime !=null  and  settlementTime  !=''">
+                AND a.settlement_time =#{settlementTime}
+            </if>
+
+            <if test="userId !=null  and  userId  !=''">
+                and a.userId   =#{userId}
+            </if>
+            <if test="companyId !=null  and  companyId  !=''">
+                and a.company_id   =#{companyId}
+            </if>
+            <if test="riskcode !=null  and  riskcode  !=''">
+                and a.riskcode   =#{riskcode}
+            </if>
+            <if test="year !=null  and  year  !=''">
+                AND YEAR(a.signdate) =#{year}
+            </if>
+            <if test="yeartsStart !=null and  yeartsStart  !=''   and yeartsEnd  !=null  and  yeartsEnd!=''">
+                and DATE_FORMAT( a.signdate, '%Y')  between #{yeartsStart}   and  #{yeartsEnd}
+            </if>
+            <if test="month !=null  and  month !=''">
+                AND month(a.signdate) =#{month}
+            </if>
+            <if test="day !=null  and  day !=''">
+                AND day(a.signdate) =#{day}
+            </if>
+            <if test="insuredName !=null  and  insuredName !=''">
+                AND  a.insured_name =#{insuredName}
+            </if>
+
+            AND YEAR(a.signdate) = YEAR(CURDATE())
+        </where>
+        GROUP BY
+        MONTH(a.signdate)
+        ) other_fees ON m.month_num = other_fees.month_num
+        LEFT JOIN (
+        SELECT
+        MONTH(signing_time) AS month_num,
+        SUM(settlement_amount) AS total_settlement_amount
+        FROM
+        settlement_documentary_fees
+        WHERE
+        settlement_status = '1'
+        AND handling_fees_status = '1'
+        <if test="isNotCar !=null  and  isNotCar  !=''">
+            and is_not_car =#{isNotCar}
+        </if>
+        <if test="yeartsStart !=null and  yeartsStart  !=''   and yeartsEnd  !=null  and  yeartsEnd!=''">
+            and DATE_FORMAT( signing_time, '%Y')  between #{yeartsStart}   and  #{yeartsEnd}
+        </if>
+        GROUP BY
+        MONTH(signing_time)
+        ) settlement_fees ON m.month_num = settlement_fees.month_num
+        ORDER BY
+        m.month_num;
+    </select>
 
 </mapper>

+ 5 - 0
src/main/resources/mapper/modules/fnc/SettlementDocumentaryFeesMapper.xml

@@ -27,6 +27,8 @@
         <result column="parent_id" property="parentId"/>
         <result column="handling_fees_status" property="handlingFeesStatus"/>
         <result column="agreement_type" property="agreementType"/>
+        <result column="settlement_status" property="settlementStatus"/>
+        <result column="settlement_image_id" property="settlementImageId"/>
     </resultMap>
 
 
@@ -50,8 +52,11 @@
             a.handling_fees_status as "handlingFeesStatus",
             a.agreement_type as "agreementType",
             a.settlement_time as "settlementTime",
+            a.settlement_image_id as "settlementImageId",
+            upf.url as "imageUrl",
             a.unsettled_amount as "unsettledAmount"
             from  settlement_documentary_fees  a
+            LEFT  JOIN   ins_upload_files  upf   on  a.settlement_image_id=upf.id
         <where>
             1=1
             <if test="partnerCompaniesId !=null  and  partnerCompaniesId  !=''">

+ 182 - 2
src/main/resources/mapper/modules/ins/InsFeeOrderNewMapper.xml

@@ -324,7 +324,187 @@
         </where>
         ) AS fee
     </select>
+    <select id="getByUserIdAndOrderStatusAndNoCheckType"
+            resultType="com.ydtech.modules.protocols.entity.po.InsFeeOrderNew">
+        select a.*  from
+            ins_fee_order_new a  left join ins_area_company ins  on  a.ins_order_no=ins.id
+        WHERE
+            a.user_id = #{userId}
+          and  ins.orderstatus ='3'
+          and a.ins_order_no
+          <if test="type=='1'">
+             not
+          </if>
+           in
+           (select ins_order_no from ins_fee_audit)
+    </select>
+    <select id="getSumWillAmountGeneralizationNew"
+            resultType="com.ydtech.modules.protocols.entity.po.InsFeeOrderNew">
+        SELECT
+        fee.id,
+        fee.userId,
+        fee.signingTime,
+        fee.licenseno,
+        fee.jqExportSuperviseCostsPremiums,
+        fee.syExportSuperviseCostsPremiums,
+        fee.noExportSuperviseCostsPremiums,
+        fee.jqExportOtherCostsPremiums,
+        fee.syExportOtherCostsPremiums,
+        fee.noExportOtherCostsPremiums,
+        fee.willAmount
+        FROM
+        (
+        SELECT
+        a.ins_order_no as "id",
+        a.user_id as "userId",
+        iac.signing_time as "signingTime",
+        o.licenseno as "licenseno",
+        a.jq_export_supervise_costs_premiums as "jqExportSuperviseCostsPremiums",
+        a.sy_export_supervise_costs_premiums as "syExportSuperviseCostsPremiums",
+        a.no_export_supervise_costs_premiums as "noExportSuperviseCostsPremiums",
+        a.jq_export_other_costs_premiums as "jqExportOtherCostsPremiums",
+        a.sy_export_other_costs_premiums as "syExportOtherCostsPremiums",
+        a.no_export_other_costs_premiums as "noExportOtherCostsPremiums",
+        a.first_detail_premiums as "willAmount"
+        FROM
+        ins_fee_order_new a
+        LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
+        left join  ins_orders o ON o.orderno=iac.orderno
+        <where>
+            <if test='type == "1"'>
+                NOT
+            </if>
+            EXISTS (SELECT ins_order_no FROM ins_fee_audit fee where fee.ins_order_no =a.ins_order_no)
+            and iac.orderstatus = '3'
+            <if test="userId!=null and  userId!= ''">
+                AND a.first_level_user_id = #{userId}
+            </if>
+            <if test="timeFiltering!= null  and  timeFiltering  !=''">
+                <choose>
+                    <when  test="type=='1'">
+                        AND DATE_FORMAT(iac.signing_time, '%Y-%m' ) = #{timeFiltering}
+                    </when>
+                    <otherwise>
+                        AND DATE_FORMAT(iac.signing_time, '%Y-%m-%d' ) = #{timeFiltering}
+                    </otherwise>
+                </choose>
+            </if>
+        </where>
+        UNION
+        SELECT
+        a.ins_order_no as "id",
+        a.user_id as "userId",
+        iac.signing_time as "signingTime",
+        o.licenseno as "licenseno",
+        a.jq_export_supervise_costs_premiums as "jqExportSuperviseCostsPremiums",
+        a.sy_export_supervise_costs_premiums as "syExportSuperviseCostsPremiums",
+        a.no_export_supervise_costs_premiums as "noExportSuperviseCostsPremiums",
+        a.jq_export_other_costs_premiums as "jqExportOtherCostsPremiums",
+        a.sy_export_other_costs_premiums as "syExportOtherCostsPremiums",
+        a.no_export_other_costs_premiums as "noExportOtherCostsPremiums",
+        a.third_detail_premiums as "willAmount"
+        FROM
+        ins_fee_order_new a
+        LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
+        left join  ins_orders o ON o.orderno=iac.orderno
+        <where>
+            <if test='type == "1"'>
+                NOT
+            </if>
+            EXISTS (SELECT ins_order_no FROM ins_fee_audit fee where fee.ins_order_no =a.ins_order_no)
+            and iac.orderstatus = '3'
+            <if test="userId!=null and  userId!= ''">
+                AND a.three_level_user_id = #{userId}
+            </if>
+            <if test="timeFiltering!= null  and  timeFiltering  !=''">
+                <choose>
+                    <when  test="type=='1'">
+                        AND DATE_FORMAT(iac.signing_time, '%Y-%m' ) = #{timeFiltering}
+                    </when>
+                    <otherwise>
+                        AND DATE_FORMAT(iac.signing_time, '%Y-%m-%d' ) = #{timeFiltering}
+                    </otherwise>
+                </choose>
+            </if>
+        </where>
+        UNION
+        SELECT
+        a.ins_order_no as "id",
+        a.user_id as "userId",
+        iac.signing_time as "signingTime",
+        o.licenseno as "licenseno",
+        a.jq_export_supervise_costs_premiums as "jqExportSuperviseCostsPremiums",
+        a.sy_export_supervise_costs_premiums as "syExportSuperviseCostsPremiums",
+        a.no_export_supervise_costs_premiums as "noExportSuperviseCostsPremiums",
+        a.jq_export_other_costs_premiums as "jqExportOtherCostsPremiums",
+        a.sy_export_other_costs_premiums as "syExportOtherCostsPremiums",
+        a.no_export_other_costs_premiums as "noExportOtherCostsPremiums",
+        a.second_detail_premiums as "willAmount"
+        FROM
+        ins_fee_order_new a
+        LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
+        left join  ins_orders o ON o.orderno=iac.orderno
+        <where>
+            <if test='type == "1"'>
+                NOT
+            </if>
+            EXISTS (SELECT ins_order_no FROM ins_fee_audit fee where fee.ins_order_no =a.ins_order_no)
+            and iac.orderstatus = '3'
+            <if test="userId!=null and  userId!= ''">
+                AND a.two_level_user_id = #{userId}
+            </if>
+            <if test="timeFiltering!= null  and  timeFiltering  !=''">
+                <choose>
+                    <when  test="type=='1'">
+                        AND DATE_FORMAT(iac.signing_time, '%Y-%m' ) = #{timeFiltering}
+                    </when>
+                    <otherwise>
+                        AND DATE_FORMAT(iac.signing_time, '%Y-%m-%d' ) = #{timeFiltering}
+                    </otherwise>
+                </choose>
+            </if>
+        </where>
+        ) AS fee
+    </select>
 
-
-
+    <select id="getSumWillAmountNew"  resultType="com.ydtech.modules.protocols.entity.po.InsFeeOrderNew">
+        select
+        a.ins_order_no as "id",
+        a.user_id as "userId",
+        ins.signing_time as "signingTime",
+        o.licenseno as "licenseno",
+        a.jq_export_supervise_costs_premiums as "jqExportSuperviseCostsPremiums",
+        a.sy_export_supervise_costs_premiums as "syExportSuperviseCostsPremiums",
+        a.no_export_supervise_costs_premiums as "noExportSuperviseCostsPremiums",
+        a.jq_export_other_costs_premiums as "jqExportOtherCostsPremiums",
+        a.sy_export_other_costs_premiums as "syExportOtherCostsPremiums",
+        a.no_export_other_costs_premiums as "noExportOtherCostsPremiums"
+        from
+        ins_fee_order_new a  left join ins_area_company ins  on  a.ins_order_no=ins.id
+        left join  ins_orders o ON o.orderno=ins.orderno
+        <where>
+            <if test="userId !=null  and  userId !=''">
+                a.user_id = #{userId}
+            </if>
+            and  ins.orderstatus ='3'
+            and
+            <if test='type == "1"'>
+                NOT
+            </if>
+            EXISTS (SELECT ins_order_no FROM ins_fee_audit fee where fee.ins_order_no =a.ins_order_no)
+            <if test="timeFiltering!= null  and  timeFiltering  !=''">
+                <choose>
+                    <when  test='type == "1"'>
+                        AND DATE_FORMAT(ins.signing_time, '%Y-%m' ) = #{timeFiltering}
+                    </when>
+                    <otherwise>
+                        AND DATE_FORMAT(ins.signing_time, '%Y-%m-%d' ) = #{timeFiltering}
+                    </otherwise>
+                </choose>
+            </if>
+            <if test="amountType !=null  and amountType !=''  and amountType == 3 ">
+                and  (a.first_level_user_id is not  null   or  a.two_level_user_id is not null  or  a.three_level_user_id is  not  null )
+            </if>
+        </where>
+    </select>
 </mapper>

+ 82 - 1
src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

@@ -486,7 +486,7 @@
            iac.*
         FROM
            ins_area_company iac
-        JOIN ins_orders AS io  ON io.orderno = iac.orderno
+         left JOIN ins_orders AS io  ON io.orderno = iac.orderno
         WHERE
         1=1
         <if test="dateStr != null and dateStr != ''">
@@ -505,4 +505,85 @@
             AND iac.id =#{id}
         </if>
     </select>
+    <select id="selectSecondPromotionByNew" resultType="com.ydtech.modules.order.entity.InsOrders">
+        SELECT
+        sum( fee.p ) as  "willFirstPremiums"
+        FROM
+        (
+        SELECT
+        sum( a.first_detail_premiums ) AS p
+        FROM
+        ins_fee_order_new a
+        LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
+        <where>
+            <if test='type == "1"'>
+                NOT
+            </if>
+            EXISTS
+            ( SELECT ins_order_no FROM ins_fee_audit AS b WHERE b.ins_order_no = a.ins_order_no )
+            and iac.orderstatus = '3'
+            <if test="userId!=null and  userId!= ''">
+                AND a.first_level_user_id = #{userId}
+            </if>
+            <if test="id  != null  and  id!=''">
+                AND  a.id =#{id}
+            </if>
+        </where>
+        UNION
+        SELECT
+        sum( a.third_detail_premiums ) AS p
+        FROM
+        ins_fee_order_new a
+        LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
+        <where>
+            <if test='type == "1"'>
+                NOT
+            </if>
+            EXISTS ( SELECT ins_order_no FROM ins_fee_audit AS b WHERE b.ins_order_no = a.ins_order_no )
+            and iac.orderstatus = '3'
+            <if test="userId!=null and  userId!= ''">
+                AND a.three_level_user_id = #{userId}
+            </if>
+            <if test="id  != null  and  id!=''">
+                AND  a.id =#{id}
+            </if>
+        </where>
+        UNION
+        SELECT
+        sum( a.second_detail_premiums ) AS p
+        FROM
+        ins_fee_order_new a
+        LEFT JOIN ins_area_company iac ON iac.id = a.ins_order_no
+        <where>
+            <if test='type == "1"'>
+                NOT
+            </if>
+            EXISTS ( SELECT ins_order_no FROM ins_fee_audit AS b WHERE b.ins_order_no = a.ins_order_no )
+            and iac.orderstatus = '3'
+            <if test="userId!=null and  userId!= ''">
+                AND a.two_level_user_id = #{userId}
+            </if>
+            <if test="id  != null  and  id!=''">
+                AND  a.id =#{id}
+            </if>
+        </where>
+        ) AS fee
+    </select>
+
+
+    <select id="getSubOrderDetails" resultType="com.ydtech.modules.admin.model.vo.SubOrder">
+        SELECT
+            iac.id as subOrderId,
+            iac.signing_time    as signingTime,
+            iac.jqpremium  as  jqpremium,
+            iac.sypremium  as  sypremium,
+            iac.jypremium  as  jypremium,
+            io.licenseno  as  licenseno,
+            io.userid as userId
+        FROM
+            ins_area_company iac
+            LEFT  JOIN ins_orders AS io  ON io.orderno = iac.orderno
+        WHERE
+            iac.id=#{subOrderId}
+    </select>
 </mapper>

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

@@ -413,10 +413,10 @@
             and b.orderstatus = #{orderstatus}
         </if>
         <if test="startDate != null ">
-            and a.createtime &gt;= #{startDate}
+            and b.signing_time &gt;= #{startDate}
         </if>
         <if test="endDate != null ">
-            and a.createtime &lt;= #{endDate}
+            and b.signing_time &lt;= #{endDate}
         </if>
     </select>
 

BIN
src/main/resources/template/handlingFeeTemplate.xlsx


BIN
src/main/resources/template/noHandlingFeeTemplate.xlsx