Selaa lähdekoodia

1. 結算需求 1.0

wuhp 2 vuotta sitten
vanhempi
commit
7e250d4c02
22 muutettua tiedostoa jossa 955 lisäystä ja 4 poistoa
  1. 35 4
      src/main/java/com/ydtech/modules/fnc/controller/InsPlyIncomeController.java
  2. 40 0
      src/main/java/com/ydtech/modules/fnc/controller/SettlementDocumentaryFeesController.java
  3. 40 0
      src/main/java/com/ydtech/modules/fnc/controller/SettlementDocumentaryLogController.java
  4. 11 0
      src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java
  5. 19 0
      src/main/java/com/ydtech/modules/fnc/dao/SettlementDocumentaryFeesMapper.java
  6. 12 0
      src/main/java/com/ydtech/modules/fnc/dao/SettlementDocumentaryLogMapper.java
  7. 48 0
      src/main/java/com/ydtech/modules/fnc/entity/InsPlyIncome.java
  8. 66 0
      src/main/java/com/ydtech/modules/fnc/entity/SettlementDocumentaryFeesEntity.java
  9. 40 0
      src/main/java/com/ydtech/modules/fnc/entity/SettlementDocumentaryLogEntity.java
  10. 15 0
      src/main/java/com/ydtech/modules/fnc/service/InsPlyIncomeService.java
  11. 18 0
      src/main/java/com/ydtech/modules/fnc/service/SettlementDocumentaryFeesService.java
  12. 16 0
      src/main/java/com/ydtech/modules/fnc/service/SettlementDocumentaryLogService.java
  13. 190 0
      src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java
  14. 62 0
      src/main/java/com/ydtech/modules/fnc/service/impl/SettlementDocumentaryFeesServiceImpl.java
  15. 25 0
      src/main/java/com/ydtech/modules/fnc/service/impl/SettlementDocumentaryLogImpl.java
  16. 42 0
      src/main/java/com/ydtech/modules/fnc/vo/InsPlyIncomeVo.java
  17. 58 0
      src/main/java/com/ydtech/modules/fnc/vo/SettlementDocumentaryFeesVo.java
  18. 46 0
      src/main/java/com/ydtech/modules/fnc/vo/SettlementDocumentaryLogVo.java
  19. 10 0
      src/main/java/com/ydtech/modules/order/service/impl/DaJiaOrderServiceImpl.java
  20. 98 0
      src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml
  21. 47 0
      src/main/resources/mapper/modules/fnc/SettlementDocumentaryFeesMapper.xml
  22. 17 0
      src/main/resources/mapper/modules/fnc/SettlementDocumentaryLogMapper.xml

+ 35 - 4
src/main/java/com/ydtech/modules/fnc/controller/InsPlyIncomeController.java

@@ -1,6 +1,7 @@
 package com.ydtech.modules.fnc.controller;
 
 import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.admin.model.vo.SysUserBankCardVO;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.fnc.entity.InsPlyIncome;
 import com.ydtech.modules.fnc.service.InsPlyIncomeService;
@@ -10,15 +11,15 @@ import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.entity.vo.OrderQueryVo;
 import com.ydtech.utils.StringUtils;
 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.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
+import java.time.LocalDate;
 import java.time.Period;
