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

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

# Conflicts:
#	src/main/java/com/ydtech/modules/inv/model/InvAccount.java
wks 2 жил өмнө
parent
commit
b4ed16b6e7
30 өөрчлөгдсөн 1761 нэмэгдсэн , 97 устгасан
  1. 81 0
      src/main/java/com/ydtech/modules/inv/controller/InvChannelAccountController.java
  2. 119 0
      src/main/java/com/ydtech/modules/inv/controller/InvReceivableController.java
  3. 33 1
      src/main/java/com/ydtech/modules/inv/controller/InvSettlementSourController.java
  4. 31 1
      src/main/java/com/ydtech/modules/inv/controller/InvSourceController.java
  5. 27 0
      src/main/java/com/ydtech/modules/inv/dao/InvReceivableMapper.java
  6. 1 1
      src/main/java/com/ydtech/modules/inv/dao/InvSourceMapper.java
  7. 10 6
      src/main/java/com/ydtech/modules/inv/model/excel/InvSettlementSourceExcel.java
  8. 19 5
      src/main/java/com/ydtech/modules/inv/model/excel/InvSourceExcel.java
  9. 15 5
      src/main/java/com/ydtech/modules/inv/model/po/InvChannelAccount.java
  10. 12 0
      src/main/java/com/ydtech/modules/inv/model/po/InvSettlementSource.java
  11. 14 5
      src/main/java/com/ydtech/modules/inv/model/po/InvSource.java
  12. 74 0
      src/main/java/com/ydtech/modules/inv/model/po/QueryInvChannelAccount.java
  13. 180 0
      src/main/java/com/ydtech/modules/inv/model/vo/InvSettlementSourceQueryVo.java
  14. 288 0
      src/main/java/com/ydtech/modules/inv/model/vo/InvSourceQueryVo.java
  15. 61 0
      src/main/java/com/ydtech/modules/inv/model/vo/ReceivableResultVo.java
  16. 51 0
      src/main/java/com/ydtech/modules/inv/model/vo/SettlementSourceResultVo.java
  17. 55 0
      src/main/java/com/ydtech/modules/inv/model/vo/SigningSourceResultVo.java
  18. 3 1
      src/main/java/com/ydtech/modules/inv/service/InvChannelAccountService.java
  19. 37 0
      src/main/java/com/ydtech/modules/inv/service/InvReceivableService.java
  20. 4 0
      src/main/java/com/ydtech/modules/inv/service/InvSettlementSourceService.java
  21. 4 0
      src/main/java/com/ydtech/modules/inv/service/InvSourceService.java
  22. 27 0
      src/main/java/com/ydtech/modules/inv/service/impl/InvChannelAccountServiceImpl.java
  23. 271 0
      src/main/java/com/ydtech/modules/inv/service/impl/InvReceivableServiceImpl.java
  24. 35 24
      src/main/java/com/ydtech/modules/inv/service/impl/InvSettlementSourceServiceImpl.java
  25. 34 44
      src/main/java/com/ydtech/modules/inv/service/impl/InvSourceServiceImpl.java
  26. 11 4
      src/main/java/com/ydtech/modules/inv/utils/EasyExcelUtils.java
  27. 74 0
      src/main/java/com/ydtech/modules/inv/utils/excel/InvSettlementSourceDataListener.java
  28. 87 0
      src/main/java/com/ydtech/modules/inv/utils/excel/InvSourceDataListener.java
  29. 93 0
      src/main/resources/mapper/modules/inv/InvReceivableMapper.xml
  30. 10 0
      src/main/resources/mapper/modules/inv/InvSourceMapper.xml

+ 81 - 0
src/main/java/com/ydtech/modules/inv/controller/InvChannelAccountController.java

@@ -0,0 +1,81 @@
+package com.ydtech.modules.inv.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.inv.model.po.InvChannelAccount;
+import com.ydtech.modules.inv.model.po.QueryInvChannelAccount;
+import com.ydtech.modules.inv.service.InvChannelAccountService;
+import com.ydtech.modules.order.entity.BasePageResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.time.LocalDateTime;
+
+
+/**
+ *
+ * @author jianlong
+ * @date 2024-01-05 09:31
+ */
+@Api(tags = "应收应付 - 渠道账号管理", value = "渠道账号管理")
+@RequestMapping("/InvChannelAccount")
+@RestController
+public class InvChannelAccountController extends BaseController {
+    @Autowired
+    private InvChannelAccountService invChannelAccountService;
+
+    @ApiOperation("获取渠道列表")
+    @PostMapping("getAccount")
+    public HttpResult<BasePageResult<InvChannelAccount>> getInsAccountList(@RequestBody QueryInvChannelAccount queryInvChannelAccount){
+        IPage<InvChannelAccount> invChannelAccountIPage = invChannelAccountService.selectAccountsList(queryInvChannelAccount);
+        BasePageResult<InvChannelAccount> invChannelAccountBasePageResult = new BasePageResult<>(invChannelAccountIPage.getCurrent(), invChannelAccountIPage.getSize(), invChannelAccountIPage.getTotal(), invChannelAccountIPage.getPages(),
+                invChannelAccountIPage.getRecords());
+        return HttpResult.ok(invChannelAccountBasePageResult);
+    }
+
+    @ApiOperation("获取账户详细信息")
+    @GetMapping("getAccountById")
+    public HttpResult<InvChannelAccount> getInsAccountById(@RequestParam("accountId") String accountId){
+        return HttpResult.ok("", invChannelAccountService.getById(accountId));
+    }
+
+    @ApiOperation("删除账户(只传一个id就行)")
+    @DeleteMapping("{accountId}")
+    public HttpResult deleteInsAccount(@PathVariable("accountId") String accountId){
+        if (accountId!= null){
+            InvChannelAccount invChannelAccount = invChannelAccountService.getById(accountId);
+            if (invChannelAccountService.removeById(invChannelAccount.getId())){
+                return HttpResult.ok("删除成功");
+            }else {
+                return HttpResult.error();
+            }
+        }else {
+            return HttpResult.error("id不能为空");
+        }
+    }
+
+    @ApiOperation("插入账户信息")
+    @PostMapping("insertAccount")
+    public HttpResult insertInsAccount(@RequestBody InvChannelAccount invChannelAccount){
+        invChannelAccount.setCreateTime(LocalDateTime.now());
+        invChannelAccount.setCreateName(getUserName());
+        if (invChannelAccountService.save(invChannelAccount)){
+            return HttpResult.ok();
+        }else {
+            return HttpResult.error();
+        }
+    }
+
+    @ApiOperation("修改账户信息")
+    @PostMapping("updateAccount")
+    public HttpResult updateInsAccount(@RequestBody InvChannelAccount invChannelAccount){
+        if (invChannelAccountService.saveOrUpdate(invChannelAccount)){
+            return HttpResult.ok();
+        }else {
+            return HttpResult.error();
+        }
+    }
+}

+ 119 - 0
src/main/java/com/ydtech/modules/inv/controller/InvReceivableController.java

@@ -0,0 +1,119 @@
+package com.ydtech.modules.inv.controller;
+
+import com.alibaba.excel.EasyExcel;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.core.page.PageResult;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.inv.model.po.InvChannelAccount;
+import com.ydtech.modules.inv.model.po.InvSettlementSource;
+import com.ydtech.modules.inv.model.po.InvSource;
+import com.ydtech.modules.inv.model.po.QueryInvChannelAccount;
+import com.ydtech.modules.inv.model.vo.*;
+import com.ydtech.modules.inv.service.InvChannelAccountService;
+import com.ydtech.modules.inv.service.InvReceivableService;
+import com.ydtech.modules.inv.utils.EasyExcelUtils;
+import com.ydtech.modules.order.entity.BasePageResult;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.YearMonth;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+
+
+/**
+ *
+ * @author jianlong
+ * @date 2024-01-05 09:31
+ */
+@Api(tags = "应收应付 - 数据查询", value = "应收应付数据查询")
+@RequestMapping("/InsReceivable")
+@RestController
+public class InvReceivableController extends BaseController {
+    @Autowired
+    private InvReceivableService invReceivableService;
+
+    @ApiOperation("应收导入数据分页查询")
+    @PostMapping("receivablePage")
+    public HttpResult<PageResult> receivablePage(@RequestBody InvSourceQueryVo invSourceQueryVo){
+
+        IPage<InvSource> recivablePage = invReceivableService.getRecivablePage(invSourceQueryVo);
+        PageResult pageResult = buildPageResponse(recivablePage);
+        return HttpResult.ok(pageResult);
+    }
+
+    @ApiOperation("应收导入数据修改")
+    @PostMapping("receivableUpdates")
+    public HttpResult updateRecivable(@RequestBody InvSource invSource){
+
+        Boolean b = invReceivableService.updateRecivable(invSource);
+        return b ? HttpResult.ok("修改成功") : HttpResult.error("修改失败");
+    }
+
+
+    @ApiOperation("结算导入数据分页查询")
+    @PostMapping("settlementPage")
+    public HttpResult<PageResult> settlementPage(@RequestBody InvSettlementSourceQueryVo invSettlementSourceQueryVo){
+
+        IPage<InvSettlementSource> recivablePage = invReceivableService.getSettlementPage(invSettlementSourceQueryVo);
+        PageResult pageResult = buildPageResponse(recivablePage);
+        return HttpResult.ok(pageResult);
+    }
+
+    @ApiOperation("结算导入数据修改")
+    @PostMapping("updateSettlement")
+    public HttpResult updateSettlement(@RequestBody InvSettlementSource invSettlementSource){
+        Boolean b = invReceivableService.updateSettlement(invSettlementSource);
+        return b ? HttpResult.ok("修改成功") : HttpResult.error("修改失败");
+    }
+
+
+    @ApiOperation("应收结果")
+    @GetMapping("receivableResult")
+    public HttpResult<BasePageResult<ReceivableResultVo>> receivableResult(String yearMonthStr){
+        // 获取当前年月
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
+        YearMonth yearMonth = YearMonth.parse(yearMonthStr, formatter);
+        // 获取当前月份的最大天数
+        int maxDaysInMonth = yearMonth.lengthOfMonth();
+        List<ReceivableResultVo> invChannelAccountList = invReceivableService.getReceivableList(yearMonth.toString() + "-01",yearMonth.toString() + "-" + String.valueOf(maxDaysInMonth));
+        BasePageResult<ReceivableResultVo> invChannelAccountBasePageResult = new BasePageResult<>(0, 0, 0, 0, invChannelAccountList);
+        return HttpResult.ok(invChannelAccountBasePageResult);
+    }
+
+    @ApiOperation("签单日期结算来源表")
+    @GetMapping("signingSourceResult")
+    public HttpResult<BasePageResult<SigningSourceResultVo>> signingSourceResult(String yearMonthStr){
+        // 获取当前年月
+        String startMonth = yearMonthStr + "-01-01";
+        String endMonth = yearMonthStr + "-12-31";
+        List<SigningSourceResultVo> invChannelAccountList = invReceivableService.getSigningSourceResult(yearMonthStr,startMonth,endMonth);
+        BasePageResult<SigningSourceResultVo> invChannelAccountBasePageResult = new BasePageResult<>(0, 0, 0, 0, invChannelAccountList);
+        return HttpResult.ok(invChannelAccountBasePageResult);
+    }
+
+    @ApiOperation("结算日期结算来源表")
+    @GetMapping("settlementSourceResult")
+    public HttpResult<BasePageResult<SettlementSourceResultVo>> settlementSourceResult(String yearMonthStr){
+        // 获取当前年月
+        String startMonth = yearMonthStr + "-01-01";
+        String endMonth = yearMonthStr + "-12-31";
+        List<SettlementSourceResultVo> invChannelAccountList = invReceivableService.getSettlementSourceResult(yearMonthStr,startMonth,endMonth);
+        BasePageResult<SettlementSourceResultVo> invChannelAccountBasePageResult = new BasePageResult<>(0, 0, 0, 0, invChannelAccountList);
+        return HttpResult.ok(invChannelAccountBasePageResult);
+    }
+
+    @ApiOperation("同步应收表与结算表的状态")
+    @GetMapping("syncStatus")
+    public HttpResult syncStatus(){
+        Integer i = invReceivableService.syncStatus();
+        return HttpResult.ok("同步成功,共同步" + i + "条数据");
+    }
+
+
+}

+ 33 - 1
src/main/java/com/ydtech/modules/inv/controller/InvSettlementSourController.java

@@ -6,6 +6,8 @@ import io.swagger.annotations.Api;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
+import java.util.Arrays;
+
 /**
 /**
  * @author jianlong
  * @author jianlong
  * @date 2024-01-20 11:36
  * @date 2024-01-20 11:36
@@ -17,8 +19,38 @@ public class InvSettlementSourController {
     @Autowired
     @Autowired
     private InvSettlementSourceService invSettlementSourceService;
     private InvSettlementSourceService invSettlementSourceService;
 
 
+    private static String concatenateWithSlash(String[] array) {
+        StringBuilder result = new StringBuilder();
+
+        for (String segment : array) {
+            result.append(segment).append("/");
+        }
+
+        // Remove the trailing "/"
+        if (result.length() > 0) {
+            result.setLength(result.length() - 1);
+        }
+
+        return result.toString();
+    }
+
+    private static int findIndex(String[] array, String target) {
+        for (int i = 0; i < array.length; i++) {
+            // Use the indexOf method to check for the target string
+            if (array[i].indexOf(target) != -1) {
+                return i;
+            }
+        }
+        return -1;  // Return -1 if the element is not found
+    }
+
     @GetMapping("excel")
     @GetMapping("excel")
     public HttpResult readExcel(@RequestParam("file") String file){
     public HttpResult readExcel(@RequestParam("file") String file){
-        return invSettlementSourceService.readInvSettlementSourceExcel(file);
+        String[] pathSegments = file.split("/");
+        // The last segment should be the filename
+        int index = findIndex(pathSegments,"upload");
+        String[] subarray = Arrays.copyOfRange(pathSegments, index+1, pathSegments.length);
+        String filename = concatenateWithSlash(subarray);
+        return invSettlementSourceService.readInvSettlementSourceExcel(filename);
     }
     }
 }
 }

+ 31 - 1
src/main/java/com/ydtech/modules/inv/controller/InvSourceController.java

@@ -9,6 +9,8 @@ import io.swagger.annotations.Api;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
+import java.util.Arrays;
+
 /**
 /**
  * @author jianlong
  * @author jianlong
  * @date 2024-01-20 10:38
  * @date 2024-01-20 10:38
@@ -20,9 +22,37 @@ public class InvSourceController {
     @Autowired
     @Autowired
     private InvSourceService invSourceService;
     private InvSourceService invSourceService;
 
 
+    private static String concatenateWithSlash(String[] array) {
+        StringBuilder result = new StringBuilder();
+
+        for (String segment : array) {
+            result.append(segment).append("/");
+        }
+
+        // Remove the trailing "/"
+        if (result.length() > 0) {
+            result.setLength(result.length() - 1);
+        }
+
+        return result.toString();
+    }
+
+    private static int findIndex(String[] array, String target) {
+        for (int i = 0; i < array.length; i++) {
+            // Use the indexOf method to check for the target string
+            if (array[i].indexOf(target) != -1) {
+                return i;
+            }
+        }
+        return -1;  // Return -1 if the element is not found
+    }
 
 
     @GetMapping("excel")
     @GetMapping("excel")
     public HttpResult readExcel(@RequestParam("file") String file ) {
     public HttpResult readExcel(@RequestParam("file") String file ) {
-       return invSourceService.readExcel(file);
+        String[] pathSegments = file.split("/");
+        int index = findIndex(pathSegments,"upload");
+        String[] subarray = Arrays.copyOfRange(pathSegments, index+1, pathSegments.length);
+        String filename = concatenateWithSlash(subarray);
+       return invSourceService.readExcel(filename);
     }
     }
 }
 }

+ 27 - 0
src/main/java/com/ydtech/modules/inv/dao/InvReceivableMapper.java

@@ -0,0 +1,27 @@
+package com.ydtech.modules.inv.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.inv.model.po.InvChannelAccount;
+import com.ydtech.modules.inv.model.vo.ReceivableResultVo;
+import com.ydtech.modules.inv.model.vo.SettlementSourceResultVo;
+import com.ydtech.modules.inv.model.vo.SigningSourceResultVo;
+
+import java.util.List;
+
+/**
+* @author Administrator
+* @description 针对表【inv_channel_account(渠道账户表)】的数据库操作Mapper
+* @createDate 2024-01-20 10:29:30
+* @Entity com.ydtech.modules.inv.model.po.InvChannelAccount
+*/
+public interface InvReceivableMapper extends BaseMapper<InvChannelAccount> {
+    List<ReceivableResultVo> getReceivableList(String startTime, String endTime);
+
+    List<SigningSourceResultVo> getSigningSourceResult(String startTime, String endTime);
+
+    List<SettlementSourceResultVo> getSettlementSourceResult(String startTime, String endTime);
+}
+
+
+
+

+ 1 - 1
src/main/java/com/ydtech/modules/inv/dao/InvSourceMapper.java

@@ -10,7 +10,7 @@ import com.ydtech.modules.inv.model.po.InvSource;
 * @Entity com.ydtech.modules.inv.model.po.InvSource
 * @Entity com.ydtech.modules.inv.model.po.InvSource
 */
 */
 public interface InvSourceMapper extends BaseMapper<InvSource> {
 public interface InvSourceMapper extends BaseMapper<InvSource> {
-
+    Integer syncStatus();
 }
 }
 
 
 
 

+ 10 - 6
src/main/java/com/ydtech/modules/inv/model/excel/InvSettlementSourceExcel.java

