Authored by mali

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

package com.yoho.order.dal;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yoho.order.model.BuyerOrderGoods;
/**
* Created by caoyan on 2018/9/12.
*/
public interface BuyerOrderGoodsMapper {
List<BuyerOrderGoods> selectByOrderCode(@Param("orderCodeList") List<String> orderCodeList);
}
... ...
package com.yoho.order.dal;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yoho.order.model.ExpressInfo;
/**
* Created by caoyan on 2018/9/12.
*/
public interface ExpressInfoMapper {
List<ExpressInfo> selectByOrderCodeList(@Param("orderCodeList") List<String> orderCodeList);
ExpressInfo selectByWaybillCode(@Param("waybillCode") String waybillCode);
}
... ...
package com.yoho.order.dal;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yoho.order.model.SellerOrderGoods;
/**
* Created by caoyan on 2018/9/12.
*/
public interface SellerOrderGoodsMapper {
List<SellerOrderGoods> selectByIds(@Param("idList") List<Integer> idList);
}
... ...
package com.yoho.order.dal;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yoho.order.model.SellerOrder;
/**
* Created by caoyan on 2018/9/12.
*/
public interface SellerOrderMapper {
List<SellerOrder> selectBySkups(@Param("skupList") List<Integer> skupList);
SellerOrder selectByOrderCode(@Param("orderCode") String orderCode);
}
... ...
... ... @@ -16,7 +16,7 @@ public class BuyerOrder implements Serializable {
private Integer uid;
private Integer orderCode;
private String orderCode;
private Integer sellerUid;//卖家UID
... ... @@ -43,8 +43,6 @@ public class BuyerOrder implements Serializable {
private Integer updateTime;//更新时间
private Byte orderStatus;//1:有效,0:逻辑删除
private String channelNo;//渠道号
public Integer getId() {
... ... @@ -63,11 +61,11 @@ public class BuyerOrder implements Serializable {
this.uid = uid;
}
public Integer getOrderCode() {
public String getOrderCode() {
return orderCode;
}
public void setOrderCode(Integer orderCode) {
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
... ... @@ -151,14 +149,6 @@ public class BuyerOrder implements Serializable {
this.updateTime = updateTime;
}
public Byte getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(Byte orderStatus) {
this.orderStatus = orderStatus;
}
public String getChannelNo() {
return channelNo;
}
... ... @@ -169,7 +159,7 @@ public class BuyerOrder implements Serializable {
@Override
public String toString() {
return "Brand{" +
return "BuyerOrder{" +
"id=" + id +
", uid='" + uid + '\'' +
", orderCode='" + orderCode + '\'' +
... ... @@ -183,7 +173,6 @@ public class BuyerOrder implements Serializable {
", status=" + status +
", createTime=" + createTime +
", updateTime=" + updateTime +
", orderStatus=" + orderStatus +
", channelNo=" + channelNo +
'}';
}
... ...
package com.yoho.order.model;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author caoyan
* @date 2018/9/12
*/
public class BuyerOrderGoods implements Serializable {
private static final long serialVersionUID = 2607922995706119816L;
private Integer id;
private Integer uid;
private String orderCode;
private Integer skup;
private BigDecimal goodsPrice;//标价
private BigDecimal goodsAmount;//成交价
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public String getOrderCode() {
return orderCode;
}
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public Integer getSkup() {
return skup;
}
public void setSkup(Integer skup) {
this.skup = skup;
}
public BigDecimal getGoodsPrice() {
return goodsPrice;
}
public void setGoodsPrice(BigDecimal goodsPrice) {
this.goodsPrice = goodsPrice;
}
public BigDecimal getGoodsAmount() {
return goodsAmount;
}
public void setGoodsAmount(BigDecimal goodsAmount) {
this.goodsAmount = goodsAmount;
}
@Override
public String toString() {
return "BuyerOrderGoods{" +
"id=" + id +
", uid='" + uid + '\'' +
", orderCode='" + orderCode + '\'' +
", skup='" + skup + '\'' +
", goodsPrice=" + goodsPrice +
", goodsAmount=" + goodsAmount +
'}';
}
}
... ...
... ... @@ -14,8 +14,102 @@ public class BuyerOrderReq extends PageRequestBO{
*/
private static final long serialVersionUID = 1620427808531296022L;
private String orderCode;
private Integer uid;
private Integer sellerUid;
private String sellerWaybillCode;
private Integer productId;
private Integer storageId;
private String mobile;
private Integer skup;
private Byte status;
private List<Byte> statusList;
private String statusStr;
private Integer depotNo;
public String getOrderCode() {
return orderCode;
}
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public Integer getSellerUid() {
return sellerUid;
}
public void setSellerUid(Integer sellerUid) {
this.sellerUid = sellerUid;
}
public String getSellerWaybillCode() {
return sellerWaybillCode;
}
public void setSellerWaybillCode(String sellerWaybillCode) {
this.sellerWaybillCode = sellerWaybillCode;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public Integer getStorageId() {
return storageId;
}
public void setStorageId(Integer storageId) {
this.storageId = storageId;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public Integer getSkup() {
return skup;
}
public void setSkup(Integer skup) {
this.skup = skup;
}
public Byte getStatus() {
return status;
}
public void setStatus(Byte status) {
this.status = status;
}
public List<Byte> getStatusList() {
return statusList;
}
... ... @@ -23,11 +117,36 @@ public class BuyerOrderReq extends PageRequestBO{
public void setStatusList(List<Byte> statusList) {
this.statusList = statusList;
}
@Override
public String toString() {
public String getStatusStr() {
return statusStr;
}
public void setStatusStr(String statusStr) {
this.statusStr = statusStr;
}
public Integer getDepotNo() {
return depotNo;
}
public void setDepotNo(Integer depotNo) {
this.depotNo = depotNo;
}
public String toString() {
return "BuyerOrderListReq{" +
"statusList=" + statusList +
"orderCode=" + orderCode +
"uid=" + uid +
"sellerUid=" + sellerUid +
"sellerWaybillCode=" + sellerWaybillCode +
"productId=" + productId +
"storageId=" + storageId +
"skup=" + skup +
"status=" + status +
"statusList=" + statusList +
"statusStr=" + statusStr +
"depotNo=" + depotNo +
'}';
}
}
... ...
... ... @@ -15,7 +15,7 @@ public class ExpressInfo implements Serializable {
private Integer uid;
private Integer orderCode;
private String orderCode;
private String waybillCode;//运单号
... ... @@ -50,11 +50,11 @@ public class ExpressInfo implements Serializable {
this.uid = uid;
}
public Integer getOrderCode() {
public String getOrderCode() {
return orderCode;
}
public void setOrderCode(Integer orderCode) {
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
... ...
... ... @@ -16,7 +16,7 @@ public class SellerOrder implements Serializable {
private Integer uid;
private Integer orderCode;
private String orderCode;
private Integer skup;//映射ufo_product.storage_price.id
... ... @@ -56,11 +56,11 @@ public class SellerOrder implements Serializable {
this.uid = uid;
}
public Integer getOrderCode() {
public String getOrderCode() {
return orderCode;
}
public void setOrderCode(Integer orderCode) {
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
... ...
... ... @@ -12,15 +12,19 @@ public class SellerOrderGoods implements Serializable {
private Integer id;
private Integer uid;
private Integer productId;
private String productName;
private Integer skup;
private Integer storageId;
private Integer depotNo;
private Integer goodsId;
private Integer sizeId;
private String sizeName;
private Integer colorId;
... ... @@ -29,6 +33,10 @@ public class SellerOrderGoods implements Serializable {
private BigDecimal goodsPrice;
private Byte status;
private Integer imageId;
private String imageUrl;
public Integer getId() {
return id;
... ... @@ -38,6 +46,14 @@ public class SellerOrderGoods implements Serializable {
this.id = id;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public Integer getProductId() {
return productId;
}
... ... @@ -54,12 +70,12 @@ public class SellerOrderGoods implements Serializable {
this.productName = productName;
}
public Integer getSkup() {
return skup;
public Integer getStorageId() {
return storageId;
}
public void setSkup(Integer skup) {
this.skup = skup;
public void setStorageId(Integer storageId) {
this.storageId = storageId;
}
public Integer getDepotNo() {
... ... @@ -70,12 +86,20 @@ public class SellerOrderGoods implements Serializable {
this.depotNo = depotNo;
}
public Integer getGoodsId() {
return goodsId;
public Integer getSizeId() {
return sizeId;
}
public void setGoodsId(Integer goodsId) {
this.goodsId = goodsId;
public void setSizeId(Integer sizeId) {
this.sizeId = sizeId;
}
public String getSizeName() {
return sizeName;
}
public void setSizeName(String sizeName) {
this.sizeName = sizeName;
}
public Integer getColorId() {
... ... @@ -109,4 +133,21 @@ public class SellerOrderGoods implements Serializable {
public void setStatus(Byte status) {
this.status = status;
}
public Integer getImageId() {
return imageId;
}
public void setImageId(Integer imageId) {
this.imageId = imageId;
}
public String getImageUrl() {
return imageUrl;
}
public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
}
}
... ...
<?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.order.dal.BuyerOrderGoodsMapper">
<resultMap id="BaseResultMap" type="com.yoho.order.model.BuyerOrderGoods">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="uid" property="uid" 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" />
</resultMap>
<sql id="Base_Column_List">
id, uid, order_code, skup, goods_price, goods_amount
</sql>
<select id="selectById" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from buyer_order_goods where id = #{id}
</select>
<select id="selectByOrderCode" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from buyer_order_goods
where order_code in
<foreach collection="orderCodeList" item="orderCode" open="(" close=")" separator=",">
#{orderCode}
</foreach>
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -15,13 +15,12 @@
<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="order_status" property="orderStatus" 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, order_status, channel_no
amount, ship_fee, status, create_time, update_time, channel_no
</sql>
<select id="selectById" resultMap="BaseResultMap">
... ... @@ -38,27 +37,63 @@
</select>
<sql id="Query_Order_Sql" >
<if test="buyerOrderReq.statusList != null and buyerOrderReq.statusList.size() > 0">
and status in
<foreach collection="buyerOrderReq.statusList" item="status" open="(" close=")" separator=",">
#{status}
</foreach>
<if test="buyerOrderReq.statusList != null and buyerOrderReq.statusList.size() >0">
and a.status in
<foreach collection="buyerOrderReq.statusList" item="status" open="(" close=")" separator=",">
#{status}
</foreach>
</if>
<if test="buyerOrderReq.orderCode != null and buyerOrderReq.orderCode != '' ">
and a.order_code = #{buyerOrderReq.orderCode}
</if>
<if test="buyerOrderReq.uid != null and buyerOrderReq.uid != 0 ">
and a.uid = #{buyerOrderReq.uid}
</if>
<if test="buyerOrderReq.status != null ">
and a.status = #{buyerOrderReq.status}
</if>
<if test="buyerOrderReq.productId != null and buyerOrderReq.productId != 0 ">
and c.product_id = #{buyerOrderReq.productId}
</if>
<if test="buyerOrderReq.storageId != null and buyerOrderReq.storageId != 0 ">
and c.storage_id = #{buyerOrderReq.storageId}
</if>
<if test="buyerOrderReq.skup != null and buyerOrderReq.skup != 0 ">
and c.id = #{buyerOrderReq.skup}
</if>
<if test="buyerOrderReq.depotNo != null and buyerOrderReq.depotNo != 0 ">
and c.depot_no = #{buyerOrderReq.depotNo}
</if>
<if test="buyerOrderReq.mobile != null and buyerOrderReq.mobile != '' ">
and (a.uid = #{buyerOrderReq.sellerUid} or a.seller_uid = #{buyerOrderReq.sellerUid})
</if>
</sql>
<select id="selectTotalByCondition" resultType="java.lang.Integer" parameterType="com.yoho.order.model.BuyerOrderReq">
select count(1)
from buyer_order
select count(a.id)
from buyer_order a
<if test="(buyerOrderReq.depotNo != null) or (buyerOrderReq.productId != null) or (buyerOrderReq.storageId != null) or (buyerOrderReq.skup != null)">
LEFT JOIN buyer_order_goods b
ON( b.order_code=a.order_code)
LEFT JOIN seller_order_goods c
ON( c.id=b.skup)
</if>
where 1=1
<include refid="Query_Order_Sql" />
</select>
<select id="selectByCondition" resultMap="BaseResultMap" parameterType="com.yoho.order.model.BuyerOrderReq">
select <include refid="Base_Column_List" />
from buyer_order
select a.*
from buyer_order a
<if test="(buyerOrderReq.productId != null) or (buyerOrderReq.storageId != null) or (buyerOrderReq.skup != null)">
LEFT JOIN buyer_order_goods b
ON( b.order_code=a.order_code)
LEFT JOIN seller_order_goods c
ON( c.id=b.skup)
</if>
where 1=1
<include refid="Query_Order_Sql" />
order by create_time desc
order by a.create_time desc
<if test="buyerOrderReq.start!=null and buyerOrderReq.size != null">
limit #{buyerOrderReq.start},#{buyerOrderReq.size}
</if>
... ...
<?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.ufo.dal.ExpressInfoMapper">
<mapper namespace="com.yoho.order.dal.ExpressInfoMapper">
<resultMap id="BaseResultMap" type="com.yoho.order.model.ExpressInfo">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="uid" property="uid" jdbcType="INTEGER" />
... ... @@ -19,9 +19,17 @@
create_time, express_type, state
</sql>
<select id="selectById" resultMap="BaseResultMap">
<select id="selectByOrderCodeList" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from express_info where id = #{id}
from express_info where order_code in
<foreach collection="orderCodeList" item="orderCode" open="(" close=")" separator=",">
#{orderCode}
</foreach>
</select>
<select id="selectByWaybillCode" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from express_info where waybill_code = #{waybillCode}
</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.ufo.dal.SellerOrderGoodsMapper">
<mapper namespace="com.yoho.order.dal.SellerOrderGoodsMapper">
<resultMap id="BaseResultMap" type="com.yoho.order.model.SellerOrderGoods">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="uid" property="uid" jdbcType="INTEGER" />
<result column="product_id" property="productId" jdbcType="INTEGER" />
<result column="product_name" property="productName" jdbcType="VARCHAR" />
<result column="skup" property="skup" jdbcType="INTEGER" />
<result column="storage_id" property="storageId" jdbcType="INTEGER" />
<result column="depot_no" property="depotNo" jdbcType="INTEGER" />
<result column="goods_id" property="goodsId" jdbcType="INTEGER" />
<result column="size_id" property="sizeId" jdbcType="INTEGER" />
<result column="size_name" property="sizeName" jdbcType="VARCHAR" />
<result column="color_id" property="colorId" jdbcType="SMALLINT" />
<result column="color_name" property="colorName" jdbcType="VARCHAR" />
<result column="goods_price" property="goodsPrice" jdbcType="DECIMAL" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="image_id" property="imageId" jdbcType="INTEGER" />
<result column="image_url" property="imageUrl" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List">
id, product_id, product_name, skup, depot_no, goods_id, color_id, color_name, goods_price, status
id, uid, product_id, product_name, storage_id, depot_no, size_id, size_name, color_id,
color_name, goods_price, status, image_id, image_url
</sql>
<select id="selectById" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from seller_order_goods where id = #{id}
<select id="selectByIds" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from seller_order_goods where id in
<foreach collection="idList" item="id" open="(" close=")" separator=",">
#{id}
</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.ufo.dal.SellerOrderMapper">
<mapper namespace="com.yoho.order.dal.SellerOrderMapper">
<resultMap id="BaseResultMap" type="com.yoho.order.model.SellerOrder">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="uid" property="uid" jdbcType="INTEGER" />
... ... @@ -26,9 +26,17 @@
from seller_order where id = #{id}
</select>
<select id="selectCountByStatus" resultMap="BaseResultMap">
<select id="selectBySkups" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from seller_order where id = #{id}
from seller_order where id in
<foreach collection="skupList" item="skup" open="(" close=")" separator=",">
#{skup}
</foreach>
</select>
<select id="selectByOrderCode" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from seller_order where order_code = #{orderCode}
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -38,6 +38,10 @@
<groupId>com.yoho.ufo.model</groupId>
<artifactId>order-ufo-model</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.core</groupId>
<artifactId>yoho-core-rest-client-simple</artifactId>
</dependency>
</dependencies>
</project>
... ...
package com.yoho.ufo.order.service.impl;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.common.collect.Lists;
import org.elasticsearch.common.collect.Maps;
import org.elasticsearch.common.netty.util.internal.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.order.dal.BuyerOrderGoodsMapper;
import com.yoho.order.dal.BuyerOrderMapper;
import com.yoho.order.dal.ExpressInfoMapper;
import com.yoho.order.dal.SellerOrderGoodsMapper;
import com.yoho.order.dal.SellerOrderMapper;
import com.yoho.order.model.BuyerOrder;
import com.yoho.order.model.BuyerOrderGoods;
import com.yoho.order.model.BuyerOrderReq;
import com.yoho.order.model.ExpressInfo;
import com.yoho.order.model.SellerOrder;
import com.yoho.order.model.SellerOrderGoods;
import com.yoho.ufo.order.constant.Constant;
import com.yoho.ufo.order.service.IBuyerOrderService;
import com.yoho.ufo.service.model.PageResponseBO;
... ... @@ -32,6 +46,21 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
@Autowired
private BuyerOrderMapper buyerOrderMapper;
@Autowired
private SellerOrderMapper sellerOrderMapper;
@Autowired
private ExpressInfoMapper expressInfoMapper;
@Autowired
private BuyerOrderGoodsMapper buyerOrderGoodsMapper;
@Autowired
private SellerOrderGoodsMapper sellerOrderGoodsMapper;
@Autowired
private ServiceCaller serviceCaller;
public Map<String, Integer> getCountByJudgeStatus(){
List<Byte> toBeJudgedList = Lists.newArrayList();
List<Byte> alreadyJudgedList = Lists.newArrayList();
... ... @@ -51,6 +80,10 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
}
public PageResponseBO<BuyerOrderResp> queryOrderList(BuyerOrderReq req) {
if(!checkAndBuildParam(req)) {
return null;
}
int total = buyerOrderMapper.selectTotalByCondition(req);
if(total == 0) {
return null;
... ... @@ -61,24 +94,95 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
return null;
}
//查询buyer_order_goods
List<String> buyerOrderCodeList = orderList.stream().map(BuyerOrder::getOrderCode).collect(Collectors.toList());
List<BuyerOrderGoods> buyerGoodsList = buyerOrderGoodsMapper.selectByOrderCode(buyerOrderCodeList);
Map<String, BuyerOrderGoods> buyerGoodsMap = buyerGoodsList.stream().collect(Collectors.toMap(BuyerOrderGoods::getOrderCode, b->b));
//查询seller_order_goods
List<Integer> skupList = buyerGoodsList.stream().map(BuyerOrderGoods::getSkup).collect(Collectors.toList());
List<SellerOrderGoods> sellerGoodsList = sellerOrderGoodsMapper.selectByIds(skupList);
Map<Integer, SellerOrderGoods> sellerGoodsMap = sellerGoodsList.stream().collect(Collectors.toMap(SellerOrderGoods::getId, s->s));
//查询seller_order
List<SellerOrder> sellerOrderList = sellerOrderMapper.selectBySkups(skupList);
List<String> sellerOrderCodeList = sellerOrderList.stream().map(SellerOrder::getOrderCode).collect(Collectors.toList());
Map<Integer, SellerOrder> sellerOrderMap = sellerOrderList.stream().collect(Collectors.toMap(SellerOrder::getSkup, s->s));
//查询卖家快递单号
List<ExpressInfo> expressInfoList =expressInfoMapper.selectByOrderCodeList(sellerOrderCodeList);
Map<String, ExpressInfo> expressInfoMap = expressInfoList.stream().collect(Collectors.toMap(ExpressInfo::getOrderCode, e->e));
List<BuyerOrderResp> respList = convertToResp(orderList, buyerGoodsMap, sellerOrderMap, sellerGoodsMap,expressInfoMap);
PageResponseBO<BuyerOrderResp> result=new PageResponseBO<>();
result.setList(respList);
result.setPage(req.getPage());
result.setSize(req.getSize());
result.setTotal(total);
return result;
}
private List<BuyerOrderResp> convertToResp(List<BuyerOrder> orderList, Map<String, BuyerOrderGoods> buyerGoodsMap,
Map<Integer, SellerOrder> sellerOrderMap, Map<Integer, SellerOrderGoods> sellerGoodsMap, Map<String, ExpressInfo> expressInfoMap){
List<BuyerOrderResp> respList = Lists.newArrayList();
for(BuyerOrder item : orderList) {
Integer skup = buyerGoodsMap.get(item.getOrderCode()).getSkup();
SellerOrder sellerOrder= sellerOrderMap.get(skup);
BuyerOrderResp resp = new BuyerOrderResp();
resp.setId(item.getId());
resp.setOrderCode(item.getOrderCode());
resp.setStatus(item.getStatus());
resp.setCreateTimeStr(DateUtil.long2DateStr(item.getCreateTime()*1000, "yyyy-MM-dd HH:mm:ss"));
resp.setProductNum(1);//目前固定为1
resp.setSkuStr(sellerGoodsMap.get(skup).getStorageId().toString());
resp.setDepotNo(sellerGoodsMap.get(skup).getDepotNo());
resp.setSellerWaybillCode(expressInfoMap.get(sellerOrder.getOrderCode()).getWaybillCode());
resp.setCreateTimeStr(null == item.getCreateTime() ? "" : DateUtil.long2DateStr(item.getCreateTime().longValue()*1000, "yyyy-MM-dd HH:mm:ss"));
respList.add(resp);
}
PageResponseBO<BuyerOrderResp> result=new PageResponseBO<>();
result.setList(respList);
result.setPage(req.getPage());
result.setSize(req.getSize());
result.setTotal(total);
return result;
return respList;
}
private boolean checkAndBuildParam(BuyerOrderReq req) {
if(StringUtils.isNotEmpty(req.getStatusStr())) {
req.setStatusList(convertStatus(req.getStatusStr()));
}
if(StringUtils.isNotEmpty(req.getSellerWaybillCode())) {
ExpressInfo expressInfo = expressInfoMapper.selectByWaybillCode(req.getSellerWaybillCode());
if(null == expressInfo) {
return false;
}else {
String sellerOrderCode = expressInfo.getOrderCode();
SellerOrder sellerOrder = sellerOrderMapper.selectByOrderCode(sellerOrderCode);
req.setSkup(sellerOrder.getSkup());
}
}
if(StringUtils.isNotEmpty(req.getMobile())) {
Map<String,String> request = Collections.singletonMap("account", req.getMobile());
JSONObject jsonObject = serviceCaller.getcall("uic.getProfileAction", request, JSONObject.class);
if(null == jsonObject.getJSONObject("data") || null == jsonObject.getJSONObject("data").getInteger("uid")) {
return false;
}
Integer uid = jsonObject.getJSONObject("data").getInteger("uid");
req.setSellerUid(uid);//卖家uid
}
return true;
}
private List<Byte> convertStatus(String statusStr){
String[] statusArr = StringUtil.split(statusStr, ',');
List<Byte> list = Lists.newArrayList();
for(int i=0; i<statusArr.length; i++) {
list.add(Byte.valueOf(statusArr[i]));
}
return list;
}
}
... ...
... ... @@ -21,6 +21,7 @@ datasources:
- com.yoho.order.dal.SellerOrderMapper
- com.yoho.order.dal.SellerOrderGoodsMapper
- com.yoho.order.dal.ExpressInfoMapper
- com.yoho.order.dal.BuyerOrderGoodsMapper
readOnlyInSlave: true
... ...
... ... @@ -21,5 +21,6 @@ datasources:
- com.yoho.order.dal.SellerOrderMapper
- com.yoho.order.dal.SellerOrderGoodsMapper
- com.yoho.order.dal.ExpressInfoMapper
- com.yoho.order.dal.BuyerOrderGoodsMapper
readOnlyInSlave: ${readOnlyInSlave}
... ...
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Yoho!Buy运营平台</title>
<script src="/ufoPlatform/js/include.js"></script>
</head>
<body class="easyui-layout">
<div region="north" style="height:300px;">
<script>
document.write(addHead('鉴定中心', '列表管理'));
</script>
<div style="margin-left:1200px">
<select id="depotNo" style="width:70px;">
<option value="1" selected>北京</option>
<option value="2">南京</option>
</select>
</div>
<div id="tt" class="easyui-tabs">
<div title="待鉴定" style="padding:20px;display:none;">
<div>
<label>订单编号:</label>
<input id="orderCode_0" type="text" class="easyui-textbox" style="width:150px">
<label>买家UID:</label>
<input id="buyerUid_0" type="text" class="easyui-textbox" style="width:150px"/>
<label>卖家快递单号:</label>
<input id="sellerWaybillCode_0" type="text" class="easyui-textbox" style="width:150px"/>
<label>订单状态:</label>
<select id="status_0" class="easyui-combobox" style="width:100px;" >
<option value="">全部</option>
<option value="2">卖家已发货</option>
<option value="3">平台鉴定中</option>
</select>
<br>
<label>商品编码:</label>
<input id="productId_0" type="text" class="easyui-textbox" style="width:150px"/>
<label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SKU:</label>
<input id="sku_0" type="text" class="easyui-textbox" style="width:150px"/>
<label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;手机号:</label>
<input id="mobile_0" type="text" class="easyui-textbox" style="width:150px"/>
<label>&nbsp;&nbsp;&nbsp;SKU-P:</label>
<input id="skup_0" type="text" class="easyui-textbox" style="width:150px"/>
<a id="searchBtn_0" class="btn-info">查询</a>
<a id="allBtn_0" class="btn-success">全部</a>
</div>
</div>
<div title="鉴定完成" style="overflow:auto;padding:20px;display:none;">
<div>
<label>订单编号:</label>
<input id="orderCode_1" type="text" class="easyui-textbox" style="width:150px">
<label>买家UID:</label>
<input id="buyerUid_1" type="text" class="easyui-textbox" style="width:150px"/>
<label>卖家快递单号:</label>
<input id="sellerWaybillCode_1" type="text" class="easyui-textbox" style="width:150px"/>
<label>订单状态:</label>
<select id="status_1" class="easyui-combobox" style="width:100px;" >
<option value="">全部</option>
<option value="4">鉴定通过</option>
<option value="13">鉴定不通过</option>
</select>
<br>
<label>商品编码:</label>
<input id="productId_1" type="text" class="easyui-textbox" style="width:150px"/>
<label> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SKU:</label>
<input id="sku_1" type="text" class="easyui-textbox" style="width:150px"/>
<label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;手机号:</label>
<input id="mobile_1" type="text" class="easyui-textbox" style="width:150px"/>
<label>&nbsp;&nbsp;&nbsp;SKU-P:</label>
<input id="skup_1" type="text" class="easyui-textbox" style="width:150px"/>
<a id="searchBtn_1" class="btn-info">查询</a>
<a id="allBtn_1" class="btn-success">全部</a>
</div>
</div>
</div>
</div>
<div id="orderList" region="center">
<table id="orderListTable"></table>
</div>
<script>
$(function() {
$("#depotNo").combobox({
onchange : function(newValue, oldValue){
var depotNo = $("#depotNo").combobox("getValue");
alert(depotNo);
}
});
$("#searchBtn_0").linkbutton({
iconCls : "icon-search",
onClick : function() {
$("#orderListTable").datagrid("load", {
statusStr : "2,3",
status : $("#status_0").myCombobox("getValue"),
orderCode : $("#orderCode_0").val(),
uid : $("#buyerUid_0").val(),
productId : $("#productId_0").val(),
storageId : $("#sku_0").val(),
skup : $("#skup_0").val(),
sellerWaybillCode : $("#sellerWaybillCode_0").val(),
mobile : $("#mobile_0").val(),
depotNo : $("#depotNo").myCombobox("getValue")
});
}
});
$("#searchBtn_1").linkbutton({
iconCls : "icon-search",
onClick : function() {
$("#orderListTable").datagrid("load", {
statusStr : "4,13",
status : $("#status_1").myCombobox("getValue"),
orderCode : $("#orderCode_1").val(),
uid : $("#buyerUid_1").val(),
productId : $("#productId_1").val(),
storageId : $("#sku_1").val(),
skup : $("#skup_1").val(),
sellerWaybillCode : $("#sellerWaybillCode_1").val(),
mobile : $("#mobile_1").val()
});
}
})
getToBeJudgedList();
$("#tt").tabs({
onSelect:function(title,index){
if(index == 0){
getToBeJudgedList();
}else if(index == 1){
getAlreadyJudgedList();
}
}
});
//全部按钮
$("#allBtn_0").linkbutton({
iconCls: "icon-import",
onClick: function () {
$("#orderCode_0").textbox('setValue','');
$("#uid_0").textbox('setValue','');
$("#sellerWaybillCode_0").textbox('setValue','');
$("#status_0").combobox('setValue','');
$("#productId_0").textbox('setValue','');
$("#sku_0").textbox('setValue','');
$("#mobile_0").textbox('setValue','');
$("#skup_0").textbox('setValue','');
$("#orderListTable").datagrid("load", {
statusStr: "2,3",
});
}
});
$("#allBtn_1").linkbutton({
iconCls: "icon-import",
onClick: function () {
$("#orderCode_1").textbox('setValue','');
$("#uid_1").textbox('setValue','');
$("#sellerWaybillCode_1").textbox('setValue','');
$("#status_1").combobox('setValue','');
$("#productId_1").textbox('setValue','');
$("#sku_1").textbox('setValue','');
$("#mobile_1").textbox('setValue','');
$("#skup_1").textbox('setValue','');
$("#orderListTable").datagrid("load", {
statusStr: "4,13",
});
}
});
});
function getToBeJudgedList(){
$("#orderListTable").myDatagrid({
fit: true,
fitColumns: true,
striped: true,
url: contextPath + "/buyerOrder/queryOrderList",
method: 'POST',
queryParams: {
statusStr: "2,3"
},
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp=null==temp?[]:temp;
temp.rows = temp.list;
return temp;
},
columns: [[{
title: "卖家快递单号",
field: "sellerWaybillCode",
width: 30,
align: "center"
}, {
title: "收货仓库",
field: "depotNo",
width: 20,
align: "center"
}, {
title: "商品件数",
field: "productNum",
width: 20,
align: "center"
}, {
title: "SKU",
field: "skuStr",
width: 20,
align: "center"
}, {
title: "订单编号",
field: "orderCode",
width: 30,
align: "center"
}, {
title: "订单状态",
field: "status",
width: 20,
align: "center",
formatter: function (value, rowData, rowIndex) {
if (value == 2) {
return "卖家已发货";
}else if(value == 3){
return "平台鉴定中";
}
}
},{
title: "下单时间",
field: "createTimeStr",
width: 20,
align: "center"
},{
title: "操作",
field: "asdf",
width: 30,
align: "center",
formatter: function (value, rowData, rowIndex) {
if (rowData.status == 2) {
return "<a role='close' dataId='"+ rowData.shopId +"' style='margin-left:10px;background-color: #5cb85c !important;'>确认收货</a>";
} else if (rowData.status == 3) {
return "<a role='open' dataId='"+ rowData.shopId +"' style='margin-left:10px;background-color: #d9534f !important;'>鉴定通过</a>"+
"<a role='open' dataId='"+ rowData.shopId +"' style='margin-left:10px;background-color: #5cb85c !important;'>鉴定不通过</a>";
}
}
}]],
cache: false,
pagination: true,
pageSize: 20,
idField: "id",
singleSelect: true,
onLoadSuccess: function (data) {
$(this).datagrid("getPanel").find("a[role='open']").linkbutton({
onClick: function () {
var shopsId = $(this).attr("dataId");
$.post(contextPath + "/couponLimit/shopStartOrStop.do", {
shopsIdForShop : shopsId,
shopLimitStatus : 1,
type : 0
}, function(data) {
if (data.code == CODE_SUCCESS) {
$("#limitListTable").datagrid("reload");
window.self.$.messager.show({
title : "提示",
msg : "开启成功!"
});
} else {
window.self.$.messager.alert("失败", data.message, "error");
}
});
}
});
$(this).datagrid("getPanel").find("a[role='close']").linkbutton({
onClick: function () {
var shopsId = $(this).attr("dataId");
$.post(contextPath + "/couponLimit/shopStartOrStop.do", {
shopsIdForShop : shopsId,
shopLimitStatus : 0,
type : 0
}, function(data) {
if (data.code == CODE_SUCCESS) {
$("#limitListTable").datagrid("reload");
window.self.$.messager.show({
title : "提示",
msg : "关闭成功!"
});
} else {
window.self.$.messager.alert("失败", data.message, "error");
}
});
}
});
}
});
}
function getAlreadyJudgedList(){
var depotNo = $("#depotNo").myCombobox("getValue");
$("#orderListTable").myDatagrid({
fit: true,
fitColumns: true,
striped: true,
url: contextPath + "/buyerOrder/queryOrderList",
method: 'POST',
queryParams: {
statusStr: "4,13",
depotNo: depotNo
},
loadFilter: function (data) {
var temp = defaultLoadFilter(data);
temp=null==temp?[]:temp;
temp.rows = temp.list;
return temp;
},
columns: [[{
title: "卖家快递单号",
field: "sellerWaybillCode",
width: 30,
align: "center"
}, {
title: "收货仓库",
field: "depotNo",
width: 20,
align: "center"
}, {
title: "商品件数",
field: "productNum",
width: 20,
align: "center"
}, {
title: "SKU",
field: "skuStr",
width: 20,
align: "center"
}, {
title: "订单编号",
field: "orderCode",
width: 30,
align: "center"
}, {
title: "订单状态",
field: "status",
width: 20,
align: "center",
formatter: function (value, rowData, rowIndex) {
if (value == 4) {
return "鉴定通过";
}else if(value == 13){
return "鉴定不通过";
}
}
},{
title: "下单时间",
field: "createTimeStr",
width: 20,
align: "center"
}]],
cache: false,
pagination: true,
pageSize: 20,
idField: "id",
singleSelect: true,
onLoadSuccess: function (data) {
}
});
}
function addPage() {
var div = $("<div id='addProductCouponLimitDiv'>").appendTo($(document.body));
var url = contextPath + "/html/promotion/useCouponLimit/add.html";
$(div).myDialog({
width: "50%",
height: "40%",
title: "导入商品的用券限制",
href: url,
modal: true,
collapsible: true,
cache: false,
buttons: [{
text: "保存",
id: "saveBtn",
iconCls: "icon-save",
onClick: function () {
$('#uploadFile').click();
}
}, {
text: "关闭",
iconCls: "icon-cancel",
handler: function () {
$(div).dialog("close");
}
}]
});
}
</script>
</body>
</html>
\ No newline at end of file
... ...