Przeglądaj źródła

Merge branch 'refs/heads/test' into master-20240326

# Conflicts:
#	sql/Online.sql
bifrons 2 lat temu
rodzic
commit
5bfae53192
30 zmienionych plików z 504 dodań i 289 usunięć
  1. 52 40
      src/main/java/com/ydtech/modules/admin/controller/SysUserController.java
  2. 10 2
      src/main/java/com/ydtech/modules/admin/model/SysUser.java
  3. 9 0
      src/main/java/com/ydtech/modules/admin/model/po/SysUserIsDial.java
  4. 15 0
      src/main/java/com/ydtech/modules/admin/model/vo/SysDeptAccountWithdrawVo.java
  5. 30 0
      src/main/java/com/ydtech/modules/admin/model/vo/SysUserRoleVo.java
  6. 16 63
      src/main/java/com/ydtech/modules/admin/service/impl/SysUserAccountServiceImpl.java
  7. 2 0
      src/main/java/com/ydtech/modules/admin/service/impl/SysUserServiceImpl.java
  8. 16 2
      src/main/java/com/ydtech/modules/fee/service/impl/CostsCalServiceImpl.java
  9. 2 10
      src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceImpl.java
  10. 31 0
      src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java
  11. 10 0
      src/main/java/com/ydtech/modules/fnc/entity/SettlementDocumentaryFeesEntity.java
  12. 47 47
      src/main/java/com/ydtech/modules/fnc/service/impl/InsFeeAuditServiceImpl.java
  13. 61 47
      src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java
  14. 1 1
      src/main/java/com/ydtech/modules/fnc/vo/InsPlyIncomeVo.java
  15. 8 0
      src/main/java/com/ydtech/modules/fnc/vo/SettlementDocumentaryFeesVo.java
  16. 9 0
      src/main/java/com/ydtech/modules/order/entity/vo/OrderVo.java
  17. 2 0
      src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java
  18. 8 0
      src/main/java/com/ydtech/modules/protocol/controller/PtlAgreementController.java
  19. 5 0
      src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementMapper.java
  20. 4 0
      src/main/java/com/ydtech/modules/protocol/service/PtlAgreementService.java
  21. 5 0
      src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java
  22. 1 1
      src/main/java/com/ydtech/modules/protocols/controller/PtlNewAgreementController.java
  23. 38 0
      src/main/java/com/ydtech/modules/protocols/entity/po/InsFeeOrderNew.java
  24. 3 0
      src/main/java/com/ydtech/modules/protocols/entity/vo/AgreementProductCostsEndDateVo.java
  25. 5 3
      src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementProductCostsNewServiceImpl.java
  26. 8 0
      src/main/resources/mapper/modules/admin/SysDeptAccountWithdrawMapper.xml
  27. 72 40
      src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml
  28. 25 31
      src/main/resources/mapper/modules/fnc/SettlementDocumentaryFeesMapper.xml
  29. 7 0
      src/main/resources/mapper/modules/protocol/PtlAgreementMapper.xml
  30. 2 2
      src/main/resources/mapper/modules/protocols/PtlAgreementProductCostsNewMapper.xml

+ 52 - 40
src/main/java/com/ydtech/modules/admin/controller/SysUserController.java

@@ -144,15 +144,23 @@ public class SysUserController extends BaseController {
     }
 
     /**
-     * 配置用户角色
+     * 保存用户角色信息
      *
-     * @param userId
-     * @param roleId
-     * @return
+     * @param sysUserRoleVo 用户角色信息对象,包括用户ID、角色ID、展示级别、是否允许拨号、拨号用户名和密码
+     * @return 返回操作结果,成功返回ok
      */
     @PostMapping(value = "/saveUserRole")
     @Transactional