+import java.util.List;
 
 /**
  * <p>
@@ -64,5 +65,35 @@ public class InsPlyIncomeController extends BaseController {
 
         return result;
     }
+    @PostMapping("/query")
+    @ApiOperation(value = "[1]保司费用查询new")
+    public HttpResult<BasePageResult<InsPlyIncome>> query(@RequestBody @Valid InsPlyIncomeVo insPlyIncomeVo) {
+
+        HttpResult<BasePageResult<InsPlyIncome>> result=insPlyIncomeService.queryNew(insPlyIncomeVo);
+
+        return result;
+    }
+    @PutMapping("/balance")
+    @ApiModelProperty(value = "结算手续费")
+    public HttpResult<Object> balance(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        insPlyIncomeService.uodateBalance(insPlyIncomeVo);
+        return HttpResult.ok("手续费结算成功");
+    }
+
+    @PostMapping("/totalQuery")
+    @ApiOperation(value = "跟单费总数")
+    public HttpResult<BasePageResult<InsPlyIncome>> totalQuery(@RequestBody @Valid InsPlyIncomeVo insPlyIncomeVo) {
+        HttpResult<BasePageResult<InsPlyIncome>> result=insPlyIncomeService.totalQuery(insPlyIncomeVo);
+        return result;
+    }
+
+    @PutMapping("/batchBalance")
+    @ApiModelProperty(value = "批量跟单费")
+    public HttpResult<Object> batchBalance(@RequestBody InsPlyIncomeVo insPlyIncomeVo) {
+        insPlyIncomeService.batchBalance(insPlyIncomeVo);
+        return HttpResult.ok("批量跟单费结算成功");
+    }
+
+
 
 }

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

@@ -0,0 +1,40 @@
+package com.ydtech.modules.fnc.controller;
+
+import com.ydtech.core.page.HttpResult;
+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.SettlementDocumentaryFeesVo;
+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.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+
+@RestController
+@Api(tags = "跟单费结算")
+@RequestMapping("/fnc/SettlementFees")
+public class SettlementDocumentaryFeesController extends BaseController {
+    @Autowired
+    private SettlementDocumentaryFeesService settlementDocumentaryFeesService;
+
+    @PostMapping("/query")
+    @ApiOperation(value = "查询")
+    public BasePageResult<SettlementDocumentaryFeesEntity> query(@RequestBody @Valid SettlementDocumentaryFeesVo settlementDocumentaryFeesVo) {
+        BasePageResult<SettlementDocumentaryFeesEntity> result=settlementDocumentaryFeesService.querySettle(settlementDocumentaryFeesVo);
+        return result;
+    }
+
+    @PostMapping("/insert")
+    @ApiOperation("提交")
+    public void submit(@RequestBody SettlementDocumentaryFeesVo settlementDocumentaryFeesVo) {
+       settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
+    }
+
+}

+ 40 - 0
src/main/java/com/ydtech/modules/fnc/controller/SettlementDocumentaryLogController.java

@@ -0,0 +1,40 @@
+package com.ydtech.modules.fnc.controller;
+
+import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity;
+import com.ydtech.modules.fnc.entity.SettlementDocumentaryLogEntity;
+import com.ydtech.modules.fnc.service.SettlementDocumentaryFeesService;
+import com.ydtech.modules.fnc.service.SettlementDocumentaryLogService;
+import com.ydtech.modules.fnc.vo.SettlementDocumentaryFeesVo;
+import com.ydtech.modules.fnc.vo.SettlementDocumentaryLogVo;
+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.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+
+@RestController
+@Api(tags = "跟单费结算")
+@RequestMapping("/fnc/SettlementFeesLog")
+public class SettlementDocumentaryLogController {
+
+
+
+    @Autowired
+    private SettlementDocumentaryLogService settlementDocumentaryLogService;
+
+    @PostMapping("/query")
+    @ApiOperation(value = "查询")
+    public BasePageResult<SettlementDocumentaryLogEntity> query(@RequestBody @Valid SettlementDocumentaryLogVo settlementDocumentaryLogVo) {
+        BasePageResult<SettlementDocumentaryLogEntity> result=settlementDocumentaryLogService.querySettle(settlementDocumentaryLogVo);
+        return result;
+    }
+
+
+
+
+}

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

@@ -1,13 +1,16 @@
 package com.ydtech.modules.fnc.dao;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.modules.fnc.entity.InsPlyIncome;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ydtech.modules.fnc.entity.InsPlySettleDetail;
 import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
 import com.ydtech.modules.fnc.vo.InsPlySettleVo;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -72,4 +75,12 @@ public interface InsPlyIncomeMapper extends BaseMapper<InsPlyIncome> {
     )
     List<InsPlyIncome> selectSettleByCondition(InsPlySettleVo insPlySettleVo);
 
+
+
+    List<InsPlyIncome> queryNew(HashMap<String, Object> params);
+
+    List<InsPlyIncome> totalQuery(HashMap<String, Object> params);
+
+    void uopdateByOrderno(InsPlyIncome insPlyIncome);
+
 }

+ 19 - 0
src/main/java/com/ydtech/modules/fnc/dao/SettlementDocumentaryFeesMapper.java

@@ -0,0 +1,19 @@
+package com.ydtech.modules.fnc.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity;
+import com.ydtech.modules.fnc.entity.SettlementDocumentaryLogEntity;
+import com.ydtech.modules.fnc.vo.SettlementDocumentaryFeesVo;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.HashMap;
+import java.util.List;
+
+@Mapper
+public interface SettlementDocumentaryFeesMapper  extends BaseMapper<SettlementDocumentaryFeesEntity> {
+
+    Page<SettlementDocumentaryFeesEntity> querySettle(SettlementDocumentaryFeesVo settlementDocumentaryFeesVo, Page<SettlementDocumentaryFeesEntity> page);
+
+    List<SettlementDocumentaryFeesEntity> checkDate(HashMap<String, Object> params);
+}

+ 12 - 0
src/main/java/com/ydtech/modules/fnc/dao/SettlementDocumentaryLogMapper.java

@@ -0,0 +1,12 @@
+package com.ydtech.modules.fnc.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity;
+import com.ydtech.modules.fnc.entity.SettlementDocumentaryLogEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface SettlementDocumentaryLogMapper extends BaseMapper<SettlementDocumentaryLogEntity> {
+}

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

@@ -113,4 +113,52 @@ public class InsPlyIncome implements Serializable {
     @ApiModelProperty("记录插入时间")
     @TableField("create_time")
     private LocalDateTime createTime;
+
+    @ApiModelProperty("凭证号")
+    @TableField("voucher_number")
+    private String voucherNumber;
+
+    @ApiModelProperty("合同号")
+    @TableField("contract_id")
+    private String contractId;
+
+    @ApiModelProperty("合同附件id")
+    @TableField("contract_file_id")
+    private String contractFileId;
+
+    @ApiModelProperty("手续费结算状态  1 为已结算")
+    @TableField("handling_fees_status")
+    private String handlingFeesStatus;
+
+
+    @ApiModelProperty("跟单费结算状态  1 为已结算")
+    @TableField("documentary_fees_status")
+    private String documentaryFeesStatus;
+
+
+    @ApiModelProperty("总单数")
+    @TableField(exist = false)
+    private String totalorders;
+
+
+    @ApiModelProperty("总费用")
+    @TableField(exist = false)
+    private String totAmount;
+
+
+    @ApiModelProperty("协议类型")
+    @TableField(exist = false)
+    private String agreementtype;
+
+
+    @ApiModelProperty("ids")
+    @TableField(exist = false)
+    private String ids;
+
+    @ApiModelProperty("时间范围")
+    @TableField(exist = false)
+    private String timeFrame;
+
+
+
 }

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

@@ -0,0 +1,66 @@
+package com.ydtech.modules.fnc.entity;
+
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Getter
+@Setter
+@TableName("settlement_documentary_fees")
+@ApiModel(value = "SettlementDocumentaryFees对象", description = "跟单费结算")
+public class SettlementDocumentaryFeesEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+
+    @ApiModelProperty("主键")
+    @TableId("id")
+    private String id;
+
+
+    @ApiModelProperty("结算单数")
+    @TableField("total_orders")
+    private String totalOrders;
+
+    @ApiModelProperty("时间范围")
+    @TableField("time_frame")
+    private String timeFrame;
+
+    @ApiModelProperty("结算总金额")
+    @TableField("total_amount")
+    private BigDecimal totalAmount;
+
+    @ApiModelProperty("结算金额")
+    @TableField("settlement_amount")
+    private BigDecimal settlementAmount;
+
+    @ApiModelProperty("未结算金额")
+    @TableField("unsettled_amount")
+    private BigDecimal unsettledAmount;
+
+
+    @ApiModelProperty("创建时间")
+    @TableField("create_time")
+    private LocalDateTime createTime;
+
+
+    @ApiModelProperty("开始时间")
+    @TableField("start_time")
+    private LocalDateTime startTime;
+
+    @ApiModelProperty("结束时间")
+    @TableField("end_time")
+    private LocalDateTime endTime;
+
+
+
+
+}

+ 40 - 0
src/main/java/com/ydtech/modules/fnc/entity/SettlementDocumentaryLogEntity.java

@@ -0,0 +1,40 @@
+package com.ydtech.modules.fnc.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Getter
+@Setter
+@TableName("settlement_documentary_log")
+@ApiModel(value = "SettlementDocumentaryLog对象", description = "跟单费结算日志")
+public class SettlementDocumentaryLogEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+    @ApiModelProperty("主键")
+    @TableId("id")
+    private String id;
+
+    @ApiModelProperty("金额")
+    @TableField("amount")
+    private BigDecimal amount;
+
+    @ApiModelProperty("关联跟单费id")
+    @TableField("settlement_documentary_id")
+    private String settlementDocumentaryId;
+
+    @ApiModelProperty("金额类型")
+    @TableField("amount_type")
+    private String amountType;
+
+    @ApiModelProperty("创建时间")
+    @TableField("create_time")
+    private Date createTime;
+}

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

@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
 import com.ydtech.modules.order.entity.BasePageResult;
 
+import java.util.List;
+
 /**
  * <p>
  * 保司结算手续费 服务类
@@ -16,4 +18,17 @@ import com.ydtech.modules.order.entity.BasePageResult;
  */
 public interface InsPlyIncomeService extends IService<InsPlyIncome> {
     public HttpResult<BasePageResult<InsPlyIncome>> queryplyIncome(InsPlyIncomeVo insPlyIncomeVo);
+
+    void saveBalance(String companyId, String orderno);
+
+
+
+    void uodateBalance(InsPlyIncomeVo insPlyIncomeVo);
+
+
+    HttpResult<BasePageResult<InsPlyIncome>> totalQuery(InsPlyIncomeVo insPlyIncomeVo);
+
+    void batchBalance(InsPlyIncomeVo insPlyIncomeVo);
+
+    HttpResult<BasePageResult<InsPlyIncome>> queryNew(InsPlyIncomeVo insPlyIncomeVo);
 }

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

