Authored by Lixiaodi

Merge branch 'dev' of http://git.yoho.cn/ufo/yohoufo-fore into dev

# Conflicts:
#	product/src/main/java/com/yohoufo/product/service/ProductService.java
#	product/src/main/java/com/yohoufo/product/service/impl/ProductServiceImpl.java
@@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
22 <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> 22 <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
23 select 23 select
24 <include refid="Base_Column_List" /> 24 <include refid="Base_Column_List" />
25 - from seller_orders 25 + from seller_order
26 where id = #{id,jdbcType=INTEGER} 26 where id = #{id,jdbcType=INTEGER}
27 </select> 27 </select>
28 28
@@ -40,7 +40,7 @@ public class ExpressInfoController { @@ -40,7 +40,7 @@ public class ExpressInfoController {
40 * @return 40 * @return
41 */ 41 */
42 @RequestMapping(params = "method=ufo.order.expressDetailInfo") 42 @RequestMapping(params = "method=ufo.order.expressDetailInfo")
43 - public ApiResponse queryExpressDetailInfo(@RequestParam("uid") Integer uid,@RequestParam("orderCode") Long orderCode) { 43 + public ApiResponse queryExpressDetailInfo(@RequestParam("uid") Integer uid, @RequestParam("orderCode") Long orderCode) {
44 ExpressInfoRespBo expressInfoRespBo = expressInfoService.queryExpressDetailInfo(uid,orderCode); 44 ExpressInfoRespBo expressInfoRespBo = expressInfoService.queryExpressDetailInfo(uid,orderCode);
45 return new ApiResponse.ApiResponseBuilder().code(200).data(expressInfoRespBo).build(); 45 return new ApiResponse.ApiResponseBuilder().code(200).data(expressInfoRespBo).build();
46 } 46 }
@@ -58,8 +58,6 @@ public class ShoppingController { @@ -58,8 +58,6 @@ public class ShoppingController {
58 return new ApiResponse.ApiResponseBuilder().code(200).data(paymentResponse).message("提交订单SUCCESS").build(); 58 return new ApiResponse.ApiResponseBuilder().code(200).data(paymentResponse).message("提交订单SUCCESS").build();
59 } 59 }
60 60
61 -  
62 -  
63 /** 61 /**
64 * 我的出售记录数,买入记录数 62 * 我的出售记录数,买入记录数
65 * @return 63 * @return
@@ -15,4 +15,7 @@ public class SellerOrderComputeResult { @@ -15,4 +15,7 @@ public class SellerOrderComputeResult {
15 PlatformFeeDto platformFee; 15 PlatformFeeDto platformFee;
16 BigDecimal bankTransferfee; 16 BigDecimal bankTransferfee;
17 BigDecimal income; 17 BigDecimal income;
  18 +
  19 + ServiceFeeRate serviceFeeRate;
  20 +
18 } 21 }
  1 +package com.yohoufo.order.model.dto;
  2 +
  3 +/**
  4 + * Created by chenchao on 2018/9/28.
  5 + */
  6 +public class ServiceFeeRate {
  7 +
  8 + double goodsPayment = 5D;
  9 +
  10 + double earnestMoney = 20D;
  11 +
  12 + double payChannel = 0.6D;
  13 +
  14 + String rateSymbol = "%";
  15 +
  16 +
  17 + public static ServiceFeeRate getServiceFeeRate(){
  18 + return Factory.inst;
  19 + }
  20 +
  21 +
  22 + static class Factory{
  23 + static ServiceFeeRate inst = new ServiceFeeRate();
  24 + }
  25 +
  26 +}
@@ -2,8 +2,11 @@ package com.yohoufo.order.service.handler; @@ -2,8 +2,11 @@ package com.yohoufo.order.service.handler;
2 2
3 import com.yohoufo.order.model.dto.PlatformFeeDto; 3 import com.yohoufo.order.model.dto.PlatformFeeDto;
4 import com.yohoufo.order.model.dto.SellerOrderComputeResult; 4 import com.yohoufo.order.model.dto.SellerOrderComputeResult;
  5 +import com.yohoufo.order.model.dto.ServiceFeeRate;
  6 +import org.springframework.beans.factory.annotation.Value;
5 import org.springframework.stereotype.Component; 7 import org.springframework.stereotype.Component;
6 8
  9 +import javax.annotation.PostConstruct;
7 import java.math.BigDecimal; 10 import java.math.BigDecimal;
8 11
9 /** 12 /**
@@ -12,7 +15,18 @@ import java.math.BigDecimal; @@ -12,7 +15,18 @@ import java.math.BigDecimal;
12 @Component 15 @Component
13 public class SellerOrderComputeHandler { 16 public class SellerOrderComputeHandler {
14 17
15 - private static final BigDecimal[] EARNESTMONEYRANGE = {new BigDecimal(28), new BigDecimal(200)}; 18 + @Value("${order.seller.earnestmoney.min:28}")
  19 + private double earnestmoney_min;
  20 + @Value("${order.seller.earnestmoney.max:200}")
  21 + private double earnestmoney_max;
  22 + private BigDecimal[] EARNESTMONEYRANGE = new BigDecimal[2];
  23 +
  24 +
  25 + @PostConstruct
  26 + public void init(){
  27 + EARNESTMONEYRANGE[0] = new BigDecimal(earnestmoney_min);
  28 + EARNESTMONEYRANGE[1] = new BigDecimal(earnestmoney_max);
  29 + }
16 30
17 public SellerOrderComputeResult compute(BigDecimal prdPrice){ 31 public SellerOrderComputeResult compute(BigDecimal prdPrice){
18 32
@@ -28,6 +42,8 @@ public class SellerOrderComputeHandler { @@ -28,6 +42,8 @@ public class SellerOrderComputeHandler {
28 result.setBankTransferfee(bankTransferfee); 42 result.setBankTransferfee(bankTransferfee);
29 result.setPlatformFee(platformFeeDto); 43 result.setPlatformFee(platformFeeDto);
30 result.setIncome(income); 44 result.setIncome(income);
  45 + //TODO 根据配置文件
  46 + result.setServiceFeeRate(ServiceFeeRate.getServiceFeeRate());
31 return result; 47 return result;
32 } 48 }
33 49
@@ -116,6 +116,17 @@ public class ProductController { @@ -116,6 +116,17 @@ public class ProductController {
116 return productService.queryStorageLeastPrice(storageId); 116 return productService.queryStorageLeastPrice(storageId);
117 } 117 }
118 118
  119 + @ApiOperation(name = "ufo.product.baseInfo", desc="出售商品,卖家出售的价格区间")
  120 + @RequestMapping(params = "method=ufo.product.baseInfo")
  121 + @Cachable(expire = 300)
  122 + public ProductDetailResp queryProductBaseInfo(@RequestParam(value = "product_id") Integer productId) {
  123 + if (productId == null) {
  124 + LOG.info("in method=ufo.product.baseInfo productId Is Null");
  125 + return null;
  126 + }
  127 + LOG.info("in method=ufo.product.baseInfo productId={}", productId);
  128 + return productService.queryProductBaseInfo(productId);
  129 + }
119 130
120 @ApiOperation(name = "ufo.product.storage.data", desc="sku信息") 131 @ApiOperation(name = "ufo.product.storage.data", desc="sku信息")
121 @RequestMapping(params = "method=ufo.product.storage.data") 132 @RequestMapping(params = "method=ufo.product.storage.data")
@@ -40,6 +40,17 @@ public class GoodsSize { @@ -40,6 +40,17 @@ public class GoodsSize {
40 @JSONField(name="status") 40 @JSONField(name="status")
41 private Integer status; 41 private Integer status;
42 42
  43 + @JSONField(name="sell_least_price")
  44 + private BigDecimal sellLeastPrice;
  45 +
  46 + public BigDecimal getSellLeastPrice() {
  47 + return sellLeastPrice;
  48 + }
  49 +
  50 + public void setSellLeastPrice(BigDecimal sellLeastPrice) {
  51 + this.sellLeastPrice = sellLeastPrice;
  52 + }
  53 +
43 public Integer getId() { 54 public Integer getId() {
44 return id; 55 return id;
45 } 56 }
@@ -31,6 +31,28 @@ public class ProductInfo { @@ -31,6 +31,28 @@ public class ProductInfo {
31 @JSONField(name="goods_list") 31 @JSONField(name="goods_list")
32 private List<GoodsBO> goodsList; 32 private List<GoodsBO> goodsList;
33 33
  34 + @JSONField(name="min_price")
  35 + private BigDecimal minPrice;
  36 +
  37 + @JSONField(name="max_price")
  38 + private BigDecimal maxPrice;
  39 +
  40 + public BigDecimal getMinPrice() {
  41 + return minPrice;
  42 + }
  43 +
  44 + public void setMinPrice(BigDecimal minPrice) {
  45 + this.minPrice = minPrice;
  46 + }
  47 +
  48 + public BigDecimal getMaxPrice() {
  49 + return maxPrice;
  50 + }
  51 +
  52 + public void setMaxPrice(BigDecimal maxPrice) {
  53 + this.maxPrice = maxPrice;
  54 + }
  55 +
34 public Integer getProductId() { 56 public Integer getProductId() {
35 return productId; 57 return productId;
36 } 58 }
@@ -30,4 +30,6 @@ public interface ProductService { @@ -30,4 +30,6 @@ public interface ProductService {
30 30
31 ProductSimpleResp queryPriceLimit(Integer productId); 31 ProductSimpleResp queryPriceLimit(Integer productId);
32 32
  33 + // 查询商品的基本信息
  34 + ProductDetailResp queryProductBaseInfo(Integer productId);
33 } 35 }
@@ -93,13 +93,11 @@ public class ProductServiceImpl implements ProductService{ @@ -93,13 +93,11 @@ public class ProductServiceImpl implements ProductService{
93 productInfo.setProductName(product.getProductName()); 93 productInfo.setProductName(product.getProductName());
94 productInfo.setProductCode(product.getProductCode()); 94 productInfo.setProductCode(product.getProductCode());
95 productInfo.setSaleTime((product.getSaleTime() == null || product.getSaleTime().equals(0)) ? "0" : DateUtil.getDateString(product.getSaleTime(), DateUtil.YYYY_MM_DD_DOT)); 95 productInfo.setSaleTime((product.getSaleTime() == null || product.getSaleTime().equals(0)) ? "0" : DateUtil.getDateString(product.getSaleTime(), DateUtil.YYYY_MM_DD_DOT));
96 - productInfo.setLeastPrice(new BigDecimal(0));  
97 setBrand(productInfo, product.getBrandId()); 96 setBrand(productInfo, product.getBrandId());
98 setSeries(productInfo, product.getSeriesId()); 97 setSeries(productInfo, product.getSeriesId());
99 productInfo.setLeastPrice(null); 98 productInfo.setLeastPrice(null);
100 99
101 -  
102 - List<GoodsBO> goodsBOList = getGoodsList(product.getId()); 100 + List<GoodsBO> goodsBOList = getGoodsList(product.getId(), product.getMinPrice());
103 if (!CollectionUtils.isEmpty(goodsBOList) && goodsBOList.get(0) != null) { 101 if (!CollectionUtils.isEmpty(goodsBOList) && goodsBOList.get(0) != null) {
104 GoodsBO goodsBO = goodsBOList.get(0); 102 GoodsBO goodsBO = goodsBOList.get(0);
105 List<GoodsSize> goodsSizes = goodsBO.getSizeList(); 103 List<GoodsSize> goodsSizes = goodsBO.getSizeList();
@@ -494,7 +492,7 @@ public class ProductServiceImpl implements ProductService{ @@ -494,7 +492,7 @@ public class ProductServiceImpl implements ProductService{
494 return storagePriceMap; 492 return storagePriceMap;
495 } 493 }
496 494
497 - private List<GoodsBO> getGoodsList(Integer productId){ 495 + private List<GoodsBO> getGoodsList(Integer productId, BigDecimal sellMinPrice){
498 List<GoodsBO> goodsBOs = new ArrayList<>(); 496 List<GoodsBO> goodsBOs = new ArrayList<>();
499 497
500 List<Goods> goodsList = goodsMapper.selectByProductId(productId); 498 List<Goods> goodsList = goodsMapper.selectByProductId(productId);
@@ -528,6 +526,7 @@ public class ProductServiceImpl implements ProductService{ @@ -528,6 +526,7 @@ public class ProductServiceImpl implements ProductService{
528 goodsSize.setStatus(storagePrice == null ? null : storagePrice.getStatus()); 526 goodsSize.setStatus(storagePrice == null ? null : storagePrice.getStatus());
529 goodsSize.setStorageNum(storagePrice == null ? 0 : storage.getStorageNum()); 527 goodsSize.setStorageNum(storagePrice == null ? 0 : storage.getStorageNum());
530 goodsSize.setSkup(storagePrice == null ? 0 : storagePrice.getSkup()); 528 goodsSize.setSkup(storagePrice == null ? 0 : storagePrice.getSkup());
  529 + goodsSize.setSellLeastPrice(sellMinPrice);
531 goodSizeList.add(goodsSize); 530 goodSizeList.add(goodsSize);
532 } 531 }
533 } 532 }
@@ -557,4 +556,20 @@ public class ProductServiceImpl implements ProductService{ @@ -557,4 +556,20 @@ public class ProductServiceImpl implements ProductService{
557 return resp; 556 return resp;
558 } 557 }
559 558
  559 +
  560 + // 查询商品的基本信息
  561 + public ProductDetailResp queryProductBaseInfo(Integer productId) {
  562 + Product product = productMapper.selectByPrimaryKey(productId);
  563 + ProductInfo productInfo = new ProductInfo();
  564 + productInfo.setProductId(product.getId());
  565 + productInfo.setProductName(product.getProductName());
  566 + productInfo.setProductCode(product.getProductCode());
  567 + productInfo.setSaleTime((product.getSaleTime() == null || product.getSaleTime().equals(0)) ? "0" : DateUtil.getDateString(product.getSaleTime(), DateUtil.YYYY_MM_DD_DOT));
  568 + productInfo.setMinPrice(product.getMinPrice());
  569 + productInfo.setMaxPrice(product.getMaxPrice());
  570 +
  571 + ProductDetailResp productDetailResp = new ProductDetailResp();
  572 + productDetailResp.setProduct_info(productInfo);
  573 + return productDetailResp;
  574 + }
560 } 575 }
@@ -83,4 +83,8 @@ redis.readonly.proxy.auth=redis9646 @@ -83,4 +83,8 @@ redis.readonly.proxy.auth=redis9646
83 redis.readonly.proxy.port=6379 83 redis.readonly.proxy.port=6379
84 redis.proxy.address=192.168.102.45 84 redis.proxy.address=192.168.102.45
85 redis.proxy.auth=redis9646 85 redis.proxy.auth=redis9646
86 -redis.proxy.port=6379  
  86 +redis.proxy.port=6379
  87 +
  88 +
  89 +order.seller.earnestmoney.min=0.01
  90 +order.seller.earnestmoney.max=200
  1 +consumer:
  2 + - address: 192.168.102.45:5672
  3 + username: yoho
  4 + password: yoho
  5 + consumers:
  6 + #更新物流调拨信息
  7 + - class: com.yohoufo.order.mq.consumer.ExpressInfoUpdateConsumer
  8 + topic: ufo.order.updateExpressInfo
  9 +
1 producer: 10 producer:
2 - address: 192.168.102.45:5672 11 - address: 192.168.102.45:5672
3 producers: 12 producers: