Authored by Lixiaodi

Merge branch 'test6.9.10' of http://git.yoho.cn/ufo/ufo-platform into test6.9.10

@@ -47,4 +47,10 @@ public class StorageDeposit { @@ -47,4 +47,10 @@ public class StorageDeposit {
47 private Integer newSkup; 47 private Integer newSkup;
48 48
49 private Integer orderNo; 49 private Integer orderNo;
  50 +
  51 + private Integer source;//库存来源 0:购买寄存 1:现货寄存
  52 +
  53 + private Integer depositType;//库存类型 0:真实库存 1:虚假库存(无法入库,当时寄回)
  54 +
  55 + private String parentOrderCode;//现货寄存订单的父订单
50 } 56 }
@@ -23,20 +23,25 @@ @@ -23,20 +23,25 @@
23 <result column="out_type" property="outType" jdbcType="INTEGER" /> 23 <result column="out_type" property="outType" jdbcType="INTEGER" />
24 <result column="new_skup" property="newSkup" jdbcType="INTEGER" /> 24 <result column="new_skup" property="newSkup" jdbcType="INTEGER" />
25 <result column="order_no" property="orderNo" jdbcType="INTEGER" /> 25 <result column="order_no" property="orderNo" jdbcType="INTEGER" />
  26 + <result column="source" property="source" jdbcType="INTEGER" />
  27 + <result column="deposit_type" property="depositType" jdbcType="INTEGER" />
  28 + <result column="parent_order_code" property="parentOrderCode" jdbcType="BIGINT" />
26 </resultMap> 29 </resultMap>
27 30
28 <sql id="Base_Column_List"> 31 <sql id="Base_Column_List">
29 id, product_id, goods_id, storage_id, deposit_code, shelf_code, owner_uid, order_code, 32 id, product_id, goods_id, storage_id, deposit_code, shelf_code, owner_uid, order_code,
30 skup, status, order_status, update_time, create_time, deposit_start_time, 33 skup, status, order_status, update_time, create_time, deposit_start_time,
31 - deposit_end_time, edit_pid, out_type, del_status, remind_status,new_skup, order_no 34 + deposit_end_time, edit_pid, out_type, del_status, remind_status,new_skup, order_no,
  35 + source, deposit_type, parent_order_code