@@ -19,10 +19,6 @@ import java.util.Date;
  */
  */
 @Data
 @Data
 public class InvSettlementSourceExcel implements Serializable {
 public class InvSettlementSourceExcel implements Serializable {
-
-
-
-
     /**
     /**
      * 工号
      * 工号
      */
      */
@@ -30,12 +26,20 @@ public class InvSettlementSourceExcel implements Serializable {
     private String employeeId;
     private String employeeId;
 
 
 
 
+    @ExcelProperty("运营小组")
+    private String operationsTeam;
+
+    @ExcelProperty("渠道分级")
+    private String channelClassification;
+
+    @ExcelProperty("渠道")
+    private String channel;
     /**
     /**
      * 签单日期
      * 签单日期
      */
      */
     @JsonFormat(pattern = "yyyy-MM-dd")
     @JsonFormat(pattern = "yyyy-MM-dd")
     @ExcelProperty("签单日期")
     @ExcelProperty("签单日期")
-    private LocalDateTime signDate;
+    private String signDate;
 
 
     /**
     /**
      * 车牌号
      * 车牌号
@@ -139,5 +143,5 @@ public class InvSettlementSourceExcel implements Serializable {
      */
      */
     @JsonFormat(pattern = "yyyy-MM-dd")
     @JsonFormat(pattern = "yyyy-MM-dd")
     @ExcelProperty("代理结算时间")
     @ExcelProperty("代理结算时间")
-    private LocalDateTime agencySettlementTime;
+    private String agencySettlementTime;
 }
 }

+ 19 - 5
src/main/java/com/ydtech/modules/inv/model/excel/InvSourceExcel.java

@@ -59,13 +59,13 @@ public class InvSourceExcel implements Serializable {
     /**
     /**
      * 交强保费(含税)
      * 交强保费(含税)
      */
      */
-    @ExcelProperty("交强保费")
+    @ExcelProperty(value = "交强保费")
     private String jqPremiumTax;
     private String jqPremiumTax;
 
 
     /**
     /**
      * 交强保费(不含税)
      * 交强保费(不含税)
      */
      */
-    @ExcelProperty("交强保费不含税")
+    @ExcelProperty(value = "交强保费不含税")
     private String jqPremium;
     private String jqPremium;
 
 
     /**
     /**
@@ -121,14 +121,14 @@ public class InvSourceExcel implements Serializable {
      */
      */
     @ExcelProperty(value = "出单日期")
     @ExcelProperty(value = "出单日期")
     @JsonFormat(pattern = "yyyy-MM-dd")
     @JsonFormat(pattern = "yyyy-MM-dd")
-    private LocalDateTime signingTime;
+    private String signingTime;
 
 
     /**
     /**
      * 结算日期
      * 结算日期
      */
      */
     @ExcelProperty(value = "结算日期")
     @ExcelProperty(value = "结算日期")
     @JsonFormat(pattern = "yyyy-MM-dd")
     @JsonFormat(pattern = "yyyy-MM-dd")
-    private LocalDateTime  clearingTime;
+    private String  clearingTime;
 
 
     /**
     /**
      * 车船税
      * 车船税
@@ -205,9 +205,23 @@ public class InvSourceExcel implements Serializable {
     /**
     /**
      * 应收金额
      * 应收金额
      */
      */
-    @ExcelProperty("应收金额")
+    @ExcelProperty("保司应收金额")
     private String receivable;
     private String receivable;
 
 
+    @ExcelProperty("补贴比例")
+    private String subsidyRatio;
+
+    @ExcelProperty("补贴金额")
+    private String subsidyAmount;
+
+    @ExcelProperty("总应收金额")
+    private String totalReceivableAmount;
+
+
+
+
+
+
     /**
     /**
      * 最大交强应付比例
      * 最大交强应付比例
      */
      */

+ 15 - 5
src/main/java/com/ydtech/modules/inv/model/po/InvChannelAccount.java

@@ -1,11 +1,12 @@
 package com.ydtech.modules.inv.model.po;
 package com.ydtech.modules.inv.model.po;
 
 
-import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.TableName;
 import java.io.Serializable;
 import java.io.Serializable;
-import java.util.Date;
+import java.time.LocalDateTime;
+
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.Data;
 
 
 /**
 /**
@@ -18,6 +19,7 @@ public class InvChannelAccount implements Serializable {
     /**
     /**
      * 工号
      * 工号
      */
      */
+    @ApiModelProperty(value = "工号")
     @TableField(value = "employee_id")
     @TableField(value = "employee_id")
     private String employeeId;
     private String employeeId;
 
 
@@ -30,48 +32,56 @@ public class InvChannelAccount implements Serializable {
     /**
     /**
      * 省
      * 省
      */
      */
+    @ApiModelProperty(value = "省")
     @TableField(value = "province")
     @TableField(value = "province")
     private String province;
     private String province;
 
 
     /**
     /**
      * 地级市
      * 地级市
      */
      */
+    @ApiModelProperty(value = "地级市")
     @TableField(value = "city")
     @TableField(value = "city")
     private String city;
     private String city;
 
 
     /**
     /**
      * 县级市
      * 县级市
      */
      */
+    @ApiModelProperty(value = "县级市")
     @TableField(value = "county")
     @TableField(value = "county")
     private String county;
     private String county;
 
 
     /**
     /**
      * 组
      * 组
      */
      */
-    @TableField(value = "group")
+    @ApiModelProperty(value = "组")
+    @TableField(value="`group`")
     private String group;
     private String group;
 
 
     /**
     /**
      * 组员
      * 组员
      */
      */
+    @ApiModelProperty(value = "组员")
     @TableField(value = "member")
     @TableField(value = "member")
     private String member;
     private String member;
 
 
     /**
     /**
      * 收款人账户
      * 收款人账户
      */
      */
+    @ApiModelProperty(value = "收款人账户")
     @TableField(value = "account")
     @TableField(value = "account")
     private String account;
     private String account;
 
 
     /**
     /**
      * 收款人名称
      * 收款人名称
      */
      */
+    @ApiModelProperty(value = "收款人名称")
     @TableField(value = "payee")
     @TableField(value = "payee")
     private String payee;
     private String payee;
 
 
     /**
     /**
      * 收款人开户行
      * 收款人开户行
      */
      */
+    @ApiModelProperty(value = "收款人开户行")
     @TableField(value = "bank")
     @TableField(value = "bank")
     private String bank;
     private String bank;
 
 
@@ -85,7 +95,7 @@ public class InvChannelAccount implements Serializable {
      * 创建时间
      * 创建时间
      */
      */
     @TableField(value = "create_time")
     @TableField(value = "create_time")
-    private Date createTime;
+    private LocalDateTime createTime;
 
 
     /**
     /**
      * 更新人
      * 更新人
@@ -97,7 +107,7 @@ public class InvChannelAccount implements Serializable {
      * 更新时间
      * 更新时间
      */
      */
     @TableField(value = "update_time")
     @TableField(value = "update_time")
-    private Date updateTime;
+    private LocalDateTime updateTime;
 
 
     @TableField(exist = false)
     @TableField(exist = false)
     private static final long serialVersionUID = 1L;
     private static final long serialVersionUID = 1L;

+ 12 - 0
src/main/java/com/ydtech/modules/inv/model/po/InvSettlementSource.java

@@ -36,6 +36,18 @@ public class InvSettlementSource implements Serializable {
     @ApiModelProperty("工号")
     @ApiModelProperty("工号")
     private String employeeId;
     private String employeeId;
 
 
+    @TableField(value = "operations_team")
+    @ApiModelProperty("运营小组")
+    private String operationsTeam;
+
+    @TableField(value = "channel_classification")
+    @ApiModelProperty("渠道分级")
+    private String channelClassification;
+
+    @TableField(value = "channel")
+    @ApiModelProperty("渠道")
+    private String channel;
+
 
 
     /**
     /**
      * 签单日期
      * 签单日期

+ 14 - 5
src/main/java/com/ydtech/modules/inv/model/po/InvSource.java

@@ -28,14 +28,14 @@ public class InvSource implements Serializable {
      */
      */
     @TableId(value = "id")
     @TableId(value = "id")
     @ApiModelProperty("编号")
     @ApiModelProperty("编号")
-    private Long id;
+    private String id;
 
 
     /**
     /**
      * 保司编码
      * 保司编码
      */
      */
     @TableField(value = "insurance_id")
     @TableField(value = "insurance_id")
     @ApiModelProperty("保司编码")
     @ApiModelProperty("保司编码")
-    private Long insuranceId;
+    private String insuranceId;
 
 
 
 
     /**
     /**
@@ -157,7 +157,7 @@ public class InvSource implements Serializable {
     @TableField(value = "clearing_time")
     @TableField(value = "clearing_time")
     @ApiModelProperty("结算日期")
     @ApiModelProperty("结算日期")
     @JsonFormat(pattern = "yyyy-MM-dd")
     @JsonFormat(pattern = "yyyy-MM-dd")
-    private LocalDate clearingTime;
+    private String clearingTime;
 
 
     /**
     /**
      * 车船税
      * 车船税
@@ -247,9 +247,18 @@ public class InvSource implements Serializable {
      * 应收金额
      * 应收金额
      */
      */
     @TableField(value = "receivable")
     @TableField(value = "receivable")
-    @ApiModelProperty("应收金额")
+    @ApiModelProperty("保司应收金额")
     private BigDecimal receivable;
     private BigDecimal receivable;
 
 
+    @ExcelProperty("补贴比例")
+    private BigDecimal subsidyRatio;
+
+    @ExcelProperty("补贴金额")
+    private BigDecimal subsidyAmount;
+
+    @ExcelProperty("总应收金额")
+    private BigDecimal totalReceivableAmount;
+
     /**
     /**
      * 最大交强应付比例
      * 最大交强应付比例
      */
      */
@@ -276,7 +285,7 @@ public class InvSource implements Serializable {
      */
      */
     @TableField(value = "max_receivable")
     @TableField(value = "max_receivable")
     @ApiModelProperty("最大应收金额")
     @ApiModelProperty("最大应收金额")
-    private String maxReceivable;
+    private BigDecimal maxReceivable;
 
 
     /**
     /**
      * 结算状态 (0 已认领 (未结) 1已认领(结算) 2未认领 3孤儿单
      * 结算状态 (0 已认领 (未结) 1已认领(结算) 2未认领 3孤儿单

+ 74 - 0
src/main/java/com/ydtech/modules/inv/model/po/QueryInvChannelAccount.java

@@ -0,0 +1,74 @@
+package com.ydtech.modules.inv.model.po;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ydtech.core.page.PageRequest;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 渠道账户表
+ * @TableName inv_channel_account
+ */
+@Data
+public class QueryInvChannelAccount extends PageRequest implements Serializable {
+    /**
+     * 工号
+     */
+    private Long employeeId;
+
+    /**
+     * 编号
+     */
+    private Long id;
+
+    /**
+     * 省
+     */
+    private String province;
+
+    /**
+     * 地级市
+     */
+    private String city;
+
+    /**
+     * 县级市
+     */
+    private String county;
+
+    /**
+     * 组
+     */
+    private String group;
+
+    /**
+     * 组员
+     */
+    private String member;
+
+    /**
+     * 收款人账户
+     */
+    private String account;
+
+    /**
+     * 收款人名称
+     */
+    private String payee;
+
+    /**
+     * 收款人开户行
+     */
+    private String bank;
+
+    /**
+     * 创建人
+     */
+    private String createName;
+
+    private static final long serialVersionUID = 1L;
+}

+ 180 - 0
src/main/java/com/ydtech/modules/inv/model/vo/InvSettlementSourceQueryVo.java

@@ -0,0 +1,180 @@
+package com.ydtech.modules.inv.model.vo;
+
+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 com.ydtech.core.page.PageRequest;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+/**
+ * 结算来源表
+ * @TableName inv_settlement_source
+ */
+@TableName(value ="inv_settlement_source")
+@Data
+public class InvSettlementSourceQueryVo extends PageRequest implements Serializable {
+
+
+    /**
+     * 编号
+     */
+    @TableId(value = "id")
+    private Long id;
+
+    /**
+     * 工号
+     */
+    @TableField(value = "employee_id")
+    @ApiModelProperty("工号")
+    private String employeeId;
+
+    @TableField(value = "operations_team")
+    @ApiModelProperty("运营小组")
+    private String operationsTeam;
+
+    @TableField(value = "channel_classification")
+    @ApiModelProperty("渠道分级")
+    private String channelClassification;
+
+    @TableField(value = "channel")
+    @ApiModelProperty("渠道")
+    private String channel;
+
+
+    /**
+     * 签单日期
+     */
+    @TableField(value = "sign_date")
+    @ApiModelProperty("签单日期")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private LocalDate signDate;
+
+    /**
+     * 车牌号
+     */
+    @TableField(value = "licenseno")
+    @ApiModelProperty("车牌号")
+    private String licenseno;
+
+    /**
+     * 被保险人
+     */
+    @TableField(value = "insured_name")
+    @ApiModelProperty("被保险人")
+    private String insuredName;
+
+    /**
+     * 保险公司
+     */
+    @TableField(value = "insurance_company")
+    @ApiModelProperty("险种")
+    private String insuranceCompany;
+
+    /**
+     * 险种
+     */
+    @TableField(value = "insurance_type")
+    @ApiModelProperty("险种")
+    private String insuranceType;
+
+    /**
+     * 业务归属
+     */
+    @TableField(value = "business_owner")
+    @ApiModelProperty("业务归属")
+    private String businessOwner;
+
+    /**
+     * 交强保单号
+     */
+    @TableField(value = "jq_policy_id")
+    @ApiModelProperty("交强保单号")
+    private String jqPolicyId;
+
+    /**
+     * 商业保单号
+     */
+    @TableField(value = "sy_policy_id")
+    @ApiModelProperty("商业保单号")
+    private String syPolicyId;
+
+    /**
+     * 非车保单号
+     */
+    @TableField(value = "non_car_policy_id")
+    @ApiModelProperty("非车保单号")
+    private String nonCarPolicyId;
+
+    /**
+     * 交强保费
+     */
+    @TableField(value = "jq_premium_tax")
+    @ApiModelProperty("交强保费")
+    private BigDecimal jqPremiumTax;
+
+    /**
+     * 车船税
+     */
+    @TableField(value = "vehicle_tax")
+    @ApiModelProperty("车船税")
+    private BigDecimal vehicleTax;
+
+    /**
+     * 商业保费
+     */
+    @TableField(value = "sy_premium_tax")
+    @ApiModelProperty("商业保费")
+    private BigDecimal syPremiumTax;
+
+    /**
+     * 非车保费
+     */
+    @TableField(value = "non_car_premium_tax")
+    @ApiModelProperty("非车保费")
+    private BigDecimal nonCarPremiumTax;
+
+    /**
+     * 交强出口比例
+     */
+    @TableField(value = "compulsory_export_ratio")
+    @ApiModelProperty("交强出口比例")
+    private BigDecimal compulsoryExportRatio;
+
+    /**
+     * 商业出口比例
+     */
+    @TableField(value = "commercial_export_ratio")
+    @ApiModelProperty("商业出口比例")
+    private BigDecimal commercialExportRatio;
+
+    /**
+     * 非车出口比例
+     */
+    @TableField(value = "non_vehicle_export_ratio")
+    @ApiModelProperty("非车出口比例")
+    private BigDecimal nonVehicleExportRatio;
+
+    /**
+     * 结算金额
+     */
+    @TableField(value = "settlement_amount")
+    @ApiModelProperty("结算金额")
+    private BigDecimal settlementAmount;
+
+    /**
+     * 代理结算时间
+     */
+    @TableField(value = "agency_settlement_time")
+    @ApiModelProperty("代理结算时间")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private LocalDate agencySettlementTime;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+}

+ 288 - 0
src/main/java/com/ydtech/modules/inv/model/vo/InvSourceQueryVo.java

@@ -0,0 +1,288 @@
+package com.ydtech.modules.inv.model.vo;
+
+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 com.ydtech.core.page.PageRequest;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+/**
+ * 来源表
+ * @TableName inv_source
+ */
+
+@Data
+public class InvSourceQueryVo extends PageRequest implements Serializable {
+
+
+    /**
+     * 编号
+     */
+    @TableId(value = "id")
+    @ApiModelProperty("编号")
+    private Long id;
+
+    /**
+     * 保司编码
+     */
+    @TableField(value = "insurance_id")
+    @ApiModelProperty("保司编码")
+    private Long insuranceId;
+
+
+    /**
+     * 保司名称
+     */
+    @TableField(value = "insurance_name")
+    @ApiModelProperty("保司名称")
+    private String insuranceName;
+
+    /**
+     * 保司机构
+     */
+    @TableField(value = "insurance_dept")
+    @ApiModelProperty("保司机构")
+    private String insuranceDept;
+
+    /**
+     * 保司机构id
+     */
+    @TableField(value = "insurance_dept_id")
+    @ApiModelProperty("保司机构id")
+    private String insuranceDeptId;
+
+    /**
+     * 险种
+     */
+    @TableField(value = "risk")
+    @ApiModelProperty("险种")
+    private String risk;
+
+    /**
+     * 交强保单号
+     */
+    @TableField(value = "jq_policy_id")
+    @ApiModelProperty("交强保单号")
+    private String jqPolicyId;
+
+    /**
+     * 交强保费(含税)
+     */
+    @TableField(value = "jq_premium_tax")
+    @ApiModelProperty("交强保费(含税)")
+    private BigDecimal jqPremiumTax;
+
+    /**
+     * 交强保费(不含税)
+     */
+    @TableField(value = "jq_premium")
+    @ApiModelProperty("交强保费(不含税)")
+    private BigDecimal jqPremium;
+
+    /**
+     * 商业保单号
+     */
+    @TableField(value = "sy_policy_id")
+    @ApiModelProperty("商业保单号")
+    private String syPolicyId;
+
+    /**
+     * 商业保费(含税)
+     */
+    @TableField(value = "sy_premium_tax")
+    @ApiModelProperty("商业保费(含税)")
+    private BigDecimal syPremiumTax;
+
+    /**
+     * 商业保费(不含税)
+     */
+    @TableField(value = "sy_premium")
+    @ApiModelProperty("商业保费(不含税)")
+    private BigDecimal syPremium;
+
+    /**
+     * 非车保单号
+     */
+    @TableField(value = "non_car_policy_id")
+    @ApiModelProperty("非车保单号")
+    private String nonCarPolicyId;
+
+    /**
+     * 非车保费(含税)
+     */
+    @ApiModelProperty("非车保单号")
+    @TableField(value = "non_car_premium_tax")
+    private BigDecimal nonCarPremiumTax;
+
+    /**
+     * 非车保费(不含税)
+     */
+    @TableField(value = "non_car_premium")
+    @ApiModelProperty("非车保费(不含税)")
+    private BigDecimal nonCarPremium;
+
+    /**
+     * 被保险人名字
+     */
+    @TableField(value = "insured_name")
+    @ApiModelProperty("被保险人名字")
+    private String insuredName;
+
+    /**
+     * 车牌号
+     */
+    @TableField(value = "licenseno")
+    @ApiModelProperty("车牌号")
+    private String licenseno;
+
+    /**
+     * 出单日期
+     */
+    @TableField(value = "signing_time")
+    @ApiModelProperty("出单日期")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private LocalDate signingTime;
+
+    /**
+     * 结算日期
+     */
+    @TableField(value = "clearing_time")
+    @ApiModelProperty("结算日期")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private String clearingTime;
+
+    /**
+     * 车船税
+     */
+    @TableField(value = "taxamount")
+    @ApiModelProperty("车船税")
+    private BigDecimal taxamount;
+
+    /**
+     * 交强应收比例
+     */
+    @TableField(value = "jq_receivable_ratio")
+    @ApiModelProperty("交强应收比例")
+    private BigDecimal jqReceivableRatio;
+
+    /**
+     * 交强手续费比例
+     */
+    @TableField(value = "jq_premium_ratio")
+    @ApiModelProperty("交强手续费比例")
+    private BigDecimal jqPremiumRatio;
+
+    /**
+     * 交强非跟单比例
+     */
+    @TableField(value = "jq_non_copying_ratio")
+    @ApiModelProperty("交强非跟单比例")
+    private BigDecimal jqNonCopyingRatio;
+
+    /**
+     * 商业应收比例
+     */
+    @TableField(value = "sy_receivable_ratio")
+    @ApiModelProperty("商业应收比例")
+    private BigDecimal syReceivableRatio;
+
+    /**
+     * 商业手续费比例
+     */
+    @TableField(value = "sy_premium_ratio")
+    @ApiModelProperty("商业手续费比例")
+    private BigDecimal syPremiumRatio;
+
+    /**
+     * 商业非跟单比例
+     */
+    @TableField(value = "sy_non_copying_ratio")
+    @ApiModelProperty("商业非跟单比例")
+    private BigDecimal syNonCopyingRatio;
+
+    /**
+     * 非车应收比例
+     */
+    @TableField(value = "non_car_receivable_ratio")
+    @ApiModelProperty("非车应收比例")
+    private BigDecimal nonCarReceivableRatio;
+
+    /**
+     * 非车手续费比例
+     */
+    @TableField(value = "non_car_premium_ratio")
+    @ApiModelProperty("非车手续费比例")
+    private BigDecimal nonCarPremiumRatio;
+
+    /**
+     * 非车非跟单比例
+     */
+    @TableField(value = "non_car_non_copying_ratio")
+    @ApiModelProperty("非车非跟单比例")
+    private BigDecimal nonCarNonCopyingRatio;
+
+    /**
+     * 手续费金额
+     */
+    @TableField(value = "premium")
+    @ApiModelProperty("手续费金额")
+    private BigDecimal premium;
+
+    /**
+     * 非跟单金额
+     */
+    @TableField(value = "non_copying")
+    @ApiModelProperty("非跟单金额")
+    private BigDecimal nonCopying;
+
+    /**
+     * 应收金额
+     */
+    @TableField(value = "receivable")
+    @ApiModelProperty("应收金额")
+    private BigDecimal receivable;
+
+    /**
+     * 最大交强应付比例
+     */
+    @TableField(value = "max_jq_receivable_ratio")
+    @ApiModelProperty("最大交强应付比例")
+    private BigDecimal maxJqReceivableRatio;
+
+    /**
+     * 最大交强应付比例
+     */
+    @TableField(value = "max_sy_receivable_ratio")
+    @ApiModelProperty("最大交强应付比例")
+    private BigDecimal maxSyReceivableRatio;
+
+    /**
+     * 最大交强应付比例
+     */
+    @TableField(value = "max_non_car_receivable_ratio")
+    @ApiModelProperty("最大交强应付比例")
+    private BigDecimal maxNonCarReceivableRatio;
+
+    /**
+     * 最大应收金额
+     */
+    @TableField(value = "max_receivable")
+    @ApiModelProperty("最大应收金额")
+    private String maxReceivable;
+
+    /**
+     * 结算状态 (0 已认领 (未结) 1已认领(结算) 2未认领 3孤儿单
+     */
+    @TableField(value = "clearing_state")
+    @ApiModelProperty("结算状态 (0 已认领 (未结) 1已认领(结算) 2未认领 3Singleton)")
+    private String clearingState;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+}

+ 61 - 0
src/main/java/com/ydtech/modules/inv/model/vo/ReceivableResultVo.java

@@ -0,0 +1,61 @@
+package com.ydtech.modules.inv.model.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.ydtech.modules.nai.httpvo.excel.Excel;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class ReceivableResultVo {
+    @ApiModelProperty(value = "年月")
+    @ExcelProperty(value = "年月",index = 0)
+    private String yearmonth;
+
+    @ApiModelProperty(value = "日期")
+    @ExcelProperty(value = "日期",index = 1)
+    private String day;
+
+    @ApiModelProperty(value = "保险公司名称")
+    @ExcelProperty(value = "保险公司名称",index = 2)
+    private String insuranceName;
+
+    @ApiModelProperty(value = "交强")
+    @ExcelProperty(value = "交强",index = 3)
+    private String jqPremiumTax;
+
+    @ApiModelProperty(value = "商业")
+    @ExcelProperty(value = "商业",index = 4)
+    private String syPremiumTax;
+
+    @ApiModelProperty(value = "车船税")
+    @ExcelProperty(value = "车船税",index = 5)
+    private String taxamount;
+
+    @ApiModelProperty(value = "非车")
+    @ExcelProperty(value = "非车",index = 6)
+    private String nonCarPremiumTax;
+
+    @ApiModelProperty(value = "保费合计")
+    @ExcelProperty(value = "保费合计",index = 7)
+    private String totalPermium;
+
+    @ApiModelProperty(value = "手续费")
+    @ExcelProperty(value = "手续费",index = 8)
+    private String premium;
+
+    @ApiModelProperty(value = "非跟单")
+    @ExcelProperty(value = "非跟单",index = 9)
+    private String nonCopying;
+
+    @ApiModelProperty(value = "应收合计")
+    @ExcelProperty(value = "应收合计",index = 10)
+    private String totalReceivable;
+
+    @ApiModelProperty(value = "补贴金额")
+    private String subsidyAmount;
+
+    @ApiModelProperty(value = "总应收金额")
+    private String totalReceivableAmount;
+
+}

+ 51 - 0
src/main/java/com/ydtech/modules/inv/model/vo/SettlementSourceResultVo.java

@@ -0,0 +1,51 @@
+package com.ydtech.modules.inv.model.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class SettlementSourceResultVo {
+    @ApiModelProperty(value = "年月")
+    @ExcelProperty(value = "年月",index = 0)
+    private String yearmonth;
+
+    @ApiModelProperty(value = "日期")
+    @ExcelProperty(value = "日期",index = 1)
+    private String day;
+
+    @ApiModelProperty(value = "保险公司名称")
+    @ExcelProperty(value = "保险公司名称",index = 2)
+    private String insuranceName;
+
+    @ApiModelProperty(value = "交强")
+    @ExcelProperty(value = "交强",index = 3)
+    private String jqPremiumTax;
+
+    @ApiModelProperty(value = "商业")
+    @ExcelProperty(value = "商业",index = 4)
+    private String syPremiumTax;
+
+    @ApiModelProperty(value = "非车")
+    @ExcelProperty(value = "非车",index = 6)
+    private String nonCarPremiumTax;
+
+    @ApiModelProperty(value = "签单保费")
+    private String writtenPremium;
+
+    @ApiModelProperty(value = "结算金额")
+    @ExcelProperty(value = "结算金额",index = 10)
+    private String settlementAmount;
+
+
+    public SettlementSourceResultVo(){
+        this.yearmonth = "0";
+        this.day = "0";
+        this.insuranceName = "0";
+        this.jqPremiumTax = "0";
+        this.syPremiumTax = "0";
+        this.nonCarPremiumTax = "0";
+        this.writtenPremium = "0";
+        this.settlementAmount = "0";
+    }
+}

+ 55 - 0
src/main/java/com/ydtech/modules/inv/model/vo/SigningSourceResultVo.java

@@ -0,0 +1,55 @@
+package com.ydtech.modules.inv.model.vo;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class SigningSourceResultVo {
+    @ApiModelProperty(value = "年月")
+    @ExcelProperty(value = "年月",index = 0)
+    private String yearmonth;
+
+    @ApiModelProperty(value = "日期")
+    @ExcelProperty(value = "日期",index = 1)
+    private String day;
+
+    @ApiModelProperty(value = "保险公司名称")
+    @ExcelProperty(value = "保险公司名称",index = 2)
+    private String insuranceName;
+
+    @ApiModelProperty(value = "交强")
+    @ExcelProperty(value = "交强",index = 3)
+    private String jqPremiumTax;
+
+    @ApiModelProperty(value = "商业")
+    @ExcelProperty(value = "商业",index = 4)
+    private String syPremiumTax;
+
+    @ApiModelProperty(value = "非车")
+    @ExcelProperty(value = "非车",index = 6)
+    private String nonCarPremiumTax;
+
+    @ApiModelProperty(value = "签单保费")
+    private String writtenPremium;
+
+//    @ApiModelProperty(value = "结算金额")
+//    @ExcelProperty(value = "结算金额",index = 10)
+//    private String settlementAmount;
+
+    @ApiModelProperty(value = "应收总金额")
+    private String totalAmountReceivable;
+
+    public SigningSourceResultVo() {
+    	this.yearmonth = "0";
+        this.day = "0";
+        this.insuranceName = "0";
+        this.jqPremiumTax = "0";
+        this.syPremiumTax = "0";
+        this.nonCarPremiumTax = "0";
+        this.writtenPremium = "0";
+        //        this.settlementAmount = "0";
+        this.totalAmountReceivable = "0";
+    }
+
+}

+ 3 - 1
src/main/java/com/ydtech/modules/inv/service/InvChannelAccountService.java

@@ -1,7 +1,9 @@
 package com.ydtech.modules.inv.service;
 package com.ydtech.modules.inv.service;
 
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ydtech.modules.inv.model.po.InvChannelAccount;
 import com.ydtech.modules.inv.model.po.InvChannelAccount;
+import com.ydtech.modules.inv.model.po.QueryInvChannelAccount;
 
 
 /**
 /**
 * @author Administrator
 * @author Administrator
@@ -9,5 +11,5 @@ import com.ydtech.modules.inv.model.po.InvChannelAccount;
 * @createDate 2024-01-20 10:29:30
 * @createDate 2024-01-20 10:29:30
 */
 */
 public interface InvChannelAccountService extends IService<InvChannelAccount> {
 public interface InvChannelAccountService extends IService<InvChannelAccount> {
-
+    IPage<InvChannelAccount> selectAccountsList(QueryInvChannelAccount invChannelAccount);
 }
 }

+ 37 - 0
src/main/java/com/ydtech/modules/inv/service/InvReceivableService.java

@@ -0,0 +1,37 @@
+package com.ydtech.modules.inv.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.inv.model.InvAccount;
+import com.ydtech.modules.inv.model.po.InvSettlementSource;
+import com.ydtech.modules.inv.model.po.InvSource;
+import com.ydtech.modules.inv.model.po.QueryInvChannelAccount;
+import com.ydtech.modules.inv.model.vo.*;
+
+import java.util.List;
+
+/**
+* @author Administrator
+* @description 针对表【ins_account(账户信息表)】的数据库操作Service
+* @createDate 2024-01-04 18:29:20
+*/
+public interface InvReceivableService {
+
+    List<ReceivableResultVo> getReceivableList(String startTime,String endTime);
+
+    List<SigningSourceResultVo> getSigningSourceResult(String yearMonthStr,String startTime, String endTime);
+
+    List<SettlementSourceResultVo> getSettlementSourceResult(String yearMonthStr,String startTime,String endTime);
+
+
+    IPage<InvSource> getRecivablePage(InvSourceQueryVo invSourceQueryVo);
+
+    Boolean updateRecivable(InvSource invSource);
+
+    IPage<InvSettlementSource> getSettlementPage(InvSettlementSourceQueryVo invSettlementSourceQueryVo);
+
+    Boolean updateSettlement(InvSettlementSource invSettlementSource);
+
+    Integer syncStatus();
+}

+ 4 - 0
src/main/java/com/ydtech/modules/inv/service/InvSettlementSourceService.java

@@ -5,6 +5,8 @@ import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.inv.model.po.InvSettlementSource;
 import com.ydtech.modules.inv.model.po.InvSettlementSource;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 
 
+import java.util.List;
+
 /**
 /**
 * @author Administrator
 * @author Administrator
 * @description 针对表【inv_settlement_source(结算来源表)】的数据库操作Service
 * @description 针对表【inv_settlement_source(结算来源表)】的数据库操作Service
@@ -15,4 +17,6 @@ public interface InvSettlementSourceService extends IService<InvSettlementSource
 
 
 
 
     HttpResult readInvSettlementSourceExcel(String File);
     HttpResult readInvSettlementSourceExcel(String File);
+
+    public boolean saveOrUpdateBatchWithConditions(List<InvSettlementSource> invSettlementSources);
 }
 }

+ 4 - 0
src/main/java/com/ydtech/modules/inv/service/InvSourceService.java

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.inv.model.po.InvSource;
 import com.ydtech.modules.inv.model.po.InvSource;
 
 
+import java.util.List;
+
 /**
 /**
 * @author Administrator
 * @author Administrator
 * @description 针对表【inv_source(来源表)】的数据库操作Service
 * @description 针对表【inv_source(来源表)】的数据库操作Service
@@ -11,4 +13,6 @@ import com.ydtech.modules.inv.model.po.InvSource;
 */
 */
 public interface InvSourceService extends IService<InvSource> {
 public interface InvSourceService extends IService<InvSource> {
     HttpResult readExcel(String file);
     HttpResult readExcel(String file);
+
+    boolean saveOrUpdateBatchWithConditions(List<InvSource> invSourceList);
 }
 }

+ 27 - 0
src/main/java/com/ydtech/modules/inv/service/impl/InvChannelAccountServiceImpl.java

@@ -1,8 +1,14 @@
 package com.ydtech.modules.inv.service.impl;
 package com.ydtech.modules.inv.service.impl;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.core.page.PageRequest;
 import com.ydtech.modules.inv.dao.InvChannelAccountMapper;
 import com.ydtech.modules.inv.dao.InvChannelAccountMapper;
+import com.ydtech.modules.inv.model.InvAccount;
 import com.ydtech.modules.inv.model.po.InvChannelAccount;
 import com.ydtech.modules.inv.model.po.InvChannelAccount;
+import com.ydtech.modules.inv.model.po.QueryInvChannelAccount;
 import com.ydtech.modules.inv.service.InvChannelAccountService;
 import com.ydtech.modules.inv.service.InvChannelAccountService;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
@@ -15,6 +21,27 @@ import org.springframework.stereotype.Service;
 public class InvChannelAccountServiceImpl extends ServiceImpl<InvChannelAccountMapper, InvChannelAccount>
 public class InvChannelAccountServiceImpl extends ServiceImpl<InvChannelAccountMapper, InvChannelAccount>
     implements InvChannelAccountService {
     implements InvChannelAccountService {
 
 
+    @Override
+    public IPage<InvChannelAccount> selectAccountsList(QueryInvChannelAccount invChannelAccount) {
+        PageRequest pageRequest = new PageRequest();
+        pageRequest.setPageNum(invChannelAccount.getPageNum());
+        pageRequest.setPageSize(invChannelAccount.getPageSize());
+        Page page = PageRequest.buildPageRequest(pageRequest);
+        LambdaQueryWrapper<InvChannelAccount> wrapper = new LambdaQueryWrapper<>();
+        if(invChannelAccount.getEmployeeId() != null) {
+            wrapper.eq(InvChannelAccount::getEmployeeId, invChannelAccount.getEmployeeId());
+        }
+        if(invChannelAccount.getAccount() != null) {
+            wrapper.eq(InvChannelAccount::getAccount, invChannelAccount.getAccount());
+        }
+        if(invChannelAccount.getMember() != null){
+            wrapper.eq(InvChannelAccount::getMember, invChannelAccount.getMember());
+        }
+        if(invChannelAccount.getPayee() != null){
+            wrapper.eq(InvChannelAccount::getProvince, invChannelAccount.getProvince());
+        }
+        return baseMapper.selectPage(page, wrapper);
+    }
 }
 }
 
 
 
 

+ 271 - 0
src/main/java/com/ydtech/modules/inv/service/impl/InvReceivableServiceImpl.java

@@ -0,0 +1,271 @@
+package com.ydtech.modules.inv.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.core.page.PageRequest;
+import com.ydtech.modules.inv.dao.InvChannelAccountMapper;
+import com.ydtech.modules.inv.dao.InvReceivableMapper;
+import com.ydtech.modules.inv.dao.InvSettlementSourceMapper;
+import com.ydtech.modules.inv.dao.InvSourceMapper;
+import com.ydtech.modules.inv.model.InvAccount;
+import com.ydtech.modules.inv.model.po.InvChannelAccount;
+import com.ydtech.modules.inv.model.po.InvSettlementSource;
+import com.ydtech.modules.inv.model.po.InvSource;
+import com.ydtech.modules.inv.model.po.QueryInvChannelAccount;
+import com.ydtech.modules.inv.model.vo.*;
+import com.ydtech.modules.inv.service.InvChannelAccountService;
+import com.ydtech.modules.inv.service.InvReceivableService;
+import com.ydtech.modules.inv.service.InvSourceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.time.YearMonth;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+* @author Administrator
+* @description 针对表【inv_channel_account(渠道账户表)】的数据库操作Service实现
+* @createDate 2024-01-20 10:29:30
+*/
+@Service
+public class InvReceivableServiceImpl implements InvReceivableService {
+    @Autowired
+    InvReceivableMapper invReceivableMapper;
+
+    @Autowired
+    InvSourceService invSourceService;
+
+    @Autowired
+    InvSourceMapper invSourceMapper;
+
+    @Autowired
+    InvSettlementSourceMapper invSettlementSourceMapper;
+
+    @Override
+    public List<ReceivableResultVo> getReceivableList(String startTime, String endTime) {
+        return invReceivableMapper.getReceivableList(startTime,endTime);
+    }
+
+    @Override
+    public List<SigningSourceResultVo> getSigningSourceResult(String yearMonthStr,String startTime, String endTime) {
+        List<SigningSourceResultVo> signingSources = invReceivableMapper.getSigningSourceResult(startTime, endTime);
+        List<SigningSourceResultVo> signingSourceResult = new ArrayList<>();
+
+        Float jqPremiumTax = 0f;
+        Float syPremiumTax = 0f;
+        Float nonCarPremiumTax = 0f;
+        Float writtenPremium = 0f;
+        Float settlementAmount = 0f;
+
+        for(int i=1;i<=12;i++){
+            //查找day是否有数据
+            String finalI = i < 10 ? "0" + String.valueOf(i) : String.valueOf(i);
+            boolean countBol = signingSources.stream().filter(x -> finalI.equals(x.getDay())).count() > 0 ? true : false;
+            if(countBol)
+            {
+                signingSourceResult.add(signingSources.stream().filter(x -> String.valueOf(finalI).equals(x.getDay())).findFirst().get());
+            }else{
+                SigningSourceResultVo signingSourceResultVo = new SigningSourceResultVo();
+                signingSourceResultVo.setDay(finalI);
+                signingSourceResultVo.setYearmonth(yearMonthStr + "-" + finalI);
+                signingSourceResult.add(signingSourceResultVo);
+            }
+        }
+
+
+        //处理合计
+        for(SigningSourceResultVo vo : signingSourceResult){
+            jqPremiumTax = Float.parseFloat(vo.getJqPremiumTax()) + jqPremiumTax;
+            syPremiumTax = Float.parseFloat(vo.getSyPremiumTax()) + syPremiumTax;
+            nonCarPremiumTax = Float.parseFloat(vo.getNonCarPremiumTax()) + nonCarPremiumTax;
+            writtenPremium = Float.parseFloat(vo.getWrittenPremium()) + writtenPremium;
+            settlementAmount = Float.parseFloat(vo.getTotalAmountReceivable()) + settlementAmount;
+        }
+        SigningSourceResultVo vo = new SigningSourceResultVo();
+        vo.setYearmonth("合计");
+        vo.setJqPremiumTax(String.format("%.2f", jqPremiumTax));
+        vo.setSyPremiumTax(String.format("%.2f", syPremiumTax));
+        vo.setNonCarPremiumTax(String.format("%.2f", nonCarPremiumTax));
+        vo.setWrittenPremium(String.format("%.2f", writtenPremium));
+        vo.setTotalAmountReceivable(String.format("%.2f", settlementAmount));
+        signingSourceResult.add(vo);
+        return signingSourceResult;
+    }
+
+    @Override
+    public List<SettlementSourceResultVo> getSettlementSourceResult(String yearMonthStr, String startTime, String endTime) {
+        List<SettlementSourceResultVo> settlementSources = invReceivableMapper.getSettlementSourceResult(startTime, endTime);
+        List<SettlementSourceResultVo> settlementSourceResult = new ArrayList<>();
+
+        Float jqPremiumTax = 0f;
+        Float syPremiumTax = 0f;
+        Float nonCarPremiumTax = 0f;
+        Float writtenPremium = 0f;
+        Float settlementAmount = 0f;
+
+        for(int i=1;i<=12;i++){
+            //查找day是否有数据
+            String finalI = i < 10 ? "0" + String.valueOf(i) : String.valueOf(i);
+            boolean countBol = settlementSources.stream().filter(x -> finalI.equals(x.getDay())).count() > 0 ? true : false;
+            if(countBol)
+            {
+                settlementSourceResult.add(settlementSources.stream().filter(x -> String.valueOf(finalI).equals(x.getDay())).findFirst().get());
+            }else{
+                SettlementSourceResultVo settlementSourceResultVo = new SettlementSourceResultVo();
+                settlementSourceResultVo.setDay(finalI);
+                settlementSourceResultVo.setYearmonth(yearMonthStr + "-" + String.valueOf(i));
+                settlementSourceResult.add(settlementSourceResultVo);
+            }
+        }
+
+
+        //处理合计
+        for(SettlementSourceResultVo vo : settlementSources){
+            jqPremiumTax = Float.parseFloat(vo.getJqPremiumTax()) + jqPremiumTax;
+            syPremiumTax = Float.parseFloat(vo.getSyPremiumTax()) + syPremiumTax;
+            nonCarPremiumTax = Float.parseFloat(vo.getNonCarPremiumTax()) + nonCarPremiumTax;
+            writtenPremium = Float.parseFloat(vo.getWrittenPremium()) + writtenPremium;
+            settlementAmount = Float.parseFloat(vo.getSettlementAmount()) + settlementAmount;
+        }
+        SettlementSourceResultVo vo = new SettlementSourceResultVo();
+        vo.setYearmonth("合计");
+        vo.setJqPremiumTax(String.format("%.2f", jqPremiumTax));
+        vo.setSyPremiumTax(String.format("%.2f", syPremiumTax));
+        vo.setNonCarPremiumTax(String.format("%.2f", nonCarPremiumTax));
+        vo.setWrittenPremium(String.format("%.2f", writtenPremium));
+        vo.setSettlementAmount(String.format("%.2f", settlementAmount));
+        settlementSourceResult.add(vo);
+
+        //签单数据
+        List<SigningSourceResultVo> signingSourceResult = this.getSigningSourceResult(yearMonthStr, startTime, endTime);
+        //签单合计
+        SigningSourceResultVo signingSourceResultVo = signingSourceResult.get(signingSourceResult.size() - 1);
+        SettlementSourceResultVo voCalc = new SettlementSourceResultVo();
+        Float jq = Float.parseFloat(signingSourceResultVo.getJqPremiumTax()) - Float.parseFloat(vo.getJqPremiumTax());
+        Float sy = Float.parseFloat(signingSourceResultVo.getSyPremiumTax()) - Float.parseFloat(vo.getSyPremiumTax());
+        Float nonCar = Float.parseFloat(signingSourceResultVo.getNonCarPremiumTax()) - Float.parseFloat(vo.getNonCarPremiumTax());
+        Float written = Float.parseFloat(signingSourceResultVo.getWrittenPremium()) - Float.parseFloat(vo.getWrittenPremium());
+        Float settlement = Float.parseFloat(signingSourceResultVo.getTotalAmountReceivable()) - Float.parseFloat(vo.getSettlementAmount());
+        voCalc.setJqPremiumTax(String.format("%.2f", jq));
+        voCalc.setSyPremiumTax(String.format("%.2f", sy));
+        voCalc.setNonCarPremiumTax(String.format("%.2f", nonCar));
+        voCalc.setWrittenPremium(String.format("%.2f", written));
+        voCalc.setSettlementAmount(String.format("%.2f", settlement));
+        voCalc.setYearmonth("签单合计");
+        settlementSourceResult.add(voCalc);
+        return settlementSourceResult;
+    }
+
+    @Override
+    public IPage<InvSource> getRecivablePage(InvSourceQueryVo invSourceQueryVo) {
+        PageRequest pageRequest = new PageRequest();
+        pageRequest.setPageNum(invSourceQueryVo.getPageNum());
+        pageRequest.setPageSize(invSourceQueryVo.getPageSize());
+        Page page = PageRequest.buildPageRequest(pageRequest);
+        LambdaQueryWrapper<InvSource> queryWrapper = new LambdaQueryWrapper<>();
+        if(invSourceQueryVo.getLicenseno() != null && !"".equals(invSourceQueryVo.getLicenseno())){
+            queryWrapper.eq(InvSource::getLicenseno,invSourceQueryVo.getLicenseno());
+        }
+        if(invSourceQueryVo.getJqPolicyId() != null && !"".equals(invSourceQueryVo.getJqPolicyId())){
+            queryWrapper.eq(InvSource::getJqPolicyId,invSourceQueryVo.getJqPolicyId());
+        }
+        if(invSourceQueryVo.getSyPolicyId() != null && !"".equals(invSourceQueryVo.getSyPolicyId())){
+            queryWrapper.eq(InvSource::getSyPolicyId,invSourceQueryVo.getSyPolicyId());
+        }
+        if(invSourceQueryVo.getNonCarPolicyId() != null && !"".equals(invSourceQueryVo.getNonCarPolicyId())){
+            queryWrapper.eq(InvSource::getNonCarPolicyId,invSourceQueryVo.getNonCarPolicyId());
+        }
+        Page pageData = invSourceMapper.selectPage(page, queryWrapper);
+        return pageData;
+    }
+
+    @Override
+    public Boolean updateRecivable(InvSource invSource) {
+        BigDecimal tax = new BigDecimal(1.06);
+        //处理交强不含税
+        invSource.setJqPremium(invSource.getJqPremiumTax().divide(tax,2, RoundingMode.HALF_UP));
+        //处理商业不含税
+        invSource.setSyPremium(invSource.getSyPremiumTax().divide(tax,2, RoundingMode.HALF_UP));
+        //处理非车不含税
+        invSource.setNonCarPremium(invSource.getNonCarPremiumTax().divide(tax,2, RoundingMode.HALF_UP));
+        //处理手续费金额
+        invSource.setPremium(
+                invSource.getJqPremium().multiply(invSource.getJqPremiumRatio())
+                        .add(invSource.getSyPremium().multiply(invSource.getSyPremiumRatio()))
+                        .add(invSource.getNonCarPremium().multiply(invSource.getNonCarPremiumRatio())));
+        //处理非跟单金额
+        invSource.setNonCopying(
+                invSource.getJqPremium().multiply(invSource.getJqNonCopyingRatio())
+                        .add(invSource.getSyPremium().multiply(invSource.getSyNonCopyingRatio()))
+                        .add(invSource.getNonCarPremium().multiply(invSource.getNonCarNonCopyingRatio())));
+        //处理保司应收金额
+        invSource.setReceivable(
+                invSource.getJqPremium().multiply(invSource.getJqReceivableRatio())
+                        .add(invSource.getSyPremium().multiply(invSource.getSyReceivableRatio()))
+                        .add(invSource.getNonCarPremium().multiply(invSource.getNonCarReceivableRatio())));
+        //处理补贴金额
+        invSource.setSubsidyAmount(
+                invSource.getJqPremiumTax().multiply(invSource.getSubsidyRatio())
+                        .add(invSource.getSyPremiumTax().multiply(invSource.getSubsidyRatio()))
+                        .add(invSource.getNonCarPremiumTax().multiply(invSource.getSubsidyRatio())));
+        //处理应收总金额
+        invSource.setTotalReceivableAmount(
+                invSource.getReceivable().add(invSource.getSubsidyAmount()));
+        //处理最大应付金额
+        invSource.setMaxReceivable(
+                invSource.getJqPremiumTax().multiply(invSource.getMaxJqReceivableRatio())
+                        .add(invSource.getSyPremiumTax().multiply(invSource.getMaxSyReceivableRatio()))
+                        .add(invSource.getNonCarPremiumTax().multiply(invSource.getMaxNonCarReceivableRatio())));
+
+        return invSourceMapper.updateById(invSource) > 0 ? true : false;
+    }
+
+    @Override
+    public IPage<InvSettlementSource> getSettlementPage(InvSettlementSourceQueryVo invSettlementSourceQueryVo) {
+        PageRequest pageRequest = new PageRequest();
+        pageRequest.setPageNum(invSettlementSourceQueryVo.getPageNum());
+        pageRequest.setPageSize(invSettlementSourceQueryVo.getPageSize());
+        Page page = PageRequest.buildPageRequest(pageRequest);
+        LambdaQueryWrapper<InvSettlementSource> queryWrapper = new LambdaQueryWrapper<>();
+        if(invSettlementSourceQueryVo.getLicenseno() != null && !"".equals(invSettlementSourceQueryVo.getLicenseno())){
+            queryWrapper.eq(InvSettlementSource::getLicenseno,invSettlementSourceQueryVo.getLicenseno());
+        }
+        if(invSettlementSourceQueryVo.getJqPolicyId() != null && !"".equals(invSettlementSourceQueryVo.getJqPolicyId())){
+            queryWrapper.eq(InvSettlementSource::getJqPolicyId,invSettlementSourceQueryVo.getJqPolicyId());
+        }
+        if(invSettlementSourceQueryVo.getSyPolicyId() != null && !"".equals(invSettlementSourceQueryVo.getSyPolicyId())){
+            queryWrapper.eq(InvSettlementSource::getSyPolicyId,invSettlementSourceQueryVo.getSyPolicyId());
+        }
+        if(invSettlementSourceQueryVo.getNonCarPolicyId() != null && !"".equals(invSettlementSourceQueryVo.getNonCarPolicyId())){
+            queryWrapper.eq(InvSettlementSource::getNonCarPolicyId,invSettlementSourceQueryVo.getNonCarPolicyId());
+        }
+        Page pageData = invSettlementSourceMapper.selectPage(page, queryWrapper);
+
+        return pageData;
+    }
+
+    @Override
+    public Boolean updateSettlement(InvSettlementSource invSettlementSource) {
+        //处理结算金额
+        invSettlementSource.setSettlementAmount(invSettlementSource.getJqPremiumTax().multiply(invSettlementSource.getCompulsoryExportRatio()
+                .add(invSettlementSource.getSyPremiumTax().multiply(invSettlementSource.getCommercialExportRatio()))
+                .add(invSettlementSource.getNonCarPremiumTax().multiply(invSettlementSource.getNonVehicleExportRatio()))));
+        return invSettlementSourceMapper.updateById(invSettlementSource) > 0 ? true : false;
+    }
+
+    @Override
+    public Integer syncStatus() {
+        Integer i = invSourceMapper.syncStatus();
+        return i;
+    }
+}
+
+
+
+

+ 35 - 24
src/main/java/com/ydtech/modules/inv/service/impl/InvSettlementSourceServiceImpl.java

@@ -1,15 +1,20 @@
 package com.ydtech.modules.inv.service.impl;
 package com.ydtech.modules.inv.service.impl;
 
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.inv.dao.InvSettlementSourceMapper;
 import com.ydtech.modules.inv.dao.InvSettlementSourceMapper;
 import com.ydtech.modules.inv.model.excel.InvSettlementSourceExcel;
 import com.ydtech.modules.inv.model.excel.InvSettlementSourceExcel;
 import com.ydtech.modules.inv.model.po.InvSettlementSource;
 import com.ydtech.modules.inv.model.po.InvSettlementSource;
+import com.ydtech.modules.inv.model.po.InvSource;
 import com.ydtech.modules.inv.service.InvSettlementSourceService;
 import com.ydtech.modules.inv.service.InvSettlementSourceService;
 import com.ydtech.modules.inv.utils.EasyExcelUtils;
 import com.ydtech.modules.inv.utils.EasyExcelUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.LocalDate;
@@ -33,31 +38,37 @@ public class InvSettlementSourceServiceImpl extends ServiceImpl<InvSettlementSou
     @Override
     @Override
     public HttpResult readInvSettlementSourceExcel(String file) {
     public HttpResult readInvSettlementSourceExcel(String file) {
         List<InvSettlementSourceExcel> invSettlementSourceExcels = EasyExcelUtils.readInvSettlementSourceExcelExcel(uploadFilePath + file, InvSettlementSourceExcel.class);
         List<InvSettlementSourceExcel> invSettlementSourceExcels = EasyExcelUtils.readInvSettlementSourceExcelExcel(uploadFilePath + file, InvSettlementSourceExcel.class);
-        List<InvSettlementSource> invSettlementSources = new ArrayList<>();
-        for (InvSettlementSourceExcel invSettlementSourceExcel : invSettlementSourceExcels){
-            InvSettlementSource invSettlementSource = new InvSettlementSource();
-            invSettlementSource.setEmployeeId(invSettlementSourceExcel.getEmployeeId());
-            invSettlementSource.setSignDate(LocalDate.from(invSettlementSourceExcel.getSignDate()));
-            invSettlementSource.setLicenseno(invSettlementSourceExcel.getLicenseno());
-            invSettlementSource.setInsuredName(invSettlementSourceExcel.getInsuredName());
-            invSettlementSource.setInsuranceCompany(invSettlementSourceExcel.getInsuranceCompany());
-            invSettlementSource.setInsuranceType(invSettlementSourceExcel.getInsuranceType());
-            invSettlementSource.setBusinessOwner(invSettlementSourceExcel.getBusinessOwner());
-            invSettlementSource.setJqPolicyId(invSettlementSourceExcel.getJqPolicyId());
-            invSettlementSource.setSyPolicyId(invSettlementSourceExcel.getSyPolicyId());
-            invSettlementSource.setNonCarPolicyId(invSettlementSourceExcel.getNonCarPolicyId());
-            invSettlementSource.setJqPremiumTax(new BigDecimal(invSettlementSourceExcel.getJqPremiumTax()));
-            invSettlementSource.setSyPremiumTax(new BigDecimal(invSettlementSourceExcel.getSyPremiumTax()));
-            invSettlementSource.setNonCarPremiumTax(new BigDecimal(invSettlementSourceExcel.getNonCarPremiumTax()));
-            invSettlementSource.setCompulsoryExportRatio(new BigDecimal(invSettlementSourceExcel.getCompulsoryExportRatio().substring(0,invSettlementSourceExcel.getCompulsoryExportRatio().length()-1)));
-            invSettlementSource.setCommercialExportRatio(new BigDecimal(invSettlementSourceExcel.getCommercialExportRatio().substring(0,invSettlementSourceExcel.getCommercialExportRatio().length()-1)));
-            invSettlementSource.setNonVehicleExportRatio(new BigDecimal(invSettlementSourceExcel.getNonVehicleExportRatio().substring(0,invSettlementSourceExcel.getNonVehicleExportRatio().length()-1)));
-            invSettlementSource.setSettlementAmount(new BigDecimal(invSettlementSourceExcel.getSettlementAmount()));
-            invSettlementSource.setAgencySettlementTime(LocalDate.from(invSettlementSourceExcel.getAgencySettlementTime()));
-            invSettlementSources.add(invSettlementSource);
+        List<InvSettlementSource> invSettlementSources = JSONArray.parseArray(JSONArray.toJSONString(invSettlementSourceExcels),InvSettlementSource.class);
+        boolean result = invSettlementSourceService.saveOrUpdateBatchWithConditions(invSettlementSources);
+        return result ? HttpResult.ok("导入成功") : HttpResult.error("导入失败");
+    }
+
+    /**
+     * 导入InvSettlementSource 处理重复导入
+     * @param invSettlementSources
+     * @return
+     */
+    @Override
+    @Transactional
+    public boolean saveOrUpdateBatchWithConditions(List<InvSettlementSource> invSettlementSources) {
+        try {
+            for (InvSettlementSource invSettlementSource : invSettlementSources) {
+                InvSettlementSource one = baseMapper.selectOne(new LambdaQueryWrapper<InvSettlementSource>()
+                        .eq(InvSettlementSource::getLicenseno, invSettlementSource.getLicenseno())
+                        .eq(InvSettlementSource::getJqPolicyId, invSettlementSource.getJqPolicyId())
+                        .eq(InvSettlementSource::getSyPolicyId, invSettlementSource.getSyPolicyId())
+                        .eq(InvSettlementSource::getNonCarPolicyId, invSettlementSource.getNonCarPolicyId()));
+                if (one != null) {
+                    invSettlementSource.setId(one.getId());
+                    baseMapper.updateById(invSettlementSource);
+                } else {
+                    baseMapper.insert(invSettlementSource);
+                }
+            }
+        }catch(Exception e){
+            return false;
         }
         }
-        invSettlementSourceService.saveBatch(invSettlementSources);
-        return HttpResult.ok(invSettlementSourceExcels);
+        return true;
     }
     }
 
 
 }
 }

+ 34 - 44
src/main/java/com/ydtech/modules/inv/service/impl/InvSourceServiceImpl.java

@@ -1,5 +1,8 @@
 package com.ydtech.modules.inv.service.impl;
 package com.ydtech.modules.inv.service.impl;
 
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.modules.inv.dao.InvSourceMapper;
 import com.ydtech.modules.inv.dao.InvSourceMapper;
@@ -11,6 +14,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.ArrayList;
@@ -33,53 +37,39 @@ public class InvSourceServiceImpl extends ServiceImpl<InvSourceMapper, InvSource
     @Override
     @Override
     public HttpResult readExcel(String file) {
     public HttpResult readExcel(String file) {
         List<InvSourceExcel> invSourceExcels = EasyExcelUtils.readInvSourceExcel(uploadFilePath + file, InvSourceExcel.class);
         List<InvSourceExcel> invSourceExcels = EasyExcelUtils.readInvSourceExcel(uploadFilePath + file, InvSourceExcel.class);
-        List<InvSource> invSources = new ArrayList<>();
-        for(InvSourceExcel invSourceExcel:invSourceExcels){
-            InvSource invSource = new InvSource();
-            if (invSourceExcel.getInsuranceId() != null){
-                invSource.setInsuranceId(Long.valueOf(invSourceExcel.getInsuranceId()));
-            }
+        List<InvSource> invSources = JSON.parseArray(JSONArray.toJSONString(invSourceExcels), InvSource.class);
+        boolean result = invSourceService.saveOrUpdateBatchWithConditions(invSources);
+        return result ? HttpResult.ok("导入成功") : HttpResult.error("导入失败");
+    }
 
 
-            invSource.setInsuranceName(invSourceExcel.getInsuranceName());
-            invSource.setInsuranceDept(invSourceExcel.getInsuranceDept());
-            invSource.setInsuranceDeptId(invSourceExcel.getInsuranceDeptId());
-            invSource.setRisk(invSourceExcel.getRisk());
-            invSource.setJqPolicyId(invSourceExcel.getJqPolicyId());
-            invSource.setJqPremium(new BigDecimal(invSourceExcel.getJqPremium()));
-            invSource.setJqPremiumTax(new BigDecimal(invSourceExcel.getJqPremiumTax()));
-            invSource.setSyPolicyId(invSourceExcel.getSyPolicyId());
-            invSource.setSyPremium(new BigDecimal(invSourceExcel.getSyPremium()));
-            invSource.setSyPremiumTax(new BigDecimal(invSourceExcel.getSyPremiumTax()));
-            invSource.setNonCarPolicyId(invSourceExcel.getNonCarPolicyId());
-            invSource.setNonCarPremiumTax(new BigDecimal(invSourceExcel.getNonCarPremiumTax()));
-            invSource.setNonCarPremium(new BigDecimal(invSourceExcel.getNonCarPremium()));
-            invSource.setInsuredName(invSourceExcel.getInsuredName());
-            invSource.setLicenseno(invSourceExcel.getLicenseno());
-            invSource.setSigningTime(invSourceExcel.getSigningTime().toLocalDate());
-            invSource.setClearingTime(invSourceExcel.getClearingTime().toLocalDate());
-            invSource.setTaxamount(new BigDecimal(invSourceExcel.getTaxamount()));
-            invSource.setJqReceivableRatio(new BigDecimal(invSourceExcel.getJqReceivableRatio().substring(0,invSourceExcel.getJqReceivableRatio().length()-1)));
-            invSource.setJqPremiumRatio(new BigDecimal(invSourceExcel.getJqPremiumRatio().substring(0,invSourceExcel.getJqPremiumRatio().length()-1)));
-            invSource.setJqNonCopyingRatio(new BigDecimal(invSourceExcel.getJqNonCopyingRatio().substring(0,invSourceExcel.getJqNonCopyingRatio().length()-1)));
-            invSource.setSyReceivableRatio(new BigDecimal(invSourceExcel.getSyReceivableRatio().substring(0,invSourceExcel.getSyReceivableRatio().length()-1)));
-            invSource.setSyPremiumRatio(new BigDecimal(invSourceExcel.getSyPremiumRatio().substring(0,invSourceExcel.getSyPremiumRatio().length()-1)));
-            invSource.setSyNonCopyingRatio(new BigDecimal(invSourceExcel.getSyNonCopyingRatio().substring(0,invSourceExcel.getSyNonCopyingRatio().length()-1)));
-            invSource.setNonCarReceivableRatio(new BigDecimal(invSourceExcel.getNonCarReceivableRatio().substring(0,invSourceExcel.getNonCarReceivableRatio().length()-1)));
-            invSource.setNonCarPremiumRatio(new BigDecimal(invSourceExcel.getNonCarPremiumRatio().substring(0,invSourceExcel.getNonCarPremiumRatio().length()-1)));
-            invSource.setNonCarNonCopyingRatio(new BigDecimal(invSourceExcel.getNonCarNonCopyingRatio().substring(0,invSourceExcel.getNonCarNonCopyingRatio().length()-1)));
-            invSource.setPremium(new BigDecimal(invSourceExcel.getPremium()));
-            invSource.setNonCopying(new BigDecimal(invSourceExcel.getNonCopying()));
-            invSource.setReceivable(new BigDecimal(invSourceExcel.getReceivable()));
-            invSource.setMaxJqReceivableRatio(new BigDecimal(invSourceExcel.getMaxJqReceivableRatio().substring(0,invSourceExcel.getMaxJqReceivableRatio().length()-1)));
-            invSource.setMaxSyReceivableRatio(new BigDecimal(invSourceExcel.getMaxSyReceivableRatio().substring(0,invSourceExcel.getMaxSyReceivableRatio().length()-1)));
-            invSource.setMaxNonCarReceivableRatio(new BigDecimal(invSourceExcel.getMaxNonCarReceivableRatio().substring(0,invSourceExcel.getMaxNonCarReceivableRatio().length()-1)));
-            invSource.setMaxReceivable(invSourceExcel.getMaxReceivable());
-            invSource.setClearingState(invSourceExcel.getClearingState());
-            invSources.add(invSource);
+    /**
+     * 导入InsSource 处理重复导入
+     * @param invSourceList
+     * @return
+     */
+    @Override
+    @Transactional
+    public boolean saveOrUpdateBatchWithConditions(List<InvSource> invSourceList) {
+        try {
+            for (InvSource invSource : invSourceList) {
+                InvSource one = baseMapper.selectOne(new LambdaQueryWrapper<InvSource>()
+                        .eq(InvSource::getLicenseno, invSource.getLicenseno())
+                        .eq(InvSource::getJqPolicyId, invSource.getJqPolicyId())
+                        .eq(InvSource::getSyPolicyId, invSource.getSyPolicyId())
+                        .eq(InvSource::getNonCarPolicyId, invSource.getNonCarPolicyId()));
+                if (one != null) {
+                    invSource.setId(one.getId());
+                    baseMapper.updateById(invSource);
+                } else {
+                    baseMapper.insert(invSource);
+                }
+            }
+        }catch(Exception e){
+            return false;
         }
         }
-        invSourceService.saveBatch(invSources);
-        return  HttpResult.ok();
+        return true;
     }
     }
+
 }
 }
 
 
 
 

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

@@ -9,6 +9,8 @@ import com.ydtech.modules.inv.model.InvAccountExcel;
 import com.ydtech.modules.inv.model.excel.InvSettlementSourceExcel;
 import com.ydtech.modules.inv.model.excel.InvSettlementSourceExcel;
 import com.ydtech.modules.inv.model.excel.InvSourceExcel;
 import com.ydtech.modules.inv.model.excel.InvSourceExcel;
 import com.ydtech.modules.inv.service.InvAccountExcelService;
 import com.ydtech.modules.inv.service.InvAccountExcelService;
+import com.ydtech.modules.inv.utils.excel.InvSettlementSourceDataListener;
+import com.ydtech.modules.inv.utils.excel.InvSourceDataListener;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
@@ -37,16 +39,21 @@ public class EasyExcelUtils {
     public static List<InvSourceExcel> readInvSourceExcel(String uploadFilePath, Class clz) {
     public static List<InvSourceExcel> readInvSourceExcel(String uploadFilePath, Class clz) {
 
 
         // 这里默认每次会读取100条数据 然后返回过来 直接调用使用数据就行
         // 这里默认每次会读取100条数据 然后返回过来 直接调用使用数据就行
-        List<InvSourceExcel> list = new ArrayList<>();
-        EasyExcel.read(uploadFilePath, clz, new PageReadListener<InvSourceExcel>(list::addAll)).sheet().sheetName("来源表(1)").doRead();
+//        List<InvSourceExcel> list = new ArrayList<>();
+        List<InvSourceExcel> list = EasyExcel.read(uploadFilePath, clz, new InvSourceDataListener())
+                .sheet()
+                .sheetName("来源表")
+                .doReadSync();
         return list;
         return list;
     }
     }
 
 
     public static List<InvSettlementSourceExcel> readInvSettlementSourceExcelExcel(String uploadFilePath, Class clz) {
     public static List<InvSettlementSourceExcel> readInvSettlementSourceExcelExcel(String uploadFilePath, Class clz) {
 
 
         // 这里默认每次会读取100条数据 然后返回过来 直接调用使用数据就行
         // 这里默认每次会读取100条数据 然后返回过来 直接调用使用数据就行
-        List<InvSettlementSourceExcel> list = new ArrayList<>();
-        EasyExcel.read(uploadFilePath, clz, new PageReadListener<InvSettlementSourceExcel>(list::addAll)).sheet().sheetName("结算来源表(3)").doRead();
+        List<InvSettlementSourceExcel> list = EasyExcel.read(uploadFilePath, clz, new InvSettlementSourceDataListener())
+                .sheet()
+                .sheetName("结算来源表")
+                .doReadSync();
         return list;
         return list;
     }
     }
 
 

+ 74 - 0
src/main/java/com/ydtech/modules/inv/utils/excel/InvSettlementSourceDataListener.java

@@ -0,0 +1,74 @@
+package com.ydtech.modules.inv.utils.excel;
+
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.read.listener.ReadListener;
+import com.alibaba.excel.util.ListUtils;
+import com.ydtech.modules.inv.model.excel.InvSettlementSourceExcel;
+import com.ydtech.modules.inv.model.excel.InvSourceExcel;
+
+import java.lang.reflect.Field;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.List;
+
+public class InvSettlementSourceDataListener implements ReadListener<InvSettlementSourceExcel> {
+
+    /**
+     * 缓存的数据
+     */
+    private List<InvSettlementSourceExcel> cachedDataList = new ArrayList<>();
+
+
+    public InvSettlementSourceDataListener() {
+        // 这里是demo,所以随便new一个。实际使用如果到了spring,请使用下面的有参构造函数
+
+    }
+
+    public InvSettlementSourceDataListener(List<InvSettlementSourceExcel> invSettlementSourceExcels) {
+        invSettlementSourceExcels.addAll(cachedDataList);
+    }
+
+
+    /**
+     * 这个每一条数据解析都会来调用
+     *
+     * @param data    one row value. Is is same as {@link AnalysisContext#readRowHolder()}
+     * @param context
+     */
+    @Override
+    public void invoke(InvSettlementSourceExcel data, AnalysisContext context) {
+        Field[] fields = data.getClass().getDeclaredFields();
+        for(Field field:fields){
+            field.setAccessible(true);
+            try {
+                    //处理日期格式
+                    if("signDate".equals(field.getName()) || "agencySettlementTime".equals(field.getName())){
+                        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+                        LocalDate o = LocalDate.parse(field.get(data).toString(),DateTimeFormatter.ISO_DATE);
+                        field.set(data,formatter.format(o));
+                    }else{
+                        if(field.get(data) == null){
+                            field.set(data,"0");
+                        }else{
+                            field.set(data,field.get(data).toString());
+                        }
+                    }
+            } catch (IllegalAccessException e) {
+                e.printStackTrace();
+            }
+        }
+        cachedDataList.add(data);
+    }
+
+    /**
+     * 所有数据解析完成了 都会来调用
+     *
+     * @param context
+     */
+    @Override
+    public void doAfterAllAnalysed(AnalysisContext context) {
+        // 这里也要保存数据,确保最后遗留的数据也存储到数据库
+    }
+
+}

+ 87 - 0
src/main/java/com/ydtech/modules/inv/utils/excel/InvSourceDataListener.java

@@ -0,0 +1,87 @@
+package com.ydtech.modules.inv.utils.excel;
+
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.read.listener.ReadListener;
+import com.alibaba.excel.util.ListUtils;
+import com.ydtech.modules.inv.model.excel.InvSourceExcel;
+
+import java.lang.reflect.Field;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.List;
+
+public class InvSourceDataListener implements ReadListener<InvSourceExcel> {
+
+    /**
+     * 每隔5条存储数据库,实际使用中可以100条,然后清理list ,方便内存回收
+     */
+    private static final int BATCH_COUNT = 100;
+    /**
+     * 缓存的数据
+     */
+    private List<InvSourceExcel> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
+
+
+    public InvSourceDataListener() {
+        // 这里是demo,所以随便new一个。实际使用如果到了spring,请使用下面的有参构造函数
+
+    }
+
+    public InvSourceDataListener(List<InvSourceExcel> invSourceExcel) {
+        invSourceExcel.addAll(cachedDataList);
+    }
+
+
+    /**
+     * 这个每一条数据解析都会来调用
+     *
+     * @param data    one row value. Is is same as {@link AnalysisContext#readRowHolder()}
+     * @param context
+     */
+    @Override
+    public void invoke(InvSourceExcel data, AnalysisContext context) {
+        Field[] fields = data.getClass().getDeclaredFields();
+        for(Field field:fields){
+            field.setAccessible(true);
+            try {
+                    //处理日期格式
+                    if("clearingTime".equals(field.getName()) || "signingTime".equals(field.getName())){
+                        if("0".equals(field.get(data))){
+                            field.set(data,"0");
+                        }else{
+                            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+                            LocalDate o = LocalDate.parse(field.get(data).toString(),DateTimeFormatter.ISO_DATE);
+                            field.set(data,formatter.format(o));
+                        }
+
+                    }else{
+                        if(field.get(data) == null){
+                            field.set(data,"0");
+                        }else{
+                            field.set(data,field.get(data).toString());
+                        }
+                    }
+            } catch (IllegalAccessException e) {
+                e.printStackTrace();
+            }
+        }
+        cachedDataList.add(data);
+        // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM
+        if (cachedDataList.size() >= BATCH_COUNT) {
+            // 存储完成清理 list
+            cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
+        }
+    }
+
+    /**
+     * 所有数据解析完成了 都会来调用
+     *
+     * @param context
+     */
+    @Override
+    public void doAfterAllAnalysed(AnalysisContext context) {
+        // 这里也要保存数据,确保最后遗留的数据也存储到数据库
+        System.out.printf(context.toString());
+    }
+
+}

+ 93 - 0
src/main/resources/mapper/modules/inv/InvReceivableMapper.xml

@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ydtech.modules.inv.dao.InvReceivableMapper">
+
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.inv.model.vo.ReceivableResultVo">
+    </resultMap>
+
+    <select id="getReceivableList" resultType="com.ydtech.modules.inv.model.vo.ReceivableResultVo">
+        SELECT
+        DATE_FORMAT( signing_time, '%d') as day,
+        DATE_FORMAT( signing_time, '%Y-%m' ) as yearmonth,
+        insurance_name,
+        sum( jq_premium_tax ) as jq_premium_tax,
+        sum(jq_premium) as jq_premium,
+        sum(sy_premium_tax) as sy_premium_tax,
+        sum(sy_premium) as sy_premium,
+        sum(taxamount) as taxamount,
+        sum(non_car_premium_tax) as non_car_premium_tax,
+        sum(non_car_premium) as non_car_premium,
+        sum(premium) as premium,
+        sum(non_copying) as non_copying,
+        sum(jq_premium_tax + sy_premium_tax + non_car_premium_tax) as total_permium,
+        sum(premium + non_copying) as total_receivable,
+        sum(subsidy_amount) as subsidy_amount,
+        sum(total_receivable_amount) as total_receivable_amount
+        FROM
+        inv_source
+        WHERE
+        signing_time BETWEEN #{startTime}
+        AND #{endTime}
+        <!--and insurance_id = '123'-->
+        GROUP BY
+        insurance_id,
+        DATE_FORMAT(
+        signing_time,
+        '%Y-%m-%d')
+    </select>
+
+    <select id="getSigningSourceResult" resultType="com.ydtech.modules.inv.model.vo.SigningSourceResultVo">
+        SELECT
+        DATE_FORMAT( signing_time, '%m') as day,
+        DATE_FORMAT( signing_time, '%Y-%m' ) as yearmonth,
+        insurance_name,
+        sum( jq_premium_tax ) as jq_premium_tax,
+        sum(jq_premium) as jq_premium,
+        sum(sy_premium_tax) as sy_premium_tax,
+        sum(sy_premium) as sy_premium,
+        sum(taxamount) as taxamount,
+        sum(non_car_premium_tax) as non_car_premium_tax,
+        sum(non_car_premium) as non_car_premium,
+        sum(premium) as premium,
+        sum(non_copying) as non_copying,
+        sum(jq_premium_tax + sy_premium_tax + non_car_premium_tax) as written_premium,
+        sum(premium + non_copying) as total_receivable,
+        sum(receivable) as total_amount_receivable
+        FROM
+        inv_source
+        WHERE
+        signing_time BETWEEN #{startTime}
+        AND #{endTime}
+        <!--and insurance_id = '123'-->
+        GROUP BY
+        insurance_id,
+        DATE_FORMAT(
+        signing_time,
+        '%Y-%m')
+    </select>
+
+    <select id="getSettlementSourceResult" resultType="com.ydtech.modules.inv.model.vo.SettlementSourceResultVo">
+        SELECT
+            DATE_FORMAT( agency_settlement_time, '%m' ) AS DAY,
+            DATE_FORMAT( agency_settlement_time, '%Y-%m' ) AS yearmonth,
+            insurance_company,
+            sum( jq_premium_tax ) AS jq_premium_tax,
+            sum( sy_premium_tax ) AS sy_premium_tax,
+            sum( non_car_premium_tax ) AS non_car_premium_tax,
+            sum( jq_premium_tax + sy_premium_tax + non_car_premium_tax ) AS writtenPremium,
+            sum( settlement_amount ) AS settlement_amount
+        FROM
+            inv_settlement_source
+        WHERE
+            agency_settlement_time BETWEEN #{startTime}
+                AND #{endTime}
+        GROUP BY
+            insurance_company,
+            DATE_FORMAT(
+                    agency_settlement_time,
+                    '%Y-%m')
+    </select>
+
+</mapper>

+ 10 - 0
src/main/resources/mapper/modules/inv/InvSourceMapper.xml

@@ -59,4 +59,14 @@
         max_sy_receivable_ratio,max_non_car_receivable_ratio,max_receivable,
         max_sy_receivable_ratio,max_non_car_receivable_ratio,max_receivable,
         clearing_state
         clearing_state
     </sql>
     </sql>
+
+    <update id="syncStatus">
+        UPDATE inv_source ins,
+            inv_settlement_source iss
+        SET ins.clearing_state = 1
+            AND ins.jq_policy_id = iss.jq_policy_id
+            AND ins.sy_policy_id = iss.sy_policy_id
+            AND ins.non_car_policy_id = iss.non_car_policy_id
+            AND ins.licenseno = iss.licenseno
+    </update>
 </mapper>
 </mapper>