@@ -0,0 +1,18 @@
+package com.ydtech.modules.fnc.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity;
+import com.ydtech.modules.fnc.vo.SettlementDocumentaryFeesVo;
+import com.ydtech.modules.order.entity.BasePageResult;
+
+import java.util.HashMap;
+
+public interface SettlementDocumentaryFeesService extends IService<SettlementDocumentaryFeesEntity> {
+    BasePageResult<SettlementDocumentaryFeesEntity> querySettle(SettlementDocumentaryFeesVo settlementDocumentaryFeesVo);
+
+    void inertSettle(SettlementDocumentaryFeesVo settlementDocumentaryFeesVo);
+
+    String checkDate(HashMap<String, Object> params);
+
+}

+ 16 - 0
src/main/java/com/ydtech/modules/fnc/service/SettlementDocumentaryLogService.java

@@ -0,0 +1,16 @@
+package com.ydtech.modules.fnc.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity;
+import com.ydtech.modules.fnc.entity.SettlementDocumentaryLogEntity;
+import com.ydtech.modules.fnc.vo.SettlementDocumentaryLogVo;
+import com.ydtech.modules.order.entity.BasePageResult;
+
+import java.util.HashMap;
+import java.util.List;
+
+public interface SettlementDocumentaryLogService extends IService<SettlementDocumentaryLogEntity> {
+    BasePageResult<SettlementDocumentaryLogEntity> querySettle(SettlementDocumentaryLogVo settlementDocumentaryLogVo);
+
+}

+ 190 - 0
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -4,15 +4,35 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.admin.model.po.SysAmountAuditingEntity;
+import com.ydtech.modules.admin.model.po.SysUserAccountHistory;
 import com.ydtech.modules.fnc.entity.InsPlyIncome;
 import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
+import com.ydtech.modules.fnc.entity.SettlementDocumentaryLogEntity;
 import com.ydtech.modules.fnc.service.InsPlyIncomeService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.fnc.service.SettlementDocumentaryFeesService;
+import com.ydtech.modules.fnc.service.SettlementDocumentaryLogService;
 import com.ydtech.modules.fnc.vo.InsPlyIncomeVo;
+import com.ydtech.modules.fnc.vo.SettlementDocumentaryFeesVo;
 import com.ydtech.modules.order.entity.BasePageResult;
