Explorar o código

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

zhouxin hai 1 ano
pai
achega
2bd3558218

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

@@ -19,4 +19,10 @@ public interface DubboUnifiedSettlementProgrammeService {
     R<List<UnifiedSettlementVo>> list(OperationCenterCustomerParam param);
 
     R<UnifiedSettlementParam> get(Long id);
+
+    R<String> delete(Long id);
+
+    R<String> enabled(Long id);
+
+    R<String> setDefault(Long id);
 }

+ 28 - 1
superdesk-uniorder-dubbo-provider/src/main/java/cn/superdesk/uniorder/dubbo/provider/unified/settlement/DubboUnifiedSettlementProgrammeServiceImpl.java

@@ -38,7 +38,7 @@ public class DubboUnifiedSettlementProgrammeServiceImpl implements DubboUnifiedS
 
     @Override
     public R<List<UnifiedSettlementVo>> list(OperationCenterCustomerParam param) {
-        PageHelper.startPage(param.getPageNumber(), param.getPageNumber());
+        PageHelper.startPage(param.getPageNumber(), param.getPageSize());
 
         List<UnifiedSettlementVo> list = unifiedSettlementProgrammeService.list(param);
 
@@ -57,4 +57,31 @@ public class DubboUnifiedSettlementProgrammeServiceImpl implements DubboUnifiedS
         return unifiedSettlementProgrammeService.get(id);
     }
 
+    @Override
+    public R<String> delete(Long id) {
+        unifiedSettlementProgrammeService.deleteObj(id);
+        return new R<>("删除成功!");
+    }
+
+    @Override
+    public R<String> enabled(Long id) {
+
+        UnifiedSettlementProgramme entity = unifiedSettlementProgrammeService.findById(id);
+        if (null == entity) {
+            return new R<>("500", "不存在该结算方案", false);
+        }
+        Integer enabled = entity.getEnabled();
+        entity = new UnifiedSettlementProgramme();
+        entity.setId(id);
+        entity.setEnabled(enabled == 0 ? 1 : 0);
+        unifiedSettlementProgrammeService.updateByPrimaryKeySelective(entity);
+        String massage = entity.getEnabled() == 1 ? "启用成功!" : "停用成功!";
+        return new R<>(massage);
+    }
+
+    @Override
+    public R<String> setDefault(Long id) {
+        return unifiedSettlementProgrammeService.setDefault(id);
+    }
+
 }

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

@@ -18,4 +18,6 @@ public interface UnifiedSettlementProgrammeService extends BaseService<UnifiedSe
     List<UnifiedSettlementVo> list(OperationCenterCustomerParam param);
 
     R<UnifiedSettlementParam> get(Long id);
+
+    R<String> setDefault(Long id);
 }

+ 26 - 4
superdesk-uniorder-service/src/main/java/cn/superdesk/uniorder/service/unified/settlement/impl/UnifiedSettlementProgrammeServiceImpl.java

@@ -58,12 +58,15 @@ public class UnifiedSettlementProgrammeServiceImpl implements UnifiedSettlementP
 
     @Override
     public int updateByPrimaryKeySelective(UnifiedSettlementProgramme unifiedSettlementProgramme) {
-        return 0;
+        return unifiedSettlementProgrammeMapper.updateByPrimaryKeySelective(unifiedSettlementProgramme);
     }
 
     @Override
     public void deleteObj(Long id) {
-
+        UnifiedSettlementProgramme entity = new UnifiedSettlementProgramme();
+        entity.setId(id);
+        entity.setDeleted(1);
+        unifiedSettlementProgrammeMapper.updateByPrimaryKeySelective(entity);
     }
 
     @Override
@@ -288,7 +291,7 @@ public class UnifiedSettlementProgrammeServiceImpl implements UnifiedSettlementP
 
         UnifiedSettlementProgrammeRangeRuleExample example1 =new UnifiedSettlementProgrammeRangeRuleExample();
         example1.createCriteria().andProgrammeIdEqualTo(id).andTypeEqualTo((byte) 1);
-        List<UnifiedSettlementProgrammeRangeRule> rangeRules1 = unifiedSettlementProgrammeRangeRuleMapper.selectByExample(example1);
+        List<UnifiedSettlementProgrammeRangeRule> rangeRules1 = unifiedSettlementProgrammeRangeRuleMapper.selectByExampleWithBLOBs(example1);
 
         for (UnifiedSettlementProgrammeRangeRule voRangeRule : rangeRules1) {
             UnifiedSettlementRangeRuleParam RangeRuleParam = new UnifiedSettlementRangeRuleParam();
@@ -303,7 +306,7 @@ public class UnifiedSettlementProgrammeServiceImpl implements UnifiedSettlementP
 
         UnifiedSettlementProgrammeRangeRuleExample example2 =new UnifiedSettlementProgrammeRangeRuleExample();
         example2.createCriteria().andProgrammeIdEqualTo(id).andTypeEqualTo((byte) 2);
-        List<UnifiedSettlementProgrammeRangeRule> rangeRules2 = unifiedSettlementProgrammeRangeRuleMapper.selectByExample(example2);
+        List<UnifiedSettlementProgrammeRangeRule> rangeRules2 = unifiedSettlementProgrammeRangeRuleMapper.selectByExampleWithBLOBs(example2);
 
         for (UnifiedSettlementProgrammeRangeRule voRangeRule : rangeRules2) {
             UnifiedSettlementRangeRuleParam RangeRuleParam = new UnifiedSettlementRangeRuleParam();
@@ -331,4 +334,23 @@ public class UnifiedSettlementProgrammeServiceImpl implements UnifiedSettlementP
         return new R<>(vo);
     }
 
+    @Override
+    public R<String> setDefault(Long id) {
+        UnifiedSettlementProgrammeExample example = new UnifiedSettlementProgrammeExample();
+        example.createCriteria().andDeletedEqualTo((byte) 0)
+                .andIdEqualTo(id);
+        List<UnifiedSettlementProgramme> unifiedSettlementProgrammes = unifiedSettlementProgrammeMapper.selectByExample(example);
+        if (CollectionUtils.isEmpty(unifiedSettlementProgrammes)) {
+            return new R<>("500", "该结算方案不存在或已删除,请检查", false);
+        }
+        Integer isDefault = unifiedSettlementProgrammes.get(0).getIsDefault();
+
+        UnifiedSettlementProgramme entity = new UnifiedSettlementProgramme();
+        entity.setId(id);
+        entity.setIsDefault(isDefault == 1 ? 0 : 1);
+        unifiedSettlementProgrammeMapper.updateByPrimaryKeySelective(entity);
+        String message = entity.getIsDefault() == 1 ? "设为默认成功!" : "取消默认成功!";
+        return new R<>(message);
+    }
+
 }

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

