Authored by unknown

ufo列表加销量排序

package com.yoho.search.dal;
import com.yoho.search.dal.model.UfoBrand;
import com.yoho.search.dal.model.UfoBuyerOrderGoods;
import java.util.List;
public interface UfoBuyerOrderGoodsMapper {
int deleteByPrimaryKey(Integer id);
int insert(UfoBuyerOrderGoods record);
int insertSelective(UfoBuyerOrderGoods record);
UfoBuyerOrderGoods selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(UfoBuyerOrderGoods record);
int updateByPrimaryKey(UfoBuyerOrderGoods record);
List<UfoBuyerOrderGoods> selectBySkupList(List<Integer> skupList);
}
\ No newline at end of file
... ...
package com.yoho.search.dal;
import com.yoho.search.dal.model.UfoBuyerOrder;
import com.yoho.search.dal.model.UfoBuyerOrderGoods;
import java.util.List;
public interface UfoBuyerOrderMapper {
int deleteByPrimaryKey(Integer id);
int insert(UfoBuyerOrder record);
int insertSelective(UfoBuyerOrder record);
UfoBuyerOrder selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(UfoBuyerOrder record);
int updateByPrimaryKey(UfoBuyerOrder record);
List<UfoBuyerOrder> selectByOrderCodeList(List<Long> orderCodeList);
}
\ No newline at end of file
... ...
<?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.yoho.search.dal.UfoBuyerOrderGoodsMapper" >
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.UfoBuyerOrderGoods" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="order_code" property="orderCode" jdbcType="BIGINT" />
<result column="skup" property="skup" jdbcType="INTEGER" />
<result column="goods_price" property="goodsPrice" jdbcType="DECIMAL" />
<result column="goods_amount" property="goodsAmount" jdbcType="DECIMAL" />
<result column="uid" property="uid" jdbcType="INTEGER" />
<result column="coupon_cut_amount" property="couponCutAmount" jdbcType="DECIMAL" />
</resultMap>
<sql id="Base_Column_List" >
id, order_code, skup, goods_price, goods_amount, uid, coupon_cut_amount
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from ufo_buyer_order_goods
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from ufo_buyer_order_goods
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.search.dal.model.UfoBuyerOrderGoods" >
insert into ufo_buyer_order_goods (id, order_code, skup,
goods_price, goods_amount, uid,
coupon_cut_amount)
values (#{id,jdbcType=INTEGER}, #{orderCode,jdbcType=BIGINT}, #{skup,jdbcType=INTEGER},
#{goodsPrice,jdbcType=DECIMAL}, #{goodsAmount,jdbcType=DECIMAL}, #{uid,jdbcType=INTEGER},
#{couponCutAmount,jdbcType=DECIMAL})
</insert>
<insert id="insertSelective" parameterType="com.yoho.search.dal.model.UfoBuyerOrderGoods" >
insert into ufo_buyer_order_goods
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="orderCode != null" >
order_code,
</if>
<if test="skup != null" >
skup,
</if>
<if test="goodsPrice != null" >
goods_price,
</if>
<if test="goodsAmount != null" >
goods_amount,
</if>
<if test="uid != null" >
uid,
</if>
<if test="couponCutAmount != null" >
coupon_cut_amount,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="orderCode != null" >
#{orderCode,jdbcType=BIGINT},
</if>
<if test="skup != null" >
#{skup,jdbcType=INTEGER},
</if>
<if test="goodsPrice != null" >
#{goodsPrice,jdbcType=DECIMAL},
</if>
<if test="goodsAmount != null" >
#{goodsAmount,jdbcType=DECIMAL},
</if>
<if test="uid != null" >
#{uid,jdbcType=INTEGER},
</if>
<if test="couponCutAmount != null" >
#{couponCutAmount,jdbcType=DECIMAL},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.UfoBuyerOrderGoods" >
update ufo_buyer_order_goods
<set >
<if test="orderCode != null" >
order_code = #{orderCode,jdbcType=BIGINT},
</if>
<if test="skup != null" >
skup = #{skup,jdbcType=INTEGER},
</if>
<if test="goodsPrice != null" >
goods_price = #{goodsPrice,jdbcType=DECIMAL},
</if>
<if test="goodsAmount != null" >
goods_amount = #{goodsAmount,jdbcType=DECIMAL},
</if>
<if test="uid != null" >
uid = #{uid,jdbcType=INTEGER},
</if>
<if test="couponCutAmount != null" >
coupon_cut_amount = #{couponCutAmount,jdbcType=DECIMAL},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.UfoBuyerOrderGoods" >
update ufo_buyer_order_goods
set order_code = #{orderCode,jdbcType=BIGINT},
skup = #{skup,jdbcType=INTEGER},
goods_price = #{goodsPrice,jdbcType=DECIMAL},
goods_amount = #{goodsAmount,jdbcType=DECIMAL},
uid = #{uid,jdbcType=INTEGER},
coupon_cut_amount = #{couponCutAmount,jdbcType=DECIMAL}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectBySkupList" resultMap="BaseResultMap" timeout="20000">
select
<include refid="Base_Column_List"/>
from ufo_buyer_order_goods
WHERE
skup in
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
... ...
<?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.yoho.search.dal.UfoBuyerOrderMapper" >
<resultMap id="BaseResultMap" type="com.yoho.search.dal.model.UfoBuyerOrder" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="uid" property="uid" jdbcType="INTEGER" />
<result column="order_code" property="orderCode" jdbcType="BIGINT" />
<result column="seller_uid" property="sellerUid" jdbcType="INTEGER" />
<result column="client_type" property="clientType" jdbcType="TINYINT" />
<result column="payment" property="payment" jdbcType="TINYINT" />
<result column="payment_type" property="paymentType" jdbcType="TINYINT" />
<result column="is_cancel" property="isCancel" jdbcType="TINYINT" />
<result column="amount" property="amount" jdbcType="DECIMAL" />
<result column="ship_fee" property="shipFee" jdbcType="DECIMAL" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
<result column="seller_order_status" property="sellerOrderStatus" jdbcType="TINYINT" />
<result column="buyer_order_status" property="buyerOrderStatus" jdbcType="TINYINT" />
<result column="channel_no" property="channelNo" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, uid, order_code, seller_uid, client_type, payment, payment_type, is_cancel, amount,
ship_fee, status, create_time, update_time, seller_order_status, buyer_order_status,
channel_no
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from ufo_buyer_order
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from ufo_buyer_order
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.search.dal.model.UfoBuyerOrder" >
insert into ufo_buyer_order (id, uid, order_code,
seller_uid, client_type, payment,
payment_type, is_cancel, amount,
ship_fee, status, create_time,
update_time, seller_order_status, buyer_order_status,
channel_no)
values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=INTEGER}, #{orderCode,jdbcType=BIGINT},
#{sellerUid,jdbcType=INTEGER}, #{clientType,jdbcType=TINYINT}, #{payment,jdbcType=TINYINT},
#{paymentType,jdbcType=TINYINT}, #{isCancel,jdbcType=TINYINT}, #{amount,jdbcType=DECIMAL},
#{shipFee,jdbcType=DECIMAL}, #{status,jdbcType=TINYINT}, #{createTime,jdbcType=INTEGER},
#{updateTime,jdbcType=INTEGER}, #{sellerOrderStatus,jdbcType=TINYINT}, #{buyerOrderStatus,jdbcType=TINYINT},
#{channelNo,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.yoho.search.dal.model.UfoBuyerOrder" >
insert into ufo_buyer_order
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="uid != null" >
uid,
</if>
<if test="orderCode != null" >
order_code,
</if>
<if test="sellerUid != null" >
seller_uid,
</if>
<if test="clientType != null" >
client_type,
</if>
<if test="payment != null" >
payment,
</if>
<if test="paymentType != null" >
payment_type,
</if>
<if test="isCancel != null" >
is_cancel,
</if>
<if test="amount != null" >
amount,
</if>
<if test="shipFee != null" >
ship_fee,
</if>
<if test="status != null" >
status,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="updateTime != null" >
update_time,
</if>
<if test="sellerOrderStatus != null" >
seller_order_status,
</if>
<if test="buyerOrderStatus != null" >
buyer_order_status,
</if>
<if test="channelNo != null" >
channel_no,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="uid != null" >
#{uid,jdbcType=INTEGER},
</if>
<if test="orderCode != null" >
#{orderCode,jdbcType=BIGINT},
</if>
<if test="sellerUid != null" >
#{sellerUid,jdbcType=INTEGER},
</if>
<if test="clientType != null" >
#{clientType,jdbcType=TINYINT},
</if>
<if test="payment != null" >
#{payment,jdbcType=TINYINT},
</if>
<if test="paymentType != null" >
#{paymentType,jdbcType=TINYINT},
</if>
<if test="isCancel != null" >
#{isCancel,jdbcType=TINYINT},
</if>
<if test="amount != null" >
#{amount,jdbcType=DECIMAL},
</if>
<if test="shipFee != null" >
#{shipFee,jdbcType=DECIMAL},
</if>
<if test="status != null" >
#{status,jdbcType=TINYINT},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=INTEGER},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=INTEGER},
</if>
<if test="sellerOrderStatus != null" >
#{sellerOrderStatus,jdbcType=TINYINT},
</if>
<if test="buyerOrderStatus != null" >
#{buyerOrderStatus,jdbcType=TINYINT},
</if>
<if test="channelNo != null" >
#{channelNo,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.search.dal.model.UfoBuyerOrder" >
update ufo_buyer_order
<set >
<if test="uid != null" >
uid = #{uid,jdbcType=INTEGER},
</if>
<if test="orderCode != null" >
order_code = #{orderCode,jdbcType=BIGINT},
</if>
<if test="sellerUid != null" >
seller_uid = #{sellerUid,jdbcType=INTEGER},
</if>
<if test="clientType != null" >
client_type = #{clientType,jdbcType=TINYINT},
</if>
<if test="payment != null" >
payment = #{payment,jdbcType=TINYINT},
</if>
<if test="paymentType != null" >
payment_type = #{paymentType,jdbcType=TINYINT},
</if>
<if test="isCancel != null" >
is_cancel = #{isCancel,jdbcType=TINYINT},
</if>
<if test="amount != null" >
amount = #{amount,jdbcType=DECIMAL},
</if>
<if test="shipFee != null" >
ship_fee = #{shipFee,jdbcType=DECIMAL},
</if>
<if test="status != null" >
status = #{status,jdbcType=TINYINT},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=INTEGER},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=INTEGER},
</if>
<if test="sellerOrderStatus != null" >
seller_order_status = #{sellerOrderStatus,jdbcType=TINYINT},
</if>
<if test="buyerOrderStatus != null" >
buyer_order_status = #{buyerOrderStatus,jdbcType=TINYINT},
</if>
<if test="channelNo != null" >
channel_no = #{channelNo,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.search.dal.model.UfoBuyerOrder" >
update ufo_buyer_order
set uid = #{uid,jdbcType=INTEGER},
order_code = #{orderCode,jdbcType=BIGINT},
seller_uid = #{sellerUid,jdbcType=INTEGER},
client_type = #{clientType,jdbcType=TINYINT},
payment = #{payment,jdbcType=TINYINT},
payment_type = #{paymentType,jdbcType=TINYINT},
is_cancel = #{isCancel,jdbcType=TINYINT},
amount = #{amount,jdbcType=DECIMAL},
ship_fee = #{shipFee,jdbcType=DECIMAL},
status = #{status,jdbcType=TINYINT},
create_time = #{createTime,jdbcType=INTEGER},
update_time = #{updateTime,jdbcType=INTEGER},
seller_order_status = #{sellerOrderStatus,jdbcType=TINYINT},
buyer_order_status = #{buyerOrderStatus,jdbcType=TINYINT},
channel_no = #{channelNo,jdbcType=VARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectByOrderCodeList" resultMap="BaseResultMap" timeout="20000">
select
<include refid="Base_Column_List"/>
from ufo_buyer_order
WHERE
order_code in
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
... ...
package com.yoho.search.consumer.index.increment.ufo;
import com.alibaba.fastjson.JSONObject;
import com.yoho.search.base.utils.ConvertUtils;
import com.yoho.search.base.utils.EventReportEnum;
import com.yoho.search.consumer.index.increment.AbstractMqListener;
import com.yoho.search.consumer.service.daoService.ufo.UfoBuyerOrderGoodsService;
import com.yoho.search.consumer.service.daoService.ufo.UfoGoodsImagesService;
import com.yoho.search.core.message.beans.SearchMqConsumerListerner;
import com.yoho.search.dal.model.UfoBuyerOrderGoods;
import com.yoho.search.dal.model.UfoGoodsImages;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Created by aaron.wang on 2018/12/5.
*/
@Component
@SearchMqConsumerListerner(tableName = "ufo_buyer_order_goods")
public class UfoBuyerOrderGoodsMqListener extends AbstractMqListener {
@Autowired
private UfoBuyerOrderGoodsService ufoBuyerOrderGoodsService;
@Override
protected EventReportEnum getEventReportEnum() {
return EventReportEnum.UFOBUYERORDERGOODSMQLISTENER_ONMESSAGE;
}
@Override
protected void deleteData(String id) throws Exception {
ufoBuyerOrderGoodsService.delete(Integer.valueOf(id));
}
@Override
protected void updateData(JSONObject data) throws Exception {
UfoBuyerOrderGoods ufoBuyerOrderGoods = ConvertUtils.toJavaObject(UfoBuyerOrderGoods.class, data);
if (ufoBuyerOrderGoods == null || ufoBuyerOrderGoods.getId() == null) {
return;
}
ufoBuyerOrderGoodsService.saveOrUpdate(ufoBuyerOrderGoods);
}
}
... ...
package com.yoho.search.consumer.index.increment.ufo;
import com.alibaba.fastjson.JSONObject;
import com.yoho.search.base.utils.ConvertUtils;
import com.yoho.search.base.utils.EventReportEnum;
import com.yoho.search.consumer.index.increment.AbstractMqListener;
import com.yoho.search.consumer.service.daoService.ufo.UfoBuyerOrderService;
import com.yoho.search.consumer.service.daoService.ufo.UfoGoodsImagesService;
import com.yoho.search.core.message.beans.SearchMqConsumerListerner;
import com.yoho.search.dal.model.UfoBuyerOrder;
import com.yoho.search.dal.model.UfoGoodsImages;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Created by aaron.wang on 2018/12/5.
*/
@Component
@SearchMqConsumerListerner(tableName = "ufo_buyer_order")
public class UfoBuyerOrderMqListener extends AbstractMqListener {
@Autowired
private UfoBuyerOrderService ufoBuyerOrderService;
@Override
protected EventReportEnum getEventReportEnum() {
return EventReportEnum.UFOBUYERORDERMQLISTENER_ONMESSAGE;
}
@Override
protected void deleteData(String id) throws Exception {
ufoBuyerOrderService.delete(Integer.valueOf(id));
}
@Override
protected void updateData(JSONObject data) throws Exception {
UfoBuyerOrder ufoBuyerOrder = ConvertUtils.toJavaObject(UfoBuyerOrder.class, data);
if (ufoBuyerOrder == null || ufoBuyerOrder.getId() == null) {
return;
}
ufoBuyerOrderService.saveOrUpdate(ufoBuyerOrder);
}
}
... ...
... ... @@ -201,6 +201,9 @@
},
"orderBy": {
"type": "integer"
},
"salesNum": {
"type": "integer"
}
}
}
... ...
... ... @@ -52,6 +52,15 @@ public class UfoProductIndexBO {
private Double price;
//other
private String idString;
private Integer salesNum;
public Integer getSalesNum() {
return salesNum;
}
public void setSalesNum(Integer salesNum) {
this.salesNum = salesNum;
}
public Integer getId() {
return id;
... ...
package com.yoho.search.consumer.service.daoService.ufo;
import com.yoho.search.dal.UfoBuyerOrderGoodsMapper;
import com.yoho.search.dal.UfoBuyerOrderMapper;
import com.yoho.search.dal.model.UfoBuyerOrder;
import com.yoho.search.dal.model.UfoBuyerOrderGoods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Created by aaron.wang on 2018/12/5.
*/
@Component
public class UfoBuyerOrderGoodsService{
@Autowired
private UfoBuyerOrderGoodsMapper ufoBuyerOrderGoodsMapper;
public UfoBuyerOrderGoods getById(Integer id) {
return ufoBuyerOrderGoodsMapper.selectByPrimaryKey(id);
}
public int insert(UfoBuyerOrderGoods ufoBuyerOrderGoods) {
return ufoBuyerOrderGoodsMapper.insertSelective(ufoBuyerOrderGoods);
}
public int update(UfoBuyerOrderGoods ufoBuyerOrderGoods) {
return ufoBuyerOrderGoodsMapper.updateByPrimaryKeySelective(ufoBuyerOrderGoods);
}
public int saveOrUpdate(UfoBuyerOrderGoods ufoBuyerOrderGoods) {
if (ufoBuyerOrderGoods.getId() == null || ufoBuyerOrderGoodsMapper.selectByPrimaryKey(ufoBuyerOrderGoods.getId()) == null) {
return ufoBuyerOrderGoodsMapper.insertSelective(ufoBuyerOrderGoods);
} else {
return ufoBuyerOrderGoodsMapper.updateByPrimaryKeySelective(ufoBuyerOrderGoods);
}
}
public int delete(Integer id) {
return ufoBuyerOrderGoodsMapper.deleteByPrimaryKey(id);
}
}
... ...
package com.yoho.search.consumer.service.daoService.ufo;
import com.yoho.search.dal.UfoBrandMapper;
import com.yoho.search.dal.UfoBuyerOrderMapper;
import com.yoho.search.dal.model.UfoBrand;
import com.yoho.search.dal.model.UfoBuyerOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Created by aaron.wang on 2018/12/5.
*/
@Component
public class UfoBuyerOrderService {
@Autowired
private UfoBuyerOrderMapper ufoBuyerOrderMapper;
public UfoBuyerOrder getById(Integer id) {
return ufoBuyerOrderMapper.selectByPrimaryKey(id);
}
public int insert(UfoBuyerOrder ufoBuyerOrder) {
return ufoBuyerOrderMapper.insertSelective(ufoBuyerOrder);
}
public int update(UfoBuyerOrder ufoBuyerOrder) {
return ufoBuyerOrderMapper.updateByPrimaryKeySelective(ufoBuyerOrder);
}
public int saveOrUpdate(UfoBuyerOrder ufoBuyerOrder) {
if (ufoBuyerOrder.getId() == null || ufoBuyerOrderMapper.selectByPrimaryKey(ufoBuyerOrder.getId()) == null) {
return ufoBuyerOrderMapper.insertSelective(ufoBuyerOrder);
} else {
return ufoBuyerOrderMapper.updateByPrimaryKeySelective(ufoBuyerOrder);
}
}
public int delete(Integer id) {
return ufoBuyerOrderMapper.deleteByPrimaryKey(id);
}
}
... ...
package com.yoho.search.consumer.service.logicService.ufo;
import com.yoho.search.consumer.service.bo.UfoProductIndexBO;
import com.yoho.search.dal.UfoBuyerOrderGoodsMapper;
import com.yoho.search.dal.UfoBuyerOrderMapper;
import com.yoho.search.dal.UfoStorageMapper;
import com.yoho.search.dal.UfoStoragePriceMapper;
import com.yoho.search.dal.model.UfoBuyerOrder;
import com.yoho.search.dal.model.UfoBuyerOrderGoods;
import com.yoho.search.dal.model.UfoStoragePrice;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Created by aaron.wang on 2018/12/5.
*/
@Component
public class UfoSalesNumFieldBuilder implements UfoIndexFieldBuilder {
@Autowired
private UfoStoragePriceMapper ufoStoragePriceMapper;
@Autowired
private UfoBuyerOrderMapper ufoBuyerOrderMapper;
@Autowired
private UfoBuyerOrderGoodsMapper ufoBuyerOrderGoodsMapper;
@Override
public void build(List<UfoProductIndexBO> ufoProductIndexBOList, List<Integer> idList) {
List<UfoStoragePrice> ufoStoragePriceList = ufoStoragePriceMapper.selectByProductIdList(idList);
Map<Integer, List<UfoStoragePrice>> ufoStoragePriceMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(ufoStoragePriceList)) {
ufoStoragePriceMap = ufoStoragePriceList.stream().collect(Collectors.groupingBy(UfoStoragePrice::getProductId));
}
for (UfoProductIndexBO ufoProductIndexBO : ufoProductIndexBOList) {
ufoProductIndexBO.setSalesNum(0);
List<UfoStoragePrice> storagePriceList = ufoStoragePriceMap.get(ufoProductIndexBO.getId());
if (CollectionUtils.isEmpty(storagePriceList)) {
continue;
}
List<Integer> skupList = storagePriceList.stream().map(UfoStoragePrice::getSkup).collect(Collectors.toList());
if (CollectionUtils.isEmpty(storagePriceList)) {
continue;
}
List<UfoBuyerOrderGoods> ufoBuyerOrderGoodsList = ufoBuyerOrderGoodsMapper.selectBySkupList(skupList);
if (CollectionUtils.isEmpty(ufoBuyerOrderGoodsList)) {
continue;
}
List<Long> orderCodeList = ufoBuyerOrderGoodsList.stream().map(UfoBuyerOrderGoods::getOrderCode).collect(Collectors.toList());
if (CollectionUtils.isEmpty(orderCodeList)) {
continue;
}
List<UfoBuyerOrder> ufoBuyerOrderList = ufoBuyerOrderMapper.selectByOrderCodeList(orderCodeList);
if (CollectionUtils.isEmpty(ufoBuyerOrderList)) {
continue;
}
Integer saleNum = 0;
for(UfoBuyerOrder ufoBuyerOrder:ufoBuyerOrderList){
if(ufoBuyerOrder.getStatus()==1||ufoBuyerOrder.getStatus()==2||ufoBuyerOrder.getStatus()==3||ufoBuyerOrder.getStatus()==4||ufoBuyerOrder.getStatus()==5){
saleNum++;
}
}
ufoProductIndexBO.setSalesNum(saleNum);
}
}
}
... ...