+import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrders;
+import com.ydtech.modules.order.service.InsAreaCompanyService;
+import com.ydtech.modules.order.service.InsOrdersService;
+import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
+import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -27,6 +47,19 @@ import java.util.List;
 public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, InsPlyIncome> implements InsPlyIncomeService {
 
 
+    @Autowired
+    private InsOrdersService insOrdersService;
+    @Autowired
+    private InsAreaCompanyService insAreaCompanyService;
+
+    @Autowired
+    private InsFeeOrderNewService insFeeOrderNewService;
+    @Autowired
+    private SettlementDocumentaryFeesService settlementDocumentaryFeesService;
+    @Autowired
+    private SettlementDocumentaryLogService settlementDocumentaryLogService;
+
+
     public HttpResult<BasePageResult<InsPlyIncome>> queryplyIncome(InsPlyIncomeVo insPlyIncomeVo){
 
         try{
@@ -44,5 +77,162 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
 
 
 
+    }
+
+    @Override
+    public void saveBalance(String companyId, String orderno) {
+        InsOrders insOrders = insOrdersService.getById(orderno);
+        InsAreaCompany insAreaCompany = insAreaCompanyService.getById(companyId);
+        InsFeeOrderNew insFeeOrderNew = insFeeOrderNewService.getInsFeeOrderNewByCompanyId(companyId);
+        this.saveBalanc(insFeeOrderNew, insOrders, insAreaCompany);
+    }
+
+
+
+    private void saveBalanc(InsFeeOrderNew insFeeOrderNew, InsOrders insOrders, InsAreaCompany insAreaCompany) {
+        StringBuffer stringBuffer = new StringBuffer();
+        InsPlyIncome insPlyIncome = new InsPlyIncome();
+
+        if (ObjectUtils.isNotEmpty(insAreaCompany)) {
+            // 使用链式条件判断来减少嵌套
+            if (StringUtils.isNotEmpty(insAreaCompany.getJqpolicyno())) {
+                stringBuffer.append(insAreaCompany.getJqpolicyno());
+                if (StringUtils.isNotEmpty(insAreaCompany.getSypolicyno())) {
+                    stringBuffer.append(",");
+                    stringBuffer.append(insAreaCompany.getSypolicyno());
+                }
+            } else if (StringUtils.isNotEmpty(insAreaCompany.getSypolicyno())) {
+                // 如果jqpolicyno为空但sypolicyno不为空,则只添加sypolicyno
+                stringBuffer.append(insAreaCompany.getSypolicyno());
+            }
+        }
+        String policyno = stringBuffer.toString();  // 保单号
+        insPlyIncome.setOrderno(insOrders.getOrderno());
+        insPlyIncome.setPolicyno(policyno);
+        insPlyIncome.setDeptId(insFeeOrderNew.getDeptId());
+        insPlyIncome.setRiskcode(insOrders.getProductid());
+        insPlyIncome.setPayDate(insAreaCompany.getPayDate());
+        insPlyIncome.setSignDate(insAreaCompany.getSigningTime());
+        insPlyIncome.setCompanyId(insAreaCompany.getCompanyId());
+        insPlyIncome.setAgreementId(insFeeOrderNew.getAgreementId());
+        insPlyIncome.setLicenseno(insOrders.getLicenseno());
+        insPlyIncome.setTaxamount(insAreaCompany.getTaxamount());
+
+        BigDecimal bigDecimal = this.sumAmount(insFeeOrderNew.getJqNoTaxPremium(), insFeeOrderNew.getSyNoTaxPremium(), insFeeOrderNew.getNoNoTaxPremium());
+        //      不含保费
+        insPlyIncome.setNoTaxPremium(bigDecimal);
+//      手续费比例
+        BigDecimal CostsProportion = this.sumAmount(insFeeOrderNew.getJqSuperviseCostsProportion(), insFeeOrderNew.getSySuperviseCostsProportion(), insFeeOrderNew.getNoSuperviseCostsProportion());
+        insPlyIncome.setCommissionFeerate(CostsProportion);
+//      其他费用比例
+        BigDecimal OtherCostsProportion = this.sumAmount(insFeeOrderNew.getJqOtherCostsProportion(), insFeeOrderNew.getSyOtherCostsProportion(), insFeeOrderNew.getNoOtherCostsProportion());
+        insPlyIncome.setOtherFeerate(OtherCostsProportion);
+//        手续费金额
+        BigDecimal SuperviseCostsPremiums = this.sumAmount(insFeeOrderNew.getJqSuperviseCostsPremiums(), insFeeOrderNew.getSySuperviseCostsPremiums(), insFeeOrderNew.getNoSuperviseCostsPremiums());
+        insPlyIncome.setCommissionFeevalue(SuperviseCostsPremiums);
+//      其他费用金额
+        BigDecimal OtherCostsPremiums = this.sumAmount(insFeeOrderNew.getJqOtherCostsPremiums(), insFeeOrderNew.getSyOtherCostsPremiums(), insFeeOrderNew.getNoOtherCostsPremiums());
+        insPlyIncome.setOtherFeevalue(OtherCostsPremiums);
+        insPlyIncome.setAllFeeValue(SuperviseCostsPremiums.add(OtherCostsPremiums));
+        insPlyIncome.setCreateTime(LocalDateTime.now());
+        insPlyIncome.setDocumentaryFeesStatus("0");
+        insPlyIncome.setHandlingFeesStatus("0");
+        baseMapper.insert(insPlyIncome);
+
+    }
+    private BigDecimal sumAmount(BigDecimal amount1, BigDecimal amount2, BigDecimal amount3) {
+        BigDecimal jqNoTaxPremium = (amount1 != null) ? amount1 : BigDecimal.ZERO;
+        BigDecimal syNoTaxPremium = (amount2 != null) ? amount2 : BigDecimal.ZERO;
+        BigDecimal noNoTaxPremium = (amount3 != null) ? amount3 : BigDecimal.ZERO;
+
+        return jqNoTaxPremium.add(syNoTaxPremium).add(noNoTaxPremium);
+    }
+
+
+    public HttpResult<BasePageResult<InsPlyIncome>> queryNew(InsPlyIncomeVo insPlyIncomeVo){
+        try{
+            HashMap<String, Object> params = new HashMap<>();
+            PageInfo<List<InsPlyIncome>> pageHelper = null;
+            PageHelper.startPage(insPlyIncomeVo.getPageNum(),insPlyIncomeVo.getPageSize());
+            params.put("pageNum",insPlyIncomeVo.getPageNum());
+            params.put("pageSize",insPlyIncomeVo.getPageSize());
+            params.put("startDate",insPlyIncomeVo.getStartDate().toString());
+            params.put("endDate",insPlyIncomeVo.getEndDate().toString());
+            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);
+        }catch (Exception e){
+            e.printStackTrace();
+            return HttpResult.error("查询异常");
+        }
+    }
+
+    @Override
+    @Transactional
+    public void uodateBalance(InsPlyIncomeVo insPlyIncomeVo) {
+        InsPlyIncome insPlyIncome = new InsPlyIncome();
+        BeanUtils.copyProperties(insPlyIncomeVo, insPlyIncome);
+        baseMapper.uopdateByOrderno(insPlyIncome);
+
+//        生成记录
+        SettlementDocumentaryLogEntity settlementDocumentaryLogEntity = new SettlementDocumentaryLogEntity();
+        settlementDocumentaryLogEntity.setAmount(insPlyIncomeVo.getCommissionFeevalue());  // 手续费金额
+        settlementDocumentaryLogEntity.setSettlementDocumentaryId(insPlyIncomeVo.getOrderno()); // 关联id
+        settlementDocumentaryLogEntity.setAmountType("1");  //手续费结算
+        settlementDocumentaryLogEntity.setCreateTime(new Date());
+        settlementDocumentaryLogService.save(settlementDocumentaryLogEntity);
+    }
+
+    @Override
+    @Transactional
+    public HttpResult<BasePageResult<InsPlyIncome>> totalQuery(InsPlyIncomeVo insPlyIncomeVo) {
+        HashMap<String, Object> params = new HashMap<>();
+        PageInfo<List<InsPlyIncome>> pageHelper = null;
+        params.put("startDate",insPlyIncomeVo.getStartDate().toString());
+        params.put("endDate",insPlyIncomeVo.getEndDate().toString());
+//      判断非跟单结算日期是否已经存在
+        String resultDate = this.JudgingDate(params);
+        if(StringUtils.isNotEmpty(resultDate)){
+            return HttpResult.error("该时间段已近有单据做过结算,请结算");
+        }
+
+        params.put("pageNum",insPlyIncomeVo.getPageNum());
+        params.put("pageSize",insPlyIncomeVo.getPageSize());
+        List<InsPlyIncome> list= this.baseMapper.totalQuery(params);
+        pageHelper=new PageInfo(list);
+
+        return  HttpResult.ok(new BasePageResult<>(insPlyIncomeVo.getPageNum(), insPlyIncomeVo.getPageSize(), pageHelper.getTotal(), pageHelper.getPages(), list));
+    }
+
+    private String JudgingDate(HashMap<String, Object> params) {
+        if(ObjectUtils.isNotEmpty(params.get("startDate"))  &&  ObjectUtils.isNotEmpty(params.get("endDate")) ){
+            String   checkResult = settlementDocumentaryFeesService.checkDate(params);
+            if(StringUtils.isNotEmpty(checkResult)){
+                return checkResult;
+            }
+        }
+        return  null;
+
+    }
+
+    @Override
+    @Transactional
+    public void batchBalance(InsPlyIncomeVo insPlyIncomeVo) {
+//      生成新数据
+        SettlementDocumentaryFeesVo settlementDocumentaryFeesVo = new SettlementDocumentaryFeesVo();
+        settlementDocumentaryFeesVo.setTotalAmount(insPlyIncomeVo.getTotAmount());
+        settlementDocumentaryFeesVo.setTotalOrders(insPlyIncomeVo.getTotalorders());
+        settlementDocumentaryFeesVo.setTimeFrame(insPlyIncomeVo.getTimeFrame());
+        settlementDocumentaryFeesVo.setCreateTime(LocalDateTime.now());
+        settlementDocumentaryFeesVo.setStartTime(insPlyIncomeVo.getStartDate().atStartOfDay());
+        settlementDocumentaryFeesVo.setEndTime(insPlyIncomeVo.getEndDate().atStartOfDay());
+        settlementDocumentaryFeesVo.setSettlementAmount(insPlyIncomeVo.getSettlementAmount());//  结算金额
+        settlementDocumentaryFeesVo.setUnsettledAmount(insPlyIncomeVo.getTotAmount().subtract(insPlyIncomeVo.getSettlementAmount()));  //未结算金额
+
+        settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
+
+
+//
     }
 }

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

