Merge branch 'test6.9.10' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.10
Showing
30 changed files
with
545 additions
and
137 deletions
@@ -15,6 +15,8 @@ public interface AppraiseOrderGoodsMapper { | @@ -15,6 +15,8 @@ public interface AppraiseOrderGoodsMapper { | ||
15 | 15 | ||
16 | List<AppraiseOrderGoods> selectByOrderCode(Long orderCode); | 16 | List<AppraiseOrderGoods> selectByOrderCode(Long orderCode); |
17 | 17 | ||
18 | + AppraiseOrderGoods selectOneByOrderCode(Long orderCode); | ||
19 | + | ||
18 | int updateDepotNo(AppraiseOrderGoods record); | 20 | int updateDepotNo(AppraiseOrderGoods record); |
19 | 21 | ||
20 | int updateByPrimaryKey(AppraiseOrderGoods record); | 22 | int updateByPrimaryKey(AppraiseOrderGoods record); |
@@ -18,18 +18,25 @@ public interface AppraiseOrderMapper { | @@ -18,18 +18,25 @@ public interface AppraiseOrderMapper { | ||
18 | 18 | ||
19 | int updateByPrimaryKey(AppraiseOrder record); | 19 | int updateByPrimaryKey(AppraiseOrder record); |
20 | 20 | ||
21 | - List<AppraiseOrder> selectSubOrderList(long parentOrderCode); | 21 | + int selectSubOrderCnt(@Param("parentOrderCode") long parentOrderCode); |
22 | + | ||
23 | + List<AppraiseOrder> selectSubOrderList(@Param("parentOrderCode") long parentOrderCode, | ||
24 | + @Param("offset")int offset, | ||
25 | + @Param("limit")int limit); | ||
22 | 26 | ||
23 | AppraiseOrder selectByOrderCode(long orderCode); | 27 | AppraiseOrder selectByOrderCode(long orderCode); |
24 | 28 | ||
25 | 29 | ||
26 | int selectCntByOrderType(@Param("uid") int uid, | 30 | int selectCntByOrderType(@Param("uid") int uid, |
27 | @Param("attributes") int attributes, | 31 | @Param("attributes") int attributes, |
28 | - @Param("statusList")Collection<Integer> statusList); | 32 | + @Param("statusList")Collection<Integer> statusList, |
33 | + @Param("parentOnly") boolean parentOnly | ||
34 | + ); | ||
29 | 35 | ||
30 | List<AppraiseOrder> selectOrderListByOrderType(@Param("uid") int uid, | 36 | List<AppraiseOrder> selectOrderListByOrderType(@Param("uid") int uid, |
31 | @Param("attributes") int attributes, | 37 | @Param("attributes") int attributes, |
32 | @Param("statusList")Collection<Integer> statusList, | 38 | @Param("statusList")Collection<Integer> statusList, |
39 | + @Param("parentOnly") boolean parentOnly, | ||
33 | @Param("offset")int offset, | 40 | @Param("offset")int offset, |
34 | @Param("limit")int limit); | 41 | @Param("limit")int limit); |
35 | 42 | ||
@@ -40,7 +47,7 @@ public interface AppraiseOrderMapper { | @@ -40,7 +47,7 @@ public interface AppraiseOrderMapper { | ||
40 | 47 | ||
41 | /** | 48 | /** |
42 | * 根据订单列表查询信息列表 | 49 | * 根据订单列表查询信息列表 |
43 | - * @param appraiseOrderList | 50 | + * @param orderList |
44 | * @return | 51 | * @return |
45 | */ | 52 | */ |
46 | List<AppraiseOrder> selectByOrderCodeList(@Param("orderList")List<Long> orderList); | 53 | List<AppraiseOrder> selectByOrderCodeList(@Param("orderList")List<Long> orderList); |
@@ -25,4 +25,6 @@ public interface AppraiseOrderStorageMapper { | @@ -25,4 +25,6 @@ public interface AppraiseOrderStorageMapper { | ||
25 | List<AppraiseOrderStorage> selectAllByOrderCodePrdId(@Param("orderCode")long orderCode, | 25 | List<AppraiseOrderStorage> selectAllByOrderCodePrdId(@Param("orderCode")long orderCode, |
26 | @Param("productId")int productId); | 26 | @Param("productId")int productId); |
27 | 27 | ||
28 | + List<AppraiseOrderStorage> selectByOrderCodes(@Param("orderCodes")Collection<Long> appraiseOrderCodes); | ||
29 | + | ||
28 | } | 30 | } |
@@ -22,6 +22,13 @@ | @@ -22,6 +22,13 @@ | ||
22 | where order_code = #{orderCode,jdbcType=BIGINT} | 22 | where order_code = #{orderCode,jdbcType=BIGINT} |
23 | </select> | 23 | </select> |
24 | 24 | ||
25 | + <select id="selectOneByOrderCode" parameterType="java.lang.Long" resultMap="BaseResultMap"> | ||
26 | + select | ||
27 | + <include refid="Base_Column_List" /> | ||
28 | + from appraise_order_goods | ||
29 | + where order_code = #{orderCode,jdbcType=BIGINT} limit 0,1 | ||
30 | + </select> | ||
31 | + | ||
25 | <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrderGoods" useGeneratedKeys="true"> | 32 | <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrderGoods" useGeneratedKeys="true"> |
26 | insert into appraise_order_goods (order_code, product_id, product_name, | 33 | insert into appraise_order_goods (order_code, product_id, product_name, |
27 | product_code, image_url, depot_no, | 34 | product_code, image_url, depot_no, |
@@ -23,11 +23,18 @@ | @@ -23,11 +23,18 @@ | ||
23 | create_time, update_time, is_del, channel_no, attributes, platform_delivery_status | 23 | create_time, update_time, is_del, channel_no, attributes, platform_delivery_status |
24 | </sql> | 24 | </sql> |
25 | 25 | ||
26 | - <select id="selectSubOrderList" parameterType="java.lang.Long" resultMap="BaseResultMap"> | 26 | + <select id="selectSubOrderList" resultMap="BaseResultMap"> |
27 | select | 27 | select |
28 | <include refid="Base_Column_List" /> | 28 | <include refid="Base_Column_List" /> |
29 | from appraise_order | 29 | from appraise_order |
30 | where parent_order_code = #{parentOrderCode,jdbcType=INTEGER} | 30 | where parent_order_code = #{parentOrderCode,jdbcType=INTEGER} |
31 | + limit #{offset},#{limit} | ||
32 | + </select> | ||
33 | + | ||
34 | + | ||
35 | + <select id="selectSubOrderCnt" parameterType="java.lang.Long" resultType="java.lang.Integer"> | ||
36 | + select count(*) from appraise_order | ||
37 | + where parent_order_code = #{parentOrderCode,jdbcType=INTEGER} | ||
31 | </select> | 38 | </select> |
32 | 39 | ||
33 | <select id="selectByOrderCode" parameterType="java.lang.Long" resultMap="BaseResultMap"> | 40 | <select id="selectByOrderCode" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
@@ -45,6 +52,10 @@ | @@ -45,6 +52,10 @@ | ||
45 | <foreach collection="statusList" item="status" open="(" close=")" separator=","> | 52 | <foreach collection="statusList" item="status" open="(" close=")" separator=","> |
46 | #{status,jdbcType=TINYINT} | 53 | #{status,jdbcType=TINYINT} |
47 | </foreach> | 54 | </foreach> |
55 | + <if test="parentOnly"> | ||
56 | + and parent_order_code is null | ||
57 | + </if> | ||
58 | + | ||
48 | </select> | 59 | </select> |
49 | 60 | ||
50 | <select id="selectOrderListByOrderType" resultMap="BaseResultMap"> | 61 | <select id="selectOrderListByOrderType" resultMap="BaseResultMap"> |
@@ -57,6 +68,9 @@ | @@ -57,6 +68,9 @@ | ||
57 | <foreach collection="statusList" item="status" open="(" close=")" separator=","> | 68 | <foreach collection="statusList" item="status" open="(" close=")" separator=","> |
58 | #{status,jdbcType=TINYINT} | 69 | #{status,jdbcType=TINYINT} |
59 | </foreach> | 70 | </foreach> |
71 | + <if test="parentOnly"> | ||
72 | + and parent_order_code is null | ||
73 | + </if> | ||
60 | order by id desc limit #{offset},#{limit} | 74 | order by id desc limit #{offset},#{limit} |
61 | </select> | 75 | </select> |
62 | 76 |
@@ -158,4 +158,16 @@ | @@ -158,4 +158,16 @@ | ||
158 | from appraise_order_storage | 158 | from appraise_order_storage |
159 | where order_code = #{orderCode,jdbcType=BIGINT} ORDER BY id desc limit 1 | 159 | where order_code = #{orderCode,jdbcType=BIGINT} ORDER BY id desc limit 1 |
160 | </select> | 160 | </select> |
161 | + | ||
162 | + | ||
163 | + | ||
164 | + <select id="selectByOrderCodes" resultMap="BaseResultMap"> | ||
165 | + select | ||
166 | + <include refid="Base_Column_List" /> | ||
167 | + from appraise_order_storage | ||
168 | + where order_code in | ||
169 | + <foreach collection="orderCodes" item="orderCode" open="(" close=")" separator=","> | ||
170 | + #{orderCode,jdbcType=BIGINT} | ||
171 | + </foreach> | ||
172 | + </select> | ||
161 | </mapper> | 173 | </mapper> |
@@ -2,12 +2,14 @@ package com.yohoufo.order.controller; | @@ -2,12 +2,14 @@ package com.yohoufo.order.controller; | ||
2 | 2 | ||
3 | import com.yoho.core.rest.annotation.ServiceDesc; | 3 | import com.yoho.core.rest.annotation.ServiceDesc; |
4 | import com.yohobuy.ufo.model.order.bo.AppraiseExpressInfoBo; | 4 | import com.yohobuy.ufo.model.order.bo.AppraiseExpressInfoBo; |
5 | +import com.yohobuy.ufo.model.order.common.OrderCodeType; | ||
5 | import com.yohobuy.ufo.model.order.req.BuyerOrderCancelReq; | 6 | import com.yohobuy.ufo.model.order.req.BuyerOrderCancelReq; |
6 | import com.yohoufo.common.ApiResponse; | 7 | import com.yohoufo.common.ApiResponse; |
7 | import com.yohoufo.common.annotation.IgnoreSession; | 8 | import com.yohoufo.common.annotation.IgnoreSession; |
8 | import com.yohoufo.common.annotation.IgnoreSignature; | 9 | import com.yohoufo.common.annotation.IgnoreSignature; |
9 | import com.yohoufo.order.model.request.SaveQualityCheckInfoRequest; | 10 | import com.yohoufo.order.model.request.SaveQualityCheckInfoRequest; |
10 | import com.yohoufo.order.service.impl.AppraiseService; | 11 | import com.yohoufo.order.service.impl.AppraiseService; |
12 | +import com.yohoufo.order.service.support.codegenerator.impl.OrderCodeGeneratorImpl; | ||
11 | import org.slf4j.Logger; | 13 | import org.slf4j.Logger; |
12 | import org.slf4j.LoggerFactory; | 14 | import org.slf4j.LoggerFactory; |
13 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -29,6 +31,9 @@ public class AppraiseController { | @@ -29,6 +31,9 @@ public class AppraiseController { | ||
29 | @Autowired | 31 | @Autowired |
30 | private AppraiseService appraiseService; | 32 | private AppraiseService appraiseService; |
31 | 33 | ||
34 | + @Autowired | ||
35 | + private OrderCodeGeneratorImpl orderCodeGenerator; | ||
36 | + | ||
32 | /** | 37 | /** |
33 | * 卖家到平台的物流单号更新,重新触发物流 | 38 | * 卖家到平台的物流单号更新,重新触发物流 |
34 | */ | 39 | */ |
@@ -207,4 +212,13 @@ public class AppraiseController { | @@ -207,4 +212,13 @@ public class AppraiseController { | ||
207 | appraiseService.updateDeptNo(appraiseExpressInfoBo); | 212 | appraiseService.updateDeptNo(appraiseExpressInfoBo); |
208 | return new ApiResponse(); | 213 | return new ApiResponse(); |
209 | } | 214 | } |
215 | + | ||
216 | + @RequestMapping(params = "method=ufo.order.isServiceOrder") | ||
217 | + @IgnoreSession | ||
218 | + @IgnoreSignature | ||
219 | + public ApiResponse updateDeptNo(Long orderCode) { | ||
220 | + OrderCodeType type = OrderCodeType.getOrderCodeType(orderCodeGenerator.expId(orderCode).getType()); | ||
221 | + return new ApiResponse(200, "", type == OrderCodeType.GOODS_SERVICE || type == OrderCodeType.STORAGE_MANAGEMENT); | ||
222 | + } | ||
223 | + | ||
210 | } | 224 | } |
@@ -211,9 +211,10 @@ public class SellerDepositOrderController { | @@ -211,9 +211,10 @@ public class SellerDepositOrderController { | ||
211 | .page(page) | 211 | .page(page) |
212 | .limit(limit).build(); | 212 | .limit(limit).build(); |
213 | logger.info("in method=ufo.depositOrderInStore.list req {}", req); | 213 | logger.info("in method=ufo.depositOrderInStore.list req {}", req); |
214 | - PageResp<DepositOrderInStorePrdListResp> resp = sellerDepositOrderService.getDepositOrderListInStore(req); | 214 | + PageResp<DepositOrderInStorePrdListResp> resp = sellerDepositOrderListService.getDepositOrderListInStore(req); |
215 | return new ApiResponse.ApiResponseBuilder() | 215 | return new ApiResponse.ApiResponseBuilder() |
216 | .code(200) | 216 | .code(200) |
217 | + .data(resp) | ||
217 | .message("寄存订单入库单查询成功") | 218 | .message("寄存订单入库单查询成功") |
218 | .build(); | 219 | .build(); |
219 | } | 220 | } |
1 | +package com.yohoufo.order.event; | ||
2 | + | ||
3 | +import lombok.Getter; | ||
4 | +import lombok.Setter; | ||
5 | +import lombok.ToString; | ||
6 | + | ||
7 | +import java.util.function.Function; | ||
8 | +@ToString(of = {"uid", "orderCode"}) | ||
9 | +public class SellerDepositOrderCancelAsyncEvent extends AsyncEvent { | ||
10 | + @Getter@Setter | ||
11 | + private int uid; | ||
12 | + @Getter@Setter | ||
13 | + private long orderCode; | ||
14 | + | ||
15 | + public SellerDepositOrderCancelAsyncEvent(Function<SellerDepositOrderCancelAsyncEvent,Boolean> function) { | ||
16 | + super(function); | ||
17 | + } | ||
18 | + | ||
19 | + @Override | ||
20 | + AsyncEvent getAsyncEvent() { | ||
21 | + return this; | ||
22 | + } | ||
23 | +} |
@@ -28,4 +28,6 @@ public interface DelayTime { | @@ -28,4 +28,6 @@ public interface DelayTime { | ||
28 | int CANCEL_SHAM_DELIVERY_TIME_MINUTE=48*60; | 28 | int CANCEL_SHAM_DELIVERY_TIME_MINUTE=48*60; |
29 | 29 | ||
30 | int MINUTES_120_HOURS = 120 * 60; | 30 | int MINUTES_120_HOURS = 120 * 60; |
31 | + | ||
32 | + int SELLER_DEPOSIT_ORDER_PAY_TIME_LIMIT = 10; | ||
31 | } | 33 | } |
@@ -63,4 +63,7 @@ public interface TopicConstants { | @@ -63,4 +63,7 @@ public interface TopicConstants { | ||
63 | */ | 63 | */ |
64 | String DEPOSIT_FINISH_DELIVERY = "deposit.finishDelivery"; | 64 | String DEPOSIT_FINISH_DELIVERY = "deposit.finishDelivery"; |
65 | 65 | ||
66 | + | ||
67 | + String SELLER_DEPOSIT_ORDER_AUTO_CANCEL = "sellerDepositOrder.autoCancel"; | ||
68 | + | ||
66 | } | 69 | } |
order/src/main/java/com/yohoufo/order/mq/consumer/SellerDepositOrderAutoCancelMsgConsumer.java
0 → 100644
1 | +package com.yohoufo.order.mq.consumer; | ||
2 | + | ||
3 | +import com.yohoufo.order.event.OrderCancelEvent; | ||
4 | +import com.yohoufo.order.mq.TopicConstants; | ||
5 | +import com.yohoufo.order.service.seller.deposit.SellerDepositOrderService; | ||
6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
7 | +import org.springframework.stereotype.Component; | ||
8 | + | ||
9 | +@Component | ||
10 | +public class SellerDepositOrderAutoCancelMsgConsumer extends AbsOrderAutoCancelDelayMsgConsumer { | ||
11 | + | ||
12 | + @Autowired | ||
13 | + private SellerDepositOrderService sellerDepositOrderService; | ||
14 | + | ||
15 | + @Override | ||
16 | + public String getTopic() { | ||
17 | + return TopicConstants.SELLER_DEPOSIT_ORDER_AUTO_CANCEL; | ||
18 | + } | ||
19 | + | ||
20 | + @Override | ||
21 | + public void cancel(OrderCancelEvent event) { | ||
22 | + sellerDepositOrderService.cancelByTimeout(event); | ||
23 | + } | ||
24 | + | ||
25 | + @Override | ||
26 | + public void sendAgain(OrderCancelEvent cancelBean) { | ||
27 | + producerTemplate.send(getTopic(), cancelBean, null, cancelBean.getPayExpire()); | ||
28 | + } | ||
29 | +} |
@@ -7,6 +7,7 @@ import com.yohobuy.ufo.model.order.bo.OrderInfo; | @@ -7,6 +7,7 @@ import com.yohobuy.ufo.model.order.bo.OrderInfo; | ||
7 | import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus; | 7 | import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus; |
8 | import com.yohobuy.ufo.model.order.common.OrderAttributes; | 8 | import com.yohobuy.ufo.model.order.common.OrderAttributes; |
9 | import com.yohobuy.ufo.model.order.common.OrderCodeType; | 9 | import com.yohobuy.ufo.model.order.common.OrderCodeType; |
10 | +import com.yohoufo.common.alarm.EventBusPublisher; | ||
10 | import com.yohoufo.common.exception.UfoServiceException; | 11 | import com.yohoufo.common.exception.UfoServiceException; |
11 | import com.yohoufo.common.utils.DateUtil; | 12 | import com.yohoufo.common.utils.DateUtil; |
12 | import com.yohoufo.dal.order.AppraiseOrderMapper; | 13 | import com.yohoufo.dal.order.AppraiseOrderMapper; |
@@ -14,9 +15,12 @@ import com.yohoufo.dal.order.AppraiseOrderMetaMapper; | @@ -14,9 +15,12 @@ import com.yohoufo.dal.order.AppraiseOrderMetaMapper; | ||
14 | import com.yohoufo.dal.order.model.AppraiseOrder; | 15 | import com.yohoufo.dal.order.model.AppraiseOrder; |
15 | import com.yohoufo.dal.order.model.AppraiseOrderMeta; | 16 | import com.yohoufo.dal.order.model.AppraiseOrderMeta; |
16 | import com.yohoufo.order.constants.MetaKey; | 17 | import com.yohoufo.order.constants.MetaKey; |
18 | +import com.yohoufo.order.event.EventHandlerContainer; | ||
19 | +import com.yohoufo.order.event.SellerDepositOrderCancelAsyncEvent; | ||
17 | import com.yohoufo.order.model.request.PaymentRequest; | 20 | import com.yohoufo.order.model.request.PaymentRequest; |
18 | import com.yohoufo.order.model.response.PrepayResponse; | 21 | import com.yohoufo.order.model.response.PrepayResponse; |
19 | import com.yohoufo.order.mq.DelayTime; | 22 | import com.yohoufo.order.mq.DelayTime; |
23 | +import com.yohoufo.order.service.seller.deposit.SellerDepositOrderService; | ||
20 | import org.slf4j.Logger; | 24 | import org.slf4j.Logger; |
21 | import org.slf4j.LoggerFactory; | 25 | import org.slf4j.LoggerFactory; |
22 | import org.springframework.beans.factory.annotation.Autowired; | 26 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -35,6 +39,9 @@ public class AppraiseOrderPaymentService extends AbstractOrderPaymentService { | @@ -35,6 +39,9 @@ public class AppraiseOrderPaymentService extends AbstractOrderPaymentService { | ||
35 | @Autowired | 39 | @Autowired |
36 | private AppraiseOrderMetaMapper appraiseOrderMetaMapper; | 40 | private AppraiseOrderMetaMapper appraiseOrderMetaMapper; |
37 | 41 | ||
42 | + @Autowired | ||
43 | + private SellerDepositOrderService sellerDepositOrderService; | ||
44 | + | ||
38 | @Override | 45 | @Override |
39 | public boolean isTimeoutCancelStatus(OrderInfo orderInfo) { | 46 | public boolean isTimeoutCancelStatus(OrderInfo orderInfo) { |
40 | if (orderInfo.getStatus() != null | 47 | if (orderInfo.getStatus() != null |
@@ -129,7 +136,10 @@ public class AppraiseOrderPaymentService extends AbstractOrderPaymentService { | @@ -129,7 +136,10 @@ public class AppraiseOrderPaymentService extends AbstractOrderPaymentService { | ||
129 | } | 136 | } |
130 | return false; | 137 | return false; |
131 | } | 138 | } |
132 | - final static List<Integer> canRefundStatusList = Arrays.asList(AppraiseOrderStatus.HAS_PAYED.getCode()); | 139 | + |
140 | + final static List<Integer> canRefundStatusList = Arrays.asList(AppraiseOrderStatus.WAITING_PAY.getCode(), | ||
141 | + AppraiseOrderStatus.HAS_PAYED.getCode()); | ||
142 | + | ||
133 | @Override | 143 | @Override |
134 | public boolean canRefund(OrderInfo orderInfo) { | 144 | public boolean canRefund(OrderInfo orderInfo) { |
135 | OrderAttributes oa = OrderAttributes.getOrderAttributes(orderInfo.getAttributes()); | 145 | OrderAttributes oa = OrderAttributes.getOrderAttributes(orderInfo.getAttributes()); |
@@ -158,5 +168,18 @@ public class AppraiseOrderPaymentService extends AbstractOrderPaymentService { | @@ -158,5 +168,18 @@ public class AppraiseOrderPaymentService extends AbstractOrderPaymentService { | ||
158 | @Override | 168 | @Override |
159 | public void processAfterPay(OrderInfo orderInfo) { | 169 | public void processAfterPay(OrderInfo orderInfo) { |
160 | 170 | ||
171 | + OrderAttributes oa = OrderAttributes.getOrderAttributes(orderInfo.getAttributes()); | ||
172 | + switch (oa){ | ||
173 | + case APPRAISE: | ||
174 | + | ||
175 | + break; | ||
176 | + case DEPOSITE: | ||
177 | + SellerDepositOrderCancelAsyncEvent event = new SellerDepositOrderCancelAsyncEvent(sellerDepositOrderService::handleOrderCancelAsyncEvent); | ||
178 | + event.setUid(orderInfo.getUid()); | ||
179 | + event.setOrderCode(orderInfo.getOrderCode()); | ||
180 | + EventBusPublisher.publishEvent(event); | ||
181 | + logger.info("processAfterPay seller deposit order , SellerDepositOrderCancelAsyncEvent send out"); | ||
182 | + break; | ||
183 | + } | ||
161 | } | 184 | } |
162 | } | 185 | } |
@@ -77,7 +77,7 @@ public class GoodsServiceRefundHandler extends AbsRefundOrderHandler { | @@ -77,7 +77,7 @@ public class GoodsServiceRefundHandler extends AbsRefundOrderHandler { | ||
77 | .refundAmount(this.refundEarnestMoney.doubleValue()) | 77 | .refundAmount(this.refundEarnestMoney.doubleValue()) |
78 | .refundattch(moai).build(); | 78 | .refundattch(moai).build(); |
79 | 79 | ||
80 | - BillLogEvent.BillLogEventBuilder bleb = BillLogEvent.builder() | 80 | + this.bleb = BillLogEvent.builder() |
81 | .buyerUid(uid).sellerUid(uid).orderCode(orderCode) | 81 | .buyerUid(uid).sellerUid(uid).orderCode(orderCode) |
82 | .payType(payment).refundCase(RefundCase.SELLER_EARNEST_MONEY) | 82 | .payType(payment).refundCase(RefundCase.SELLER_EARNEST_MONEY) |
83 | ; | 83 | ; |
@@ -141,7 +141,7 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService { | @@ -141,7 +141,7 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService { | ||
141 | @Override | 141 | @Override |
142 | public int findFlaw(AppraiseOrder appraiseOrder){ | 142 | public int findFlaw(AppraiseOrder appraiseOrder){ |
143 | long orderCode = appraiseOrder.getOrderCode(); | 143 | long orderCode = appraiseOrder.getOrderCode(); |
144 | - AppraiseOrderStatus targetStatus = AppraiseOrderStatus.FLAW, | 144 | + AppraiseOrderStatus targetStatus = AppraiseOrderStatus.QUALITY_CHECK_FAKE, |
145 | expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE; | 145 | expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE; |
146 | 146 | ||
147 | int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus); | 147 | int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus); |
@@ -229,8 +229,9 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements | @@ -229,8 +229,9 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements | ||
229 | PageResp.PageRespBuilder respBuilder = PageResp.builder(); | 229 | PageResp.PageRespBuilder respBuilder = PageResp.builder(); |
230 | int uid = req.getUid(); | 230 | int uid = req.getUid(); |
231 | OrderAttributes orderAttributes = getOrderAttributes(); | 231 | OrderAttributes orderAttributes = getOrderAttributes(); |
232 | + final boolean showParentOnly = true; | ||
232 | final List<Integer> statusList = getLegalStatus(); | 233 | final List<Integer> statusList = getLegalStatus(); |
233 | - int total = appraiseOrderMapper.selectCntByOrderType(uid, orderAttributes.getCode(), statusList); | 234 | + int total = appraiseOrderMapper.selectCntByOrderType(uid, orderAttributes.getCode(), statusList, showParentOnly); |
234 | int limit = req.getLimit(); | 235 | int limit = req.getLimit(); |
235 | if (total == 0){ | 236 | if (total == 0){ |
236 | return respBuilder | 237 | return respBuilder |
@@ -242,7 +243,7 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements | @@ -242,7 +243,7 @@ public class AppraiseOrderService extends AbsGoodsServiceOrderService implements | ||
242 | 243 | ||
243 | int offset = (req.getPage() - 1) * limit; | 244 | int offset = (req.getPage() - 1) * limit; |
244 | 245 | ||
245 | - List<AppraiseOrder> orderList = appraiseOrderMapper.selectOrderListByOrderType(uid, orderAttributes.getCode(), statusList, offset, limit); | 246 | + List<AppraiseOrder> orderList = appraiseOrderMapper.selectOrderListByOrderType(uid, orderAttributes.getCode(), statusList, showParentOnly, offset, limit); |
246 | 247 | ||
247 | List<Long> orderCodes = orderList.stream().map(AppraiseOrder::getOrderCode).collect(Collectors.toList()); | 248 | List<Long> orderCodes = orderList.stream().map(AppraiseOrder::getOrderCode).collect(Collectors.toList()); |
248 | List<AppraiseOrderGoods> paogs = appraiseOrderGoodsMapper.selectByOrderCodes(orderCodes); | 249 | List<AppraiseOrderGoods> paogs = appraiseOrderGoodsMapper.selectByOrderCodes(orderCodes); |
@@ -15,6 +15,7 @@ import com.yohobuy.ufo.model.order.resp.PageResp; | @@ -15,6 +15,7 @@ import com.yohobuy.ufo.model.order.resp.PageResp; | ||
15 | import com.yohobuy.ufo.model.order.resp.SellerDepositOrderDetailResp; | 15 | import com.yohobuy.ufo.model.order.resp.SellerDepositOrderDetailResp; |
16 | import com.yohobuy.ufo.model.order.vo.AddressInfo; | 16 | import com.yohobuy.ufo.model.order.vo.AddressInfo; |
17 | import com.yohobuy.ufo.model.order.vo.ProductVo; | 17 | import com.yohobuy.ufo.model.order.vo.ProductVo; |
18 | +import com.yohoufo.common.utils.BigDecimalHelper; | ||
18 | import com.yohoufo.common.utils.DateUtil; | 19 | import com.yohoufo.common.utils.DateUtil; |
19 | import com.yohoufo.dal.order.AppraiseOrderGoodsMapper; | 20 | import com.yohoufo.dal.order.AppraiseOrderGoodsMapper; |
20 | import com.yohoufo.dal.order.AppraiseOrderMapper; | 21 | import com.yohoufo.dal.order.AppraiseOrderMapper; |
@@ -121,7 +122,7 @@ public class SellerDepositOrderDetailService extends AbsOrderViewService { | @@ -121,7 +122,7 @@ public class SellerDepositOrderDetailService extends AbsOrderViewService { | ||
121 | return SellerDepositOrderDetailResp.builder() | 122 | return SellerDepositOrderDetailResp.builder() |
122 | .orderCode(orderCode) | 123 | .orderCode(orderCode) |
123 | .uid(uid) | 124 | .uid(uid) |
124 | - .earnestMoney(SellerOrderConvertor.formatFee(pao.getAmount())) | 125 | + .earnestMoney(BigDecimalHelper.halfUp(pao.getAmount()).toPlainString()) |
125 | .createTime(DateUtil.formatDate(pao.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS)) | 126 | .createTime(DateUtil.formatDate(pao.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS)) |
126 | .timeout(timeout) | 127 | .timeout(timeout) |
127 | .statusDetail(statusDetail) | 128 | .statusDetail(statusDetail) |
@@ -6,6 +6,7 @@ import com.yohobuy.ufo.model.order.common.OrderAttributes; | @@ -6,6 +6,7 @@ import com.yohobuy.ufo.model.order.common.OrderAttributes; | ||
6 | import com.yohobuy.ufo.model.order.constants.SellerDepositOrderListType; | 6 | import com.yohobuy.ufo.model.order.constants.SellerDepositOrderListType; |
7 | import com.yohobuy.ufo.model.order.req.SellerDepositOrderListReq; | 7 | import com.yohobuy.ufo.model.order.req.SellerDepositOrderListReq; |
8 | import com.yohobuy.ufo.model.order.req.SellerDepositOrderPrdListReq; | 8 | import com.yohobuy.ufo.model.order.req.SellerDepositOrderPrdListReq; |
9 | +import com.yohobuy.ufo.model.order.resp.DepositOrderInStorePrdListResp; | ||
9 | import com.yohobuy.ufo.model.order.resp.PageResp; | 10 | import com.yohobuy.ufo.model.order.resp.PageResp; |
10 | import com.yohobuy.ufo.model.order.resp.SellerDepositOrderListResp; | 11 | import com.yohobuy.ufo.model.order.resp.SellerDepositOrderListResp; |
11 | import com.yohobuy.ufo.model.order.vo.GoodsVo; | 12 | import com.yohobuy.ufo.model.order.vo.GoodsVo; |
@@ -58,11 +59,11 @@ public class SellerDepositOrderListService { | @@ -58,11 +59,11 @@ public class SellerDepositOrderListService { | ||
58 | if (Objects.isNull(sellerDepositOrderListType)){ | 59 | if (Objects.isNull(sellerDepositOrderListType)){ |
59 | return respBuilder.build(); | 60 | return respBuilder.build(); |
60 | } | 61 | } |
61 | - | 62 | + final boolean showParentOnly = true; |
62 | int uid = req.getUid(); | 63 | int uid = req.getUid(); |
63 | OrderAttributes orderAttributes = getOrderAttributes(); | 64 | OrderAttributes orderAttributes = getOrderAttributes(); |
64 | final List<Integer> statusList = sellerDepositOrderListType.statusList(); | 65 | final List<Integer> statusList = sellerDepositOrderListType.statusList(); |
65 | - int total = appraiseOrderMapper.selectCntByOrderType(uid, orderAttributes.getCode(), statusList); | 66 | + int total = appraiseOrderMapper.selectCntByOrderType(uid, orderAttributes.getCode(), statusList, showParentOnly); |
66 | int limit = req.getLimit(); | 67 | int limit = req.getLimit(); |
67 | if (total == 0){ | 68 | if (total == 0){ |
68 | return respBuilder | 69 | return respBuilder |
@@ -74,7 +75,7 @@ public class SellerDepositOrderListService { | @@ -74,7 +75,7 @@ public class SellerDepositOrderListService { | ||
74 | 75 | ||
75 | int offset = (req.getPage() - 1) * limit; | 76 | int offset = (req.getPage() - 1) * limit; |
76 | 77 | ||
77 | - List<AppraiseOrder> orderList = appraiseOrderMapper.selectOrderListByOrderType(uid, orderAttributes.getCode(), statusList, offset, limit); | 78 | + List<AppraiseOrder> orderList = appraiseOrderMapper.selectOrderListByOrderType(uid, orderAttributes.getCode(), statusList, showParentOnly, offset, limit); |
78 | 79 | ||
79 | List<Long> orderCodes = orderList.stream().map(AppraiseOrder::getOrderCode).collect(Collectors.toList()); | 80 | List<Long> orderCodes = orderList.stream().map(AppraiseOrder::getOrderCode).collect(Collectors.toList()); |
80 | List<AppraiseOrderGoods> paogs = appraiseOrderGoodsMapper.selectByOrderCodes(orderCodes); | 81 | List<AppraiseOrderGoods> paogs = appraiseOrderGoodsMapper.selectByOrderCodes(orderCodes); |
@@ -127,6 +128,61 @@ public class SellerDepositOrderListService { | @@ -127,6 +128,61 @@ public class SellerDepositOrderListService { | ||
127 | .productList(productList) | 128 | .productList(productList) |
128 | .build(); | 129 | .build(); |
129 | } | 130 | } |
131 | + | ||
132 | + public PageResp<DepositOrderInStorePrdListResp> getDepositOrderListInStore(SellerDepositOrderPrdListReq req){ | ||
133 | + Long orderCode = req.getOrderCode(); | ||
134 | + int total = appraiseOrderMapper.selectSubOrderCnt(orderCode); | ||
135 | + int limit = req.getLimit(); | ||
136 | + PageResp.PageRespBuilder<DepositOrderInStorePrdListResp> respBuilder = PageResp.builder(); | ||
137 | + respBuilder.page(req.getPage()).pageSize(limit).total(total); | ||
138 | + if (total == 0){ | ||
139 | + return respBuilder.build(); | ||
140 | + } | ||
141 | + int offset = (req.getPage() - 1) * limit; | ||
142 | + List<AppraiseOrder> paoList = appraiseOrderMapper.selectSubOrderList(orderCode, offset, limit); | ||
143 | + List<Long> orderCodes = paoList.parallelStream().map(AppraiseOrder::getOrderCode).collect(Collectors.toList()); | ||
144 | + // | ||
145 | + List<AppraiseOrderGoods> paogList = appraiseOrderGoodsMapper.selectByOrderCodes(orderCodes); | ||
146 | + Map<Long, AppraiseOrderGoods> orderCodeAppraiseOrderGoodsMap = paogList.parallelStream() | ||
147 | + .collect(Collectors.toMap(AppraiseOrderGoods::getOrderCode,Function.identity())); | ||
148 | + // | ||
149 | + List<AppraiseOrderStorage> paosList = appraiseOrderStorageMapper.selectByOrderCodes(orderCodes); | ||
150 | + Map<Long,AppraiseOrderStorage> orderCodeAppraiseOrderStorageMap = paosList.parallelStream() | ||
151 | + .collect(Collectors.toMap(AppraiseOrderStorage::getOrderCode, Function.identity())); | ||
152 | + List<DepositOrderInStorePrdListResp> dataList = paoList.parallelStream() | ||
153 | + .map(pao->buildDepositOrderInStorePrdListResp(pao, orderCodeAppraiseOrderGoodsMap.get(pao.getOrderCode()), | ||
154 | + orderCodeAppraiseOrderStorageMap.get(pao.getOrderCode()))) | ||
155 | + .collect(Collectors.toList()); | ||
156 | + | ||
157 | + respBuilder.data(dataList); | ||
158 | + return respBuilder.build(); | ||
159 | + | ||
160 | + } | ||
161 | + | ||
162 | + DepositOrderInStorePrdListResp buildDepositOrderInStorePrdListResp(AppraiseOrder pao, | ||
163 | + AppraiseOrderGoods paog, | ||
164 | + AppraiseOrderStorage paos){ | ||
165 | + | ||
166 | + AppraiseOrderStatus appraiseOrderStatus = AppraiseOrderStatus.getByCode(pao.getStatus()); | ||
167 | + OrderAttributes oa = OrderAttributes.getOrderAttributes(pao.getAttributes()); | ||
168 | + String refundEarnestMoney = null; | ||
169 | + GoodsVo goods = GoodsVo.builder() | ||
170 | + .productName(paog.getProductName()) | ||
171 | + .imgUrl(ImageUrlAssist.getAllProductPicUrl(paog.getImageUrl(), "goodsimg", "center", "d2hpdGU=")) | ||
172 | + .sizeName(paos.getSizeName()) | ||
173 | + .build(); | ||
174 | + DepositOrderInStorePrdListResp resp = DepositOrderInStorePrdListResp.builder() | ||
175 | + .earnestMoney(BigDecimalHelper.halfUp(pao.getAmount()).toPlainString()) | ||
176 | + .refundEarnestMoney(refundEarnestMoney) | ||
177 | + .goods(goods) | ||
178 | + .orderCode(pao.getOrderCode()) | ||
179 | + .status(pao.getStatus()) | ||
180 | + .statuStr(appraiseOrderStatus.statusStr(oa)) | ||
181 | + .build(); | ||
182 | + | ||
183 | + return resp; | ||
184 | + } | ||
185 | + | ||
130 | OrderAttributes getOrderAttributes(){ | 186 | OrderAttributes getOrderAttributes(){ |
131 | return OrderAttributes.DEPOSITE; | 187 | return OrderAttributes.DEPOSITE; |
132 | } | 188 | } |
@@ -6,14 +6,14 @@ import com.yoho.error.exception.ServiceException; | @@ -6,14 +6,14 @@ import com.yoho.error.exception.ServiceException; | ||
6 | import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus; | 6 | import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus; |
7 | import com.yohobuy.ufo.model.order.common.OrderAttributes; | 7 | import com.yohobuy.ufo.model.order.common.OrderAttributes; |
8 | import com.yohobuy.ufo.model.order.common.OrderCodeType; | 8 | import com.yohobuy.ufo.model.order.common.OrderCodeType; |
9 | +import com.yohobuy.ufo.model.order.common.Payment; | ||
9 | import com.yohobuy.ufo.model.order.req.*; | 10 | import com.yohobuy.ufo.model.order.req.*; |
10 | -import com.yohobuy.ufo.model.order.resp.DepositOrderInStorePrdListResp; | ||
11 | -import com.yohobuy.ufo.model.order.resp.PageResp; | ||
12 | import com.yohobuy.ufo.model.order.resp.SellerDepositOrderComputeResp; | 11 | import com.yohobuy.ufo.model.order.resp.SellerDepositOrderComputeResp; |
13 | import com.yohobuy.ufo.model.order.resp.SellerDepositOrderSubmitResp; | 12 | import com.yohobuy.ufo.model.order.resp.SellerDepositOrderSubmitResp; |
14 | import com.yohobuy.ufo.model.order.vo.AddressInfo; | 13 | import com.yohobuy.ufo.model.order.vo.AddressInfo; |
15 | import com.yohobuy.ufo.model.order.vo.GoodsVo; | 14 | import com.yohobuy.ufo.model.order.vo.GoodsVo; |
16 | import com.yohobuy.ufo.model.order.vo.ProductVo; | 15 | import com.yohobuy.ufo.model.order.vo.ProductVo; |
16 | +import com.yohoufo.common.alarm.EventBusPublisher; | ||
17 | import com.yohoufo.common.exception.UfoServiceException; | 17 | import com.yohoufo.common.exception.UfoServiceException; |
18 | import com.yohoufo.common.utils.AddressUtil; | 18 | import com.yohoufo.common.utils.AddressUtil; |
19 | import com.yohoufo.common.utils.BigDecimalHelper; | 19 | import com.yohoufo.common.utils.BigDecimalHelper; |
@@ -25,14 +25,23 @@ import com.yohoufo.dal.order.model.*; | @@ -25,14 +25,23 @@ import com.yohoufo.dal.order.model.*; | ||
25 | import com.yohoufo.order.common.ClientType; | 25 | import com.yohoufo.order.common.ClientType; |
26 | import com.yohoufo.order.common.DelStatus; | 26 | import com.yohoufo.order.common.DelStatus; |
27 | import com.yohoufo.order.constants.MetaKey; | 27 | import com.yohoufo.order.constants.MetaKey; |
28 | +import com.yohoufo.order.event.OrderCancelEvent; | ||
29 | +import com.yohoufo.order.event.PayConfirmEvent; | ||
30 | +import com.yohoufo.order.event.SellerDepositOrderCancelAsyncEvent; | ||
31 | +import com.yohoufo.order.model.PayQueryBo; | ||
28 | import com.yohoufo.order.model.dto.PlatformFeeDto; | 32 | import com.yohoufo.order.model.dto.PlatformFeeDto; |
29 | import com.yohoufo.order.model.dto.SellerDepositOrderContext; | 33 | import com.yohoufo.order.model.dto.SellerDepositOrderContext; |
30 | import com.yohoufo.order.model.dto.SellerDepositSubOrderContext; | 34 | import com.yohoufo.order.model.dto.SellerDepositSubOrderContext; |
31 | import com.yohoufo.order.model.dto.SellerOrderComputeResult; | 35 | import com.yohoufo.order.model.dto.SellerOrderComputeResult; |
36 | +import com.yohoufo.order.mq.DelayTime; | ||
37 | +import com.yohoufo.order.mq.TopicConstants; | ||
38 | +import com.yohoufo.order.mq.producer.TradeMqSender; | ||
32 | import com.yohoufo.order.service.DepositService; | 39 | import com.yohoufo.order.service.DepositService; |
33 | import com.yohoufo.order.service.IGoodsService; | 40 | import com.yohoufo.order.service.IGoodsService; |
41 | +import com.yohoufo.order.service.IPaymentService; | ||
34 | import com.yohoufo.order.service.handler.GoodsServiceRefundHandler; | 42 | import com.yohoufo.order.service.handler.GoodsServiceRefundHandler; |
35 | import com.yohoufo.order.service.impl.*; | 43 | import com.yohoufo.order.service.impl.*; |
44 | +import com.yohoufo.order.service.pay.AbstractPayService; | ||
36 | import com.yohoufo.order.service.proxy.OrderStatusFlowService; | 45 | import com.yohoufo.order.service.proxy.OrderStatusFlowService; |
37 | import com.yohoufo.order.service.proxy.UserProxyService; | 46 | import com.yohoufo.order.service.proxy.UserProxyService; |
38 | import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; | 47 | import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; |
@@ -91,6 +100,12 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple | @@ -91,6 +100,12 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple | ||
91 | @Autowired | 100 | @Autowired |
92 | private PayRefundService payRefundService; | 101 | private PayRefundService payRefundService; |
93 | 102 | ||
103 | + @Autowired | ||
104 | + private ServiceOrderProcessor serviceOrderProcessor; | ||
105 | + | ||
106 | + @Autowired | ||
107 | + IPaymentService paymentService; | ||
108 | + | ||
94 | 109 | ||
95 | 110 | ||
96 | public SellerDepositOrderComputeResp compute(SellerDepositOrderComputeReq req){ | 111 | public SellerDepositOrderComputeResp compute(SellerDepositOrderComputeReq req){ |
@@ -168,17 +183,10 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple | @@ -168,17 +183,10 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple | ||
168 | 183 | ||
169 | 184 | ||
170 | 185 | ||
171 | - public PageResp<DepositOrderInStorePrdListResp> getDepositOrderListInStore(SellerDepositOrderPrdListReq req){ | ||
172 | - return null; | ||
173 | - } | ||
174 | - | ||
175 | - @Autowired | ||
176 | - private ServiceOrderProcessor serviceOrderProcessor; | ||
177 | - | ||
178 | public void cancel(SellerDepositOrderDetailReq req){ | 186 | public void cancel(SellerDepositOrderDetailReq req){ |
179 | //TODO | 187 | //TODO |
180 | long orderCode = req.getOrderCode(); | 188 | long orderCode = req.getOrderCode(); |
181 | - if(serviceOrderProcessor.isGoodsServiceOrder(orderCode)){ | 189 | + if(!serviceOrderProcessor.isGoodsServiceOrder(orderCode)){ |
182 | logger.warn("cancel AppraiseOrder not GoodsServiceOrder, orderCode {}", orderCode); | 190 | logger.warn("cancel AppraiseOrder not GoodsServiceOrder, orderCode {}", orderCode); |
183 | throw new UfoServiceException(400, "订单已迷路"); | 191 | throw new UfoServiceException(400, "订单已迷路"); |
184 | } | 192 | } |
@@ -219,6 +227,51 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple | @@ -219,6 +227,51 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple | ||
219 | 227 | ||
220 | } | 228 | } |
221 | 229 | ||
230 | + public int cancelByTimeout(OrderCancelEvent orderCancelEvent){ | ||
231 | + Long orderCode = orderCancelEvent.getOrderCode(); | ||
232 | + int uid = orderCancelEvent.getUid(); | ||
233 | + if(!serviceOrderProcessor.isGoodsServiceOrder(orderCode)){ | ||
234 | + logger.warn("auto cancel AppraiseOrder not GoodsServiceOrder, orderCode {}", orderCode); | ||
235 | + throw new UfoServiceException(400, "订单已迷路"); | ||
236 | + } | ||
237 | + ServiceOrderProcessor.ExistenceNode existenceNode = serviceOrderProcessor.isAppraiseOrder(orderCode); | ||
238 | + | ||
239 | + if (!existenceNode.isExisted()){ | ||
240 | + logger.warn("auto cancel AppraiseOrder not exist, orderCode {}", orderCode); | ||
241 | + throw new UfoServiceException(400, "订单已迷路"); | ||
242 | + } | ||
243 | + AppraiseOrder pao = existenceNode.getAppraiseOrder(); | ||
244 | + | ||
245 | + OrderAttributes oa = OrderAttributes.getOrderAttributes(pao.getAttributes()); | ||
246 | + if (!OrderAttributes.DEPOSITE.equals(oa)){ | ||
247 | + logger.warn("auto cancel AppraiseOrder not deposit Order, orderCode {}", orderCode); | ||
248 | + throw new UfoServiceException(400, "订单已迷路"); | ||
249 | + } | ||
250 | + AppraiseOrderStatus appraiseOrderStatus = AppraiseOrderStatus.getByCode(pao.getStatus()); | ||
251 | + int rows = 0; | ||
252 | + switch (appraiseOrderStatus){ | ||
253 | + case WAITING_PAY: | ||
254 | + Payment payment = Payment.getPayment(pao.getPayment()); | ||
255 | + AbstractPayService payService = paymentService.getPayService(payment.getCode()); | ||
256 | + PayQueryBo payQueryBo = payService.payQuery(String.valueOf(orderCode), pao.getCreateTime()); | ||
257 | + | ||
258 | + if (payQueryBo != null && payQueryBo.isPayStatus()){ | ||
259 | + logger.info("seller deposit order auto cancel failed, confirm paid. uid is {}, orderCode is {}", uid, orderCode); | ||
260 | + PayConfirmEvent event = new PayConfirmEvent(uid, orderCode, pao.getPayment()); | ||
261 | + EventBusPublisher.publishEvent(event); | ||
262 | + } | ||
263 | + // 如果近1分钟有预支付记录,则发送 自动取消延迟消息 | ||
264 | + if ( !orderCancelEvent.isFinalRetry()){ | ||
265 | + paymentService.checkPrePay(uid, orderCode); | ||
266 | + } | ||
267 | + rows = super.triggerStatusChange(orderCode, AppraiseOrderStatus.CANCEL_TIMEOUT, appraiseOrderStatus); | ||
268 | + break; | ||
269 | + default: | ||
270 | + throw new UfoServiceException(400, "订单不支持取消"); | ||
271 | + } | ||
272 | + | ||
273 | + return rows; | ||
274 | + } | ||
222 | 275 | ||
223 | 276 | ||
224 | @Override | 277 | @Override |
@@ -491,5 +544,18 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple | @@ -491,5 +544,18 @@ public class SellerDepositOrderService extends AbsGoodsServiceOrderService imple | ||
491 | return rows; | 544 | return rows; |
492 | } | 545 | } |
493 | 546 | ||
547 | + @Autowired | ||
548 | + private TradeMqSender tradeMqSender; | ||
549 | + | ||
550 | + public boolean handleOrderCancelAsyncEvent(SellerDepositOrderCancelAsyncEvent event) { | ||
551 | + logger.info("Subscribe Buyer timeout cancel delay msg, event {}", event); | ||
552 | + OrderCancelEvent orderCancelEvent = OrderCancelEvent.builder() | ||
553 | + .uid(event.getUid()) | ||
554 | + .orderCode(event.getOrderCode()) | ||
555 | + .payExpire(DelayTime.SELLER_DEPOSIT_ORDER_PAY_TIME_LIMIT) | ||
556 | + .build(); | ||
557 | + tradeMqSender.send(TopicConstants.SELLER_DEPOSIT_ORDER_AUTO_CANCEL, orderCancelEvent, DelayTime.SELLER_DEPOSIT_ORDER_PAY_TIME_LIMIT); | ||
558 | + return true; | ||
559 | + } | ||
494 | 560 | ||
495 | } | 561 | } |
@@ -19,6 +19,7 @@ import java.util.List; | @@ -19,6 +19,7 @@ import java.util.List; | ||
19 | public class SellerOrderStatsConfiguration implements StatsConfiguration { | 19 | public class SellerOrderStatsConfiguration implements StatsConfiguration { |
20 | 20 | ||
21 | public static SellerOrderStatsConfiguration emptyConfiguration = SellerOrderStatsConfiguration.builder() | 21 | public static SellerOrderStatsConfiguration emptyConfiguration = SellerOrderStatsConfiguration.builder() |
22 | + .statsCode("OrderQuantityStats") | ||
22 | .excludeUids(Lists.newArrayList()) | 23 | .excludeUids(Lists.newArrayList()) |
23 | .statsUnit(StatsUnit.MONTH) | 24 | .statsUnit(StatsUnit.MONTH) |
24 | .skupTypes(Lists.newArrayList()) | 25 | .skupTypes(Lists.newArrayList()) |
@@ -50,7 +50,7 @@ public class SellerPlatformServiceFeeSupport { | @@ -50,7 +50,7 @@ public class SellerPlatformServiceFeeSupport { | ||
50 | SellerOrderStatsConfiguration currentStatsConfig = statsConfigurationManager.getStatsConfig(currentStatsEntry); | 50 | SellerOrderStatsConfiguration currentStatsConfig = statsConfigurationManager.getStatsConfig(currentStatsEntry); |
51 | SellerOrderStatsResult statsResult = (SellerOrderStatsResult) statsConfigurationManager.getStatsProcessor(currentStatsConfig.getStatsProcessorName()).getResult(currentStatsEntry, currentStatsConfig); | 51 | SellerOrderStatsResult statsResult = (SellerOrderStatsResult) statsConfigurationManager.getStatsProcessor(currentStatsConfig.getStatsProcessorName()).getResult(currentStatsEntry, currentStatsConfig); |
52 | if (Objects.isNull(statsResult)) { | 52 | if (Objects.isNull(statsResult)) { |
53 | - statsResult = createEmptyStatsResult(uid); | 53 | + statsResult = createEmptyStatsResult(uid, currentStatsConfig.getStatsCode()); |
54 | } | 54 | } |
55 | return this.buildSellerPlatformServiceFee(uid, statsResult); | 55 | return this.buildSellerPlatformServiceFee(uid, statsResult); |
56 | } | 56 | } |
@@ -70,7 +70,7 @@ public class SellerPlatformServiceFeeSupport { | @@ -70,7 +70,7 @@ public class SellerPlatformServiceFeeSupport { | ||
70 | nextStatsEntry.setTime(nextStatsConfig.getStatsUnit().nextPeriodTimeTuple(nextStatsConfig.getStatsPeriod(), nextStatsConfig.getStatsPeriod()).getKey()); | 70 | nextStatsEntry.setTime(nextStatsConfig.getStatsUnit().nextPeriodTimeTuple(nextStatsConfig.getStatsPeriod(), nextStatsConfig.getStatsPeriod()).getKey()); |
71 | SellerOrderStatsResult statsResult = (SellerOrderStatsResult) statsConfigurationManager.getStatsProcessor(nextStatsConfig.getStatsProcessorName()).getResult(nextStatsEntry, nextStatsConfig); | 71 | SellerOrderStatsResult statsResult = (SellerOrderStatsResult) statsConfigurationManager.getStatsProcessor(nextStatsConfig.getStatsProcessorName()).getResult(nextStatsEntry, nextStatsConfig); |
72 | if (Objects.isNull(statsResult)) { | 72 | if (Objects.isNull(statsResult)) { |
73 | - statsResult = createEmptyStatsResult(uid); | 73 | + statsResult = createEmptyStatsResult(uid, nextStatsConfig.getStatsCode()); |
74 | } | 74 | } |
75 | return this.buildSellerPlatformServiceFee(uid, statsResult); | 75 | return this.buildSellerPlatformServiceFee(uid, statsResult); |
76 | } | 76 | } |
@@ -106,8 +106,9 @@ public class SellerPlatformServiceFeeSupport { | @@ -106,8 +106,9 @@ public class SellerPlatformServiceFeeSupport { | ||
106 | return new SellerPlatformServiceFee(statsResult.getQuantity(), platformServiceFeeDefinition); | 106 | return new SellerPlatformServiceFee(statsResult.getQuantity(), platformServiceFeeDefinition); |
107 | } | 107 | } |
108 | 108 | ||
109 | - private SellerOrderStatsResult createEmptyStatsResult(int uid) { | 109 | + private SellerOrderStatsResult createEmptyStatsResult(int uid, String statsCode) { |
110 | SellerOrderStatsResult statsResult = new SellerOrderStatsResult(); | 110 | SellerOrderStatsResult statsResult = new SellerOrderStatsResult(); |
111 | + statsResult.setStatsCode(statsCode); | ||
111 | statsResult.setUid(uid); | 112 | statsResult.setUid(uid); |
112 | statsResult.setQuantity(0); | 113 | statsResult.setQuantity(0); |
113 | statsResult.setEnterType(-1); | 114 | statsResult.setEnterType(-1); |
@@ -15,7 +15,7 @@ public class CodeTest { | @@ -15,7 +15,7 @@ public class CodeTest { | ||
15 | // System.out.print(result); | 15 | // System.out.print(result); |
16 | // System.out.println(" 反解结果: "+ orderCodeGenerator.expId(result)); | 16 | // System.out.println(" 反解结果: "+ orderCodeGenerator.expId(result)); |
17 | // } | 17 | // } |
18 | - Long ordercode = 19952220626966L; | 18 | + Long ordercode = 36378182115151L; |
19 | CodeMeta meta = orderCodeGenerator.expId(ordercode); | 19 | CodeMeta meta = orderCodeGenerator.expId(ordercode); |
20 | System.out.println(meta); | 20 | System.out.println(meta); |
21 | 21 |
1 | package com.yohoufo.order.service.seller; | 1 | package com.yohoufo.order.service.seller; |
2 | 2 | ||
3 | +import com.google.common.collect.Lists; | ||
4 | +import com.yohobuy.ufo.model.order.common.EntrySellerType; | ||
3 | import com.yohobuy.ufo.model.order.common.OrderStatus; | 5 | import com.yohobuy.ufo.model.order.common.OrderStatus; |
4 | import com.yohobuy.ufo.model.order.constants.SkupType; | 6 | import com.yohobuy.ufo.model.order.constants.SkupType; |
5 | import com.yohobuy.ufo.model.order.resp.SellerPlatformServiceFeeResp; | 7 | import com.yohobuy.ufo.model.order.resp.SellerPlatformServiceFeeResp; |
6 | import com.yohoufo.common.alarm.EventBusPublisher; | 8 | import com.yohoufo.common.alarm.EventBusPublisher; |
7 | import com.yohoufo.dal.order.model.BuyerOrder; | 9 | import com.yohoufo.dal.order.model.BuyerOrder; |
10 | +import com.yohoufo.dal.order.model.SellerOrderStatsResult; | ||
8 | import com.yohoufo.order.BaseWebTest; | 11 | import com.yohoufo.order.BaseWebTest; |
9 | import com.yohoufo.order.common.EnterQuitEnum; | 12 | import com.yohoufo.order.common.EnterQuitEnum; |
10 | import com.yohoufo.order.event.SellerEnterTypeChangeEvent; | 13 | import com.yohoufo.order.event.SellerEnterTypeChangeEvent; |
14 | +import com.yohoufo.order.model.bo.PlatformServiceFeeDefinition; | ||
15 | +import com.yohoufo.order.model.bo.SellerServiceFeeRuleDefinition; | ||
16 | +import com.yohoufo.order.service.cache.SellerServiceFeeRuleCacheService; | ||
11 | import com.yohoufo.order.service.listener.BuyerOrderChangeEvent; | 17 | import com.yohoufo.order.service.listener.BuyerOrderChangeEvent; |
12 | import com.yohoufo.order.service.listener.OrderChangeListenerContainer; | 18 | import com.yohoufo.order.service.listener.OrderChangeListenerContainer; |
13 | import com.yohoufo.order.service.seller.setting.SellerService; | 19 | import com.yohoufo.order.service.seller.setting.SellerService; |
20 | +import com.yohoufo.order.service.stats.StatsConfigManager; | ||
21 | +import com.yohoufo.order.service.stats.impl.EmptyStatsProcessor; | ||
22 | +import com.yohoufo.order.service.stats.impl.SellerOrderStatsConfiguration; | ||
23 | +import com.yohoufo.order.service.stats.impl.SellerOrderStatsEntry; | ||
14 | import com.yohoufo.order.service.support.SellerPlatformServiceFeeSupport; | 24 | import com.yohoufo.order.service.support.SellerPlatformServiceFeeSupport; |
15 | import org.junit.Assert; | 25 | import org.junit.Assert; |
26 | +import org.junit.Before; | ||
16 | import org.junit.Test; | 27 | import org.junit.Test; |
28 | +import org.mockito.InjectMocks; | ||
29 | +import org.mockito.Mock; | ||
30 | +import org.mockito.Mockito; | ||
31 | +import org.mockito.MockitoAnnotations; | ||
17 | import org.springframework.beans.factory.annotation.Autowired; | 32 | import org.springframework.beans.factory.annotation.Autowired; |
18 | 33 | ||
34 | +import java.io.IOException; | ||
19 | import java.math.BigDecimal; | 35 | import java.math.BigDecimal; |
36 | +import java.util.ArrayList; | ||
37 | +import java.util.List; | ||
38 | +import java.util.concurrent.TimeUnit; | ||
39 | + | ||
20 | 40 | ||
21 | public class SellerEnterTypeChangeEventTest extends BaseWebTest { | 41 | public class SellerEnterTypeChangeEventTest extends BaseWebTest { |
22 | 42 | ||
23 | @Autowired | 43 | @Autowired |
24 | private OrderChangeListenerContainer orderChangeListenerContainer; | 44 | private OrderChangeListenerContainer orderChangeListenerContainer; |
25 | 45 | ||
26 | - @Autowired | ||
27 | - private SellerService sellerService; | ||
28 | 46 | ||
29 | @Autowired | 47 | @Autowired |
48 | + @InjectMocks | ||
30 | private SellerPlatformServiceFeeSupport sellerPlatformServiceFeeSupport; | 49 | private SellerPlatformServiceFeeSupport sellerPlatformServiceFeeSupport; |
31 | 50 | ||
51 | + @Mock | ||
52 | + private SellerServiceFeeRuleCacheService sellerServiceFeeRuleCacheService; | ||
53 | + | ||
54 | + @Mock | ||
55 | + private StatsConfigManager<SellerOrderStatsEntry, SellerOrderStatsConfiguration> statsConfigurationManager; | ||
56 | + | ||
57 | + @Mock | ||
58 | + private SellerService sellerService; | ||
59 | + | ||
60 | + | ||
61 | + @Before | ||
62 | + public void setup() throws IOException { | ||
63 | + MockitoAnnotations.initMocks(this); | ||
64 | + } | ||
65 | + | ||
32 | @Test | 66 | @Test |
33 | - public void test_stats_event() { | 67 | + public void test_stats_event() throws Exception{ |
34 | BuyerOrder buyerOrder = new BuyerOrder(); | 68 | BuyerOrder buyerOrder = new BuyerOrder(); |
35 | buyerOrder.setUid(500031424); | 69 | buyerOrder.setUid(500031424); |
36 | buyerOrder.setOrderCode(9939757498185L); | 70 | buyerOrder.setOrderCode(9939757498185L); |
37 | buyerOrder.setSellerUid(500031424); | 71 | buyerOrder.setSellerUid(500031424); |
38 | orderChangeListenerContainer.fireAsyncEvent(new BuyerOrderChangeEvent(buyerOrder, BuyerOrderChangeEvent.BizCase.APPRAISE_SUCCESS, OrderStatus.DONE)); | 72 | orderChangeListenerContainer.fireAsyncEvent(new BuyerOrderChangeEvent(buyerOrder, BuyerOrderChangeEvent.BizCase.APPRAISE_SUCCESS, OrderStatus.DONE)); |
73 | + TimeUnit.SECONDS.sleep(10); | ||
39 | } | 74 | } |
40 | 75 | ||
41 | @Test | 76 | @Test |
42 | - public void test_enter_event() { | 77 | + public void test_enter_event() throws Exception{ |
43 | EventBusPublisher.publishEvent(SellerEnterTypeChangeEvent.builder().sellerUid(500031116).eventType(EnterQuitEnum.ENTER).build()); | 78 | EventBusPublisher.publishEvent(SellerEnterTypeChangeEvent.builder().sellerUid(500031116).eventType(EnterQuitEnum.ENTER).build()); |
79 | + TimeUnit.SECONDS.sleep(10); | ||
44 | } | 80 | } |
45 | 81 | ||
46 | @Test | 82 | @Test |
47 | - public void test_quit_event() { | ||
48 | - EventBusPublisher.publishEvent(SellerEnterTypeChangeEvent.builder().sellerUid(500031424).eventType(EnterQuitEnum.QUIT).build()); | 83 | + public void test_quit_event() throws Exception{ |
84 | + EventBusPublisher.publishEvent(SellerEnterTypeChangeEvent.builder().sellerUid(500031116).eventType(EnterQuitEnum.QUIT).build()); | ||
85 | + TimeUnit.SECONDS.sleep(10); | ||
49 | } | 86 | } |
50 | 87 | ||
51 | - | ||
52 | @Test | 88 | @Test |
53 | - public void platformServiceFeeDetail() { | ||
54 | - SellerPlatformServiceFeeResp sellerPlatformServiceFeeResp = sellerService.platformServiceFeeDetail(500031424); | ||
55 | - System.out.println(sellerPlatformServiceFeeResp); | ||
56 | - Assert.assertNotNull(sellerPlatformServiceFeeResp); | ||
57 | - Assert.assertEquals(sellerPlatformServiceFeeResp.getCurrentRate(), "5.0%"); | 89 | + public void getPlatformServiceFeeRate_when_superEnterType_and_first_level_rule() { |
90 | + | ||
91 | + List<SellerServiceFeeRuleDefinition> rules = new ArrayList<>(); | ||
92 | + //{"rules":[{"threshold":0,"rate":0.045},{"threshold":10,"rate":0.044},{"threshold":20,"rate":0.04},{"threshold":50,"rate":0.039},{"threshold":100,"rate":0.035},{"threshold":200,"rate":0.033}]} | ||
93 | + rules.add(SellerServiceFeeRuleDefinition.builder() | ||
94 | + .statsCode("OrderQuantityStats") | ||
95 | + .enterType(EntrySellerType.SUPER_ENTRY.getCode()) | ||
96 | + .serviceFeeDefinition(PlatformServiceFeeDefinition.convert("{\"rules\":[{\"threshold\":0,\"rate\":0.045},{\"threshold\":10,\"rate\":0.044},{\"threshold\":20,\"rate\":0.04},{\"threshold\":50,\"rate\":0.039},{\"threshold\":100,\"rate\":0.035},{\"threshold\":200,\"rate\":0.033}]}")).build()); | ||
97 | + | ||
98 | + Mockito.when(sellerServiceFeeRuleCacheService.getRuleDefinitions()).thenReturn(rules); | ||
99 | + | ||
100 | + Mockito.when(statsConfigurationManager.getStatsConfig(Mockito.any(SellerOrderStatsEntry.class))).thenReturn(SellerOrderStatsConfiguration.emptyConfiguration); | ||
101 | + Mockito.when(statsConfigurationManager.getStatsProcessor(SellerOrderStatsConfiguration.emptyConfiguration.getStatsProcessorName())).thenReturn(new EmptyStatsProcessor()); | ||
102 | + | ||
103 | + Mockito.when(sellerService.getEntrySellerType(500031424)).thenReturn(EntrySellerType.SUPER_ENTRY); | ||
104 | + | ||
105 | + BigDecimal feeRate = sellerPlatformServiceFeeSupport.getPlatformServiceFeeRate(500031424, SkupType.IN_STOCK); | ||
106 | + Assert.assertTrue(feeRate != null); | ||
107 | + Assert.assertEquals(feeRate.toPlainString(), "0.045"); | ||
58 | } | 108 | } |
59 | 109 | ||
60 | @Test | 110 | @Test |
61 | - public void getPlatformServiceFeeRate() { | 111 | + public void getPlatformServiceFeeRate_when_superEnterType_and_second_level_rule() { |
112 | + | ||
113 | + List<SellerServiceFeeRuleDefinition> rules = new ArrayList<>(); | ||
114 | + //{"rules":[{"threshold":0,"rate":0.045},{"threshold":10,"rate":0.044},{"threshold":20,"rate":0.04},{"threshold":50,"rate":0.039},{"threshold":100,"rate":0.035},{"threshold":200,"rate":0.033}]} | ||
115 | + rules.add(SellerServiceFeeRuleDefinition.builder() | ||
116 | + .statsCode("OrderQuantityStats") | ||
117 | + .enterType(EntrySellerType.SUPER_ENTRY.getCode()) | ||
118 | + .serviceFeeDefinition(PlatformServiceFeeDefinition.convert("{\"rules\":[{\"threshold\":0,\"rate\":0.045},{\"threshold\":10,\"rate\":0.044},{\"threshold\":20,\"rate\":0.04},{\"threshold\":50,\"rate\":0.039},{\"threshold\":100,\"rate\":0.035},{\"threshold\":200,\"rate\":0.033}]}")).build()); | ||
119 | + | ||
120 | + Mockito.when(sellerServiceFeeRuleCacheService.getRuleDefinitions()).thenReturn(rules); | ||
121 | + | ||
122 | + Mockito.when(statsConfigurationManager.getStatsConfig(Mockito.any(SellerOrderStatsEntry.class))).thenReturn(SellerOrderStatsConfiguration.emptyConfiguration); | ||
123 | + | ||
124 | + Mockito.when(statsConfigurationManager.getStatsProcessor(SellerOrderStatsConfiguration.emptyConfiguration.getStatsProcessorName())).thenReturn(new EmptyStatsProcessor() { | ||
125 | + @Override | ||
126 | + public SellerOrderStatsResult getResult(SellerOrderStatsEntry entry, SellerOrderStatsConfiguration configuration) { | ||
127 | + SellerOrderStatsResult statsResult = new SellerOrderStatsResult(); | ||
128 | + statsResult.setStatsCode(configuration.getStatsCode()); | ||
129 | + statsResult.setUid(entry.getSellerUid()); | ||
130 | + statsResult.setEnterType(-1); | ||
131 | + statsResult.setQuantity(11); | ||
132 | + return statsResult; | ||
133 | + } | ||
134 | + }); | ||
135 | + | ||
136 | + Mockito.when(sellerService.getEntrySellerType(500031424)).thenReturn(EntrySellerType.SUPER_ENTRY); | ||
137 | + | ||
62 | BigDecimal feeRate = sellerPlatformServiceFeeSupport.getPlatformServiceFeeRate(500031424, SkupType.IN_STOCK); | 138 | BigDecimal feeRate = sellerPlatformServiceFeeSupport.getPlatformServiceFeeRate(500031424, SkupType.IN_STOCK); |
63 | - Assert.assertEquals(feeRate.toPlainString(),"0.049"); | 139 | + |
140 | + Assert.assertTrue(feeRate != null); | ||
141 | + Assert.assertEquals(feeRate.toPlainString(), "0.044"); | ||
64 | } | 142 | } |
65 | 143 | ||
66 | @Test | 144 | @Test |
67 | public void getPlatformServiceFeeRate_withoutRules() { | 145 | public void getPlatformServiceFeeRate_withoutRules() { |
146 | + Mockito.when(sellerServiceFeeRuleCacheService.getRuleDefinitions()).thenReturn(Lists.newArrayList()); | ||
147 | + Mockito.when(statsConfigurationManager.getStatsConfig(Mockito.any(SellerOrderStatsEntry.class))).thenReturn(SellerOrderStatsConfiguration.emptyConfiguration); | ||
148 | + Mockito.when(statsConfigurationManager.getStatsProcessor(SellerOrderStatsConfiguration.emptyConfiguration.getStatsProcessorName())).thenReturn(new EmptyStatsProcessor()); | ||
149 | + Mockito.when(sellerService.getEntrySellerType(500031424)).thenReturn(EntrySellerType.SUPER_ENTRY); | ||
68 | BigDecimal feeRate = sellerPlatformServiceFeeSupport.getPlatformServiceFeeRate(500031424, SkupType.IN_STOCK); | 150 | BigDecimal feeRate = sellerPlatformServiceFeeSupport.getPlatformServiceFeeRate(500031424, SkupType.IN_STOCK); |
69 | - Assert.assertEquals(feeRate,null); | 151 | + Assert.assertTrue(feeRate == null); |
70 | } | 152 | } |
71 | } | 153 | } |
1 | package com.yohoufo.product.service; | 1 | package com.yohoufo.product.service; |
2 | 2 | ||
3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
4 | +import com.yoho.core.rest.client.hystrix.AsyncFuture; | ||
4 | import com.yoho.service.model.response.ProfileInfoRsp; | 5 | import com.yoho.service.model.response.ProfileInfoRsp; |
6 | +import com.yoho.service.model.social.response.UserInfoRspBO; | ||
7 | +import com.yoho.service.model.uic.UicResponse; | ||
5 | import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; | 8 | import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum; |
9 | +import com.yohoufo.common.exception.GatewayException; | ||
6 | import com.yohoufo.common.utils.DateUtil; | 10 | import com.yohoufo.common.utils.DateUtil; |
7 | import com.yohoufo.common.utils.MobileHelper; | 11 | import com.yohoufo.common.utils.MobileHelper; |
8 | import com.yohoufo.dal.order.BuyerOrderGoodsMapper; | 12 | import com.yohoufo.dal.order.BuyerOrderGoodsMapper; |
@@ -63,6 +67,9 @@ public class MessageFacade { | @@ -63,6 +67,9 @@ public class MessageFacade { | ||
63 | @Autowired | 67 | @Autowired |
64 | private ProductMapper productMapper; | 68 | private ProductMapper productMapper; |
65 | 69 | ||
70 | + @Autowired | ||
71 | + private ProductIdentifyService productIdentifyService; | ||
72 | + | ||
66 | /** | 73 | /** |
67 | * 申请物权转移后 | 74 | * 申请物权转移后 |
68 | */ | 75 | */ |
@@ -81,15 +88,10 @@ public class MessageFacade { | @@ -81,15 +88,10 @@ public class MessageFacade { | ||
81 | String applicantName = MobileHelper.coverMobile2(profileMap.get(Integer.parseInt(applicantUid)).getMobile()); | 88 | String applicantName = MobileHelper.coverMobile2(profileMap.get(Integer.parseInt(applicantUid)).getMobile()); |
82 | 89 | ||
83 | //商品信息 | 90 | //商品信息 |
84 | - BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode); | ||
85 | - Integer skup = buyerOrderGoods.getSkup(); | ||
86 | - //skup获取 productInfo | ||
87 | - SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); | ||
88 | - String prdName = sellerOrderGoods.getProductName(); | ||
89 | - String sizeName = sellerOrderGoods.getSizeName(); | ||
90 | - | ||
91 | - Product product = productMapper.selectByPrimaryKey(sellerOrderGoods.getProductId()); | ||
92 | - String productCode = product.getProductCode(); | 91 | + Map<String, Object> infoMap = productIdentifyService.getProductInfo(orderCode); |
92 | + String prdName = (String) infoMap.get("productName"); | ||
93 | + String sizeName = (String) infoMap.get("size"); | ||
94 | + String productCode = (String) infoMap.get("productCode"); | ||
93 | 95 | ||
94 | String params = buildParams(applicantName, prdName, sizeName,productCode); | 96 | String params = buildParams(applicantName, prdName, sizeName,productCode); |
95 | InboxReqVO req = buildInboxReqVO(Integer.parseInt(ownerUid), params, ibtOfBuyer); | 97 | InboxReqVO req = buildInboxReqVO(Integer.parseInt(ownerUid), params, ibtOfBuyer); |
@@ -144,16 +146,10 @@ public class MessageFacade { | @@ -144,16 +146,10 @@ public class MessageFacade { | ||
144 | Map<Integer, ProfileInfoRsp> profileMap = userInfoProxyService.queryIcoAndMobile(uidList); | 146 | Map<Integer, ProfileInfoRsp> profileMap = userInfoProxyService.queryIcoAndMobile(uidList); |
145 | String applicantMobile = profileMap.get(Integer.parseInt(applicantUid)).getMobile(); | 147 | String applicantMobile = profileMap.get(Integer.parseInt(applicantUid)).getMobile(); |
146 | 148 | ||
147 | - //商品信息 | ||
148 | - BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode); | ||
149 | - Integer skup = buyerOrderGoods.getSkup(); | ||
150 | - //skup获取 productInfo | ||
151 | - SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); | ||
152 | - String prdName = sellerOrderGoods.getProductName(); | ||
153 | - String sizeName = sellerOrderGoods.getSizeName(); | ||
154 | - | ||
155 | - Product product = productMapper.selectByPrimaryKey(sellerOrderGoods.getProductId()); | ||
156 | - String productCode = product.getProductCode(); | 149 | + Map<String, Object> infoMap = productIdentifyService.getProductInfo(orderCode); |
150 | + String prdName = (String) infoMap.get("productName"); | ||
151 | + String sizeName = (String) infoMap.get("size"); | ||
152 | + String productCode = (String) infoMap.get("productCode"); | ||
157 | 153 | ||
158 | String params = buildParams(prdName, sizeName,productCode); | 154 | String params = buildParams(prdName, sizeName,productCode); |
159 | InboxReqVO req = buildInboxReqVO(Integer.parseInt(applicantUid), params, ibtOfBuyer); | 155 | InboxReqVO req = buildInboxReqVO(Integer.parseInt(applicantUid), params, ibtOfBuyer); |
@@ -189,16 +185,10 @@ public class MessageFacade { | @@ -189,16 +185,10 @@ public class MessageFacade { | ||
189 | Map<Integer, ProfileInfoRsp> profileMap = userInfoProxyService.queryIcoAndMobile(uidList); | 185 | Map<Integer, ProfileInfoRsp> profileMap = userInfoProxyService.queryIcoAndMobile(uidList); |
190 | String applicantMobile = profileMap.get(Integer.parseInt(applicantUid)).getMobile(); | 186 | String applicantMobile = profileMap.get(Integer.parseInt(applicantUid)).getMobile(); |
191 | 187 | ||
192 | - //商品信息 | ||
193 | - BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode); | ||
194 | - Integer skup = buyerOrderGoods.getSkup(); | ||
195 | - //skup获取 productInfo | ||
196 | - SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); | ||
197 | - String prdName = sellerOrderGoods.getProductName(); | ||
198 | - String sizeName = sellerOrderGoods.getSizeName(); | ||
199 | - | ||
200 | - Product product = productMapper.selectByPrimaryKey(sellerOrderGoods.getProductId()); | ||
201 | - String productCode = product.getProductCode(); | 188 | + Map<String, Object> infoMap = productIdentifyService.getProductInfo(orderCode); |
189 | + String prdName = (String) infoMap.get("productName"); | ||
190 | + String sizeName = (String) infoMap.get("size"); | ||
191 | + String productCode = (String) infoMap.get("productCode"); | ||
202 | 192 | ||
203 | String params = buildParams(prdName, sizeName,productCode); | 193 | String params = buildParams(prdName, sizeName,productCode); |
204 | InboxReqVO req = buildInboxReqVO(Integer.parseInt(applicantUid), params, ibtOfBuyer); | 194 | InboxReqVO req = buildInboxReqVO(Integer.parseInt(applicantUid), params, ibtOfBuyer); |
@@ -233,17 +223,11 @@ public class MessageFacade { | @@ -233,17 +223,11 @@ public class MessageFacade { | ||
233 | List<String> uidList = Lists.newArrayList(applicantUid); | 223 | List<String> uidList = Lists.newArrayList(applicantUid); |
234 | Map<Integer, ProfileInfoRsp> profileMap = userInfoProxyService.queryIcoAndMobile(uidList); | 224 | Map<Integer, ProfileInfoRsp> profileMap = userInfoProxyService.queryIcoAndMobile(uidList); |
235 | String applicantMobile = profileMap.get(Integer.parseInt(applicantUid)).getMobile(); | 225 | String applicantMobile = profileMap.get(Integer.parseInt(applicantUid)).getMobile(); |
236 | - | ||
237 | - //商品信息 | ||
238 | - BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode); | ||
239 | - Integer skup = buyerOrderGoods.getSkup(); | ||
240 | - //skup获取 productInfo | ||
241 | - SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); | ||
242 | - String prdName = sellerOrderGoods.getProductName(); | ||
243 | - String sizeName = sellerOrderGoods.getSizeName(); | ||
244 | 226 | ||
245 | - Product product = productMapper.selectByPrimaryKey(sellerOrderGoods.getProductId()); | ||
246 | - String productCode = product.getProductCode(); | 227 | + Map<String, Object> infoMap = productIdentifyService.getProductInfo(orderCode); |
228 | + String prdName = (String) infoMap.get("productName"); | ||
229 | + String sizeName = (String) infoMap.get("size"); | ||
230 | + String productCode = (String) infoMap.get("productCode"); | ||
247 | 231 | ||
248 | String params = buildParams(prdName, sizeName,productCode); | 232 | String params = buildParams(prdName, sizeName,productCode); |
249 | InboxReqVO req = buildInboxReqVO(Integer.parseInt(applicantUid), params, ibtOfBuyer); | 233 | InboxReqVO req = buildInboxReqVO(Integer.parseInt(applicantUid), params, ibtOfBuyer); |
@@ -7,6 +7,8 @@ import com.yohoufo.dal.product.model.IdentifyRecord; | @@ -7,6 +7,8 @@ import com.yohoufo.dal.product.model.IdentifyRecord; | ||
7 | import com.yohoufo.product.response.IdentifyShareInfoResp; | 7 | import com.yohoufo.product.response.IdentifyShareInfoResp; |
8 | import com.yohoufo.product.response.ProductIdentifyResp; | 8 | import com.yohoufo.product.response.ProductIdentifyResp; |
9 | 9 | ||
10 | +import java.util.Map; | ||
11 | + | ||
10 | public interface ProductIdentifyService { | 12 | public interface ProductIdentifyService { |
11 | 13 | ||
12 | ProductIdentifyResp queryIdentifyInfo(String tagId, String nfcUid) throws GatewayException; | 14 | ProductIdentifyResp queryIdentifyInfo(String tagId, String nfcUid) throws GatewayException; |
@@ -24,4 +26,6 @@ public interface ProductIdentifyService { | @@ -24,4 +26,6 @@ public interface ProductIdentifyService { | ||
24 | ProductIdentifyResp queryIdentifyInfoForPlatform(String tagId, String nfcUid) throws GatewayException; | 26 | ProductIdentifyResp queryIdentifyInfoForPlatform(String tagId, String nfcUid) throws GatewayException; |
25 | 27 | ||
26 | void autoTransfer(Long orderCode, Integer toUid, Long buyerOrderCode); // 自动转移物权所属 | 28 | void autoTransfer(Long orderCode, Integer toUid, Long buyerOrderCode); // 自动转移物权所属 |
29 | + | ||
30 | + Map<String, Object> getProductInfo(Long orderCode); | ||
27 | } | 31 | } |
@@ -7,8 +7,15 @@ import java.util.stream.Collectors; | @@ -7,8 +7,15 @@ import java.util.stream.Collectors; | ||
7 | 7 | ||
8 | import javax.annotation.Resource; | 8 | import javax.annotation.Resource; |
9 | 9 | ||
10 | +import com.sun.org.apache.xpath.internal.operations.Bool; | ||
11 | +import com.yoho.tools.common.beans.ApiResponse; | ||
12 | +import com.yohobuy.ufo.model.order.common.OrderCodeType; | ||
13 | +import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO; | ||
14 | +import com.yohoufo.common.caller.UfoServiceCaller; | ||
10 | import com.yohoufo.common.constant.OrderConfigConstant; | 15 | import com.yohoufo.common.constant.OrderConfigConstant; |
11 | import com.yohoufo.common.utils.QiniuLiveUrlUtil; | 16 | import com.yohoufo.common.utils.QiniuLiveUrlUtil; |
17 | +import com.yohoufo.dal.order.*; | ||
18 | +import com.yohoufo.dal.order.model.*; | ||
12 | import org.apache.commons.collections.CollectionUtils; | 19 | import org.apache.commons.collections.CollectionUtils; |
13 | import org.apache.commons.collections.MapUtils; | 20 | import org.apache.commons.collections.MapUtils; |
14 | import org.apache.commons.lang3.StringUtils; | 21 | import org.apache.commons.lang3.StringUtils; |
@@ -41,18 +48,6 @@ import com.yohoufo.common.helper.ImageUrlAssist; | @@ -41,18 +48,6 @@ import com.yohoufo.common.helper.ImageUrlAssist; | ||
41 | import com.yohoufo.common.redis.NoSyncGracefulRedisTemplate; | 48 | import com.yohoufo.common.redis.NoSyncGracefulRedisTemplate; |
42 | import com.yohoufo.common.utils.DateUtil; | 49 | import com.yohoufo.common.utils.DateUtil; |
43 | import com.yohoufo.common.utils.MobileHelper; | 50 | import com.yohoufo.common.utils.MobileHelper; |
44 | -import com.yohoufo.dal.order.BuyerOrderGoodsMapper; | ||
45 | -import com.yohoufo.dal.order.BuyerOrderMapper; | ||
46 | -import com.yohoufo.dal.order.OrderOperateRecordMapper; | ||
47 | -import com.yohoufo.dal.order.OrdersPayMapper; | ||
48 | -import com.yohoufo.dal.order.QiniuLiveRecordMapper; | ||
49 | -import com.yohoufo.dal.order.SellerOrderGoodsMapper; | ||
50 | -import com.yohoufo.dal.order.model.BuyerOrder; | ||
51 | -import com.yohoufo.dal.order.model.BuyerOrderGoods; | ||
52 | -import com.yohoufo.dal.order.model.OrderOperateRecord; | ||
53 | -import com.yohoufo.dal.order.model.OrdersPay; | ||
54 | -import com.yohoufo.dal.order.model.QiniuLiveRecord; | ||
55 | -import com.yohoufo.dal.order.model.SellerOrderGoods; | ||
56 | import com.yohoufo.dal.product.IdentifyRecordsMapper; | 51 | import com.yohoufo.dal.product.IdentifyRecordsMapper; |
57 | import com.yohoufo.dal.product.IdentifyRelationMapper; | 52 | import com.yohoufo.dal.product.IdentifyRelationMapper; |
58 | import com.yohoufo.dal.product.ProductChainMapper; | 53 | import com.yohoufo.dal.product.ProductChainMapper; |
@@ -128,6 +123,13 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | @@ -128,6 +123,13 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | ||
128 | 123 | ||
129 | @Autowired | 124 | @Autowired |
130 | private UserInfoProxyService userInfoProxyService; | 125 | private UserInfoProxyService userInfoProxyService; |
126 | + | ||
127 | + @Autowired | ||
128 | + private AppraiseOrderMapper appraiseOrderMapper; | ||
129 | + @Autowired | ||
130 | + private AppraiseOrderGoodsMapper appraiseOrderGoodsMapper; | ||
131 | + @Autowired | ||
132 | + private AppraiseOrderStorageMapper appraiseOrderStorageMapper; | ||
131 | 133 | ||
132 | @Autowired | 134 | @Autowired |
133 | private ProductMapper productMapper; | 135 | private ProductMapper productMapper; |
@@ -151,6 +153,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | @@ -151,6 +153,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | ||
151 | private String syncBlockChain_url; | 153 | private String syncBlockChain_url; |
152 | 154 | ||
153 | @Autowired | 155 | @Autowired |
156 | + UfoServiceCaller ufoServiceCaller; | ||
157 | + | ||
158 | + @Autowired | ||
154 | OrderConfigConstant orderConfigConstant; | 159 | OrderConfigConstant orderConfigConstant; |
155 | 160 | ||
156 | private static final String UIC_PROFILE_URL = "/profile/getProfile"; | 161 | private static final String UIC_PROFILE_URL = "/profile/getProfile"; |
@@ -207,14 +212,13 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | @@ -207,14 +212,13 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | ||
207 | } | 212 | } |
208 | //根据鉴定记录 获取订单号 | 213 | //根据鉴定记录 获取订单号 |
209 | Long orderCode = identifyRecord.getOrderCode(); | 214 | Long orderCode = identifyRecord.getOrderCode(); |
210 | - //2)订单号 获取订单详细信息 | ||
211 | - BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode); | ||
212 | - if(buyerOrder == null){ | 215 | + Map<String, Object> infoMap = getProductInfo(orderCode); |
216 | + Integer orderStatus = (Integer) (infoMap.get("status"));//5--订单已经完成 | ||
217 | + if(orderStatus == null){ | ||
213 | throw new GatewayException(403, "订单不存在"); | 218 | throw new GatewayException(403, "订单不存在"); |
214 | } | 219 | } |
215 | - Integer buyerUid = buyerOrder.getUid();//买家 | 220 | + Integer buyerUid = (Integer) (infoMap.get("uid")); |
216 | // Integer sellerUid = buyerOrder.getSellerUid();//卖家 | 221 | // Integer sellerUid = buyerOrder.getSellerUid();//卖家 |
217 | - Integer orderStatus = buyerOrder.getStatus();//5--订单已经完成 | ||
218 | 222 | ||
219 | //去获取用户的基本信息(头像等 不要去取此接口的手机号!))--异步 | 223 | //去获取用户的基本信息(头像等 不要去取此接口的手机号!))--异步 |
220 | AsyncFuture<UserInfoRspBO> userInfoRspBOAsyncFuture = getUserBaseInfo(buyerUid); | 224 | AsyncFuture<UserInfoRspBO> userInfoRspBOAsyncFuture = getUserBaseInfo(buyerUid); |
@@ -222,15 +226,11 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | @@ -222,15 +226,11 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | ||
222 | AsyncFuture<UicResponse> uicResponseAsyncFuture = getProfileInfo(buyerUid); | 226 | AsyncFuture<UicResponse> uicResponseAsyncFuture = getProfileInfo(buyerUid); |
223 | 227 | ||
224 | //3)订单号获取 skup | 228 | //3)订单号获取 skup |
225 | - BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode); | ||
226 | - Integer skup = buyerOrderGoods.getSkup(); | ||
227 | - //3)skup获取 productInfo | ||
228 | - SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); | ||
229 | - result.setProductImageUrl(ImageUrlAssist.getAllProductPicUrl(sellerOrderGoods.getImageUrl(), "goodsimg", "center", "d2hpdGU=")); | 229 | + result.setProductImageUrl((String) infoMap.get("image")); |
230 | result.setNfcUid(identifyRecord.getNfcUid()); | 230 | result.setNfcUid(identifyRecord.getNfcUid()); |
231 | - result.setProductId(sellerOrderGoods.getProductId()); | ||
232 | - result.setProductName(sellerOrderGoods.getProductName()); | ||
233 | - result.setProductSize(sellerOrderGoods.getSizeName()); | 231 | + result.setProductId((Integer) infoMap.get("productId")); |
232 | + result.setProductName((String) infoMap.get("productName")); | ||
233 | + result.setProductSize((String) infoMap.get("size")); | ||
234 | 234 | ||
235 | //4)vedioFileUrl视频链接 | 235 | //4)vedioFileUrl视频链接 |
236 | String vedioFileUrl = getLiveVideoUrlByOrderCode(orderCode); | 236 | String vedioFileUrl = getLiveVideoUrlByOrderCode(orderCode); |
@@ -280,8 +280,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | @@ -280,8 +280,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | ||
280 | //2)订单完成 | 280 | //2)订单完成 |
281 | if(orderStatus != null && orderStatus.intValue() == 5){//订单已完成 | 281 | if(orderStatus != null && orderStatus.intValue() == 5){//订单已完成 |
282 | IdentifyTrackResp updateOrderTrack = new IdentifyTrackResp(); | 282 | IdentifyTrackResp updateOrderTrack = new IdentifyTrackResp(); |
283 | - timeStr = formatDate(buyerOrder.getUpdateTime(), "yyyy.MM.dd HH:mm:ss"); | ||
284 | - updateOrderTrack.setTime(buyerOrder.getUpdateTime()); | 283 | + Integer updateTime = (Integer) infoMap.get("updateTime"); |
284 | + timeStr = formatDate(updateTime, "yyyy.MM.dd HH:mm:ss"); | ||
285 | + updateOrderTrack.setTime(updateTime); | ||
285 | updateOrderTrack.setTimeStr(timeStr); | 286 | updateOrderTrack.setTimeStr(timeStr); |
286 | updateOrderTrack.setContent("用户" + mobileMask + "成为商品物权所有人"); | 287 | updateOrderTrack.setContent("用户" + mobileMask + "成为商品物权所有人"); |
287 | updateOrderTrack.setHeadIcon(headIcon); | 288 | updateOrderTrack.setHeadIcon(headIcon); |
@@ -344,14 +345,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | @@ -344,14 +345,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | ||
344 | 345 | ||
345 | //根据鉴定记录 获取订单号 | 346 | //根据鉴定记录 获取订单号 |
346 | Long orderCode = identifyRecord.getOrderCode(); | 347 | Long orderCode = identifyRecord.getOrderCode(); |
347 | - //2)订单号 获取订单详细信息 | ||
348 | - BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode); | ||
349 | - if(buyerOrder == null){ | ||
350 | - throw new GatewayException(403, "订单不存在"); | ||
351 | - } | ||
352 | 348 | ||
353 | //3)商品详细信息 | 349 | //3)商品详细信息 |
354 | - result = getOrderDetail(buyerOrder, identifyRecord, tagId); | 350 | + result = getOrderDetail(orderCode, identifyRecord, tagId); |
355 | 351 | ||
356 | //4)物权转移轨迹 | 352 | //4)物权转移轨迹 |
357 | List<IdentifyTrackResp> trackList = getTrackList(identifyRecord, result.getIdentifyPlat()); | 353 | List<IdentifyTrackResp> trackList = getTrackList(identifyRecord, result.getIdentifyPlat()); |
@@ -391,14 +387,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | @@ -391,14 +387,9 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | ||
391 | 387 | ||
392 | //根据鉴定记录 获取订单号 | 388 | //根据鉴定记录 获取订单号 |
393 | Long orderCode = identifyRecord.getOrderCode(); | 389 | Long orderCode = identifyRecord.getOrderCode(); |
394 | - //2)订单号 获取订单详细信息 | ||
395 | - BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode); | ||
396 | - if(buyerOrder == null){ | ||
397 | - throw new GatewayException(403, "订单不存在"); | ||
398 | - } | ||
399 | 390 | ||
400 | //3)商品详细信息 | 391 | //3)商品详细信息 |
401 | - ProductIdentifyResp result = getOrderDetail(buyerOrder, identifyRecord, tagId); | 392 | + ProductIdentifyResp result = getOrderDetail(orderCode, identifyRecord, tagId); |
402 | 393 | ||
403 | //4)物权转移轨迹 | 394 | //4)物权转移轨迹 |
404 | List<IdentifyTrackResp> trackList = getTrackList(identifyRecord, result.getIdentifyPlat()); | 395 | List<IdentifyTrackResp> trackList = getTrackList(identifyRecord, result.getIdentifyPlat()); |
@@ -441,11 +432,17 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | @@ -441,11 +432,17 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | ||
441 | 432 | ||
442 | //根据鉴定记录 获取订单号 | 433 | //根据鉴定记录 获取订单号 |
443 | Long orderCode = identifyRecord.getOrderCode(); | 434 | Long orderCode = identifyRecord.getOrderCode(); |
444 | - //获取订单详细信息 | ||
445 | - BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode); | ||
446 | - if(buyerOrder == null){ | 435 | + Object buyerOrder; |
436 | + if (isServiceOrder(orderCode)) { | ||
437 | + //获取订单详细信息 | ||
438 | + buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode); | ||
439 | + } else { | ||
440 | + buyerOrder = appraiseOrderMapper.selectByOrderCode(orderCode); | ||
441 | + } | ||
442 | + if (buyerOrder == null) { | ||
447 | throw new GatewayException(403, "订单不存在"); | 443 | throw new GatewayException(403, "订单不存在"); |
448 | } | 444 | } |
445 | + | ||
449 | //向物权所有人发短信、站内信 | 446 | //向物权所有人发短信、站内信 |
450 | messageFacade.applyToBeOwner(insertItem.getFromUid(), String.valueOf(uid), tagId, nfcUid, orderCode); | 447 | messageFacade.applyToBeOwner(insertItem.getFromUid(), String.valueOf(uid), tagId, nfcUid, orderCode); |
451 | 448 | ||
@@ -728,22 +725,24 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | @@ -728,22 +725,24 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | ||
728 | } | 725 | } |
729 | 726 | ||
730 | //获取订单详情 | 727 | //获取订单详情 |
731 | - private ProductIdentifyResp getOrderDetail(BuyerOrder buyerOrder, IdentifyRecord identifyRecord, String tagId) { | 728 | + private ProductIdentifyResp getOrderDetail(Long orderCode, IdentifyRecord identifyRecord, String tagId) throws GatewayException { |
732 | ProductIdentifyResp result = new ProductIdentifyResp(); | 729 | ProductIdentifyResp result = new ProductIdentifyResp(); |
733 | 730 | ||
734 | - //3)订单号获取 skup | ||
735 | - BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(buyerOrder.getOrderCode()); | ||
736 | - Integer skup = buyerOrderGoods.getSkup(); | ||
737 | - //3)skup获取 productInfo | ||
738 | - SellerOrderGoods sellerOrderGoods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); | ||
739 | - result.setProductImageUrl(ImageUrlAssist.getAllProductPicUrl(sellerOrderGoods.getImageUrl(), "goodsimg", "center", "d2hpdGU=")); | 731 | + Map<String, Object> infoMap = getProductInfo(orderCode); |
732 | + Integer orderStatus = (Integer) (infoMap.get("status"));//5--订单已经完成 | ||
733 | + if(orderStatus == null){ | ||
734 | + throw new GatewayException(403, "订单不存在"); | ||
735 | + } | ||
736 | + Integer buyerUid = (Integer) (infoMap.get("uid")); | ||
737 | + | ||
738 | + result.setProductImageUrl((String) infoMap.get("image")); | ||
740 | result.setNfcUid(identifyRecord.getNfcUid()); | 739 | result.setNfcUid(identifyRecord.getNfcUid()); |
741 | - result.setProductId(sellerOrderGoods.getProductId()); | ||
742 | - result.setProductName(sellerOrderGoods.getProductName()); | ||
743 | - result.setProductSize(sellerOrderGoods.getSizeName()); | 740 | + result.setProductId((Integer) infoMap.get("productId")); |
741 | + result.setProductName((String) infoMap.get("productName")); | ||
742 | + result.setProductSize((String) infoMap.get("size")); | ||
744 | 743 | ||
745 | //4)vedioFileUrl视频链接 | 744 | //4)vedioFileUrl视频链接 |
746 | - String vedioFileUrl = getLiveVideoUrlByOrderCode(buyerOrder.getOrderCode()); | 745 | + String vedioFileUrl = getLiveVideoUrlByOrderCode(orderCode); |
747 | result.setVedioFileUrl(vedioFileUrl); | 746 | result.setVedioFileUrl(vedioFileUrl); |
748 | 747 | ||
749 | //查询区块链id | 748 | //查询区块链id |
@@ -758,7 +757,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | @@ -758,7 +757,7 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | ||
758 | // result.setIdentifyTime(timeStr); | 757 | // result.setIdentifyTime(timeStr); |
759 | 758 | ||
760 | //查询鉴定师名字 | 759 | //查询鉴定师名字 |
761 | - OrderOperateRecord orderOperateRecord = orderOperateRecordMapper.selectByTypeAndOrderCode(OperateTypeEnum.OPERATE_TYPE_JUDGE_PASS.getCode(), buyerOrder.getOrderCode()); | 760 | + OrderOperateRecord orderOperateRecord = orderOperateRecordMapper.selectByTypeAndOrderCode(OperateTypeEnum.OPERATE_TYPE_JUDGE_PASS.getCode(), orderCode); |
762 | result.setIdentifyUserName(null == orderOperateRecord ? "" : orderOperateRecord.getUserName()); | 761 | result.setIdentifyUserName(null == orderOperateRecord ? "" : orderOperateRecord.getUserName()); |
763 | 762 | ||
764 | return result; | 763 | return result; |
@@ -819,6 +818,55 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | @@ -819,6 +818,55 @@ public class ProductIdentifyServiceImpl implements ProductIdentifyService{ | ||
819 | return result; | 818 | return result; |
820 | } | 819 | } |
821 | 820 | ||
821 | + public Map<String, Object> getProductInfo(Long orderCode) { | ||
822 | + Map<String, Object> resultMap = new HashMap<>(); | ||
823 | + if (isServiceOrder(orderCode)) { | ||
824 | + AppraiseOrder order = appraiseOrderMapper.selectByOrderCode(orderCode); | ||
825 | + AppraiseOrderGoods goods = appraiseOrderGoodsMapper.selectOneByOrderCode(orderCode); | ||
826 | + AppraiseOrderStorage storage = appraiseOrderStorageMapper.selectByOrderCode(orderCode); | ||
827 | + resultMap.put("image", goods == null ? "" : ImageUrlAssist.getAllProductPicUrl(goods.getImageUrl(), "goodsimg", "center", "d2hpdGU=")); | ||
828 | + resultMap.put("productId", goods == null ? "" : goods.getProductId()); | ||
829 | + resultMap.put("productName", goods == null ? "" : goods.getProductName()); | ||
830 | + resultMap.put("productCode", goods == null ? "" : goods.getProductCode()); | ||
831 | + resultMap.put("size", storage == null ? "" : storage.getSizeName()); | ||
832 | + resultMap.put("color", storage == null ? "" : storage.getColorName()); | ||
833 | + resultMap.put("uid", order == null ? "" : order.getUid()); | ||
834 | + } else { | ||
835 | + BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode); | ||
836 | + if (buyerOrder != null) { | ||
837 | + resultMap.put("status", buyerOrder.getStatus()); | ||
838 | + resultMap.put("updateTime", buyerOrder.getUpdateTime()); | ||
839 | + } | ||
840 | + //订单号获取 skup | ||
841 | + BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectOnlyByOrderCode(orderCode); | ||
842 | + Integer skup = buyerOrderGoods.getSkup(); | ||
843 | + //skup获取 productInfo | ||
844 | + SellerOrderGoods goods = sellerOrderGoodsMapper.selectByPrimaryKey(skup); | ||
845 | + resultMap.put("image", goods == null ? "" : ImageUrlAssist.getAllProductPicUrl(goods.getImageUrl(), "goodsimg", "center", "d2hpdGU=")); | ||
846 | + resultMap.put("productId", goods == null ? "" : goods.getProductId()); | ||
847 | + resultMap.put("productName", goods == null ? "" : goods.getProductName()); | ||
848 | + resultMap.put("size", goods == null ? "" : goods.getSizeName()); | ||
849 | + resultMap.put("color", goods == null ? "" : goods.getColorName()); | ||
850 | + resultMap.put("uid", buyerOrderGoods == null ? "" : buyerOrderGoods.getUid()); | ||
851 | + if (goods != null) { | ||
852 | + Product productInfo = productMapper.selectByPrimaryKey(goods.getProductId()); | ||
853 | + resultMap.put("productCode", goods == null ? "" : productInfo.getProductCode()); | ||
854 | + } | ||
855 | + if (!resultMap.containsKey("productCode")) { | ||
856 | + resultMap.put("productCode", ""); | ||
857 | + } | ||
858 | + } | ||
859 | + return resultMap; | ||
860 | + } | ||
861 | + | ||
862 | + private boolean isServiceOrder(long orderCode) { | ||
863 | + ApiResponse<Boolean> resp = ufoServiceCaller.call("ufo.order.isServiceOrder", ApiResponse.class, orderCode); | ||
864 | + if (resp != null) { | ||
865 | + return (Boolean) resp.getData(); | ||
866 | + } | ||
867 | + return false; | ||
868 | + } | ||
869 | + | ||
822 | 870 | ||
823 | /** | 871 | /** |
824 | * 获取鉴定者 所在的鉴定中心名 | 872 | * 获取鉴定者 所在的鉴定中心名 |
1 | package com.yohoufo.user.controller.certification; | 1 | package com.yohoufo.user.controller.certification; |
2 | 2 | ||
3 | +import com.yoho.core.config.ConfigReader; | ||
3 | import com.yoho.tools.common.beans.ApiResponse; | 4 | import com.yoho.tools.common.beans.ApiResponse; |
4 | import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO; | 5 | import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO; |
5 | import com.yohoufo.common.exception.GatewayException; | 6 | import com.yohoufo.common.exception.GatewayException; |
@@ -36,9 +37,16 @@ public class CertificationController { | @@ -36,9 +37,16 @@ public class CertificationController { | ||
36 | @Autowired | 37 | @Autowired |
37 | private ICertificationService certificationService; | 38 | private ICertificationService certificationService; |
38 | 39 | ||
40 | + @Autowired | ||
41 | + private ConfigReader configReader; | ||
42 | + | ||
39 | @RequestMapping(params = "method=ufo.user.alipayCertification") | 43 | @RequestMapping(params = "method=ufo.user.alipayCertification") |
40 | public ApiResponse alipayCertification(RealNameAuthorizeReqVO reqVO) throws GatewayException { | 44 | public ApiResponse alipayCertification(RealNameAuthorizeReqVO reqVO) throws GatewayException { |
41 | logger.info("CertificationController.alipayCertification: Enter alipayCertification param reqVO is {}", reqVO); | 45 | logger.info("CertificationController.alipayCertification: Enter alipayCertification param reqVO is {}", reqVO); |
46 | + //若版本低于6.9.9, 提示升级版本 | ||
47 | + if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && reqVO.getApp_version().compareTo("6.9.9") < 0){ | ||
48 | + throw new VersionNotSupportException(); | ||
49 | + } | ||
42 | //(1) 必要参数的校验 | 50 | //(1) 必要参数的校验 |
43 | if(reqVO == null || reqVO.getUid() <= 0){ | 51 | if(reqVO == null || reqVO.getUid() <= 0){ |
44 | throw new GatewayException(400, "uid不能为空!"); | 52 | throw new GatewayException(400, "uid不能为空!"); |
@@ -66,6 +74,10 @@ public class CertificationController { | @@ -66,6 +74,10 @@ public class CertificationController { | ||
66 | @RequestMapping(params = "method=ufo.user.alipayCertifyResultQuery") | 74 | @RequestMapping(params = "method=ufo.user.alipayCertifyResultQuery") |
67 | public ApiResponse alipayCertifyResultQuery(RealNameAuthorizeReqVO reqVO) throws GatewayException { | 75 | public ApiResponse alipayCertifyResultQuery(RealNameAuthorizeReqVO reqVO) throws GatewayException { |
68 | logger.info("CertificationController.alipayCertifyResultQuery: Enter. RealNameAuthorizeReqVO is {}", reqVO); | 76 | logger.info("CertificationController.alipayCertifyResultQuery: Enter. RealNameAuthorizeReqVO is {}", reqVO); |
77 | + //若版本低于6.9.9提示升级版本 | ||
78 | + if(configReader.getBoolean("ufo.user.idCertUpdateVersionSwitch",false) && reqVO.getApp_version().compareTo("6.9.9") < 0){ | ||
79 | + throw new VersionNotSupportException(); | ||
80 | + } | ||
69 | //(1) 校验请求的参数 | 81 | //(1) 校验请求的参数 |
70 | if (reqVO == null || StringUtils.isBlank(reqVO.getZhiMaBizNo())){ | 82 | if (reqVO == null || StringUtils.isBlank(reqVO.getZhiMaBizNo())){ |
71 | throw new GatewayException(400, "参数错误,zhiMaBizNo不能为空!"); | 83 | throw new GatewayException(400, "参数错误,zhiMaBizNo不能为空!"); |
@@ -39,4 +39,7 @@ ufo.order.seller.hkAccountSettlementEmailTo=xiuchun.luo@yoho.cn | @@ -39,4 +39,7 @@ ufo.order.seller.hkAccountSettlementEmailTo=xiuchun.luo@yoho.cn | ||
39 | ufo.order.seller.noticeHKSellerEmailTo=chao.chen@yoho.cn,xiuchun.luo@yoho.cn | 39 | ufo.order.seller.noticeHKSellerEmailTo=chao.chen@yoho.cn,xiuchun.luo@yoho.cn |
40 | 40 | ||
41 | #实名认证开关 | 41 | #实名认证开关 |
42 | -ufo.user.idCertSwitch=false | ||
42 | +ufo.user.idCertSwitch=false | ||
43 | + | ||
44 | +#实名认证提示版本升级开关 | ||
45 | +ufo.user.idCertUpdateVersionSwitch = true |
@@ -72,6 +72,11 @@ consumer: | @@ -72,6 +72,11 @@ consumer: | ||
72 | delay: | 72 | delay: |
73 | interval: 10 | 73 | interval: 10 |
74 | 74 | ||
75 | + - class: com.yohoufo.order.mq.consumer.SellerDepositOrderAutoCancelMsgConsumer | ||
76 | + topic: sellerDepositOrder.autoCancel | ||
77 | + delay: | ||
78 | + interval: 10 | ||
79 | + | ||
75 | #更新物流调拨信息 | 80 | #更新物流调拨信息 |
76 | - address: 192.168.102.45:5672 | 81 | - address: 192.168.102.45:5672 |
77 | username: yoho | 82 | username: yoho |
@@ -83,6 +83,11 @@ consumer: | @@ -83,6 +83,11 @@ consumer: | ||
83 | delay: | 83 | delay: |
84 | interval: 10080 | 84 | interval: 10080 |
85 | 85 | ||
86 | + - class: com.yohoufo.order.mq.consumer.SellerDepositOrderAutoCancelMsgConsumer | ||
87 | + topic: sellerDepositOrder.autoCancel | ||
88 | + delay: | ||
89 | + interval: 10 | ||
90 | + | ||
86 | - address: ${rabbit_ufo} | 91 | - address: ${rabbit_ufo} |
87 | username: ${rabbit_ufo_user} | 92 | username: ${rabbit_ufo_user} |
88 | password: ${rabbit_ufo_password} | 93 | password: ${rabbit_ufo_password} |
-
Please register or login to post a comment