Authored by caoyan

订单查询

package com.yoho.ufo.dal;
import com.yoho.ufo.dal.model.IdentifyRecords;
import com.yoho.ufo.model.coupon.UserCoupon;
import com.yohobuy.ufo.coupon.req.UserCouponQueryReq;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import com.yoho.ufo.dal.model.IdentifyRecords;
/**
*/
public interface IdentifyRecordsMapper {
int insertRecord(IdentifyRecords records);
List<IdentifyRecords> selectByBatchOrderCode(@Param("orderCodeList") List<String> orderCode);
}
... ...
... ... @@ -24,4 +24,12 @@
(#{tagId,jdbcType=VARCHAR },#{nfcUid,jdbcType=VARCHAR },#{owner,jdbcType=INTEGER },#{allowTransfer,jdbcType=INTEGER },#{orderCode,jdbcType=BIGINT },
#{authTime,jdbcType=INTEGER },#{authUid,jdbcType=VARCHAR },#{authName,jdbcType=VARCHAR })
</insert>
<select id="selectByBatchOrderCode" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from identify_records where order_code in
<foreach item="orderCode" collection="orderCodeList" open="(" separator="," close=")">
#{orderCode}
</foreach>
</select>
</mapper>
\ No newline at end of file
... ...
package com.yoho.ufo.order.service.impl;
import java.math.BigDecimal;
import java.util.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import com.yoho.order.dal.*;
import com.yoho.order.model.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.common.collect.Lists;
... ... @@ -22,8 +25,38 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.error.exception.ServiceException;
import com.yoho.order.dal.AppraiseAddressMapper;
import com.yoho.order.dal.AreaMapper;
import com.yoho.order.dal.BuyerOrderGoodsMapper;
import com.yoho.order.dal.BuyerOrderMapper;
import com.yoho.order.dal.BuyerOrderMetaMapper;
import com.yoho.order.dal.ExpressCompanyMapper;
import com.yoho.order.dal.ExpressInfoMapper;
import com.yoho.order.dal.ExpressRecordMapper;
import com.yoho.order.dal.OrderOperateRecordMapper;
import com.yoho.order.dal.OrdersPayMapper;
import com.yoho.order.dal.QiniuLiveRecordMapper;
import com.yoho.order.dal.SellerOrderGoodsMapper;
import com.yoho.order.dal.SellerOrderMapper;
import com.yoho.order.dal.SellerOrderMetaMapper;
import com.yoho.order.model.Area;
import com.yoho.order.model.BuyerOrder;
import com.yoho.order.model.BuyerOrderGoods;
import com.yoho.order.model.BuyerOrderMeta;
import com.yoho.order.model.BuyerOrderReq;
import com.yoho.order.model.ExpressCompany;
import com.yoho.order.model.ExpressInfo;
import com.yoho.order.model.ExpressRecord;
import com.yoho.order.model.OrderOperateRecord;
import com.yoho.order.model.OrdersPay;
import com.yoho.order.model.QiniuLiveRecord;
import com.yoho.order.model.SellerOrder;
import com.yoho.order.model.SellerOrderGoods;
import com.yoho.order.model.SellerOrderMeta;
import com.yoho.service.model.order.request.OrderRequest;
import com.yoho.ufo.dal.IdentifyRecordsMapper;
import com.yoho.ufo.dal.ProductMapper;
import com.yoho.ufo.dal.model.IdentifyRecords;
import com.yoho.ufo.dal.model.Product;
import com.yoho.ufo.order.constant.Constant;
import com.yoho.ufo.order.service.IBuyerOrderService;
... ... @@ -94,6 +127,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
@Autowired
private QiniuLiveRecordMapper qiniuLiveRecordMapper;
@Autowired
private IdentifyRecordsMapper identifyRecordsMapper;
private static final String BUYER_ORDER_META_KEY_DELIVERY_ADDRESS = "delivery_address";
... ... @@ -284,8 +320,11 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
List<ExpressRecord> expressRecordList =expressRecordMapper.selectByOrderCodeListAndType(buyerOrderCodeList, Lists.newArrayList(EXPRESS_TYPE_SELLER_TO_JUDGE));
Map<String, ExpressRecord> expressRecordMap = expressRecordList.stream().collect(Collectors.toMap(ExpressRecord::getOrderCode, e->e));
//查询identify_records
List<IdentifyRecords> identifyRecordList = identifyRecordsMapper.selectByBatchOrderCode(buyerOrderCodeList);
Map<String, List<IdentifyRecords>> identifyMap = identifyRecordList.stream().collect(Collectors.groupingBy(IdentifyRecords::getOrderCode));
List<BuyerOrderResp> respList = convertToRespForQuery(orderList, buyerGoodsMap, sellerGoodsMap,expressRecordMap, buyerOrderMetaMap);
List<BuyerOrderResp> respList = convertToRespForQuery(orderList, buyerGoodsMap, sellerGoodsMap,expressRecordMap, buyerOrderMetaMap, identifyMap);
PageResponseBO<BuyerOrderResp> result=new PageResponseBO<>();
result.setPage(1);
... ... @@ -836,7 +875,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
private List<BuyerOrderResp> convertToRespForQuery(List<BuyerOrder> orderList, Map<String, BuyerOrderGoods> buyerGoodsMap,
Map<Integer, SellerOrderGoods> sellerGoodsMap, Map<String, ExpressRecord> expressInfoMap,
Map<String, BuyerOrderMeta> buyerOrderMetaMap){
Map<String, BuyerOrderMeta> buyerOrderMetaMap, Map<String, List<IdentifyRecords>> identifyMap){
List<BuyerOrderResp> respList = Lists.newArrayList();
for(BuyerOrder item : orderList) {
if(null == buyerGoodsMap.get(item.getOrderCode())) {
... ... @@ -857,6 +896,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
resp.setReceiveMobile(metaValue.getString("mobile"));
String receiveAddressCode = metaValue.getString("areaCode");
resp.setReceiveAddress(getAddressInfo(receiveAddressCode));
resp.setNfcStatus(CollectionUtils.isEmpty(identifyMap.get(item.getOrderCode())) ? 0 : 1);//0:未写入,1:已写入
respList.add(resp);
}
... ...