Authored by tanling

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

... ... @@ -20,7 +20,7 @@ public class StoragePrice {
private BigDecimal price;
/** 1:可售,2卖出,3鉴定失败,4卖家取消. */
/** 1:可售,2卖出,3鉴定失败,4卖家取消, 5客服取消. */
private Integer status;
private Integer updateTime;
... ...
... ... @@ -78,7 +78,7 @@
from product
</select>
<select id="selectByIds" resultMap="BaseResultMap">
select id, series_id from product where id in
select id, product_name, product_code, series_id from product where id in
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
... ...
... ... @@ -4,51 +4,105 @@ import com.google.common.collect.Lists;
import com.yohoufo.order.constants.OrderDetailDesc;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public enum OrderStatus {
WAITING_PAY(0,
"未付款",
WAITING_PAY(0, "未付款", new Node[]{
new Node(
"待付款",
Arrays.asList(ButtonShow.CANCEL_ORDER, ButtonShow.NOW_BUY),
Arrays.asList(ButtonShow.CANCEL_ORDER, ButtonShow.NOW_BUY),
OrderDetailDesc.NO_PAY),
OrderDetailDesc.NO_PAY
),
new Node(
"待买家付款",
Arrays.asList(ButtonShow.SHOW_DETAIL),
null,
OrderDetailDesc.Seller.BUYER_NO_PAY
)
}),
HAS_PAYED(1,
"已付款",
HAS_PAYED(1, "已付款", new Node[]{
new Node(
"商品调拨中",
Arrays.asList(ButtonShow.SHOW_DETAIL),
Lists.newArrayList(),
OrderDetailDesc.BUY_HAS_PAID),
SELLER_SEND_OUT(2,
"商品调拨中(卖家发货,可查物流)",
OrderDetailDesc.BUY_HAS_PAID
),
new Node(
"待发货",
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.NOT_SOLD, ButtonShow.DELIVER_GOODS),
Arrays.asList(ButtonShow.NOT_SOLD, ButtonShow.DELIVER_GOODS),
OrderDetailDesc.Seller.BUYER_HAS_PAID
)
}),
SELLER_SEND_OUT(2, "商品调拨中(卖家发货,可查物流)", new Node[]{
new Node(
"商品调拨中",
Arrays.asList(ButtonShow.SHOW_DETAIL),
Lists.newArrayList(),
OrderDetailDesc.SELL_HAS_SENDED),
PLATFORM_CHECKING(3,
"有货平台鉴定中",
OrderDetailDesc.SELL_HAS_SENDED
),
new Node(
"已发货",
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.SHOW_EXPRESS),
Arrays.asList(ButtonShow.SHOW_EXPRESS),
null
)
}),
PLATFORM_CHECKING(3, "有货平台鉴定中", new Node[]{
new Node(
"有货平台鉴定中",
Arrays.asList(ButtonShow.SHOW_DETAIL),
Lists.newArrayList(),
OrderDetailDesc.PLATFORM_SEND),
WAITING_RECEIVE(4,
"待收货",
OrderDetailDesc.PLATFORM_SEND
),
new Node(
"有货平台鉴定中",
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.SHOW_EXPRESS),
Arrays.asList(ButtonShow.SHOW_EXPRESS),
OrderDetailDesc.Seller.IN_CHECK
)
}),
WAITING_RECEIVE(4, "待收货", new Node[]{
new Node(
"待收货",
Arrays.asList(ButtonShow.SHOW_EXPRESS, ButtonShow.CONFIRM_DELIVERY),
Arrays.asList(ButtonShow.SHOW_EXPRESS, ButtonShow.CONFIRM_DELIVERY),
OrderDetailDesc.CHECK_OK_SEND),
OrderDetailDesc.CHECK_OK_SEND
),
DONE(5,
"已完成",
new Node(
"交易成功",
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.DEL_ORDER),
Arrays.asList( ButtonShow.DEL_ORDER),
OrderDetailDesc.Seller.TRADE_DONE
)
}),
DONE(5, "已完成", new Node[]{
new Node(
"交易成功",
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
OrderDetailDesc.DONE),
OrderDetailDesc.DONE
),
new Node(
"交易成功",
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.DEL_ORDER),
Arrays.asList( ButtonShow.DEL_ORDER),
OrderDetailDesc.Seller.TRADE_DONE
)
} ),
// TODO 这种状态不存在
// SELLER_CANCEL_BEFORE_PAY(10,
... ... @@ -58,40 +112,57 @@ public enum OrderStatus {
// Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
// ),
SELLER_CANCEL_AFTER_PAY(11,
"买家付款后卖家取消",
SELLER_CANCEL_AFTER_PAY(11, "买家付款后卖家取消", new Node[]{
new Node(
"交易失败",
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
OrderDetailDesc.SELL_CANCEL_SEND),
OrderDetailDesc.SELL_CANCEL_SEND
),
buildFail4Seller(OrderDetailDesc.Seller.NO_SALE)
}
),
SEND_OUT_TIMEOUT(12,
"超时未发货取消",
SEND_OUT_TIMEOUT(12, "超时未发货取消", new Node[]{
new Node(
"交易失败",
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
OrderDetailDesc.SELL_TIMETOUT_CANCEL),
OrderDetailDesc.SELL_TIMETOUT_CANCEL
),
buildFail4Seller(OrderDetailDesc.Seller.DELIVER_GOODS_TIMEOUT)
}
),
CHECKING_FAKE(13,
"鉴定不通过取消",
CHECKING_FAKE(13, "鉴定不通过取消", new Node[]{
new Node(
"交易失败",
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
OrderDetailDesc.CHECK_FAKE),
OrderDetailDesc.CHECK_FAKE
),
buildFail4Seller(OrderDetailDesc.Seller.CHECK_FAIL)
}),
BUYER_CANCEL_BEFORE_PAY(14,
"支付前取消",
BUYER_CANCEL_BEFORE_PAY(14, "支付前取消", new Node[]{
new Node(
"交易失败",
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
OrderDetailDesc.BUY_CANCEL),
BUYER_CANCEL_TIMEOUT(15,
"超时未支付取消",
"交易失败",
OrderDetailDesc.BUY_CANCEL
),
buildFail4Seller(OrderDetailDesc.Seller.BUYER_CANCEL)
}),
BUYER_CANCEL_TIMEOUT(15, "超时未支付取消", new Node[]{
new Node(
"交易失败",
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
Arrays.asList(ButtonShow.BUY_AGAIN, ButtonShow.DEL_ORDER),
OrderDetailDesc.BUY_TIMEOUT_CANCEL),
OrderDetailDesc.BUY_TIMEOUT_CANCEL
),
buildFail4Seller(OrderDetailDesc.Seller.BUYER_CANCEL_OF_TIMEOUT)
}),
// CUSTOMER_SERVICE(17,
// "客服取消",
... ... @@ -104,72 +175,105 @@ public enum OrderStatus {
String desc;
/**
* 列表or详情显示状态
*/
String statusStr;
/**
* 订单列表中的按钮
*/
List<ButtonShow> listButtons;
/**
* 详情的按钮
*/
List<ButtonShow> detailButtons;
Node[] nodes;
/**
* 详情页状态说明
*/
String detailDesc;
static Node buildFail4Seller(String detailDesc){
return new Node(
"交易失败",
Arrays.asList(ButtonShow.SHOW_DETAIL, ButtonShow.DEL_ORDER),
Arrays.asList(ButtonShow.DEL_ORDER),
detailDesc
);
}
/**
*
* @param code db中code
* @param desc db中code的含义
* @param statusStr 订单列表中状态显示
* @param listButtons 订单列表显示的按钮
* @param nodes db中code的含义
*/
OrderStatus(int code, String desc, String statusStr, List<ButtonShow> listButtons,
List<ButtonShow> detailButtons, String detailDesc) {
OrderStatus(int code, String desc, Node[] nodes) {
this.code = code;
this.desc = desc;
this.statusStr = statusStr;
this.listButtons = listButtons;
this.detailButtons = detailButtons;
this.detailDesc = detailDesc;
this.nodes = nodes;
}
public int getCode() {
return code;
}
private int getIndex(TabType actorType){
switch (actorType){
case BUY:
return 0;
case SELL:
return 1;
}
return -1;
}
public List<ButtonShow> getListButtons() {
return listButtons;
public List<ButtonShow> getListButtons(TabType actorType) {
return nodes[getIndex(actorType)].listButtons;
}
public List<ButtonShow> getDetailButtons() {
return detailButtons;
public List<ButtonShow> getDetailButtons(TabType actorType) {
return nodes[getIndex(actorType)].detailButtons;
}
public String getDetailDesc() {
return detailDesc;
public String getDetailDesc(TabType actorType) {
return nodes[getIndex(actorType)].detailDesc;
}
public String getStatusStr() {
return statusStr;
public String getStatusStr(TabType actorType) {
return nodes[getIndex(actorType)].statusStr;
}
public static OrderStatus getOrderStatus(int code){
static Map<Integer,OrderStatus> localcache;
static {
localcache = new HashMap<>();
for(OrderStatus v : values()){
if(v.code == code){
return v;
}
localcache.put(v.code, v);
}
}
public static OrderStatus getOrderStatus(int code){
return localcache.get(code);
}
public static class Node{
/**
* 列表or详情显示状态
*/
String statusStr;
/**
* 订单列表中的按钮
*/
List<ButtonShow> listButtons;
/**
* 详情的按钮
*/
List<ButtonShow> detailButtons;
/**
* 详情页状态说明
*/
String detailDesc;
public Node(String statusStr,
List<ButtonShow> listButtons,
List<ButtonShow> detailButtons,
String detailDesc) {
this.statusStr = statusStr;
this.listButtons = listButtons;
this.detailButtons = detailButtons;
this.detailDesc = detailDesc;
}
return null;
}
}
... ...
... ... @@ -58,4 +58,24 @@ public interface OrderDetailDesc {
* 非直接显示
*/
String DONE = OrderConstant.EXPRESS_SENDTIME_TO_QUERY;
interface Seller{
String TRADE_DONE = "您出售的商品鉴定通过,支付的保证金已退还至您的支付账户,货款已打入您的有货账户,亲注意查收";
String CHECK_FAIL = "您出售的商品鉴定未通过,商品已寄回,您支付的保证金已作为补偿赔付给买家";
String BUYER_CANCEL = "买家取消订单,您的商品已重新上架出售";
String BUYER_CANCEL_OF_TIMEOUT = "买家未在15分钟内付款,系统取消订单,您的商品已重新上架出售";
String DELIVER_GOODS_TIMEOUT = "您未在48小时内发货,系统取消订单,您支付的保证金作已为补偿赔付给买家";
String IN_CHECK = "有货鉴定中心已收货,您出售的商品正在鉴定中,如鉴定不通过则按您提供的收货地址寄回,您支付的保证金将作为补偿赔付给买家";
String NO_SALE = "您已取消商品出售,您支付的保证金作已为补偿赔付给买家";
String BUYER_HAS_PAID = "买家已付款,请于48小时内发货,超时发货系统自动取消订单并下架商品,您支付的保证金将作为补偿赔付给买家";
String BUYER_NO_PAY = "等待买家付款,15分钟未付款将自动取消订单并重新上架商品";
}
}
... ...
... ... @@ -34,6 +34,7 @@ public class BuyerOrderController {
@ResponseBody
public ApiResponse getOrderList(@RequestParam("type") int type,
@RequestParam("uid") int uid,
@RequestParam("tabType") String tabType,
@RequestParam(value = "page", required = false, defaultValue = "1") int page,
@RequestParam(value = "limit", required = false, defaultValue = "10") int limit) {
... ... @@ -42,6 +43,7 @@ public class BuyerOrderController {
.type(type)
.page(page)
.limit(limit)
.tabType(tabType)
.build();
OrderListInfoRsp orderListInfoRsp = buyerOrderService.getOrderList(orderListRequest);
... ...
... ... @@ -18,4 +18,6 @@ public class OrderListRequest {
int page;
int limit;
String tabType;
}
... ...
... ... @@ -16,4 +16,5 @@ public class OrderRequest {
long orderCode;
String tabType;
}
... ...
... ... @@ -133,6 +133,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
}
if (TabType.BUY != tabType){
//todo 对于卖家出售中的订单处理
return new OrderDetailInfo();
}
... ... @@ -170,19 +171,21 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
throw new ServiceException(ServiceError.ORDER_ORDERS_GOODS_IS_EMPTY);
}
OrderDetailInfo orderDetailInfo = buildOrderDetail(buyerOrder, orderStatus, buyerOrderGoods, sellerOrderGoods);
OrderDetailInfo orderDetailInfo = buildOrderDetail(buyerOrder, orderStatus, buyerOrderGoods, sellerOrderGoods, tabType);
return orderDetailInfo;
}
private OrderDetailInfo buildOrderDetail(BuyerOrder buyerOrder, OrderStatus orderStatus, BuyerOrderGoods buyerOrderGoods, SellerOrderGoods sellerOrderGoods) {
private OrderDetailInfo buildOrderDetail(BuyerOrder buyerOrder, OrderStatus orderStatus,
BuyerOrderGoods buyerOrderGoods, SellerOrderGoods sellerOrderGoods,
TabType tabType) {
OrderDetailInfo orderDetailInfo = new OrderDetailInfo();
orderDetailInfo.setUid(buyerOrder.getUid());
orderDetailInfo.setOrderCode(buyerOrder.getOrderCode());
orderDetailInfo.setButtons(orderStatus.getDetailButtons());
orderDetailInfo.setButtons(orderStatus.getDetailButtons(tabType));
OrderDetailInfo.StatusDetail statusDetail = getStatusDetail(buyerOrder, orderStatus);
OrderDetailInfo.StatusDetail statusDetail = getStatusDetail(buyerOrder, orderStatus, tabType);
orderDetailInfo.setStatusDetail(statusDetail);
GoodsInfo goodsInfo = getGoodsInfo(sellerOrderGoods);
orderDetailInfo.setGoodsInfo(goodsInfo);
... ... @@ -225,14 +228,14 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
* @param orderStatus
* @return
*/
private OrderDetailInfo.StatusDetail getStatusDetail(BuyerOrder buyerOrder,OrderStatus orderStatus) {
private OrderDetailInfo.StatusDetail getStatusDetail(BuyerOrder buyerOrder,OrderStatus orderStatus, TabType tabType) {
OrderDetailInfo.StatusDetail statusDetail = OrderDetailInfo.StatusDetail.builder()
.status(orderStatus.getCode())
.statuStr(orderStatus.getStatusStr())
.statuStr(orderStatus.getStatusStr(tabType))
.build();
// TODO 需要查询 时间点 and 物流定位
if (OrderConstant.EXPRESS_SENDTIME_TO_QUERY.equals(orderStatus.getDetailDesc())){
if (OrderConstant.EXPRESS_SENDTIME_TO_QUERY.equals(orderStatus.getDetailDesc(tabType))){
}
... ... @@ -254,7 +257,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
// check and init请求参数
List<Integer> statusQuery = initOrderListRequest(request);
TabType tabType = TabType.getTabType(request.getTabType());
int total = buyerOrderMapper.selectCntByUidStatus(request.getUid(), statusQuery);
int limit = request.getLimit();
... ... @@ -277,7 +280,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
List<OrderListInfo> data = Lists.newArrayList();
buyerOrderList.stream().forEach(buyerOrder -> {
OrderListInfo orderListInfo = convertOrderInfo(buyerOrderGoodsMap, sellerOrderGoodsMap, buyerOrder);
OrderListInfo orderListInfo = convertOrderInfo(buyerOrderGoodsMap, sellerOrderGoodsMap, buyerOrder, tabType);
if (orderListInfo == null) return;
data.add(orderListInfo);
... ... @@ -305,7 +308,8 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
*/
private OrderListInfo convertOrderInfo(Map<Long, BuyerOrderGoods> buyerOrderGoodsMap,
Map<Integer, SellerOrderGoods> sellerOrderGoodsMap,
BuyerOrder buyerOrder) {
BuyerOrder buyerOrder,
TabType tabType) {
/**
* 1.查询 buyer_order
... ... @@ -326,10 +330,10 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
return null;
}
orderListInfo.setStatuStr(orderStatus.getStatusStr());
orderListInfo.setStatuStr(orderStatus.getStatusStr(tabType));
// 按钮显示
orderListInfo.setButtons(orderStatus.getListButtons());
orderListInfo.setButtons(orderStatus.getListButtons(tabType));
// 当订单状态是待付款, 显示leftTime
if (orderListInfo.getStatus() == OrderStatus.WAITING_PAY.getCode()){
... ...
... ... @@ -3,6 +3,7 @@ package com.yohoufo.product.controller;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import com.yohoufo.product.response.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -22,10 +23,6 @@ import com.yohoufo.common.caller.UfoServiceCaller;
import com.yohoufo.common.utils.UfoJsonUtil;
import com.yohoufo.dal.product.model.StoragePrice;
import com.yohoufo.product.request.StoragePriceBo;
import com.yohoufo.product.response.ProductDetailResp;
import com.yohoufo.product.response.ProductSeriesTemplateResp;
import com.yohoufo.product.response.StorageDataResp;
import com.yohoufo.product.response.StorageLeastPriceResp;
import com.yohoufo.product.service.ProductService;
... ... @@ -46,7 +43,7 @@ public class ProductController {
@RequestMapping(params = "method=ufo.product.data")
@Cachable(expire=600)
public ApiResponse queryProductDetailById(
@RequestParam(value = "product_id", required = true) Integer productId) {
@RequestParam(value = "product_id") Integer productId) {
if (null == productId) {
return new ApiResponse(400, "product_id Is Null", null);
... ... @@ -57,19 +54,33 @@ public class ProductController {
return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("product data").build();
}
@ApiOperation(name = "ufo.product.series.template", desc="商品系列列表")
@IgnoreSignature
@IgnoreSession
@RequestMapping(params = "method=ufo.product.series.template")
//@Cachable(expire=600)
public ApiResponse querySeriesTemplateData(
@RequestParam(value = "product_ids") String productIds) {
if (StringUtils.isBlank(productIds)) {
return new ApiResponse(400, "productIds Is Null", null);
}
ProductSeriesTemplateResp resp = productService.querySeriesTemplateData(productIds);
return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("product data").build();
}
@ApiOperation(name = "ufo.product.sort.template", desc="商品列表")
@IgnoreSignature
@IgnoreSession
@RequestMapping(params = "method=ufo.product.sort.template")
//@Cachable(expire=600)
public ApiResponse querySortTemplateData(
@RequestParam(value = "skns", required = false) String skns) {
@RequestParam(value = "product_ids") String productIds) {
if (StringUtils.isBlank(skns)) {
return new ApiResponse(500, "skns Is Null", null);
if (StringUtils.isBlank(productIds)) {
return new ApiResponse(400, "productIds Is Null", null);
}
ProductSeriesTemplateResp resp = productService.querySortTemplateData(skns);
ProductSortTemplateResp resp = productService.querySortTemplateData(productIds);
return new ApiResponse.ApiResponseBuilder().data(resp).code(200).message("product data").build();
}
... ...
package com.yohoufo.product.model;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class ProductSortTemplate {
@JSONField(name = "image_url")
private String imageUrl;
@JSONField(name = "product_id")
private Integer productId;
@JSONField(name = "product_name")
private String productName;
@JSONField(name = "product_code")
private String productCode;
}
... ...
package com.yohoufo.product.response;
import com.yohoufo.product.model.ProductSortTemplate;
import java.util.List;
public class ProductSortTemplateResp {
private List<ProductSortTemplate> list;
public List<ProductSortTemplate> getList() {
return list;
}
public void setList(List<ProductSortTemplate> list) {
this.list = list;
}
}
... ...
... ... @@ -2,10 +2,7 @@ package com.yohoufo.product.service;
import com.yohoufo.dal.product.model.StoragePrice;
import com.yohoufo.product.request.StoragePriceBo;
import com.yohoufo.product.response.ProductDetailResp;
import com.yohoufo.product.response.ProductSeriesTemplateResp;
import com.yohoufo.product.response.StorageDataResp;
import com.yohoufo.product.response.StorageLeastPriceResp;
import com.yohoufo.product.response.*;
public interface ProductService {
... ... @@ -23,7 +20,9 @@ public interface ProductService {
StoragePrice getStoragePriceBySkup(Integer skup);
ProductSeriesTemplateResp querySortTemplateData(String skns);
ProductSeriesTemplateResp querySeriesTemplateData(String skns);
ProductSortTemplateResp querySortTemplateData(String productIds);
}
... ...
... ... @@ -11,9 +11,7 @@ import com.yohoufo.common.utils.UfoStringUtils;
import com.yohoufo.dal.product.*;
import com.yohoufo.dal.product.model.*;
import com.yohoufo.product.model.*;
import com.yohoufo.product.response.ProductSeriesTemplateResp;
import com.yohoufo.product.response.StorageDataResp;
import com.yohoufo.product.response.StorageLeastPriceResp;
import com.yohoufo.product.response.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -22,7 +20,6 @@ import org.springframework.stereotype.Service;
import com.yoho.error.exception.ServiceException;
import com.yohoufo.product.request.StoragePriceBo;
import com.yohoufo.product.response.ProductDetailResp;
import com.yohoufo.product.service.ProductService;
import com.yohoufo.resource.util.DateUtils;
import org.springframework.util.CollectionUtils;
... ... @@ -136,7 +133,34 @@ public class ProductServiceImpl implements ProductService{
}
@Override
public ProductSeriesTemplateResp querySortTemplateData(String skns) {
public ProductSortTemplateResp querySortTemplateData(String productIds) {
ProductSortTemplateResp resp = new ProductSortTemplateResp();
List<ProductSortTemplate> list = new ArrayList<>();
resp.setList(list);
List<Integer> productList = UfoStringUtils.string2IntegerList(productIds);
if (!CollectionUtils.isEmpty(productList)) {
List<Product> products = productMapper.selectByIds(productList);
if (!CollectionUtils.isEmpty(products)) {
List<Goods> goodsList = goodsMapper.selectByProductIds(productList);
Map<Integer, List<Goods>> productGoodsMap = goodsList.stream().collect(Collectors.groupingBy(Goods::getProductId));
for (Product product : products) {
List<Goods> pgList = productGoodsMap.get(product.getId());
if (!CollectionUtils.isEmpty(pgList) && pgList.get(0) != null && StringUtils.isNotBlank(pgList.get(0).getColorImage())) {
ProductSortTemplate productSortTemplate = new ProductSortTemplate();
productSortTemplate.setProductId(product.getId());
productSortTemplate.setProductName(product.getProductName());
productSortTemplate.setProductCode(product.getProductCode());
productSortTemplate.setImageUrl(pgList.get(0).getColorImage());
list.add(productSortTemplate);
}
}
}
}
return resp;
}
@Override
public ProductSeriesTemplateResp querySeriesTemplateData(String skns) {
ProductSeriesTemplateResp resp = new ProductSeriesTemplateResp();
List<Integer> sknlist = UfoStringUtils.string2IntegerList(skns);
if (!CollectionUtils.isEmpty(sknlist)) {
... ... @@ -307,6 +331,7 @@ public class ProductServiceImpl implements ProductService{
sp.setDepotNum(depotNum);
sp.setSkup(skup);
sp.setCreateTime((int) (System.currentTimeMillis() / 1000));
sp.setUpdateTime(0);
sp.setStatus(1);
return sp;
}
... ...