-    public HttpResult saveUserRole(@RequestParam String userId, @RequestParam String roleId, @RequestParam String showLevel, @RequestParam String isDial) {
+    @ApiOperation(value = "保存用户角色信息")
+    public HttpResult saveUserRole(@RequestBody SysUserRoleVo sysUserRoleVo) {
+        String userId = sysUserRoleVo.getUserId();
+        String roleId = sysUserRoleVo.getRoleId();
+        String showLevel = sysUserRoleVo.getShowLevel();
+        String isDial = sysUserRoleVo.getIsDial();
+        String dialUserName = sysUserRoleVo.getDialUserName();
+        String dialPassWord = sysUserRoleVo.getDialPassWord();
+
+        //添加用户角色
         SysUserRole userRole = new SysUserRole();
         sysUserRoleService.deleteByUserId(userId);
         String userName = getUserName();
@@ -162,24 +170,27 @@ public class SysUserController extends BaseController {
         userRole.setCreateBy(userName);
         userRole.setCreateTime(new Date());
         sysUserRoleService.save(userRole);
-        if (!"".equals(showLevel)) {
-            sysUserTreeShowLevelService.remove(new LambdaQueryWrapper<SysUserTreeShowLevel>().eq(SysUserTreeShowLevel::getUserId, userId));
-            SysUserTreeShowLevel sysUserTreeShowLevel = new SysUserTreeShowLevel();
-            sysUserTreeShowLevel.setUserId(userId);
-            sysUserTreeShowLevel.setShowLevel(showLevel);
-            sysUserTreeShowLevel.setCreateName(userName);
-            sysUserTreeShowLevel.setCreateTime(new Date());
-            sysUserTreeShowLevelService.save(sysUserTreeShowLevel);
-        }
-        if (!"".equals(isDial)) {
-            sysUserIsDialService.remove(new LambdaQueryWrapper<SysUserIsDial>().eq(SysUserIsDial::getUserId, userId));
-            SysUserIsDial sysUserIsDial = new SysUserIsDial();
-            sysUserIsDial.setUserId(userId);
-            sysUserIsDial.setIsDial(isDial);
-            sysUserIsDial.setCreateName(userName);
-            sysUserIsDial.setCreateTime(new Date());
-            sysUserIsDialService.save(sysUserIsDial);
-        }
+
+        //添加树权限
+        sysUserTreeShowLevelService.remove(new LambdaQueryWrapper<SysUserTreeShowLevel>().eq(SysUserTreeShowLevel::getUserId, userId));
+        SysUserTreeShowLevel sysUserTreeShowLevel = new SysUserTreeShowLevel();
+        sysUserTreeShowLevel.setUserId(userId);
+        sysUserTreeShowLevel.setShowLevel(showLevel);
+        sysUserTreeShowLevel.setCreateName(userName);
+        sysUserTreeShowLevel.setCreateTime(new Date());
+        sysUserTreeShowLevelService.save(sysUserTreeShowLevel);
+
+        //添加拨号权限
+        sysUserIsDialService.remove(new LambdaQueryWrapper<SysUserIsDial>().eq(SysUserIsDial::getUserId, userId));
+        SysUserIsDial sysUserIsDial = new SysUserIsDial();
+        sysUserIsDial.setUserId(userId);
+        sysUserIsDial.setDialUserName(dialUserName);
+        sysUserIsDial.setDialPassWord(dialPassWord);
+        sysUserIsDial.setIsDial(isDial);
+        sysUserIsDial.setCreateName(userName);
+        sysUserIsDial.setCreateTime(new Date());
+        sysUserIsDialService.save(sysUserIsDial);
+
         return HttpResult.ok();
     }
 
@@ -672,9 +683,9 @@ public class SysUserController extends BaseController {
                     throw new SystemException("团队长、代理人、出单员只能归属团队中");
                 }
                 //如果为团队长,判断是否已经存在团队长,存在不允许添加   add by  hxl  2024-05-07  ============begin
-                if(RoleConstants.R21.getCode().equals(sysUser.getRoleId())){
-                    int count= sysUserService.getCountByDeptAndRoleId(sysUser);
-                    if(count>0){
+                if (RoleConstants.R21.getCode().equals(sysUser.getRoleId())) {
+                    int count = sysUserService.getCountByDeptAndRoleId(sysUser);
+                    if (count > 0) {
                         throw new SystemException("该机构已存在团队长,不允许再添加!!");
                     }
                 }
@@ -773,36 +784,37 @@ public class SysUserController extends BaseController {
 
 
     /**
-     *  @version
-     *  @author: hxl
-     *  @Date: 2024/4/16 16:16
-     *  @Description:  获取待客录入可选业务员列表   通过工号、姓名、手机号、身份证号
+     * @version
+     * @author: hxl
+     * @Date: 2024/4/16 16:16
+     * @Description: 获取待客录入可选业务员列表   通过工号、姓名、手机号、身份证号
      */
     @ApiOperation(value = "获取待客录入可选业务员列表   通过工号、姓名、手机号、身份证号")
     @PostMapping(value = "/getAllUsersByHospitality")
     public HttpResult getAllUsersByHospitality(@RequestBody SysUserVOExt sysUserVOExt) {
-        try{
+        try {
             List<SysUserBaseVO> userList = sysUserService.getAllUsersByHospitality(sysUserVOExt);
             return HttpResult.ok(userList);
-        }catch (Exception e){
-            return HttpResult.error("查询失败"+e.getMessage());
+        } catch (Exception e) {
+            return HttpResult.error("查询失败" + e.getMessage());
         }
 
     }
+
     /**
-     *  @version
-     *  @author: hxl
-     *  @Date: 2024/4/18 16:12
-     *  @Description: 查询客服人员列表数据
+     * @version
+     * @author: hxl
+     * @Date: 2024/4/18 16:12
+     * @Description: 查询客服人员列表数据
      */
     @ApiOperation(value = "获取客服人员列表数据")
     @PostMapping(value = "/getCustomerUsers")
     public HttpResult getCustomerUsers() {
-        try{
+        try {
             List<SysUserBaseVO> userList = sysUserService.getCustomerUsers();
             return HttpResult.ok(userList);
-        }catch (Exception e){
-            return HttpResult.error("查询失败"+e.getMessage());
+        } catch (Exception e) {
+            return HttpResult.error("查询失败" + e.getMessage());
         }
 
     }

+ 10 - 2
src/main/java/com/ydtech/modules/admin/model/SysUser.java

@@ -167,13 +167,21 @@ public class SysUser extends BaseEntity {
     private String referrerName;
 
     @TableField(exist = false)
-    @Excel(name = "树权限等级")
+    @ApiModelProperty(value = "树权限等级")
     private String showLevel;
 
     @TableField(exist = false)
-    @Excel(name = "是否拥有拨号权限")
+    @ApiModelProperty(value = "是否拥有拨号权限")
     private String isDial;
 
+    @TableField(exist = false)
+    @ApiModelProperty(value = "拨号权限账号")
+    private String dialUserName;
+
+    @TableField(exist = false)
+    @ApiModelProperty(value = "拨号权限密码")
+    private String dialPassWord;
+
     @TableField(exist = false)
     @ApiModelProperty("机构来源")
     private String managementSource;

+ 9 - 0
src/main/java/com/ydtech/modules/admin/model/po/SysUserIsDial.java

@@ -5,6 +5,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 io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.util.Date;
@@ -29,6 +30,14 @@ public class SysUserIsDial {
     @TableField(value = "user_id")
     private String userId;
 
+    @TableField(value = "dial_username")
+    @ApiModelProperty(value = "拨号权限账号")
+    private String dialUserName;
+
+    @TableField(value = "dial_password")
+    @ApiModelProperty(value = "拨号权限密码")
+    private String dialPassWord;
+
     /**
      * 是否开启拨号
      */

+ 15 - 0
src/main/java/com/ydtech/modules/admin/model/vo/SysDeptAccountWithdrawVo.java

@@ -30,6 +30,21 @@ public class SysDeptAccountWithdrawVo implements Serializable {
     @ApiModelProperty(value = "提现状态")
     private String status;
 
+    @TableField(value = "withdraw_userid")
+    @ApiModelProperty(value = "申请提现人id")
+    private String withdrawUserid;
+    @TableField(value = "withdraw_name")
+    @ApiModelProperty(value = "申请提现人姓名")
+    private String withdrawName;
+
+    @TableField(value = "audit_userid")
+    @ApiModelProperty(value = "审核人id")
+    private String auditUserid;
+
+    @TableField(value = "audit_name")
+    @ApiModelProperty(value = "审核人姓名")
+    private String auditName;
+
     @TableField(value = "remark")
     @ApiModelProperty(value = "备注")
     private String remark;

+ 30 - 0
src/main/java/com/ydtech/modules/admin/model/vo/SysUserRoleVo.java

@@ -0,0 +1,30 @@
+package com.ydtech.modules.admin.model.vo;
+
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@ApiModel
+public class SysUserRoleVo {
+
+    @ApiModelProperty(value = "用户ID")
+    private String userId;
+
+    @ApiModelProperty(value = "角色ID")
+    private String roleId;
+
+    @ApiModelProperty(value = "树权限")
+    private String showLevel;
+
+    @ApiModelProperty(value = "是否开启拨号权限")
+    private String isDial;
+
+    @ApiModelProperty(value = "拨号权限账号")
+    private String dialUserName;
+
+    @ApiModelProperty(value = "拨号权限密码")
+    private String dialPassWord;
+
+}

+ 16 - 63
src/main/java/com/ydtech/modules/admin/service/impl/SysUserAccountServiceImpl.java

@@ -508,76 +508,29 @@ public class SysUserAccountServiceImpl extends ServiceImpl<SysUserAccountMapper,
         return null;
     }
 
-    private void willAmount(InsFeeOrderNew insFeeOrderNew, BigDecimal willHalding, BigDecimal willDocumentary,SysUserAccountVo sysUserAccountVo) {
-        if(ObjectUtils.isNotEmpty(insFeeOrderNew)){
-            //交强手续费出口比例
-            BigDecimal jqExportProceduresFee = insFeeOrderNew.getJqPremium().multiply(insFeeOrderNew.getJqSuperviseCostsProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
-            //商业手续费出口比例
-            BigDecimal syExportProceduresFee = insFeeOrderNew.getSyPremium().multiply(insFeeOrderNew.getSySuperviseCostsProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
-            //非车手续费出口比例
-            BigDecimal noExportProceduresFee = insFeeOrderNew.getNoPremium().multiply(insFeeOrderNew.getNoSuperviseCostsProportion().divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
-            //用户出口手续费
-
-            if(sysUserAccountVo.getWillHalding()==null){
+    private void willAmount(InsFeeOrderNew insFeeOrderNew, BigDecimal willHalding, BigDecimal willDocumentary, SysUserAccountVo sysUserAccountVo) {
+        if (ObjectUtils.isNotEmpty(insFeeOrderNew)) {
+            //交强手续费
+            BigDecimal jqExportProceduresFee = insFeeOrderNew.getJqExportSuperviseCostsPremiums();
+            //商业手续费
+            BigDecimal syExportProceduresFee = insFeeOrderNew.getSyExportSuperviseCostsPremiums();
+            //非车手续费
+            BigDecimal noExportProceduresFee = insFeeOrderNew.getNoExportSuperviseCostsPremiums();
+            if (sysUserAccountVo.getWillHalding() == null) {
                 sysUserAccountVo.setWillHalding(BigDecimal.ZERO);
             }
             sysUserAccountVo.setWillHalding(sysUserAccountVo.getWillHalding().add(jqExportProceduresFee).add(syExportProceduresFee).add(noExportProceduresFee));
-
-            //非车出口比例
-            //总机构 交强管理比例
-            BigDecimal sumJqDeptProportion = insFeeOrderNew.getJqDeptProportionLevel1()
-                    .add(insFeeOrderNew.getJqDeptProportionLevel2())
-                    .add(insFeeOrderNew.getJqDeptProportionLevel3())
-                    .add(insFeeOrderNew.getJqDeptProportionLevel4())
-                    .add(insFeeOrderNew.getJqDeptProportionLevel5());
-
-            //总机构 商业管理比例
-            BigDecimal sumSyDeptProportion = insFeeOrderNew.getSyDeptProportionLevel1()
-                    .add(insFeeOrderNew.getSyDeptProportionLevel2())
-                    .add(insFeeOrderNew.getSyDeptProportionLevel3())
-                    .add(insFeeOrderNew.getSyDeptProportionLevel4())
-                    .add(insFeeOrderNew.getSyDeptProportionLevel5());
-
-            //总机构 非车管理比例
-            BigDecimal sumNoDeptProportion = insFeeOrderNew.getNoDeptProportionLevel1()
-                    .add(insFeeOrderNew.getNoDeptProportionLevel2())
-                    .add(insFeeOrderNew.getNoDeptProportionLevel3())
-                    .add(insFeeOrderNew.getNoDeptProportionLevel4())
-                    .add(insFeeOrderNew.getNoDeptProportionLevel5());
-            BigDecimal noExportProceduresProportion = new BigDecimal(0);
-            //总分销比例
-            BigDecimal sumRetail = insFeeOrderNew.getFirstDetailProportion().add(insFeeOrderNew.getSecondDetailProportion()).add(insFeeOrderNew.getThirdDetailProportion());
-            if(insFeeOrderNew.getNoCostsProportion().compareTo(sumNoDeptProportion.add(sumRetail))>0){
-                noExportProceduresProportion = insFeeOrderNew.getNoCostsProportion().subtract(sumNoDeptProportion).subtract(sumRetail);
-            }
-            //商业出口比例
-            BigDecimal syExportProceduresProportion = new BigDecimal(0);
-            if(insFeeOrderNew.getSyCostsProportion().compareTo(sumSyDeptProportion.add(sumRetail))>0){
-                syExportProceduresProportion = insFeeOrderNew.getSyCostsProportion().subtract(sumSyDeptProportion).subtract(sumRetail);
-            }
-            //交强出口比例
-            BigDecimal jqExportProceduresProportion = new BigDecimal(0);
-            if(insFeeOrderNew.getJqCostsProportion().compareTo(sumJqDeptProportion.add(sumRetail))>0){
-                jqExportProceduresProportion = insFeeOrderNew.getJqCostsProportion().subtract(sumJqDeptProportion).subtract(sumRetail);
-            }
             //交强跟单出口费用
-            BigDecimal jqExportOtherFee = insFeeOrderNew.getJqPremium()
-                    .multiply(jqExportProceduresProportion
-                            .subtract(insFeeOrderNew.getJqSuperviseCostsProportion()).divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
-
-            //商业跟单出口比例
-            BigDecimal syExportOtherFee = insFeeOrderNew.getSyPremium()
-                    .multiply(syExportProceduresProportion
-                            .subtract(insFeeOrderNew.getSySuperviseCostsProportion()).divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
-            //非车跟单出口比例
-            BigDecimal noExportOtherFee = insFeeOrderNew.getNoPremium()
-                    .multiply(noExportProceduresProportion
-                            .subtract(insFeeOrderNew.getNoSuperviseCostsProportion()).divide(new BigDecimal(100))).setScale(2,BigDecimal.ROUND_DOWN);
+            BigDecimal jqExportOtherCostsPremiums = insFeeOrderNew.getJqExportOtherCostsPremiums();
+            //商业跟单出口费用
+            BigDecimal syExportOtherCostsPremiums = insFeeOrderNew.getSyExportOtherCostsPremiums();
+            //非车跟单出口费用
+            BigDecimal noExportOtherCostsPremiums = insFeeOrderNew.getNoExportOtherCostsPremiums();
             //用户出口跟单费
-            if(sysUserAccountVo.getWillDocumentary()==null){
+            if (sysUserAccountVo.getWillDocumentary() == null) {
                 sysUserAccountVo.setWillDocumentary(BigDecimal.ZERO);
             }
-            sysUserAccountVo.setWillDocumentary(sysUserAccountVo.getWillDocumentary().add(jqExportOtherFee).add(syExportOtherFee).add(noExportOtherFee));
+            sysUserAccountVo.setWillDocumentary(sysUserAccountVo.getWillDocumentary().add(jqExportOtherCostsPremiums).add(syExportOtherCostsPremiums).add(noExportOtherCostsPremiums));
         }
     }
 }

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

@@ -347,6 +347,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
                 for (SysUserIsDial isDial : isDialList) {
                     if (record.getId().equals(isDial.getUserId())) {
                         record.setIsDial(isDial.getIsDial());
+                        record.setDialUserName(isDial.getDialUserName());
+                        record.setDialPassWord(isDial.getDialPassWord());
                     }
                 }
             }

+ 16 - 2
src/main/java/com/ydtech/modules/fee/service/impl/CostsCalServiceImpl.java

@@ -123,11 +123,14 @@ public class CostsCalServiceImpl implements CostsCalcService {
             if (esmRetail != null) {
 //                BigDecimal sumPremium = insFeeOrderNew.getJqPremium().add(insFeeOrderNew.getSyPremium()).add(insFeeOrderNew.getNoPremium());
                 if (Integer.parseInt(esmRetail.getRetailtype()) >= 3) {
-                    retailStoreFee.setRetailStoreRadioLevel1(new BigDecimal(esmRetail.getDisrate1()));
-                    retailStoreFee.setRetailStoreFeeLevel1(sumPremium.multiply(new BigDecimal(esmRetail.getDisrate1())).divide(new BigDecimal("100")));
+                    retailStoreFee.setRetailStoreRadioLevel3(new BigDecimal(esmRetail.getDisrate1()));
+                    retailStoreFee.setRetailStoreFeeLevel3(sumPremium.multiply(new BigDecimal(esmRetail.getDisrate1())).divide(new BigDecimal("100")));
                     if (parents != null && parents.size() > 2) {
                         retailStoreFee.setRetailStoreUserIdLevel3(parents.get(2).getId());
                     }
+                }else{
+                    retailStoreFee.setRetailStoreRadioLevel3(new BigDecimal(0));
+                    retailStoreFee.setRetailStoreFeeLevel3(new BigDecimal(0));
                 }
                 if (Integer.parseInt(esmRetail.getRetailtype()) >= 2) {
                     retailStoreFee.setRetailStoreRadioLevel2(new BigDecimal(esmRetail.getDisrate2()));
@@ -135,6 +138,9 @@ public class CostsCalServiceImpl implements CostsCalcService {
                     if (parents != null && parents.size() > 1) {
                         retailStoreFee.setRetailStoreUserIdLevel2(parents.get(1).getId());
                     }
+                }else{
+                    retailStoreFee.setRetailStoreRadioLevel2(new BigDecimal(0));
+                    retailStoreFee.setRetailStoreFeeLevel2(new BigDecimal(0));
                 }
                 if (Integer.parseInt(esmRetail.getRetailtype()) >= 1) {
                     retailStoreFee.setRetailStoreRadioLevel1(new BigDecimal(esmRetail.getDisrate1()));
@@ -142,8 +148,16 @@ public class CostsCalServiceImpl implements CostsCalcService {
                     if (parents != null && parents.size() > 0) {
                         retailStoreFee.setRetailStoreUserIdLevel1(parents.get(0).getId());
                     }
+                }else{
+                    retailStoreFee.setRetailStoreRadioLevel1(new BigDecimal(0));
+                    retailStoreFee.setRetailStoreFeeLevel1(new BigDecimal(0));
                 }
             }
+
+            BigDecimal retailStore = retailStoreFee.getRetailStoreRadioLevel1() != null ? retailStoreFee.getRetailStoreRadioLevel1() : new BigDecimal(0)
+                    .add(retailStoreFee.getRetailStoreRadioLevel2() != null ?  retailStoreFee.getRetailStoreRadioLevel2() : new BigDecimal(0))
+                    .add(retailStoreFee.getRetailStoreRadioLevel3() != null ? retailStoreFee.getRetailStoreRadioLevel3() : new BigDecimal(0));
+            retailStoreFee.setRetailStoreRadio(retailStore);
         }else{
             retailStoreFee.setRetailStoreFee(BigDecimal.ZERO);
             retailStoreFee.setRetailStoreRadio(BigDecimal.ZERO);

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

@@ -46,22 +46,14 @@ import java.util.stream.Collectors;
 public class FeeRuleSchemeServiceImpl implements FeeRuleSchemeService {
     @Resource
     private PtlAgreementProductCostsService ptlAgreementProductCostsService;
-    @Resource
-    private InsOrdersService insOrdersService;
+
     @Resource
     private InsFeeOrderService insFeeOrderService;
     @Resource
     private InsCopyFeeOrderService insCopyFeeOrderService;
     @Resource
     private SysUserService sysUserService;
-    @Resource
-    private SysDeptService sysDeptService;
-    @Resource
-    private EsmRetailService esmRetailService;
-    @Resource
-    private EsmUserReferrerService esmUserReferrerService;
-    @Resource
-    private InsAreaCompanyService insAreaCompanyService;
+
     @Resource
     private PtlAgreementService ptlAgreementService;
     @Resource

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

@@ -340,6 +340,37 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
 
         //endregion
 
+        //region 出口费用
+
+        //交强出口手续费比例
+        FeeOrderNewVo.ExportFee jqExportFee = feeRuleSchemeService.calcExportFee(insFeeOrderNew.getJqPremium(), insFeeOrderNew.getJqCostsExportProportion(),
+                insFeeOrderNew.getJqCostsProportion(), jqDeptRadio, retailRadio, taxRadio);
+
+        //商业出口手续费比例
+        FeeOrderNewVo.ExportFee syExportFee = feeRuleSchemeService.calcExportFee(insFeeOrderNew.getSyPremium(), insFeeOrderNew.getSyCostsExportProportion(),
+                insFeeOrderNew.getSyCostsProportion(), syDeptRadio, retailRadio, taxRadio);
+
+        //交强出口手续费比例
+        FeeOrderNewVo.ExportFee noExportFee = feeRuleSchemeService.calcExportFee(insFeeOrderNew.getNoPremium(), insFeeOrderNew.getNoCostsExportProportion(),
+                insFeeOrderNew.getNoCostsProportion(), noDeptRadio, retailRadio, taxRadio);
+
+        //出口手续费用
+        insFeeOrderNew.setJqExportSuperviseCostsPremiums(jqExportFee.getSuperviseCostsPremiums());
+        insFeeOrderNew.setSyExportSuperviseCostsPremiums(syExportFee.getSuperviseCostsPremiums());
+        insFeeOrderNew.setNoExportSuperviseCostsPremiums(noExportFee.getSuperviseCostsPremiums());
+
+        //出口其他费用比例
+        insFeeOrderNew.setJqExportOtherCostsProportion(jqExportFee.getOtherCostsProportion());
+        insFeeOrderNew.setSyExportOtherCostsProportion(syExportFee.getOtherCostsProportion());
+        insFeeOrderNew.setNoExportOtherCostsProportion(noExportFee.getOtherCostsProportion());
+
+        //出口其他费用
+        insFeeOrderNew.setJqExportOtherCostsPremiums(jqExportFee.getOtherCostsPremiums());
+        insFeeOrderNew.setSyExportOtherCostsPremiums(syExportFee.getOtherCostsPremiums());
+        insFeeOrderNew.setNoExportOtherCostsPremiums(noExportFee.getOtherCostsPremiums());
+
+        //endregion
+
 
         insFeeOrderNewService.saveOrUpdate(insFeeOrderNew);
     }

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

@@ -109,4 +109,14 @@ public class SettlementDocumentaryFeesEntity implements Serializable {
     @TableField("expend_amount")
     private BigDecimal expendAmount;
 
+    @ApiModelProperty("开票id")
+    @TableField("parent_id")
+    private String parentId;
+
+    @ApiModelProperty("是否是手续费")
+    @TableField("handling_fees_status")
+    private String handlingFeesStatus;
+
+
+
 }

+ 47 - 47
src/main/java/com/ydtech/modules/fnc/service/impl/InsFeeAuditServiceImpl.java

@@ -13,6 +13,7 @@ import com.ydtech.modules.admin.model.vo.SysUserBaseVO;
 import com.ydtech.modules.admin.service.*;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.esm.service.EsmUserReferrerService;
+import com.ydtech.modules.fee.service.FeeRuleSchemeNewService;
 import com.ydtech.modules.fnc.dao.FncInsAreaCompanyMapper;
 import com.ydtech.modules.fnc.dao.InsPlyIncomeMapper;
 import com.ydtech.modules.fnc.entity.InsFeeAudit;
@@ -32,6 +33,8 @@ import com.ydtech.modules.fnc.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsFeeOrder;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.modules.order.service.InsFeeOrderService;
+import com.ydtech.modules.protocol.entity.po.PtlAgreement;
+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.DateUtil;
@@ -63,8 +66,6 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
     private final InsOrdersMapper insOrdersMapper;
     private final InsPlyIncomeMapper insPlyIncomeMapper;
 
-    private final InsFeeOrderService insFeeOrderService;
-
     private final FncInsAreaCompanyMapper insAreaCompanyMapper;
 
     private final InsDeptFeeService insDeptFeeService;
@@ -90,11 +91,13 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
     @Autowired
     private InsPlyIncomeService insPlyIncomeService;
 
+    @Autowired
+    private PtlAgreementService ptlAgreementService;
+
 
-    public InsFeeAuditServiceImpl(FncInsAreaCompanyMapper insAreaCompanyMapper, InsOrdersMapper insOrdersMapper, InsFeeOrderService insFeeOrderService,InsDeptFeeService insDeptFeeService,EsmUserReferrerService esmUserReferrerService,SysUserService sysUserService,InsCommissionService insCommissionService,InsCompanyFeeService insCompanyFeeService,InsPlyIncomeMapper insPlyIncomeMapper) {
+    public InsFeeAuditServiceImpl(FncInsAreaCompanyMapper insAreaCompanyMapper, InsOrdersMapper insOrdersMapper, InsDeptFeeService insDeptFeeService,EsmUserReferrerService esmUserReferrerService,SysUserService sysUserService,InsCommissionService insCommissionService,InsCompanyFeeService insCompanyFeeService,InsPlyIncomeMapper insPlyIncomeMapper) {
         this.insAreaCompanyMapper = insAreaCompanyMapper;
         this.insOrdersMapper = insOrdersMapper;
-        this.insFeeOrderService=insFeeOrderService;
         this.insDeptFeeService=insDeptFeeService;
         this.esmUserReferrerService=esmUserReferrerService;
         this.sysUserService=sysUserService;
@@ -246,11 +249,12 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
 
                 //用户出口手续费
                 BigDecimal totalPremiumAmount = new BigDecimal(0);
-                totalPremiumAmount = totalPremiumAmount.add(jqExportProceduresFee).add(syExportProceduresFee).add(noExportProceduresFee);
+                totalPremiumAmount = totalPremiumAmount.add(insFeeOrderNew.getJqExportSuperviseCostsPremiums())
+                        .add(insFeeOrderNew.getSyExportSuperviseCostsPremiums()).add(insFeeOrderNew.getNoExportSuperviseCostsPremiums());
 
                 //用户出口跟单费
                 BigDecimal totalOtherPremiumAmount = new BigDecimal(0);
-                totalOtherPremiumAmount = totalOtherPremiumAmount.add(jqExportOtherFee).add(syExportOtherFee).add(noExportOtherFee);
+                totalOtherPremiumAmount = totalOtherPremiumAmount.add(insFeeOrderNew.getJqExportOtherCostsPremiums()).add(insFeeOrderNew.getSyExportOtherCostsPremiums()).add(insFeeOrderNew.getNoExportOtherCostsPremiums());
 
 
 //              用戶
@@ -413,17 +417,13 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
             if (ObjectUtils.isNotEmpty(insFeeOrderNew) ) {
 //                手续非佣金  =  交强监管费用 + 商业监管费用 + 非车监管费用
 //                非跟单费用  = 交强非跟单费用 + 商业非跟单费用 + 非车非跟单费用
-                //手续费入口费用
-//                BigDecimal jqPremiumAmount = this.zeroBigdecimal(insFeeOrderNew.getJqSuperviseCostsPremiums());//交强监管费
-//                BigDecimal syPremiumAmount = this.zeroBigdecimal(insFeeOrderNew.getSySuperviseCostsPremiums());//商业监管费
-//                BigDecimal noPremiumAmount = this.zeroBigdecimal(insFeeOrderNew.getNoSuperviseCostsPremiums());//非车监管费用
-//                BigDecimal totalPremiumAmount = jqPremiumAmount.add(syPremiumAmount).add(noPremiumAmount);    // 手续非佣金
-//                //其他费用入口费用
-//                BigDecimal jqOtherCostsPremiums  =this.zeroBigdecimal(insFeeOrderNew.getJqOtherCostsPremiums());//交强其他费用
-//                BigDecimal syOtherCostsPremiums  =this.zeroBigdecimal(insFeeOrderNew.getSyOtherCostsPremiums()); //商业其他费用
-//                BigDecimal noOtherCostsProportion = this.zeroBigdecimal(insFeeOrderNew.getNoOtherCostsPremiums());//非车其他费用
-//                BigDecimal totalOtherPremiumAmount = jqOtherCostsPremiums.add(syOtherCostsPremiums).add(noOtherCostsProportion);  //非跟单费用
+                PtlAgreement ptlAgreement = ptlAgreementService.getById(insAreaCompany.getAgreementId());
+                BigDecimal taxRadio = new BigDecimal("1.00");
+                if (ptlAgreement.getWithTax().equals("否")) {
+                    taxRadio = new BigDecimal("1.06");
+                }
 
+                
                 //总机构 交强管理比例
                 BigDecimal sumJqDeptProportion = insFeeOrderNew.getJqDeptProportionLevel1()
                         .add(insFeeOrderNew.getJqDeptProportionLevel2())
@@ -601,68 +601,68 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
         return true;
     }
 
-    private void countUserAmount(InsFeeOrderNew insFeeOrderNew ,String orderNo) {
+    private void countUserAmount(InsFeeOrderNew insFeeOrderNew, String orderNo) {
         String distributionStatus = insFeeOrderNew.getDistributionStatus();
-        if(StringUtils.isNotEmpty(distributionStatus)){
-            if(InsFeeAuditDistributionStatusEnum.DS_3.getCode().equals(distributionStatus)){
+        if (StringUtils.isNotEmpty(distributionStatus)) {
+            if (InsFeeAuditDistributionStatusEnum.DS_3.getCode().equals(distributionStatus)) {
                 BigDecimal totalDept = BigDecimal.ZERO;
-                if(StringUtils.isNotEmpty(insFeeOrderNew.getFirstLevelUserId())){
+                if (StringUtils.isNotEmpty(insFeeOrderNew.getFirstLevelUserId())) {
                     String firstLevelUserId = insFeeOrderNew.getFirstLevelUserId();
                     BigDecimal firstDetailPremiums = insFeeOrderNew.getFirstDetailPremiums();
-                    this.saveUpdateAccount(firstLevelUserId,firstDetailPremiums,orderNo);
-                }else {
-                    totalDept =  totalDept.add(insFeeOrderNew.getFirstDetailPremiums());
+                    this.saveUpdateAccount(firstLevelUserId, firstDetailPremiums, orderNo);
+                } else {
+                    totalDept = totalDept.add(insFeeOrderNew.getFirstDetailPremiums());
                 }
-                if(StringUtils.isNotEmpty(insFeeOrderNew.getTwoLevelUserId())){
+                if (StringUtils.isNotEmpty(insFeeOrderNew.getTwoLevelUserId())) {
                     String twoLevelUserId = insFeeOrderNew.getTwoLevelUserId();
                     BigDecimal secondDetailProportion = insFeeOrderNew.getSecondDetailPremiums();
-                    this.saveUpdateAccount(twoLevelUserId,secondDetailProportion,orderNo);
-                }else {
-                    totalDept =totalDept.add(insFeeOrderNew.getSecondDetailPremiums());
+                    this.saveUpdateAccount(twoLevelUserId, secondDetailProportion, orderNo);
+                } else {
+                    totalDept = totalDept.add(insFeeOrderNew.getSecondDetailPremiums());
                 }
-                if(StringUtils.isNotEmpty(insFeeOrderNew.getThreeLevelUserId())){
+                if (StringUtils.isNotEmpty(insFeeOrderNew.getThreeLevelUserId())) {
                     String threeLevelUserId = insFeeOrderNew.getThreeLevelUserId();
                     BigDecimal threeDetailPremiums = insFeeOrderNew.getThirdDetailPremiums();
-                    this.saveUpdateAccount(threeLevelUserId,threeDetailPremiums,orderNo);
-                }else {
-                    totalDept =totalDept.add(insFeeOrderNew.getThirdDetailPremiums());
+                    this.saveUpdateAccount(threeLevelUserId, threeDetailPremiums, orderNo);
+                } else {
+                    totalDept = totalDept.add(insFeeOrderNew.getThirdDetailPremiums());
                 }
 //                     机构管理 费用给五级交钱机构管理费
-                if(totalDept.compareTo(BigDecimal.ZERO) ==0){
+                if (totalDept.compareTo(BigDecimal.ZERO) == 0) {
                     BigDecimal jqDeptPremiumsLevel5 = insFeeOrderNew.getJqDeptPremiumsLevel5();
                     jqDeptPremiumsLevel5.add(totalDept);
                     insFeeOrderNewService.updateById(insFeeOrderNew);
                 }
-                } else if (InsFeeAuditDistributionStatusEnum.DS_2.getCode().equals(distributionStatus)) {
+            } else if (InsFeeAuditDistributionStatusEnum.DS_2.getCode().equals(distributionStatus)) {
                 BigDecimal totalDept = BigDecimal.ZERO;
-                if(StringUtils.isNotEmpty(insFeeOrderNew.getFirstLevelUserId())){
+                if (StringUtils.isNotEmpty(insFeeOrderNew.getFirstLevelUserId())) {
                     String firstLevelUserId = insFeeOrderNew.getFirstLevelUserId();
                     BigDecimal firstDetailPremiums = insFeeOrderNew.getFirstDetailPremiums();
-                    this.saveUpdateAccount(firstLevelUserId,firstDetailPremiums,orderNo);
-                }else {
-                    totalDept =  totalDept.add(insFeeOrderNew.getFirstDetailPremiums());
+                    this.saveUpdateAccount(firstLevelUserId, firstDetailPremiums, orderNo);
+                } else {
+                    totalDept = totalDept.add(insFeeOrderNew.getFirstDetailPremiums());
                 }
-                if(StringUtils.isNotEmpty(insFeeOrderNew.getTwoLevelUserId())){
+                if (StringUtils.isNotEmpty(insFeeOrderNew.getTwoLevelUserId())) {
                     String twoLevelUserId = insFeeOrderNew.getTwoLevelUserId();
                     BigDecimal secondDetailProportion = insFeeOrderNew.getSecondDetailPremiums();
-                    this.saveUpdateAccount(twoLevelUserId,secondDetailProportion,orderNo);
-                }else {
-                    totalDept =totalDept.add(insFeeOrderNew.getSecondDetailPremiums());
+                    this.saveUpdateAccount(twoLevelUserId, secondDetailProportion, orderNo);
+                } else {
+                    totalDept = totalDept.add(insFeeOrderNew.getSecondDetailPremiums());
                 }
 //                     机构管理 费用给五级交钱机构管理费
-                if(totalDept.compareTo(BigDecimal.ZERO) ==0){
+                if (totalDept.compareTo(BigDecimal.ZERO) == 0) {
                     BigDecimal jqDeptPremiumsLevel5 = insFeeOrderNew.getJqDeptPremiumsLevel5();
                     jqDeptPremiumsLevel5.add(totalDept);
                     insFeeOrderNewService.updateById(insFeeOrderNew);
                 }
-            }else {
+            } else {
 //                    一级分销
-                if(StringUtils.isNotEmpty(insFeeOrderNew.getFirstLevelUserId())){
+                if (StringUtils.isNotEmpty(insFeeOrderNew.getFirstLevelUserId())) {
                     String firstLevelUserId = insFeeOrderNew.getFirstLevelUserId();
                     BigDecimal firstDetailPremiums = insFeeOrderNew.getFirstDetailPremiums();
-                    this.saveUpdateAccount(firstLevelUserId,firstDetailPremiums,orderNo);
-                }else {
-                    if(insFeeOrderNew.getFirstDetailPremiums().compareTo(BigDecimal.ZERO) ==0){
+                    this.saveUpdateAccount(firstLevelUserId, firstDetailPremiums, orderNo);
+                } else {
+                    if (insFeeOrderNew.getFirstDetailPremiums().compareTo(BigDecimal.ZERO) == 0) {
                         BigDecimal jqDeptPremiumsLevel5 = insFeeOrderNew.getJqDeptPremiumsLevel5();
                         jqDeptPremiumsLevel5.add(insFeeOrderNew.getFirstDetailPremiums());
                         insFeeOrderNewService.updateById(insFeeOrderNew);

+ 61 - 47
src/main/java/com/ydtech/modules/fnc/service/impl/InsPlyIncomeServiceImpl.java

@@ -555,6 +555,9 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         if(StringUtils.isNotEmpty(insPlyIncomeVo.getPartnerCompaniesName())){
             params.put("partnerCompaniesName",insPlyIncomeVo.getPartnerCompaniesName());
         }
+        if(StringUtils.isNotEmpty(insPlyIncomeVo.getDockingPerson())){
+            params.put("dockingPerson",insPlyIncomeVo.getDockingPerson());
+        }
         return params;
     }
 
@@ -687,12 +690,12 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         HashMap<String, Object> params = new HashMap<>();
         ArrayList<HashMap<String, Object>> resultList = new ArrayList<>();
         HashMap<String, Object> resultMap = new HashMap<>();
-        StringBuffer strBuilder = new StringBuffer();
-        String ids="";
         try {
             List<InsBxPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsBxPlyIncomeExcelDto.class, 0, 1, 1);
+            Integer i=0;
             if(!CollectionUtils.isEmpty(dtoList)){
                 for (InsBxPlyIncomeExcelDto excelItem : dtoList) {
+                    i=i+1;
                     params.clear();
                     if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
                         String licenseno = excelItem.getLicenseno();//车牌号
@@ -711,8 +714,12 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                     params.put("isOther","0");
                     params.put("isNotCar",isNotCar);
                     InsPlyIncome insPlyIncome = baseMapper.findByBxLicenseno(params);
+                    if(i==dtoList.size()){
+                        resultMap.put("companyId",insPlyIncome.getCompanyId()); // 保险公司id
+                        resultMap.put("partnerCompaniesId",insPlyIncome.getPartnerCompaniesId()); //合作公司id
+                        resultMap.put("agreementId",insPlyIncome.getAgreementId());  //协议id
+                    }
                     if(ObjectUtils.isNotEmpty(insPlyIncome)){  // 比配上汇总金额 未匹配则返回到数据当中
-                        strBuilder.append(insPlyIncome.getId()).append(",");
                         if(  insPlyIncome.getCommissionFeevalue()!=null && insPlyIncome.getCommissionFeevalue().compareTo(BigDecimal.ZERO)!=0){
                             totalAmount = totalAmount.add(insPlyIncome.getCommissionFeevalue());  //添加总手续费
                         }
@@ -731,10 +738,6 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                     }
                 }
             }
-            if(strBuilder.length() >0){
-                 ids = strBuilder.deleteCharAt(strBuilder.length() - 1).toString();
-            }
-            resultMap.put("ids",ids);
             resultMap.put("totalAmount",totalAmount);
             resultMap.put("resultList",resultList);
             return resultMap;
@@ -750,12 +753,13 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         HashMap<String, Object> params = new HashMap<>();
         HashMap<String, Object> resultMap = new HashMap<>();
         ArrayList<HashMap<String, Object>> resultList = new ArrayList<>();
-        StringBuffer strBuilder = new StringBuffer();
         String ids="";
         try {
+            Integer i=0;
             List<InsBxNoPlyIncomeExcelDto> dtoList = ExcelEasypoiUtils.importExcel(multipartFile, InsBxNoPlyIncomeExcelDto.class, 0, 1, 1);
             if(!CollectionUtils.isEmpty(dtoList)){
                 for (InsBxNoPlyIncomeExcelDto excelItem : dtoList) {
+                    i=i+1;
                     params.clear();
                     if(StringUtils.isNotEmpty(excelItem.getLicenseno())){
                         String licenseno = excelItem.getLicenseno();//车牌号
@@ -769,8 +773,12 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                     params.put("isOther","0");
                     params.put("isNotCar",isNotCar);
                     InsPlyIncome insPlyIncome = baseMapper.findByBxLicenseno(params);
+                    if(i==dtoList.size()){
+                        resultMap.put("companyId",insPlyIncome.getCompanyId()); // 保险公司id
+                        resultMap.put("partnerCompaniesId",insPlyIncome.getPartnerCompaniesId()); //合作公司id
+                        resultMap.put("agreementId",insPlyIncome.getAgreementId());  //协议id
+                    }
                     if(ObjectUtils.isNotEmpty(insPlyIncome)){  // 比配上汇总金额 未匹配则返回到数据当中
-                        strBuilder.append(insPlyIncome.getId()).append(",");
                         if(  insPlyIncome.getCommissionFeevalue()!=null && insPlyIncome.getCommissionFeevalue().compareTo(BigDecimal.ZERO)!=0){
                             totalAmount = totalAmount.add(insPlyIncome.getCommissionFeevalue());  //添加总手续费
                         }
@@ -785,10 +793,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
                         resultList.add(noMatching);
                     }
                 }
-                if(strBuilder.length() >0){
-                    ids = strBuilder.deleteCharAt(strBuilder.length() - 1).toString();
-                }
-                resultMap.put("ids",ids);
+
                 resultMap.put("totalAmount",totalAmount);
                 resultMap.put("resultList",resultList);
             }
@@ -835,9 +840,12 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
     @Override
     public HttpResult<List<HashMap<String,Object>>> invicdetail(InsPlyIncomeVo insPlyIncomeVo) {
         HashMap<String, Object> params = new HashMap<>();
-        params= this.saveParams(insPlyIncomeVo,params);
-        List<HashMap<String,Object>>  result= this.baseMapper.groupByInvoic(params);
-        return HttpResult.ok(result);
+        params =this.saveParams(insPlyIncomeVo,params);
+        List<HashMap<String, Object>> resultList = settlementDocumentaryFeesService.getOtherSettldetail(params);
+        if (resultList.size() > 0) {
+            return HttpResult.ok(resultList);
+        }
+        return HttpResult.ok();
     }
 
     /***
@@ -887,7 +895,6 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         if (resultList.size() > 0) {
             return HttpResult.ok(resultList);
         }
-
         return HttpResult.ok();
     }
 
@@ -1210,8 +1217,10 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         settlementDocumentaryFeesVo.setInvoicingMethod(insPlyIncomeVo.getInvoicingMethod());  //开票方式
         settlementDocumentaryFeesVo.setTaxPoints(insPlyIncomeVo.getTaxPoints());  //税点
         settlementDocumentaryFeesVo.setExpendAmount(insPlyIncomeVo.getExpendAmount()); //税点支出
+        settlementDocumentaryFeesVo.setHandlingFeesStatus(insPlyIncomeVo.getHandlingFeesStatus());
         settlementDocumentaryFeesVo.setTotalAmount(insPlyIncomeVo.getInvoicCommissionFeevalue());
         settlementDocumentaryFeesVo.setCreateTime(LocalDate.now());
+        settlementDocumentaryFeesVo.setParentId(insPlyIncomeVo.getId());
         settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
         return HttpResult.ok();
     }
@@ -1257,21 +1266,21 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         }
     }
 
+    /**
+     *
+     * @param insPlyIncomeVo
+     * @return   保险手续费改成多次结算
+     */
     @Override
     @Transactional
     public HttpResult<Object> batchInvoicing(InsPlyIncomeVo insPlyIncomeVo) {
-//      开票时生成  记录 用来合计已经开票数据
-        String ids = insPlyIncomeVo.getIds();
-        if(StringUtils.isNotEmpty(ids)){
-            String[] split = ids.split(",");
-            for (String id :  split){
-                InsPlyIncome insPlyIncome = baseMapper.selectById(id);
-                insPlyIncome.setInvoicTime(LocalDate.now());  //开票时间
-                insPlyIncome.setInvoicId(insPlyIncomeVo.getInvoicId()); //开票号
-                insPlyIncome.setHandlingFeesStatus("2");   //2为开票
-                baseMapper.updateById(insPlyIncome);
-            }
-        }
+        insPlyIncomeVo.setNoInvoicCommissionFeevalue(insPlyIncomeVo.getTotalAmount());
+        insPlyIncomeVo.setOtherFeevalue(insPlyIncomeVo.getTotalAmount());
+        insPlyIncomeVo.setHandlingFeesStatus("0");  // 0手续费 1  跟单费
+        insPlyIncomeVo.setIsNotCar(insPlyIncomeVo.getIsNotCar());
+        insPlyIncomeVo.setSettlementAmount(insPlyIncomeVo.getTotalAmount());
+        insPlyIncomeVo.setContractId(insPlyIncomeVo.getInvoicId());
+        this.batchInvoic(insPlyIncomeVo);
         return HttpResult.ok();
     }
 
@@ -1288,25 +1297,29 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
 
     @Override
     public HttpResult<Object> batchBxBalance(InsPlyIncomeVo insPlyIncomeVo) {
-        InsPlyIncome insPlyIncome = new InsPlyIncome();
-
-        if(StringUtils.isNotEmpty(insPlyIncomeVo.getIds())){
-            String[] split = insPlyIncomeVo.getIds().split(",");
-            for(String  id : split){
-                insPlyIncome.setId(id);
-                insPlyIncome.setHandlingFeesStatus("1");
-                insPlyIncome.setSettlementTime(LocalDate.now());
-                baseMapper.updateById(insPlyIncome);
-            }
+//            分批结算
+        SettlementDocumentaryFeesVo settlementDocumentaryFeesVo = new SettlementDocumentaryFeesVo();
 
+        if ("0".equals(insPlyIncomeVo.getInvoicingMethod())) {
+            settlementDocumentaryFeesVo.setExpendAmount(insPlyIncomeVo.getInvoicCommissionFeevalue().multiply(BigDecimal.ONE.subtract(insPlyIncomeVo.getTaxPoints().divide(new BigDecimal(100)))));
+            settlementDocumentaryFeesVo.setSettlementAmount(insPlyIncomeVo.getSettlementAmount());   //进账金额
+        } else {
+            settlementDocumentaryFeesVo.setSettlementAmount(insPlyIncomeVo.getSettlementAmount());   //进账金额
         }
-        SettlementDocumentaryLogEntity settlementDocumentaryLogEntity = new SettlementDocumentaryLogEntity();
-
-        settlementDocumentaryLogEntity.setHandingAmount(insPlyIncomeVo.getReadyCommissionFeevalue());
-        settlementDocumentaryLogEntity.setIds(insPlyIncomeVo.getIds());
-        settlementDocumentaryLogEntity.setCreateTime(new Date());
-        settlementDocumentaryLogEntity.setCompanyId(insPlyIncomeVo.getCompanyId());
-        settlementDocumentaryLogService.save(settlementDocumentaryLogEntity);
+        settlementDocumentaryFeesVo.setInvoiceId(insPlyIncomeVo.getInvoicId());   //开票号
+        settlementDocumentaryFeesVo.setSettlementTime(insPlyIncomeVo.getSettlementTime());   //结算时间
+        settlementDocumentaryFeesVo.setSettlementStatus("2");   //2为结算状态
+        settlementDocumentaryFeesVo.setCompanyId(insPlyIncomeVo.getCompanyId());  // 保险公司id
+        settlementDocumentaryFeesVo.setPartnerCompaniesId(insPlyIncomeVo.getPartnerCompaniesId());  //合作公司id
+        settlementDocumentaryFeesVo.setIsNotCar(insPlyIncomeVo.getIsNotCar()); // 是否是非车
+        settlementDocumentaryFeesVo.setInvoicingMethod(insPlyIncomeVo.getInvoicingMethod());  //开票方式
+        settlementDocumentaryFeesVo.setTaxPoints(insPlyIncomeVo.getTaxPoints());  //税点
+        settlementDocumentaryFeesVo.setExpendAmount(insPlyIncomeVo.getExpendAmount()); //税点支出
+        settlementDocumentaryFeesVo.setTotalAmount(insPlyIncomeVo.getInvoicCommissionFeevalue());
+        settlementDocumentaryFeesVo.setHandlingFeesStatus("0");
+        settlementDocumentaryFeesVo.setParentId(insPlyIncomeVo.getId());
+        settlementDocumentaryFeesVo.setCreateTime(LocalDate.now());
+        settlementDocumentaryFeesService.inertSettle(settlementDocumentaryFeesVo);
         return HttpResult.ok();
     }
 
@@ -1330,7 +1343,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         List<InsPlyIncome> result = baseMapper.allOtherAmount(params);
         List<HashMap<String, Object>> otherIds = baseMapper.getOtherIds(params);
         List<HashMap<String, Object>> invoicIds = settlementDocumentaryFeesService.getInvoicIds(params);
-        this.splicingOtherIds(result,otherIds,invoicIds);
+        this.splicingOtherIds(result,otherIds,invoicIds );
         return HttpResult.ok(result);
     }
 
@@ -1420,6 +1433,7 @@ public class InsPlyIncomeServiceImpl extends ServiceImpl<InsPlyIncomeMapper, Ins
         if(StringUtils.isNotEmpty(insPlyIncomeVo.getContractId())){
             settlementDocumentaryFeesVo.setInvoiceId(insPlyIncomeVo.getContractId());  //开票号
         }
+        settlementDocumentaryFeesVo.setHandlingFeesStatus(insPlyIncomeVo.getHandlingFeesStatus());
         settlementDocumentaryFeesVo.setInvoicingMethod(insPlyIncomeVo.getInvoicingMethod()); //开票方式
         settlementDocumentaryFeesVo.setTaxPoints(insPlyIncomeVo.getTaxPoints()); //税点
         //  税点支出

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

@@ -127,7 +127,7 @@ public class InsPlyIncomeVo implements Serializable {
     private String  ids;
 
     @ApiModelProperty("总手续费")
-    private BigDecimal  totAmount;
+    private BigDecimal  totalAmount;
     @ApiModelProperty("结算金额")
     private BigDecimal settlementAmount;
 

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

@@ -97,4 +97,12 @@ public class SettlementDocumentaryFeesVo implements Serializable {
 
     @ApiModelProperty("结算时间")
     private LocalDate settlementTime;
+
+
+    @ApiModelProperty("开票id")
+    private String parentId;
+
+
+    @ApiModelProperty("是否是手续费")
+    private String handlingFeesStatus;
 }

+ 9 - 0
src/main/java/com/ydtech/modules/order/entity/vo/OrderVo.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.ydtech.modules.protocols.entity.vo.AgreementProductCostsSave;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -448,4 +449,12 @@ public class OrderVo implements Serializable {
     @TableField(exist = false)
     private String isDial;
 
+    @TableField(exist = false)
+    @ApiModelProperty(value = "拨号权限账号")
+    private String dialUserName;
+
+    @TableField(exist = false)
+    @ApiModelProperty(value = "拨号权限密码")
+    private String dialPassWord;
+
 }

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

@@ -949,6 +949,8 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             orderAndAreaCompany.setIsDial("0");
         }else {
             orderAndAreaCompany.setIsDial(userIsDial.getIsDial());
+            orderAndAreaCompany.setDialUserName(userIsDial.getDialUserName());
+            orderAndAreaCompany.setDialPassWord(userIsDial.getDialPassWord());
         }
         return HttpResult.ok("success", orderAndAreaCompany);
     }

+ 8 - 0
src/main/java/com/ydtech/modules/protocol/controller/PtlAgreementController.java

@@ -6,6 +6,7 @@ import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.PageRequest;
 import com.ydtech.core.page.PageResult;
 import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.inv.model.InvAccountProfit;
 import com.ydtech.modules.protocol.entity.dto.PltAgreementSchemeSaveDto;
 import com.ydtech.modules.protocol.entity.dto.PtlAgreementUndwrtRulesSaveDto;
 import com.ydtech.modules.protocol.entity.po.PtlAgreement;
@@ -24,6 +25,7 @@ import org.apache.poi.ss.formula.functions.T;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -193,5 +195,11 @@ public class PtlAgreementController extends BaseController {
     public HttpResult<List<PtlAgreement>> findRelationAgreement(@RequestBody PtlAgreement ptlAgreement){
         return ptlAgreementService.findRelationAgreement(ptlAgreement.getAssociationCompaniesId());
     }
+    @GetMapping("getDockingPersonList")
+    @ApiOperation("获取对接人列表")
+    public HttpResult getDockingPersonList(){
+        List<HashMap<String,Object>>list = ptlAgreementService.getDockingPersonList();
+        return HttpResult.ok(list);
+    }
 
 }

+ 5 - 0
src/main/java/com/ydtech/modules/protocol/dao/PtlAgreementMapper.java

@@ -6,6 +6,7 @@ import com.ydtech.modules.protocol.entity.po.PtlAgreement;
 import org.apache.ibatis.annotations.Param;
 
 import java.time.LocalDate;
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -21,6 +22,10 @@ public interface PtlAgreementMapper extends BaseMapper<PtlAgreement> {
     PtlAgreementInsCompanyDto getAgreementCompanyByCompanyId(@Param("localDate") LocalDate localDate, @Param("deptId") String deptId,@Param("companyId") String companyId);
 
     PtlAgreement getByAgreementIdNew(String agreementId);
+
+    List<HashMap<String, Object>> getDockingPersonList();
+
+
 }
 
 

+ 4 - 0
src/main/java/com/ydtech/modules/protocol/service/PtlAgreementService.java

@@ -13,6 +13,7 @@ import com.ydtech.modules.protocol.entity.po.PtlAgreementProductCosts;
 import com.ydtech.modules.protocol.entity.po.PtlAgreementUndwrtRules;
 import com.ydtech.modules.protocol.entity.vo.*;
 
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -222,4 +223,7 @@ public interface PtlAgreementService extends IService<PtlAgreement> {
      */
     List<PtlAgreement> getByCompanyCode(String companyCode);
 
+    List<HashMap<String, Object>> getDockingPersonList();
+
+
 }

+ 5 - 0
src/main/java/com/ydtech/modules/protocol/service/impl/PtlAgreementServiceImpl.java

@@ -733,5 +733,10 @@ public class PtlAgreementServiceImpl extends ServiceImpl<PtlAgreementMapper, Ptl
         return baseMapper.selectList(new LambdaQueryWrapper<PtlAgreement>().eq(PtlAgreement::getPartnerCompaniesId, companyCode));
     }
 
+    @Override
+    public List<HashMap<String, Object>> getDockingPersonList() {
+        return   baseMapper.getDockingPersonList();
+    }
+
 
 }

+ 1 - 1
src/main/java/com/ydtech/modules/protocols/controller/PtlNewAgreementController.java

@@ -154,7 +154,7 @@ public class PtlNewAgreementController extends BaseController {
         return ptlAgreementProductCostsNewService.costsAuditBatch(costsAuditVo) ? HttpResult.ok("费用批量审核成功") : HttpResult.error("费用批量审核失败");
     }
 
-    @ApiOperation(value = "费用批量修改期")
+    @ApiOperation(value = "费用批量修改期")
     @PostMapping("/costs/endDateBatch")
     public HttpResult costsEndDateBatch(@RequestBody AgreementProductCostsEndDateVo agreementProductCostsEndDateVo){
         return ptlAgreementProductCostsNewService.costsEndDateBatch(agreementProductCostsEndDateVo) ? HttpResult.ok("费用批量修改成功") : HttpResult.error("费用批量修改失败");

+ 38 - 0
src/main/java/com/ydtech/modules/protocols/entity/po/InsFeeOrderNew.java

@@ -363,6 +363,44 @@ public class InsFeeOrderNew {
     @TableField(value = "dept_distribution")
     private BigDecimal deptDistribution;
 
+
+    @ApiModelProperty(value = "交强手续费出口金额")
+    @TableField(value = "jq_export_supervise_costs_premiums")
+    private BigDecimal jqExportSuperviseCostsPremiums;
+
+    @ApiModelProperty(value = "商业手续费出口金额")
+    @TableField(value = "sy_export_supervise_costs_premiums")
+    private BigDecimal syExportSuperviseCostsPremiums;
+
+    @ApiModelProperty(value = "非车手续费出口金额")
+    @TableField(value = "no_export_supervise_costs_premiums")
+    private BigDecimal noExportSuperviseCostsPremiums;
+
+    @ApiModelProperty(value = "交强其他费用出口比例")
+    @TableField(value = "jq_export_other_costs_proportion")
+    private BigDecimal jqExportOtherCostsProportion;
+
+    @ApiModelProperty(value = "商业其他费用出口比例")
+    @TableField(value = "sy_export_other_costs_proportion")
+    private BigDecimal  syExportOtherCostsProportion;
+
+    @ApiModelProperty(value = "非车其他费用出口比例")
+    @TableField(value = "no_export_other_costs_proportion")
+    private BigDecimal noExportOtherCostsProportion;
+
+    @ApiModelProperty(value = "交强其他费用出口金额")
+    @TableField(value = "jq_export_other_costs_premiums")
+    private BigDecimal jqExportOtherCostsPremiums;
+
+    @ApiModelProperty(value = "商业其他费用出口金额")
+    @TableField(value = "sy_export_other_costs_premiums")
+    private BigDecimal syExportOtherCostsPremiums;
+
+    @ApiModelProperty(value = "非车其他费用出口金额")
+    @TableField(value = "no_export_other_costs_premiums")
+    private BigDecimal noExportOtherCostsPremiums;
+
+
     @ApiModelProperty(value = "签单日期")
     @TableField(exist = false)
     private LocalDate signingTime;

+ 3 - 0
src/main/java/com/ydtech/modules/protocols/entity/vo/AgreementProductCostsEndDateVo.java

@@ -12,4 +12,7 @@ public class AgreementProductCostsEndDateVo {
 
     @ApiModelProperty(value = "费用止期")
     private String costsEndDate;
+
+    @ApiModelProperty(value = "费用起期")
+    private String costsStartDate;
 }

+ 5 - 3
src/main/java/com/ydtech/modules/protocols/service/impl/PtlAgreementProductCostsNewServiceImpl.java

@@ -983,10 +983,12 @@ public class PtlAgreementProductCostsNewServiceImpl extends ServiceImpl<PtlAgree
             if(ptlAgreementProductCostsNew == null){
                 throw new SystemException("费用不存在");
             }
-            if (agreementProductCostsEndDateVo.getCostsEndDate() == null) {
-                throw new SystemException("费用止期不可为空");
+            if (agreementProductCostsEndDateVo.getCostsEndDate() != null) {
+                ptlAgreementProductCostsNew.setCostsEndDate(agreementProductCostsEndDateVo.getCostsEndDate());
+            }
+            if (agreementProductCostsEndDateVo.getCostsStartDate() != null) {
+                ptlAgreementProductCostsNew.setCostsStartDate(agreementProductCostsEndDateVo.getCostsStartDate());
             }
-            ptlAgreementProductCostsNew.setCostsEndDate(agreementProductCostsEndDateVo.getCostsEndDate());
             String desc = "修改费用因子";
             //添加费用因子轨迹
             ptlAgreementProductCostsTrajectoryService.addCostsTrajectory(ptlAgreementProductCostsNew.getId(),desc,BaseController.getUser().getId());

+ 8 - 0
src/main/resources/mapper/modules/admin/SysDeptAccountWithdrawMapper.xml

@@ -13,6 +13,10 @@
         <result property="createTime" column="create_date" jdbcType="TIMESTAMP"/>
         <result property="createTimeStart" column="createTimeStart" jdbcType="VARCHAR"/>
         <result property="createTimeEnd" column="createTimeEnd" jdbcType="VARCHAR"/>
+        <result property="auditName" column="audit_name" jdbcType="VARCHAR"/>
+        <result property="auditUserid" column="audit_userid" jdbcType="VARCHAR"/>
+        <result property="withdrawUserid" column="withdraw_userid" jdbcType="VARCHAR"/>
+        <result property="withdrawName" column="withdraw_name" jdbcType="VARCHAR"/>
     </resultMap>
 
 
@@ -26,6 +30,10 @@
         remark,
         voucher_id,
         pic_id,
+        withdraw_userid,
+        withdraw_name,
+        audit_userid,
+        audit_name,
         DATE(create_time) as create_date
         from sys_dept_account_withdraw
         where

+ 72 - 40
src/main/resources/mapper/modules/fnc/InsPlyIncomeMapper.xml

@@ -164,6 +164,10 @@
                     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>
@@ -726,19 +730,47 @@
 
 
     <select id="totalBxAmount" resultType="com.ydtech.modules.fnc.entity.InsPlyIncome">
-        select
-        SUM(a.commission_feevalue) AS "commissionFeevalue",
-        a.partner_companies_id  AS  "partnerCompaniesId",
-        MAX(a.agreement_id) AS "agreementId",
-        MAX(a.partner_companies_name) AS "partnerCompaniesName",
+        SELECT
+        a.partner_companies_id AS "partnerCompaniesId",
         MAX( a.company_name ) AS "companyName",
-        SUM(CASE WHEN a.handling_fees_status = '2' THEN a.commission_feevalue ELSE 0 END) AS "invoicCommissionFeevalue",
-        SUM( CASE WHEN a.handling_fees_status = '0' THEN a.commission_feevalue ELSE 0 END ) AS "noInvoicCommissionFeevalue",
-        SUM(CASE WHEN a.handling_fees_status = '1' THEN a.commission_feevalue ELSE 0 END) AS "readyCommissionFeevalue",
-        SUM( CASE WHEN ( a.handling_fees_status = '2' or   a.handling_fees_status = '1' ) THEN a.commission_feevalue ELSE 0 END ) AS "allInvoicCommissionFeevalue",
-        SUM( CASE WHEN ( a.handling_fees_status = '2' or   a.handling_fees_status = '0' ) THEN a.commission_feevalue ELSE 0 END ) AS "unSettledAmount"
-        from  ins_ply_income a
-        LEFT JOIN   ptl_agreement  pa  on pa.id= a.agreement_id
+        MAX( a.company_id ) AS "companyId",
+        MAX( a.partner_companies_name ) AS "partnerCompaniesName",
+        IFNULL ( max(c.settleMentAmount),0.00) as  "allInvoicCommissionFeevalue",
+        IFNULL(max(f.settleMentAmount) , 0.00)  as  "readyCommissionFeevalue",
+        IFNULL ( max(d.settleMentAmount),0.00) as "invoicCommissionFeevalue",
+        sum(COALESCE( a.commission_feevalue,0.00) )-COALESCE(max(c.settleMentAmount),0.00)  as "noInvoicCommissionFeevalue",
+        sum(COALESCE( a.commission_feevalue,0.00) )-COALESCE(max(c.settleMentAmount),0.00)+IFNULL ( max(d.settleMentAmount),0.00)  AS "unSettledAmount",
+        sum( a.commission_feevalue ) AS "commissionFeevalue"
+        FROM
+        ins_ply_income a
+        LEFT JOIN ptl_agreement pa ON a.agreement_id = pa.id
+        LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId" ,sum(
+        settlement_amount ) AS "settleMentAmount" FROM settlement_documentary_fees a
+        WHERE ( a.settlement_status = '1' or a.settlement_status = '2')
+        and  a.handling_fees_status ='0'
+        <if test="isNotCar !=null  and  isNotCar  !=''">
+            and a.is_not_car =#{isNotCar}
+        </if>
+        GROUP BY partner_companies_id
+        ) c ON c.partnerCompaniesId = a.partner_companies_id
+        LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId" ,sum(
+        settlement_amount ) AS "settleMentAmount" FROM settlement_documentary_fees a
+        WHERE ( a.settlement_status = '1')
+        and  a.handling_fees_status ='0'
+        <if test="isNotCar !=null  and  isNotCar  !=''">
+            and a.is_not_car =#{isNotCar}
+        </if>
+        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
+        WHERE a.settlement_status = '2'
+        and  a.handling_fees_status ='0'
+        <if test="isNotCar !=null  and  isNotCar  !=''">
+            and a.is_not_car =#{isNotCar}
+        </if>
+        GROUP BY partner_companies_id
+        ) f ON f.partnerCompaniesId = a.partner_companies_id
         <where>
             1=1
             <if test="agreementType !=null  and agreementType!='' ">
@@ -753,9 +785,6 @@
             <if test="isNotCar !=null  and  isNotCar  !=''">
                 and a.is_not_car =#{isNotCar}
             </if>
-            <if test="handlingFeesStatus !=null  and  handlingFeesStatus  !=''">
-                and a.handling_fees_status =#{handlingFeesStatus}
-            </if>
             <if test="month !=null  and  month !=''">
                 AND month(a.signdate) =#{month}
             </if>
@@ -816,6 +845,7 @@
         LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId" ,sum(
         settlement_amount ) AS "settleMentAmount" FROM settlement_documentary_fees a
         WHERE ( a.settlement_status = '1' or a.settlement_status = '2')
+        and  a.handling_fees_status ='1'
         <if test="isNotCar !=null  and  isNotCar  !=''">
             and a.is_not_car =#{isNotCar}
         </if>
@@ -824,6 +854,7 @@
         LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId" ,sum(
         settlement_amount ) AS "settleMentAmount" FROM settlement_documentary_fees a
         WHERE ( a.settlement_status = '1')
+        and  a.handling_fees_status ='1'
         <if test="isNotCar !=null  and  isNotCar  !=''">
             and a.is_not_car =#{isNotCar}
         </if>
@@ -832,37 +863,38 @@
         LEFT JOIN ( SELECT a.partner_companies_id AS "partnerCompaniesId",sum(
         settlement_amount ) AS "settleMentAmount" FROM settlement_documentary_fees a
         WHERE a.settlement_status = '2'
+          and  a.handling_fees_status ='1'
         <if test="isNotCar !=null  and  isNotCar  !=''">
             and a.is_not_car =#{isNotCar}
         </if>
         GROUP BY partner_companies_id
         ) f ON f.partnerCompaniesId = a.partner_companies_id
-       <where>
-           1=1
-           <if test="agreementType !=null  and agreementType!='' ">
-               AND pa.agreement_type =#{agreementType}
-           </if>
-           <if test="year !=null  and  year  !=''">
-               AND YEAR(a.signdate) =#{year}
-           </if>
-           <if test="isOther !=null  and  isOther  !=''">
-               and a.is_not_documentary   =#{isOther}
-           </if>
-           <if test="isNotCar !=null  and  isNotCar  !=''">
-               and a.is_not_car =#{isNotCar}
-           </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="documentaryFeesStatus != null  and documentaryFeesStatus != '' ">
-               AND   a.documentary_fees_status = #{documentaryFeesStatus}
-           </if>
-       </where>
+        <where>
+            1=1
+            <if test="agreementType !=null  and agreementType!='' ">
+                AND pa.agreement_type =#{agreementType}
+            </if>
+            <if test="year !=null  and  year  !=''">
+                AND YEAR(a.signdate) =#{year}
+            </if>
+            <if test="isOther !=null  and  isOther  !=''">
+                and a.is_not_documentary   =#{isOther}
+            </if>
+            <if test="isNotCar !=null  and  isNotCar  !=''">
+                and a.is_not_car =#{isNotCar}
+            </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="documentaryFeesStatus != null  and documentaryFeesStatus != '' ">
+                AND   a.documentary_fees_status = #{documentaryFeesStatus}
+            </if>
+        </where>
         GROUP BY
-            a.partner_companies_id
+        a.partner_companies_id
     </select>
 
     <select id="getOtherIds" resultType="java.util.HashMap">

+ 25 - 31
src/main/resources/mapper/modules/fnc/SettlementDocumentaryFeesMapper.xml

@@ -24,6 +24,8 @@
         <result column="invoicing_method" property="invoicingMethod"/>
         <result column="tax_points" property="taxPoints"/>
         <result column="expend_amount" property="expendAmount"/>
+        <result column="parent_id" property="parentId"/>
+        <result column="handling_fees_status" property="handlingFeesStatus"/>
     </resultMap>
 
 
@@ -43,44 +45,38 @@
             a.invoicing_method as "invoicingMethod",
             a.tax_points as "taxPoints",
             a.expend_amount as "expendAmount",
+            a.parent_id as "parentId",
+            a.handling_fees_status as "handlingFeesStatus",
             a.unsettled_amount as "unsettledAmount"
             from  settlement_documentary_fees  a
     </select>
 
     <select id="getOtherSettldetail" resultType="java.util.HashMap">
         SELECT
-        CASE
-        WHEN t.total_settlement_amount_1 = 0 THEN 0
-        ELSE t.total_settlement_amount_1 - t.total_settlement_amount_2
-        END AS "invoicCommissionFeevalue",
-        t.max_create_time AS "invoicTime",
-        t.max_invoice_id AS "invoicId",
-        t.max_tax_points AS "taxPoints",
-        t.max_invoicing_method AS "invoicingMethod",
-        t.ids AS "ids"
-        FROM (
-        SELECT
-        SUM(CASE WHEN a.settlement_status = '1' THEN a.settlement_amount ELSE 0 END) AS total_settlement_amount_1,
-        SUM(CASE WHEN a.settlement_status = '2' THEN a.settlement_amount ELSE 0 END) AS total_settlement_amount_2,
-        MAX(a.create_time) AS max_create_time,
-        MAX(a.invoice_id) AS max_invoice_id,
-        MAX(a.tax_points) AS max_tax_points,
-        MAX(a.invoicing_method) AS max_invoicing_method,
-        GROUP_CONCAT(a.id) AS ids
+        a.id as "id",
+        a.create_time AS "invoicTime",
+        a.invoice_id AS  "invoicId",
+        a.tax_points AS  "taxPoints",
+        a.settlement_amount - COALESCE(b.settlementAmount, 0) AS "invoicCommissionFeevalue",
+        a.invoicing_method AS  "invoicingMethod"
         FROM
         settlement_documentary_fees a
+        left  join  (
+        select a.parent_id as "parentId" ,sum(a.settlement_amount) as "settlementAmount" from
+        settlement_documentary_fees a
+        where  a.settlement_status ='2'  and  a.parent_id is  not  null
+        GROUP BY a.parent_id
+        ) b  on a.id=b.parentId
         <where>
             1=1
-            <if test="settlementStatus !=null and  settlementStatus !=''">
-                and a.settlement_status = =#{settlementStatus}
-            </if>
-            <if test="isNotCar !=null  and  isNotCar  !=''">
-                and a.is_not_car =#{isNotCar}
-            </if>
-
+            and  a.settlement_status  ='1'
+            and a.settlement_amount - COALESCE(b.settlementAmount, 0) &lt;&gt; 0
             <if test="partnerCompaniesId !=null  and  partnerCompaniesId  !=''">
                 and a.partner_companies_id =#{partnerCompaniesId}
             </if>
+            <if test="handlingFeesStatus !=null  and  handlingFeesStatus  !=''">
+                and a.handling_fees_status =#{handlingFeesStatus}
+            </if>
             <if test="invoiceIds !=null and  invoiceIds !=''  and invoiceIds.length>0">
                 and a.id IN
                 <foreach item="item" index="index" collection="invoiceIds" open="(" separator="," close=")">
@@ -88,12 +84,6 @@
                 </foreach>
             </if>
         </where>
-        GROUP BY
-        a.invoice_id
-        HAVING
-        SUM(CASE WHEN a.settlement_status = '1' THEN a.settlement_amount ELSE 0 END)  &lt;&gt; 0
-        AND SUM(CASE WHEN a.settlement_status = '1' THEN a.settlement_amount ELSE 0 END) &lt;&gt; SUM(CASE WHEN a.settlement_status = '2' THEN a.settlement_amount ELSE 0 END)
-        ) t;
     </select>
 
     <update id="batchByInvoice" parameterType="java.util.HashMap">
@@ -126,6 +116,10 @@
             <if test="isNotCar !=null  and  isNotCar  !=''">
                 and a.is_not_car =#{isNotCar}
             </if>
+            <if test="handlingFeesStatus !=null  and  handlingFeesStatus !=''">
+                a.handling_fees_status=#{handlingFeesStatus}
+
+            </if>
         </where>
     </select>
 

+ 7 - 0
src/main/resources/mapper/modules/protocol/PtlAgreementMapper.xml

@@ -114,4 +114,11 @@
         </where>
     </select>
 
+
+    <select id="getDockingPersonList" resultType="java.util.HashMap">
+        SELECT docking_person
+        FROM `ptl_agreement`
+        GROUP BY docking_person
+    </select>
+
 </mapper>

+ 2 - 2
src/main/resources/mapper/modules/protocols/PtlAgreementProductCostsNewMapper.xml

@@ -14,7 +14,7 @@
         LEFT JOIN ptl_agreement pa ON papcn.agreement_id = pa.id
         where 1=1
         <if test="params.agreementIds != null and params.agreementIds != ''">
-            AND pa.id in (#{params.agreementIds})
+            AND pa.id in (${params.agreementIds})
         </if>
         <if test="params.agreementId != null and params.agreementId != ''">
             AND pa.id in (#{params.agreementId})
@@ -32,7 +32,7 @@
             </foreach>
         </if>
         <if test="params.createStartTime != null and params.createStartTime != ''">
-            and papcn.create_time BETWEEN #{params.createStartTime} and #{params.createEndTime}
+            and DATE(papcn.create_time) BETWEEN #{params.createStartTime} and #{params.createEndTime}
         </if>
 
     </select>