32 </sql> 36 </sql>
33 37
34 <insert id="insert" parameterType="com.yoho.order.model.StorageDeposit"> 38 <insert id="insert" parameterType="com.yoho.order.model.StorageDeposit">
35 insert into storage_deposit(id, product_id, goods_id, storage_id, deposit_code, shelf_code, owner_uid, order_code, 39 insert into storage_deposit(id, product_id, goods_id, storage_id, deposit_code, shelf_code, owner_uid, order_code,
36 skup, status, order_status, update_time, create_time, deposit_start_time, 40 skup, status, order_status, update_time, create_time, deposit_start_time,
37 - deposit_end_time, edit_pid, out_type) 41 + deposit_end_time, edit_pid, out_type, source, deposit_type, parent_order_code)
38 values (#{id}, #{productId}, #{goodsId}, #{storageId}, #{depositCode}, #{shelfCode}, #{ownerUid}, #{orderCode}, 42 values (#{id}, #{productId}, #{goodsId}, #{storageId}, #{depositCode}, #{shelfCode}, #{ownerUid}, #{orderCode},
39 - #{skup}, #{status}, #{orderStatus}, #{updateTime}, #{createTime}, #{depositStartTime}, #{depositEndTime}, #{editPid}, #{outType}) 43 + #{skup}, #{status}, #{orderStatus}, #{updateTime}, #{createTime}, #{depositStartTime}, #{depositEndTime}, #{editPid},
  44 + #{outType}, #{source}, #{depositType}, #{parentOrderCode})
40 </insert> 45 </insert>
41 46
42 <update id="batchBindShelfCode"> 47 <update id="batchBindShelfCode">
@@ -22,6 +22,7 @@ import org.apache.commons.collections.CollectionUtils; @@ -22,6 +22,7 @@ import org.apache.commons.collections.CollectionUtils;
22 import org.apache.commons.lang3.StringUtils; 22 import org.apache.commons.lang3.StringUtils;
23 import org.elasticsearch.common.collect.Lists; 23 import org.elasticsearch.common.collect.Lists;
24 import org.elasticsearch.common.collect.Maps; 24 import org.elasticsearch.common.collect.Maps;
  25 +import org.elasticsearch.common.collect.Sets;
25 import org.elasticsearch.common.netty.util.internal.StringUtil; 26 import org.elasticsearch.common.netty.util.internal.StringUtil;
26 import org.slf4j.Logger; 27 import org.slf4j.Logger;
27 import org.slf4j.LoggerFactory; 28 import org.slf4j.LoggerFactory;
@@ -149,6 +150,8 @@ import com.yohobuy.ufo.model.order.common.OrderAttributes; @@ -149,6 +150,8 @@ import com.yohobuy.ufo.model.order.common.OrderAttributes;
149 import com.yohobuy.ufo.model.order.common.OrderStatus; 150 import com.yohobuy.ufo.model.order.common.OrderStatus;
150 import com.yohobuy.ufo.model.order.constants.DepositOrderStatusEnum; 151 import com.yohobuy.ufo.model.order.constants.DepositOrderStatusEnum;
151 import com.yohobuy.ufo.model.order.constants.DepositOutTypeEnum; 152 import com.yohobuy.ufo.model.order.constants.DepositOutTypeEnum;
  153 +import com.yohobuy.ufo.model.order.constants.DepositSourceEnum;
  154 +import com.yohobuy.ufo.model.order.constants.DepositTypeEnum;
152 import com.yohobuy.ufo.model.order.constants.ExpressCompanyEnum; 155 import com.yohobuy.ufo.model.order.constants.ExpressCompanyEnum;
153 import com.yohobuy.ufo.model.order.constants.IdentifyCenterEnum; 156 import com.yohobuy.ufo.model.order.constants.IdentifyCenterEnum;
154 import com.yohobuy.ufo.model.order.constants.RegionEnum; 157 import com.yohobuy.ufo.model.order.constants.RegionEnum;
@@ -936,6 +939,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -936,6 +939,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
936 939
937 private List<BuyerOrderResp> convertAppraiseToBuyerOrderResp(List<AppraiseOrder> list, JSONObject jsonObject){ 940 private List<BuyerOrderResp> convertAppraiseToBuyerOrderResp(List<AppraiseOrder> list, JSONObject jsonObject){
938 List<BuyerOrderResp> respList = Lists.newArrayList(); 941 List<BuyerOrderResp> respList = Lists.newArrayList();
  942 + Set<String> parentOrderSet = Sets.newHashSet();
939 List<String> orderCodeList = list.stream().map(AppraiseOrder::getOrderCode).collect(Collectors.toList()); 943 List<String> orderCodeList = list.stream().map(AppraiseOrder::getOrderCode).collect(Collectors.toList());
940 List<ExpressRecord> expressList = expressRecordMapper.selectByOrderCodeListAndType(orderCodeList, Lists.newArrayList(EnumExpressType.EXPRESS_TYPE_1.getCode())); 944 List<ExpressRecord> expressList = expressRecordMapper.selectByOrderCodeListAndType(orderCodeList, Lists.newArrayList(EnumExpressType.EXPRESS_TYPE_1.getCode()));
941 Map<String, ExpressRecord> expressMap = expressList.stream().collect(Collectors.toMap(ExpressRecord::getOrderCode, e->e)); 945 Map<String, ExpressRecord> expressMap = expressList.stream().collect(Collectors.toMap(ExpressRecord::getOrderCode, e->e));
@@ -956,9 +960,15 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -956,9 +960,15 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
956 resp.setProductCode(goodsMap.get(item.getOrderCode()).getProductCode()); 960 resp.setProductCode(goodsMap.get(item.getOrderCode()).getProductCode());
957 resp.setSizeName(storageMap.get(item.getOrderCode()).getSizeName()); 961 resp.setSizeName(storageMap.get(item.getOrderCode()).getSizeName());
958 962
  963 + if(StringUtils.isNotEmpty(item.getParentOrderCode())) {
  964 + parentOrderSet.add(item.getParentOrderCode());
  965 + }
  966 +
959 respList.add(resp); 967 respList.add(resp);
960 } 968 }
961 969
  970 + jsonObject.put("parentOrderNum", parentOrderSet.size());
  971 +
962 return respList; 972 return respList;
963 } 973 }
964 974
@@ -1665,10 +1675,16 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -1665,10 +1675,16 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
1665 UserHelper userHelper = new UserHelper(); 1675 UserHelper userHelper = new UserHelper();
1666 saveOrderOperateRecord(buyerOrder.getOrderCode(), userHelper, operateType, ""); 1676 saveOrderOperateRecord(buyerOrder.getOrderCode(), userHelper, operateType, "");
1667 1677
1668 - //如果是寄存商品 1678 + //如果是购买寄存商品
1669 if(buyerOrder.getAttributes().equals(OrderAttributes.DEPOSITE.getCode())) { 1679 if(buyerOrder.getAttributes().equals(OrderAttributes.DEPOSITE.getCode())) {
1670 saveStorageDeposit(buyerOrder); 1680 saveStorageDeposit(buyerOrder);
1671 } 1681 }
  1682 +
  1683 + //如果是现货寄存商品
  1684 + AppraiseOrder appraiseOrder = appraiseOrderMapper.selectByOrderCode(orderCode);
  1685 + if(null != appraiseOrder && appraiseOrder.getAttributes().equals(OrderAttributes.DEPOSITE.getCode())) {//现货寄存
  1686 + saveAppraiseStorageDeposit(appraiseOrder);
  1687 + }