@@ -31,7 +31,7 @@ public class UnifiedSettlementController extends BaseController {
      */
     @PostMapping("/list")
     public R<List<UnifiedSettlementVo>> list(@RequestBody @Validated OperationCenterCustomerParam param) {
-        log.info("运营中心--客户管理-列表:入参:param:{}", JSON.toJSONString(param));
+        log.info("运营中心--客户管理-结算方案-列表:入参:param:{}", JSON.toJSONString(param));
         return unifiedSettlementDubboService.list(param);
     }
 
@@ -41,7 +41,7 @@ public class UnifiedSettlementController extends BaseController {
      */
     @PostMapping("/add")
     public R<String> add(@Validated @RequestBody UnifiedSettlementParam param) {
-        log.info("运营中心--客户管理-新增 或修改 :入参:param:{}", JSON.toJSONString(param));
+        log.info("运营中心--客户管理-结算方案-新增 或修改 :入参:param:{}", JSON.toJSONString(param));
         return unifiedSettlementDubboService.saveUnifiedSettlement(param,getToken());
 
     }
@@ -51,7 +51,7 @@ public class UnifiedSettlementController extends BaseController {
      */
     @PostMapping("/update")
     public R<String> update(@Validated @RequestBody UnifiedSettlementParam param) {
-        log.info("运营中心--客户管理-新增 或修改 :入参:param:{}", JSON.toJSONString(param));
+        log.info("运营中心--客户管理-结算方案-新增 或修改 :入参:param:{}", JSON.toJSONString(param));
         return unifiedSettlementDubboService.updateUnifiedSettlement(param,getToken());
 
     }
@@ -62,7 +62,7 @@ public class UnifiedSettlementController extends BaseController {
      */
     @PostMapping("/get/{id}")
     public R<UnifiedSettlementParam> get(@PathVariable("id") Long id) {
-        log.info("运营中心--客户管理-根据id查询客户信息--->入参:id:{}", id);
+        log.info("运营中心--客户管理-结算方案-根据id查询客户信息--->入参:id:{}", id);
         return unifiedSettlementDubboService.get(id);
 
     }
@@ -70,13 +70,30 @@ public class UnifiedSettlementController extends BaseController {
     /**
      * 删除
      */
-//    @PostMapping("/delete/{id}")
-//    public R<String> delete(@PathVariable("id") Long id) {
-//        log.info("运营中心--客户管理-根据id软删除客户信息--->入参:id:{}", id);
-//        return operationCenterCustomerDubboService.deleteOperationCenterCustomerById(id);
-//
-//    }
+    @PostMapping("/delete/{id}")
+    public R<String> delete(@PathVariable("id") Long id) {
+        log.info("运营中心--客户管理-结算方案-根据id软删除客户信息--->入参:id:{}", id);
+        return unifiedSettlementDubboService.delete(id);
 
+    }
+    /**
+     * 启用/禁用
+     */
+    @PostMapping("/enabled/{id}")
+    public R<String> enabled(@PathVariable("id") Long id) {
+        log.info("运营中心--客户管理-结算方案-根据id启用/禁用--->入参:id:{}", id);
+        return unifiedSettlementDubboService.enabled(id);
+
+    }
 
+    /**
+     * 设为默认/取消默认
+     */
+    @PostMapping("/default/{id}")
+    public R<String> setDefault(@PathVariable("id") Long id) {
+        log.info("运营中心--客户管理-结算方案-根据id 设为默认/取消默认--->入参:id:{}", id);
+        return unifiedSettlementDubboService.setDefault(id);
+
+    }
 
 }

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

@@ -43,4 +43,16 @@ public class UnifiedSettlementDubboService {
     public R<UnifiedSettlementParam> get(Long id) {
         return dubboUnifiedSettlementProgrammeService.get(id);
     }
+
+    public R<String> delete(Long id) {
+        return dubboUnifiedSettlementProgrammeService.delete(id);
+    }
+
+    public R<String> enabled(Long id) {
+        return dubboUnifiedSettlementProgrammeService.enabled(id);
+    }
+
+    public R<String> setDefault(Long id) {
+        return dubboUnifiedSettlementProgrammeService.setDefault(id);
+    }
 }