@@ -0,0 +1,62 @@
+package com.ydtech.modules.fnc.service.impl;
+
+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.fnc.dao.SettlementDocumentaryFeesMapper;
+import com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity;
+import com.ydtech.modules.fnc.entity.SettlementDocumentaryLogEntity;
+import com.ydtech.modules.fnc.service.SettlementDocumentaryFeesService;
+import com.ydtech.modules.fnc.service.SettlementDocumentaryLogService;
+import com.ydtech.modules.fnc.vo.SettlementDocumentaryFeesVo;
+import com.ydtech.modules.order.entity.BasePageResult;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+@Service
+public class SettlementDocumentaryFeesServiceImpl extends ServiceImpl<SettlementDocumentaryFeesMapper, SettlementDocumentaryFeesEntity> implements SettlementDocumentaryFeesService {
+
+        @Autowired
+        private SettlementDocumentaryLogService settlementDocumentaryLogService;
+    @Override
+    public BasePageResult<SettlementDocumentaryFeesEntity> querySettle(SettlementDocumentaryFeesVo settlementDocumentaryFeesVo) {
+
+        Page<SettlementDocumentaryFeesEntity> page = new Page<>(settlementDocumentaryFeesVo.getPageNum(), settlementDocumentaryFeesVo.getPageSize());
+
+        Page<SettlementDocumentaryFeesEntity> resultPage  = baseMapper.querySettle(settlementDocumentaryFeesVo,page);
+
+        return new BasePageResult<>(settlementDocumentaryFeesVo.getPageNum(),page.getSize(),resultPage.getTotal(),page.getPages(),resultPage.getRecords());
+    }
+
+    @Override
+    @Transactional
+    public void inertSettle(SettlementDocumentaryFeesVo settlementDocumentaryFeesVo) {
+        SettlementDocumentaryFeesEntity settlementDocumentaryFeesEntity = new SettlementDocumentaryFeesEntity();
+        BeanUtils.copyProperties(settlementDocumentaryFeesVo, settlementDocumentaryFeesEntity);
+        baseMapper.insert(settlementDocumentaryFeesEntity);
+
+        //       生成跟单费结算记录
+        SettlementDocumentaryLogEntity settlementDocumentaryLogEntity = new SettlementDocumentaryLogEntity();
+        settlementDocumentaryLogEntity.setAmount(settlementDocumentaryFeesVo.getSettlementAmount());  // 结算金额
+        settlementDocumentaryLogEntity.setSettlementDocumentaryId(settlementDocumentaryFeesEntity.getId()); // 关联id
+        settlementDocumentaryLogEntity.setAmountType("2");  //跟单费结算
+        settlementDocumentaryLogEntity.setCreateTime(new Date());
+        settlementDocumentaryLogService.save(settlementDocumentaryLogEntity);
+    }
+
+    @Override
+    public String  checkDate(HashMap<String, Object> params) {
+
+        List<SettlementDocumentaryFeesEntity> startList=  baseMapper.checkDate(params);
+        if(startList.size()>0 ){
+            return "有重复";
+        }
+        return null;
+    }
+}

