Browse Source

运营中心结算方案

zhouxin 1 year ago
parent
commit
6ae8b91ccc
19 changed files with 438 additions and 37 deletions
  1. 7 0
      superdesk-uniorder-dao/src/main/java/cn/superdesk/uniorder/dao/mapper/unified/settlement/UnifiedSettlementProgrammeMapperEx.java
  2. 3 0
      superdesk-uniorder-dao/src/main/resources/mappers/operationCenter/UnifiedCenterCustomerMapper.xml
  3. 6 1
      superdesk-uniorder-dao/src/main/resources/mappers/operationCenter/accounting/UnifiedAccountingOrderCreditMapperEx.xml
  4. 7 0
      superdesk-uniorder-dao/src/main/resources/mappers/operationCenter/accounting/UnifiedAccountingOrderGoodsMapperEx.xml
  5. 33 0
      superdesk-uniorder-dao/src/main/resources/mappers/unified/settlement/UnifiedSettlementProgrammeMapperEx.xml
  6. 4 0
      superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/param/operationCenter/customer/OperationCenterCustomerParam.java
  7. 9 4
      superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/param/operationCenter/customer/settlement/UnifiedSettlementAmountRuleParam.java
  8. 5 0
      superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/param/operationCenter/customer/settlement/UnifiedSettlementParam.java
  9. 2 1
      superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/param/operationCenter/customer/settlement/UnifiedSettlementRangeRuleParam.java
  10. 6 0
      superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/vo/operationCenter/accounting/UnifiedAccountingOrderInfoVo.java
  11. 9 0
      superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/vo/operationCenter/customer/OperationCenterCustomerVo.java
  12. 29 0
      superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/vo/operationCenter/customer/settlement/UnifiedSettlementVo.java
  13. 11 0
      superdesk-uniorder-dubbo-facade/src/main/java/cn/superdesk/uniorder/dubbo/facade/unified/settlement/DubboUnifiedSettlementProgrammeService.java
  14. 36 0
      superdesk-uniorder-dubbo-provider/src/main/java/cn/superdesk/uniorder/dubbo/provider/unified/settlement/DubboUnifiedSettlementProgrammeServiceImpl.java
  15. 11 0
      superdesk-uniorder-service/src/main/java/cn/superdesk/uniorder/service/unified/settlement/UnifiedSettlementProgrammeService.java
  16. 209 6
      superdesk-uniorder-service/src/main/java/cn/superdesk/uniorder/service/unified/settlement/impl/UnifiedSettlementProgrammeServiceImpl.java
  17. 5 5
      superdesk-uniorder-web/src/main/java/cn/superdesk/uniorder/controller/operationCenter/accounting/UnifiedAccountingController.java
  18. 27 19
      superdesk-uniorder-web/src/main/java/cn/superdesk/uniorder/controller/operationCenter/customer/UnifiedSettlementController.java
  19. 19 1
      superdesk-uniorder-web/src/main/java/cn/superdesk/uniorder/dubbo/consumer/operationCenter/customer/UnifiedSettlementDubboService.java

+ 7 - 0
superdesk-uniorder-dao/src/main/java/cn/superdesk/uniorder/dao/mapper/unified/settlement/UnifiedSettlementProgrammeMapperEx.java

@@ -1,4 +1,11 @@
 package cn.superdesk.uniorder.dao.mapper.unified.settlement;
 
+import cn.superdesk.uniorder.dto.param.operationCenter.customer.OperationCenterCustomerParam;
+import cn.superdesk.uniorder.dto.vo.operationCenter.customer.OperationCenterCustomerVo;
+import cn.superdesk.uniorder.dto.vo.operationCenter.customer.settlement.UnifiedSettlementVo;
+
+import java.util.List;
+
 public interface UnifiedSettlementProgrammeMapperEx {
+    List<UnifiedSettlementVo> list(OperationCenterCustomerParam param);
 }

+ 3 - 0
superdesk-uniorder-dao/src/main/resources/mappers/operationCenter/UnifiedCenterCustomerMapper.xml

@@ -316,6 +316,9 @@
            t.business_name businessName,
            t.remark,
            t.`status`,
+           t.is_data_permission isPermission,
+           t.is_settlement_method isSettlement,
+           t.is_bill_start isBillStart,
            IF(is_data_permission=0,'未关联','已关联') permission,
            IF(is_settlement_method=0,'未配置','已配置') settlement,
            IF(is_bill_start=0,'未配置','已配置') billStart,

+ 6 - 1
superdesk-uniorder-dao/src/main/resources/mappers/operationCenter/accounting/UnifiedAccountingOrderCreditMapperEx.xml

@@ -40,7 +40,12 @@
 
 
     t.accounting_order_sn_operator accountingOrderSnOperator,
-
+        t1.operator_id operatorId,
+        t1.org_id orgId,
+        t1.enterprise_id enterpriseId,
+        t1.biz_platform_code bizPlatformCode,
+        t1.order_type_code order_type_code,
+        t1.platform_pay_type_id  platformPayTypeId,
     t.update_time updateTime
     </sql>
 

+ 7 - 0
superdesk-uniorder-dao/src/main/resources/mappers/operationCenter/accounting/UnifiedAccountingOrderGoodsMapperEx.xml

@@ -258,6 +258,13 @@
       t1.refund_origin_order_sn refundOriginOrderSn,
       t.accounting_status accountingStatus,
       t.accounting_order_sn_operator accountingOrderSnOperator,
