Jelajahi Sumber

bug提交 修改 杜魏通道银行卡列表返回无数据以及添加银行卡不指定通道编号

杨六六 4 tahun lalu
induk
melakukan
dae1ec4ff7

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

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

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

@@ -1,5 +1,6 @@
 package com.fire.dto;
 
+import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
@@ -27,14 +28,12 @@ import java.math.BigDecimal;
 public class CustomerProduct {
 
     @ApiModelProperty(value = "主键")
-    @TableId(value="customer_product_id")
+    @TableId(value="customer_product_id",type = IdType.AUTO)
     private Integer customerProductId;
 
     @ApiModelProperty(value = "客户编号(前端不展示)")
     private Long customerId;
 
-    @ApiModelProperty(value = "产品id")
-    private Integer productId;
 
     @ApiModelProperty(value = "产品包id(前端不展示)")
     private String packageId;
@@ -52,6 +51,7 @@ public class CustomerProduct {
     private Integer isEffective;
 
     @ApiModelProperty(value = "客户结算价格折扣")
+    @TableField(value = "discount")
     private BigDecimal disCount;
 
     /********************扩展冗余字段*********************/

+ 0 - 1
common/fire-dto/src/main/java/com/fire/dto/enums/Status.java

@@ -32,7 +32,6 @@ public enum Status {
     PRODUCT_MAINTAIN("205", "产品维护"),
     BALANCE_NOT_ENOUGH("301", "可用余额不足"),
     RECORDING_EXISTS("410", "记录已经存在"),
-    PACKAGEERROR("411","产品查询运营商参数错误,1 : 移动  2 : 电信  3 : 联通"),
     PARAM_ERROR("306", "参数不合法");
 
     private final String status;

+ 3 - 2
modules/admin/src/main/java/com/fire/admin/dto/CustomerProductDto.java

@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Builder;
 import lombok.Data;
 
+import java.math.BigDecimal;
 import java.math.BigInteger;
 
 /**
@@ -42,10 +43,10 @@ public class CustomerProductDto {
 
 
     @ApiModelProperty(value = "客户结算价格()")
-    private Integer price;
+    private BigDecimal price;
 
     @ApiModelProperty(value = "产品面额")
-    private Integer facePrice;
+    private BigDecimal facePrice;
 
 
     @ApiModelProperty(value = "区域名称(省份名称)")

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

@@ -34,8 +34,8 @@ public class BankCardRest {
 
     @PostMapping("/list")
     @ApiOperation(value = "银行卡列表", notes = "bankcard_list.py")
-    public BaseRestResponse getBankCardList(Integer supplierId) {
-        List<BankCard> bankCardList = bankCardService.getBankCardList(supplierId);
+    public BaseRestResponse getBankCardList(Integer supplierId, Integer distinguish) {
+        List<BankCard> bankCardList = bankCardService.getBankCardList(supplierId,distinguish);
         if (bankCardList != null) {
             return new BaseRestResponse(bankCardList);
         } else {

+ 3 - 2
modules/admin/src/main/java/com/fire/admin/rest/TestController.java

@@ -14,6 +14,7 @@ import org.springframework.web.multipart.support.StandardMultipartHttpServletReq
 
 import java.io.File;
 import java.io.IOException;
+import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -45,8 +46,8 @@ public class TestController {
 
 
     public static void main(String[] args) {
-
-
+        int i = new BigDecimal("9.9000").multiply(new BigDecimal(10000)).intValue();
+        System.out.println("anInt = " + i);
     }
 
 }

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

@@ -21,7 +21,7 @@ public interface BankCardService extends IService<BankCard> {
     * @Author: liuliu
     * @Date: 2021/6/3 15:00
     */
-    List<BankCard> getBankCardList(Integer relation_id, Integer distinguish);
+    List<BankCard> getBankCardList(Integer relationId, Integer distinguish);
 
     void saveBankCards(@RequestBody List<BankCard> bankCards);
 

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

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

+ 21 - 16
modules/admin/src/main/java/com/fire/admin/service/impl/CustomerProductInfoServiceImpl.java

@@ -6,7 +6,9 @@ import com.fire.admin.dto.CustomerProductDto;
 import com.fire.admin.mapper.CustomerProductInfoMapper;
 import com.fire.admin.service.CustomerProductInfoService;
 import com.fire.admin.vo.CustomerProductInfoVo;
+import com.fire.common.exception.BaseException;
 import com.fire.dto.CustomerProduct;
+import com.fire.dto.enums.Status;
 import com.google.common.collect.Lists;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
@@ -82,25 +84,28 @@ public class CustomerProductInfoServiceImpl extends ServiceImpl<CustomerProductI
     @Override
     public void saveOrUpdate(List<CustomerProductDto> productDtoList) {
 
-        List<CustomerProduct> productList = Lists.newArrayList();
+        if(!productDtoList.isEmpty()){
+            List<CustomerProduct> productList = Lists.newArrayList();
+            productDtoList.forEach(dto->{
+                CustomerProduct product = CustomerProduct.builder()
+                        .customerProductId(dto.getCustomerProductId())
+                        .customerId(dto.getCustomerId())
+                        .packageId(dto.getPackageId())
+                        .type(dto.getType())
+                        .price(Integer.parseInt(String.valueOf((dto.getPrice().multiply(new BigDecimal(10000))).longValue())))
+                        .facePrice(Integer.parseInt(String.valueOf(dto.getFacePrice().multiply(new BigDecimal(10000)).longValue())))
+                        .isEffective(dto.getIsEffective())
+                        .disCount(dto.getPrice().divide(dto.getFacePrice())).build();
+                log.info("产品为:【{}】",product.toString());
+                productList.add(product);
+            });
 
-        productDtoList.forEach(dto->{
-            CustomerProduct product = CustomerProduct.builder().customerProductId(dto.getCustomerProductId())
-                    .customerId(dto.getCustomerId())
-                    .packageId(dto.getPackageId())
-                    .type(dto.getType())
-                    .price(Integer.parseInt(String.valueOf(new BigDecimal(dto.getPrice()).multiply(new BigDecimal(10000)))))
-                    .facePrice(Integer.parseInt(String.valueOf(new BigDecimal(dto.getFacePrice()).multiply(new BigDecimal(10000)))))
-                    .isEffective(dto.getIsEffective())
-                    .disCount(new BigDecimal(dto.getPrice()).divide(new BigDecimal(dto.getFacePrice()))).build();
-            productList.add(product);
-        });
-        boolean flag = this.saveOrUpdateBatch(productList);
-        if(flag){
-            //TODO 发送消息到topic
+            boolean flag = this.saveOrUpdateBatch(productList);
+            if(flag){
+                //TODO 发送消息到topic
 
+            }
         }
-
     }
 
     @Override

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

@@ -37,14 +37,15 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
     @Override
     public IPage<ChannelSupplier> getSupplierList(SupplierPageParam supplierPageParam) {
         LambdaQueryWrapper<ChannelSupplier> lambdaQueryWrapper = new LambdaQueryWrapper<>();
-        lambdaQueryWrapper.like(supplierPageParam.getSupplierName() != null, ChannelSupplier::getSupplierName, supplierPageParam.getSupplierName())
+        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()));
+                supplier.setBankCards(bankCardService.getBankCardList(supplier.getSupplierId(),1));
             }
             return supplierList;
         } else {
@@ -70,6 +71,11 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
             // TODO: 2021/5/18 向MQ推送消息
         }
         if (ObjectUtil.isNotEmpty(channelSupplier.getBankCards())) {
+            // TODO 把通道编号写入添加的银行里面
+            channelSupplier.getBankCards().forEach(c->{
+                c.setRelationId(channelSupplier.getSupplierId());
+            });
+
             bankCardService.saveBankCards(channelSupplier.getBankCards());
         }
 

+ 1 - 1
modules/admin/src/main/resources/mapper/ChannelInfoMapper.xml

@@ -6,7 +6,7 @@
         <id column="channel_id" property="channelId"/>
         <result column="supplier_id" property="supplierId"/>
         <result column="channel_name" property="channelName"/>
-        <result column="operator_code" property="operatorCode"/>
+        <result column="operator" property="operator"/>
         <result column="is_valid" property="isValid"/>
         <result column="remark" property="remark"/>
         <result column="creator" property="creator"/>