Showing
14 changed files
with
343 additions
and
136 deletions
1 | package com.yohoufo.dal.order; | 1 | package com.yohoufo.dal.order; |
2 | 2 | ||
3 | import com.yohoufo.dal.order.model.AppraiseOrderGoods; | 3 | import com.yohoufo.dal.order.model.AppraiseOrderGoods; |
4 | +import org.apache.ibatis.annotations.Param; | ||
5 | + | ||
6 | +import java.util.List; | ||
4 | 7 | ||
5 | public interface AppraiseOrderGoodsMapper { | 8 | public interface AppraiseOrderGoodsMapper { |
6 | 9 | ||
@@ -8,9 +11,11 @@ public interface AppraiseOrderGoodsMapper { | @@ -8,9 +11,11 @@ public interface AppraiseOrderGoodsMapper { | ||
8 | 11 | ||
9 | int insertSelective(AppraiseOrderGoods record); | 12 | int insertSelective(AppraiseOrderGoods record); |
10 | 13 | ||
11 | - AppraiseOrderGoods selectByPrimaryKey(Integer id); | 14 | + AppraiseOrderGoods selectByOrderCode(Long orderCode); |
12 | 15 | ||
13 | int updateByPrimaryKeySelective(AppraiseOrderGoods record); | 16 | int updateByPrimaryKeySelective(AppraiseOrderGoods record); |
14 | 17 | ||
15 | int updateByPrimaryKey(AppraiseOrderGoods record); | 18 | int updateByPrimaryKey(AppraiseOrderGoods record); |
19 | + | ||
20 | + List<AppraiseOrderGoods> selectByOrderCodes(@Param("orderCodes") List<Long> orderCodes); | ||
16 | } | 21 | } |
1 | package com.yohoufo.dal.order; | 1 | package com.yohoufo.dal.order; |
2 | 2 | ||
3 | import com.yohoufo.dal.order.model.AppraiseOrder; | 3 | import com.yohoufo.dal.order.model.AppraiseOrder; |
4 | +import org.apache.ibatis.annotations.Param; | ||
5 | + | ||
6 | +import java.util.Collection; | ||
7 | +import java.util.List; | ||
4 | 8 | ||
5 | public interface AppraiseOrderMapper { | 9 | public interface AppraiseOrderMapper { |
6 | 10 | ||
@@ -8,9 +12,22 @@ public interface AppraiseOrderMapper { | @@ -8,9 +12,22 @@ public interface AppraiseOrderMapper { | ||
8 | 12 | ||
9 | int insertSelective(AppraiseOrder record); | 13 | int insertSelective(AppraiseOrder record); |
10 | 14 | ||
11 | - AppraiseOrder selectByPrimaryKey(Integer id); | ||
12 | - | ||
13 | int updateByPrimaryKeySelective(AppraiseOrder record); | 15 | int updateByPrimaryKeySelective(AppraiseOrder record); |
14 | 16 | ||
15 | int updateByPrimaryKey(AppraiseOrder record); | 17 | int updateByPrimaryKey(AppraiseOrder record); |
18 | + | ||
19 | + List<AppraiseOrder> selectSubOrderList(long parentOrderCode); | ||
20 | + | ||
21 | + AppraiseOrder selectByOrderCode(long orderCode); | ||
22 | + | ||
23 | + | ||
24 | + int selectCntByOrderType(@Param("uid") int uid, | ||
25 | + @Param("attributes") int attributes, | ||
26 | + @Param("statusList")Collection<Integer> statusList); | ||
27 | + | ||
28 | + List<AppraiseOrder> selectOrderListByOrderType(@Param("uid") int uid, | ||
29 | + @Param("attributes") int attributes, | ||
30 | + @Param("statusList")Collection<Integer> statusList, | ||
31 | + @Param("offset")int offset, | ||
32 | + @Param("limit")int limit); | ||
16 | } | 33 | } |
@@ -2,8 +2,10 @@ package com.yohoufo.dal.order; | @@ -2,8 +2,10 @@ package com.yohoufo.dal.order; | ||
2 | 2 | ||
3 | import com.yohoufo.dal.order.model.AppraiseOrderMeta; | 3 | import com.yohoufo.dal.order.model.AppraiseOrderMeta; |
4 | 4 | ||
5 | +import java.util.List; | ||
6 | + | ||
5 | public interface AppraiseOrderMetaMapper { | 7 | public interface AppraiseOrderMetaMapper { |
6 | - int deleteByPrimaryKey(Integer id); | 8 | + int insertBatch(List<AppraiseOrderMeta> list); |
7 | 9 | ||
8 | int insert(AppraiseOrderMeta record); | 10 | int insert(AppraiseOrderMeta record); |
9 | 11 | ||
@@ -11,7 +13,8 @@ public interface AppraiseOrderMetaMapper { | @@ -11,7 +13,8 @@ public interface AppraiseOrderMetaMapper { | ||
11 | 13 | ||
12 | AppraiseOrderMeta selectByPrimaryKey(Integer id); | 14 | AppraiseOrderMeta selectByPrimaryKey(Integer id); |
13 | 15 | ||
14 | - int updateByPrimaryKeySelective(AppraiseOrderMeta record); | 16 | + AppraiseOrderMeta selectByOrderCode(AppraiseOrderMeta condition); |
17 | + | ||
15 | 18 | ||
16 | - int updateByPrimaryKey(AppraiseOrderMeta record); | 19 | + AppraiseOrderMeta selectByOrderCodeStorageId(AppraiseOrderMeta condition); |
17 | } | 20 | } |
1 | package com.yohoufo.dal.order.model; | 1 | package com.yohoufo.dal.order.model; |
2 | 2 | ||
3 | +import lombok.AllArgsConstructor; | ||
4 | +import lombok.Builder; | ||
3 | import lombok.Data; | 5 | import lombok.Data; |
6 | +import lombok.NoArgsConstructor; | ||
4 | 7 | ||
5 | @Data | 8 | @Data |
9 | +@Builder | ||
10 | +@AllArgsConstructor@NoArgsConstructor | ||
6 | public class AppraiseOrderGoods { | 11 | public class AppraiseOrderGoods { |
7 | private Integer id; | 12 | private Integer id; |
8 | 13 |
@@ -14,11 +14,11 @@ | @@ -14,11 +14,11 @@ | ||
14 | <sql id="Base_Column_List"> | 14 | <sql id="Base_Column_List"> |
15 | id, order_code, product_id, product_name, product_code, image_url, depot_no, num | 15 | id, order_code, product_id, product_name, product_code, image_url, depot_no, num |
16 | </sql> | 16 | </sql> |
17 | - <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | 17 | + <select id="selectByOrderCode" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
18 | select | 18 | select |
19 | <include refid="Base_Column_List" /> | 19 | <include refid="Base_Column_List" /> |
20 | from appraise_order_goods | 20 | from appraise_order_goods |
21 | - where id = #{id,jdbcType=INTEGER} | 21 | + where order_code = #{orderCode,jdbcType=BIGINT} |
22 | </select> | 22 | </select> |
23 | 23 | ||
24 | <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrderGoods" useGeneratedKeys="true"> | 24 | <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrderGoods" useGeneratedKeys="true"> |
@@ -117,4 +117,13 @@ | @@ -117,4 +117,13 @@ | ||
117 | num = #{num,jdbcType=INTEGER} | 117 | num = #{num,jdbcType=INTEGER} |
118 | where id = #{id,jdbcType=INTEGER} | 118 | where id = #{id,jdbcType=INTEGER} |
119 | </update> | 119 | </update> |
120 | + | ||
121 | + | ||
122 | + <select id="selectByOrderCodes" resultMap="BaseResultMap"> | ||
123 | + select <include refid="Base_Column_List" /> from appraise_order_goods | ||
124 | + where order_code in | ||
125 | + <foreach collection="orderCodes" item="orderCode" open="(" close=")" separator=","> | ||
126 | + #{orderCode,jdbcType=BIGINT} | ||
127 | + </foreach> | ||
128 | + </select> | ||
120 | </mapper> | 129 | </mapper> |
@@ -22,11 +22,40 @@ | @@ -22,11 +22,40 @@ | ||
22 | id, uid, parent_order_code, order_code, client_type, payment, amount, ship_fee, status, | 22 | id, uid, parent_order_code, order_code, client_type, payment, amount, ship_fee, status, |
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 | - <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | 25 | + |
26 | + <select id="selectSubOrderList" parameterType="java.lang.Long" resultMap="BaseResultMap"> | ||
26 | select | 27 | select |
27 | <include refid="Base_Column_List" /> | 28 | <include refid="Base_Column_List" /> |
28 | from appraise_order | 29 | from appraise_order |
29 | - where id = #{id,jdbcType=INTEGER} | 30 | + where parent_order_code = #{parentOrderCode,jdbcType=INTEGER} |
31 | + </select> | ||
32 | + | ||
33 | + <select id="selectByOrderCode" parameterType="java.lang.Long" resultMap="BaseResultMap"> | ||
34 | + select | ||
35 | + <include refid="Base_Column_List" /> | ||
36 | + from appraise_order | ||
37 | + where order_code = #{orderCode,jdbcType=INTEGER} | ||
38 | + </select> | ||
39 | + | ||
40 | + <select id="selectCntByOrderType" resultType="java.lang.Integer"> | ||
41 | + select count(*) from appraise_order | ||
42 | + where uid = #{uid,jdbcType=INTEGER} and attributes = #{attributes,jdbcType=INTEGER} | ||
43 | + and status in | ||
44 | + <foreach collection="statusList" item="status" open="(" close=")" separator=","> | ||
45 | + #{status,jdbcType=TINYINT} | ||
46 | + </foreach> | ||
47 | + </select> | ||
48 | + | ||
49 | + <select id="selectOrderListByOrderType" resultType="java.lang.Integer"> | ||
50 | + select | ||
51 | + <include refid="Base_Column_List" /> | ||
52 | + from appraise_order | ||
53 | + where uid = #{uid,jdbcType=INTEGER} and attributes = #{attributes,jdbcType=INTEGER} | ||
54 | + and status in | ||
55 | + <foreach collection="statusList" item="status" open="(" close=")" separator=","> | ||
56 | + #{status,jdbcType=TINYINT} | ||
57 | + </foreach> | ||
58 | + limit #{offset},#{limit} | ||
30 | </select> | 59 | </select> |
31 | 60 | ||
32 | 61 | ||
@@ -42,6 +71,7 @@ | @@ -42,6 +71,7 @@ | ||
42 | #{updateTime,jdbcType=INTEGER}, #{isDel,jdbcType=TINYINT}, #{channelNo,jdbcType=VARCHAR}, | 71 | #{updateTime,jdbcType=INTEGER}, #{isDel,jdbcType=TINYINT}, #{channelNo,jdbcType=VARCHAR}, |
43 | #{attributes,jdbcType=INTEGER}, #{platformDeliveryStatus,jdbcType=TINYINT}) | 72 | #{attributes,jdbcType=INTEGER}, #{platformDeliveryStatus,jdbcType=TINYINT}) |
44 | </insert> | 73 | </insert> |
74 | + | ||
45 | <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrder" useGeneratedKeys="true"> | 75 | <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrder" useGeneratedKeys="true"> |
46 | insert into appraise_order | 76 | insert into appraise_order |
47 | <trim prefix="(" suffix=")" suffixOverrides=","> | 77 | <trim prefix="(" suffix=")" suffixOverrides=","> |
@@ -136,67 +166,23 @@ | @@ -136,67 +166,23 @@ | ||
136 | <update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.order.model.AppraiseOrder"> | 166 | <update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.order.model.AppraiseOrder"> |
137 | update appraise_order | 167 | update appraise_order |
138 | <set> | 168 | <set> |
139 | - <if test="uid != null"> | ||
140 | - uid = #{uid,jdbcType=INTEGER}, | ||
141 | - </if> | ||
142 | - <if test="parentOrderCode != null"> | ||
143 | - parent_order_code = #{parentOrderCode,jdbcType=BIGINT}, | ||
144 | - </if> | ||
145 | - <if test="orderCode != null"> | ||
146 | - order_code = #{orderCode,jdbcType=BIGINT}, | ||
147 | - </if> | ||
148 | - <if test="clientType != null"> | ||
149 | - client_type = #{clientType,jdbcType=TINYINT}, | ||
150 | - </if> | ||
151 | <if test="payment != null"> | 169 | <if test="payment != null"> |
152 | payment = #{payment,jdbcType=TINYINT}, | 170 | payment = #{payment,jdbcType=TINYINT}, |
153 | </if> | 171 | </if> |
154 | - <if test="amount != null"> | ||
155 | - amount = #{amount,jdbcType=DECIMAL}, | ||
156 | - </if> | ||
157 | - <if test="shipFee != null"> | ||
158 | - ship_fee = #{shipFee,jdbcType=DECIMAL}, | ||
159 | - </if> | ||
160 | <if test="status != null"> | 172 | <if test="status != null"> |
161 | status = #{status,jdbcType=TINYINT}, | 173 | status = #{status,jdbcType=TINYINT}, |
162 | </if> | 174 | </if> |
163 | - <if test="createTime != null"> | ||
164 | - create_time = #{createTime,jdbcType=INTEGER}, | ||
165 | - </if> | ||
166 | <if test="updateTime != null"> | 175 | <if test="updateTime != null"> |
167 | update_time = #{updateTime,jdbcType=INTEGER}, | 176 | update_time = #{updateTime,jdbcType=INTEGER}, |
168 | </if> | 177 | </if> |
169 | <if test="isDel != null"> | 178 | <if test="isDel != null"> |
170 | is_del = #{isDel,jdbcType=TINYINT}, | 179 | is_del = #{isDel,jdbcType=TINYINT}, |
171 | </if> | 180 | </if> |
172 | - <if test="channelNo != null"> | ||
173 | - channel_no = #{channelNo,jdbcType=VARCHAR}, | ||
174 | - </if> | ||
175 | - <if test="attributes != null"> | ||
176 | - attributes = #{attributes,jdbcType=INTEGER}, | ||
177 | - </if> | ||
178 | <if test="platformDeliveryStatus != null"> | 181 | <if test="platformDeliveryStatus != null"> |
179 | platform_delivery_status = #{platformDeliveryStatus,jdbcType=TINYINT}, | 182 | platform_delivery_status = #{platformDeliveryStatus,jdbcType=TINYINT}, |
180 | </if> | 183 | </if> |
181 | </set> | 184 | </set> |
182 | where id = #{id,jdbcType=INTEGER} | 185 | where id = #{id,jdbcType=INTEGER} |
183 | </update> | 186 | </update> |
184 | - <update id="updateByPrimaryKey" parameterType="com.yohoufo.dal.order.model.AppraiseOrder"> | ||
185 | - update appraise_order | ||
186 | - set uid = #{uid,jdbcType=INTEGER}, | ||
187 | - parent_order_code = #{parentOrderCode,jdbcType=BIGINT}, | ||
188 | - order_code = #{orderCode,jdbcType=BIGINT}, | ||
189 | - client_type = #{clientType,jdbcType=TINYINT}, | ||
190 | - payment = #{payment,jdbcType=TINYINT}, | ||
191 | - amount = #{amount,jdbcType=DECIMAL}, | ||
192 | - ship_fee = #{shipFee,jdbcType=DECIMAL}, | ||
193 | - status = #{status,jdbcType=TINYINT}, | ||
194 | - create_time = #{createTime,jdbcType=INTEGER}, | ||
195 | - update_time = #{updateTime,jdbcType=INTEGER}, | ||
196 | - is_del = #{isDel,jdbcType=TINYINT}, | ||
197 | - channel_no = #{channelNo,jdbcType=VARCHAR}, | ||
198 | - attributes = #{attributes,jdbcType=INTEGER}, | ||
199 | - platform_delivery_status = #{platformDeliveryStatus,jdbcType=TINYINT} | ||
200 | - where id = #{id,jdbcType=INTEGER} | ||
201 | - </update> | 187 | + |
202 | </mapper> | 188 | </mapper> |
@@ -26,6 +26,16 @@ | @@ -26,6 +26,16 @@ | ||
26 | values (#{uid,jdbcType=INTEGER}, #{orderCode,jdbcType=BIGINT}, #{storageId,jdbcType=INTEGER}, | 26 | values (#{uid,jdbcType=INTEGER}, #{orderCode,jdbcType=BIGINT}, #{storageId,jdbcType=INTEGER}, |
27 | #{metaKey,jdbcType=VARCHAR}, #{metaValue,jdbcType=VARCHAR}) | 27 | #{metaKey,jdbcType=VARCHAR}, #{metaValue,jdbcType=VARCHAR}) |
28 | </insert> | 28 | </insert> |
29 | + | ||
30 | + <insert id="insertBatch" parameterType="java.util.List"> | ||
31 | + insert into appraise_order_meta (uid, order_code, storage_id, meta_key, meta_value) | ||
32 | + values | ||
33 | + <foreach collection="list" item="record" separator=","> | ||
34 | + (#{record.uid,jdbcType=INTEGER}, #{record.orderCode,jdbcType=BIGINT}, #{record.storageId,jdbcType=INTEGER}, | ||
35 | + #{record.metaKey,jdbcType=VARCHAR}, #{record.metaValue,jdbcType=VARCHAR}) | ||
36 | + </foreach> | ||
37 | + </insert> | ||
38 | + | ||
29 | <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrderMeta" useGeneratedKeys="true"> | 39 | <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.AppraiseOrderMeta" useGeneratedKeys="true"> |
30 | insert into appraise_order_meta | 40 | insert into appraise_order_meta |
31 | <trim prefix="(" suffix=")" suffixOverrides=","> | 41 | <trim prefix="(" suffix=")" suffixOverrides=","> |
@@ -63,34 +73,23 @@ | @@ -63,34 +73,23 @@ | ||
63 | </if> | 73 | </if> |
64 | </trim> | 74 | </trim> |
65 | </insert> | 75 | </insert> |
66 | - <update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.order.model.AppraiseOrderMeta"> | ||
67 | - update appraise_order_meta | ||
68 | - <set> | ||
69 | - <if test="uid != null"> | ||
70 | - uid = #{uid,jdbcType=INTEGER}, | ||
71 | - </if> | ||
72 | - <if test="orderCode != null"> | ||
73 | - order_code = #{orderCode,jdbcType=BIGINT}, | ||
74 | - </if> | ||
75 | - <if test="storageId != null"> | ||
76 | - storage_id = #{storageId,jdbcType=INTEGER}, | ||
77 | - </if> | ||
78 | - <if test="metaKey != null"> | ||
79 | - meta_key = #{metaKey,jdbcType=VARCHAR}, | ||
80 | - </if> | ||
81 | - <if test="metaValue != null"> | ||
82 | - meta_value = #{metaValue,jdbcType=VARCHAR}, | ||
83 | - </if> | ||
84 | - </set> | ||
85 | - where id = #{id,jdbcType=INTEGER} | ||
86 | - </update> | ||
87 | - <update id="updateByPrimaryKey" parameterType="com.yohoufo.dal.order.model.AppraiseOrderMeta"> | ||
88 | - update appraise_order_meta | ||
89 | - set uid = #{uid,jdbcType=INTEGER}, | ||
90 | - order_code = #{orderCode,jdbcType=BIGINT}, | ||
91 | - storage_id = #{storageId,jdbcType=INTEGER}, | ||
92 | - meta_key = #{metaKey,jdbcType=VARCHAR}, | ||
93 | - meta_value = #{metaValue,jdbcType=VARCHAR} | ||
94 | - where id = #{id,jdbcType=INTEGER} | ||
95 | - </update> | 76 | + |
77 | + | ||
78 | + <select id="selectByOrderCode" parameterType="com.yohoufo.dal.order.model.AppraiseOrderMeta" resultMap="BaseResultMap"> | ||
79 | + select | ||
80 | + <include refid="Base_Column_List" /> | ||
81 | + from appraise_order_meta | ||
82 | + where order_code = #{orderCode,jdbcType=INTEGER} | ||
83 | + and meta_key = #{metaKey,jdbcType=VARCHAR} | ||
84 | + </select> | ||
85 | + | ||
86 | + <select id="selectByOrderCodeStorageId" parameterType="com.yohoufo.dal.order.model.AppraiseOrderMeta" resultMap="BaseResultMap"> | ||
87 | + select | ||
88 | + <include refid="Base_Column_List" /> | ||
89 | + from appraise_order_meta | ||
90 | + where order_code = #{orderCode,jdbcType=INTEGER} | ||
91 | + and storage_id = #{storageId,jdbcType=INTEGER} | ||
92 | + and meta_key = #{metaKey,jdbcType=VARCHAR} | ||
93 | + </select> | ||
94 | + | ||
96 | </mapper> | 95 | </mapper> |
@@ -4,10 +4,7 @@ import com.yohobuy.ufo.model.order.req.AppraiseOrderComputeReq; | @@ -4,10 +4,7 @@ import com.yohobuy.ufo.model.order.req.AppraiseOrderComputeReq; | ||
4 | import com.yohobuy.ufo.model.order.req.AppraiseOrderDetailReq; | 4 | import com.yohobuy.ufo.model.order.req.AppraiseOrderDetailReq; |
5 | import com.yohobuy.ufo.model.order.req.AppraiseOrderListReq; | 5 | import com.yohobuy.ufo.model.order.req.AppraiseOrderListReq; |
6 | import com.yohobuy.ufo.model.order.req.AppraiseOrderSubmitReq; | 6 | import com.yohobuy.ufo.model.order.req.AppraiseOrderSubmitReq; |
7 | -import com.yohobuy.ufo.model.order.resp.AppraiseOrderComputeResp; | ||
8 | -import com.yohobuy.ufo.model.order.resp.AppraiseOrderDetailResp; | ||
9 | -import com.yohobuy.ufo.model.order.resp.AppraiseOrderListResp; | ||
10 | -import com.yohobuy.ufo.model.order.resp.AppraiseOrderSubmitResp; | 7 | +import com.yohobuy.ufo.model.order.resp.*; |
11 | import com.yohoufo.common.ApiResponse; | 8 | import com.yohoufo.common.ApiResponse; |
12 | import com.yohoufo.order.service.impl.AppraiseOrderService; | 9 | import com.yohoufo.order.service.impl.AppraiseOrderService; |
13 | import org.slf4j.Logger; | 10 | import org.slf4j.Logger; |
@@ -51,9 +48,12 @@ public class AppraiseOrderController { | @@ -51,9 +48,12 @@ public class AppraiseOrderController { | ||
51 | @RequestMapping(params = "method=ufo.appraiseOrder.submit") | 48 | @RequestMapping(params = "method=ufo.appraiseOrder.submit") |
52 | public ApiResponse submit(@RequestParam(name = "uid")int uid, | 49 | public ApiResponse submit(@RequestParam(name = "uid")int uid, |
53 | @RequestParam(name = "productId")int productId, | 50 | @RequestParam(name = "productId")int productId, |
54 | - @RequestParam(name = "addressId") String addressId){ | 51 | + @RequestParam(name = "addressId") String addressId, |
52 | + @RequestParam(name = "channelNo", required = false) String channelNo, | ||
53 | + @RequestParam(name = "client_type", required = false) String clientType){ | ||
55 | AppraiseOrderSubmitReq req = AppraiseOrderSubmitReq.builder() | 54 | AppraiseOrderSubmitReq req = AppraiseOrderSubmitReq.builder() |
56 | - .uid(uid).productId(productId).addressId(addressId).build(); | 55 | + .uid(uid).productId(productId).addressId(addressId) |
56 | + .channelNo(channelNo).clientType(clientType).build(); | ||
57 | logger.info("in ufo.appraiseOrder.submit req {}", req); | 57 | logger.info("in ufo.appraiseOrder.submit req {}", req); |
58 | AppraiseOrderSubmitResp resp = appraiseOrderService.submit(req); | 58 | AppraiseOrderSubmitResp resp = appraiseOrderService.submit(req); |
59 | return new ApiResponse.ApiResponseBuilder() | 59 | return new ApiResponse.ApiResponseBuilder() |
@@ -78,7 +78,7 @@ public class AppraiseOrderController { | @@ -78,7 +78,7 @@ public class AppraiseOrderController { | ||
78 | .uid(uid).limit(limit).page(page).build(); | 78 | .uid(uid).limit(limit).page(page).build(); |
79 | 79 | ||
80 | logger.info("in ufo.appraiseOrder.list req {}", req); | 80 | logger.info("in ufo.appraiseOrder.list req {}", req); |
81 | - AppraiseOrderListResp resp = appraiseOrderService.getOrderList(req); | 81 | + PageResp<AppraiseOrderListResp> resp = appraiseOrderService.getOrderList(req); |
82 | return new ApiResponse.ApiResponseBuilder() | 82 | return new ApiResponse.ApiResponseBuilder() |
83 | .code(200) | 83 | .code(200) |
84 | .data(resp) | 84 | .data(resp) |
1 | +package com.yohoufo.order.convert; | ||
2 | + | ||
3 | +import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo; | ||
4 | +import com.yohoufo.common.helper.ImageUrlAssist; | ||
5 | +import com.yohoufo.dal.order.model.AppraiseOrderGoods; | ||
6 | + | ||
7 | +public final class AppraiseOrderGoodsConvertor { | ||
8 | + | ||
9 | + public static AppraiseOrderGoodsBo do2Bo(AppraiseOrderGoods paog){ | ||
10 | + return AppraiseOrderGoodsBo.builder() | ||
11 | + .productId(paog.getProductId()) | ||
12 | + .productName(paog.getProductName()) | ||
13 | + .productCode(paog.getProductCode()) | ||
14 | + .imageUrl(ImageUrlAssist.getAllProductPicUrl(paog.getImageUrl(), "goodsimg", "center", "d2hpdGU=")) | ||
15 | + .build(); | ||
16 | + } | ||
17 | +} |
1 | package com.yohoufo.order.service.impl; | 1 | package com.yohoufo.order.service.impl; |
2 | 2 | ||
3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
4 | +import com.yoho.core.dal.datasource.annotation.Database; | ||
4 | import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo; | 5 | import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo; |
5 | import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus; | 6 | import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus; |
6 | import com.yohobuy.ufo.model.order.vo.AddressInfo; | 7 | import com.yohobuy.ufo.model.order.vo.AddressInfo; |
8 | +import com.yohoufo.common.utils.DateUtil; | ||
7 | import com.yohoufo.dal.order.AppraiseOrderGoodsMapper; | 9 | import com.yohoufo.dal.order.AppraiseOrderGoodsMapper; |
8 | import com.yohoufo.dal.order.AppraiseOrderMapper; | 10 | import com.yohoufo.dal.order.AppraiseOrderMapper; |
9 | -import com.yohoufo.dal.order.BuyerOrderMetaMapper; | 11 | +import com.yohoufo.dal.order.AppraiseOrderMetaMapper; |
10 | import com.yohoufo.dal.order.model.AppraiseOrder; | 12 | import com.yohoufo.dal.order.model.AppraiseOrder; |
11 | import com.yohoufo.dal.order.model.AppraiseOrderGoods; | 13 | import com.yohoufo.dal.order.model.AppraiseOrderGoods; |
12 | -import com.yohoufo.dal.order.model.BuyerOrderMeta; | 14 | +import com.yohoufo.dal.order.model.AppraiseOrderMeta; |
15 | +import com.yohoufo.order.common.DelStatus; | ||
13 | import com.yohoufo.order.constants.MetaKey; | 16 | import com.yohoufo.order.constants.MetaKey; |
14 | import com.yohoufo.order.model.dto.AppraiseOrderContext; | 17 | import com.yohoufo.order.model.dto.AppraiseOrderContext; |
15 | import com.yohoufo.order.utils.LoggerUtils; | 18 | import com.yohoufo.order.utils.LoggerUtils; |
@@ -18,6 +21,8 @@ import lombok.Data; | @@ -18,6 +21,8 @@ import lombok.Data; | ||
18 | import org.slf4j.Logger; | 21 | import org.slf4j.Logger; |
19 | import org.springframework.beans.factory.annotation.Autowired; | 22 | import org.springframework.beans.factory.annotation.Autowired; |
20 | import org.springframework.stereotype.Service; | 23 | import org.springframework.stereotype.Service; |
24 | +import org.springframework.transaction.annotation.Propagation; | ||
25 | +import org.springframework.transaction.annotation.Transactional; | ||
21 | 26 | ||
22 | import java.util.ArrayList; | 27 | import java.util.ArrayList; |
23 | import java.util.List; | 28 | import java.util.List; |
@@ -35,7 +40,7 @@ public class AppraiseOrderCreateService { | @@ -35,7 +40,7 @@ public class AppraiseOrderCreateService { | ||
35 | private AppraiseOrderGoodsMapper appraiseOrderGoodsMapper; | 40 | private AppraiseOrderGoodsMapper appraiseOrderGoodsMapper; |
36 | 41 | ||
37 | @Autowired | 42 | @Autowired |
38 | - private BuyerOrderMetaMapper buyerOrderMetaMapper; | 43 | + private AppraiseOrderMetaMapper appraiseOrderMetaMapper; |
39 | 44 | ||
40 | @Builder | 45 | @Builder |
41 | @Data | 46 | @Data |
@@ -45,6 +50,8 @@ public class AppraiseOrderCreateService { | @@ -45,6 +50,8 @@ public class AppraiseOrderCreateService { | ||
45 | AppraiseOrderGoods appraiseOrderGoods; | 50 | AppraiseOrderGoods appraiseOrderGoods; |
46 | } | 51 | } |
47 | 52 | ||
53 | + @Transactional(propagation = Propagation.REQUIRES_NEW) | ||
54 | + @Database(ForceMaster=true, DataSource="ufo_order") | ||
48 | public SubmitResult create(AppraiseOrderContext ctx){ | 55 | public SubmitResult create(AppraiseOrderContext ctx){ |
49 | logger.info("in AppraiseOrderCreateService create, "); | 56 | logger.info("in AppraiseOrderCreateService create, "); |
50 | int uid = ctx.getUid(); | 57 | int uid = ctx.getUid(); |
@@ -53,10 +60,18 @@ public class AppraiseOrderCreateService { | @@ -53,10 +60,18 @@ public class AppraiseOrderCreateService { | ||
53 | uid, orderCode, ctx.getProductId()); | 60 | uid, orderCode, ctx.getProductId()); |
54 | // | 61 | // |
55 | AppraiseOrder pao = new AppraiseOrder(); | 62 | AppraiseOrder pao = new AppraiseOrder(); |
63 | + pao.setUid(ctx.getUid()); | ||
56 | pao.setOrderCode(orderCode); | 64 | pao.setOrderCode(orderCode); |
57 | pao.setAmount(ctx.getFee()); | 65 | pao.setAmount(ctx.getFee()); |
58 | - //TODO | 66 | + |
67 | + int cdt = DateUtil.getCurrentTimeSecond(); | ||
68 | + pao.setCreateTime(cdt); | ||
69 | + pao.setUpdateTime(cdt); | ||
70 | + // | ||
59 | pao.setStatus(AppraiseOrderStatus.WAITING_PAY.getCode()); | 71 | pao.setStatus(AppraiseOrderStatus.WAITING_PAY.getCode()); |
72 | + pao.setIsDel(DelStatus.NOT_DEL.getCode()); | ||
73 | + pao.setChannelNo(ctx.getChannelNo()); | ||
74 | + pao.setClientType(ctx.getClientType()); | ||
60 | appraiseOrderMapper.insertSelective(pao); | 75 | appraiseOrderMapper.insertSelective(pao); |
61 | // | 76 | // |
62 | AppraiseOrderGoodsBo aogb = ctx.getGoodsBo(); | 77 | AppraiseOrderGoodsBo aogb = ctx.getGoodsBo(); |
@@ -65,28 +80,29 @@ public class AppraiseOrderCreateService { | @@ -65,28 +80,29 @@ public class AppraiseOrderCreateService { | ||
65 | paog.setProductId(aogb.getProductId()); | 80 | paog.setProductId(aogb.getProductId()); |
66 | paog.setProductName(aogb.getProductName()); | 81 | paog.setProductName(aogb.getProductName()); |
67 | paog.setProductCode(aogb.getProductCode()); | 82 | paog.setProductCode(aogb.getProductCode()); |
83 | + paog.setNum(1); | ||
68 | appraiseOrderGoodsMapper.insertSelective(paog); | 84 | appraiseOrderGoodsMapper.insertSelective(paog); |
69 | 85 | ||
70 | //meta | 86 | //meta |
71 | AddressInfo noHiddenBackAddress = ctx.getBackAddress(), | 87 | AddressInfo noHiddenBackAddress = ctx.getBackAddress(), |
72 | hiddenBackAddress = ctx.getBackHiddenAddress(); | 88 | hiddenBackAddress = ctx.getBackHiddenAddress(); |
73 | final String key = MetaKey.BUYER_DELIVERY_ADDRESS, | 89 | final String key = MetaKey.BUYER_DELIVERY_ADDRESS, |
74 | - hiiden_key = MetaKey.BUYER_DELIVERY_HIDDEN_ADDRESS; | ||
75 | - BuyerOrderMeta noHiddenAddressMeta=new BuyerOrderMeta(); | 90 | + hidden_key = MetaKey.BUYER_DELIVERY_HIDDEN_ADDRESS; |
91 | + AppraiseOrderMeta noHiddenAddressMeta = new AppraiseOrderMeta(); | ||
76 | noHiddenAddressMeta.setUid(uid); | 92 | noHiddenAddressMeta.setUid(uid); |
77 | noHiddenAddressMeta.setOrderCode(orderCode); | 93 | noHiddenAddressMeta.setOrderCode(orderCode); |
78 | noHiddenAddressMeta.setMetaKey(key); | 94 | noHiddenAddressMeta.setMetaKey(key); |
79 | noHiddenAddressMeta.setMetaValue(JSONObject.toJSONString(noHiddenBackAddress)); | 95 | noHiddenAddressMeta.setMetaValue(JSONObject.toJSONString(noHiddenBackAddress)); |
80 | //hidden address | 96 | //hidden address |
81 | - BuyerOrderMeta hiddenAddressMeta=new BuyerOrderMeta(); | 97 | + AppraiseOrderMeta hiddenAddressMeta = new AppraiseOrderMeta(); |
82 | hiddenAddressMeta.setUid(uid); | 98 | hiddenAddressMeta.setUid(uid); |
83 | hiddenAddressMeta.setOrderCode(orderCode); | 99 | hiddenAddressMeta.setOrderCode(orderCode); |
84 | - hiddenAddressMeta.setMetaKey(hiiden_key); | 100 | + hiddenAddressMeta.setMetaKey(hidden_key); |
85 | hiddenAddressMeta.setMetaValue(JSONObject.toJSONString(hiddenBackAddress)); | 101 | hiddenAddressMeta.setMetaValue(JSONObject.toJSONString(hiddenBackAddress)); |
86 | - List<BuyerOrderMeta> boms = new ArrayList<>(2); | 102 | + List<AppraiseOrderMeta> boms = new ArrayList<>(2); |
87 | boms.add(noHiddenAddressMeta); | 103 | boms.add(noHiddenAddressMeta); |
88 | boms.add(hiddenAddressMeta); | 104 | boms.add(hiddenAddressMeta); |
89 | - buyerOrderMetaMapper.insertBatch(boms); | 105 | + appraiseOrderMetaMapper.insertBatch(boms); |
90 | 106 | ||
91 | return SubmitResult.builder().appraiseOrder(pao).appraiseOrderGoods(paog).build(); | 107 | return SubmitResult.builder().appraiseOrder(pao).appraiseOrderGoods(paog).build(); |
92 | } | 108 | } |
1 | package com.yohoufo.order.service.impl; | 1 | package com.yohoufo.order.service.impl; |
2 | 2 | ||
3 | +import com.alibaba.fastjson.JSONObject; | ||
3 | import com.yoho.error.ServiceError; | 4 | import com.yoho.error.ServiceError; |
4 | import com.yoho.error.exception.ServiceException; | 5 | import com.yoho.error.exception.ServiceException; |
5 | import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo; | 6 | import com.yohobuy.ufo.model.order.bo.AppraiseOrderGoodsBo; |
7 | +import com.yohobuy.ufo.model.order.common.AppraiseOrderStatus; | ||
6 | import com.yohobuy.ufo.model.order.common.OrderAttributes; | 8 | import com.yohobuy.ufo.model.order.common.OrderAttributes; |
7 | import com.yohobuy.ufo.model.order.common.OrderCodeType; | 9 | import com.yohobuy.ufo.model.order.common.OrderCodeType; |
8 | import com.yohobuy.ufo.model.order.req.AppraiseOrderComputeReq; | 10 | import com.yohobuy.ufo.model.order.req.AppraiseOrderComputeReq; |
9 | import com.yohobuy.ufo.model.order.req.AppraiseOrderDetailReq; | 11 | import com.yohobuy.ufo.model.order.req.AppraiseOrderDetailReq; |
10 | import com.yohobuy.ufo.model.order.req.AppraiseOrderListReq; | 12 | import com.yohobuy.ufo.model.order.req.AppraiseOrderListReq; |
11 | import com.yohobuy.ufo.model.order.req.AppraiseOrderSubmitReq; | 13 | import com.yohobuy.ufo.model.order.req.AppraiseOrderSubmitReq; |
12 | -import com.yohobuy.ufo.model.order.resp.AppraiseOrderComputeResp; | ||
13 | -import com.yohobuy.ufo.model.order.resp.AppraiseOrderDetailResp; | ||
14 | -import com.yohobuy.ufo.model.order.resp.AppraiseOrderListResp; | ||
15 | -import com.yohobuy.ufo.model.order.resp.AppraiseOrderSubmitResp; | 14 | +import com.yohobuy.ufo.model.order.resp.*; |
16 | import com.yohobuy.ufo.model.order.vo.AddressInfo; | 15 | import com.yohobuy.ufo.model.order.vo.AddressInfo; |
17 | import com.yohoufo.common.exception.UfoServiceException; | 16 | import com.yohoufo.common.exception.UfoServiceException; |
18 | import com.yohoufo.common.utils.AddressUtil; | 17 | import com.yohoufo.common.utils.AddressUtil; |
18 | +import com.yohoufo.common.utils.DateUtil; | ||
19 | import com.yohoufo.dal.order.AppraiseOrderGoodsMapper; | 19 | import com.yohoufo.dal.order.AppraiseOrderGoodsMapper; |
20 | import com.yohoufo.dal.order.AppraiseOrderMapper; | 20 | import com.yohoufo.dal.order.AppraiseOrderMapper; |
21 | +import com.yohoufo.dal.order.AppraiseOrderMetaMapper; | ||
22 | +import com.yohoufo.dal.order.model.AppraiseOrder; | ||
23 | +import com.yohoufo.dal.order.model.AppraiseOrderGoods; | ||
24 | +import com.yohoufo.dal.order.model.AppraiseOrderMeta; | ||
25 | +import com.yohoufo.dal.order.model.QiniuLiveRecord; | ||
26 | +import com.yohoufo.order.common.ClientType; | ||
27 | +import com.yohoufo.order.constants.MetaKey; | ||
28 | +import com.yohoufo.order.convert.AppraiseOrderGoodsConvertor; | ||
21 | import com.yohoufo.order.model.dto.AppraiseOrderContext; | 29 | import com.yohoufo.order.model.dto.AppraiseOrderContext; |
22 | import com.yohoufo.order.service.proxy.UserProxyService; | 30 | import com.yohoufo.order.service.proxy.UserProxyService; |
23 | import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; | 31 | import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; |
@@ -31,7 +39,10 @@ import org.springframework.stereotype.Service; | @@ -31,7 +39,10 @@ import org.springframework.stereotype.Service; | ||
31 | 39 | ||
32 | import java.util.ArrayList; | 40 | import java.util.ArrayList; |
33 | import java.util.List; | 41 | import java.util.List; |
42 | +import java.util.Map; | ||
34 | import java.util.Objects; | 43 | import java.util.Objects; |
44 | +import java.util.function.Function; | ||
45 | +import java.util.stream.Collectors; | ||
35 | 46 | ||
36 | @Service | 47 | @Service |
37 | public class AppraiseOrderService { | 48 | public class AppraiseOrderService { |
@@ -51,7 +62,13 @@ public class AppraiseOrderService { | @@ -51,7 +62,13 @@ public class AppraiseOrderService { | ||
51 | 62 | ||
52 | 63 | ||
53 | @Autowired | 64 | @Autowired |
54 | - OrderCodeGenerator orderCodeGenerator; | 65 | + private OrderCodeGenerator orderCodeGenerator; |
66 | + | ||
67 | + @Autowired | ||
68 | + private AppraiseOrderMetaMapper appraiseOrderMetaMapper; | ||
69 | + | ||
70 | + @Autowired | ||
71 | + private QiniuLiveRecordService qiniuLiveRecordService; | ||
55 | 72 | ||
56 | 73 | ||
57 | public AppraiseOrderComputeResp compute(AppraiseOrderComputeReq req){ | 74 | public AppraiseOrderComputeResp compute(AppraiseOrderComputeReq req){ |
@@ -64,24 +81,7 @@ public class AppraiseOrderService { | @@ -64,24 +81,7 @@ public class AppraiseOrderService { | ||
64 | if (productId <= 0){ | 81 | if (productId <= 0){ |
65 | throw new UfoServiceException(400, "商品ID错误"); | 82 | throw new UfoServiceException(400, "商品ID错误"); |
66 | } | 83 | } |
67 | - int orderType = req.getOrderType(); | ||
68 | - OrderAttributes orderAttributes = checkOrderType(orderType); | ||
69 | - double fee = 0D; | ||
70 | - switch (orderAttributes){ | ||
71 | - case DEPOSITE:{ | ||
72 | - fee = 15D; | ||
73 | - break; | ||
74 | - } | ||
75 | - | ||
76 | - case APPRAISE:{ | ||
77 | - fee = 31D; | ||
78 | - break; | ||
79 | - } | ||
80 | - default:{ | ||
81 | - throw new UfoServiceException(400, "orderType错误"); | ||
82 | - } | ||
83 | - } | ||
84 | - | 84 | + double fee = 15D; |
85 | return AppraiseOrderComputeResp.builder().fee(String.valueOf(fee)).build(); | 85 | return AppraiseOrderComputeResp.builder().fee(String.valueOf(fee)).build(); |
86 | } | 86 | } |
87 | 87 | ||
@@ -91,6 +91,7 @@ public class AppraiseOrderService { | @@ -91,6 +91,7 @@ public class AppraiseOrderService { | ||
91 | add(OrderAttributes.APPRAISE); | 91 | add(OrderAttributes.APPRAISE); |
92 | } | 92 | } |
93 | }; | 93 | }; |
94 | + | ||
94 | private OrderAttributes checkOrderType(int orderType){ | 95 | private OrderAttributes checkOrderType(int orderType){ |
95 | OrderAttributes oa = OrderAttributes.getOrderAttributes(orderType); | 96 | OrderAttributes oa = OrderAttributes.getOrderAttributes(orderType); |
96 | if (Objects.isNull(oa) || !legalOrderTypes.contains(oa)){ | 97 | if (Objects.isNull(oa) || !legalOrderTypes.contains(oa)){ |
@@ -110,8 +111,6 @@ public class AppraiseOrderService { | @@ -110,8 +111,6 @@ public class AppraiseOrderService { | ||
110 | 111 | ||
111 | AppraiseOrderGoodsBo aog = new AppraiseOrderGoodsBo(); | 112 | AppraiseOrderGoodsBo aog = new AppraiseOrderGoodsBo(); |
112 | //TODO dependency product service support produce data | 113 | //TODO dependency product service support produce data |
113 | - | ||
114 | - | ||
115 | AppraiseOrderContext aoc = AppraiseOrderContext.builder() | 114 | AppraiseOrderContext aoc = AppraiseOrderContext.builder() |
116 | .orderCode(orderCode) | 115 | .orderCode(orderCode) |
117 | .uid(pn.getUid()) | 116 | .uid(pn.getUid()) |
@@ -119,6 +118,8 @@ public class AppraiseOrderService { | @@ -119,6 +118,8 @@ public class AppraiseOrderService { | ||
119 | .backAddress(pn.getNoHiddenBackAddress()) | 118 | .backAddress(pn.getNoHiddenBackAddress()) |
120 | .backHiddenAddress(pn.getHiddenBackAddress()) | 119 | .backHiddenAddress(pn.getHiddenBackAddress()) |
121 | .goodsBo(aog) | 120 | .goodsBo(aog) |
121 | + .channelNo(req.getChannelNo()) | ||
122 | + .clientType(ClientType.getClientType(req.getClientType())) | ||
122 | .build(); | 123 | .build(); |
123 | 124 | ||
124 | //2 persistent key info | 125 | //2 persistent key info |
@@ -128,6 +129,8 @@ public class AppraiseOrderService { | @@ -128,6 +129,8 @@ public class AppraiseOrderService { | ||
128 | AppraiseOrderCreateService.SubmitResult submitResult = appraiseOrderCreateService.create(aoc); | 129 | AppraiseOrderCreateService.SubmitResult submitResult = appraiseOrderCreateService.create(aoc); |
129 | 130 | ||
130 | //todo notice by async | 131 | //todo notice by async |
132 | + | ||
133 | + //resp | ||
131 | AppraiseOrderSubmitResp aosr = new AppraiseOrderSubmitResp(); | 134 | AppraiseOrderSubmitResp aosr = new AppraiseOrderSubmitResp(); |
132 | aosr.setOrderCode(orderCode); | 135 | aosr.setOrderCode(orderCode); |
133 | return aosr; | 136 | return aosr; |
@@ -143,6 +146,10 @@ public class AppraiseOrderService { | @@ -143,6 +146,10 @@ public class AppraiseOrderService { | ||
143 | OrderAttributes orderAttributes; | 146 | OrderAttributes orderAttributes; |
144 | } | 147 | } |
145 | 148 | ||
149 | + OrderAttributes getOrderAttributes(){ | ||
150 | + return OrderAttributes.APPRAISE; | ||
151 | + } | ||
152 | + | ||
146 | private PreparedNode checkAndAcquire(AppraiseOrderSubmitReq req){ | 153 | private PreparedNode checkAndAcquire(AppraiseOrderSubmitReq req){ |
147 | int uid = req.getUid(); | 154 | int uid = req.getUid(); |
148 | if (uid<=0){ | 155 | if (uid<=0){ |
@@ -152,7 +159,7 @@ public class AppraiseOrderService { | @@ -152,7 +159,7 @@ public class AppraiseOrderService { | ||
152 | if (productId <= 0){ | 159 | if (productId <= 0){ |
153 | throw new UfoServiceException(400, "商品ID错误"); | 160 | throw new UfoServiceException(400, "商品ID错误"); |
154 | } | 161 | } |
155 | - OrderAttributes orderAttributes = OrderAttributes.APPRAISE; | 162 | + final OrderAttributes orderAttributes = getOrderAttributes(); |
156 | 163 | ||
157 | int addressId = AddressUtil.getDecryptStr(req.getAddressId()); | 164 | int addressId = AddressUtil.getDecryptStr(req.getAddressId()); |
158 | if (addressId < 0){ | 165 | if (addressId < 0){ |
@@ -179,23 +186,151 @@ public class AppraiseOrderService { | @@ -179,23 +186,151 @@ public class AppraiseOrderService { | ||
179 | .build(); | 186 | .build(); |
180 | } | 187 | } |
181 | 188 | ||
189 | + List<Integer> getLegalStatus(){ | ||
190 | + | ||
191 | + return new ArrayList<Integer>(){ | ||
192 | + { | ||
193 | + add(AppraiseOrderStatus.HAS_PAYED.getCode()); | ||
194 | + add(AppraiseOrderStatus.SELLER_SEND_OUT.getCode()); | ||
195 | + add(AppraiseOrderStatus.PLATFORM_RECEIVE.getCode()); | ||
196 | + add(AppraiseOrderStatus.JUDGE_PASS.getCode()); | ||
197 | + add(AppraiseOrderStatus.WAITING_RECEIVE.getCode()); | ||
198 | + add(AppraiseOrderStatus.CHECKING_FAKE.getCode()); | ||
199 | + add(AppraiseOrderStatus.SHAM_SEND_OUT.getCode()); | ||
200 | + add(AppraiseOrderStatus.PLATFORM_APPRAISE_UNSURE.getCode()); | ||
201 | + } | ||
202 | + }; | ||
203 | + } | ||
182 | 204 | ||
205 | + public PageResp<AppraiseOrderListResp> getOrderList(AppraiseOrderListReq req){ | ||
206 | + PageResp.PageRespBuilder respBuilder = PageResp.builder(); | ||
207 | + int uid = req.getUid(); | ||
208 | + OrderAttributes orderAttributes = getOrderAttributes(); | ||
209 | + final List<Integer> statusList = getLegalStatus(); | ||
210 | + int total = appraiseOrderMapper.selectCntByOrderType(uid, orderAttributes.getCode(), statusList); | ||
211 | + int limit = req.getLimit(); | ||
212 | + if (total == 0){ | ||
213 | + return respBuilder | ||
214 | + .pageSize(limit) | ||
215 | + .total(total) | ||
216 | + .page(req.getPage()) | ||
217 | + .build(); | ||
218 | + } | ||
183 | 219 | ||
184 | - public AppraiseOrderListResp getOrderList(AppraiseOrderListReq req){ | 220 | + int offset = (req.getPage() - 1) * limit; |
185 | 221 | ||
222 | + List<AppraiseOrder> orderList = appraiseOrderMapper.selectOrderListByOrderType(uid, orderAttributes.getCode(), statusList, offset, limit); | ||
186 | 223 | ||
187 | - return null; | 224 | + List<Long> orderCodes = orderList.stream().map(AppraiseOrder::getOrderCode).collect(Collectors.toList()); |
225 | + List<AppraiseOrderGoods> paogs = appraiseOrderGoodsMapper.selectByOrderCodes(orderCodes); | ||
226 | + Map<Long,AppraiseOrderGoods> orderCodeAOGMap = paogs.stream().collect(Collectors.toMap(AppraiseOrderGoods::getOrderCode, Function.identity())); | ||
227 | + List<AppraiseOrderListResp> aolrList = orderList.parallelStream() | ||
228 | + .map(pao-> buildAppraiseOrderListResp(pao, orderCodeAOGMap.get(pao.getOrderCode()))) | ||
229 | + .collect(Collectors.toList()); | ||
230 | + | ||
231 | + respBuilder.page(req.getPage()) | ||
232 | + .pageSize(limit) | ||
233 | + .total(total) | ||
234 | + .pagetotal((total % limit == 0) ? (total / limit) : (total / limit + 1)) | ||
235 | + .data(aolrList); | ||
236 | + return respBuilder.build(); | ||
188 | } | 237 | } |
189 | 238 | ||
239 | + AppraiseOrderListResp buildAppraiseOrderListResp(AppraiseOrder pao, AppraiseOrderGoods paog){ | ||
240 | + Integer uid = pao.getUid(); | ||
241 | + Long orderCode = pao.getOrderCode(); | ||
242 | + Integer status = pao.getStatus(); | ||
243 | + | ||
244 | + AppraiseOrderStatus aos = AppraiseOrderStatus.getByCode(status); | ||
245 | + | ||
246 | + | ||
247 | + | ||
248 | + AppraiseOrderListResp resp = AppraiseOrderListResp.builder() | ||
249 | + .uid(uid) | ||
250 | + .orderCode(orderCode) | ||
251 | + .goodsInfo(AppraiseOrderGoodsConvertor.do2Bo(paog)) | ||
252 | + .buttons(Objects.nonNull(aos) ? aos.listButtons() : null) | ||
253 | + .statuStr(Objects.nonNull(aos) ? aos.statusStr() : "") | ||
254 | + .status(status) | ||
255 | + .build(); | ||
256 | + return resp; | ||
257 | + } | ||
258 | + | ||
259 | + | ||
190 | 260 | ||
191 | public AppraiseOrderDetailResp getOrderDetail(AppraiseOrderDetailReq req){ | 261 | public AppraiseOrderDetailResp getOrderDetail(AppraiseOrderDetailReq req){ |
262 | + int uid = req.getUid(); | ||
263 | + long orderCode = req.getOrderCode(); | ||
192 | 264 | ||
193 | - return null; | 265 | + AppraiseOrder pao = appraiseOrderMapper.selectByOrderCode(orderCode); |
266 | + if (Objects.isNull(pao)){ | ||
267 | + logger.warn("in getOrderDetail of appraise order null ,req {}", req); | ||
268 | + return null; | ||
269 | + } | ||
270 | + Integer aoac = pao.getAttributes(); | ||
271 | + OrderAttributes oa = OrderAttributes.getOrderAttributes(aoac); | ||
272 | + if (Objects.isNull(oa) || !getOrderAttributes().equals(oa)){ | ||
273 | + logger.warn("in getOrderDetail of appraise order attr is null ,req {}", req); | ||
274 | + return null; | ||
275 | + } | ||
276 | + | ||
277 | + AppraiseOrderGoods paog = appraiseOrderGoodsMapper.selectByOrderCode(orderCode); | ||
278 | + | ||
279 | + | ||
280 | + Integer status = pao.getStatus(); | ||
281 | + AppraiseOrderStatus aos = AppraiseOrderStatus.getByCode(status); | ||
282 | + // | ||
283 | + OrderDetailInfo.StatusDetail statusDetail = OrderDetailInfo.StatusDetail | ||
284 | + .builder().status(status) | ||
285 | + .statuStr(aos.statusStr()) | ||
286 | + .detailDesc(aos.detailDesc()).build(); | ||
287 | + // | ||
288 | + String hidden_key = MetaKey.BUYER_DELIVERY_HIDDEN_ADDRESS; | ||
289 | + AppraiseOrderMeta aomc = new AppraiseOrderMeta(); | ||
290 | + aomc.setOrderCode(orderCode); | ||
291 | + aomc.setMetaKey(hidden_key); | ||
292 | + AppraiseOrderMeta paom = appraiseOrderMetaMapper.selectByOrderCode(aomc); | ||
293 | + AppraiseAddressInfo appraiseAddressInfo = null; | ||
294 | + if (Objects.nonNull(paom)){ | ||
295 | + try { | ||
296 | + appraiseAddressInfo = JSONObject.parseObject(paom.getMetaValue(), AppraiseAddressInfo.class); | ||
297 | + }catch (Exception ex){ | ||
298 | + logger.warn("in get detail of appraise order "); | ||
299 | + } | ||
300 | + } | ||
301 | + String appraiseVideoUrl = null; | ||
302 | + QiniuLiveRecord qiniuLiveRecord = qiniuLiveRecordService.getByOrderCode(orderCode); | ||
303 | + if (Objects.nonNull(qiniuLiveRecord)){ | ||
304 | + appraiseVideoUrl = qiniuLiveRecord.getVideoUrl(); | ||
305 | + } | ||
306 | + AppraiseOrderDetailResp aodResp = AppraiseOrderDetailResp.builder() | ||
307 | + .uid(uid).orderCode(orderCode) | ||
308 | + .statusDetail(statusDetail) | ||
309 | + .createTime(DateUtil.formatDate(pao.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS)) | ||
310 | + .goodsInfo(AppraiseOrderGoodsConvertor.do2Bo(paog)) | ||
311 | + .appraiseAddress(appraiseAddressInfo) | ||
312 | + .appraiseVideoUrl(appraiseVideoUrl) | ||
313 | + .build(); | ||
314 | + return aodResp; | ||
194 | } | 315 | } |
195 | 316 | ||
317 | + /** | ||
318 | + * 是否付费鉴定订单 | ||
319 | + * @param uid | ||
320 | + * @param orderCode | ||
321 | + * @return | ||
322 | + */ | ||
196 | public boolean isAppraiseOrder(int uid, long orderCode){ | 323 | public boolean isAppraiseOrder(int uid, long orderCode){ |
197 | - | ||
198 | - return false; | 324 | + AppraiseOrder pao = appraiseOrderMapper.selectByOrderCode(orderCode); |
325 | + Integer aoac = null; | ||
326 | + OrderAttributes oa = null; | ||
327 | + boolean flag = Objects.nonNull(pao) | ||
328 | + && Objects.nonNull(aoac=pao.getAttributes()) | ||
329 | + && Objects.nonNull(oa = OrderAttributes.getOrderAttributes(aoac)) | ||
330 | + && Objects.equals(oa, OrderAttributes.APPRAISE); | ||
331 | + logger.info("in isAppraiseOrder uid {} orderCode {} aoac {} oa {} flag {}", | ||
332 | + uid, orderCode, aoac, oa, flag); | ||
333 | + return flag; | ||
199 | } | 334 | } |
200 | 335 | ||
201 | /** | 336 | /** |
@@ -208,7 +343,7 @@ public class AppraiseOrderService { | @@ -208,7 +343,7 @@ public class AppraiseOrderService { | ||
208 | } | 343 | } |
209 | 344 | ||
210 | /** | 345 | /** |
211 | - * | 346 | + * 平台收货 |
212 | * @param orderCode | 347 | * @param orderCode |
213 | */ | 348 | */ |
214 | public void platformReceiveGoods(long orderCode){ | 349 | public void platformReceiveGoods(long orderCode){ |
@@ -216,7 +351,7 @@ public class AppraiseOrderService { | @@ -216,7 +351,7 @@ public class AppraiseOrderService { | ||
216 | } | 351 | } |
217 | 352 | ||
218 | /** | 353 | /** |
219 | - * | 354 | + * 鉴定通过 |
220 | * @param orderCode | 355 | * @param orderCode |
221 | */ | 356 | */ |
222 | public void appraisePass(long orderCode){ | 357 | public void appraisePass(long orderCode){ |
@@ -83,7 +83,7 @@ public class QiniuLiveRecordService { | @@ -83,7 +83,7 @@ public class QiniuLiveRecordService { | ||
83 | qiniuLiveRecordMapper.insert(qiniuLiveRecords); | 83 | qiniuLiveRecordMapper.insert(qiniuLiveRecords); |
84 | } | 84 | } |
85 | 85 | ||
86 | - public QiniuLiveRecord selectByOrderCodes(Long orderCode) { | 86 | + public QiniuLiveRecord getByOrderCode(Long orderCode) { |
87 | if (null == orderCode) { | 87 | if (null == orderCode) { |
88 | return null; | 88 | return null; |
89 | } | 89 | } |
-
Please register or login to post a comment