Jelajahi Sumber

修改供应商及加款字段

杜魏 4 tahun lalu
induk
melakukan
ab2012ad12

+ 3 - 3
common/fire-dto/src/main/java/com/fire/dto/BankCard.java

@@ -24,7 +24,7 @@ import java.util.Date;
 public class BankCard {
 
     @ApiModelProperty("主键")
-    @TableId(value = "id",type = IdType.AUTO)
+    @TableId(type = IdType.AUTO)
     private Integer id;
 
     @ApiModelProperty("银行卡号")
@@ -36,8 +36,8 @@ public class BankCard {
     @ApiModelProperty("账户全称")
     private String account;
 
-    @ApiModelProperty("供应商id")
-    private Integer supplierId;
+    @ApiModelProperty("客户或者供应商的关联id")
+    private Integer relationId;
 
     @ApiModelProperty("创建者")
     private String creator;

+ 6 - 4
common/fire-dto/src/main/java/com/fire/dto/ChannelGroup.java

@@ -1,15 +1,13 @@
 package com.fire.dto;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableLogic;
-import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.*;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * @author: admin
@@ -45,4 +43,8 @@ public class ChannelGroup {
     @ApiModelProperty("删除标记 0-未删除,1-删除")
     @TableLogic
     private Integer isDelete;
+
+    @ApiModelProperty("分发组")
+    @TableField(exist = false)
+    private List<DistributeGroup> distributeGroups;
 }

+ 2 - 2
common/fire-dto/src/main/java/com/fire/dto/ChannelInfo.java

@@ -25,8 +25,8 @@ public class ChannelInfo {
     @ApiModelProperty("通道id")
     private Long channelId;
 
-    @ApiModelProperty("供应商id")
-    private Integer supplierId;
+    @ApiModelProperty("客户或者供应商的关联id")
+    private Integer relationId;
 
     @ApiModelProperty("通道名称")
     private String channelName;

+ 2 - 2
common/fire-dto/src/main/java/com/fire/dto/ChannelSupplier.java

@@ -21,9 +21,9 @@ import java.util.List;
 @TableName("channel_supplier")
 public class ChannelSupplier {
 
-    @TableId(value = "supplier_id", type = IdType.AUTO)
+    @TableId(value = "relation_id", type = IdType.AUTO)
     @ApiModelProperty("供应商id")
-    private Integer supplierId;
+    private Integer relationId;
 
     @ApiModelProperty("供应商名称")
     private String supplierName;

+ 4 - 4
common/fire-dto/src/main/java/com/fire/dto/DistributeGroup.java

@@ -1,6 +1,9 @@
 package com.fire.dto;
 
-import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -8,7 +11,6 @@ import lombok.NoArgsConstructor;
 import lombok.ToString;
 
 import java.util.Date;
-import java.util.List;
 
 /**
  * @author: admin
@@ -61,6 +63,4 @@ public class DistributeGroup {
     @TableLogic
     private Integer isDelete;
 
-    @TableField(exist = false)
-    private List<ChannelGroup> channelGroups;
 }

+ 2 - 2
modules/admin/src/main/java/com/fire/admin/request/ChannelPageParam.java

@@ -20,8 +20,8 @@ public class ChannelPageParam extends Page {
     @ApiModelProperty("通道id")
     private Long channelId;
 
-    @ApiModelProperty("供应商id")
-    private Integer supplierId;
+    @ApiModelProperty("客户或者供应商的关联id")
+    private Integer relationId;
 
     @ApiModelProperty("通道名称")
     private String channelName;

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

@@ -7,12 +7,9 @@ import com.fire.dto.ChannelGroup;
 import com.fire.dto.response.BaseResponse;
 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.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * @author: admin
@@ -22,7 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @Api(tags = "通道组相关接口")
 @RestController
-@RequestMapping("channelgroup")
+@RequestMapping("channelGroup")
 public class ChannelGroupRest {
 
     private ChannelGroupService channelGroupService;
@@ -44,12 +41,23 @@ public class ChannelGroupRest {
     }
 
     @PostMapping("/add")
-    @ApiModelProperty(value = "添加通道组", notes = "add_channel_group.py")
+    @ApiOperation(value = "添加通道组", notes = "add_channel_group.py")
     public BaseResponse saveChannelGroup(ChannelGroup channelGroup) {
         channelGroupService.addChannelGroup(channelGroup);
         return new BaseResponse();
     }
 
+    @PutMapping("/update")
+    @ApiOperation(value = "修改通道组", notes = "update_channel_group.py")
+    public BaseResponse updateChannelGroup(ChannelGroup channelGroup) {
+        channelGroupService.updateChannelGroupById(channelGroup);
+        return new BaseResponse();
+    }
 
-
+    @DeleteMapping("/delete/{channelGroupId}")
+    @ApiOperation(value = "删除通道组", notes = "delete_channel_group.py")
+    public BaseResponse removeChannelGroup(@PathVariable("channelGroupId") Long channelGroupId) {
+        channelGroupService.deleteChannelGroupById(channelGroupId);
+        return new BaseResponse();
+    }
 }

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

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.fire.admin.request.ChannelPageParam;
 import com.fire.admin.service.ChannelInfoService;
 import com.fire.dto.ChannelInfo;
+import com.fire.dto.ChannelSupplier;
 import com.fire.dto.FireProductInfo;
 import com.fire.dto.response.BaseResponse;
 import com.fire.dto.response.BaseRestResponse;
@@ -57,6 +58,17 @@ public class ChannelInfoRest {
         }
     }
 
+    @GetMapping("/supplierInfo")
+    @ApiModelProperty(value = "获取供应商信息", notes = "get_supplier_info.py")
+    public BaseRestResponse getSupplierInfo() {
+        List<ChannelSupplier> supplierList = channelInfoService.getSupplierInfo();
+        if (supplierList != null) {
+            return new BaseRestResponse(supplierList);
+        } else {
+            return new BaseRestResponse(null);
+        }
+    }
+
     @PostMapping("/add")
     @ApiOperation(value = "添加通道", notes = "add_channelInfo.py")
     public BaseResponse addChannelInfo(@RequestBody ChannelInfo channelInfo) {

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

@@ -52,7 +52,7 @@ public class ChannelSupplierRest {
     @PostMapping("/update")
     @ApiOperation(value = "修改供应商", notes = "supplier_update.py")
     public BaseResponse updateSupplierBySupplierId(@RequestBody ChannelSupplier channelSupplier) {
-        supplierService.updateSupplierBySupplierId(channelSupplier);
+        supplierService.updateSupplierByRelationId(channelSupplier);
         return new BaseResponse();
     }
 

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

@@ -17,4 +17,7 @@ public interface ChannelGroupService extends IService<ChannelGroup> {
 
     void addChannelGroup(ChannelGroup channelGroup);
 
+    void updateChannelGroupById(ChannelGroup channelGroup);
+
+    void deleteChannelGroupById(Long channelGroupId);
 }

+ 3 - 0
modules/admin/src/main/java/com/fire/admin/service/ChannelInfoService.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fire.admin.request.ChannelPageParam;
 import com.fire.dto.ChannelInfo;
+import com.fire.dto.ChannelSupplier;
 import com.fire.dto.FireProductInfo;
 
 import java.util.List;
@@ -18,6 +19,8 @@ public interface ChannelInfoService extends IService<ChannelInfo> {
 
     IPage<ChannelInfo> getChannelList(ChannelPageParam channelPageParam);
 
+    List<ChannelSupplier> getSupplierInfo();
+
     List<FireProductInfo> getChannelProduct(Integer operator);
 
     void updateChannelInfoById(ChannelInfo channelInfo);

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

@@ -19,7 +19,7 @@ public interface SupplierService extends IService<ChannelSupplier> {
 
     List<ChannelSupplier> getSupplierInfo();
 
-    void updateSupplierBySupplierId(ChannelSupplier channelSupplier);
+    void updateSupplierByRelationId(ChannelSupplier channelSupplier);
 
     void saveSupplier(ChannelSupplier channelSupplier);
 

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

@@ -22,8 +22,8 @@ import java.util.List;
 public class BankCardServiceImpl extends ServiceImpl<BankCardMapper, BankCard> implements BankCardService {
 
     @Override
-    public List<BankCard> getBankCardList(Integer supplierId) {
-        List<BankCard> bankCardList = new LambdaQueryChainWrapper<>(baseMapper).eq(supplierId != null, BankCard::getSupplierId, supplierId).list();
+    public List<BankCard> getBankCardList(Integer relationId) {
+        List<BankCard> bankCardList = new LambdaQueryChainWrapper<>(baseMapper).eq(relationId != null, BankCard::getRelationId, relationId).list();
         if (bankCardList != null) {
             return bankCardList;
         } else {

+ 16 - 0
modules/admin/src/main/java/com/fire/admin/service/impl/ChannelGroupServiceImpl.java

@@ -36,4 +36,20 @@ public class ChannelGroupServiceImpl extends ServiceImpl<ChannelGroupMapper, Cha
             baseMapper.insert(channelGroup);
         }
     }
+
+    @Override
+    public void updateChannelGroupById(ChannelGroup channelGroup) {
+        int result = baseMapper.updateById(channelGroup);
+        if (result > 0) {
+            // TODO: 2021/6/3 向MQ推送消息
+        }
+    }
+
+    @Override
+    public void deleteChannelGroupById(Long channelGroupId) {
+        int result = baseMapper.deleteById(channelGroupId);
+        if (result > 0) {
+            // TODO: 2021/6/3 向MQ推送消息
+        }
+    }
 }

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

@@ -13,6 +13,7 @@ import com.fire.admin.service.ChannelProductService;
 import com.fire.admin.service.SupplierService;
 import com.fire.common.exception.BaseException;
 import com.fire.dto.ChannelInfo;
+import com.fire.dto.ChannelSupplier;
 import com.fire.dto.FireProductInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -42,7 +43,7 @@ public class ChannelInfoServiceImpl extends ServiceImpl<ChannelInfoMapper, Chann
     public IPage<ChannelInfo> getChannelList(ChannelPageParam channelPageParam) {
         LambdaQueryWrapper<ChannelInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
         lambdaQueryWrapper.eq(channelPageParam.getChannelId() != null, ChannelInfo::getChannelId, channelPageParam.getChannelId())
-                .eq(channelPageParam.getSupplierId() != null, ChannelInfo::getSupplierId, channelPageParam.getSupplierId())
+                .eq(channelPageParam.getRelationId() != null, ChannelInfo::getRelationId, channelPageParam.getRelationId())
                 .like(channelPageParam.getChannelName() != null, ChannelInfo::getChannelName, channelPageParam.getChannelName())
                 .eq(ChannelInfo::getIsDelete, 0);
         IPage<ChannelInfo> channelInfoList = baseMapper.selectPage(channelPageParam, lambdaQueryWrapper);
@@ -56,6 +57,11 @@ public class ChannelInfoServiceImpl extends ServiceImpl<ChannelInfoMapper, Chann
         }
     }
 
+    @Override
+    public List<ChannelSupplier> getSupplierInfo() {
+        return supplierService.getSupplierInfo();
+    }
+
     @Override
     public List<FireProductInfo> getChannelProduct(Integer operator) {
         List<FireProductInfo> fireProductInfos = new LambdaQueryChainWrapper<>(fireProductMapper).eq(operator != null, FireProductInfo::getOperator, operator).list();
@@ -89,6 +95,7 @@ public class ChannelInfoServiceImpl extends ServiceImpl<ChannelInfoMapper, Chann
         if (result > 0) {
             // TODO: 2021/5/24 向MQ推送消息
         }
+
     }
 
     @Override

+ 6 - 3
modules/admin/src/main/java/com/fire/admin/service/impl/SupplierServiceImpl.java

@@ -2,6 +2,7 @@ package com.fire.admin.service.impl;
 
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -43,7 +44,7 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
 
         if (supplierList != null) {
             for (ChannelSupplier supplier : supplierList.getRecords()) {
-                supplier.setBankCards(bankCardService.getBankCardList(supplier.getSupplierId()));
+                supplier.setBankCards(bankCardService.getBankCardList(supplier.getRelationId()));
             }
             return supplierList;
         } else {
@@ -53,15 +54,17 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
 
     @Override
     public List<ChannelSupplier> getSupplierInfo() {
+        QueryWrapper<ChannelSupplier> queryWrapper = new QueryWrapper<>();
+        queryWrapper.select("relation_id", "supplierName");
         return baseMapper.selectList(null);
     }
 
     @Override
-    public void updateSupplierBySupplierId(ChannelSupplier channelSupplier) {
+    public void updateSupplierByRelationId(ChannelSupplier channelSupplier) {
         channelSupplier.setUpdator("admin");
         channelSupplier.setUpdateTime(new Date());
         LambdaUpdateWrapper<ChannelSupplier> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
-        lambdaUpdateWrapper.eq(channelSupplier.getSupplierId() != null, ChannelSupplier::getSupplierId, channelSupplier.getSupplierId());
+        lambdaUpdateWrapper.eq(channelSupplier.getRelationId() != null, ChannelSupplier::getRelationId, channelSupplier.getRelationId());
         int result = baseMapper.update(channelSupplier, lambdaUpdateWrapper);
         if (result > 0) {
             // TODO: 2021/5/18 向MQ推送消息