1672 1688
1673 String args = "orderAppraise.judgeCenterPass"; 1689 String args = "orderAppraise.judgeCenterPass";
1674 LOGGER.info("judgeCenterPass begin call enter interface is {}, orderCode is {}", buyerOrder.getOrderCode(), args); 1690 LOGGER.info("judgeCenterPass begin call enter interface is {}, orderCode is {}", buyerOrder.getOrderCode(), args);
@@ -1678,6 +1694,42 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -1678,6 +1694,42 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
1678 return jsonObject; 1694 return jsonObject;
1679 } 1695 }
1680 1696
  1697 + private void saveAppraiseStorageDeposit(AppraiseOrder appraiseOrder) {
  1698 + StorageDeposit record = new StorageDeposit();
  1699 +
  1700 + StorageDeposit deposit = storageDepositMapper.selectByOrderCode(appraiseOrder.getOrderCode());
  1701 + if(null != deposit) {
  1702 + return;
  1703 + }
  1704 +
  1705 + AppraiseOrderGoods goods = appraiseOrderGoodsMapper.selectByOrderCode(Long.parseLong(appraiseOrder.getOrderCode()));
  1706 + AppraiseOrderStorage storage = appraiseOrderStorageMapper.selectByOrderCodes(Lists.newArrayList(appraiseOrder.getOrderCode())).get(0);
  1707 +
  1708 + record.setProductId(goods.getProductId());
  1709 + record.setGoodsId(goods.getId());
  1710 + record.setStorageId(storage.getStorageId());
  1711 + record.setDepositCode(generateDepositCode());
  1712 + record.setOwnerUid(appraiseOrder.getUid());
  1713 + record.setOrderCode(appraiseOrder.getOrderCode());
  1714 + record.setSkup(0);
  1715 + record.setStatus(StorageDepositStatusEnum.WAITING_IN.getCode());
  1716 + record.setOrderStatus(DepositOrderStatusEnum.ORDER_STATUS_DOWN.getCode());
  1717 + record.setUpdateTime(DateUtil.getCurrentTimeSeconds());
  1718 + record.setCreateTime(DateUtil.getCurrentTimeSeconds());
  1719 + record.setDepositStartTime(DateUtil.getCurrentTimeSeconds());
  1720 + record.setDepositEndTime(DateUtil.getCurrentTimeSeconds() + 45*24*60*60);
  1721 + record.setEditPid(new UserHelper().getUserId());
  1722 + record.setOutType(0);
  1723 + record.setSource(DepositSourceEnum.SOURCE_SPOT_GOODS.getCode());
  1724 + record.setDepositType(DepositTypeEnum.TYPE_REAL.getCode());
  1725 + record.setParentOrderCode(appraiseOrder.getParentOrderCode());
  1726 +
  1727 + storageDepositMapper.insert(record);
  1728 +
  1729 + //清缓存
  1730 + asyncCallClearCache(appraiseOrder.getUid(), goods.getProductId(), storage.getStorageId());
  1731 + }
  1732 +
1681 private void saveStorageDeposit(BuyerOrder buyerOrder) { 1733 private void saveStorageDeposit(BuyerOrder buyerOrder) {
1682 StorageDeposit record = new StorageDeposit(); 1734 StorageDeposit record = new StorageDeposit();
1683 List<BuyerOrderGoods> buyerGoodsList = buyerOrderGoodsMapper.selectByOrderCode(Lists.newArrayList(buyerOrder.getOrderCode())); 1735 List<BuyerOrderGoods> buyerGoodsList = buyerOrderGoodsMapper.selectByOrderCode(Lists.newArrayList(buyerOrder.getOrderCode()));
@@ -2932,6 +2984,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon @@ -2932,6 +2984,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
2932 jsonObj.put("uid", buyerOrder.getUid()); 2984 jsonObj.put("uid", buyerOrder.getUid());
2933 2985
2934 Map<String, String> addressMap = subAddress(appraiseAddress); 2986 Map<String, String> addressMap = subAddress(appraiseAddress);
  2987 + //鉴定服务订单
2935 2988
2936 //寄件人信息 2989 //寄件人信息
2937 jsonObj.put("jCompany", "UFO鉴定中心"); 2990 jsonObj.put("jCompany", "UFO鉴定中心");