Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	common/fire-dto/src/main/java/com/fire/dto/ChannelGroup.java
#	common/fire-dto/src/main/java/com/fire/dto/DistributeGroup.java
杜魏 4 лет назад
Родитель
Сommit
bd54693e30
57 измененных файлов с 1029 добавлено и 155 удалено
  1. 7 1
      common/fire-dto/src/main/java/com/fire/dto/ChannelGroup.java
  2. 16 1
      common/fire-dto/src/main/java/com/fire/dto/ChannelInfo.java
  3. 5 0
      common/fire-dto/src/main/java/com/fire/dto/ChannelProductInfo.java
  4. 2 1
      common/fire-dto/src/main/java/com/fire/dto/CustomerInfo.java
  5. 7 1
      common/fire-dto/src/main/java/com/fire/dto/CustomerProduct.java
  6. 10 5
      common/fire-dto/src/main/java/com/fire/dto/DistributeGroup.java
  7. 1 2
      common/fire-dto/src/main/java/com/fire/dto/FireProductInfo.java
  8. 2 2
      common/fire-dto/src/main/java/com/fire/dto/FlowAppInfo.java
  9. 1 1
      common/fire-dto/src/main/java/com/fire/dto/MobileFlowDispatchRec.java
  10. 1 0
      common/fire-dto/src/main/java/com/fire/dto/enums/RedisKey.java
  11. 1 0
      common/fire-dto/src/main/java/com/fire/dto/enums/Status.java
  12. 4 1
      modules/admin/pom.xml
  13. 25 0
      modules/admin/src/main/java/com/fire/admin/dto/ConstantProperties.java
  14. 7 4
      modules/admin/src/main/java/com/fire/admin/dto/CustomerDto.java
  15. 3 1
      modules/admin/src/main/java/com/fire/admin/dto/CustomerProductDto.java
  16. 4 0
      modules/admin/src/main/java/com/fire/admin/dto/FireProductInfoDto.java
  17. 2 2
      modules/admin/src/main/java/com/fire/admin/dto/FlowAppInfoDto.java
  18. 17 1
      modules/admin/src/main/java/com/fire/admin/rest/CustomerController.java
  19. 28 3
      modules/admin/src/main/java/com/fire/admin/rest/CustomerProductInfoController.java
  20. 16 4
      modules/admin/src/main/java/com/fire/admin/rest/FireProductController.java
  21. 9 5
      modules/admin/src/main/java/com/fire/admin/rest/FlowAppInfoController.java
  22. 20 9
      modules/admin/src/main/java/com/fire/admin/rest/TestController.java
  23. 40 0
      modules/admin/src/main/java/com/fire/admin/service/CustomerProductInfoService.java
  24. 20 0
      modules/admin/src/main/java/com/fire/admin/service/CustomerService.java
  25. 11 1
      modules/admin/src/main/java/com/fire/admin/service/FireProductService.java
  26. 82 1
      modules/admin/src/main/java/com/fire/admin/service/impl/CustomerProductInfoServiceImpl.java
  27. 48 5
      modules/admin/src/main/java/com/fire/admin/service/impl/CustomerServiceImpl.java
  28. 91 18
      modules/admin/src/main/java/com/fire/admin/service/impl/FireProductServiceImpl.java
  29. 1 1
      modules/admin/src/main/java/com/fire/admin/service/impl/FlowAppInfoServiceImpl.java
  30. 92 0
      modules/admin/src/main/java/com/fire/admin/util/AliyunOSSUtil.java
  31. 3 3
      modules/admin/src/main/java/com/fire/admin/vo/CustomerInfoVo.java
  32. 9 1
      modules/admin/src/main/java/com/fire/admin/vo/CustomerProductInfoVo.java
  33. 2 2
      modules/admin/src/main/java/com/fire/admin/vo/FireProductInfoVo.java
  34. 1 2
      modules/admin/src/main/java/com/fire/admin/vo/FlowAppInfoVo.java
  35. 18 1
      modules/admin/src/main/resources/bootstrap.yml
  36. 4 34
      modules/admin/src/main/resources/mapper/CustomerMapper.xml
  37. 7 3
      modules/admin/src/main/resources/mapper/CustomerProductInfoMapper.xml
  38. 1 0
      modules/admin/src/main/resources/mapper/FireProductMapper.xml
  39. 2 1
      modules/admin/src/main/resources/mapper/FlowAppInfoMapper.xml
  40. 19 15
      modules/distribution/src/main/java/com/fire/dist/consumer/RocketOrderConsumer.java
  41. 5 0
      modules/distribution/src/main/java/com/fire/dist/data/DataPool.java
  42. 23 0
      modules/distribution/src/main/java/com/fire/dist/mapper/ChannelGroupMapper.java
  43. 23 0
      modules/distribution/src/main/java/com/fire/dist/mapper/ChannelInfoMapper.java
  44. 23 0
      modules/distribution/src/main/java/com/fire/dist/mapper/ChannelProductInfoMapper.java
  45. 22 0
      modules/distribution/src/main/java/com/fire/dist/mapper/DistributeGroupMapper.java
  46. 4 0
      modules/distribution/src/main/java/com/fire/dist/service/CacheService.java
  47. 43 8
      modules/distribution/src/main/java/com/fire/dist/service/impl/CacheServiceImpl.java
  48. 51 8
      modules/distribution/src/main/java/com/fire/dist/service/impl/DistOrderServiceImpl.java
  49. 32 0
      modules/distribution/src/main/resources/mapper/ChannelGroupMapper.xml
  50. 70 0
      modules/distribution/src/main/resources/mapper/ChannelInfoMapper.xml
  51. 38 0
      modules/distribution/src/main/resources/mapper/ChannelProductInfoMapper.xml
  52. 42 0
      modules/distribution/src/main/resources/mapper/DistributeGroupMapper.xml
  53. 3 1
      modules/distribution/src/main/resources/mapper/FlowAppInfoMapper.xml
  54. 1 0
      modules/make-order/src/main/java/com/fire/order/service/impl/CacheServiceImpl.java
  55. 1 1
      modules/make-order/src/main/java/com/fire/order/service/impl/MakeOrderServiceImpl.java
  56. 3 4
      modules/make-order/src/main/resources/mapper/CustomerProductMapper.xml
  57. 6 1
      pom.xml

+ 7 - 1
common/fire-dto/src/main/java/com/fire/dto/ChannelGroup.java

@@ -1,6 +1,7 @@
 package com.fire.dto;
 
 import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -8,6 +9,7 @@ import lombok.NoArgsConstructor;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author: admin
@@ -44,7 +46,11 @@ public class ChannelGroup {
     @TableLogic
     private Integer isDelete;
 
-    @ApiModelProperty("分发组")
     @TableField(exist = false)
     private List<DistributeGroup> distributeGroups;
+
+    @TableField(exist = false)
+    @JsonIgnoreProperties
+    @ApiModelProperty(value = "分发组map list", hidden = true)
+    private Map<Integer, List<DistributeGroup>> distributeGroupsMap;
 }

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

