杜魏 4 лет назад
Родитель
Сommit
f341a1334d

+ 14 - 0
modules/admin/src/main/java/com/fire/admin/mapper/DistributeGroupMapper.java

@@ -0,0 +1,14 @@
+package com.fire.admin.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fire.dto.DistributeGroup;
+
+/**
+ * @author: admin
+ * @Description:
+ * @date: 2021-06-07 17:45
+ * @Modified By:
+ */
+public interface DistributeGroupMapper extends BaseMapper<DistributeGroup> {
+
+}

+ 38 - 0
modules/admin/src/main/java/com/fire/admin/rest/DistributeGroupRest.java

@@ -0,0 +1,38 @@
+package com.fire.admin.rest;
+
+import com.fire.admin.service.DistributeGroupService;
+import com.fire.dto.DistributeGroup;
+import com.fire.dto.response.BaseResponse;
+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.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author: admin
+ * @Description:
+ * @date: 2021-06-07 17:39
+ * @Modified By:
+ */
+@Api(tags = "分发组相关接口")
+@RestController
+@RequestMapping("/distributeGroup")
+public class DistributeGroupRest {
+
+    private DistributeGroupService distributeGroupService;
+
+    @Autowired
+    public DistributeGroupRest(DistributeGroupService distributeGroupService) {
+        this.distributeGroupService = distributeGroupService;
+    }
+
+    @PostMapping("/add")
+    @ApiOperation(value = "添加分发组", notes = "add_distributegroup.py")
+    public BaseResponse addDistributeGroup(DistributeGroup distributeGroup) {
+        distributeGroupService.insertDistributeGroup(distributeGroup);
+        return new BaseResponse();
+    }
+
+}

+ 4 - 1
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.DistributeGroup;
 
 /**
  * @author: admin
@@ -8,6 +9,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @date: 2021-05-31 16:02
  * @Modified By:
  */