+        t1.operator_id operatorId,
+        t1.org_id orgId,
+        t1.enterprise_id enterpriseId,
+        t1.biz_platform_code bizPlatformCode,
+        t1.order_type_code order_type_code,
+        t1.platform_pay_type_id  platformPayTypeId,
+
       t.update_time updateTime
   </sql>
   <sql id="EXCEL_COLUMN">

+ 33 - 0
superdesk-uniorder-dao/src/main/resources/mappers/unified/settlement/UnifiedSettlementProgrammeMapperEx.xml

@@ -2,4 +2,37 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.superdesk.uniorder.dao.mapper.unified.settlement.UnifiedSettlementProgrammeMapperEx">
 
+    <select id="list"
+            resultType="cn.superdesk.uniorder.dto.vo.operationCenter.customer.settlement.UnifiedSettlementVo">
+
+        SELECT
+            t.id ,
+            t.programme_name programmeName,
+            t.programme_no programmeNo,
+            t.settlement_rule settlementRule,
+            t.remark,
+            t.enabled,
+            t1.fullname updateUser,
+            t.update_time updateTime
+        FROM unified_settlement_programme t
+                 LEFT JOIN
+             sys_user t1
+             on t.update_user_id= t1.id
+        WHERE
+            t.deleted=0
+        <if test="status !=null and status !=''">
+            and t.enabled=#{status}
+        </if>
+        <if test="programmeName !=null and programmeName !=''">
+            and t.programme_name=#{programmeName}
+        </if>
+        <if test="programmeNo !=null and programmeNo !=''">
+            and t.programme_no=#{programmeNo}
+        </if>
+
+
+
+        ORDER BY t.update_time
+
+    </select>
 </mapper>

+ 4 - 0
superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/param/operationCenter/customer/OperationCenterCustomerParam.java

@@ -26,4 +26,8 @@ public class OperationCenterCustomerParam implements Serializable {
     private String customerContact;//客户联系人
     private String business;//业务人员
 
+    //客户管理-结算方案
+    private String programmeName;//方案名称
+    private String programmeNo;//方案编号
+
 }

+ 9 - 4
superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/param/operationCenter/customer/settlement/UnifiedSettlementAmountRuleParam.java

