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 {
private Integer newSkup;
private Integer orderNo;
private Integer source;//库存来源 0:购买寄存 1:现货寄存
private Integer depositType;//库存类型 0:真实库存 1:虚假库存(无法入库,当时寄回)
private String parentOrderCode;//现货寄存订单的父订单
}
\ No newline at end of file
... ...
... ... @@ -23,20 +23,25 @@
<result column="out_type" property="outType" jdbcType="INTEGER" />
<result column="new_skup" property="newSkup" jdbcType="INTEGER" />
<result column="order_no" property="orderNo" jdbcType="INTEGER" />
<result column="source" property="source" jdbcType="INTEGER" />
<result column="deposit_type" property="depositType" jdbcType="INTEGER" />
<result column="parent_order_code" property="parentOrderCode" jdbcType="BIGINT" />
</resultMap>
<sql id="Base_Column_List">
id, product_id, goods_id, storage_id, deposit_code, shelf_code, owner_uid, order_code,
skup, status, order_status, update_time, create_time, deposit_start_time,
deposit_end_time, edit_pid, out_type, del_status, remind_status,new_skup, order_no
deposit_end_time, edit_pid, out_type, del_status, remind_status,new_skup, order_no,
source, deposit_type, parent_order_code
</sql>
<insert id="insert" parameterType="com.yoho.order.model.StorageDeposit">
insert into storage_deposit(id, product_id, goods_id, storage_id, deposit_code, shelf_code, owner_uid, order_code,
skup, status, order_status, update_time, create_time, deposit_start_time,
deposit_end_time, edit_pid, out_type)
deposit_end_time, edit_pid, out_type, source, deposit_type, parent_order_code)
values (#{id}, #{productId}, #{goodsId}, #{storageId}, #{depositCode}, #{shelfCode}, #{ownerUid}, #{orderCode},
#{skup}, #{status}, #{orderStatus}, #{updateTime}, #{createTime}, #{depositStartTime}, #{depositEndTime}, #{editPid}, #{outType})
#{skup}, #{status}, #{orderStatus}, #{updateTime}, #{createTime}, #{depositStartTime}, #{depositEndTime}, #{editPid},
#{outType}, #{source}, #{depositType}, #{parentOrderCode})
</insert>
<update id="batchBindShelfCode">
... ...
... ... @@ -22,6 +22,7 @@ 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.collect.Sets;
import org.elasticsearch.common.netty.util.internal.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -149,6 +150,8 @@ import com.yohobuy.ufo.model.order.common.OrderAttributes;
import com.yohobuy.ufo.model.order.common.OrderStatus;
import com.yohobuy.ufo.model.order.constants.DepositOrderStatusEnum;
import com.yohobuy.ufo.model.order.constants.DepositOutTypeEnum;
import com.yohobuy.ufo.model.order.constants.DepositSourceEnum;
import com.yohobuy.ufo.model.order.constants.DepositTypeEnum;
import com.yohobuy.ufo.model.order.constants.ExpressCompanyEnum;
import com.yohobuy.ufo.model.order.constants.IdentifyCenterEnum;
import com.yohobuy.ufo.model.order.constants.RegionEnum;
... ... @@ -936,6 +939,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
private List<BuyerOrderResp> convertAppraiseToBuyerOrderResp(List<AppraiseOrder> list, JSONObject jsonObject){
List<BuyerOrderResp> respList = Lists.newArrayList();
Set<String> parentOrderSet = Sets.newHashSet();
List<String> orderCodeList = list.stream().map(AppraiseOrder::getOrderCode).collect(Collectors.toList());
List<ExpressRecord> expressList = expressRecordMapper.selectByOrderCodeListAndType(orderCodeList, Lists.newArrayList(EnumExpressType.EXPRESS_TYPE_1.getCode()));
Map<String, ExpressRecord> expressMap = expressList.stream().collect(Collectors.toMap(ExpressRecord::getOrderCode, e->e));
... ... @@ -956,9 +960,15 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
resp.setProductCode(goodsMap.get(item.getOrderCode()).getProductCode());
resp.setSizeName(storageMap.get(item.getOrderCode()).getSizeName());
if(StringUtils.isNotEmpty(item.getParentOrderCode())) {
parentOrderSet.add(item.getParentOrderCode());
}
respList.add(resp);
}
jsonObject.put("parentOrderNum", parentOrderSet.size());
return respList;
}
... ... @@ -1665,10 +1675,16 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
UserHelper userHelper = new UserHelper();
saveOrderOperateRecord(buyerOrder.getOrderCode(), userHelper, operateType, "");
//如果是寄存商品
//如果是购买寄存商品
if(buyerOrder.getAttributes().equals(OrderAttributes.DEPOSITE.getCode())) {
saveStorageDeposit(buyerOrder);
}
//如果是现货寄存商品
AppraiseOrder appraiseOrder = appraiseOrderMapper.selectByOrderCode(orderCode);
if(null != appraiseOrder && appraiseOrder.getAttributes().equals(OrderAttributes.DEPOSITE.getCode())) {//现货寄存
saveAppraiseStorageDeposit(appraiseOrder);
}
String args = "orderAppraise.judgeCenterPass";
LOGGER.info("judgeCenterPass begin call enter interface is {}, orderCode is {}", buyerOrder.getOrderCode(), args);
... ... @@ -1678,6 +1694,42 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
return jsonObject;
}
private void saveAppraiseStorageDeposit(AppraiseOrder appraiseOrder) {
StorageDeposit record = new StorageDeposit();
StorageDeposit deposit = storageDepositMapper.selectByOrderCode(appraiseOrder.getOrderCode());
if(null != deposit) {
return;
}
AppraiseOrderGoods goods = appraiseOrderGoodsMapper.selectByOrderCode(Long.parseLong(appraiseOrder.getOrderCode()));
AppraiseOrderStorage storage = appraiseOrderStorageMapper.selectByOrderCodes(Lists.newArrayList(appraiseOrder.getOrderCode())).get(0);
record.setProductId(goods.getProductId());
record.setGoodsId(goods.getId());
record.setStorageId(storage.getStorageId());
record.setDepositCode(generateDepositCode());
record.setOwnerUid(appraiseOrder.getUid());
record.setOrderCode(appraiseOrder.getOrderCode());
record.setSkup(0);
record.setStatus(StorageDepositStatusEnum.WAITING_IN.getCode());
record.setOrderStatus(DepositOrderStatusEnum.ORDER_STATUS_DOWN.getCode());
record.setUpdateTime(DateUtil.getCurrentTimeSeconds());
record.setCreateTime(DateUtil.getCurrentTimeSeconds());
record.setDepositStartTime(DateUtil.getCurrentTimeSeconds());
record.setDepositEndTime(DateUtil.getCurrentTimeSeconds() + 45*24*60*60);
record.setEditPid(new UserHelper().getUserId());
record.setOutType(0);
record.setSource(DepositSourceEnum.SOURCE_SPOT_GOODS.getCode());
record.setDepositType(DepositTypeEnum.TYPE_REAL.getCode());
record.setParentOrderCode(appraiseOrder.getParentOrderCode());
storageDepositMapper.insert(record);
//清缓存
asyncCallClearCache(appraiseOrder.getUid(), goods.getProductId(), storage.getStorageId());
}
private void saveStorageDeposit(BuyerOrder buyerOrder) {
StorageDeposit record = new StorageDeposit();
List<BuyerOrderGoods> buyerGoodsList = buyerOrderGoodsMapper.selectByOrderCode(Lists.newArrayList(buyerOrder.getOrderCode()));
... ... @@ -2932,6 +2984,7 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService, ApplicationCon
jsonObj.put("uid", buyerOrder.getUid());
Map<String, String> addressMap = subAddress(appraiseAddress);
//鉴定服务订单
//寄件人信息
jsonObj.put("jCompany", "UFO鉴定中心");
... ...