-public interface DistributeGroupService extends IService<DistributeGroupService> {
+public interface DistributeGroupService extends IService<DistributeGroup> {
+
+    void insertDistributeGroup(DistributeGroup distributeGroup);
 
 }

+ 13 - 4
modules/admin/src/main/java/com/fire/admin/service/impl/BankCardServiceImpl.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fire.admin.mapper.BankCardMapper;
 import com.fire.admin.service.BankCardService;
 import com.fire.dto.BankCard;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.web.bind.annotation.RequestBody;
 
@@ -19,13 +20,14 @@ import java.util.List;
  * @Modified By:
  */
 @Service
+@Slf4j
 public class BankCardServiceImpl extends ServiceImpl<BankCardMapper, BankCard> implements BankCardService {
 
     @Override
     public List<BankCard> getBankCardList(Integer relationId, Integer distinguish) {
         List<BankCard> bankCardList = new LambdaQueryChainWrapper<>(baseMapper)
-                .eq(BankCard::getRelationId,relationId )
-                .eq(distinguish !=null,BankCard::getDistinguish, distinguish).list();
+                .eq(BankCard::getRelationId, relationId)
+                .eq(distinguish != null, BankCard::getDistinguish, distinguish).list();
         if (bankCardList != null) {
             return bankCardList;
         } else {
@@ -46,6 +48,13 @@ public class BankCardServiceImpl extends ServiceImpl<BankCardMapper, BankCard> i
         }
         if (ObjectUtil.isNotEmpty(bankCards)) {
             boolean result = this.saveOrUpdateBatch(bankCards);
+            for (BankCard bankCard : bankCards) {
+                if (bankCard.getId() == null) {
+                    log.info("添加的银行卡是:【{}】", bankCards);
+                } else {
+                    log.info("修改的银行卡是:【{}】", bankCards);
+                }
+            }
             if (result) {
                 // TODO: 2021/5/20 向MQ推送消息
             }
@@ -55,8 +64,8 @@ public class BankCardServiceImpl extends ServiceImpl<BankCardMapper, BankCard> i
     @Override
     public void deleteBankCards(Integer bankId) {
         if (bankId != null) {
-            this.baseMapper.deleteById(bankId);
+            baseMapper.deleteById(bankId);
+            log.info("编号为:【{}】的银行卡删除成功!", bankId);
         }
     }
-
 }

+ 8 - 1
modules/admin/src/main/java/com/fire/admin/service/impl/ChannelInfoServiceImpl.java

@@ -14,6 +14,8 @@ import com.fire.common.exception.BaseException;
 import com.fire.dto.ChannelInfo;
 import com.fire.dto.ChannelSupplier;
 import com.fire.dto.FireProductInfo;
+import com.fire.dto.enums.Status;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -27,6 +29,7 @@ import java.util.List;
  * @Modified By:
  */
 @Service
+@Slf4j
 public class ChannelInfoServiceImpl extends ServiceImpl<ChannelInfoMapper, ChannelInfo> implements ChannelInfoService {
 
     @Autowired
@@ -71,11 +74,13 @@ public class ChannelInfoServiceImpl extends ServiceImpl<ChannelInfoMapper, Chann
         channelInfo.setUpdator("admin");
         channelInfo.setUpdateTime(new Date());
         int result = baseMapper.updateById(channelInfo);
+        log.info("通道已修改为:【{}】", channelInfo);
         if (result > 0) {
             // TODO: 2021/5/24 向MQ推送消息
         }
         if (ObjectUtil.isNotEmpty(channelInfo.getChannelProductInfos())) {
             channelProductService.saveChannelProducts(channelInfo.getChannelProductInfos());
+            log.info("添加的通道产品是:【{}】", channelInfo.getChannelProductInfos().toString());
         }
 
     }
@@ -85,6 +90,7 @@ public class ChannelInfoServiceImpl extends ServiceImpl<ChannelInfoMapper, Chann
         channelInfo.setCreator("admin");
         channelInfo.setCreateTime(new Date());
         int result = baseMapper.insert(channelInfo);
+        log.info("添加的通道是:【{}】", channelInfo);
         if (result > 0) {
             // TODO: 2021/5/24 向MQ推送消息
         }
@@ -94,11 +100,12 @@ public class ChannelInfoServiceImpl extends ServiceImpl<ChannelInfoMapper, Chann
     public void deleteChannelById(Long id) {
         if (id != null) {
             int result = baseMapper.deleteById(id);
+            log.info("编号为:【{}】的通道删除成功!", id);
             if (result > 0) {
                 // TODO: 2021/5/20 向MQ推送消息
             }
         } else {
-            throw new BaseException("非法参数!");
+            throw new BaseException(Status.REQUEST_PARAM_ERROR.status(),Status.REQUEST_PARAM_ERROR.message());
         }
     }
 }

+ 11 - 2
modules/admin/src/main/java/com/fire/admin/service/impl/ChannelProductServiceImpl.java

@@ -6,8 +6,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fire.admin.mapper.ChannelProductMapper;
 import com.fire.admin.service.ChannelProductService;
 import com.fire.dto.ChannelProductInfo;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
-import org.springframework.web.bind.annotation.RequestBody;
 
 import java.util.List;
 
@@ -18,6 +18,7 @@ import java.util.List;
  * @Modified By:
  */
 @Service
+@Slf4j
 public class ChannelProductServiceImpl extends ServiceImpl<ChannelProductMapper, ChannelProductInfo> implements ChannelProductService {
 
     @Override
@@ -32,9 +33,16 @@ public class ChannelProductServiceImpl extends ServiceImpl<ChannelProductMapper,
     }
 
     @Override
-    public void saveChannelProducts(@RequestBody List<ChannelProductInfo> channelProductInfos) {
+    public void saveChannelProducts(List<ChannelProductInfo> channelProductInfos) {
         if (ObjectUtil.isNotEmpty(channelProductInfos)) {
             boolean result = this.saveOrUpdateBatch(channelProductInfos);
+            for (ChannelProductInfo info : channelProductInfos) {
+                if (info.getChannelProductId() == null) {
+                    log.info("添加的通道产品是:【{}】", channelProductInfos);
+                } else {
+                    log.info("通道产品已修改为:【{}】", channelProductInfos);
+                }
+            }
             if (result) {
                 // TODO: 2021/5/25 向MQ推送消息
             }
@@ -44,5 +52,6 @@ public class ChannelProductServiceImpl extends ServiceImpl<ChannelProductMapper,
     @Override
     public void deleteChannelProductById(Long channelProductId) {
         baseMapper.deleteById(channelProductId);
+        log.info("编号为:【{}】的通道产品删除成功!", channelProductId);
     }
 }

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

@@ -0,0 +1,30 @@
+package com.fire.admin.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fire.admin.mapper.DistributeGroupMapper;
+import com.fire.admin.service.DistributeGroupService;
+import com.fire.dto.DistributeGroup;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author: admin
+ * @Description:
+ * @date: 2021-06-07 17:44
+ * @Modified By:
+ */
+@Service
+@Slf4j
+public class DistributeGroupServiceImpl extends ServiceImpl<DistributeGroupMapper, DistributeGroup> implements DistributeGroupService {
+
+    @Override
+    public void insertDistributeGroup(DistributeGroup distributeGroup) {
+        if (distributeGroup != null) {
+            int result = baseMapper.insert(distributeGroup);
+            if (result > 0) {
+                // TODO: 2021/6/7 向MQ推送消息
+            }
+            log.info("添加的分发组是:【{}】", distributeGroup);
+        }
+    }
+}

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

@@ -11,6 +11,7 @@ import com.fire.admin.service.BankCardService;
 import com.fire.admin.service.SupplierService;
 import com.fire.common.exception.BaseException;
 import com.fire.dto.ChannelSupplier;
+import com.fire.dto.enums.Status;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -38,13 +39,12 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
         LambdaQueryWrapper<ChannelSupplier> lambdaQueryWrapper = new LambdaQueryWrapper<>();
         lambdaQueryWrapper.
                 like(supplierPageParam.getSupplierName() != null, ChannelSupplier::getSupplierName, supplierPageParam.getSupplierName())
-                .eq(ChannelSupplier::getIsDelete, 0)
                 .orderByDesc(ChannelSupplier::getBalance, ChannelSupplier::getIsValid);
         IPage<ChannelSupplier> supplierList = baseMapper.selectPage(supplierPageParam, lambdaQueryWrapper);
 
         if (supplierList != null) {
             for (ChannelSupplier supplier : supplierList.getRecords()) {
-                supplier.setBankCards(bankCardService.getBankCardList(supplier.getSupplierId(),1));
+                supplier.setBankCards(bankCardService.getBankCardList(supplier.getSupplierId(), 1));
             }
             return supplierList;
         } else {
@@ -66,13 +66,14 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
         LambdaUpdateWrapper<ChannelSupplier> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
         lambdaUpdateWrapper.eq(channelSupplier.getSupplierId() != null, ChannelSupplier::getSupplierId, channelSupplier.getSupplierId());
         int result = baseMapper.update(channelSupplier, lambdaUpdateWrapper);
+        log.info("供应商已修改为:【{}】", channelSupplier);
         if (result > 0) {
             // TODO: 2021/5/18 向MQ推送消息
         }
         if (ObjectUtil.isNotEmpty(channelSupplier.getBankCards())) {
-            // TODO 把通道编号写入添加的银行里面
-            channelSupplier.getBankCards().forEach(c->{
-                c.setRelationId(channelSupplier.getSupplierId());
+            // TODO 把供应商编号写入添加的银行里面
+            channelSupplier.getBankCards().forEach(bankCard -> {
+                bankCard.setRelationId(channelSupplier.getSupplierId());
             });
 
             bankCardService.saveBankCards(channelSupplier.getBankCards());
@@ -85,6 +86,7 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
         channelSupplier.setCreator("admin");
         channelSupplier.setCreateTime(new Date());
         int result = baseMapper.insert(channelSupplier);
+        log.info("添加的供应商是:【{}】", channelSupplier);
         if (result > 0) {
             // TODO:2021/5/18 向MQ推送消息
         }
@@ -94,11 +96,12 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
     public void deleteSupplierById(Integer id) {
         if (id != null) {
             int result = baseMapper.deleteById(id);
+            log.info("编号为:【{}】的供应商删除成功!", id);
             if (result > 0) {
                 // TODO:2021/5/18 向MQ推送消息
             }
         } else {
-            throw new BaseException("非法参数!");
+            throw new BaseException(Status.REQUEST_PARAM_ERROR.status(),Status.REQUEST_PARAM_ERROR.message());
         }
     }
 
@@ -112,7 +115,7 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
                 // TODO:2021/5/18 向MQ推送消息
             }
         } else {
-            throw new BaseException("非法参数!");
+            throw new BaseException(Status.REQUEST_PARAM_ERROR.status(),Status.REQUEST_PARAM_ERROR.message());
         }
     }