@@ -4,6 +4,7 @@ import lombok.Data;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.util.Date;
 
 /**
  * @Author : zx
@@ -13,15 +14,19 @@ import java.math.BigDecimal;
 @Data
 public class UnifiedSettlementAmountRuleParam implements Serializable {
     private Integer display;//排序 序号
-    private String operator_names;//适用运营商
-    private String org_names;//使用项目
-  //  private String
+    private String operatorNames;//适用运营商
+    private String orgNames;//适用项目
+    private String orderTypeNames;//适用订单类型
+
+
 
     private String operatorIds;//运营商id-多个
     private String orgIds;//项目id-多个
-    private String bizPlatformCodes;//订单类型-多个 OpCenterBizPlatformEnum
+    private String orderTypeIds;//订单类型-多个 OpCenterBizPlatformEnum
+
     private Integer amountRule;//  SettlementAmountRuleEnum
     private BigDecimal amountRate;//结算规则比例
 
 
+
 }

+ 5 - 0
superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/param/operationCenter/customer/settlement/UnifiedSettlementParam.java

@@ -13,8 +13,13 @@ import java.util.List;
  */
 @Data
 public class UnifiedSettlementParam extends SettlementExportFieldVo implements Serializable{
+    private Long id;//id
+
     private Long customerId;//客户id
+
+    private String customerName;//客户名
     private Integer type;//类型
+    private String typeDesc;
     private String programmeName;//方案名称
 
     private Integer settlementScope;//结算范围 SettlementScopeEnum

+ 2 - 1
superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/param/operationCenter/customer/settlement/UnifiedSettlementRangeRuleParam.java

@@ -1,5 +1,6 @@
 package cn.superdesk.uniorder.dto.param.operationCenter.customer.settlement;
 
+import cn.superdesk.uniorder.dto.vo.operationCenter.base.OperationCenterVo;
 import cn.superdesk.uniorder.dto.vo.sys.SysSelectVo;
 import lombok.Data;
 
@@ -20,7 +21,7 @@ public class UnifiedSettlementRangeRuleParam implements Serializable {
     //指定供应商,指定订单类型,指定支付方式
     private String notJoiningRange;//不参与结算范围
 
-    List<SysSelectVo> sysSelectVoList;
+    List<OperationCenterVo> sysSelectVoList;
 
 
 }

+ 6 - 0
superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/vo/operationCenter/accounting/UnifiedAccountingOrderInfoVo.java

@@ -97,4 +97,10 @@ public class UnifiedAccountingOrderInfoVo implements Serializable {
     private String batch;
 
 
+    private String operatorId;
+    private String orgId;
+    private String enterpriseId;
+    private String bizPlatformCode;
+    private String orderTypeCode;
+    private Long platformPayTypeId;
 }

+ 9 - 0
superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/vo/operationCenter/customer/OperationCenterCustomerVo.java

@@ -29,6 +29,15 @@ public class OperationCenterCustomerVo implements Serializable {
     private String remark;
     //状态
     private Integer status;
+
+
+    //数据权限
+    private Integer isPermission;
+    //结算方案
+    private Integer isSettlement;
+    //开票抬头
+    private Integer isBillStart;
+
     //数据权限
     private String permission;
     //结算方案

+ 29 - 0
superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/vo/operationCenter/customer/settlement/UnifiedSettlementVo.java

@@ -0,0 +1,29 @@
+package cn.superdesk.uniorder.dto.vo.operationCenter.customer.settlement;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Author : zx
+ * @Create : 2023/5/11 15:27
+ * Description :
+ */
+@Data
+public class UnifiedSettlementVo implements Serializable {
+    private Long id ;
+    private String programmeName;//方案名称
+    private String programmeNo;//方案编号
+
+    private Integer settlementRule;//结算规则
+    private String settlementRuleDesc;//描述
+
+    private String remark;//备注
+
+    private Integer enabled;//状态
+
+    private String updateTime;
+
+    private String updateUser;
+}

+ 11 - 0
superdesk-uniorder-dubbo-facade/src/main/java/cn/superdesk/uniorder/dubbo/facade/unified/settlement/DubboUnifiedSettlementProgrammeService.java

@@ -2,10 +2,21 @@ package cn.superdesk.uniorder.dubbo.facade.unified.settlement;
 
 import cn.superdesk.uniorder.common.rest.response.R;
 import cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgramme;
+import cn.superdesk.uniorder.dto.param.operationCenter.customer.OperationCenterCustomerParam;
 import cn.superdesk.uniorder.dto.param.operationCenter.customer.settlement.UnifiedSettlementParam;
+import cn.superdesk.uniorder.dto.vo.operationCenter.customer.OperationCenterCustomerVo;
+import cn.superdesk.uniorder.dto.vo.operationCenter.customer.settlement.UnifiedSettlementVo;
+
+import java.util.List;
 
 public interface DubboUnifiedSettlementProgrammeService {
     UnifiedSettlementProgramme findById(Long id);
 
     R<String> saveUnifiedSettlement(UnifiedSettlementParam param, Long sysUserId);
+
+    R<String> updateUnifiedSettlement(UnifiedSettlementParam param, Long sysUserId);
+
+    R<List<UnifiedSettlementVo>> list(OperationCenterCustomerParam param);
+
+    R<UnifiedSettlementParam> get(Long id);
 }

+ 36 - 0
superdesk-uniorder-dubbo-provider/src/main/java/cn/superdesk/uniorder/dubbo/provider/unified/settlement/DubboUnifiedSettlementProgrammeServiceImpl.java

@@ -1,13 +1,22 @@
 package cn.superdesk.uniorder.dubbo.provider.unified.settlement;
 
+import cn.superdesk.uniorder.common.enums.accounting.operator.SettlementRuleEnum;
 import cn.superdesk.uniorder.common.rest.response.R;
 import cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgramme;
+import cn.superdesk.uniorder.dto.param.operationCenter.customer.OperationCenterCustomerParam;
 import cn.superdesk.uniorder.dto.param.operationCenter.customer.settlement.UnifiedSettlementParam;
+import cn.superdesk.uniorder.dto.vo.operationCenter.customer.OperationCenterCustomerVo;
+import cn.superdesk.uniorder.dto.vo.operationCenter.customer.settlement.UnifiedSettlementVo;
 import cn.superdesk.uniorder.dubbo.facade.unified.settlement.DubboUnifiedSettlementProgrammeService;
 import cn.superdesk.uniorder.service.unified.settlement.UnifiedSettlementProgrammeService;
 import com.alibaba.dubbo.config.annotation.Service;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.List;
+import java.util.stream.Collectors;
+
 @Service(version = "1.0.1", retries = -1, timeout = 10000)
 public class DubboUnifiedSettlementProgrammeServiceImpl implements DubboUnifiedSettlementProgrammeService {
     @Autowired
@@ -21,4 +30,31 @@ public class DubboUnifiedSettlementProgrammeServiceImpl implements DubboUnifiedS
     public R<String> saveUnifiedSettlement(UnifiedSettlementParam param, Long sysUserId) {
         return unifiedSettlementProgrammeService.saveUnifiedSettlement(param, sysUserId);
     }
+
+    @Override
+    public R<String> updateUnifiedSettlement(UnifiedSettlementParam param, Long sysUserId) {
+        return unifiedSettlementProgrammeService.updateUnifiedSettlement(param, sysUserId);
+    }
+
+    @Override
+    public R<List<UnifiedSettlementVo>> list(OperationCenterCustomerParam param) {
+        PageHelper.startPage(param.getPageNumber(), param.getPageNumber());
+
+        List<UnifiedSettlementVo> list = unifiedSettlementProgrammeService.list(param);
+
+       list= list.stream().map(vo->{
+            vo.setSettlementRuleDesc(vo.getSettlementRule()!=null ? SettlementRuleEnum.getDescByKey(vo.getSettlementRule()) :"" );
+            return vo;
+        }).collect(Collectors.toList());
+
+        PageInfo page = new PageInfo(list);
+
+        return new R<List<UnifiedSettlementVo>>(page.getPageNum(), page.getPageSize(), (int) page.getTotal(), list);
+    }
+
+    @Override
+    public R<UnifiedSettlementParam> get(Long id) {
+        return unifiedSettlementProgrammeService.get(id);
+    }
+
 }

+ 11 - 0
superdesk-uniorder-service/src/main/java/cn/superdesk/uniorder/service/unified/settlement/UnifiedSettlementProgrammeService.java

@@ -2,9 +2,20 @@ package cn.superdesk.uniorder.service.unified.settlement;
 
 import cn.superdesk.uniorder.common.rest.response.R;
 import cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgramme;
+import cn.superdesk.uniorder.dto.param.operationCenter.customer.OperationCenterCustomerParam;
 import cn.superdesk.uniorder.dto.param.operationCenter.customer.settlement.UnifiedSettlementParam;
+import cn.superdesk.uniorder.dto.vo.operationCenter.customer.OperationCenterCustomerVo;
+import cn.superdesk.uniorder.dto.vo.operationCenter.customer.settlement.UnifiedSettlementVo;
 import cn.superdesk.uniorder.service.base.BaseService;
 
+import java.util.List;
+
 public interface UnifiedSettlementProgrammeService extends BaseService<UnifiedSettlementProgramme> {
     R<String> saveUnifiedSettlement(UnifiedSettlementParam param, Long sysUserId);
+
+    R<String> updateUnifiedSettlement(UnifiedSettlementParam param, Long sysUserId);
+
+    List<UnifiedSettlementVo> list(OperationCenterCustomerParam param);
+
+    R<UnifiedSettlementParam> get(Long id);
 }

+ 209 - 6
superdesk-uniorder-service/src/main/java/cn/superdesk/uniorder/service/unified/settlement/impl/UnifiedSettlementProgrammeServiceImpl.java

@@ -1,24 +1,32 @@
 package cn.superdesk.uniorder.service.unified.settlement.impl;
 
 import cn.hutool.core.date.DateUtil;
+import cn.superdesk.uniorder.common.enums.accounting.operator.SettlementProgrammeTypeEnum;
 import cn.superdesk.uniorder.common.enums.accounting.operator.SettlementRangeWayEnum;
 import cn.superdesk.uniorder.common.enums.accounting.operator.SettlementScopeEnum;
 import cn.superdesk.uniorder.common.enums.accounting.operator.SupnameDisplayRuleEnum;
 import cn.superdesk.uniorder.common.rest.response.R;
 import cn.superdesk.uniorder.common.sequence.GenRandomHelper;
-import cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgramme;
-import cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgrammeRangeRule;
-import cn.superdesk.uniorder.dao.mapper.unified.settlement.UnifiedSettlementProgrammeAmountRuleMapper;
-import cn.superdesk.uniorder.dao.mapper.unified.settlement.UnifiedSettlementProgrammeMapper;
-import cn.superdesk.uniorder.dao.mapper.unified.settlement.UnifiedSettlementProgrammeRangeRuleMapper;
+import cn.superdesk.uniorder.dao.entity.operationCenter.UnifiedCenterCustomer;
+import cn.superdesk.uniorder.dao.entity.unified.settlement.*;
+import cn.superdesk.uniorder.dao.mapper.operationCenter.UnifiedCenterCustomerMapper;
+import cn.superdesk.uniorder.dao.mapper.unified.settlement.*;
+import cn.superdesk.uniorder.dto.param.operationCenter.customer.OperationCenterCustomerParam;
+import cn.superdesk.uniorder.dto.param.operationCenter.customer.settlement.UnifiedSettlementAmountRuleParam;
 import cn.superdesk.uniorder.dto.param.operationCenter.customer.settlement.UnifiedSettlementParam;
 import cn.superdesk.uniorder.dto.param.operationCenter.customer.settlement.UnifiedSettlementRangeRuleParam;
+import cn.superdesk.uniorder.dto.vo.accounting.unified.operator.SettlementExportFieldVo;
+import cn.superdesk.uniorder.dto.vo.operationCenter.base.OperationCenterVo;
+import cn.superdesk.uniorder.dto.vo.operationCenter.customer.OperationCenterCustomerVo;
+import cn.superdesk.uniorder.dto.vo.operationCenter.customer.settlement.UnifiedSettlementVo;
 import cn.superdesk.uniorder.service.unified.settlement.UnifiedSettlementProgrammeService;
 import com.alibaba.fastjson2.JSON;
 import com.github.pagehelper.PageInfo;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.aspectj.weaver.ast.Var;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -34,11 +42,15 @@ import java.util.Map;
 @RequiredArgsConstructor
 public class UnifiedSettlementProgrammeServiceImpl implements UnifiedSettlementProgrammeService {
     private final UnifiedSettlementProgrammeMapper unifiedSettlementProgrammeMapper;
+    private final UnifiedSettlementProgrammeMapperEx unifiedSettlementProgrammeMapperEx;
 
     private final UnifiedSettlementProgrammeAmountRuleMapper unifiedSettlementProgrammeAmountRuleMapper;
 
     private final UnifiedSettlementProgrammeRangeRuleMapper unifiedSettlementProgrammeRangeRuleMapper;
 
+    private final UnifiedCenterCustomerMapper unifiedCenterCustomerMapper;
+
+
     @Override
     public int insertSelective(UnifiedSettlementProgramme unifiedSettlementProgramme) {
         return 0;
@@ -69,6 +81,12 @@ public class UnifiedSettlementProgrammeServiceImpl implements UnifiedSettlementP
         return null;
     }
 
+    @Override
+    public List<UnifiedSettlementVo> list(OperationCenterCustomerParam param) {
+        return unifiedSettlementProgrammeMapperEx.list(param);
+    }
+
+
 
     @Transactional(rollbackFor = Exception.class)
     @Override
@@ -79,7 +97,13 @@ public class UnifiedSettlementProgrammeServiceImpl implements UnifiedSettlementP
         BeanUtils.copyProperties(param, entity);
         entity.setCreateUserId(sysUserId);
         entity.setCreateTime(new Date());
+        entity.setUpdateTime(new Date());
+        entity.setUpdateUserId(sysUserId);
+
         entity.setProgrammeNo("PR"+ DateUtil.format(new Date(), "yyyyMM")+  GenRandomHelper.genRandomNum(6) );
+        SettlementExportFieldVo vo = new SettlementExportFieldVo();
+        BeanUtils.copyProperties(param, vo);
+        entity.setExportField(JSON.toJSONString(vo));
         unifiedSettlementProgrammeMapper.insertSelective(entity);
 
         if (param.getSettlementScope().intValue() == SettlementScopeEnum.部分订单不参与结算.getKey().intValue()
@@ -101,9 +125,21 @@ public class UnifiedSettlementProgrammeServiceImpl implements UnifiedSettlementP
             }
         }
 
+        if (CollectionUtils.isNotEmpty(param.getUnifiedSettlementAmountRuleParamList())) {
 
+            //订单结算金额
+            for (UnifiedSettlementAmountRuleParam amountRuleParam : param.getUnifiedSettlementAmountRuleParamList()) {
+                UnifiedSettlementProgrammeAmountRule rule = new UnifiedSettlementProgrammeAmountRule();
+
+                BeanUtils.copyProperties(amountRuleParam,rule);
+                rule.setCreateUserId(sysUserId);
+                rule.setCreateTime(new Date());
+                rule.setProgrammeId(entity.getId());
+                unifiedSettlementProgrammeAmountRuleMapper.insertSelective(rule);
+            }
 
 
+        }
 
 
         if (param.getSupnameDisplayRule().intValue() == SupnameDisplayRuleEnum.部分按原供应商名称导出.getKey().intValue()
@@ -112,6 +148,58 @@ public class UnifiedSettlementProgrammeServiceImpl implements UnifiedSettlementP
 
             for (UnifiedSettlementRangeRuleParam unifiedSettlementRangeRuleParam : param.getUnifiedSettlementRangeRuleParam1List()) {
                 UnifiedSettlementProgrammeRangeRule rangeRule = new UnifiedSettlementProgrammeRangeRule();
+                rangeRule.setType(2);
+                rangeRule.setProgrammeId(entity.getId());
+                rangeRule.setDisplay(unifiedSettlementRangeRuleParam.getDisplay());
+                rangeRule.setCreateUserId(sysUserId);
+                rangeRule.setCreateTime(new Date());
+                rangeRule.setWay(unifiedSettlementRangeRuleParam.getWay());
+                rangeRule.setNotJoiningRange(unifiedSettlementRangeRuleParam.getNotJoiningRange());
+                rangeRule.setNotJoiningRangeJson(JSON.toJSONString(unifiedSettlementRangeRuleParam.getSysSelectVoList()));
+
+                unifiedSettlementProgrammeRangeRuleMapper.insertSelective(rangeRule);
+            }
+        }
+
+        UnifiedCenterCustomer customer = new UnifiedCenterCustomer();
+        customer.setId(param.getCustomerId());
+        customer.setIsSettlementMethod((byte)1);
+        unifiedCenterCustomerMapper.updateByPrimaryKeySelective(customer);
+
+        //更改客户主体 结算方案已配置
+        return new R<>("新增成功");
+    }
+
+    @Override
+    public R<String> updateUnifiedSettlement(UnifiedSettlementParam param, Long sysUserId) {
+        //校验
+        if (null == param.getId()) {
+            return new R<>("500", "id不能为空", false);
+        }
+
+        UnifiedSettlementProgramme entity = unifiedSettlementProgrammeMapper.selectByPrimaryKey(param.getId());
+        BeanUtils.copyProperties(param, entity);
+
+        entity.setUpdateTime(new Date());
+        entity.setUpdateUserId(sysUserId);
+
+        SettlementExportFieldVo vo = new SettlementExportFieldVo();
+        BeanUtils.copyProperties(param, vo);
+        entity.setExportField(JSON.toJSONString(vo));
+        unifiedSettlementProgrammeMapper.updateByPrimaryKeySelective(entity);
+
+        if (param.getSettlementScope().intValue() == SettlementScopeEnum.部分订单不参与结算.getKey().intValue()
+                && CollectionUtils.isNotEmpty(param.getUnifiedSettlementRangeRuleParam1List())) {
+
+            //先删除
+            UnifiedSettlementProgrammeRangeRuleExample example =new UnifiedSettlementProgrammeRangeRuleExample();
+            example.createCriteria().andProgrammeIdEqualTo(param.getId());
+            unifiedSettlementProgrammeRangeRuleMapper.deleteByExample(example);
+
+
+            //结算范围 部分订单不参与结算
+            for (UnifiedSettlementRangeRuleParam unifiedSettlementRangeRuleParam : param.getUnifiedSettlementRangeRuleParam1List()) {
+                UnifiedSettlementProgrammeRangeRule rangeRule = new UnifiedSettlementProgrammeRangeRule();
                 rangeRule.setType(1);
                 rangeRule.setProgrammeId(entity.getId());
                 rangeRule.setDisplay(unifiedSettlementRangeRuleParam.getDisplay());
@@ -125,7 +213,122 @@ public class UnifiedSettlementProgrammeServiceImpl implements UnifiedSettlementP
             }
         }
 
+        if (CollectionUtils.isNotEmpty(param.getUnifiedSettlementAmountRuleParamList())) {
+
+            //先删除
+            UnifiedSettlementProgrammeAmountRuleExample example = new UnifiedSettlementProgrammeAmountRuleExample();
+            example.createCriteria().andProgrammeIdEqualTo(param.getId());
+            unifiedSettlementProgrammeAmountRuleMapper.deleteByExample(example);
+
+
+            //订单结算金额
+            for (UnifiedSettlementAmountRuleParam amountRuleParam : param.getUnifiedSettlementAmountRuleParamList()) {
+                UnifiedSettlementProgrammeAmountRule rule = new UnifiedSettlementProgrammeAmountRule();
+
+                BeanUtils.copyProperties(amountRuleParam,rule);
+                rule.setCreateUserId(sysUserId);
+                rule.setCreateTime(new Date());
+                rule.setProgrammeId(entity.getId());
+                unifiedSettlementProgrammeAmountRuleMapper.insertSelective(rule);
+            }
+
+
+        }
+
+
+        if (param.getSupnameDisplayRule().intValue() == SupnameDisplayRuleEnum.部分按原供应商名称导出.getKey().intValue()
+                && CollectionUtils.isNotEmpty(param.getUnifiedSettlementRangeRuleParam1List())) {
+            UnifiedSettlementProgrammeRangeRuleExample example =new UnifiedSettlementProgrammeRangeRuleExample();
+            example.createCriteria().andProgrammeIdEqualTo(param.getId());
+            unifiedSettlementProgrammeRangeRuleMapper.deleteByExample(example);
+
+            for (UnifiedSettlementRangeRuleParam unifiedSettlementRangeRuleParam : param.getUnifiedSettlementRangeRuleParam1List()) {
+                UnifiedSettlementProgrammeRangeRule rangeRule = new UnifiedSettlementProgrammeRangeRule();
+                rangeRule.setType(2);
+                rangeRule.setProgrammeId(entity.getId());
+                rangeRule.setDisplay(unifiedSettlementRangeRuleParam.getDisplay());
+                rangeRule.setCreateUserId(sysUserId);
+                rangeRule.setCreateTime(new Date());
+                rangeRule.setWay(unifiedSettlementRangeRuleParam.getWay());
+                rangeRule.setNotJoiningRange(unifiedSettlementRangeRuleParam.getNotJoiningRange());
+                rangeRule.setNotJoiningRangeJson(JSON.toJSONString(unifiedSettlementRangeRuleParam.getSysSelectVoList()));
+
+                unifiedSettlementProgrammeRangeRuleMapper.insertSelective(rangeRule);
+            }
+        }
+
         //更改客户主体 结算方案已配置
-        return null;
+        return new R<>("修改成功");
+    }
+
+    @Override
+    public R<UnifiedSettlementParam> get(Long id) {
+        UnifiedSettlementProgramme programme = unifiedSettlementProgrammeMapper.selectByPrimaryKey(id);
+        UnifiedSettlementParam vo = new UnifiedSettlementParam();
+        BeanUtils.copyProperties(programme, vo);
+
+
+        programme.getExportField();
+        SettlementExportFieldVo settlementExportFieldVo = JSON.parseObject(programme.getExportField(), SettlementExportFieldVo.class);
+        BeanUtils.copyProperties(settlementExportFieldVo, vo);
+
+
+        //主体
+        UnifiedCenterCustomer customer = unifiedCenterCustomerMapper.selectByPrimaryKey(programme.getCustomerId());
+        vo.setCustomerName(customer.getCustomerName());
+        vo.setTypeDesc(SettlementProgrammeTypeEnum.getDescByKey((int)customer.getType()));
+
+        List<UnifiedSettlementRangeRuleParam> unifiedSettlementRangeRuleParam1List = new ArrayList<>();
+
+        List<UnifiedSettlementAmountRuleParam> unifiedSettlementAmountRuleParamList = new ArrayList<>();
+
+        List<UnifiedSettlementRangeRuleParam> unifiedSettlementRangeRuleParam2List = new ArrayList<>();
+
+
+
+        UnifiedSettlementProgrammeRangeRuleExample example1 =new UnifiedSettlementProgrammeRangeRuleExample();
+        example1.createCriteria().andProgrammeIdEqualTo(id).andTypeEqualTo((byte) 1);
+        List<UnifiedSettlementProgrammeRangeRule> rangeRules1 = unifiedSettlementProgrammeRangeRuleMapper.selectByExample(example1);
+
+        for (UnifiedSettlementProgrammeRangeRule voRangeRule : rangeRules1) {
+            UnifiedSettlementRangeRuleParam RangeRuleParam = new UnifiedSettlementRangeRuleParam();
+            BeanUtils.copyProperties(voRangeRule,RangeRuleParam);
+            if (StringUtils.isNotBlank(voRangeRule.getNotJoiningRangeJson())) {
+
+                RangeRuleParam.setSysSelectVoList(JSON.parseArray(voRangeRule.getNotJoiningRangeJson(), OperationCenterVo.class));
+            }
+            unifiedSettlementRangeRuleParam1List.add(RangeRuleParam);
+        }
+
+
+        UnifiedSettlementProgrammeRangeRuleExample example2 =new UnifiedSettlementProgrammeRangeRuleExample();
+        example2.createCriteria().andProgrammeIdEqualTo(id).andTypeEqualTo((byte) 2);
+        List<UnifiedSettlementProgrammeRangeRule> rangeRules2 = unifiedSettlementProgrammeRangeRuleMapper.selectByExample(example2);
+
+        for (UnifiedSettlementProgrammeRangeRule voRangeRule : rangeRules2) {
+            UnifiedSettlementRangeRuleParam RangeRuleParam = new UnifiedSettlementRangeRuleParam();
+            BeanUtils.copyProperties(voRangeRule,RangeRuleParam);
+            if (StringUtils.isNotBlank(voRangeRule.getNotJoiningRangeJson())) {
+                List<OperationCenterVo> operationCenterVos = JSON.parseArray(voRangeRule.getNotJoiningRangeJson(), OperationCenterVo.class);
+                RangeRuleParam.setSysSelectVoList(operationCenterVos);
+            }
+            unifiedSettlementRangeRuleParam2List.add(RangeRuleParam);
+        }
+
+
+        UnifiedSettlementProgrammeAmountRuleExample example = new UnifiedSettlementProgrammeAmountRuleExample();
+        example.createCriteria().andProgrammeIdEqualTo(id);
+        List<UnifiedSettlementProgrammeAmountRule> amountRules = unifiedSettlementProgrammeAmountRuleMapper.selectByExample(example);
+        for (UnifiedSettlementProgrammeAmountRule amountRule : amountRules) {
+            UnifiedSettlementAmountRuleParam param = new UnifiedSettlementAmountRuleParam();
+            BeanUtils.copyProperties(amountRule, param);
+            unifiedSettlementAmountRuleParamList.add(param);
+        }
+        vo.setUnifiedSettlementRangeRuleParam1List(unifiedSettlementRangeRuleParam1List);
+        vo.setUnifiedSettlementAmountRuleParamList(unifiedSettlementAmountRuleParamList);
+        vo.setUnifiedSettlementRangeRuleParam2List(unifiedSettlementRangeRuleParam2List);
+
+        return new R<>(vo);
     }
+
 }

