Sfoglia il codice sorgente

优化-运营商结算 结算方案

zhouxin 1 anno fa
parent
commit
7ed5ec8731
10 ha cambiato i file con 127 aggiunte e 10 eliminazioni
  1. 1 1
      superdesk-uniorder-dao/src/main/resources/mappers/unified/settlement/UnifiedSettlementProgrammeMapper.xml
  2. 4 0
      superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/param/operationCenter/customer/settlement/UnifiedSettlementAmountRuleParam.java
  3. 2 2
      superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/param/operationCenter/customer/settlement/UnifiedSettlementParam.java
  4. 5 3
      superdesk-uniorder-dto/src/main/java/cn/superdesk/uniorder/dto/param/operationCenter/customer/settlement/UnifiedSettlementRangeRuleParam.java
  5. 4 0
      superdesk-uniorder-dubbo-facade/src/main/java/cn/superdesk/uniorder/dubbo/facade/unified/settlement/DubboUnifiedSettlementProgrammeService.java
  6. 7 0
      superdesk-uniorder-dubbo-provider/src/main/java/cn/superdesk/uniorder/dubbo/provider/unified/settlement/DubboUnifiedSettlementProgrammeServiceImpl.java
  7. 3 0
      superdesk-uniorder-service/src/main/java/cn/superdesk/uniorder/service/unified/settlement/UnifiedSettlementProgrammeService.java
  8. 81 0
      superdesk-uniorder-service/src/main/java/cn/superdesk/uniorder/service/unified/settlement/impl/UnifiedSettlementProgrammeServiceImpl.java
  9. 6 4
      superdesk-uniorder-web/src/main/java/cn/superdesk/uniorder/controller/operationCenter/customer/UnifiedSettlementController.java
  10. 14 0
      superdesk-uniorder-web/src/main/java/cn/superdesk/uniorder/dubbo/consumer/operationCenter/customer/UnifiedSettlementDubboService.java

+ 1 - 1
superdesk-uniorder-dao/src/main/resources/mappers/unified/settlement/UnifiedSettlementProgrammeMapper.xml

@@ -154,7 +154,7 @@
       #{updateUserId,jdbcType=BIGINT}, #{deleted,jdbcType=TINYINT}, #{enabled,jdbcType=TINYINT}, 
       #{exportField,jdbcType=LONGVARCHAR})
   </insert>
-  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgramme">
+  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.unified.settlement.UnifiedSettlementProgramme" useGeneratedKeys="true" keyProperty="id">
     insert into unified_settlement_programme
     <trim prefix="(" suffix=")" suffixOverrides=",">
       <if test="id != null">

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

@@ -13,6 +13,10 @@ 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 operatorIds;//运营商id-多个
     private String orgIds;//项目id-多个
     private String bizPlatformCodes;//订单类型-多个 OpCenterBizPlatformEnum

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

@@ -46,6 +46,6 @@ public class UnifiedSettlementParam extends SettlementExportFieldVo implements S
 
     //备注
     private String remark;
-
-
+    //状态
+    private Integer enabled;
 }

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

@@ -1,8 +1,10 @@
 package cn.superdesk.uniorder.dto.param.operationCenter.customer.settlement;
 
+import cn.superdesk.uniorder.dto.vo.sys.SysSelectVo;
 import lombok.Data;
 
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * @Author : zx
@@ -16,9 +18,9 @@ public class UnifiedSettlementRangeRuleParam implements Serializable {
     private Integer display;//排序 序号
     private Integer way;//方式 SettlementRangeWayEnum
     //指定供应商,指定订单类型,指定支付方式
-    private String supplierIds;//多个运营商
-    private String BizPlatFormCodes;//多个订单类型
-    private String paymentIds;//多个支付方式
+    private String notJoiningRange;//不参与结算范围
+
+    List<SysSelectVo> sysSelectVoList;
 
 
 }

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

@@ -1,7 +1,11 @@
 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.settlement.UnifiedSettlementParam;
 
 public interface DubboUnifiedSettlementProgrammeService {
     UnifiedSettlementProgramme findById(Long id);
+
+    R<String> saveUnifiedSettlement(UnifiedSettlementParam param, Long sysUserId);
 }

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

@@ -1,6 +1,8 @@
 package cn.superdesk.uniorder.dubbo.provider.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.settlement.UnifiedSettlementParam;
 import cn.superdesk.uniorder.dubbo.facade.unified.settlement.DubboUnifiedSettlementProgrammeService;
 import cn.superdesk.uniorder.service.unified.settlement.UnifiedSettlementProgrammeService;
 import com.alibaba.dubbo.config.annotation.Service;
@@ -14,4 +16,9 @@ public class DubboUnifiedSettlementProgrammeServiceImpl implements DubboUnifiedS
     public UnifiedSettlementProgramme findById(Long id) {
         return unifiedSettlementProgrammeService.findById(id);
     }
+
+    @Override
+    public R<String> saveUnifiedSettlement(UnifiedSettlementParam param, Long sysUserId) {
+        return unifiedSettlementProgrammeService.saveUnifiedSettlement(param, sysUserId);
+    }
 }

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

@@ -1,7 +1,10 @@
 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.settlement.UnifiedSettlementParam;
 import cn.superdesk.uniorder.service.base.BaseService;
 
 public interface UnifiedSettlementProgrammeService extends BaseService<UnifiedSettlementProgramme> {
+    R<String> saveUnifiedSettlement(UnifiedSettlementParam param, Long sysUserId);
 }

+ 81 - 0
superdesk-uniorder-service/src/main/java/cn/superdesk/uniorder/service/unified/settlement/impl/UnifiedSettlementProgrammeServiceImpl.java

@@ -1,14 +1,31 @@
 package cn.superdesk.uniorder.service.unified.settlement.impl;
 
+import cn.hutool.core.date.DateUtil;
+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.dto.param.operationCenter.customer.settlement.UnifiedSettlementParam;
+import cn.superdesk.uniorder.dto.param.operationCenter.customer.settlement.UnifiedSettlementRangeRuleParam;
 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.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -18,6 +35,10 @@ import java.util.Map;
 public class UnifiedSettlementProgrammeServiceImpl implements UnifiedSettlementProgrammeService {
     private final UnifiedSettlementProgrammeMapper unifiedSettlementProgrammeMapper;
 
+    private final UnifiedSettlementProgrammeAmountRuleMapper unifiedSettlementProgrammeAmountRuleMapper;
+
+    private final UnifiedSettlementProgrammeRangeRuleMapper unifiedSettlementProgrammeRangeRuleMapper;
+
     @Override
     public int insertSelective(UnifiedSettlementProgramme unifiedSettlementProgramme) {
         return 0;
@@ -47,4 +68,64 @@ public class UnifiedSettlementProgrammeServiceImpl implements UnifiedSettlementP
     public PageInfo<UnifiedSettlementProgramme> findByPaging(Map<String, Object> params, Integer pageNo, Integer pageSize) {
         return null;
     }
+
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public R<String> saveUnifiedSettlement(UnifiedSettlementParam param, Long sysUserId) {
+        //校验
+
+        UnifiedSettlementProgramme entity = new UnifiedSettlementProgramme();
+        BeanUtils.copyProperties(param, entity);
+        entity.setCreateUserId(sysUserId);
+        entity.setCreateTime(new Date());
+        entity.setProgrammeNo("PR"+ DateUtil.format(new Date(), "yyyyMM")+  GenRandomHelper.genRandomNum(6) );
+        unifiedSettlementProgrammeMapper.insertSelective(entity);
+
+        if (param.getSettlementScope().intValue() == SettlementScopeEnum.部分订单不参与结算.getKey().intValue()
+            && CollectionUtils.isNotEmpty(param.getUnifiedSettlementRangeRuleParam1List())) {
+
+            //结算范围 部分订单不参与结算
+            for (UnifiedSettlementRangeRuleParam unifiedSettlementRangeRuleParam : param.getUnifiedSettlementRangeRuleParam1List()) {
+                UnifiedSettlementProgrammeRangeRule rangeRule = new UnifiedSettlementProgrammeRangeRule();
+                rangeRule.setType(1);
+                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);
+            }
+        }
+
+
+
+
+
+
+        if (param.getSupnameDisplayRule().intValue() == SupnameDisplayRuleEnum.部分按原供应商名称导出.getKey().intValue()
+                && CollectionUtils.isNotEmpty(param.getUnifiedSettlementRangeRuleParam1List())) {
+
+
+            for (UnifiedSettlementRangeRuleParam unifiedSettlementRangeRuleParam : param.getUnifiedSettlementRangeRuleParam1List()) {
+                UnifiedSettlementProgrammeRangeRule rangeRule = new UnifiedSettlementProgrammeRangeRule();
+                rangeRule.setType(1);
+                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;
+    }
 }

+ 6 - 4
superdesk-uniorder-web/src/main/java/cn/superdesk/uniorder/controller/operationCenter/customer/UnifiedSettlementController.java

@@ -1,8 +1,10 @@
 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.dubbo.consumer.operationCenter.customer.UnifiedSettlementDubboService;
@@ -24,7 +26,7 @@ import org.springframework.web.bind.annotation.*;
 @RestController
 @RequestMapping("/accounting/unified/settlement")
 @RequiredArgsConstructor
-public class UnifiedSettlementController {
+public class UnifiedSettlementController extends BaseController {
     private final UnifiedSettlementDubboService unifiedSettlementDubboService;
     /**
      * 列表
@@ -40,10 +42,10 @@ public class UnifiedSettlementController {
      * 新增 修改
      */
     @PostMapping("/addOrUpdate")
-    public R<String> addOrUpdate(@Validated @RequestBody OperationCenterCustomerSaveParam param) {
+    public R<String> addOrUpdate(@Validated @RequestBody UnifiedSettlementParam param) {
         log.info("运营中心--客户管理-新增 或修改 :入参:param:{}", JSON.toJSONString(param));
-       // return operationCenterCustomerDubboService.saveOperationCenterCustomer(param,getToken());
-        return null;
+        return unifiedSettlementDubboService.saveUnifiedSettlement(param,getToken());
+
     }
 
 

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

@@ -1,5 +1,11 @@
 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.settlement.UnifiedSettlementParam;
+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;
 
@@ -11,4 +17,12 @@ import org.springframework.stereotype.Component;
 @Slf4j
 @Component
 public class UnifiedSettlementDubboService {
+    @Reference(version = "1.0.0", timeout = 30000, retries = -1)
+    private DubboUnifiedSettlementProgrammeService dubboUnifiedSettlementProgrammeService;
+
+
+    public R<String> saveUnifiedSettlement(UnifiedSettlementParam param, String token) {
+        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);
+        return dubboUnifiedSettlementProgrammeService.saveUnifiedSettlement(param, loginSysUser.getSysUserId());
+    }
 }