Authored by mali

召回详情

@@ -16,4 +16,11 @@ public interface DepositOrderMapper { @@ -16,4 +16,11 @@ public interface DepositOrderMapper {
16 int updateStatusByOrderCode(DepositOrder order); 16 int updateStatusByOrderCode(DepositOrder order);
17 17
18 DepositOrder selectByOrderCode(@Param("orderCode")Long orderCode); 18 DepositOrder selectByOrderCode(@Param("orderCode")Long orderCode);
  19 +
  20 + /**
  21 + * 查看支付成功的召回订单,可能没有
  22 + * @param depositCode
  23 + * @return
  24 + */
  25 + DepositOrder selectByDepositCode(@Param("depositCode")String depositCode, @Param("eventType")Integer eventType);
19 } 26 }
@@ -41,7 +41,14 @@ public interface StorageDepositMapper { @@ -41,7 +41,14 @@ public interface StorageDepositMapper {
41 int sale(@Param("uid") Integer uid, @Param("skup") Integer skup, @Param("orderCode") long orderCode); 41 int sale(@Param("uid") Integer uid, @Param("skup") Integer skup, @Param("orderCode") long orderCode);
42 42
43 int getDepositOffShelvesCount(@Param("uid") Integer uid, @Param("storageId") Integer storageId); 43 int getDepositOffShelvesCount(@Param("uid") Integer uid, @Param("storageId") Integer storageId);
44 - StorageDeposit selectByDepositCode(@Param("uid") int uid, @Param("depositCode")String depositCode); 44 +
  45 + /**
  46 + * 查看在库状态的库存
  47 + * @param uid
  48 + * @param depositCode
  49 + * @return
  50 + */
  51 + StorageDeposit selectByDepositCode(@Param("uid") int uid, @Param("depositCode")String depositCode, @Param("statusList")List<Integer> statusList);
45 52
46 List<StorageDeposit> getDepositOffs(@Param("uid") Integer uid, @Param("storageId") Integer storageId, @Param("count") Integer count); 53 List<StorageDeposit> getDepositOffs(@Param("uid") Integer uid, @Param("storageId") Integer storageId, @Param("count") Integer count);
47 int updateStorageStatus(@Param("depositCode")String depositCode, @Param("status")int status); 54 int updateStorageStatus(@Param("depositCode")String depositCode, @Param("status")int status);
@@ -74,4 +74,11 @@ @@ -74,4 +74,11 @@
74 from deposit_order 74 from deposit_order
75 where order_code = #{orderCode,jdbcType=BIGINT} 75 where order_code = #{orderCode,jdbcType=BIGINT}
76 </select> 76 </select>
  77 +
  78 + <select id="selectByDepositCode" resultMap="BaseResultMap">
  79 + select
  80 + <include refid="Base_Column_List" />
  81 + from deposit_order
  82 + where deposit_code = #{depositCode,jdbcType=VARCHAR} AND status = 1 AND event_type = #{eventType,jdbcType=INTEGER} limit 1
  83 + </select>
77 </mapper> 84 </mapper>
@@ -332,7 +332,12 @@ @@ -332,7 +332,12 @@
332 332
333 <select id="selectByDepositCode" resultMap="BaseResultMap"> 333 <select id="selectByDepositCode" resultMap="BaseResultMap">
334 select <include refid="Base_Column_List" /> from storage_deposit 334 select <include refid="Base_Column_List" /> from storage_deposit
335 - where owner_uid = #{uid} and status = 1 and del_status= 0 AND deposit_code = #{depositCode,jdbcType=VARCHAR} limit 1 335 + where owner_uid = #{uid} and del_status= 0 AND deposit_code = #{depositCode,jdbcType=VARCHAR}
  336 + AND status in
  337 + <foreach collection="statusList" close=")" item="status" open="(" separator=",">
  338 + #{status}
  339 + </foreach>
  340 + limit 1
336 </select> 341 </select>
337 342
338 <update id="updateStorageStatus"> 343 <update id="updateStorageStatus">
@@ -39,8 +39,10 @@ public class DepositOrderController { @@ -39,8 +39,10 @@ public class DepositOrderController {
39 @RequestMapping(params = "method=ufo.deposit.computeRecall") 39 @RequestMapping(params = "method=ufo.deposit.computeRecall")
40 @ResponseBody 40 @ResponseBody
41 public ApiResponse computePublishPrd(@RequestParam(name = "uid", required = true)int uid, 41 public ApiResponse computePublishPrd(@RequestParam(name = "uid", required = true)int uid,
42 - @RequestParam(name = "deposit_code", required = true)String depositCode) throws GatewayException {  
43 - DepositOrderComputeReq req = DepositOrderComputeReq.builder().uid(uid).depositCode(depositCode).build(); 42 + @RequestParam(name = "deposit_code", required = true)String depositCode,
  43 + @RequestParam(name="address_id")String addressId) throws GatewayException {
  44 + DepositOrderComputeReq req = DepositOrderComputeReq.builder().uid(uid)
  45 + .address_id(addressId).depositCode(depositCode).build();
44 46
45 LOG.info("in ufo.deposit.computeRecall, req {}", req); 47 LOG.info("in ufo.deposit.computeRecall, req {}", req);
46 DepositOrderComputeResp resp = depositOrderService.computePublishPrd(req); 48 DepositOrderComputeResp resp = depositOrderService.computePublishPrd(req);
@@ -55,16 +57,39 @@ public class DepositOrderController { @@ -55,16 +57,39 @@ public class DepositOrderController {
55 * @param price 57 * @param price
56 * @return 58 * @return
57 * @throws GatewayException 59 * @throws GatewayException
  60 + * http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway/?debug=XYZ&method=ufo.deposit.publishDepositOrder&uid=500031974&deposit_code=56257845
58 */ 61 */
59 @RequestMapping(params = "method=ufo.deposit.publishDepositOrder") 62 @RequestMapping(params = "method=ufo.deposit.publishDepositOrder")
60 @ResponseBody 63 @ResponseBody
61 public ApiResponse publishDepositOrder(@RequestParam(name = "uid", required = true)int uid, 64 public ApiResponse publishDepositOrder(@RequestParam(name = "uid", required = true)int uid,
62 - @RequestParam(name = "deposit_code", required = true)String depositCode) throws GatewayException {  
63 - DepositOrderComputeReq req = DepositOrderComputeReq.builder().uid(uid).depositCode(depositCode).build(); 65 + @RequestParam(name = "deposit_code", required = true)String depositCode,
  66 + @RequestParam(name="address_id")String addressId) throws GatewayException {
  67 + DepositOrderComputeReq req = DepositOrderComputeReq.builder().uid(uid)
  68 + .address_id(addressId).depositCode(depositCode).build();
64 69
65 LOG.info("in ufo.deposit.publishDepositOrder, req {}", req); 70 LOG.info("in ufo.deposit.publishDepositOrder, req {}", req);
66 OrderSubmitResponse resp = depositOrderService.publishDepositOrder(req); 71 OrderSubmitResponse resp = depositOrderService.publishDepositOrder(req);
67 72
68 return new ApiResponse.ApiResponseBuilder().code(200).data(resp).message("创建成功").build(); 73 return new ApiResponse.ApiResponseBuilder().code(200).data(resp).message("创建成功").build();
69 } 74 }
  75 +
  76 + /**
  77 + * 召回订单详情
  78 + * @param uid
  79 + * @param deposit_code 库存货号
  80 + * @return
  81 + * @throws GatewayException
  82 + * http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway/?debug=XYZ&method=ufo.deposit.orderInfo&uid=500031974&deposit_code=56257845
  83 + */
  84 + @RequestMapping(params = "method=ufo.deposit.orderInfo")
  85 + @ResponseBody
  86 + public ApiResponse depositOrderInfo(@RequestParam(name = "uid", required = true)int uid,
  87 + @RequestParam(name = "deposit_code", required = true)String depositCode) throws GatewayException {
  88 + DepositOrderComputeReq req = DepositOrderComputeReq.builder().uid(uid).depositCode(depositCode).build();
  89 +
  90 + LOG.info("in ufo.deposit.orderInfo, req {}", req);
  91 + DepositOrderComputeResp resp = depositOrderService.depositOrderInfo(req);
  92 +
  93 + return new ApiResponse.ApiResponseBuilder().code(200).data(resp).message("查询成功").build();
  94 + }
70 } 95 }
@@ -40,4 +40,11 @@ public interface DepositService { @@ -40,4 +40,11 @@ public interface DepositService {
40 int getRemainDay(Integer uid, String depositCode); 40 int getRemainDay(Integer uid, String depositCode);
41 41
42 int changeStorageStatus(String depositCode, int status); 42 int changeStorageStatus(String depositCode, int status);
  43 +
  44 + /**
  45 + * Do 转 Vo
  46 + * @param storageDeposit
  47 + * @return
  48 + */
  49 + DepositDetailBo convert(StorageDeposit storageDeposit);
43 } 50 }
@@ -3,23 +3,19 @@ package com.yohoufo.order.service.deposit; @@ -3,23 +3,19 @@ package com.yohoufo.order.service.deposit;
3 import com.google.common.collect.Lists; 3 import com.google.common.collect.Lists;
4 import com.yoho.error.ServiceError; 4 import com.yoho.error.ServiceError;
5 import com.yoho.error.exception.ServiceException; 5 import com.yoho.error.exception.ServiceException;
  6 +import com.yohobuy.ufo.model.order.bo.DepositDetailBo;
6 import com.yohobuy.ufo.model.order.bo.GoodsInfo; 7 import com.yohobuy.ufo.model.order.bo.GoodsInfo;
7 import com.yohobuy.ufo.model.order.common.OrderCodeType; 8 import com.yohobuy.ufo.model.order.common.OrderCodeType;
8 import com.yohobuy.ufo.model.order.constants.DepositEventTypeEnum; 9 import com.yohobuy.ufo.model.order.constants.DepositEventTypeEnum;
9 import com.yohobuy.ufo.model.order.constants.OrderConstant; 10 import com.yohobuy.ufo.model.order.constants.OrderConstant;
  11 +import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum;
10 import com.yohobuy.ufo.model.order.req.DepositOrderComputeReq; 12 import com.yohobuy.ufo.model.order.req.DepositOrderComputeReq;
11 import com.yohobuy.ufo.model.order.resp.DepositOrderComputeResp; 13 import com.yohobuy.ufo.model.order.resp.DepositOrderComputeResp;
12 import com.yohobuy.ufo.model.order.vo.AddressInfo; 14 import com.yohobuy.ufo.model.order.vo.AddressInfo;
13 import com.yohoufo.common.exception.UfoServiceException; 15 import com.yohoufo.common.exception.UfoServiceException;
14 import com.yohoufo.common.utils.StringUtil; 16 import com.yohoufo.common.utils.StringUtil;
15 -import com.yohoufo.dal.order.BuyerOrderGoodsMapper;  
16 -import com.yohoufo.dal.order.DepositOrderMapper;  
17 -import com.yohoufo.dal.order.SellerOrderGoodsMapper;  
18 -import com.yohoufo.dal.order.StorageDepositMapper;  
19 -import com.yohoufo.dal.order.model.BuyerOrderGoods;  
20 -import com.yohoufo.dal.order.model.DepositOrder;  
21 -import com.yohoufo.dal.order.model.SellerOrderGoods;  
22 -import com.yohoufo.dal.order.model.StorageDeposit; 17 +import com.yohoufo.dal.order.*;
  18 +import com.yohoufo.dal.order.model.*;
23 import com.yohoufo.order.convert.GoodsInfoConvertor; 19 import com.yohoufo.order.convert.GoodsInfoConvertor;
24 import com.yohoufo.order.model.response.OrderSubmitResponse; 20 import com.yohoufo.order.model.response.OrderSubmitResponse;
25 import com.yohoufo.order.service.DepositService; 21 import com.yohoufo.order.service.DepositService;
@@ -33,6 +29,7 @@ import org.springframework.stereotype.Service; @@ -33,6 +29,7 @@ import org.springframework.stereotype.Service;
33 29
34 import java.math.BigDecimal; 30 import java.math.BigDecimal;
35 import java.util.List; 31 import java.util.List;
  32 +import java.util.Objects;
36 33
37 /** 34 /**
38 * Created by li.ma on 2019/7/9. 35 * Created by li.ma on 2019/7/9.
@@ -51,7 +48,7 @@ public class DepositOrderService { @@ -51,7 +48,7 @@ public class DepositOrderService {
51 private SellerOrderGoodsMapper sellerOrderGoodsMapper; 48 private SellerOrderGoodsMapper sellerOrderGoodsMapper;
52 49
53 @Autowired 50 @Autowired
54 - private BuyerOrderGoodsMapper buyerOrderGoodsMapper; 51 + private BuyerOrderMapper buyerOrderMapper;
55 52
56 @Autowired 53 @Autowired
57 private IBuyerOrderMetaService buyerOrderMetaService; 54 private IBuyerOrderMetaService buyerOrderMetaService;
@@ -68,42 +65,42 @@ public class DepositOrderService { @@ -68,42 +65,42 @@ public class DepositOrderService {
68 * @return 65 * @return
69 */ 66 */
70 public DepositOrderComputeResp computePublishPrd(DepositOrderComputeReq req) { 67 public DepositOrderComputeResp computePublishPrd(DepositOrderComputeReq req) {
71 - StorageDeposit storageDeposit = checkStorageDeposit(req); // 不存在的时候有异常 68 + StorageDeposit storageDeposit = checkStorageDeposit(req,
  69 + Lists.newArrayList(StorageDepositStatusEnum.HAS_IN.getCode())); // 不存在的时候有异常
72 70
73 int depositRemainDay = depositService.getRemainDay(req.getUid(), req.getDepositCode()); // 还可存放多久 单位天 71 int depositRemainDay = depositService.getRemainDay(req.getUid(), req.getDepositCode()); // 还可存放多久 单位天
74 72
75 Integer skup = storageDeposit.getSkup(); 73 Integer skup = storageDeposit.getSkup();
76 Long orderCode = storageDeposit.getOrderCode(); 74 Long orderCode = storageDeposit.getOrderCode();
77 75
78 - SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);  
79 - GoodsInfo goodsInfo = null;  
80 - if (null != sellerOrderGoods) {  
81 - goodsInfo = GoodsInfoConvertor.SellerOrderGoods2GoodsInfo(sellerOrderGoods);  
82 - }  
83 - List<BuyerOrderGoods> buyerOrderGoodses = buyerOrderGoodsMapper.selectBySkups(Lists.newArrayList(skup));  
84 - DepositOrderComputeResp.PriceInfo priceInfo = getFeeInfo(orderCode);  
85 - if (CollectionUtils.isNotEmpty(buyerOrderGoodses)) {  
86 - priceInfo.setGoodPrice(buyerOrderGoodses.get(0).getGoodsAmount());  
87 - } 76 + GoodsInfo goodsInfo = getGoodsInfo(skup); // 查询购买商品的详细信息
  77 +
  78 +
  79 + DepositOrderComputeResp.PriceInfo priceInfo = getFeeInfo(orderCode, req.getAddress_id()); // 获取各种费用
88 80
89 - AddressInfo addressInfo = buyerOrderMetaService.getAddressInfo(req.getUid(), orderCode); 81 + setBuyerPrice(orderCode, priceInfo); // 设置入手价
  82 +
  83 + AddressInfo addressInfo = buyerOrderMetaService.getHiddenAddressInfo(req.getUid(), orderCode);
90 84
91 return DepositOrderComputeResp.builder().depositRemainDay(getReplacedContent(DepositOrderComputeResp.DEPOSITREMAINDAY_TIP, depositRemainDay)) 85 return DepositOrderComputeResp.builder().depositRemainDay(getReplacedContent(DepositOrderComputeResp.DEPOSITREMAINDAY_TIP, depositRemainDay))
92 .userAddress(addressInfo).priceInfo(priceInfo).goodsInfo(goodsInfo).build(); 86 .userAddress(addressInfo).priceInfo(priceInfo).goodsInfo(goodsInfo).build();
93 } 87 }
94 88
95 89
  90 +
  91 +
96 public OrderSubmitResponse publishDepositOrder(DepositOrderComputeReq req) { 92 public OrderSubmitResponse publishDepositOrder(DepositOrderComputeReq req) {
97 Integer uid = req.getUid(); 93 Integer uid = req.getUid();
98 if (uid == null || uid <= 0){ 94 if (uid == null || uid <= 0){
99 throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY); 95 throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY);
100 } 96 }
101 - checkStorageDeposit(req); 97 + StorageDeposit storageDeposit = checkStorageDeposit(req,
  98 + Lists.newArrayList(StorageDepositStatusEnum.HAS_IN.getCode())); //查看在库状态的库存
102 99
103 long orderCode = orderCodeGenerator.generate(OrderCodeType.STORAGE_MANAGEMENT); 100 long orderCode = orderCodeGenerator.generate(OrderCodeType.STORAGE_MANAGEMENT);
104 101
105 int now = (int) (System.currentTimeMillis()/1000); 102 int now = (int) (System.currentTimeMillis()/1000);
106 - DepositOrderComputeResp.PriceInfo priceInfo = getFeeInfo(orderCode); 103 + DepositOrderComputeResp.PriceInfo priceInfo = getFeeInfo(orderCode, req.getAddress_id());
107 104
108 DepositOrder depositOrder = DepositOrder.builder().uid(uid).amount(priceInfo.getAmount()) 105 DepositOrder depositOrder = DepositOrder.builder().uid(uid).amount(priceInfo.getAmount())
109 .contractFee(priceInfo.getContractFee()) 106 .contractFee(priceInfo.getContractFee())
@@ -111,6 +108,9 @@ public class DepositOrderService { @@ -111,6 +108,9 @@ public class DepositOrderService {
111 .createTime(now).depositCode(req.getDepositCode()) 108 .createTime(now).depositCode(req.getDepositCode())
112 .eventType(DepositEventTypeEnum.DEPOSIT_RECALL_FEE.getCode()).orderCode(orderCode).payment(0).status(0).updateTime(now).build(); 109 .eventType(DepositEventTypeEnum.DEPOSIT_RECALL_FEE.getCode()).orderCode(orderCode).payment(0).status(0).updateTime(now).build();
113 110
  111 + // TODO 创建召回地址
  112 + storageDeposit.getOrderCode();
  113 +
114 LOG.info("enter publishDepositOrder begin save depositOrder {} ",depositOrder); 114 LOG.info("enter publishDepositOrder begin save depositOrder {} ",depositOrder);
115 int num = depositOrderMapper.insert(depositOrder); // 生成订单数据,insert db 115 int num = depositOrderMapper.insert(depositOrder); // 生成订单数据,insert db
116 LOG.info("enter publishDepositOrder end save depositOrder {} ,num {}",depositOrder, num); 116 LOG.info("enter publishDepositOrder end save depositOrder {} ,num {}",depositOrder, num);
@@ -118,18 +118,83 @@ public class DepositOrderService { @@ -118,18 +118,83 @@ public class DepositOrderService {
118 return OrderSubmitResponse.builder().orderCode(orderCode).paymentStatus(OrderConstant.N_STR).build(); 118 return OrderSubmitResponse.builder().orderCode(orderCode).paymentStatus(OrderConstant.N_STR).build();
119 } 119 }
120 120
121 - private StorageDeposit checkStorageDeposit(DepositOrderComputeReq req) {  
122 - StorageDeposit storageDeposit = storageDepositMapper.selectByDepositCode(req.getUid(), req.getDepositCode());  
123 - if (null == storageDeposit || null == storageDeposit.getSkup() || null == storageDeposit.getOrderCode()) {  
124 - LOG.warn("storageDepositMapper.selectByDepositCode not exist, req is {}", req);  
125 - throw new UfoServiceException(400, "在库状态的库存不存在"); 121 +
  122 +
  123 + public void updateByOrderCode(DepositOrder order) {
  124 + depositOrderMapper.updatePayment(order);
126 } 125 }
127 126
128 - return storageDeposit; 127 + public DepositOrder selectByOrderCodeUid(long orderCode, int uid) {
  128 + return depositOrderMapper.selectByOrderCode(orderCode);
  129 + }
  130 +
  131 + public int updateStatusByOrderCode(DepositOrder order) {
  132 + return depositOrderMapper.updateStatusByOrderCode(order);
  133 + }
  134 +
  135 + public DepositOrder selectByOrderCode(Long orderCode) {
  136 + return depositOrderMapper.selectByOrderCode(orderCode);
  137 + }
  138 +
  139 + /**
  140 + * 查询召回订单详情
  141 + * @param req
  142 + * @return
  143 + */
  144 + public DepositOrderComputeResp depositOrderInfo(DepositOrderComputeReq req) {
  145 + StorageDeposit storageDeposit = checkStorageDeposit(req,
  146 + Lists.newArrayList(StorageDepositStatusEnum.WAITING_QUERY.getCode(), StorageDepositStatusEnum.WAITING_OUT.getCode())); // 不存在的时候有异常
  147 +
  148 + DepositDetailBo depositDetailBo = depositService.convert(storageDeposit);
  149 +
  150 + AddressInfo addressInfo = buyerOrderMetaService.getHiddenAddressInfo(req.getUid(), storageDeposit.getOrderCode());
  151 +
  152 + GoodsInfo goodsInfo = getGoodsInfo(storageDeposit.getSkup()); // 查询购买商品的详细信息
  153 +
  154 + DepositOrderComputeResp.PriceInfo priceInfo = getOrderFeeInfo(req.getDepositCode()); // 获取各种费用
  155 +
  156 + setBuyerPrice(storageDeposit.getOrderCode(), priceInfo); // 设置入手价
  157 +
  158 + return DepositOrderComputeResp.builder().userAddress(addressInfo).priceInfo(priceInfo).goodsInfo(goodsInfo).depositDetailBo(depositDetailBo).build();
  159 + }
  160 +
  161 + /**
  162 + * 查询召回订单的各种详情
  163 + * @param depositCode
  164 + * @return
  165 + */
  166 + private DepositOrderComputeResp.PriceInfo getOrderFeeInfo(String depositCode) {
  167 + DepositOrderComputeResp.PriceInfo priceInfo = DepositOrderComputeResp.PriceInfo.builder().build();
  168 +
  169 + DepositOrder depositOrder = depositOrderMapper.selectByDepositCode(depositCode, DepositEventTypeEnum.DEPOSIT_RECALL_FEE.getCode()); // 自动到期之后寄回的,没有订单
  170 + if (Objects.isNull(depositOrder)) {
  171 + return DepositOrderComputeResp.PriceInfo.builder().build();
  172 + }
  173 +
  174 + return DepositOrderComputeResp.PriceInfo.builder().amount(depositOrder.getAmount())
  175 + .contractFee(depositOrder.getContractFee())
  176 + .shipFee(depositOrder.getShipFee()).build();
  177 + }
  178 +
  179 +
  180 + private void setBuyerPrice(Long orderCode, DepositOrderComputeResp.PriceInfo priceInfo) {
  181 + BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
  182 + if (!Objects.isNull(buyerOrder)) {
  183 + priceInfo.setGoodPrice(buyerOrder.getAmount());
  184 + }
  185 + }
  186 +
  187 + private GoodsInfo getGoodsInfo(Integer skup) {
  188 + SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
  189 + GoodsInfo goodsInfo = null;
  190 + if (null != sellerOrderGoods) {
  191 + goodsInfo = GoodsInfoConvertor.SellerOrderGoods2GoodsInfo(sellerOrderGoods);
  192 + }
  193 + return goodsInfo;
129 } 194 }
130 195
131 // 查询召回所需要的费用 196 // 查询召回所需要的费用
132 - private DepositOrderComputeResp.PriceInfo getFeeInfo(Long orderCode) { 197 + private DepositOrderComputeResp.PriceInfo getFeeInfo(Long orderCode, String addressId) {
133 BigDecimal contractFee = new BigDecimal(15); // 违约金 198 BigDecimal contractFee = new BigDecimal(15); // 违约金
134 BigDecimal shipFee = new BigDecimal(15); // 运费 199 BigDecimal shipFee = new BigDecimal(15); // 运费
135 BigDecimal amount = contractFee.add(shipFee); 200 BigDecimal amount = contractFee.add(shipFee);
@@ -141,19 +206,13 @@ public class DepositOrderService { @@ -141,19 +206,13 @@ public class DepositOrderService {
141 return StringUtil.getReplacedContent(content, params); 206 return StringUtil.getReplacedContent(content, params);
142 } 207 }
143 208
144 - public void updateByOrderCode(DepositOrder order) {  
145 - depositOrderMapper.updatePayment(order);  
146 - }  
147 -  
148 - public DepositOrder selectByOrderCodeUid(long orderCode, int uid) {  
149 - return null;  
150 - }  
151 -  
152 - public int updateStatusByOrderCode(DepositOrder order) {  
153 - return depositOrderMapper.updateStatusByOrderCode(order); 209 + private StorageDeposit checkStorageDeposit(DepositOrderComputeReq req, List<Integer> statusList) {
  210 + StorageDeposit storageDeposit = storageDepositMapper.selectByDepositCode(req.getUid(), req.getDepositCode(), statusList);
  211 + if (null == storageDeposit || null == storageDeposit.getSkup() || null == storageDeposit.getOrderCode()) {
  212 + LOG.warn("storageDepositMapper.selectByDepositCode not exist, req is {}", req);
  213 + throw new UfoServiceException(400, "在库状态的库存不存在");
154 } 214 }
155 215
156 - public DepositOrder selectByOrderCode(Long orderCode) {  
157 - return depositOrderMapper.selectByOrderCode(orderCode); 216 + return storageDeposit;
158 } 217 }
159 } 218 }
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
4 import com.yohobuy.ufo.model.order.bo.ButtonShowBo; 4 import com.yohobuy.ufo.model.order.bo.ButtonShowBo;
5 import com.yohobuy.ufo.model.order.bo.DepositDetailBo; 5 import com.yohobuy.ufo.model.order.bo.DepositDetailBo;
6 import com.yohobuy.ufo.model.order.bo.DepositProductBo; 6 import com.yohobuy.ufo.model.order.bo.DepositProductBo;
  7 +import com.yohobuy.ufo.model.order.constants.StorageDepositStatusEnum;
7 import com.yohobuy.ufo.model.order.resp.PageResp; 8 import com.yohobuy.ufo.model.order.resp.PageResp;
8 import com.yohoufo.common.exception.UfoServiceException; 9 import com.yohoufo.common.exception.UfoServiceException;
9 import com.yohoufo.dal.order.SellerOrderGoodsMapper; 10 import com.yohoufo.dal.order.SellerOrderGoodsMapper;
@@ -19,10 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; @@ -19,10 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
19 import org.springframework.stereotype.Service; 20 import org.springframework.stereotype.Service;
20 21
21 import java.math.BigDecimal; 22 import java.math.BigDecimal;
22 -import java.util.ArrayList;  
23 -import java.util.Arrays;  
24 -import java.util.List;  
25 -import java.util.Map; 23 +import java.util.*;
26 import java.util.function.Function; 24 import java.util.function.Function;
27 import java.util.stream.Collectors; 25 import java.util.stream.Collectors;
28 26
@@ -273,6 +271,26 @@ public class DepositServiceImpl implements DepositService { @@ -273,6 +271,26 @@ public class DepositServiceImpl implements DepositService {
273 return storageDepositMapper.updateStorageStatus(depositCode, status); 271 return storageDepositMapper.updateStorageStatus(depositCode, status);
274 } 272 }
275 273
  274 + /**
  275 + * Do 转 Vo
  276 + * @param storageDeposit
  277 + * @return
  278 + */
  279 + public DepositDetailBo convert(StorageDeposit storageDeposit) {
  280 + if (Objects.isNull(storageDeposit)) {
  281 + return DepositDetailBo.builder().build();
  282 + }
  283 +
  284 + return DepositDetailBo.builder()
  285 + .orderCode(storageDeposit.getOrderCode())
  286 + .depositCode(storageDeposit.getDepositCode())
  287 + .skup(storageDeposit.getSkup())
  288 + .status(storageDeposit.getStatus())
  289 + .depositStatusName(StorageDepositStatusEnum.getAppStatusNameByCode(storageDeposit.getStatus()))
  290 + .depositDescName(StorageDepositStatusEnum.getAppStatusDescByCode(storageDeposit.getStatus()))
  291 + .build();
  292 + }
  293 +
276 private String getBackStatusName(Integer code) { 294 private String getBackStatusName(Integer code) {
277 if (code == null) { 295 if (code == null) {
278 return ""; 296 return "";