Ver código fonte

Merge branch 'master' of http://120.78.198.155:10080/zhangjunqiang/fire

 Conflicts:
	modules/admin/src/main/java/com/fire/admin/rest/BankCardRest.java
	modules/admin/src/main/java/com/fire/admin/service/BankCardService.java
	modules/admin/src/main/java/com/fire/admin/service/impl/BankCardServiceImpl.java
	modules/admin/src/main/java/com/fire/admin/service/impl/SupplierServiceImpl.java
杜魏 4 anos atrás
pai
commit
4a215e2110

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

@@ -23,6 +23,7 @@ public class ChannelSupplier {
 
     @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 = "区域名称(省份名称)")

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

@@ -58,4 +58,5 @@ public class BankCardRest {
     }
 
 
+
 }

+ 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 - 0
modules/admin/src/main/java/com/fire/admin/service/BankCardService.java

@@ -2,6 +2,7 @@ package com.fire.admin.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.fire.dto.BankCard;
+import org.springframework.web.bind.annotation.RequestBody;
 
 import java.util.List;
 

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

@@ -7,6 +7,7 @@ import com.fire.admin.mapper.BankCardMapper;
 import com.fire.admin.service.BankCardService;
 import com.fire.dto.BankCard;
 import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.RequestBody;
 
 import java.util.Date;
 import java.util.List;
@@ -33,7 +34,7 @@ public class BankCardServiceImpl extends ServiceImpl<BankCardMapper, BankCard> i
     }
 
     @Override
-    public void saveBankCards(List<BankCard> bankCards) {
+    public void saveBankCards(@RequestBody List<BankCard> bankCards) {
         for (BankCard bankCard : bankCards) {
             if (bankCard.getId() == null) {
                 bankCard.setCreator("admin");

+ 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 - 1
modules/admin/src/main/java/com/fire/admin/service/impl/SupplierServiceImpl.java

@@ -36,7 +36,8 @@ 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);
@@ -44,6 +45,7 @@ public class SupplierServiceImpl extends ServiceImpl<ChannelSupplierMapper, Chan
         if (supplierList != null) {
             for (ChannelSupplier supplier : supplierList.getRecords()) {
                 supplier.setBankCards(bankCardService.getBankCardList(supplier.getSupplierId(), supplierPageParam.getDistinguish()));
+                supplier.setBankCards(bankCardService.getBankCardList(supplier.getSupplierId(),1));
             }
             return supplierList;
         } else {
@@ -69,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());
         }