@@ -1,6 +1,11 @@
 package com.fire.dto;
 
 import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -8,6 +13,7 @@ import lombok.NoArgsConstructor;
 
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author: admin
@@ -21,7 +27,7 @@ import java.util.List;
 @TableName("access_channel_info")
 public class ChannelInfo {
 
-    @TableId(value = "channel_id", type = IdType.AUTO)
+    @TableId(value = "channel_id",type = IdType.AUTO)
     @ApiModelProperty("通道id")
     private Long channelId;
 
@@ -68,4 +74,13 @@ public class ChannelInfo {
     @TableField(exist = false)
     @ApiModelProperty("通道产品")
     private List<ChannelProductInfo> channelProductInfos;
+
+    @TableField(exist = false)
+    @ApiModelProperty(value = "分发组id", hidden = true)
+    private Integer distributeGroupId;
+
+    @TableField(exist = false)
+    @ApiModelProperty(value = "通道产品 根据通道id分第一层 根据区域分第二次 根据面额分第三层", hidden = true)
+    @JsonIgnoreProperties
+    Map<String, Map<Long, List<ChannelProductInfo>>> productListMap;
 }

+ 5 - 0
common/fire-dto/src/main/java/com/fire/dto/ChannelProductInfo.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -55,4 +56,8 @@ public class ChannelProductInfo {
 
     @TableField(exist = false)
     private ChannelInfo channelInfo;
+
+    @TableField(exist = false)
+    @ApiModelProperty("省级行政编码")
+    private String areaNum;
 }

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

@@ -46,7 +46,7 @@ public class CustomerInfo {
     @ApiModelProperty(value = "联系人地址")
     private String address;
 
-    @ApiModelProperty(value = "状态, 1:有效2:无效 3:暂停")
+    @ApiModelProperty(value = "状态,1:正常 2:暂停")
     private Integer status;
 
     @ApiModelProperty(value = "帐号余额")
@@ -61,6 +61,7 @@ public class CustomerInfo {
     @ApiModelProperty(value = "是否第一次登录,1:不是0:是")
     private Integer isFirstLogin;
 
+
     @ApiModelProperty(value = "删除标识,1:已删除0:未删除")
     private Integer isDeleted;
 

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

@@ -5,7 +5,10 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
 import lombok.Data;
+import lombok.NoArgsConstructor;
 
 import java.math.BigDecimal;
 
@@ -18,6 +21,9 @@ import java.math.BigDecimal;
 @Data
 @ApiModel(value = "客户产品表实体")
 @TableName("customer_product")
+@Builder
+@AllArgsConstructor
+@NoArgsConstructor
 public class CustomerProduct {
 
     @ApiModelProperty(value = "主键")
@@ -43,7 +49,7 @@ public class CustomerProduct {
     private Integer facePrice;
 
     @ApiModelProperty(value = "是否有效 (1:有效 0:无效)")
-    private Integer isValid;
+    private Integer isEffective;
 
     @ApiModelProperty(value = "客户结算价格折扣")
     private BigDecimal disCount;

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

@@ -1,9 +1,6 @@
 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;
@@ -11,6 +8,7 @@ import lombok.NoArgsConstructor;
 import lombok.ToString;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * @author: admin
@@ -27,7 +25,7 @@ public class DistributeGroup {
 
     @TableId(type = IdType.AUTO)
     @ApiModelProperty("主键")
-    private Integer id;
+    private Integer distributeGroupId;
 
     @ApiModelProperty("分发组名称")
     private String name;
@@ -63,4 +61,11 @@ public class DistributeGroup {
     @TableLogic
     private Integer isDelete;
 
+    @TableField(exist = false)
+    @ApiModelProperty("通道组列表")
+    private List<ChannelGroup> channelGroups;
+
+    @TableField(exist = false)
+    @ApiModelProperty("通道组列表")
+    private List<ChannelInfo> channelInfos;
 }

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

@@ -8,9 +8,8 @@ import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.*;
 import lombok.experimental.Accessors;
-
 import java.math.BigDecimal;
-import java.math.BigInteger;
+
 
 
 /**

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

@@ -41,7 +41,7 @@ public class FlowAppInfo {
     @ApiModelProperty(value = "结束日期")
     private String endDate;
 
-    @ApiModelProperty(value = "1-有效 2-暂停 3-无效")
+    @ApiModelProperty(value = "0-无效 1-有效")
     private Integer status;
 
     @ApiModelProperty(value = "APP名称")
@@ -63,7 +63,7 @@ public class FlowAppInfo {
     private Integer time;
 
     @ApiModelProperty(value = "通道ID(关联的通道组id)")
-    private  Integer channelId;
+    private  Long channelId;
 
     /********************************扩展字段***********************************/
     @ApiModelProperty(value = "客户基本信息")

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

@@ -11,7 +11,7 @@ import lombok.Data;
 public class MobileFlowDispatchRec {
 
     @ApiModelProperty(value = "分发ID号")
-    private String recId;
+    private Long recId;
 
     @ApiModelProperty(value = "分发订单号")
     private String orderId;

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

@@ -5,6 +5,7 @@ public enum RedisKey {
     //系统
     ORDER_ID_INCR("order.id.incr", "自增订单id"),
     ORDER_INFO("order.info", "订单详情"),
+    CHILD_ORDER_INFO("child.order.info", "子订单详情"),
     CUSTOMER_AMOUNT("{customer.amount}", "客户金额"),
     SUPPLIER_AMOUNT("{supplier.amount}", "供应商金额"),
     ORDER_DOWN("{down.order}", "客户下单号 非订单号"),

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

@@ -32,6 +32,7 @@ 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;

+ 4 - 1
modules/admin/pom.xml

@@ -72,7 +72,10 @@
             <artifactId>activation</artifactId>
         </dependency>
 
-
+        <dependency>
+            <groupId>com.aliyun.oss</groupId>
+            <artifactId>aliyun-sdk-oss</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

+ 25 - 0
modules/admin/src/main/java/com/fire/admin/dto/ConstantProperties.java

@@ -0,0 +1,25 @@
+package com.fire.admin.dto;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author: liuliu
+ * @ClassName: ConstantProperties
+ * @Description: TODO
+ * @date: 2021-06-02 11:56
+ */
+@Component
+@Data
+@ConfigurationProperties(prefix = "oos")
+public class ConstantProperties {
+
+    private String endpoint;
+    private String keyid;
+    private String keysecret;
+    private String bucketname;
+    private String filehost;
+    private String finalUrl;
+
+}

+ 7 - 4
modules/admin/src/main/java/com/fire/admin/dto/CustomerDto.java

@@ -40,21 +40,22 @@ public class CustomerDto {
     @ApiModelProperty(value = "联系人地址")
     private String address;
 
-    @ApiModelProperty(value = "状态, 1:有效2:无效 3:暂停")
+    @ApiModelProperty(value = "状态,1:正常 2:暂停")
     private Integer status;
 
     @ApiModelProperty(value = "帐号余额")
-    private BigInteger balance;
+    private Long balance;
 
     @ApiModelProperty(value = "授信额度")
-    private BigInteger  creditAmount;
+    private Long  creditAmount;
 
     @ApiModelProperty(value = "当前费用")
-    private BigInteger currentAmount;
+    private Long currentAmount;
 
     @ApiModelProperty(value = "是否第一次登录,1:不是0:是")
     private Integer isFirstLogin;
 
+
     @ApiModelProperty(value = "删除标识,1:已删除0:未删除")
     private Integer isDeleted;
 
@@ -79,4 +80,6 @@ public class CustomerDto {
     @ApiModelProperty(value = "价格校验")
     private Integer priceCheck;
 
+
+
 }

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

@@ -16,6 +16,8 @@ import java.math.BigInteger;
 @Builder
 public class CustomerProductDto {
 
+ private Integer customerProductId;
+
    @ApiModelProperty(value = "客户ID")
     private Long customerId;
 
@@ -53,7 +55,7 @@ public class CustomerProductDto {
     private Integer operator;
 
     @ApiModelProperty(value = "是否有效 (1:有效 0:无效)")
-    private Integer isValid;
+    private Integer isEffective;
 
 
 

+ 4 - 0
modules/admin/src/main/java/com/fire/admin/dto/FireProductInfoDto.java

@@ -3,8 +3,10 @@ package com.fire.admin.dto;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
 
 import java.math.BigDecimal;
 import java.math.BigInteger;
@@ -17,6 +19,8 @@ import java.math.BigInteger;
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
+@AllArgsConstructor
+@NoArgsConstructor
 public class FireProductInfoDto {
 
 

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

@@ -21,7 +21,7 @@ public class FlowAppInfoDto {
     @ApiModelProperty(value = "应用Key")
     private String appKey;
 
-    @ApiModelProperty(value = "1-有效 2-暂停 3-无效")
+    @ApiModelProperty(value = "0-无效 1-有效")
     private Integer status;
 
     @ApiModelProperty(value = "APP名称")
@@ -43,6 +43,6 @@ public class FlowAppInfoDto {
     private Integer time;
 
     @ApiModelProperty(value = "通道ID(关联的通道组id)")
-    private  Integer channelId;
+    private  Long channelId;
 
 }

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

@@ -36,9 +36,25 @@ public class CustomerController {
 
     @ApiOperation(value = "客户新增")
     @PostMapping("/add")
-    public BaseResponse makeAddCustomerInfo(@RequestBody CustomerDto customerDto){
+    public BaseResponse makeAddCustomerInfo(@RequestBody CustomerDto customerDto) {
         customerService.insertCustomer(customerDto);
         return new BaseResponse();
     }
 
+/*    @ApiOperation("客户逻辑删除")
+    @PutMapping("/del/{customerId}")
+    public BaseResponse delCustomerInfo(@PathVariable Long customerId) {
+        customerService.deleteCustomerInfo(customerId);
+        return new BaseResponse();
+    }*/
+
+
+    @ApiOperation("客户修改(包含逻辑删除)")
+    @PutMapping("/update")
+    public BaseResponse updCustomer(@RequestBody CustomerDto customerDto) {
+        customerService.updateCustomerInfo(customerDto);
+        return new BaseResponse();
+    }
+
+
 }

+ 28 - 3
modules/admin/src/main/java/com/fire/admin/rest/CustomerProductInfoController.java

@@ -1,13 +1,15 @@
 package com.fire.admin.rest;
 
+import com.fire.admin.dto.CustomerProductDto;
 import com.fire.admin.service.CustomerProductInfoService;
+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.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
 
 /**
  * @author: liuliu
@@ -34,4 +36,27 @@ public class CustomerProductInfoController {
     public BaseRestResponse getCustomerProductInfo(Integer customerId, Integer type){
         return new BaseRestResponse<>(customerProductInfoService.getCustomerProductByCustomerId(customerId,type));
     }
+
+
+    @ApiOperation(value = "客户产品物理删除")
+    @DeleteMapping("/{customerProductId}")
+    public BaseResponse delCustomerProduct(@PathVariable("customerProductId") Integer customerProductId){
+        customerProductInfoService.deleteCustomerProduct(customerProductId);
+        return new BaseResponse();
+    }
+
+    @ApiOperation(value = "客户产品置无效")
+    @PutMapping("/{customerProductId}")
+    public BaseResponse makeValidCustomerProduct(@PathVariable("customerProductId" ) Integer customerProductId){
+        customerProductInfoService.validCustomerProduct(customerProductId);
+        return new BaseResponse();
+    }
+
+
+    @ApiOperation(value = "客户产品新增或修改")
+    @PostMapping("/add")
+    public  BaseRestResponse upAddCustomerProduct(@RequestBody List<CustomerProductDto> list){
+        customerProductInfoService.saveOrUpdate(list);
+        return new BaseRestResponse();
+    }
 }

+ 16 - 4
modules/admin/src/main/java/com/fire/admin/rest/FireProductController.java

@@ -78,13 +78,21 @@ public class FireProductController {
      * @Author: liuliu
      * @Date: 2021/5/26 11:10
      */
-    @ApiOperation(value = "修改产品信息(和逻辑删除)")
+    @ApiOperation(value = "修改产品信息")
     @PutMapping
     public BaseRestResponse updateProductInfo(@RequestBody FireProductInfoDto fireProductInfoDto) {
         return new BaseRestResponse<>(fireProductService.updateProductInfo(fireProductInfoDto));
     }
 
 
+
+    @ApiOperation(value = "删除产品")
+    @PutMapping("/del/{productId}")
+    public BaseResponse delProductInfo(@PathVariable Integer productId){
+        fireProductService.deleteProductByProductId(productId);
+        return new BaseResponse();
+    }
+
     /**
      * @Description:  TODO 获取所有的产品,用于客户和通道添加
      * @Param:
@@ -93,9 +101,13 @@ public class FireProductController {
      * @Date: 2021/5/28 17:51
      */
     @ApiOperation(value = "获取所有产品,用于通道和客户产品的添加")
-    @GetMapping("/all/{operator}")
-    public BaseRestResponse makeProductAll( @PathVariable("operator") Integer operator ) {
-        return new BaseRestResponse<>(fireProductService.getProductAll(operator));
+    @GetMapping("/all/{operator}/{customerId}")
+    public BaseRestResponse makeProductAll( @PathVariable("operator") Integer operator,@PathVariable("customerId") Integer customerId ) {
+        return new BaseRestResponse<>(fireProductService.getProductAll(operator,customerId));
     }
 
+
+
+
+
 }

+ 9 - 5
modules/admin/src/main/java/com/fire/admin/rest/FlowAppInfoController.java

@@ -1,14 +1,14 @@
 package com.fire.admin.rest;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fire.admin.dto.FlowAppInfoDto;
 import com.fire.admin.service.FlowAppInfoService;
+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.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * @author: liuliu
@@ -35,8 +35,12 @@ public class FlowAppInfoController {
     }
 
 
-
-
+    @ApiOperation("修改客户接入信息")
+    @PutMapping
+    public BaseResponse updFlowAppInfo(@RequestBody FlowAppInfoDto flowAppInfoDto) {
+        flowAppInfoService.updateFlowAppInfo(flowAppInfoDto);
+        return new BaseResponse();
+    }
 
 
 }

+ 20 - 9
modules/admin/src/main/java/com/fire/admin/rest/TestController.java

@@ -3,13 +3,17 @@ package com.fire.admin.rest;
 import cn.hutool.core.util.RandomUtil;
 import com.fire.admin.dto.CustomerProductDto;
 import com.fire.admin.mapper.CustomerProductInfoMapper;
+import com.fire.admin.util.AliyunOSSUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import lombok.SneakyThrows;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest;
 
+import java.io.File;
+import java.io.IOException;
 import java.util.List;
 
 /**
@@ -25,20 +29,27 @@ public class TestController {
 
 
     @Autowired
-   private CustomerProductInfoMapper customerProductMapper;
-
+    private CustomerProductInfoMapper customerProductMapper;
 
 
+    @Autowired
+    private AliyunOSSUtil aliyunOSSUtil;
 
+    @CrossOrigin
+    @ApiOperation("文件上传测试")
+    @PostMapping("/1")
+    public String testUpload(MultipartFile file) {
+        return aliyunOSSUtil.upload2(file);
+    }
 
 
 
     public static void main(String[] args) {
-        int i = RandomUtil.randomInt();
-        String string = RandomUtil.randomString(32);
 
-        System.out.println("i = " + i);
-        System.out.println("string = " + string);
+
     }
 
 }
+
+
+

+ 40 - 0
modules/admin/src/main/java/com/fire/admin/service/CustomerProductInfoService.java

@@ -1,6 +1,7 @@
 package com.fire.admin.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fire.admin.dto.CustomerProductDto;
 import com.fire.admin.vo.CustomerProductInfoVo;
 import com.fire.dto.CustomerProduct;
 
@@ -24,4 +25,43 @@ public interface CustomerProductInfoService extends IService<CustomerProduct> {
     */
     List<CustomerProductInfoVo> getCustomerProductByCustomerId(Integer customerId, Integer type);
 
+
+    /**
+    * @Description:  TODO  删除客户产品
+    * @Param:  客户产品主键
+    * @return: void
+    * @Author: liuliu
+    * @Date: 2021/6/1 11:02
+    */
+    void deleteCustomerProduct(Integer customerProductId);
+
+    /**
+    * @Description:  TODO  把客户单个产品置无效
+    * @Param:
+    * @return:
+    * @Author: liuliu
+    * @Date: 2021/6/1 11:46
+    */
+    void validCustomerProduct(Integer customerProductId);
+
+    
+    /**
+    * @Description:  TODO  批量新增或者修改客户产品
+    * @Param: [productDtoList]
+    * @return: boolean
+    * @Author: liuliu
+    * @Date: 2021/6/1 12:24
+    */
+    void saveOrUpdate(List<CustomerProductDto> productDtoList);
+
+
+    /**
+    * @Description:  TODO  获取当前客户的所有产品,用于做过滤条件
+    * @Param: [customerId]
+    * @return: java.util.List<com.fire.dto.CustomerProduct>
+    * @Author: liuliu
+    * @Date: 2021/6/1 14:57
+    */
+    List<String> getCuProByCustomerId(Integer customerId,String packageId);
+
 }

+ 20 - 0
modules/admin/src/main/java/com/fire/admin/service/CustomerService.java

@@ -34,4 +34,24 @@ public interface CustomerService extends IService<CustomerInfo> {
     void  insertCustomer(CustomerDto customerDto);
     
 
+
+    /**
+    * @Description:  TODO 逻辑删除客户信息
+    * @Param:
+    * @return:
+    * @Author: liuliu
+    * @Date: 2021/5/31 14:09
+    */
+    void deleteCustomerInfo(Long customerId);
+
+
+    /**
+    * @Description:  TODO 客户修改
+    * @Param: [customerDto]
+    * @return: void
+    * @Author: liuliu
+    * @Date: 2021/5/31 18:03
+    */
+    void updateCustomerInfo(CustomerDto customerDto);
+    
 }

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

@@ -63,5 +63,15 @@ public interface FireProductService extends IService<FireProductInfo> {
     * @Author: liuliu
     * @Date: 2021/5/28 17:48
     */
-    List<FireProductInfoVo> getProductAll(Integer operator);
+    List<FireProductInfoVo> getProductAll(Integer operator,Integer customerId);
+    
+    /**
+    * @Description:  TODO 逻辑删除产品
+    * @Param: [productId]
+    * @return: void
+    * @Author: liuliu
+    * @Date: 2021/5/31 11:29
+    */
+    void deleteProductByProductId(Integer productId);
+    
 }

+ 82 - 1
modules/admin/src/main/java/com/fire/admin/service/impl/CustomerProductInfoServiceImpl.java

@@ -1,15 +1,19 @@
 package com.fire.admin.service.impl;
 
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+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.dto.CustomerProduct;
+import com.google.common.collect.Lists;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * @author: liuliu
@@ -32,4 +36,81 @@ public class CustomerProductInfoServiceImpl extends ServiceImpl<CustomerProductI
     public List<CustomerProductInfoVo> getCustomerProductByCustomerId(Integer customerId, Integer type) {
         return baseMapper.queryCustomerProductByCustomerId(customerId, type);
     }
+
+    /**
+     * @Description: TODO 客户产品删除
+     * @Param: 客户产品id
+     * @return:
+     * @Author: liuliu
+     * @Date: 2021/6/1 11:02
+     */
+    @Override
+    public void deleteCustomerProduct(Integer customerProductId) {
+        int i = baseMapper.deleteById(customerProductId);
+        if (i > 0) {
+            log.info("-------------------------------- 客户产品删除成功,客户产品编号为:【{}】 ----------------------------------", customerProductId);
+            // TODO 发送消息到客户产品topic
+        }
+
+    }
+
+    /**
+    * @Description:  TODO 把客户单个产品置无效
+    * @Param: [customerProductId]
+    * @return: void
+    * @Author: liuliu
+    * @Date: 2021/6/1 11:47
+    */
+    @Override
+    public void validCustomerProduct(Integer customerProductId) {
+        CustomerProduct product = CustomerProduct.builder().customerProductId(customerProductId)
+                .isEffective(0).build();
+        int count = baseMapper.updateById(product);
+        if (count> 0) {
+            log.info("-------------------------------- 客户产品置无效成功,客户产品编号为:【{}】 ----------------------------------", customerProductId);
+            // TODO 发送消息到客户产品topic
+        }
+    }
+
+    /**
+    * @Description:  TODO  批量修改和删除客户产品对象
+    * @Param: [productDtoList]
+    * @return: boolean
+    * @Author: liuliu
+    * @Date: 2021/6/1 12:25
+    */
+    @Override
+    public void saveOrUpdate(List<CustomerProductDto> productDtoList) {
+
+        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(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
+
+        }
+
+    }
+
+    @Override
+    public List<String> getCuProByCustomerId(Integer customerId,String packageId) {
+
+        LambdaQueryWrapper<CustomerProduct> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.select(CustomerProduct::getCustomerProductId,CustomerProduct::getPackageId)
+                .eq(CustomerProduct::getCustomerId,customerId)
+                .like(CustomerProduct::getPackageId,packageId);
+        List<CustomerProduct> productList = baseMapper.selectList(queryWrapper);
+        return productList.stream().map(CustomerProduct::getPackageId).collect(Collectors.toList());
+    }
 }

+ 48 - 5
modules/admin/src/main/java/com/fire/admin/service/impl/CustomerServiceImpl.java

@@ -16,6 +16,7 @@ import com.fire.utils.date.DateUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import redis.clients.jedis.JedisCluster;
 
 import javax.annotation.Resource;
@@ -59,12 +60,13 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, CustomerInf
      * @Author: liuliu
      * @Date: 2021/5/21 15:14
      */
+    @Transactional(rollbackFor = Exception.class)
     @Override
     public void insertCustomer(CustomerDto customerDto) {
         // TODO   新增客户
         CustomerInfo customerInfo = CustomerInfo.builder().partnerId(customerDto.getPartnerId())
-                .customerName(customerDto.getCustomerName())
-                .shorterName(customerDto.getShorterName())
+                .customerName(customerDto.getCustomerName().trim())
+                .shorterName(customerDto.getShorterName().trim())
                 .linkmanName(customerDto.getLinkmanName())
                 .linkmanMobile(customerDto.getLinkmanMobile())
                 .linkmanEmail(customerDto.getLinkmanEmail())
@@ -72,8 +74,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, CustomerInf
                 .status(1)
                 .isFirstLogin(0)
                 .isDeleted(0)
-                // .creator(SecurityUtil.getUser().getUsername())
-                .creator("唐僧")
+                .creator(SecurityUtil.getUser().getUsername())
                 .createTime(DateUtils.strformatDatetime(LocalDateTime.now()))
                 .partnerCommission(customerDto.getPartnerCommission())
                 .userId(customerDto.getUserId())
@@ -85,7 +86,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, CustomerInf
                 .appKey(RandomUtil.randomString(32))
                 .startDate(DateUtils.strformatDatetime(LocalDateTime.now()))
                 .status(1)
-                .appName(customerInfo.getCustomerName().concat("话费包接入"))
+                .appName(customerInfo.getCustomerName().concat("接入"))
                 .totalCount(1)
                 .time(7200).build();
         int count2 = flowAppMapper.insert(appInfo);
@@ -98,5 +99,47 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, CustomerInf
         jedisCluster.hset(CUSTOMER_AMOUNT.key(), CUSTOMER_AMOUNT.key().concat(customerInfo.getCustomerId().toString()), "0");
     }
 
+    /**
+     * @Description: TODO  逻辑删除客户信息
+     * @Param: [customerId]
+     * @return: void
+     * @Author: liuliu
+     * @Date: 2021/5/31 14:11
+     */
+    @Override
+    public void deleteCustomerInfo(Long customerId) {
+        CustomerInfo info = CustomerInfo.builder().customerId(customerId)
+                .isDeleted(1).build();
+        baseMapper.updateById(info);
+    }
+
+    @Override
+    public void updateCustomerInfo(CustomerDto customerDto) {
+        CustomerInfo customerInfo = CustomerInfo.builder().customerId(customerDto.getCustomerId())
+                .partnerId(customerDto.getPartnerId())
+                .customerName(customerDto.getCustomerName())
+                .shorterName(customerDto.getShorterName())
+                .linkmanName(customerDto.getLinkmanName())
+                .linkmanMobile(customerDto.getLinkmanMobile())
+                .linkmanEmail(customerDto.getLinkmanEmail())
+                .address(customerDto.getAddress())
+                .status(customerDto.getStatus())
+                .balance(customerDto.getBalance())
+                .creditAmount(customerDto.getCreditAmount())
+                .currentAmount(customerDto.getCurrentAmount())
+                .isFirstLogin(customerDto.getIsFirstLogin())
+                .isDeleted(customerDto.getIsDeleted())
+                .updator(SecurityUtil.getUser().getUsername())
+                .updateTime(DateUtils.strformatDatetime(LocalDateTime.now()))
+                .partnerCommission(customerDto.getPartnerCommission())
+                .priceCheck(customerDto.getPriceCheck()).build();
+
+        int count = baseMapper.updateById(customerInfo);
+        if(count>0){
+            log.info("------------------------- 客户修改成功,发送消息到相应的topic --------------------------------");
+        }
+
+    }
+
 
 }

+ 91 - 18
modules/admin/src/main/java/com/fire/admin/service/impl/FireProductServiceImpl.java

@@ -7,18 +7,24 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fire.admin.dto.FireProductInfoDto;
 import com.fire.admin.mapper.FireProductMapper;
+import com.fire.admin.service.CustomerProductInfoService;
 import com.fire.admin.service.FireProductService;
 import com.fire.admin.util.EnumUtils;
 import com.fire.admin.util.SecurityUtil;
 import com.fire.admin.vo.FireProductInfoVo;
 import com.fire.common.exception.BaseException;
+import com.fire.dto.CustomerProduct;
 import com.fire.dto.FireProductInfo;
 import com.fire.dto.enums.Status;
 import com.fire.utils.date.DateUtils;
+import com.google.common.collect.Lists;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+
 import java.time.LocalDateTime;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * @author: liuliu
@@ -31,6 +37,9 @@ import java.util.List;
 public class FireProductServiceImpl extends ServiceImpl<FireProductMapper, FireProductInfo> implements FireProductService {
 
 
+    @Autowired
+    private CustomerProductInfoService customerProductInfoService;
+
     /***
      * @Description: TODO 分页获取产品对象
      * @Param: [page, fireProductInfoDto]
@@ -53,18 +62,18 @@ public class FireProductServiceImpl extends ServiceImpl<FireProductMapper, FireP
     @Override
     public void insertProductInfo(FireProductInfoDto fireProductInfoDto) {
         String packageId = fireProductInfoDto.getPackageId();
-        if(!fireProductInfoDto.getAreaName().equals("全国")){
-            packageId=packageId.concat("_").concat(EnumUtils.convert(fireProductInfoDto.getAreaName()));
+        if (!fireProductInfoDto.getAreaName().equals("全国")) {
+            packageId = packageId.concat("_").concat(EnumUtils.convert(fireProductInfoDto.getAreaName()));
         }
 
         LambdaQueryWrapper<FireProductInfo> query = new LambdaQueryWrapper<FireProductInfo>();
-        query.select(FireProductInfo::getPackageId,FireProductInfo::getProductId)
-                .eq(FireProductInfo::getPackageId,packageId).
-                eq(FireProductInfo::getIsDelete,0);
+        query.select(FireProductInfo::getPackageId, FireProductInfo::getProductId)
+                .eq(FireProductInfo::getPackageId, packageId).
+                eq(FireProductInfo::getIsDelete, 0);
 
         List<FireProductInfo> productInfos = baseMapper.selectList(query);
 
-        if(ObjectUtil.hasEmpty(productInfos)){
+        if (ObjectUtil.hasEmpty(productInfos)) {
             FireProductInfo productInfo = FireProductInfo.builder().packageId(packageId)
                     .productName(fireProductInfoDto.getProductName())
                     .productType(fireProductInfoDto.getProductType())
@@ -76,13 +85,13 @@ public class FireProductServiceImpl extends ServiceImpl<FireProductMapper, FireP
                     .operator(fireProductInfoDto.getOperator()).build();
 
             log.info("新增产品,产品适用于客户和通道。产品信息为:【{}】", productInfo.toString());
-            int count =baseMapper.insert(productInfo);
-            if (count>0) {
+            int count = baseMapper.insert(productInfo);
+            if (count > 0) {
                 // TODO 发送消息到 产品的 TOPIC
             }
-        }else {
+        } else {
             log.info("--------  产品信息已经存在,添加产品失败 -----------------");
-            throw new BaseException(Status.RECORDING_EXISTS.status(),Status.RECORDING_EXISTS.message());
+            throw new BaseException(Status.RECORDING_EXISTS.status(), Status.RECORDING_EXISTS.message());
         }
 
     }
@@ -126,10 +135,22 @@ public class FireProductServiceImpl extends ServiceImpl<FireProductMapper, FireP
     public boolean updateProductInfo(FireProductInfoDto fireProductInfoDto) {
 
         String packageId = fireProductInfoDto.getPackageId();
-        if(!fireProductInfoDto.getAreaName().equals("全国")){
-            packageId=packageId.concat("_").concat(EnumUtils.convert(fireProductInfoDto.getAreaName()));
+        if (packageId.contains("_")) {
+            packageId = packageId.substring(0, fireProductInfoDto.getPackageId().indexOf("_"));
+        }
+        if (!fireProductInfoDto.getAreaName().equals("全国")) {
+            packageId = packageId.concat("_").concat(EnumUtils.convert(fireProductInfoDto.getAreaName()));
+        }
+
+        LambdaQueryWrapper<FireProductInfo> query = new LambdaQueryWrapper<FireProductInfo>();
+        query.select(FireProductInfo::getPackageId, FireProductInfo::getProductId)
+                .eq(FireProductInfo::getPackageId, packageId)
+                .eq(FireProductInfo::getIsDelete, 0);
+        FireProductInfo info = baseMapper.selectOne(query);
+        if (!ObjectUtil.hasEmpty(info)) {
+            log.info("--------  产品已经存在,修改产品失败 -----------------");
+            throw new BaseException(Status.RECORDING_EXISTS.status(), Status.RECORDING_EXISTS.message());
         }
-        
         FireProductInfo productInfo = FireProductInfo.builder()
                 .productId(fireProductInfoDto.getProductId())
                 .packageId(packageId)
@@ -144,8 +165,8 @@ public class FireProductServiceImpl extends ServiceImpl<FireProductMapper, FireP
                 .operator(fireProductInfoDto.getOperator()).build();
 
         log.info("产品修改的对象为:【{}】", productInfo.toString());
-       boolean flag=this.saveOrUpdate(productInfo);
-        if (flag ) {
+        boolean flag = this.saveOrUpdate(productInfo);
+        if (flag) {
             //  TODO 发送消息到topic
         }
         return flag;
@@ -153,15 +174,67 @@ public class FireProductServiceImpl extends ServiceImpl<FireProductMapper, FireP
 
 
     /**
-     * @Description:  TODO 获取所有的产品,用于客户和通道添加
+     * @Description: TODO 获取所有的产品,用于客户和通道添加
      * @Param:
      * @return:
      * @Author: liuliu
      * @Date: 2021/5/28 17:49
      */
     @Override
-    public List<FireProductInfoVo> getProductAll(Integer operator) {
-        return baseMapper.selectProductAll(operator);
+    public List<FireProductInfoVo> getProductAll(Integer operator, Integer customerId) {
+
+        // TODO  构建返回的对象
+        List<FireProductInfoVo> ProductVolist = Lists.newArrayList();
+        // TODO 首先获取所有的产品
+        List<FireProductInfoVo> fireProductInfoVos = baseMapper.selectProductAll(operator);
+        log.info("所有产品的个数:【{}】", fireProductInfoVos.size());
+        List<String> packageList = customerProductInfoService.getCuProByCustomerId(customerId, this.getOpertor(operator));
+        log.info("客户已经有的产品个数:【{}】", packageList.size());
+        if (!ObjectUtil.hasEmpty(packageList)) {
+            List<FireProductInfoVo> list = fireProductInfoVos.stream().filter((FireProductInfoVo pro) -> packageList.contains(pro.getPackageId()) == false).collect(Collectors.toList());
+            ProductVolist.addAll(list);
+        } else {
+            ProductVolist.addAll(fireProductInfoVos);
+        }
+        log.info("客户最终返回的产品个数为:【{}】", ProductVolist.size());
+        return ProductVolist;
+    }
+
+
+    /**
+     * @Description: TODO 根据运营商编号获取构建 packageId 前缀
+     * @Param: [operator]
+     * @return: java.lang.String
+     * @Author: liuliu
+     * @Date: 2021/6/1 15:57
+     */
+    public String getOpertor(int operator) {
+        switch (operator) {
+            case 1:
+                return "YDHF";
+            case 2:
+                return "DXHF";
+            case 3:
+                return "LTHF";
+            default:
+                throw new BaseException(Status.PACKAGEERROR.status(), Status.PACKAGEERROR.message());
+        }
+
+    }
+
+    /**
+     * @Description: TODO 逻辑删除产品
+     * @Param: [productId]
+     * @return: void
+     * @Author: liuliu
+     * @Date: 2021/5/31 11:13
+     */
+    @Override
+    public void deleteProductByProductId(Integer productId) {
+        FireProductInfo productInfo = FireProductInfo.builder().productId(productId)
+                .isDelete(1).build();
+        baseMapper.updateById(productInfo);
+
     }
 
 

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

@@ -55,7 +55,7 @@ public class FlowAppInfoServiceImpl extends ServiceImpl<FlowAppMapper, FlowAppIn
                 .totalCount(flowAppInfoDto.getTotalCount())
                 .time(flowAppInfoDto.getTime())
                 .channelId(flowAppInfoDto.getChannelId()).build();
-        int count = baseMapper.insert(appInfo);
+        int count = baseMapper.updateById(appInfo);
         if(count>0){
             log.info("客户接入信息修改,修改信息为:【{}】",appInfo.toString());
             // TODO 发送消息到 客户接入 topic

+ 92 - 0
modules/admin/src/main/java/com/fire/admin/util/AliyunOSSUtil.java

@@ -0,0 +1,92 @@
+package com.fire.admin.util;
+
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.RandomUtil;
+import com.aliyun.oss.*;
+import com.aliyun.oss.model.CannedAccessControlList;
+import com.aliyun.oss.model.CreateBucketRequest;
+import com.aliyun.oss.model.PutObjectRequest;
+import com.aliyun.oss.model.PutObjectResult;
+import com.fire.admin.dto.ConstantProperties;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+import java.io.*;
+
+
+/**
+ * @author: liuliu
+ * @ClassName: AliyunOSSUtil
+ * @Description: TODO 阿里云 OSSUtil
+ * @date: 2021-06-02 11:55
+ */
+@Service
+@Slf4j
+public class AliyunOSSUtil {
+
+    @Resource
+    private ConstantProperties constantProperties;
+
+
+
+    /**
+     * @Description: TODO  阿里云oss 文件上传
+     * @Param: [file]
+     * @return: java.lang.String
+     * @Author: liuliu
+     * @Date: 2021/6/2 12:23
+     */
+    public String upload2(MultipartFile multipartFile) {
+        String endpoint = constantProperties.getEndpoint();
+        String accessKeyId = constantProperties.getKeyid();
+        String accessKeySecret = constantProperties.getKeysecret();
+        String bucketName = constantProperties.getBucketname();
+        String fileHost = constantProperties.getFilehost();
+        log.info("oss 配置信息为:【{}】", constantProperties.toString());
+        OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
+        try {
+            // TODO 假如容器不存在,就创建
+            if (!ossClient.doesBucketExist(bucketName)) {
+                ossClient.createBucket(bucketName);
+                CreateBucketRequest createBucketRequest = new CreateBucketRequest(bucketName);
+                createBucketRequest.setCannedACL(CannedAccessControlList.PublicRead);
+                ossClient.createBucket(createBucketRequest);
+            }
+            log.info("======= getOriginalFilename : {} ======",multipartFile.getOriginalFilename());
+            String fileUrl = fileHost.concat("/".concat(RandomUtil.randomString(16)).concat(multipartFile.getOriginalFilename()));
+
+            if (multipartFile.getSize() != 0 && ObjectUtil.isNotEmpty(multipartFile.getName())) {
+                //上传文件
+                PutObjectResult result = null;
+                try {
+                    result = ossClient.putObject(new PutObjectRequest(bucketName, fileUrl, multipartFile.getInputStream()));
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+                //设置权限 这里是公开读
+                ossClient.setBucketAcl(bucketName, CannedAccessControlList.PublicRead);
+                if (null != result) {
+                    log.info("==========>OSS文件上传成功,OSS地址:================>" + constantProperties.getFinalUrl().concat(fileUrl));
+                    return constantProperties.getFinalUrl().concat(fileUrl);
+                }
+            }
+
+        } catch (OSSException oe) {
+            log.error(oe.getMessage());
+        } catch (ClientException ce) {
+            log.error(ce.getMessage());
+        } finally {
+            //关闭
+            ossClient.shutdown();
+        }
+        return null;
+    }
+
+
+
+
+
+}

+ 3 - 3
modules/admin/src/main/java/com/fire/admin/vo/CustomerInfoVo.java

@@ -51,7 +51,7 @@ public class CustomerInfoVo {
     @ApiModelProperty(value = "联系人地址")
     private String address;
 
-    @ApiModelProperty(value = "状态, 1:有效2:无效 3:暂停")
+    @ApiModelProperty(value = "状态, 1:正常 2:暂停")
     private Integer status;
 
     @ApiModelProperty(value = "帐号余额")
@@ -114,8 +114,8 @@ public class CustomerInfoVo {
     @ApiModelProperty(value = "通道ID(关联的通道组id)")
     private  Integer channelId;
 
-       @ApiModelProperty(value = "客户接入的产品")
- private List<CustomerProductDto> customerProductList;
+    @ApiModelProperty(value = "价格校验")
+    private Integer priceCheck;
 
 
 }

+ 9 - 1
modules/admin/src/main/java/com/fire/admin/vo/CustomerProductInfoVo.java

@@ -1,8 +1,10 @@
 package com.fire.admin.vo;
 
+import com.baomidou.mybatisplus.annotation.TableId;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
+import java.math.BigDecimal;
 import java.math.BigInteger;
 
 /**
@@ -14,6 +16,9 @@ import java.math.BigInteger;
 @Data
 public class CustomerProductInfoVo {
 
+    @ApiModelProperty(value = "主键")
+    private Integer customerProductId;
+
     @ApiModelProperty(value = "客户ID")
     private Long customerId;
 
@@ -44,6 +49,9 @@ public class CustomerProductInfoVo {
     private Integer operator;
 
     @ApiModelProperty(value = "是否有效 (1:有效 0:无效)")
-    private Integer isValid;
+    private Integer isEffective;
+
+    @ApiModelProperty(value = "客户结算价格折扣")
+    private BigDecimal disCount;
 
 }

+ 2 - 2
modules/admin/src/main/java/com/fire/admin/vo/FireProductInfoVo.java

@@ -8,7 +8,7 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 
 import java.math.BigDecimal;
-import java.math.BigInteger;
+
 
 /**
  * @author: liuliu
@@ -19,8 +19,8 @@ import java.math.BigInteger;
 @Data
 @JsonInclude(JsonInclude.Include.NON_EMPTY)
 @Builder
-@AllArgsConstructor
 @NoArgsConstructor
+@AllArgsConstructor
 public class FireProductInfoVo   {
 
 

+ 1 - 2
modules/admin/src/main/java/com/fire/admin/vo/FlowAppInfoVo.java

@@ -14,7 +14,6 @@ import lombok.Data;
  * @date: 2021-05-25 17:59
  */
 @Data
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
 @Builder
 public class FlowAppInfoVo {
 
@@ -36,7 +35,7 @@ public class FlowAppInfoVo {
     @ApiModelProperty(value = "结束日期")
     private String endDate;
 
-    @ApiModelProperty(value = "1-有效 2-暂停 3-无效")
+    @ApiModelProperty(value = "0-无效 1-有效")
     private Integer status;
 
     @ApiModelProperty(value = "APP名称")

+ 18 - 1
modules/admin/src/main/resources/bootstrap.yml

@@ -27,6 +27,15 @@ spring:
         namespace: fire
         service: admin
 
+
+oos:
+  endpoint: http://oss-cn-chengdu.aliyuncs.com
+  keyid: LTAI4FyxwFmsGEESaa7tiB6z # 填写刚刚生成的AccessKey
+  keysecret: dG701ohwFU28pT84ZpEmIn7EcLOzzu  # 填写刚刚生成的Accesssecret
+  bucketname: bluefire # bucket名称
+  filehost: bluefire    #bucket下文件夹的路径
+  finalUrl: https://bluefire.oss-cn-chengdu.aliyuncs.com/
+
 ---
 server:
   port: 8082
@@ -49,4 +58,12 @@ spring:
       discovery:
         server-addr: 192.168.2.114:8848
         namespace: fire
-        service: admin
+        service: admin
+
+
+oos:
+  endpoint: http://oss-cn-chengdu.aliyuncs.com
+  keyid: LTAI4FyxwFmsGEESaa7tiB6z # 填写刚刚生成的AccessKey
+  keysecret: dG701ohwFU28pT84ZpEmIn7EcLOzzu  # 填写刚刚生成的Accesssecret
+  bucketname: bluefire # bucket名称
+  filehost: bluefire    #bucket下文件夹的路径

+ 4 - 34
modules/admin/src/main/resources/mapper/CustomerMapper.xml

@@ -57,42 +57,9 @@
         <result column="total_count" property="totalCount"/>
         <result column="time" property="time"/>
         <result column="channel_id" property="channelId"/>
+        <result column="price_check" property="priceCheck"/>
     </resultMap>
 
-    <resultMap id="ResultMapCustomer" type="com.fire.admin.vo.CustomerInfoVo">
-        <result column="customer_id" property="customerId"/>
-        <result column="partner_name" property="partnerName"/>
-        <result column="customer_name" property="customerName"/>
-        <result column="shorter_name" property="shorterName"/>
-        <result column="linkman_name" property="linkmanName"/>
-        <result column="linkman_mobile" property="linkmanMobile"/>
-        <result column="linkman_email" property="linkmanEmail"/>
-        <result column="address" property="address"/>
-        <result column="status" property="status"/>
-        <result column="balance" property="balance"/>
-        <result column="credit_amount" property="creditAmount"/>
-        <result column="current_amount" property="currentAmount"/>
-        <result column="creator" property="creator"/>
-        <result column="create_time" property="createTime"/>
-        <result column="updator" property="updator"/>
-        <result column="update_time" property="updateTime"/>
-        <result column="partner_commission" property="partnerCommission"/>
-        <result column="flow_app_id" property="flowAppId"/>
-        <result column="app_id" property="appId"/>
-        <result column="app_key" property="appKey"/>
-        <result column="start_date" property="startDate"/>
-        <result column="status" property="status"/>
-        <result column="callback_url" property="callbackUrl"/>
-        <result column="ip_address" property="ipAddress"/>
-        <result column="dispatch_channel" property="dispatchChannel"/>
-        <result column="total_count" property="totalCount"/>
-        <result column="time" property="time"/>
-        <result column="channel_id" property="channelId"/>
-        <collection property="customerProductList" ofType="com.fire.admin.dto.CustomerProductDto"
-                    select="com.fire.admin.mapper.CustomerProductInfoMapper.queryCustomerProductByCustomerId"
-                    column="{customerId=customerId,type=type}" >
-        </collection>
-    </resultMap>
 
     <sql id="selectCustomerInfoPage">
         c.customer_id ,
@@ -112,6 +79,7 @@
         c.updator,
         c.update_time,
         c.partner_commission,
+        c.price_check,
         app.flow_app_id,
         app.app_id,
         app.app_key,
@@ -136,7 +104,9 @@
             <if test="query.customerName !=null and query.customerName!='' ">
                 and c.customer_name LIKE CONCAT('%',#{query.customerName},'%')
             </if>
+                and c.is_deleted=0
         </where>
+        ORDER BY   c.create_time DESC
     </select>
 
 </mapper>

+ 7 - 3
modules/admin/src/main/resources/mapper/CustomerProductInfoMapper.xml

@@ -10,11 +10,12 @@
         <result column="type" property="type"/>
         <result column="price" property="price"/>
         <result column="face_price" property="facePrice"/>
-        <result column="is_valid" property="isValid"/>
+        <result column="is_effective" property="isEffective"/>
         <result column="discount" property="disCount"/>
     </resultMap>
 
     <resultMap id="ResultMap" type="com.fire.admin.vo.CustomerProductInfoVo">
+        <result column="customer_product_id" property="customerProductId"/>
         <result column="customer_id" property="customerId"/>
         <result column="package_id" property="packageId"/>
         <result column="product_name" property="productName"/>
@@ -23,10 +24,12 @@
         <result column="face_price" property="facePrice"/>
         <result column="area_name" property="areaName"/>
         <result column="operator" property="operator"/>
-        <result column="is_valid" property="isValid"/>
+        <result column="is_effective" property="isEffective"/>
+        <result column="discount" property="disCount"/>
     </resultMap>
 
     <sql id="selectCustomerProductByCustomerId" >
+        cp.customer_product_id,
         cp.customer_id,
         p.package_id,
         p.product_name,
@@ -35,7 +38,8 @@
         cp.face_price,
         p.area_name,
         p.operator,
-        cp.is_valid
+        cp.is_effective,
+        FORMAT(cp.discount * 100,2) as discount
     </sql>
 
     <select id="queryCustomerProductByCustomerId" resultMap="ResultMap">

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

@@ -76,6 +76,7 @@
 
     <select id="selectProductAll" resultMap="ResultMap">
         SELECT
+        product_id,
         package_id,
         product_name,
         product_price

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

@@ -61,8 +61,9 @@
             <if test="customerName !=null and customerName !=''">
                 AND cu.customer_name LIKE CONCAT('%',#{customerName},'%')
             </if>
+            and cu.is_deleted=0
         </where>
-
+        ORDER BY f.start_date DESC
     </select>
 
 </mapper>

+ 19 - 15
modules/distribution/src/main/java/com/fire/dist/consumer/RocketOrderConsumer.java

@@ -13,8 +13,8 @@ import org.springframework.cloud.context.config.annotation.RefreshScope;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
-import java.util.concurrent.atomic.AtomicInteger;
 
+import static com.fire.common.constants.RocketTags.MAKE_TAG;
 import static com.fire.common.constants.RocketTopic.ORDER_TOPIC;
 import static org.apache.rocketmq.spring.annotation.ConsumeMode.ORDERLY;
 
@@ -41,25 +41,29 @@ public class RocketOrderConsumer implements RocketMQListener<MessageExt> {
 
     @Override
     public void onMessage(MessageExt msg) {
+        String tag = msg.getTags();
+        //只消费tag为make的消息
+        if (MAKE_TAG.equals(tag)) {
+            if (sleepConsume) {
+                try {
+                    Thread.sleep(60000);
+                } catch (InterruptedException e) {
+                    log.info("线程sleep失败");
+                }
+                throw new BaseException("暂停消费");
+            }
+            String orderStr = new String(msg.getBody());
+            ObjectMapper om = new ObjectMapper();
 
-        if (sleepConsume) {
             try {
-                Thread.sleep(60000);
-            } catch (InterruptedException e) {
-                log.info("线程sleep失败");
+                FlowOrderInfo orderInfo = om.readValue(orderStr, FlowOrderInfo.class);
+                redisPriorityQueue.push(orderInfo.getOrderId(), orderStr);
+            } catch (Exception e) {
+                log.error("订单消息解析失败,消息体为:" + orderStr, e);
+                throw new BaseException("订单消息解析失败");
             }
-            throw new BaseException("暂停消费");
         }
-        String orderStr = new String(msg.getBody());
-        ObjectMapper om = new ObjectMapper();
 
-        try {
-            FlowOrderInfo orderInfo = om.readValue(orderStr, FlowOrderInfo.class);
-            redisPriorityQueue.push(orderInfo.getOrderId(), orderStr);
-        } catch (Exception e) {
-            log.error("订单消息解析失败,消息体为:" + orderStr, e);
-            throw new BaseException("订单消息解析失败");
-        }
 
     }
 

+ 5 - 0
modules/distribution/src/main/java/com/fire/dist/data/DataPool.java

@@ -1,5 +1,6 @@
 package com.fire.dist.data;
 
+import com.fire.dto.ChannelGroup;
 import com.fire.dto.FlowAppInfo;
 
 import java.util.HashMap;
@@ -17,5 +18,9 @@ public class DataPool {
      */
     public static Map<String, FlowAppInfo> flowAppInfoMap = new HashMap<>();
 
+    /**
+     * 通道信息
+     */
+    public static Map<Long, ChannelGroup> channelGroupMap = new HashMap<>();
 
 }

+ 23 - 0
modules/distribution/src/main/java/com/fire/dist/mapper/ChannelGroupMapper.java

@@ -0,0 +1,23 @@
+package com.fire.dist.mapper;
+
+import com.fire.dto.ChannelGroup;
+
+import java.util.List;
+
+/**
+ * 通道组表(AccessChannelGroup)表数据库访问层
+ *
+ * @author ZJQ  2021-06-02 10:22:22
+ */
+public interface ChannelGroupMapper {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @return 实例对象list
+     */
+    List<ChannelGroup> queryAll();
+
+
+}
+

+ 23 - 0
modules/distribution/src/main/java/com/fire/dist/mapper/ChannelInfoMapper.java

@@ -0,0 +1,23 @@
+package com.fire.dist.mapper;
+
+import com.fire.dto.ChannelInfo;
+
+import java.util.List;
+
+/**
+ * 通道表(AccessChannelInfo)表数据库访问层
+ *
+ * @author ZJQ  2021-06-01 18:29:09
+ */
+public interface ChannelInfoMapper {
+
+    /**
+     * 查询全部
+     *
+     * @return 实例对象list
+     */
+    List<ChannelInfo> queryAll();
+
+
+}
+

+ 23 - 0
modules/distribution/src/main/java/com/fire/dist/mapper/ChannelProductInfoMapper.java

@@ -0,0 +1,23 @@
+package com.fire.dist.mapper;
+
+import com.fire.dto.ChannelProductInfo;
+
+import java.util.List;
+
+/**
+ * 通道产品表(ChannelProductInfo)表数据库访问层
+ *
+ * @author ZJQ  2021-06-01 18:24:40
+ */
+public interface ChannelProductInfoMapper {
+
+    /**
+     * 查询所有
+     *
+     * @return 实例对象list
+     */
+    List<ChannelProductInfo> queryAll();
+
+
+}
+

+ 22 - 0
modules/distribution/src/main/java/com/fire/dist/mapper/DistributeGroupMapper.java

@@ -0,0 +1,22 @@
+package com.fire.dist.mapper;
+
+import com.fire.dto.DistributeGroup;
+
+import java.util.List;
+
+/**
+ * 分发组表(DistributeGroup)表数据库访问层
+ *
+ * @author ZJQ  2021-06-02 10:07:32
+ */
+public interface DistributeGroupMapper {
+
+    /**
+     * 查询所有
+     *
+     * @return 实例对象list
+     */
+    List<DistributeGroup> queryAll();
+
+}
+

+ 4 - 0
modules/distribution/src/main/java/com/fire/dist/service/CacheService.java

@@ -13,6 +13,10 @@ public interface CacheService {
      */
     void cacheCustomer();
 
+    /**
+     * 缓存通道信息
+     */
+    void cacheChannel();
 
 
 }

+ 43 - 8
modules/distribution/src/main/java/com/fire/dist/service/impl/CacheServiceImpl.java

@@ -3,16 +3,13 @@ package com.fire.dist.service.impl;
 
 import com.alibaba.nacos.common.utils.CollectionUtils;
 import com.fire.dist.data.DataPool;
-import com.fire.dist.mapper.CustomerInfoMapper;
-import com.fire.dist.mapper.CustomerProductMapper;
-import com.fire.dist.mapper.FlowAppInfoMapper;
+import com.fire.dist.mapper.*;
 import com.fire.dist.service.CacheService;
-import com.fire.dto.CustomerInfo;
-import com.fire.dto.CustomerProduct;
-import com.fire.dto.FlowAppInfo;
+import com.fire.dto.*;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -34,6 +31,18 @@ public class CacheServiceImpl implements CacheService {
     @Resource
     private CustomerProductMapper customerProductMapper;
 
+    @Resource
+    private ChannelProductInfoMapper channelProductInfoMapper;
+
+    @Resource
+    private ChannelInfoMapper channelInfoMapper;
+
+    @Resource
+    private DistributeGroupMapper distributeGroupMapper;
+
+    @Resource
+    private ChannelGroupMapper channelGroupMapper;
+
 
     /**
      * 缓存客户信息
@@ -67,9 +76,35 @@ public class CacheServiceImpl implements CacheService {
             //将接入信息list 转换为appId为key的map 如果存在重复key,以后出现的为准
             DataPool.flowAppInfoMap = appInfos.stream().collect(Collectors.toMap(FlowAppInfo::getAppId, a -> a, (k1, k2) -> k2));
         }
-
-
     }
 
+    /**
+     * 缓存通道信息
+     */
+    @Override
+    public void cacheChannel() {
+        List<ChannelProductInfo> productInfos = channelProductInfoMapper.queryAll();
+        List<ChannelInfo> channelInfos = channelInfoMapper.queryAll();
+        List<DistributeGroup> distributeGroups = distributeGroupMapper.queryAll();
+        List<ChannelGroup> channelGroups = channelGroupMapper.queryAll();
 
+        if (CollectionUtils.isNotEmpty(productInfos) && CollectionUtils.isNotEmpty(channelInfos) && CollectionUtils.isNotEmpty(distributeGroups) && CollectionUtils.isNotEmpty(channelGroups)) {
+            //通道产品 根据 通道id第一层 区域第二层 面额分第三层 进行分组
+            Map<Long, Map<String, Map<Long, List<ChannelProductInfo>>>> productListMap = productInfos.stream().collect(Collectors.groupingBy(ChannelProductInfo::getChannelId, Collectors.groupingBy(ChannelProductInfo::getAreaNum, Collectors.groupingBy(ChannelProductInfo::getStandardPrice))));
+            //将产品挂载到通道上面
+            channelInfos.forEach(a -> a.setProductListMap(productListMap.get(a.getChannelId())));
+            //通道按分发组id进行分组
+            Map<Integer, List<ChannelInfo>> channelListMap = channelInfos.stream().collect(Collectors.groupingBy(ChannelInfo::getDistributeGroupId));
+            //将通道挂载到分发组上面
+            distributeGroups.forEach(a -> a.setChannelInfos(channelListMap.get(a.getDistributeGroupId())));
+            //分发组按 通道组id第一层 运营商第二层 进行分组
+            Map<Long, Map<Integer, List<DistributeGroup>>> distributeGroupListMap = distributeGroups.stream().collect(Collectors.groupingBy(DistributeGroup::getChannelGroupId, Collectors.groupingBy(DistributeGroup::getOperator)));
+            //将分发组进行排序
+            distributeGroupListMap.forEach((k1, v1) -> v1.forEach((k2, v2) -> v2.sort(Comparator.comparingInt(DistributeGroup::getWeight).reversed())));
+            //将分发组挂载到通道组上
+            channelGroups.forEach(a -> a.setDistributeGroupsMap(distributeGroupListMap.get(a.getChannelGroupId())));
+            //通道组转为map 以通道组id为key 存到内存常量中
+            DataPool.channelGroupMap = channelGroups.stream().collect(Collectors.toMap(ChannelGroup::getChannelGroupId, a -> a, (k1, k2) -> k2));
+        }
+    }
 }

+ 51 - 8
modules/distribution/src/main/java/com/fire/dist/service/impl/DistOrderServiceImpl.java

@@ -1,19 +1,22 @@
 package com.fire.dist.service.impl;
 
 
+import com.alibaba.nacos.common.utils.CollectionUtils;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fire.dist.data.DataPool;
 import com.fire.dist.service.DistOrderService;
-import com.fire.dto.CustomerInfo;
-import com.fire.dto.FlowAppInfo;
-import com.fire.dto.FlowOrderInfo;
-import com.fire.dto.MobileFlowDispatchRec;
+import com.fire.dto.*;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import redis.clients.jedis.JedisCluster;
 
 import javax.annotation.Resource;
 import java.util.Date;
+import java.util.List;
+import java.util.Map;
 
+import static com.fire.dto.enums.RedisKey.CHILD_ORDER_INFO;
 import static com.fire.dto.enums.ValidStatus.SUSPEND;
 
 /**
@@ -30,16 +33,18 @@ public class DistOrderServiceImpl implements DistOrderService {
 
     @Override
     public void distOrder(FlowOrderInfo orderInfo) {
-        //appId是否存在
+        //取客户信息,进行分发校验
         FlowAppInfo flowAppInfo = DataPool.flowAppInfoMap.get(orderInfo.getAppId());
         Long orderId = orderInfo.getOrderId();
         if (flowAppInfo == null) {
             log.error("客户信息为空,请检查缓存机制,本次订单号为:" + orderId);
+            //todo  入回调队列
             return;
         }
         CustomerInfo customerInfo = flowAppInfo.getCustomerInfo();
         if (customerInfo == null) {
             log.error("客户信息为空,请检查缓存机制,本次订单号为:" + orderId);
+            //todo  入回调队列
             return;
         }
         //客户是否暂停
@@ -59,14 +64,52 @@ public class DistOrderServiceImpl implements DistOrderService {
             //todo 超时回调  入回调队列
             return;
         }
-        //todo 取分发记录
+        //取分发记录
         Integer sendCount = orderInfo.getSendCount();
+        Integer nowSendCount = sendCount == null ? 1 : sendCount + 1;
         MobileFlowDispatchRec childOrder = null;
-        if(sendCount != null){
+        ObjectMapper om = new ObjectMapper();
+        if (sendCount != null) {
             Long childId = orderId + sendCount;
+            String obj = jedisCluster.hget(CHILD_ORDER_INFO.key(), String.valueOf(childId));
+            if (obj != null) {
+                try {
+                    childOrder = om.readValue(obj, MobileFlowDispatchRec.class);
+                } catch (JsonProcessingException e) {
+                    log.error("提取分发记录失败", e);
+                }
+            }
+        }
+        //找到通道组
+        ChannelGroup channelGroup = DataPool.channelGroupMap.get(flowAppInfo.getChannelId());
+        if (channelGroup == null) {
+            //todo 回调队列 直接失败
+            return;
+        }
+        //提取通道下面的分发组
+        Map<Integer, List<DistributeGroup>> distributeGroupsMap = channelGroup.getDistributeGroupsMap();
+        if (distributeGroupsMap == null) {
+            //todo 回调队列 直接失败
+            return;
+        }
+        //找到对应运营商的分发组列表
+        List<DistributeGroup> distributeGroups = distributeGroupsMap.get(orderInfo.getPhoneOperator());
+        if (CollectionUtils.isEmpty(distributeGroups)) {
+            //todo 回调队列 直接失败
+            return;
+        }
+        //分发组已经按权重排序
+        distributeGroups.forEach(a -> {
+
+        });
+
+        //当取不到分发记录时
+        if (childOrder == null) {
+            childOrder = new MobileFlowDispatchRec();
+            childOrder.setRecId(orderId + nowSendCount);
 
         }
-        //
+
 
     }
 

+ 32 - 0
modules/distribution/src/main/resources/mapper/ChannelGroupMapper.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fire.dist.mapper.ChannelGroupMapper">
+
+    <resultMap type="com.fire.dto.ChannelGroup" id="AccessChannelGroupMap">
+        <result property="channelGroupId" column="channel_group_id" jdbcType="INTEGER"/>
+        <result property="groupName" column="group_name" jdbcType="VARCHAR"/>
+        <result property="creator" column="creator" jdbcType="VARCHAR"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="updator" column="updator" jdbcType="VARCHAR"/>
+        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+        <result property="isDelete" column="is_delete" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <!--查询全部-->
+    <select id="queryAll" resultMap="AccessChannelGroupMap">
+        <include refid="baseSql"/>
+        where channel_group_id = #{channelGroupId}
+    </select>
+
+    <sql id="baseSql">
+        select channel_group_id,
+               group_name,
+               creator,
+               create_time,
+               updator,
+               update_time,
+               is_delete
+        from access_channel_group
+    </sql>
+</mapper>
+

+ 70 - 0
modules/distribution/src/main/resources/mapper/ChannelInfoMapper.xml

@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fire.dist.mapper.ChannelInfoMapper">
+
+    <resultMap type="com.fire.dto.ChannelInfo" id="ChannelInfoMap">
+        <result property="channelId" column="channel_id" jdbcType="INTEGER"/>
+        <result property="supplierId" column="supplier_id" jdbcType="INTEGER"/>
+        <result property="channelName" column="channel_name" jdbcType="VARCHAR"/>
+        <result property="operator" column="operator" jdbcType="INTEGER"/>
+        <result property="isValid" column="is_valid" jdbcType="INTEGER"/>
+        <result property="remark" column="remark" jdbcType="VARCHAR"/>
+        <result property="creator" column="creator" jdbcType="VARCHAR"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="updator" column="updator" jdbcType="VARCHAR"/>
+        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+        <result property="ip" column="ip" jdbcType="VARCHAR"/>
+        <result property="discount" column="discount" jdbcType="NUMERIC"/>
+        <result property="channelType" column="channel_type" jdbcType="INTEGER"/>
+        <result property="isDelete" column="is_delete" jdbcType="INTEGER"/>
+        <result property="distributeGroupId" column="distribute_group_id" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <!--查询全部-->
+    <select id="queryAll" resultMap="ChannelInfoMap">
+        select a.channel_id,
+               a.supplier_id,
+               a.channel_name,
+               a.operator,
+               a.is_valid,
+               a.remark,
+               a.ip,
+               a.discount,
+               a.channel_type,
+               a.succ_num,
+               a.fail_num,
+               a.succ_ratio,
+               a.timly_rate,
+               a.total_succ_ratio,
+               a.is_delete,
+               b.distribute_group_id
+        from access_channel_info a
+                 left join distribute_group_channel b on a.channel_id = b.channel_id
+    </select>
+
+    <sql id="baseSql">
+        select channel_id,
+               supplier_id,
+               channel_name,
+               operator,
+               is_valid,
+               remark,
+               creator,
+               create_time,
+               updator,
+               update_time,
+               ip,
+               discount,
+               is_allow_sale,
+               is_sms_notice,
+               channel_type,
+               succ_num,
+               fail_num,
+               succ_ratio,
+               timly_rate,
+               total_succ_ratio,
+               is_delete
+        from access_channel_info
+    </sql>
+</mapper>
+

+ 38 - 0
modules/distribution/src/main/resources/mapper/ChannelProductInfoMapper.xml

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fire.dist.mapper.ChannelProductInfoMapper">
+
+    <resultMap type="com.fire.dto.ChannelProductInfo" id="ChannelProductInfoMap">
+        <result property="channelProductId" column="channel_product_id" jdbcType="INTEGER"/>
+        <result property="channelId" column="channel_id" jdbcType="INTEGER"/>
+        <result property="productId" column="product_id" jdbcType="VARCHAR"/>
+        <result property="productName" column="product_name" jdbcType="VARCHAR"/>
+        <result property="packageId" column="package_id" jdbcType="VARCHAR"/>
+        <result property="standardPrice" column="standard_price" jdbcType="INTEGER"/>
+        <result property="price" column="price" jdbcType="NUMERIC"/>
+        <result property="remark" column="remark" jdbcType="VARCHAR"/>
+        <result property="isValid" column="is_valid" jdbcType="INTEGER"/>
+        <result property="discount" column="discount" jdbcType="VARCHAR"/>
+        <result property="areaNum" column="area_num" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <!--查询全部-->
+    <select id="queryAll" resultMap="ChannelProductInfoMap">
+        select a.channel_product_id,
+               a.channel_id,
+               a.product_id,
+               a.product_name,
+               a.package_id,
+               a.standard_price,
+               a.price,
+               a.remark,
+               a.is_valid,
+               a.discount,
+               b.area_num
+        from channel_product_info a
+                 left join flow_product_info b on a.product_id = b.product_id
+    </select>
+
+
+</mapper>
+

+ 42 - 0
modules/distribution/src/main/resources/mapper/DistributeGroupMapper.xml

@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fire.dist.mapper.DistributeGroupMapper">
+
+    <resultMap type="com.fire.dto.DistributeGroup" id="DistributeGroupMap">
+        <result property="distributeGroupId" column="distribute_group_id" jdbcType="INTEGER"/>
+        <result property="name" column="name" jdbcType="VARCHAR"/>
+        <result property="channelGroupId" column="channel_group_id" jdbcType="INTEGER"/>
+        <result property="policy" column="policy" jdbcType="VARCHAR"/>
+        <result property="operator" column="operator" jdbcType="INTEGER"/>
+        <result property="weight" column="weight" jdbcType="INTEGER"/>
+        <result property="creator" column="creator" jdbcType="VARCHAR"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="updator" column="updator" jdbcType="VARCHAR"/>
+        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+        <result property="isValid" column="is_valid" jdbcType="INTEGER"/>
+        <result property="isDelete" column="is_delete" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <!--查询所有-->
+    <select id="queryAll" resultMap="DistributeGroupMap">
+        <include refid="baseSql"/>
+    </select>
+
+
+    <sql id="baseSql">
+        select distribute_group_id,
+               name,
+               channel_group_id,
+               policy,
+               operator,
+               weight,
+               creator,
+               create_time,
+               updator,
+               update_time,
+               is_valid,
+               is_delete
+        from distribute_group
+    </sql>
+</mapper>
+

+ 3 - 1
modules/distribution/src/main/resources/mapper/FlowAppInfoMapper.xml

@@ -16,6 +16,7 @@
         <result property="dispatchChannel" column="dispatch_channel" jdbcType="VARCHAR"/>
         <result property="totalCount" column="total_count" jdbcType="INTEGER"/>
         <result property="time" column="time" jdbcType="INTEGER"/>
+        <result property="channelId" column="channel_id" jdbcType="INTEGER"/>
     </resultMap>
 
     <!--查询全部-->
@@ -35,7 +36,8 @@
                callback_url,
                ip_address,
                dispatch_channel,
-               total_count
+               total_count,
+               channel_id
         from flow_app_info
     </sql>
 

+ 1 - 0
modules/make-order/src/main/java/com/fire/order/service/impl/CacheServiceImpl.java

@@ -122,6 +122,7 @@ public class CacheServiceImpl implements CacheService {
         if (CollectionUtils.isNotEmpty(maintenances)) {
             Map<String, OperatorMaintenance> maintenanceMap = new HashMap<>();
             for (OperatorMaintenance om : maintenances) {
+                //维护信息的key为 省.运营商.面额
                 String key = om.getProvince() + "." + om.getOperator() + "." + om.getFacePrice();
                 maintenanceMap.put(key, om);
             }

+ 1 - 1
modules/make-order/src/main/java/com/fire/order/service/impl/MakeOrderServiceImpl.java

@@ -226,7 +226,7 @@ public class MakeOrderServiceImpl implements MakeOrderService {
             return responseDto;
         }
         //校验产品是否有效
-        Integer isValid = product.getIsValid();
+        Integer isValid = product.getIsEffective();
         if (INVALID.status().equals(isValid)) {
             orderResp.setRCode(PACKAGE_ERROR.status());
             orderResp.setRMsg(PACKAGE_ERROR.message());

+ 3 - 4
modules/make-order/src/main/resources/mapper/CustomerProductMapper.xml

@@ -10,7 +10,7 @@
         <result property="type" column="type" jdbcType="INTEGER"/>
         <result property="price" column="price" jdbcType="NUMERIC"/>
         <result property="facePrice" column="face_price" jdbcType="NUMERIC"/>
-        <result property="isValid" column="is_valid" jdbcType="INTEGER"/>
+        <result property="isEffective" column="is_effective" jdbcType="INTEGER"/>
         <result property="areaName" column="area_name" jdbcType="VARCHAR"/>
         <result property="operator" column="operator" jdbcType="INTEGER"/>
         <result property="areaNum" column="area_num" jdbcType="VARCHAR"/>
@@ -24,7 +24,7 @@
                a.type,
                a.price,
                a.face_price,
-               a.is_valid,
+               a.is_effective,
                b.area_name,
                b.operator,
                b.area_num,
@@ -39,8 +39,7 @@
                a.package_id,
                a.type,
                a.price,
-               a.face_price,
-               a.is_valid
+               a.face_price
         from customer_product a
     </sql>
 

+ 6 - 1
pom.xml

@@ -123,7 +123,12 @@
                 <artifactId>activation</artifactId>
                 <version>1.1.1</version>
             </dependency>
-
+            <!-- 阿里云oss-->
+            <dependency>
+                <groupId>com.aliyun.oss</groupId>
+                <artifactId>aliyun-sdk-oss</artifactId>
+                <version>3.10.2</version>
+            </dependency>
         </dependencies>
 
     </dependencyManagement>