+ 25 - 0
src/main/java/com/ydtech/modules/fnc/service/impl/SettlementDocumentaryLogImpl.java

@@ -0,0 +1,25 @@
+package com.ydtech.modules.fnc.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.fnc.dao.SettlementDocumentaryLogMapper;
+import com.ydtech.modules.fnc.entity.SettlementDocumentaryLogEntity;
+import com.ydtech.modules.fnc.service.SettlementDocumentaryLogService;
+import com.ydtech.modules.fnc.vo.SettlementDocumentaryLogVo;
+import com.ydtech.modules.order.entity.BasePageResult;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+
+@Service
+public class SettlementDocumentaryLogImpl extends ServiceImpl<SettlementDocumentaryLogMapper, SettlementDocumentaryLogEntity> implements SettlementDocumentaryLogService {
+
+
+    @Override
+    public BasePageResult<SettlementDocumentaryLogEntity> querySettle(SettlementDocumentaryLogVo settlementDocumentaryLogVo) {
+        return null;
+    }
+
+
+}

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

@@ -4,6 +4,7 @@ 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.modules.order.entity.po.InsUploadFiles;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -12,6 +13,7 @@ import lombok.Setter;
 
 import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;
+import java.io.File;
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.time.LocalDate;
@@ -62,6 +64,12 @@ public class InsPlyIncomeVo implements Serializable {
 
     private String flag;//0待结算
 
+    @ApiModelProperty("手续费金额")
+    private BigDecimal commissionFeevalue;
+
+    @ApiModelProperty("其他费用金额")
+    private BigDecimal otherFeevalue;
+
     @ApiModelProperty(value = "每页页数")
     @Min(value = 20, message = "页数最小为20")
     @Max(value = 100, message = "页数最大为100")
@@ -70,4 +78,38 @@ public class InsPlyIncomeVo implements Serializable {
     @ApiModelProperty(value = "页数")
     @Min(value = 1, message = "页数最小为1")
     private int pageNum=1;
+
+    @ApiModelProperty("协议类型")
+    private String agreementtype;
+
+    @ApiModelProperty("时间范围")
+    private String timeFrame;
+
+    @ApiModelProperty("凭证号")
+    private String voucherNumber;
+
+    @ApiModelProperty("合同号")
+    private String contractId;
+
+    @ApiModelProperty("合同附件id")
+    private String contractFileId;
+
+    @ApiModelProperty("手续费结算状态  1 为已结算")
+    private String handlingFeesStatus;
+
+
+    @ApiModelProperty("跟单费结算状态  1 为已结算")
+    private String documentaryFeesStatus;
+
+
+    @ApiModelProperty("总单数")
+    private String  totalorders;
+
+    @ApiModelProperty("ids")
+    private String  ids;
+
+    @ApiModelProperty("总手续费")
+    private BigDecimal  totAmount;
+    @ApiModelProperty("结算金额")
+    private BigDecimal settlementAmount;
 }

+ 58 - 0
src/main/java/com/ydtech/modules/fnc/vo/SettlementDocumentaryFeesVo.java

@@ -0,0 +1,58 @@
+package com.ydtech.modules.fnc.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Data
+@ApiModel("跟单费用结算")
+public class SettlementDocumentaryFeesVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty("id")
+    private String id;
+
+    @ApiModelProperty("结算单数")
+    private String totalOrders;
+
+    @ApiModelProperty("时间范围")
+    private String timeFrame;
+
+    @ApiModelProperty("结算总金额")
+    private BigDecimal totalAmount;
+
+    @ApiModelProperty("创建时间")
+    private LocalDateTime createTime;
+
+    @ApiModelProperty("结算金额")
+    @TableField("settlement_amount")
+    private BigDecimal settlementAmount;
+
+    @ApiModelProperty("未结算金额")
+    @TableField("unsettled_amount")
+    private BigDecimal unsettledAmount;
+
+    @ApiModelProperty("开始时间")
+    @TableField("start_time")
+    private LocalDateTime startTime;
+
+    @ApiModelProperty("结束时间")
+    @TableField("end_time")
+    private LocalDateTime endTime;
+
+    @ApiModelProperty(value = "每页页数")
+    @Min(value = 20, message = "页数最小为20")
+    @Max(value = 100, message = "页数最大为100")
+    private int pageSize=20;
+
+    @ApiModelProperty(value = "页数")
+    @Min(value = 1, message = "页数最小为1")
+    private int pageNum=1;
+}

