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 @@
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from seller_orders
from seller_order
where id = #{id,jdbcType=INTEGER}
</select>
... ...
... ... @@ -40,7 +40,7 @@ public class ExpressInfoController {
* @return
*/
@RequestMapping(params = "method=ufo.order.expressDetailInfo")
public ApiResponse queryExpressDetailInfo(@RequestParam("uid") Integer uid,@RequestParam("orderCode") Long orderCode) {
public ApiResponse queryExpressDetailInfo(@RequestParam("uid") Integer uid, @RequestParam("orderCode") Long orderCode) {
ExpressInfoRespBo expressInfoRespBo = expressInfoService.queryExpressDetailInfo(uid,orderCode);
return new ApiResponse.ApiResponseBuilder().code(200).data(expressInfoRespBo).build();
}
... ...
... ... @@ -58,8 +58,6 @@ public class ShoppingController {
return new ApiResponse.ApiResponseBuilder().code(200).data(paymentResponse).message("提交订单SUCCESS").build();
}
/**
* 我的出售记录数,买入记录数
* @return
... ...
... ... @@ -15,4 +15,7 @@ public class SellerOrderComputeResult {
PlatformFeeDto platformFee;
BigDecimal bankTransferfee;
BigDecimal income;
ServiceFeeRate serviceFeeRate;
}
... ...
package com.yohoufo.order.model.dto;
/**
* Created by chenchao on 2018/9/28.
*/
public class ServiceFeeRate {
double goodsPayment = 5D;
double earnestMoney = 20D;
double payChannel = 0.6D;
String rateSymbol = "%";
public static ServiceFeeRate getServiceFeeRate(){
return Factory.inst;
}
static class Factory{
static ServiceFeeRate inst = new ServiceFeeRate();
}
}
... ...
... ... @@ -2,8 +2,11 @@ package com.yohoufo.order.service.handler;
import com.yohoufo.order.model.dto.PlatformFeeDto;
import com.yohoufo.order.model.dto.SellerOrderComputeResult;
import com.yohoufo.order.model.dto.ServiceFeeRate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.math.BigDecimal;
/**
... ... @@ -12,7 +15,18 @@ import java.math.BigDecimal;
@Component
public class SellerOrderComputeHandler {
private static final BigDecimal[] EARNESTMONEYRANGE = {new BigDecimal(28), new BigDecimal(200)};
@Value("${order.seller.earnestmoney.min:28}")
private double earnestmoney_min;
@Value("${order.seller.earnestmoney.max:200}")
private double earnestmoney_max;
private BigDecimal[] EARNESTMONEYRANGE = new BigDecimal[2];
@PostConstruct
public void init(){
EARNESTMONEYRANGE[0] = new BigDecimal(earnestmoney_min);
EARNESTMONEYRANGE[1] = new BigDecimal(earnestmoney_max);
}
public SellerOrderComputeResult compute(BigDecimal prdPrice){
... ... @@ -28,6 +42,8 @@ public class SellerOrderComputeHandler {
result.setBankTransferfee(bankTransferfee);
result.setPlatformFee(platformFeeDto);
result.setIncome(income);
//TODO 根据配置文件
result.setServiceFeeRate(ServiceFeeRate.getServiceFeeRate());
return result;
}
... ...
... ... @@ -116,6 +116,17 @@ public class ProductController {
return productService.queryStorageLeastPrice(storageId);
}
@ApiOperation(name = "ufo.product.baseInfo", desc="出售商品,卖家出售的价格区间")
@RequestMapping(params = "method=ufo.product.baseInfo")
@Cachable(expire = 300)
public ProductDetailResp queryProductBaseInfo(@RequestParam(value = "product_id") Integer productId) {
if (productId == null) {
LOG.info("in method=ufo.product.baseInfo productId Is Null");
return null;
}
LOG.info("in method=ufo.product.baseInfo productId={}", productId);
return productService.queryProductBaseInfo(productId);
}
@ApiOperation(name = "ufo.product.storage.data", desc="sku信息")
@RequestMapping(params = "method=ufo.product.storage.data")
... ...
... ... @@ -40,6 +40,17 @@ public class GoodsSize {
@JSONField(name="status")
private Integer status;
@JSONField(name="sell_least_price")
private BigDecimal sellLeastPrice;
public BigDecimal getSellLeastPrice() {
return sellLeastPrice;
}
public void setSellLeastPrice(BigDecimal sellLeastPrice) {
this.sellLeastPrice = sellLeastPrice;
}
public Integer getId() {
return id;
}
... ...
... ... @@ -31,6 +31,28 @@ public class ProductInfo {
@JSONField(name="goods_list")
private List<GoodsBO> goodsList;
@JSONField(name="min_price")
private BigDecimal minPrice;
@JSONField(name="max_price")
private BigDecimal maxPrice;
public BigDecimal getMinPrice() {
return minPrice;
}
public void setMinPrice(BigDecimal minPrice) {
this.minPrice = minPrice;
}
public BigDecimal getMaxPrice() {
return maxPrice;
}
public void setMaxPrice(BigDecimal maxPrice) {
this.maxPrice = maxPrice;
}
public Integer getProductId() {
return productId;
}
... ...
... ... @@ -30,4 +30,6 @@ public interface ProductService {
ProductSimpleResp queryPriceLimit(Integer productId);
// 查询商品的基本信息
ProductDetailResp queryProductBaseInfo(Integer productId);
}
... ...
... ... @@ -93,13 +93,11 @@ public class ProductServiceImpl implements ProductService{
productInfo.setProductName(product.getProductName());
productInfo.setProductCode(product.getProductCode());
productInfo.setSaleTime((product.getSaleTime() == null || product.getSaleTime().equals(0)) ? "0" : DateUtil.getDateString(product.getSaleTime(), DateUtil.YYYY_MM_DD_DOT));
productInfo.setLeastPrice(new BigDecimal(0));
setBrand(productInfo, product.getBrandId());
setSeries(productInfo, product.getSeriesId());
productInfo.setLeastPrice(null);
List<GoodsBO> goodsBOList = getGoodsList(product.getId());
List<GoodsBO> goodsBOList = getGoodsList(product.getId(), product.getMinPrice());
if (!CollectionUtils.isEmpty(goodsBOList) && goodsBOList.get(0) != null) {
GoodsBO goodsBO = goodsBOList.get(0);
List<GoodsSize> goodsSizes = goodsBO.getSizeList();
... ... @@ -494,7 +492,7 @@ public class ProductServiceImpl implements ProductService{
return storagePriceMap;
}
private List<GoodsBO> getGoodsList(Integer productId){
private List<GoodsBO> getGoodsList(Integer productId, BigDecimal sellMinPrice){
List<GoodsBO> goodsBOs = new ArrayList<>();
List<Goods> goodsList = goodsMapper.selectByProductId(productId);
... ... @@ -528,6 +526,7 @@ public class ProductServiceImpl implements ProductService{
goodsSize.setStatus(storagePrice == null ? null : storagePrice.getStatus());
goodsSize.setStorageNum(storagePrice == null ? 0 : storage.getStorageNum());
goodsSize.setSkup(storagePrice == null ? 0 : storagePrice.getSkup());
goodsSize.setSellLeastPrice(sellMinPrice);
goodSizeList.add(goodsSize);
}
}
... ... @@ -557,4 +556,20 @@ public class ProductServiceImpl implements ProductService{
return resp;
}
// 查询商品的基本信息
public ProductDetailResp queryProductBaseInfo(Integer productId) {
Product product = productMapper.selectByPrimaryKey(productId);
ProductInfo productInfo = new ProductInfo();
productInfo.setProductId(product.getId());
productInfo.setProductName(product.getProductName());
productInfo.setProductCode(product.getProductCode());
productInfo.setSaleTime((product.getSaleTime() == null || product.getSaleTime().equals(0)) ? "0" : DateUtil.getDateString(product.getSaleTime(), DateUtil.YYYY_MM_DD_DOT));
productInfo.setMinPrice(product.getMinPrice());
productInfo.setMaxPrice(product.getMaxPrice());
ProductDetailResp productDetailResp = new ProductDetailResp();
productDetailResp.setProduct_info(productInfo);
return productDetailResp;
}
}
... ...
... ... @@ -83,4 +83,8 @@ redis.readonly.proxy.auth=redis9646
redis.readonly.proxy.port=6379
redis.proxy.address=192.168.102.45
redis.proxy.auth=redis9646
redis.proxy.port=6379
\ No newline at end of file
redis.proxy.port=6379
order.seller.earnestmoney.min=0.01
order.seller.earnestmoney.max=200
\ No newline at end of file
... ...
consumer:
- address: 192.168.102.45:5672
username: yoho
password: yoho
consumers:
#更新物流调拨信息
- class: com.yohoufo.order.mq.consumer.ExpressInfoUpdateConsumer
topic: ufo.order.updateExpressInfo
producer:
- address: 192.168.102.45:5672
producers:
... ...