Pārlūkot izejas kodu

任务提交 级联删除

杜魏 4 gadi atpakaļ
vecāks
revīzija
afa334b0a9
21 mainītis faili ar 186 papildinājumiem un 92 dzēšanām
  1. 24 0
      modules/admin/src/main/java/com/fire/admin/request/ChannelSetInvalidParam.java
  2. 24 0
      modules/admin/src/main/java/com/fire/admin/request/SupplierSetInvalidParam.java
  3. 2 6
      modules/admin/src/main/java/com/fire/admin/rest/BankCardRest.java
  4. 3 7
      modules/admin/src/main/java/com/fire/admin/rest/ChannelGroupRest.java
  5. 9 12
      modules/admin/src/main/java/com/fire/admin/rest/ChannelInfoRest.java
  6. 2 6
      modules/admin/src/main/java/com/fire/admin/rest/ChannelProductInfoRest.java
  7. 8 10
      modules/admin/src/main/java/com/fire/admin/rest/ChannelSupplierRest.java
  8. 2 6
      modules/admin/src/main/java/com/fire/admin/rest/DistributeGroupRest.java
  9. 3 6
      modules/admin/src/main/java/com/fire/admin/rest/SupplierAdditionalPaymentController.java
  10. 0 1
      modules/admin/src/main/java/com/fire/admin/service/AdditionalPaymentService.java
  11. 1 1
      modules/admin/src/main/java/com/fire/admin/service/ChannelGroupService.java
  12. 4 2
      modules/admin/src/main/java/com/fire/admin/service/ChannelInfoService.java
  13. 2 3
      modules/admin/src/main/java/com/fire/admin/service/ChannelProductService.java
  14. 4 0
      modules/admin/src/main/java/com/fire/admin/service/DistributeGroupService.java
  15. 2 2
      modules/admin/src/main/java/com/fire/admin/service/SupplierService.java
  16. 5 6
      modules/admin/src/main/java/com/fire/admin/service/impl/AdditionalPaymentServiceImpl.java
  17. 7 3
      modules/admin/src/main/java/com/fire/admin/service/impl/ChannelGroupServiceImpl.java
  18. 29 6
      modules/admin/src/main/java/com/fire/admin/service/impl/ChannelInfoServiceImpl.java
  19. 12 8
      modules/admin/src/main/java/com/fire/admin/service/impl/ChannelProductServiceImpl.java
  20. 27 0
      modules/admin/src/main/java/com/fire/admin/service/impl/DistributeGroupServiceImpl.java
  21. 16 7
      modules/admin/src/main/java/com/fire/admin/service/impl/SupplierServiceImpl.java

+ 24 - 0
modules/admin/src/main/java/com/fire/admin/request/ChannelSetInvalidParam.java

@@ -0,0 +1,24 @@
+package com.fire.admin.request;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author: admin
+ * @Description:
+ * @date: 2021-06-15 11:53
+ * @Modified By:
+ */
+@ApiModel("通道置无效/有效请求参数")
+@Getter
+@Setter
+public class ChannelSetInvalidParam {
+
+    @ApiModelProperty("通道id")
+    private Long channelId;
+
+    @ApiModelProperty("是否有效 0-无效 1-有效")
+    private Integer isValid;
+}

+ 24 - 0
modules/admin/src/main/java/com/fire/admin/request/SupplierSetInvalidParam.java

@@ -0,0 +1,24 @@
+package com.fire.admin.request;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * @author: admin
+ * @Description:
+ * @date: 2021-06-15 11:46
+ * @Modified By:
+ */
+@ApiModel("供应商置无效/有效请求参数")
+@Getter
+@Setter
+public class SupplierSetInvalidParam {
+
+    @ApiModelProperty("供应商id")
+    private Long supplierId;
+
+    @ApiModelProperty("是否有效 0-无效 1-有效")
+    private Integer isValid;
+}

+ 2 - 6
modules/admin/src/main/java/com/fire/admin/rest/BankCardRest.java

@@ -14,9 +14,9 @@ import com.fire.dto.response.BaseRestResponse;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import java.util.List;
 
 @Api(tags = "银行卡相关接口")
@@ -25,13 +25,9 @@ import java.util.List;
 @Slf4j
 public class BankCardRest {
 
+    @Resource
     private BankCardService bankCardService;
 
-    @Autowired
-    public BankCardRest(BankCardService bankCardService) {
-        this.bankCardService = bankCardService;
-    }
-
     /**
     * @Description:  TODO 获取银行卡列表
     * @Param: [relationId, distinguish]

+ 3 - 7
modules/admin/src/main/java/com/fire/admin/rest/ChannelGroupRest.java

@@ -9,9 +9,9 @@ import com.fire.dto.response.BaseRestResponse;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import java.util.List;
 
 /**
@@ -25,13 +25,9 @@ import java.util.List;
 @RequestMapping("channelGroup")
 public class ChannelGroupRest {
 
+    @Resource
     private ChannelGroupService channelGroupService;
 
-    @Autowired
-    public ChannelGroupRest(ChannelGroupService channelGroupService) {
-        this.channelGroupService = channelGroupService;
-    }
-
     @PostMapping("list")
     @ApiOperation(value = "通道组列表", notes = "channelgroup_list.py")
     public BaseRestResponse channelGroupList(@RequestBody ChannelGroupPageParam pageParam) {
@@ -71,7 +67,7 @@ public class ChannelGroupRest {
     @DeleteMapping("/delete/{channelGroupId}")
     @ApiOperation(value = "删除通道组", notes = "delete_channel_group.py")
     public BaseResponse removeChannelGroup(@PathVariable("channelGroupId") Long channelGroupId) {
-        channelGroupService.deleteChannelGroupById(channelGroupId);
+        channelGroupService.delChanGrouAndDistGrouByChanGrouId(channelGroupId);
         return new BaseResponse();
     }
 }

+ 9 - 12
modules/admin/src/main/java/com/fire/admin/rest/ChannelInfoRest.java

@@ -2,6 +2,7 @@ package com.fire.admin.rest;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.fire.admin.request.ChannelPageParam;
+import com.fire.admin.request.ChannelSetInvalidParam;
 import com.fire.admin.service.ChannelInfoService;
 import com.fire.dto.ChannelInfo;
 import com.fire.dto.ChannelSupplier;
@@ -12,9 +13,9 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import java.util.List;
 
 /**
@@ -29,13 +30,9 @@ import java.util.List;
 @Slf4j
 public class ChannelInfoRest {
 
+    @Resource
     private ChannelInfoService channelInfoService;
 
-    @Autowired
-    public ChannelInfoRest(ChannelInfoService channelInfoService) {
-        this.channelInfoService = channelInfoService;
-    }
-
     @PostMapping("/list")
     @ApiOperation(value = "通道列表", notes = "channel_list.py")
     public BaseRestResponse channelInfoList(@RequestBody ChannelPageParam channelPageParam) {
@@ -60,8 +57,8 @@ public class ChannelInfoRest {
 
     @GetMapping("/supplierInfo")
     @ApiModelProperty(value = "获取供应商信息", notes = "get_supplier_info.py")
-    public BaseRestResponse getSupplierInfo() {
-        List<ChannelSupplier> supplierList = channelInfoService.getSupplierInfo();
+    public BaseRestResponse getSupplierInfo(String supplierName) {
+        List<ChannelSupplier> supplierList = channelInfoService.getSupplierInfo(supplierName);
         if (supplierList != null) {
             return new BaseRestResponse(supplierList);
         } else {
@@ -87,7 +84,7 @@ public class ChannelInfoRest {
     @ApiOperation(value = "通道逻辑删除", notes = "delete_channelInfo.py")
     public BaseResponse deleteChannelById(@PathVariable("channelId") Long channelId) {
         try {
-            channelInfoService.deleteChannelById(channelId);
+            channelInfoService.deleteChannelAndProductByChannelId(channelId);
         } catch (Exception e) {
             e.printStackTrace();
             log.error("参数异常!");
@@ -96,9 +93,9 @@ public class ChannelInfoRest {
     }
 
     @PutMapping("/setIsValid")
-    @ApiOperation(value = "置无效/有效", notes = "set_isvalid.py")
-    public BaseResponse setInvalid(Long channelId, Integer isValid) {
-        channelInfoService.setInvalid(channelId, isValid);
+    @ApiOperation(value = "通道置无效/有效", notes = "set_isvalid.py")
+    public BaseResponse setInvalid(@RequestBody ChannelSetInvalidParam channelSetInvalidParam) {
+        channelInfoService.setInvalid(channelSetInvalidParam.getChannelId(), channelSetInvalidParam.getIsValid());
         return new BaseResponse();
     }
 }

+ 2 - 6
modules/admin/src/main/java/com/fire/admin/rest/ChannelProductInfoRest.java

@@ -6,9 +6,9 @@ import com.fire.dto.response.BaseResponse;
 import com.fire.dto.response.BaseRestResponse;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiModelProperty;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import java.util.List;
 
 /**
@@ -22,13 +22,9 @@ import java.util.List;
 @RequestMapping("/channelProduct")
 public class ChannelProductInfoRest {
 
+    @Resource
     private ChannelProductService channelProductService;
 
-    @Autowired
-    public ChannelProductInfoRest(ChannelProductService channelProductService) {
-        this.channelProductService = channelProductService;
-    }
-
     @PostMapping("/list")
     @ApiModelProperty(value = "通道产品列表", notes = "channelProduct_list.py")
     public BaseRestResponse channelProductList(Long channelId) {

+ 8 - 10
modules/admin/src/main/java/com/fire/admin/rest/ChannelSupplierRest.java

@@ -2,6 +2,7 @@ package com.fire.admin.rest;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.fire.admin.request.SupplierPageParam;
+import com.fire.admin.request.SupplierSetInvalidParam;
 import com.fire.admin.service.SupplierService;
 import com.fire.dto.ChannelSupplier;
 import com.fire.dto.response.BaseResponse;
@@ -9,9 +10,10 @@ import com.fire.dto.response.BaseRestResponse;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
+
 /**
  * @author: admin
  * @Description:
@@ -24,13 +26,9 @@ import org.springframework.web.bind.annotation.*;
 @Slf4j
 public class ChannelSupplierRest {
 
+    @Resource
     private SupplierService supplierService;
 
-    @Autowired
-    public ChannelSupplierRest(SupplierService supplierService) {
-        this.supplierService = supplierService;
-    }
-
     @PostMapping("/list")
     @ApiOperation(value = "供应商列表", notes = "supplier_list.py")
     public BaseRestResponse supplierList(@RequestBody SupplierPageParam supplierPageParam) {
@@ -60,7 +58,7 @@ public class ChannelSupplierRest {
     @ApiOperation(value = "删除供应商", notes = "supplier_delete.py")
     public BaseResponse deleteSupplierBySupplierId(@PathVariable("supplierId") Long supplierId) {
         try {
-            supplierService.deleteSupplierById(supplierId);
+            supplierService.deleteSupplierAndChannelBySupplierId(supplierId);
         } catch (Exception e) {
             e.printStackTrace();
             log.error("参数异常!");
@@ -69,9 +67,9 @@ public class ChannelSupplierRest {
     }
 
     @PutMapping("/setIsValid")
-    @ApiOperation(value = "置无效/有效", notes = "set_invalid.py")
-    public BaseResponse setInvalid(Long supplierId, Integer isValid) {
-        supplierService.setInvalid(supplierId, isValid);
+    @ApiOperation(value = "供应商置无效/有效", notes = "set_invalid.py")
+    public BaseResponse setInvalid(@RequestBody SupplierSetInvalidParam supplierSetInvalidParam) {
+        supplierService.setInvalid(supplierSetInvalidParam.getSupplierId(), supplierSetInvalidParam.getIsValid());
         return new BaseResponse();
     }
 }

+ 2 - 6
modules/admin/src/main/java/com/fire/admin/rest/DistributeGroupRest.java

@@ -6,9 +6,9 @@ import com.fire.dto.response.BaseResponse;
 import com.fire.dto.response.BaseRestResponse;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import java.util.List;
 
 /**
@@ -22,13 +22,9 @@ import java.util.List;
 @RequestMapping("/distributeGroup")
 public class DistributeGroupRest {
 
+    @Resource
     private DistributeGroupService distributeGroupService;
 
-    @Autowired
-    public DistributeGroupRest(DistributeGroupService distributeGroupService) {
-        this.distributeGroupService = distributeGroupService;
-    }
-
     @PostMapping("/list")
     @ApiOperation(value = "分发组列表", notes = "distributeGroup_list.py")
     public BaseRestResponse getDistributeGroup(Long channelGroupId) {

+ 3 - 6
modules/admin/src/main/java/com/fire/admin/rest/SupplierAdditionalPaymentController.java

@@ -6,12 +6,13 @@ import com.fire.dto.response.BaseResponse;
 import com.fire.dto.response.BaseRestResponse;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
+
 /**
  * @author: admin
  * @Description:
@@ -23,13 +24,9 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("/supplierPayment")
 public class SupplierAdditionalPaymentController {
 
+    @Resource
     private AdditionalPaymentService additionalPaymentService;
 
-    @Autowired
-    public SupplierAdditionalPaymentController(AdditionalPaymentService additionalPaymentService) {
-        this.additionalPaymentService = additionalPaymentService;
-    }
-
     @ApiOperation("供应商加款")
     @PostMapping("/add")
     public BaseResponse makeAdditionalPayment(@RequestBody AdditionalPaymentDto additionalPaymentDto) {

+ 0 - 1
modules/admin/src/main/java/com/fire/admin/service/AdditionalPaymentService.java

@@ -73,7 +73,6 @@ public interface AdditionalPaymentService extends IService<AdditionalPayment> {
      * @Description: 供应商加款撤销
      * @Param: [additionalPaymentDto]
      * @return: String
-     * @Author: liuliu
      * @Date: 2021/6/8 14:58
      */
     String cancelSupplierAdditionalPayment(AdditionalPaymentDto additionalPaymentDto);

+ 1 - 1
modules/admin/src/main/java/com/fire/admin/service/ChannelGroupService.java

@@ -21,7 +21,7 @@ public interface ChannelGroupService extends IService<ChannelGroup> {
 
     void updateChannelGroupById(ChannelGroup channelGroup);
 
-    void deleteChannelGroupById(Long channelGroupId);
+    void delChanGrouAndDistGrouByChanGrouId(Long channelGroupId);
 
 
     /**

+ 4 - 2
modules/admin/src/main/java/com/fire/admin/service/ChannelInfoService.java

@@ -19,7 +19,7 @@ public interface ChannelInfoService extends IService<ChannelInfo> {
 
     IPage<ChannelInfo> getChannelList(ChannelPageParam channelPageParam);
 
-    List<ChannelSupplier> getSupplierInfo();
+    List<ChannelSupplier> getSupplierInfo(String supplierName);
 
     List<FireProductInfo> getChannelProduct(Integer operator);
 
@@ -27,7 +27,9 @@ public interface ChannelInfoService extends IService<ChannelInfo> {
 
     void insertChannelInfo(ChannelInfo channelInfo);
 
-    void deleteChannelById(Long id);
+    void deleteChannelAndProductByChannelId(Long channelId);
+
+    int deleteChannelBySupplierId(Long supplierId);
 
     void setInvalid(Long channelId, Integer isValid);
 }

+ 2 - 3
modules/admin/src/main/java/com/fire/admin/service/ChannelProductService.java

@@ -2,7 +2,6 @@ package com.fire.admin.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fire.dto.ChannelProductInfo;
-import org.springframework.web.bind.annotation.RequestBody;
 
 import java.util.List;
 
@@ -16,8 +15,8 @@ public interface ChannelProductService extends IService<ChannelProductInfo> {
 
     List<ChannelProductInfo> getChannelProductList(Long channelId);
 
-    void saveChannelProducts(@RequestBody List<ChannelProductInfo> channelProductInfos);
+    void saveChannelProducts(List<ChannelProductInfo> channelProductInfos);
 
-    void deleteChannelProductById(Long channelProductId);
+    int deleteChannelProductById(Long channelProductId);
 
 }

+ 4 - 0
modules/admin/src/main/java/com/fire/admin/service/DistributeGroupService.java

@@ -1,6 +1,7 @@
 package com.fire.admin.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fire.dto.ChannelInfo;
 import com.fire.dto.DistributeGroup;
 
 import java.util.List;
@@ -19,4 +20,7 @@ public interface DistributeGroupService extends IService<DistributeGroup> {
 
     void removeDistributeGroupById(Long distributeGroupId);
 
+    int removeDistributeGroupByChannelGroupId(Long channelGroupId);
+
+    void updateDistributeGroupById(List<ChannelInfo> channelInfos);
 }

+ 2 - 2
modules/admin/src/main/java/com/fire/admin/service/SupplierService.java

@@ -17,13 +17,13 @@ public interface SupplierService extends IService<ChannelSupplier> {
 
     IPage<ChannelSupplier> getSupplierList(SupplierPageParam supplierPageParam);
 
-    List<ChannelSupplier> getSupplierInfo();
+    List<ChannelSupplier> getSupplierInfo(String supplierName);
 
     void updateSupplierById(ChannelSupplier channelSupplier);
 
     void saveSupplier(ChannelSupplier channelSupplier);
 
-    void deleteSupplierById(Long id);
+    void deleteSupplierAndChannelBySupplierId(Long id);
 
     void deleteBankCardById(Long bankId);
 

+ 5 - 6
modules/admin/src/main/java/com/fire/admin/service/impl/AdditionalPaymentServiceImpl.java

@@ -98,7 +98,7 @@ public class AdditionalPaymentServiceImpl extends ServiceImpl<AdditionalPaymentM
                 // TODO 加款成功之后,把加款的金额写入数据库
                 redisAmountScript.changeAmount(SUPPLIER_AMOUNT.key(), Long.getLong(additionalPaymentDto.getRelationId()), "add", additionalPaymentDto.getAmount().multiply(new BigDecimal(10000)).longValue(), 0L);
             }
-        } else if (additionalPaymentDto.getType().equals("suppler")) {
+        } else if (additionalPaymentDto.getType().equals("supplier")) {
             additionalPaymentDto.setDistinguish(1);
             // TODO 供应商加款
             this.additionalPayment(additionalPaymentDto);
@@ -230,7 +230,7 @@ public class AdditionalPaymentServiceImpl extends ServiceImpl<AdditionalPaymentM
     }
 
     /**
-     * @Description: TODO  客户账单撤销
+     * @Description:   供应商加款撤销
      * @Param: additionalPaymentDto
      * @return: void
      * @Date: 2021/6/8 14:57
@@ -238,7 +238,6 @@ public class AdditionalPaymentServiceImpl extends ServiceImpl<AdditionalPaymentM
     @Override
     public String cancelSupplierAdditionalPayment(AdditionalPaymentDto additionalPaymentDto) {
 
-        // 供应商的撤销
         if (ObjectUtil.isNotEmpty(additionalPaymentDto.getRelationId()) && additionalPaymentDto.getType().equals("supplier")) {
             additionalPaymentDto.setUndo(1);
             //  实例化对象
@@ -247,9 +246,9 @@ public class AdditionalPaymentServiceImpl extends ServiceImpl<AdditionalPaymentM
             int count = baseMapper.updateById(payment);
 
             if (count > 0) {
-                // TODO 撤销
-                Long amount = redisAmountScript.changeAmount(SUPPLIER_AMOUNT.key(), Long.parseLong(payment.getRelationId()), "sub", payment.getAmount(),10000000L);
-                log.info("供应商加款撤销。 供应商编号为:【{}】 撤销金额为:【{}】 ,授信额度为:【{}】 剩余额度为:【{}】", payment.getRelationId(), additionalPaymentDto.getAmount(), new BigDecimal(10000000L).divide(new BigDecimal("10000"), 2, BigDecimal.ROUND_DOWN), new BigDecimal(amount).divide(new BigDecimal("10000"), 2, BigDecimal.ROUND_DOWN));
+                // 撤销
+                Long amount = redisAmountScript.changeAmount(SUPPLIER_AMOUNT.key(), Long.parseLong(payment.getRelationId()), "sub", payment.getAmount(),100000000L);
+                log.info("供应商加款撤销。 供应商编号为:【{}】 撤销金额为:【{}】 ,授信额度为:【{}】 剩余额度为:【{}】", payment.getRelationId(), additionalPaymentDto.getAmount(), new BigDecimal(100000000L).divide(new BigDecimal("10000"), 2, BigDecimal.ROUND_DOWN), new BigDecimal(amount).divide(new BigDecimal("10000"), 2, BigDecimal.ROUND_DOWN));
                 return payment.getRelationId().concat("_").concat(amount.toString());
             }
         }

+ 7 - 3
modules/admin/src/main/java/com/fire/admin/service/impl/ChannelGroupServiceImpl.java

@@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.rocketmq.spring.core.RocketMQTemplate;
 import org.springframework.messaging.support.MessageBuilder;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import redis.clients.jedis.JedisCluster;
 
 import javax.annotation.Resource;
@@ -99,12 +100,15 @@ public class ChannelGroupServiceImpl extends ServiceImpl<ChannelGroupMapper, Cha
     }
 
     @Override
-    public void deleteChannelGroupById(Long channelGroupId) {
+    @Transactional
+    public void delChanGrouAndDistGrouByChanGrouId(Long channelGroupId) {
         if (channelGroupId != null) {
-            int result = baseMapper.deleteById(channelGroupId);
-            if (result > 0) {
+            int channelGroupResult = baseMapper.deleteById(channelGroupId);
+            int distributeGroupResult = distributeGroupService.removeDistributeGroupByChannelGroupId(channelGroupId);
+            if (channelGroupResult > 0 && distributeGroupResult > 0) {
                 rocketMQTemplate.send(UPDATE_TOPIC + ":" + SUPPLIER_TAG, MessageBuilder.withPayload(SUPPLIER_TAG).build());
                 log.info("编号为【{}】的通道组删除成功!", channelGroupId);
+                log.info("编号为【{}】的分发组删除成功!", channelGroupId);
             }
         } else {
             throw new BaseException(Status.PARAM_ERROR.status(), Status.PARAM_ERROR.message());

+ 29 - 6
modules/admin/src/main/java/com/fire/admin/service/impl/ChannelInfoServiceImpl.java

@@ -19,11 +19,14 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.rocketmq.spring.core.RocketMQTemplate;
 import org.springframework.messaging.support.MessageBuilder;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import redis.clients.jedis.JedisCluster;
 
 import javax.annotation.Resource;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import static com.fire.common.constants.RocketTags.SUPPLIER_TAG;
 import static com.fire.common.constants.RocketTopic.UPDATE_TOPIC;
@@ -68,8 +71,8 @@ public class ChannelInfoServiceImpl extends ServiceImpl<ChannelInfoMapper, Chann
     }
 
     @Override
-    public List<ChannelSupplier> getSupplierInfo() {
-        return supplierService.getSupplierInfo();
+    public List<ChannelSupplier> getSupplierInfo(String supplierName) {
+        return supplierService.getSupplierInfo(supplierName);
     }
 
     @Override
@@ -122,12 +125,32 @@ public class ChannelInfoServiceImpl extends ServiceImpl<ChannelInfoMapper, Chann
     }
 
     @Override
-    public void deleteChannelById(Long id) {
-        if (id != null) {
-            int result = baseMapper.deleteById(id);
+    @Transactional
+    public void deleteChannelAndProductByChannelId(Long channelId) {
+        if (channelId != null) {
+            int channelResult = baseMapper.deleteById(channelId);
+            int channelProductResult = channelProductService.deleteChannelProductById(channelId);
+            if (channelResult > 0 && channelProductResult > 0) {
+                rocketMQTemplate.send(UPDATE_TOPIC + ":" + SUPPLIER_TAG, MessageBuilder.withPayload(SUPPLIER_TAG).build());
+                log.info("编号为:【{}】的通道删除成功!", channelId);
+                log.info("编号为:【{}】的通道产品删除成功!", channelId);
+            }
+        } else {
+            throw new BaseException(Status.PARAM_ERROR.status(), Status.PARAM_ERROR.message());
+        }
+    }
+
+    @Override
+    public int deleteChannelBySupplierId(Long supplierId) {
+        if (supplierId != null) {
+            Map<String, Object> map = new HashMap<>();
+            map.put("supplier_id", supplierId);
+            int result = baseMapper.deleteByMap(map);
             if (result > 0) {
                 rocketMQTemplate.send(UPDATE_TOPIC + ":" + SUPPLIER_TAG, MessageBuilder.withPayload(SUPPLIER_TAG).build());
-                log.info("编号为:【{}】的通道删除成功!", id);
+                return result;
+            } else {
+                return 0;
             }
         } else {
             throw new BaseException(Status.PARAM_ERROR.status(), Status.PARAM_ERROR.message());

+ 12 - 8
modules/admin/src/main/java/com/fire/admin/service/impl/ChannelProductServiceImpl.java

@@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapp
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fire.admin.mapper.ChannelProductMapper;
 import com.fire.admin.service.ChannelProductService;
+import com.fire.common.exception.BaseException;
 import com.fire.dto.ChannelProductInfo;
+import com.fire.dto.enums.Status;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.rocketmq.spring.core.RocketMQTemplate;
 import org.springframework.messaging.support.MessageBuilder;
@@ -53,6 +55,9 @@ public class ChannelProductServiceImpl extends ServiceImpl<ChannelProductMapper,
             for (ChannelProductInfo info : channelProductInfos) {
                 if (info.getChannelProductId() == null) {
                     info.setChannelProductId(jedisCluster.incr(GLOBAL_ID_INCR.key()));
+                    log.info("添加的通道产品是:【{}】", channelProductInfos);
+                } else {
+                    log.info("通道产品已修改为:【{}】", channelProductInfos);
                 }
 
                 info.setDiscount((new BigDecimal(info.getPrice()).divide(new BigDecimal(10000))).divide(new BigDecimal(info.getFacePrice()), 4, BigDecimal.ROUND_DOWN));
@@ -62,24 +67,23 @@ public class ChannelProductServiceImpl extends ServiceImpl<ChannelProductMapper,
             if (result) {
                 rocketMQTemplate.send(UPDATE_TOPIC + ":" + SUPPLIER_TAG, MessageBuilder.withPayload(SUPPLIER_TAG).build());
             }
-            for (ChannelProductInfo info : channelProductInfos) {
-                if (info.getChannelProductId() == null) {
-                    log.info("添加的通道产品是:【{}】", channelProductInfos);
-                } else {
-                    log.info("通道产品已修改为:【{}】", channelProductInfos);
-                }
-            }
         }
     }
 
     @Override
-    public void deleteChannelProductById(Long channelProductId) {
+    public int deleteChannelProductById(Long channelProductId) {
         if (channelProductId != null) {
             int result = baseMapper.deleteById(channelProductId);
             if (result > 0) {
                 rocketMQTemplate.send(UPDATE_TOPIC + ":" + SUPPLIER_TAG, MessageBuilder.withPayload(SUPPLIER_TAG).build());
                 log.info("编号为:【{}】的通道产品删除成功!", channelProductId);
+                return result;
+            } else {
+                return 0;
             }
+        } else {
+            throw new BaseException(Status.PARAM_ERROR.status(), Status.PARAM_ERROR.message());
         }
     }
+
 }

+ 27 - 0
modules/admin/src/main/java/com/fire/admin/service/impl/DistributeGroupServiceImpl.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fire.admin.mapper.DistributeGroupMapper;
 import com.fire.admin.service.DistributeGroupService;
 import com.fire.common.exception.BaseException;
+import com.fire.dto.ChannelInfo;
 import com.fire.dto.DistributeGroup;
 import com.fire.dto.enums.Status;
 import lombok.extern.slf4j.Slf4j;
@@ -15,7 +16,9 @@ import org.springframework.stereotype.Service;
 import redis.clients.jedis.JedisCluster;
 
 import javax.annotation.Resource;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import static com.fire.common.constants.RocketTags.SUPPLIER_TAG;
 import static com.fire.common.constants.RocketTopic.UPDATE_TOPIC;
@@ -75,4 +78,28 @@ public class DistributeGroupServiceImpl extends ServiceImpl<DistributeGroupMappe
             throw new BaseException(Status.PARAM_ERROR.status(), Status.PARAM_ERROR.message());
         }
     }
+
+    @Override
+    public int removeDistributeGroupByChannelGroupId(Long channelGroupId) {
+        if (channelGroupId != null) {
+            Map<String, Object> map = new HashMap<>();
+            map.put("channel_group_id", channelGroupId);
+            int result = baseMapper.deleteByMap(map);
+            if (result > 0) {
+                rocketMQTemplate.send(UPDATE_TOPIC + ":" + SUPPLIER_TAG, MessageBuilder.withPayload(SUPPLIER_TAG).build());
+                log.info("编号为【{}】的分发组删除成功!", channelGroupId);
+                return result;
+            } else {
+                return 0;
+            }
+        } else {
+            throw new BaseException(Status.PARAM_ERROR.status(), Status.PARAM_ERROR.message());
+        }
+    }
+
+    @Override
+    public void updateDistributeGroupById(List<ChannelInfo> channelInfos) {
+
+
+    }
 }

+ 16 - 7
modules/admin/src/main/java/com/fire/admin/service/impl/SupplierServiceImpl.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fire.admin.mapper.ChannelSupplierMapper;
 import com.fire.admin.request.SupplierPageParam;
 import com.fire.admin.service.BankCardService;
+import com.fire.admin.service.ChannelInfoService;
 import com.fire.admin.service.SupplierService;
 import com.fire.common.exception.BaseException;
 import com.fire.dto.ChannelSupplier;
@@ -16,6 +17,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.rocketmq.spring.core.RocketMQTemplate;
 import org.springframework.messaging.support.MessageBuilder;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import redis.clients.jedis.JedisCluster;
 
 import javax.annotation.Resource;
@@ -41,6 +43,9 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
     @Resource
     private BankCardService bankCardService;
 
+    @Resource
+    private ChannelInfoService channelInfoService;
+
     @Resource
     private RocketMQTemplate rocketMQTemplate;
 
@@ -66,9 +71,10 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
     }
 
     @Override
-    public List<ChannelSupplier> getSupplierInfo() {
+    public List<ChannelSupplier> getSupplierInfo(String supplierName) {
         LambdaQueryWrapper<ChannelSupplier> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.select(ChannelSupplier::getSupplierId, ChannelSupplier::getSupplierName);
+        queryWrapper.select(ChannelSupplier::getSupplierId, ChannelSupplier::getSupplierName)
+                .like(supplierName != null, ChannelSupplier::getSupplierName, supplierName);
         return this.list(queryWrapper);
     }
 
@@ -117,12 +123,15 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
     }
 
     @Override
-    public void deleteSupplierById(Long id) {
-        if (id != null) {
-            int result = baseMapper.deleteById(id);
-            if (result > 0) {
+    @Transactional
+    public void deleteSupplierAndChannelBySupplierId(Long supplierId) {
+        if (supplierId != null) {
+            int supplierResult = baseMapper.deleteById(supplierId);
+            int channelResult = channelInfoService.deleteChannelBySupplierId(supplierId);
+            if (supplierResult > 0 && channelResult > 0) {
                 rocketMQTemplate.send(UPDATE_TOPIC + ":" + SUPPLIER_TAG, MessageBuilder.withPayload(SUPPLIER_TAG).build());
-                log.info("编号为:【{}】的供应商删除成功!", id);
+                log.info("编号为:【{}】的供应商删除成功!", supplierId);
+                log.info("编号为:【{}】的通道删除成功!", supplierId);
             }
         } else {
             throw new BaseException(Status.PARAM_ERROR.status(), Status.PARAM_ERROR.message());