+ 46 - 0
src/main/java/com/ydtech/modules/fnc/vo/SettlementDocumentaryLogVo.java

@@ -0,0 +1,46 @@
+package com.ydtech.modules.fnc.vo;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+@ApiModel("跟单费用结算")
+public class SettlementDocumentaryLogVo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    @ApiModelProperty("id")
+    private String id;
+
+
+    @ApiModelProperty("金额")
+    private BigDecimal amount;
+
+    @ApiModelProperty("关联跟单费id")
+    private String settlementDocumentaryId;
+
+    @ApiModelProperty("创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date createTime;
+
+    @ApiModelProperty(value = "每页页数")
+    @Min(value = 20, message = "页数最小为20")
+    @Max(value = 100, message = "页数最大为100")
+    private int pageSize=20;
+
+    @ApiModelProperty(value = "页数")
+    @Min(value = 1, message = "页数最小为1")
+    private int pageNum=1;
+
+    @ApiModelProperty("金额类型")
+    private String amountType;
+
+
+}

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

@@ -11,6 +11,7 @@ import com.ydtech.exception.SystemException;
 import com.ydtech.modules.admin.model.vo.PersonAreaVo;
 import com.ydtech.modules.admin.service.SysAreaService;
 import com.ydtech.modules.fee.service.FeeRuleSchemeService;
+import com.ydtech.modules.fnc.service.InsPlyIncomeService;
 import com.ydtech.modules.ins.model.vo.*;
 import com.ydtech.modules.order.components.ConfigureParametersComponents;
 import com.ydtech.modules.order.components.InsImagesUploadCacheComponents;
@@ -36,6 +37,8 @@ import com.ydtech.modules.order.service.*;
 import com.ydtech.modules.protocol.entity.po.PtlAgreementAttribution;
 import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
 import com.ydtech.modules.protocol.service.PtlAgreementService;
+import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
+import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
 import com.ydtech.utils.CalculateUtils;
 import com.ydtech.utils.DateTimeUtil;
 import com.ydtech.utils.baidu.FileUtil;
@@ -43,6 +46,7 @@ import com.ydtech.utils.idgen.IdGenerate;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
@@ -94,6 +98,9 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
     @Autowired
     private InsImagesUploadCacheComponents insImagesUploadCacheComponents;
 
+    @Autowired
+    private InsPlyIncomeService insPlyIncomeService;
+
     @Value("${upload.file.path}")
     private String uploadFilePath;
 
@@ -720,6 +727,7 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
      * @return
      */
     @Override