+ 5 - 5
superdesk-uniorder-web/src/main/java/cn/superdesk/uniorder/controller/operationCenter/accounting/UnifiedAccountingController.java

@@ -78,7 +78,7 @@ public class UnifiedAccountingController extends BaseController {
      * 运营商结算-商品维度-导出列表
      */
     @ApiOperation(value = "运营中心-运营商结算-商品维度-导出列表", notes = "")
-    @PostMapping("/importExcel/goodsList")
+    @PostMapping("/exportExcel/goodsList")
     @ResponseBody
     public R<String> importExcelOrderList(@RequestBody @Validated OperationCenterOrderParam param) {
         log.info("运营中心-运营商结算-商品维度-导出列表,param:{}", JSON.toJSONString(param));
@@ -91,7 +91,7 @@ public class UnifiedAccountingController extends BaseController {
      * 运营商结算-商品维度-导出列表含协议成本
      */
     @ApiOperation(value = "运营中心-运营商结算-商品维度-导出列表含协议成本", notes = "")
-    @PostMapping("/importExcel/negotiatingCost")
+    @PostMapping("/exportExcel/negotiatingCost")
     @ResponseBody
     public R<String> importExcelNegotiatingCostList(@RequestBody @Validated OperationCenterOrderParam param) {
         log.info("运营中心-运营商结算-商品维度-导出列表含协议成本,param:{}", JSON.toJSONString(param));
@@ -104,7 +104,7 @@ public class UnifiedAccountingController extends BaseController {
      * 运营商结算-商品维度-导出列表含供应商成本
      */
     @ApiOperation(value = "运营中心-运营商结算-商品维度-导出列表含供应商成本", notes = "")
-    @PostMapping("/importExcel/SupplierCosts")
+    @PostMapping("/exportExcel/SupplierCosts")
     @ResponseBody
     public R<String> importExcelSupplierCostsOrderList(@RequestBody @Validated OperationCenterOrderParam param) {
         log.info("运营中心-运营商结算-商品维度-导出列表含供应商成本,param:{}", JSON.toJSONString(param));
@@ -117,7 +117,7 @@ public class UnifiedAccountingController extends BaseController {
      * 运营商结算-流水维度-导出列表
      */
     @ApiOperation(value = "运营中心-运营商结算-流水维度-导出列表", notes = "")
-    @PostMapping("/importExcel/creditList")
+    @PostMapping("/exportExcel/creditList")
     @ResponseBody
     public R<String> importExcelCreditList(@RequestBody @Validated OperationCenterOrderParam param) {
         log.info("运营中心-运营商结算-流水维度-导出列表,param:{}", JSON.toJSONString(param));
@@ -131,7 +131,7 @@ public class UnifiedAccountingController extends BaseController {
      * 运营商结算-未对账订单-导出列表
      */
     @ApiOperation(value = "运营中心-运营商结算-未对账订单-导出列表", notes = "")
-    @PostMapping("/importExcel/AccountingCredit")
+    @PostMapping("/exportExcel/AccountingCredit")
     @ResponseBody
     public R<String> importExcelNoAccountingCreditList(@RequestBody @Validated OperationCenterOrderParam param) {
         log.info("运营中心-运营商结算-未对账订单-导出列表,param:{}", JSON.toJSONString(param));

+ 27 - 19
superdesk-uniorder-web/src/main/java/cn/superdesk/uniorder/controller/operationCenter/customer/UnifiedSettlementController.java

@@ -3,18 +3,16 @@ package cn.superdesk.uniorder.controller.operationCenter.customer;
 import cn.superdesk.uniorder.common.rest.response.R;
 import cn.superdesk.uniorder.controller.base.BaseController;
 import cn.superdesk.uniorder.dto.param.operationCenter.customer.OperationCenterCustomerParam;
-import cn.superdesk.uniorder.dto.param.operationCenter.customer.OperationCenterCustomerSaveParam;
 import cn.superdesk.uniorder.dto.param.operationCenter.customer.settlement.UnifiedSettlementParam;
-import cn.superdesk.uniorder.dto.vo.operationCenter.customer.OperationCenterCustomerVo;
-import cn.superdesk.uniorder.dubbo.consumer.operationCenter.customer.OperationCenterCustomerDubboService;
+import cn.superdesk.uniorder.dto.vo.operationCenter.customer.settlement.UnifiedSettlementVo;
 import cn.superdesk.uniorder.dubbo.consumer.operationCenter.customer.UnifiedSettlementDubboService;
 import com.alibaba.fastjson2.JSON;
-import io.swagger.annotations.Api;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
 
 
 /**
@@ -31,33 +29,43 @@ public class UnifiedSettlementController extends BaseController {
     /**
      * 列表
      */
-//    @PostMapping("/list")
-//    public R<List<OperationCenterCustomerVo>> list(@RequestBody @Validated OperationCenterCustomerParam param) {
-//        log.info("运营中心--客户管理-列表:入参:param:{}", JSON.toJSONString(param));
-//        return operationCenterCustomerDubboService.getOperationCenterCustomerList(param);
-//    }
+    @PostMapping("/list")
+    public R<List<UnifiedSettlementVo>> list(@RequestBody @Validated OperationCenterCustomerParam param) {
+        log.info("运营中心--客户管理-列表:入参:param:{}", JSON.toJSONString(param));
+        return unifiedSettlementDubboService.list(param);
+    }
 
 
     /**
-     * 新增 修改
+     * 新增
      */
-    @PostMapping("/addOrUpdate")
-    public R<String> addOrUpdate(@Validated @RequestBody UnifiedSettlementParam param) {
+    @PostMapping("/add")
+    public R<String> add(@Validated @RequestBody UnifiedSettlementParam param) {
         log.info("运营中心--客户管理-新增 或修改 :入参:param:{}", JSON.toJSONString(param));
         return unifiedSettlementDubboService.saveUnifiedSettlement(param,getToken());
 
     }
 
+    /**
+     * 修改
+     */
+    @PostMapping("/update")
+    public R<String> update(@Validated @RequestBody UnifiedSettlementParam param) {
+        log.info("运营中心--客户管理-新增 或修改 :入参:param:{}", JSON.toJSONString(param));
+        return unifiedSettlementDubboService.updateUnifiedSettlement(param,getToken());
+
+    }
+
 
     /**
-     * 根据id查询客户信息
+     * 根据id查询信息
      */
-//    @PostMapping("/get/{id}")
-//    public R<OperationCenterCustomerVo> get(@PathVariable("id") Long id) {
-//        log.info("运营中心--客户管理-根据id查询客户信息--->入参:id:{}", id);
-//        return operationCenterCustomerDubboService.getOperationCenterCustomerById(id);
-//
-//    }
+    @PostMapping("/get/{id}")
+    public R<UnifiedSettlementParam> get(@PathVariable("id") Long id) {
+        log.info("运营中心--客户管理-根据id查询客户信息--->入参:id:{}", id);
+        return unifiedSettlementDubboService.get(id);
+
+    }
 
     /**
      * 删除

+ 19 - 1
superdesk-uniorder-web/src/main/java/cn/superdesk/uniorder/dubbo/consumer/operationCenter/customer/UnifiedSettlementDubboService.java

@@ -3,12 +3,17 @@ package cn.superdesk.uniorder.dubbo.consumer.operationCenter.customer;
 import cn.superdesk.uniorder.common.rest.response.R;
 import cn.superdesk.uniorder.common.security.JwtUtil;
 import cn.superdesk.uniorder.common.security.dto.LoginSysUser;
+import cn.superdesk.uniorder.dto.param.operationCenter.customer.OperationCenterCustomerParam;
 import cn.superdesk.uniorder.dto.param.operationCenter.customer.settlement.UnifiedSettlementParam;
+import cn.superdesk.uniorder.dto.vo.operationCenter.customer.OperationCenterCustomerVo;
+import cn.superdesk.uniorder.dto.vo.operationCenter.customer.settlement.UnifiedSettlementVo;
 import cn.superdesk.uniorder.dubbo.facade.unified.settlement.DubboUnifiedSettlementProgrammeService;
 import com.alibaba.dubbo.config.annotation.Reference;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 
+import java.util.List;
+
 /**
  * @Author : zx
  * @Create : 2023/5/10 16:29
@@ -17,7 +22,7 @@ import org.springframework.stereotype.Component;
 @Slf4j
 @Component
 public class UnifiedSettlementDubboService {
-    @Reference(version = "1.0.0", timeout = 30000, retries = -1)
+    @Reference(version = "1.0.1", timeout = 30000, retries = -1)
     private DubboUnifiedSettlementProgrammeService dubboUnifiedSettlementProgrammeService;
 
 
@@ -25,4 +30,17 @@ public class UnifiedSettlementDubboService {
         LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);
         return dubboUnifiedSettlementProgrammeService.saveUnifiedSettlement(param, loginSysUser.getSysUserId());
     }
+
+    public R<String> updateUnifiedSettlement(UnifiedSettlementParam param, String token) {
+        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);
+        return dubboUnifiedSettlementProgrammeService.updateUnifiedSettlement(param, loginSysUser.getSysUserId());
+    }
+
+    public R<List<UnifiedSettlementVo>> list(OperationCenterCustomerParam param) {
+        return dubboUnifiedSettlementProgrammeService.list(param);
+    }
+
+    public R<UnifiedSettlementParam> get(Long id) {
+        return dubboUnifiedSettlementProgrammeService.get(id);
+    }
 }