Procházet zdrojové kódy

1.结算新逻辑调整

wuhp před 2 roky
rodič
revize
b1205da9aa
20 změnil soubory, kde provedl 699 přidání a 38 odebrání
  1. 21 1
      src/main/java/com/ydtech/modules/fnc/controller/InsPlyIncomeController.java
  2. 9 0
      src/main/java/com/ydtech/modules/fnc/controller/SettlementDocumentaryFeesController.java
  3. 2 0
      src/main/java/com/ydtech/modules/fnc/dao/InsPlyIncomeMapper.java
  4. 37 0
      src/main/java/com/ydtech/modules/fnc/entity/InsPlyIncome.java
  5. 16 0
      src/main/java/com/ydtech/modules/fnc/entity/SettlementDocumentaryFeesEntity.java
  6. 6 0
      src/main/java/com/ydtech/modules/fnc/service/InsPlyIncomeService.java
  7. 2 0
      src/main/java/com/ydtech/modules/fnc/service/SettlementDocumentaryFeesService.java
  8. 256 31
      src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java
  9. 13 0
      src/main/java/com/ydtech/modules/fnc/service/impl/SettlementDocumentaryFeesServiceImpl.java
  10. 37 0
      src/main/java/com/ydtech/modules/fnc/vo/InsPlyIncomeVo.java
  11. 4 1
      src/main/java/com/ydtech/modules/fnc/vo/SettlementDocumentaryFeesVo.java
  12. 22 0
      src/main/java/com/ydtech/modules/inv/model/dto/InsBxNoPlyIncomeExcelDto.java
  13. 42 0
      src/main/java/com/ydtech/modules/inv/model/dto/InsBxPlyIncomeExcelDto.java
  14. 6 0
      src/main/java/com/ydtech/modules/order/controller/OrderTaskImageController.java
  15. 2 0
      src/main/java/com/ydtech/modules/order/service/InsUploadFilesService.java
  16. 7 0
      src/main/java/com/ydtech/modules/order/service/impl/InsUploadFilesServiceImpl.java
  17. 212 5
      src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml
  18. 5 0
      src/main/resources/mapper/modules/fnc/SettlementDocumentaryFeesMapper.xml
  19. binární
      src/main/resources/template/handlingFeeTemplate.xlsx
  20. binární
      src/main/resources/template/noHandlingFeeTemplate.xlsx

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

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

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

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

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

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

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

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

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

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

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

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

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

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

+ 256 - 31
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

+ 212 - 5
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

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

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

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

binární
src/main/resources/template/handlingFeeTemplate.xlsx


binární
src/main/resources/template/noHandlingFeeTemplate.xlsx