+    @Transactional
     public HttpResult<Object> verifyPayment(String companyId) {
         try {
             InsAreaCompany insAreaCompany = insAreaCompanyService.getByIdIsExist(companyId);
@@ -789,6 +797,8 @@ public class DaJiaOrderServiceImpl implements DaJiaOrderService {
                     //更新订单状态
                     insAreaCompany.setOrderstatus(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode());
                     insAreaCompanyService.updateCompanyAndOrders(insAreaCompany);
+//                    生成结算
+                    insPlyIncomeService.saveBalance(companyId,insAreaCompany.getOrderno());
                 }
             }
             return HttpResult.ok("查询订单状态成功");

+ 98 - 0
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -24,6 +24,104 @@
         <result column="final_fee_value" property="finalFeeValue" />
         <result column="doing_fee_value" property="doingFeeValue" />
         <result column="create_time" property="createTime" />
+        <result column="voucher_number" property="voucherNumber"/>
+        <result column="contract_id" property="contractId"/>
+        <result column="contract_file_id" property="contractFileId"/>
+        <result column="handling_fees_status" property="handlingFeesStatus"/>
+        <result column="documentary_fees_status" property="documentaryFeesStatus"/>
     </resultMap>
 
+    <select id="queryNew"  resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
+            select
+                a.orderno  as  "orderno",
+                a.policyno  as  "policyno",
+                a.dept_id  as  "deptId",
+                a.riskcode  as  "riskcode",
+                a.pay_date  as  "payDate",
+                a.signdate  as  "signdate",
+                a.company_id  as  "companyId",
+                a.agreement_id  as  "agreementId",
+                a.licenseno  as  "licenseno",
+                a.taxamount  as  "taxamount",
+                a.no_tax_premium  as  "noTaxPremium",
+                a.commission_feerate  as  "commissionFeerate",
+                a.other_feerate  as  "otherFeerate",
+                a.commission_feevalue  as  "commissionFeevalue",
+                a.other_feevalue  as  "otherFeevalue",
+                a.all_fee_value  as  "allFeeValue",
+                a.final_fee_value  as  "finalFeeValue",
+                a.doing_fee_value  as  "doingFeeValue",
+                a.voucher_number  as  "voucherNumber",
+                a.contract_id  as  "contractId",
+                a.contract_file_id  as  "contractFileId",
+                a.handling_fees_status  as  "handlingFeesStatus",
+                a.documentary_fees_status  as  "documentaryFeesStatus",
+                a.create_time  as  "createTime"
+                from  ins_ply_income a
+                LEFT  JOIN  ptl_agreement  pa  on  a.agreement_id  = pa.id
+            <where>
+                <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="handlingFeesStatus !=null  and  handlingFeesStatus  !=''">
+                    and a.handling_fees_status =#{handlingFeesStatus}
+                </if>
+                <if test="documentaryFeesStatus !=null  and  documentaryFeesStatus  !=''">
+                    and a.documentary_fees_status =#{documentaryFeesStatus}
+                </if>
+            </where>
+    </select>
+
+
+    <select id="totalQuery"  resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
+            select
+                 sum(a.other_feevalue) as "totAmount",
+                GROUP_CONCAT(orderno) as  "ids",
+                count(1) as "totalorders"
+                from  ins_ply_income a
+                LEFT  JOIN  ptl_agreement  pa  on  a.agreement_id  = pa.id
+            <where>
+                <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="handlingFeesStatus !=null  and  handlingFeesStatus  !=''">
+                    and a.handling_fees_status =#{handlingFeesStatus}
+                </if>
+
+                <if test="documentaryFeesStatus !=null  and  documentaryFeesStatus  !=''">
+                    and a.documentary_fees_status =#{documentaryFeesStatus}
+                </if>
+            </where>
+    </select>
+
+    <update id="uopdateByOrderno" parameterType="com.ydtech.modules.fnc.entity.InsPlyIncome">
+        update ins_ply_income
+        <set>
+            <if test="contractId != null">
+                contract_id = #{contractId},
+            </if>
+            <if test="voucherNumber != null">
+                voucher_number = #{voucherNumber},
+            </if>
+            <if test="contractFileId != null">
+                contract_file_id = #{contractFileId},
+            </if>
+            <if test="handlingFeesStatus != null">
+                handling_fees_status = #{handlingFeesStatus},
+            </if>
+            <if test="documentaryFeesStatus != null">
+                documentary_fees_status = #{documentaryFeesStatus},
+            </if>
+        </set>
+        where  orderno  =#{orderno}
+    </update>
 </mapper>

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

@@ -0,0 +1,47 @@
+<?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.fnc.dao.SettlementDocumentaryFeesMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity">
+        <id column="id" property="id" />
+        <result column="total_orders" property="totalOrders"/>
+        <result column="time_frame" property="timeFrame"/>
+        <result column="total_amount" property="totalAmount"/>
+        <result column="create_time" property="createTime"/>
+    </resultMap>
+
+
+
+    <select id="querySettle" resultType="com.ydtech.modules.fnc.entity.SettlementDocumentaryFeesEntity">
+        select
+            a.id as "id",
+            a.total_orders as "totalOrders",
+            a.time_frame as "timeFrame",
+            a.total_amount as "totalAmount",
+            a.create_time as "createTime"
+            from  settlement_documentary_fees  a
+    </select>
+
+
+    <select id="checkDate" resultType="com.ydtech.modules.fnc.entity.SettlementDocumentaryLogEntity">
+        select a.id                as "id",
+        a.total_orders      as "totalOrders",
+        a.time_frame        as "timeFrame",
+        a.total_amount      as "totalAmount",
+        a.create_time       as "createTime",
+        a.start_time        as "startTime",
+        a.end_time          as "endTime",
+        a.settlement_amount as "settlementAmount",
+        a.unsettled_amount  as "unsettledAmount"
+        from settlement_documentary_fees a
+        <where>
+            <if test="startDate !=null  and  startDate  !=''  and endDate !=null  and  endDate  !=''" >
+                (start_time &lt; #{endDate} AND start_time &gt; #{startDate}) OR (end_time &lt;  #{endDate} AND end_time &gt; #{startDate})
+            </if>
+        </where>
+    </select>
+
+
+
+</mapper>

+ 17 - 0
src/main/resources/mapper/modules/fnc/SettlementDocumentaryLogMapper.xml

@@ -0,0 +1,17 @@
+<?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.fnc.dao.SettlementDocumentaryLogMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.ydtech.modules.fnc.entity.SettlementDocumentaryLogEntity">
+        <id column="id" property="id"/>
+        <result column="amount" property="amount"/>
+        <result column="settlement_documentary_id" property="settlementDocumentaryId"/>
+        <result column="amount_type" property="amountType"/>
+        <result column="create_time" property="createTime"/>
+    </resultMap>
+
+
+
+
+</mapper>