implement service logic
Showing
5 changed files
with
298 additions
and
106 deletions
1 | package com.yohoufo.dal.order.model; | 1 | package com.yohoufo.dal.order.model; |
2 | 2 | ||
3 | +import lombok.Data; | ||
4 | + | ||
3 | import java.math.BigDecimal; | 5 | import java.math.BigDecimal; |
4 | 6 | ||
7 | +@Data | ||
5 | public class AppraiseOrder { | 8 | public class AppraiseOrder { |
6 | private Integer id; | 9 | private Integer id; |
7 | 10 | ||
@@ -17,7 +20,7 @@ public class AppraiseOrder { | @@ -17,7 +20,7 @@ public class AppraiseOrder { | ||
17 | 20 | ||
18 | private BigDecimal shipFee; | 21 | private BigDecimal shipFee; |
19 | 22 | ||
20 | - private Byte status; | 23 | + private Integer status; |
21 | 24 | ||
22 | private Integer createTime; | 25 | private Integer createTime; |
23 | 26 | ||
@@ -26,100 +29,4 @@ public class AppraiseOrder { | @@ -26,100 +29,4 @@ public class AppraiseOrder { | ||
26 | private Byte isDel; | 29 | private Byte isDel; |
27 | 30 | ||
28 | private String channelNo; | 31 | private String channelNo; |
29 | - | ||
30 | - public Integer getId() { | ||
31 | - return id; | ||
32 | - } | ||
33 | - | ||
34 | - public void setId(Integer id) { | ||
35 | - this.id = id; | ||
36 | - } | ||
37 | - | ||
38 | - public Integer getUid() { | ||
39 | - return uid; | ||
40 | - } | ||
41 | - | ||
42 | - public void setUid(Integer uid) { | ||
43 | - this.uid = uid; | ||
44 | - } | ||
45 | - | ||
46 | - public Long getOrderCode() { | ||
47 | - return orderCode; | ||
48 | - } | ||
49 | - | ||
50 | - public void setOrderCode(Long orderCode) { | ||
51 | - this.orderCode = orderCode; | ||
52 | - } | ||
53 | - | ||
54 | - public Byte getClientType() { | ||
55 | - return clientType; | ||
56 | - } | ||
57 | - | ||
58 | - public void setClientType(Byte clientType) { | ||
59 | - this.clientType = clientType; | ||
60 | - } | ||
61 | - | ||
62 | - public Byte getPayment() { | ||
63 | - return payment; | ||
64 | - } | ||
65 | - | ||
66 | - public void setPayment(Byte payment) { | ||
67 | - this.payment = payment; | ||
68 | - } | ||
69 | - | ||
70 | - public BigDecimal getAmount() { | ||
71 | - return amount; | ||
72 | - } | ||
73 | - | ||
74 | - public void setAmount(BigDecimal amount) { | ||
75 | - this.amount = amount; | ||
76 | - } | ||
77 | - | ||
78 | - public BigDecimal getShipFee() { | ||
79 | - return shipFee; | ||
80 | - } | ||
81 | - | ||
82 | - public void setShipFee(BigDecimal shipFee) { | ||
83 | - this.shipFee = shipFee; | ||
84 | - } | ||
85 | - | ||
86 | - public Byte getStatus() { | ||
87 | - return status; | ||
88 | - } | ||
89 | - | ||
90 | - public void setStatus(Byte status) { | ||
91 | - this.status = status; | ||
92 | - } | ||
93 | - | ||
94 | - public Integer getCreateTime() { | ||
95 | - return createTime; | ||
96 | - } | ||
97 | - | ||
98 | - public void setCreateTime(Integer createTime) { | ||
99 | - this.createTime = createTime; | ||
100 | - } | ||
101 | - | ||
102 | - public Integer getUpdateTime() { | ||
103 | - return updateTime; | ||
104 | - } | ||
105 | - | ||
106 | - public void setUpdateTime(Integer updateTime) { | ||
107 | - this.updateTime = updateTime; | ||
108 | - } | ||
109 | - | ||
110 | - public Byte getIsDel() { | ||
111 | - return isDel; | ||
112 | - } | ||
113 | - | ||
114 | - public void setIsDel(Byte isDel) { | ||
115 | - this.isDel = isDel; | ||
116 | - } | ||
117 | - | ||
118 | - public String getChannelNo() { | ||
119 | - return channelNo; | ||
120 | - } | ||
121 | - | ||
122 | - public void setChannelNo(String channelNo) { | ||
123 | - this.channelNo = channelNo == null ? null : channelNo.trim(); | ||
124 | - } | ||
125 | } | 32 | } |
@@ -4,9 +4,15 @@ import com.yohobuy.ufo.model.order.req.AppraiseOrderComputeReq; | @@ -4,9 +4,15 @@ import com.yohobuy.ufo.model.order.req.AppraiseOrderComputeReq; | ||
4 | import com.yohobuy.ufo.model.order.req.AppraiseOrderDetailReq; | 4 | import com.yohobuy.ufo.model.order.req.AppraiseOrderDetailReq; |
5 | import com.yohobuy.ufo.model.order.req.AppraiseOrderListReq; | 5 | import com.yohobuy.ufo.model.order.req.AppraiseOrderListReq; |
6 | import com.yohobuy.ufo.model.order.req.AppraiseOrderSubmitReq; | 6 | import com.yohobuy.ufo.model.order.req.AppraiseOrderSubmitReq; |
7 | +import com.yohobuy.ufo.model.order.resp.AppraiseOrderComputeResp; | ||
8 | +import com.yohobuy.ufo.model.order.resp.AppraiseOrderDetailResp; | ||
9 | +import com.yohobuy.ufo.model.order.resp.AppraiseOrderListResp; | ||
10 | +import com.yohobuy.ufo.model.order.resp.AppraiseOrderSubmitResp; | ||
7 | import com.yohoufo.common.ApiResponse; | 11 | import com.yohoufo.common.ApiResponse; |
12 | +import com.yohoufo.order.service.impl.AppraiseOrderService; | ||
8 | import org.slf4j.Logger; | 13 | import org.slf4j.Logger; |
9 | import org.slf4j.LoggerFactory; | 14 | import org.slf4j.LoggerFactory; |
15 | +import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.web.bind.annotation.RequestMapping; | 16 | import org.springframework.web.bind.annotation.RequestMapping; |
11 | import org.springframework.web.bind.annotation.RequestParam; | 17 | import org.springframework.web.bind.annotation.RequestParam; |
12 | import org.springframework.web.bind.annotation.RestController; | 18 | import org.springframework.web.bind.annotation.RestController; |
@@ -16,6 +22,9 @@ public class AppraiseOrderController { | @@ -16,6 +22,9 @@ public class AppraiseOrderController { | ||
16 | 22 | ||
17 | private final Logger logger = LoggerFactory.getLogger(getClass()); | 23 | private final Logger logger = LoggerFactory.getLogger(getClass()); |
18 | 24 | ||
25 | + @Autowired | ||
26 | + private AppraiseOrderService appraiseOrderService; | ||
27 | + | ||
19 | /** | 28 | /** |
20 | * 商品付费鉴定费用计算 | 29 | * 商品付费鉴定费用计算 |
21 | * @param uid | 30 | * @param uid |
@@ -30,11 +39,10 @@ public class AppraiseOrderController { | @@ -30,11 +39,10 @@ public class AppraiseOrderController { | ||
30 | .productId(productId) | 39 | .productId(productId) |
31 | .build(); | 40 | .build(); |
32 | logger.info("in ufo.appriseOrder.compute req {}", req); | 41 | logger.info("in ufo.appriseOrder.compute req {}", req); |
33 | - | ||
34 | - | 42 | + AppraiseOrderComputeResp resp = appraiseOrderService.compute(req); |
35 | return new ApiResponse.ApiResponseBuilder() | 43 | return new ApiResponse.ApiResponseBuilder() |
36 | .code(200) | 44 | .code(200) |
37 | - .data(null) | 45 | + .data(resp) |
38 | .message("鉴定计算成功") | 46 | .message("鉴定计算成功") |
39 | .build(); | 47 | .build(); |
40 | } | 48 | } |
@@ -47,10 +55,10 @@ public class AppraiseOrderController { | @@ -47,10 +55,10 @@ public class AppraiseOrderController { | ||
47 | AppraiseOrderSubmitReq req = AppraiseOrderSubmitReq.builder() | 55 | AppraiseOrderSubmitReq req = AppraiseOrderSubmitReq.builder() |
48 | .uid(uid).productId(productId).addressId(addressId).build(); | 56 | .uid(uid).productId(productId).addressId(addressId).build(); |
49 | logger.info("in ufo.appriseOrder.submit req {}", req); | 57 | logger.info("in ufo.appriseOrder.submit req {}", req); |
50 | - | 58 | + AppraiseOrderSubmitResp resp = appraiseOrderService.submit(req); |
51 | return new ApiResponse.ApiResponseBuilder() | 59 | return new ApiResponse.ApiResponseBuilder() |
52 | .code(200) | 60 | .code(200) |
53 | - .data(null) | 61 | + .data(resp) |
54 | .message("鉴定订单提交成功") | 62 | .message("鉴定订单提交成功") |
55 | .build(); | 63 | .build(); |
56 | } | 64 | } |
@@ -70,10 +78,10 @@ public class AppraiseOrderController { | @@ -70,10 +78,10 @@ public class AppraiseOrderController { | ||
70 | .uid(uid).limit(limit).page(page).build(); | 78 | .uid(uid).limit(limit).page(page).build(); |
71 | 79 | ||
72 | logger.info("in ufo.appriseOrder.list req {}", req); | 80 | logger.info("in ufo.appriseOrder.list req {}", req); |
73 | - | 81 | + AppraiseOrderListResp resp = appraiseOrderService.getOrderList(req); |
74 | return new ApiResponse.ApiResponseBuilder() | 82 | return new ApiResponse.ApiResponseBuilder() |
75 | .code(200) | 83 | .code(200) |
76 | - .data(null) | 84 | + .data(resp) |
77 | .message("鉴定订单列表查询成功") | 85 | .message("鉴定订单列表查询成功") |
78 | .build(); | 86 | .build(); |
79 | } | 87 | } |
@@ -84,10 +92,10 @@ public class AppraiseOrderController { | @@ -84,10 +92,10 @@ public class AppraiseOrderController { | ||
84 | @RequestParam(name = "orderCode")long orderCode){ | 92 | @RequestParam(name = "orderCode")long orderCode){ |
85 | AppraiseOrderDetailReq req = AppraiseOrderDetailReq.builder().uid(uid).orderCode(orderCode).build(); | 93 | AppraiseOrderDetailReq req = AppraiseOrderDetailReq.builder().uid(uid).orderCode(orderCode).build(); |
86 | logger.info("in ufo.appriseOrder.detail req {}", req); | 94 | logger.info("in ufo.appriseOrder.detail req {}", req); |
87 | - | 95 | + AppraiseOrderDetailResp resp = appraiseOrderService.getOrderDetail(req); |
88 | return new ApiResponse.ApiResponseBuilder() | 96 | return new ApiResponse.ApiResponseBuilder() |
89 | .code(200) | 97 | .code(200) |
90 | - .data(null) | 98 | + .data(resp) |
91 | .message("鉴定订单详情查询成功") | 99 | .message("鉴定订单详情查询成功") |
92 | .build(); | 100 | .build(); |
93 | } | 101 | } |
1 | +package com.yohoufo.order.model.dto; | ||
2 | + | ||
3 | +import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo; | ||
4 | +import com.yohobuy.ufo.model.order.vo.AddressInfo; | ||
5 | +import lombok.AllArgsConstructor; | ||
6 | +import lombok.Builder; | ||
7 | +import lombok.Data; | ||
8 | +import lombok.NoArgsConstructor; | ||
9 | + | ||
10 | +import java.math.BigDecimal; | ||
11 | + | ||
12 | +@Data | ||
13 | +@Builder | ||
14 | +@AllArgsConstructor | ||
15 | +@NoArgsConstructor | ||
16 | +public class AppraiseOrderContext { | ||
17 | + | ||
18 | + private int uid; | ||
19 | + | ||
20 | + private long orderCode; | ||
21 | + | ||
22 | + private int productId; | ||
23 | + | ||
24 | + /** | ||
25 | + * 鉴定费 | ||
26 | + */ | ||
27 | + private BigDecimal fee; | ||
28 | + | ||
29 | + | ||
30 | + private AppraiseOrderGoodsBo goodsBo; | ||
31 | + | ||
32 | + | ||
33 | + /** | ||
34 | + * 寄回地址 | ||
35 | + */ | ||
36 | + private AddressInfo backAddress; | ||
37 | + | ||
38 | + private AddressInfo backHiddenAddress; | ||
39 | +} |
1 | +package com.yohoufo.order.service.impl; | ||
2 | + | ||
3 | +import com.alibaba.fastjson.JSONObject; | ||
4 | +import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo; | ||
5 | +import com.yohobuy.ufo.model.order.vo.AddressInfo; | ||
6 | +import com.yohoufo.dal.order.AppraiseOrderGoodsMapper; | ||
7 | +import com.yohoufo.dal.order.AppraiseOrderMapper; | ||
8 | +import com.yohoufo.dal.order.BuyerOrderMetaMapper; | ||
9 | +import com.yohoufo.dal.order.model.AppraiseOrder; | ||
10 | +import com.yohoufo.dal.order.model.AppraiseOrderGoods; | ||
11 | +import com.yohoufo.dal.order.model.BuyerOrderMeta; | ||
12 | +import com.yohoufo.order.constants.MetaKey; | ||
13 | +import com.yohoufo.order.model.dto.AppraiseOrderContext; | ||
14 | +import com.yohoufo.order.utils.LoggerUtils; | ||
15 | +import lombok.Builder; | ||
16 | +import lombok.Data; | ||
17 | +import org.slf4j.Logger; | ||
18 | +import org.springframework.beans.factory.annotation.Autowired; | ||
19 | +import org.springframework.stereotype.Service; | ||
20 | + | ||
21 | +import java.util.ArrayList; | ||
22 | +import java.util.List; | ||
23 | + | ||
24 | +@Service | ||
25 | +public class AppraiseOrderCreateService { | ||
26 | + | ||
27 | + | ||
28 | + private final Logger logger = LoggerUtils.getBuyerOrderLogger(); | ||
29 | + | ||
30 | + @Autowired | ||
31 | + private AppraiseOrderMapper appraiseOrderMapper; | ||
32 | + | ||
33 | + @Autowired | ||
34 | + private AppraiseOrderGoodsMapper appraiseOrderGoodsMapper; | ||
35 | + | ||
36 | + @Autowired | ||
37 | + private BuyerOrderMetaMapper buyerOrderMetaMapper; | ||
38 | + | ||
39 | + @Builder | ||
40 | + @Data | ||
41 | + static class SubmitResult{ | ||
42 | + AppraiseOrder appraiseOrder; | ||
43 | + | ||
44 | + AppraiseOrderGoods appraiseOrderGoods; | ||
45 | + } | ||
46 | + | ||
47 | + public SubmitResult create(AppraiseOrderContext ctx){ | ||
48 | + logger.info("in AppraiseOrderCreateService create, "); | ||
49 | + int uid = ctx.getUid(); | ||
50 | + long orderCode = ctx.getOrderCode(); | ||
51 | + logger.info("in AppraiseOrderCreateService create, uid {} orderCode {} prdId {}", | ||
52 | + uid, orderCode, ctx.getProductId()); | ||
53 | + // | ||
54 | + AppraiseOrder pao = new AppraiseOrder(); | ||
55 | + pao.setOrderCode(orderCode); | ||
56 | + pao.setAmount(ctx.getFee()); | ||
57 | + //TODO | ||
58 | + pao.setStatus(0); | ||
59 | + appraiseOrderMapper.insertSelective(pao); | ||
60 | + // | ||
61 | + AppraiseOrderGoodsBo aogb = ctx.getGoodsBo(); | ||
62 | + AppraiseOrderGoods paog = new AppraiseOrderGoods(); | ||
63 | + paog.setOrderCode(orderCode); | ||
64 | + paog.setProductId(aogb.getProductId()); | ||
65 | + paog.setProductName(aogb.getProductName()); | ||
66 | + paog.setProductCode(aogb.getProductCode()); | ||
67 | + appraiseOrderGoodsMapper.insertSelective(paog); | ||
68 | + | ||
69 | + //meta | ||
70 | + AddressInfo noHiddenBackAddress = ctx.getBackAddress(), | ||
71 | + hiddenBackAddress = ctx.getBackHiddenAddress(); | ||
72 | + final String key = MetaKey.BUYER_DELIVERY_ADDRESS, | ||
73 | + hiiden_key = MetaKey.BUYER_DELIVERY_HIDDEN_ADDRESS; | ||
74 | + BuyerOrderMeta noHiddenAddressMeta=new BuyerOrderMeta(); | ||
75 | + noHiddenAddressMeta.setUid(uid); | ||
76 | + noHiddenAddressMeta.setOrderCode(orderCode); | ||
77 | + noHiddenAddressMeta.setMetaKey(key); | ||
78 | + noHiddenAddressMeta.setMetaValue(JSONObject.toJSONString(noHiddenBackAddress)); | ||
79 | + //hidden address | ||
80 | + BuyerOrderMeta hiddenAddressMeta=new BuyerOrderMeta(); | ||
81 | + hiddenAddressMeta.setUid(uid); | ||
82 | + hiddenAddressMeta.setOrderCode(orderCode); | ||
83 | + hiddenAddressMeta.setMetaKey(hiiden_key); | ||
84 | + hiddenAddressMeta.setMetaValue(JSONObject.toJSONString(hiddenBackAddress)); | ||
85 | + List<BuyerOrderMeta> boms = new ArrayList<>(2); | ||
86 | + boms.add(noHiddenAddressMeta); | ||
87 | + boms.add(hiddenAddressMeta); | ||
88 | + buyerOrderMetaMapper.insertBatch(boms); | ||
89 | + | ||
90 | + return SubmitResult.builder().appraiseOrder(pao).appraiseOrderGoods(paog).build(); | ||
91 | + } | ||
92 | + | ||
93 | + | ||
94 | + | ||
95 | +} |
1 | package com.yohoufo.order.service.impl; | 1 | package com.yohoufo.order.service.impl; |
2 | 2 | ||
3 | +import com.yoho.error.ServiceError; | ||
4 | +import com.yoho.error.exception.ServiceException; | ||
5 | +import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo; | ||
6 | +import com.yohobuy.ufo.model.order.common.OrderCodeType; | ||
7 | +import com.yohobuy.ufo.model.order.req.AppraiseOrderComputeReq; | ||
8 | +import com.yohobuy.ufo.model.order.req.AppraiseOrderDetailReq; | ||
9 | +import com.yohobuy.ufo.model.order.req.AppraiseOrderListReq; | ||
10 | +import com.yohobuy.ufo.model.order.req.AppraiseOrderSubmitReq; | ||
11 | +import com.yohobuy.ufo.model.order.resp.AppraiseOrderComputeResp; | ||
12 | +import com.yohobuy.ufo.model.order.resp.AppraiseOrderDetailResp; | ||
13 | +import com.yohobuy.ufo.model.order.resp.AppraiseOrderListResp; | ||
14 | +import com.yohobuy.ufo.model.order.resp.AppraiseOrderSubmitResp; | ||
15 | +import com.yohobuy.ufo.model.order.vo.AddressInfo; | ||
16 | +import com.yohoufo.common.exception.UfoServiceException; | ||
17 | +import com.yohoufo.common.utils.AddressUtil; | ||
18 | +import com.yohoufo.dal.order.AppraiseOrderGoodsMapper; | ||
19 | +import com.yohoufo.dal.order.AppraiseOrderMapper; | ||
20 | +import com.yohoufo.order.model.dto.AppraiseOrderContext; | ||
21 | +import com.yohoufo.order.service.proxy.UserProxyService; | ||
22 | +import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; | ||
23 | +import com.yohoufo.order.utils.AddressHelper; | ||
3 | import com.yohoufo.order.utils.LoggerUtils; | 24 | import com.yohoufo.order.utils.LoggerUtils; |
25 | +import lombok.Builder; | ||
26 | +import lombok.Data; | ||
4 | import org.slf4j.Logger; | 27 | import org.slf4j.Logger; |
28 | +import org.springframework.beans.factory.annotation.Autowired; | ||
5 | import org.springframework.stereotype.Service; | 29 | import org.springframework.stereotype.Service; |
6 | 30 | ||
7 | @Service | 31 | @Service |
@@ -10,8 +34,127 @@ public class AppraiseOrderService { | @@ -10,8 +34,127 @@ public class AppraiseOrderService { | ||
10 | 34 | ||
11 | private final Logger logger = LoggerUtils.getBuyerOrderLogger(); | 35 | private final Logger logger = LoggerUtils.getBuyerOrderLogger(); |
12 | 36 | ||
37 | + @Autowired | ||
38 | + private AppraiseOrderMapper appraiseOrderMapper; | ||
13 | 39 | ||
40 | + @Autowired | ||
41 | + private AppraiseOrderGoodsMapper appraiseOrderGoodsMapper; | ||
14 | 42 | ||
43 | + @Autowired | ||
44 | + private UserProxyService userProxyService; | ||
15 | 45 | ||
46 | + @Autowired | ||
47 | + private AppraiseOrderCreateService appraiseOrderCreateService; | ||
16 | 48 | ||
49 | + | ||
50 | + @Autowired | ||
51 | + OrderCodeGenerator orderCodeGenerator; | ||
52 | + | ||
53 | + | ||
54 | + public AppraiseOrderComputeResp compute(AppraiseOrderComputeReq req){ | ||
55 | + logger.info("in AppraiseOrderService.compute req {}", req); | ||
56 | + int uid = req.getUid(); | ||
57 | + if (uid<=0){ | ||
58 | + throw new UfoServiceException(400, "uid错误"); | ||
59 | + } | ||
60 | + int productId = req.getProductId(); | ||
61 | + if (productId <= 0){ | ||
62 | + throw new UfoServiceException(400, "商品ID错误"); | ||
63 | + } | ||
64 | + | ||
65 | + double fee = 15D; | ||
66 | + return AppraiseOrderComputeResp.builder().fee(String.valueOf(fee)).build(); | ||
67 | + } | ||
68 | + | ||
69 | + | ||
70 | + | ||
71 | + | ||
72 | + public AppraiseOrderSubmitResp submit(AppraiseOrderSubmitReq req){ | ||
73 | + //1. check | ||
74 | + PreparedNode pn = checkAndAcquire(req); | ||
75 | + // 生成订单号 | ||
76 | + long orderCode = orderCodeGenerator.generate(OrderCodeType.BUYER_TYPE); | ||
77 | + logger.info("AppraiseOrder.submit req {} ,generate new orderCode:{}", req, orderCode); | ||
78 | + | ||
79 | + AppraiseOrderGoodsBo aog = new AppraiseOrderGoodsBo(); | ||
80 | + //TODO dependency product service support produce data | ||
81 | + | ||
82 | + | ||
83 | + AppraiseOrderContext aoc = AppraiseOrderContext.builder() | ||
84 | + .orderCode(orderCode) | ||
85 | + .uid(pn.getUid()) | ||
86 | + .productId(pn.getProductId()) | ||
87 | + .backAddress(pn.getNoHiddenBackAddress()) | ||
88 | + .backHiddenAddress(pn.getHiddenBackAddress()) | ||
89 | + .goodsBo(aog) | ||
90 | + .build(); | ||
91 | + | ||
92 | + //2 persistent key info | ||
93 | + //2.1 appraise order | ||
94 | + //2.2 appraise order goods | ||
95 | + //2.3 address | ||
96 | + AppraiseOrderCreateService.SubmitResult submitResult = appraiseOrderCreateService.create(aoc); | ||
97 | + | ||
98 | + //todo notice by async | ||
99 | + AppraiseOrderSubmitResp aosr = new AppraiseOrderSubmitResp(); | ||
100 | + aosr.setOrderCode(orderCode); | ||
101 | + return aosr; | ||
102 | + } | ||
103 | + | ||
104 | + @Data | ||
105 | + @Builder | ||
106 | + private static class PreparedNode{ | ||
107 | + int uid; | ||
108 | + int productId; | ||
109 | + AddressInfo hiddenBackAddress; | ||
110 | + AddressInfo noHiddenBackAddress; | ||
111 | + } | ||
112 | + | ||
113 | + private PreparedNode checkAndAcquire(AppraiseOrderSubmitReq req){ | ||
114 | + int uid = req.getUid(); | ||
115 | + if (uid<=0){ | ||
116 | + throw new UfoServiceException(400, "uid错误"); | ||
117 | + } | ||
118 | + int productId = req.getProductId(); | ||
119 | + if (productId <= 0){ | ||
120 | + throw new UfoServiceException(400, "商品ID错误"); | ||
121 | + } | ||
122 | + | ||
123 | + int addressId = AddressUtil.getDecryptStr(req.getAddressId()); | ||
124 | + if (addressId < 0){ | ||
125 | + logger.warn("submit appraise order addressId invalidate, uid {}, productId {}, addressId {}", | ||
126 | + uid, productId, req.getAddressId()); | ||
127 | + throw new ServiceException(ServiceError.ORDER_ADDRESSID_INVALIDATE); | ||
128 | + } | ||
129 | + | ||
130 | + //the address of send back 2 seller | ||
131 | + AddressInfo hiddenBackAddress = userProxyService.getHiddenAddressInfo(uid, addressId); | ||
132 | + AddressInfo noHiddenBackAddress = userProxyService.getAddressInfoNotHidden(uid, addressId); | ||
133 | + if(AddressHelper.isNeedUpdate(noHiddenBackAddress)){ | ||
134 | + logger.warn("submit appraise order addressId need update, uid {}, appraise {}, addressId {}", | ||
135 | + uid, productId, addressId); | ||
136 | + throw new ServiceException(ServiceError.ORDER_ADDRESS_NEED_UPDATE); | ||
137 | + } | ||
138 | + | ||
139 | + return PreparedNode.builder() | ||
140 | + .uid(uid) | ||
141 | + .productId(productId) | ||
142 | + .hiddenBackAddress(hiddenBackAddress) | ||
143 | + .noHiddenBackAddress(noHiddenBackAddress) | ||
144 | + .build(); | ||
145 | + } | ||
146 | + | ||
147 | + | ||
148 | + | ||
149 | + public AppraiseOrderListResp getOrderList(AppraiseOrderListReq req){ | ||
150 | + | ||
151 | + | ||
152 | + return null; | ||
153 | + } | ||
154 | + | ||
155 | + | ||
156 | + public AppraiseOrderDetailResp getOrderDetail(AppraiseOrderDetailReq req){ | ||
157 | + | ||
158 | + return null; | ||
159 | + } | ||
17 | } | 160 | } |
-
Please register or login to post a comment