36dffeef 刘嘉

菠萝派接口-检测退款接口

1 个父辈 b4c2c689
...@@ -106,7 +106,27 @@ public interface PineappleDao { ...@@ -106,7 +106,27 @@ public interface PineappleDao {
106 */ 106 */
107 List<CourierCompany> getCourierCompanyByName(Map<String,Object> params); 107 List<CourierCompany> getCourierCompanyByName(Map<String,Object> params);
108 108
109 /**
110 * 根据订单号查询退货信息
111 * @param orderSn
112 * @return
113 */
114 List<MemberProductBack> getMemberProductBackByOrderSn(@Param("orderSn") String orderSn);
115
116 /**
117 * 根据订单号查询换货信息
118 * @param orderSn
119 * @return
120 */
121 List<MemberProductExchange> getMemberProductExchangeByOrderSn(@Param("orderSn") String orderSn);
109 122
110 123
124 /**
125 * 根据订单ID查询投诉表
126 * @param id
127 * @return
128 */
129 List<SellerComplaint> getSellerComplaintByOrderId(@Param("orderId") Integer id);
130
111 131
112 } 132 }
......
...@@ -310,4 +310,133 @@ ...@@ -310,4 +310,133 @@
310 from `courier_company` 310 from `courier_company`
311 where company_name LIKE concat('%',#{name},'%') AND seller_id =#{sellerId} 311 where company_name LIKE concat('%',#{name},'%') AND seller_id =#{sellerId}
312 </select> 312 </select>
313
314
315 <!--退货表实体-->
316 <resultMap id="memberProductBackResult" type="com.sibu.orderHelper.integral.pineapple.model.MemberProductBack">
317 <result property="id" column="id" />
318 <result property="sellerId" column="seller_id" />
319 <result property="sellerName" column="seller_name" />
320 <result property="orderId" column="order_id" />
321 <result property="orderSn" column="order_sn" />
322 <result property="orderProductId" column="order_product_id" />
323 <result property="productId" column="product_id" />
324 <result property="productName" column="product_name" />
325 <result property="memberId" column="member_id" />
326 <result property="memberName" column="member_name" />
327 <result property="provinceId" column="province_id" />
328 <result property="cityId" column="city_id" />
329 <result property="areaId" column="area_id" />
330 <result property="addressAll" column="address_all" />
331 <result property="addressInfo" column="address_info" />
332 <result property="zipCode" column="zip_code" />
333 <result property="contactPhone" column="contact_phone" />
334 <result property="contactName" column="contact_name" />
335 <result property="logisticsId" column="logistics_id" />
336 <result property="logisticsName" column="logistics_name" />
337 <result property="logisticsMark" column="logistics_mark" />
338 <result property="logisticsNumber" column="logistics_number" />
339 <result property="question" column="question" />
340 <result property="image" column="image" />
341 <result property="stateReturn" column="state_return" />
342 <result property="stateMoney" column="state_money" />
343 <result property="number" column="number" />
344 <result property="backMoney" column="back_money" />
345 <result property="backIntegral" column="back_integral" />
346 <result property="backIntegralMoney" column="back_integral_money" />
347 <result property="backCouponUserId" column="back_coupon_user_id" />
348 <result property="backMoneyTime" column="back_money_time" />
349 <result property="optId" column="opt_id" />
350 <result property="optName" column="opt_name" />
351 <result property="remark" column="remark" />
352 <result property="createTime" column="create_time" />
353 <result property="updateTime" column="update_time" />
354 </resultMap>
355
356 <!--根据订单号查询换货信息-->
357 <select id="getMemberProductBackByOrderSn" parameterType="java.lang.String" resultMap="memberProductBackResult">
358 SELECT * FROM member_product_back WHERE order_sn = #{orderSn} AND state_return IN ('1','2','3','4') ORDER BY create_time
359 </select>
360
361 <!--换货实体类-->
362 <resultMap id="memberProductExchangeResult" type="com.sibu.orderHelper.integral.pineapple.model.MemberProductExchange">
363 <result property="id" column="id" />
364 <result property="sellerId" column="seller_id" />
365 <result property="sellerName" column="seller_name" />
366 <result property="orderId" column="order_id" />
367 <result property="orderSn" column="order_sn" />
368 <result property="orderProductId" column="order_product_id" />
369 <result property="productId" column="product_id" />
370 <result property="productName" column="product_name" />
371 <result property="memberId" column="member_id" />
372 <result property="memberName" column="member_name" />
373 <result property="provinceId" column="province_id" />
374 <result property="cityId" column="city_id" />
375 <result property="areaId" column="area_id" />
376 <result property="addressAll" column="address_all" />
377 <result property="addressInfo" column="address_info" />
378 <result property="zipCode" column="zip_code" />
379 <result property="changeName" column="change_name" />
380 <result property="phone" column="phone" />
381 <result property="logisticsId" column="logistics_id" />
382 <result property="logisticsName" column="logistics_name" />
383 <result property="logisticsMark" column="logistics_mark" />
384 <result property="logisticsNumber" column="logistics_number" />
385 <result property="provinceId2" column="province_id2" />
386 <result property="cityId2" column="city_id2" />
387 <result property="areaId2" column="area_id2" />
388 <result property="addressAll2" column="address_all2" />
389 <result property="addressInfo2" column="address_info2" />
390 <result property="zipCode2" column="zip_code2" />
391 <result property="changeName2" column="change_name2" />
392 <result property="phone2" column="phone2" />
393 <result property="logisticsId2" column="logistics_id2" />
394 <result property="logisticsName2" column="logistics_name2" />
395 <result property="logisticsMark2" column="logistics_mark2" />
396 <result property="logisticsNumber2" column="logistics_number2" />
397 <result property="number" column="number" />
398 <result property="question" column="question" />
399 <result property="image" column="image" />
400 <result property="name" column="name" />
401 <result property="state" column="state" />
402 <result property="optId" column="opt_id" />
403 <result property="optName" column="opt_name" />
404 <result property="remark" column="remark" />
405 <result property="createTime" column="create_time" />
406 <result property="updateTime" column="update_time" />
407 </resultMap>
408
409 <!--根据订单号查询换货信息-->
410 <select id="getMemberProductExchangeByOrderSn" parameterType="java.lang.String" resultMap="memberProductExchangeResult">
411 SELECT * FROM member_product_exchange WHERE order_sn = #{orderSn} AND state IN ('1','2','3','4') ORDER BY create_time
412 </select>
413
414 <!-- 投诉表实体-->
415 <resultMap id="sellerComplaintResult" type="com.sibu.orderHelper.integral.pineapple.model.SellerComplaint">
416 <result property="id" column="id" />
417 <result property="userId" column="user_id" />
418 <result property="userName" column="user_name" />
419 <result property="orderId" column="order_id" />
420 <result property="orderProductId" column="order_product_id" />
421 <result property="productBackId" column="product_back_id" />
422 <result property="productExchangeId" column="product_exchange_id" />
423 <result property="content" column="content" />
424 <result property="image" column="image" />
425 <result property="complaintTime" column="complaint_time" />
426 <result property="sellerId" column="seller_id" />
427 <result property="sellerComplaintTime" column="seller_complaint_time" />
428 <result property="sellerCompContent" column="seller_comp_content" />
429 <result property="sellerCompImage" column="seller_comp_image" />
430 <result property="state" column="state" />
431 <result property="optId" column="opt_id" />
432 <result property="optContent" column="opt_content" />
433 <result property="userContent" column="user_content" />
434 <result property="createTime" column="create_time" />
435 <result property="optTime" column="opt_time" />
436 </resultMap>
437
438 <!-- 根据条件查询投诉表-->
439 <select id="getSellerComplaintById" parameterType="java.lang.Integer" resultMap="sellerComplaintResult">
440 SELECT * FROM seller_complaint WHERE order_id = #{orderId} AND state IN (1,3,4) ORDER BY create_time
441 </select>
313 </mapper> 442 </mapper>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -2,7 +2,9 @@ package com.sibu.orderHelper.enums; ...@@ -2,7 +2,9 @@ package com.sibu.orderHelper.enums;
2 2
3 3
4 import com.alibaba.druid.util.StringUtils; 4 import com.alibaba.druid.util.StringUtils;
5 import com.sibu.orderHelper.integral.pineapple.enums.MemberProductBackEnum;
5 import com.sibu.orderHelper.integral.pineapple.enums.OrderStatusEnum; 6 import com.sibu.orderHelper.integral.pineapple.enums.OrderStatusEnum;
7 import com.sibu.orderHelper.integral.pineapple.model.MemberProductBack;
6 import org.apache.commons.lang3.EnumUtils; 8 import org.apache.commons.lang3.EnumUtils;
7 9
8 import java.util.ArrayList; 10 import java.util.ArrayList;
...@@ -15,14 +17,16 @@ import java.util.List; ...@@ -15,14 +17,16 @@ import java.util.List;
15 * @description 菠萝派商城退款验证退款状态举类 17 * @description 菠萝派商城退款验证退款状态举类
16 */ 18 */
17 public enum PineappleRefundEnum { 19 public enum PineappleRefundEnum {
18 JH_01("JH_01", "买家已经申请退款等待卖家同意",Arrays.asList(OrderRefundStatusEnum.WAIT_SELLER_AUDIT.getCode())), 20 JH_01("JH_01", "买家已经申请退款等待卖家同意",Arrays.asList(MemberProductBackEnum.Pending.getCode())),
19 JH_02("JH_02", "卖家已经同意退款等待买家退货", Arrays.asList(OrderRefundStatusEnum.WAIT_CUSTOMER_REFUND_GOODS.getCode(),OrderRefundStatusEnum.AGREE_CHANGE_GOODS.getCode())), 21 JH_02("JH_02", "卖家已经同意退款等待买家退货", Arrays.asList(MemberProductBackEnum.AuditSucceess.getCode())),
20 JH_03("JH_03", "买家已经退货等待卖家确认收货",Arrays.asList(OrderRefundStatusEnum.WAIT_SELLER_RECEIVE_GOODS.getCode(),OrderRefundStatusEnum.WAIT_SELLER_AUDIT_RECEIVE_GOODS.getCode())), 22 JH_03("JH_03", "买家已经退货等待卖家确认收货",Arrays.asList(MemberProductBackEnum.MemberDeliver.getCode())),
21 JH_04("JH_04", "卖家拒绝退款",Arrays.asList(OrderRefundStatusEnum.WAIT_CUSTOMER_AUDIT.getCode(),OrderRefundStatusEnum.DISAGREE_REFUNDING_MONEY.getCode(),OrderRefundStatusEnum.DISAGREE_CHANGE_GOODS.getCode(),OrderRefundStatusEnum.DENY_CHANGE_GOODS.getCode())), 23 JH_04("JH_04", "卖家拒绝退款",Arrays.asList()),
22 JH_05("JH_05", "退款关闭",new ArrayList<>()), 24 JH_05("JH_05", "退款关闭",new ArrayList<>(MemberProductBackEnum.Inattentive.getCode())),
23 JH_06("JH_06", "退款成功",Arrays.asList(OrderRefundStatusEnum.SELLER_REFUNDING_MONEY_SUCCESS.getCode())), 25 JH_06("JH_06", "退款成功",Arrays.asList()),
24 JH_07("JH_07", "没有退款",new ArrayList<>()), 26 JH_07("JH_07", "没有退款",new ArrayList<>()),
25 JH_99("JH_99", "其他",new ArrayList<>()); 27 JH_99("JH_99", "其他",new ArrayList<>(MemberProductBackEnum.ShopDelivery.getCode()));
28
29
26 30
27 private String code; // 错误代码 31 private String code; // 错误代码
28 private String msg; // 错误消息 32 private String msg; // 错误消息
......
1 package com.sibu.orderHelper.integral.pineapple.enums;
2
3 import com.alibaba.druid.util.StringUtils;
4 import org.apache.commons.lang3.EnumUtils;
5
6 import java.util.List;
7
8 /**
9 * @author LauKa
10 * @contact a062431@vip.qq.com
11 * @date 2018/05/15
12 * @description 新系统退款表状态 1、未处理;2、审核通过;3、用户发货,4、店铺收货;5、不予处理'
13 */
14 public enum MemberProductBackEnum {
15 Pending(1, "未处理"), AuditSucceess(2, "审核通过"), MemberDeliver(3, "用户发货"),
16 ShopDelivery(4, "店铺收货"), Inattentive(5, "不予处理");
17
18 private int code; // 错误代码
19 private String msg; // 错误消息
20
21 public int getCode() {
22 return code;
23 }
24
25 public String getMsg() {
26 return msg;
27 }
28
29 MemberProductBackEnum(int code, String msg) {
30 this.code = code;
31 this.msg = msg;
32 }
33
34 public static MemberProductBackEnum valueOf(int code) { // 手写的从int到enum的转换函数
35 List<MemberProductBackEnum> enums = EnumUtils.getEnumList(MemberProductBackEnum.class);
36 MemberProductBackEnum result = enums.stream()
37 .filter(p -> p.getCode() == code)
38 .findFirst()
39 .orElse(null);
40 return result;
41 }
42
43
44 public static MemberProductBackEnum resolve(String code) {
45 List<MemberProductBackEnum> enums = EnumUtils.getEnumList(MemberProductBackEnum.class);
46 MemberProductBackEnum result = enums.stream()
47 .filter(p -> StringUtils.equalsIgnoreCase(String.valueOf(p.getCode()), code))
48 .findFirst()
49 .orElse(null);
50 return result;
51 }
52
53
54 }
1 package com.sibu.orderHelper.integral.pineapple.enums;
2
3 import com.alibaba.druid.util.StringUtils;
4 import org.apache.commons.lang3.EnumUtils;
5
6 import java.util.List;
7
8 /**
9 * @author LauKa
10 * @contact a062431@vip.qq.com
11 * @date 2018/05/15
12 * @description 新系统换货表状态 换货状态:1、未处理;2、审核通过;3、用户发回退件;4、商家收到退件;5、商家发出换件;6、原件退还;7、不处理
13 */
14 public enum MemberProductExchangeEnum {
15 Pending(1, "未处理"), AuditSucceess(2, "审核通过"), MemberDeliver(3, "用户发回退件"),
16 ShopDelivery(4, "商家收到退件"),ShopExchange(5,"商家发出换件"),ReturnOld(6,"原件退还"), Inattentive(7, "不予处理");
17
18 private int code; // 错误代码
19 private String msg; // 错误消息
20
21 public int getCode() {
22 return code;
23 }
24
25 public String getMsg() {
26 return msg;
27 }
28
29 MemberProductExchangeEnum(int code, String msg) {
30 this.code = code;
31 this.msg = msg;
32 }
33
34 public static MemberProductExchangeEnum valueOf(int code) { // 手写的从int到enum的转换函数
35 List<MemberProductExchangeEnum> enums = EnumUtils.getEnumList(MemberProductExchangeEnum.class);
36 MemberProductExchangeEnum result = enums.stream()
37 .filter(p -> p.getCode() == code)
38 .findFirst()
39 .orElse(null);
40 return result;
41 }
42
43
44 public static MemberProductExchangeEnum resolve(String code) {
45 List<MemberProductExchangeEnum> enums = EnumUtils.getEnumList(MemberProductExchangeEnum.class);
46 MemberProductExchangeEnum result = enums.stream()
47 .filter(p -> StringUtils.equalsIgnoreCase(String.valueOf(p.getCode()), code))
48 .findFirst()
49 .orElse(null);
50 return result;
51 }
52
53
54 }
1 package com.sibu.orderHelper.integral.pineapple.enums;
2
3
4 import com.alibaba.druid.util.StringUtils;
5 import org.apache.commons.lang3.EnumUtils;
6
7 import java.util.ArrayList;
8 import java.util.Arrays;
9 import java.util.List;
10
11 /**
12 * @author lauka
13 * @date 2018/03/30
14 * @description 菠萝派商城退款验证换货状态举类
15 */
16 public enum PineappleExchangeEnum {
17 JH_01("JH_01", "买家已经申请退款等待卖家同意",Arrays.asList(MemberProductExchangeEnum.Pending.getCode())),
18 JH_02("JH_02", "卖家已经同意退款等待买家退货", Arrays.asList(MemberProductExchangeEnum.AuditSucceess.getCode())),
19 JH_03("JH_03", "买家已经退货等待卖家确认收货",Arrays.asList(MemberProductExchangeEnum.MemberDeliver.getCode())),
20 JH_04("JH_04", "卖家拒绝退款",Arrays.asList()),
21 JH_05("JH_05", "退款关闭",new ArrayList<>(MemberProductExchangeEnum.Inattentive.getCode())),
22 JH_06("JH_06", "退款成功",Arrays.asList()),
23 JH_07("JH_07", "没有退款",Arrays.asList(MemberProductExchangeEnum.ReturnOld.getCode(),MemberProductExchangeEnum.ShopExchange.getCode())),
24 JH_99("JH_99", "其他",new ArrayList<>(MemberProductExchangeEnum.ShopDelivery.getCode()));
25
26
27
28 private String code; // 错误代码
29 private String msg; // 错误消息
30 List<Integer> mallOrderStatus;
31
32
33 PineappleExchangeEnum(String code, String msg, List<Integer> mallOrderStatus) {
34 this.code = code;
35 this.msg = msg;
36 this.mallOrderStatus = mallOrderStatus;
37 }
38
39 public String getCode() {
40 return code;
41 }
42
43 public void setCode(String code) {
44 this.code = code;
45 }
46
47 public String getMsg() {
48 return msg;
49 }
50
51 public void setMsg(String msg) {
52 this.msg = msg;
53 }
54
55 public static PineappleExchangeEnum resolve(String code) {
56 List<PineappleExchangeEnum> enums = EnumUtils.getEnumList(PineappleExchangeEnum.class);
57 PineappleExchangeEnum result = enums.stream()
58 .filter(p -> StringUtils.equalsIgnoreCase(p.code, code))
59 .findFirst()
60 .orElse(PineappleExchangeEnum.JH_99);
61 return result;
62 }
63
64 public static PineappleExchangeEnum resolveByPlatformRefundStatus(Integer platformOrderStatus) {
65 List<PineappleExchangeEnum> enums = EnumUtils.getEnumList(PineappleExchangeEnum.class);
66 PineappleExchangeEnum result = enums.stream()
67 .filter(p -> p.mallOrderStatus != null && p.mallOrderStatus.contains(platformOrderStatus))
68 .findFirst()
69 .orElse(PineappleExchangeEnum.JH_99);
70 return result;
71 }
72
73
74
75 }
1 package com.sibu.orderHelper.integral.pineapple.model;
2
3 import lombok.Data;
4 import lombok.ToString;
5
6 import java.io.Serializable;
7
8 @Data
9 @ToString
10 public class MemberProductBack implements Serializable{
11
12 private java.lang.Integer id;
13 private java.lang.Integer sellerId;
14 private java.lang.String sellerName;
15 private java.lang.Integer orderId;
16 private java.lang.String orderSn;
17 private java.lang.Integer orderProductId;
18 private java.lang.Integer productId;
19 private java.lang.String productName;
20 private java.lang.Integer memberId;
21 private java.lang.String memberName;
22 private java.lang.Integer provinceId;
23 private java.lang.Integer cityId;
24 private java.lang.Integer areaId;
25 private java.lang.String addressAll;
26 private java.lang.String addressInfo;
27 private java.lang.String zipCode;
28 private java.lang.String contactPhone;
29 private java.lang.String contactName;
30 private java.lang.Integer logisticsId;
31 private java.lang.String logisticsName;
32 private java.lang.String logisticsMark;
33 private java.lang.String logisticsNumber;
34 private java.lang.String question;
35 private java.lang.String image;
36 private java.lang.Integer stateReturn;
37 private java.lang.Integer stateMoney;
38 private java.lang.Integer number;
39 private java.math.BigDecimal backMoney;
40 private java.lang.Integer backIntegral;
41 private java.math.BigDecimal backIntegralMoney;
42 private java.lang.Integer backCouponUserId;
43 private java.util.Date backMoneyTime;
44 private java.lang.Integer optId;
45 private java.lang.String optName;
46 private java.lang.String remark;
47 private java.util.Date createTime;
48 private java.util.Date updateTime;
49 }
1 package com.sibu.orderHelper.integral.pineapple.model;
2
3 import lombok.Data;
4 import lombok.ToString;
5
6 import java.io.Serializable;
7
8 @Data
9 @ToString
10 public class MemberProductExchange implements Serializable {
11
12 private java.lang.Integer id;
13 private java.lang.Integer sellerId;
14 private java.lang.String sellerName;
15 private java.lang.Integer orderId;
16 private java.lang.String orderSn;
17 private java.lang.Integer orderProductId;
18 private java.lang.Integer productId;
19 private java.lang.String productName;
20 private java.lang.Integer memberId;
21 private java.lang.String memberName;
22 private java.lang.Integer provinceId;
23 private java.lang.Integer cityId;
24 private java.lang.Integer areaId;
25 private java.lang.String addressAll;
26 private java.lang.String addressInfo;
27 private java.lang.String zipCode;
28 private java.lang.String changeName;
29 private java.lang.String phone;
30 private java.lang.Integer logisticsId;
31 private java.lang.String logisticsName;
32 private java.lang.String logisticsMark;
33 private java.lang.String logisticsNumber;
34 private java.lang.Integer provinceId2;
35 private java.lang.Integer cityId2;
36 private java.lang.Integer areaId2;
37 private java.lang.String addressAll2;
38 private java.lang.String addressInfo2;
39 private java.lang.String zipCode2;
40 private java.lang.String changeName2;
41 private java.lang.String phone2;
42 private java.lang.Integer logisticsId2;
43 private java.lang.String logisticsName2;
44 private java.lang.String logisticsMark2;
45 private java.lang.String logisticsNumber2;
46 private java.lang.Integer number;
47 private java.lang.String question;
48 private java.lang.String image;
49 private java.lang.String name;
50 private java.lang.Integer state;
51 private java.lang.Integer optId;
52 private java.lang.String optName;
53 private java.lang.String remark;
54 private java.util.Date createTime;
55 private java.util.Date updateTime;
56 }
1 package com.sibu.orderHelper.integral.pineapple.model;
2
3 import lombok.Data;
4 import lombok.ToString;
5
6 import java.io.Serializable;
7
8 @Data
9 @ToString
10 public class SellerComplaint implements Serializable {
11
12 private java.lang.Integer id; //id
13 private java.lang.Integer userId; //投诉人ID
14 private java.lang.String userName; //投诉人账户
15 private java.lang.Integer orderId; //订单ID
16 private java.lang.Integer orderProductId; //网单ID
17 private java.lang.Integer productBackId; //退货管理id,如没有置为0
18 private java.lang.Integer productExchangeId; //换货管理id,如没有置为0
19 private java.lang.String content; //投诉内容
20 private java.lang.String image; //投诉图片
21 private java.util.Date complaintTime; //投诉时间
22 private java.lang.Integer sellerId; //投诉商家
23 private java.util.Date sellerComplaintTime; //商家申诉时间
24 private java.lang.String sellerCompContent; //商家申诉内容
25 private java.lang.String sellerCompImage; //商家申诉图片
26 private java.lang.Integer state; //状态:1、买家投诉待审核;2、买家投诉不通过;3、买家投诉通过;4、卖家申诉待审核;5、卖家申诉不通过;6、卖家申诉通过;
27 private java.lang.Integer optId; //平台处理人ID
28 private java.lang.String optContent; //平台处理结果
29 private java.lang.String userContent; //客户反馈意见
30 private java.util.Date createTime; //创建时间
31 private java.util.Date optTime; //处理时间
32 }
...@@ -8,7 +8,13 @@ import com.sibu.orderHelper.enums.*; ...@@ -8,7 +8,13 @@ import com.sibu.orderHelper.enums.*;
8 import com.sibu.orderHelper.integral.dao.PineappleDao; 8 import com.sibu.orderHelper.integral.dao.PineappleDao;
9 import com.sibu.orderHelper.integral.model.CheckRefundStatusBean; 9 import com.sibu.orderHelper.integral.model.CheckRefundStatusBean;
10 import com.sibu.orderHelper.integral.model.IMDoingOrderBean; 10 import com.sibu.orderHelper.integral.model.IMDoingOrderBean;
11 import com.sibu.orderHelper.integral.pineapple.enums.MemberProductBackEnum;
12 import com.sibu.orderHelper.integral.pineapple.enums.PineappleExchangeEnum;
11 import com.sibu.orderHelper.integral.pineapple.exception.BizException; 13 import com.sibu.orderHelper.integral.pineapple.exception.BizException;
14 import com.sibu.orderHelper.integral.pineapple.model.MemberProductBack;
15 import com.sibu.orderHelper.integral.pineapple.model.MemberProductExchange;
16 import com.sibu.orderHelper.integral.pineapple.model.Orders;
17 import com.sibu.orderHelper.integral.pineapple.model.SellerComplaint;
12 import com.sibu.orderHelper.integral.pineapple.request.CallRequest; 18 import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
13 import com.sibu.orderHelper.integral.reponse.CheckRefundStatusResponse; 19 import com.sibu.orderHelper.integral.reponse.CheckRefundStatusResponse;
14 import com.sibu.orderHelper.integral.request.CheckRefundStatusRequest; 20 import com.sibu.orderHelper.integral.request.CheckRefundStatusRequest;
...@@ -29,90 +35,75 @@ public class CheckRefundStatusBizServiceImpl extends AbstractBizService<CheckRef ...@@ -29,90 +35,75 @@ public class CheckRefundStatusBizServiceImpl extends AbstractBizService<CheckRef
29 public CheckRefundStatusResponse call(CallRequest<CheckRefundStatusRequest> callRequest) throws Exception { 35 public CheckRefundStatusResponse call(CallRequest<CheckRefundStatusRequest> callRequest) throws Exception {
30 CheckRefundStatusResponse checkRefundStatusResponse = new CheckRefundStatusResponse(); 36 CheckRefundStatusResponse checkRefundStatusResponse = new CheckRefundStatusResponse();
31 Map<String,Object> params = new HashMap<>(); 37 Map<String,Object> params = new HashMap<>();
32 params.put("orderCode",callRequest.getBizModel().getOrderID()); 38 params.put("orderSn ",callRequest.getBizModel().getOrderID());
33 List<CheckRefundStatusBean> checkRefundStatusBeanList = new ArrayList<>(); 39 params.put("sellerId",callRequest.getSupplier().getId());
34 40 Orders orders = pineappleDao.getOrdersByMap(params);
35 /* 41 if(StringUtil.isNull(orders)){
36 //先判断是否有退款 42 log.error(String.format("修改订单备注,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getOrderID()));
37 if(pineappleDao.countCheckRefundStatusResponse(params)>0){ 43 throw new BizException(String.format("修改订单备注,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getOrderID()));
38 Map<String,Object> map = new HashMap<>();
39 String redisMysqlDbConfig = "";
40 Integer dataBaseModule = DbUtil.getOrderInWhichDataBase(callRequest.getBizModel().getOrderID());
41 String tableIndex = DbUtil.getOrderInWhichTable(callRequest.getBizModel().getOrderID());
42 map.put("doingOrderTable","im_doing_order_" + tableIndex);
43 map.put("orderStatus", IMOrderStatus.RefundSuccess);
44 map.put("orderCode",callRequest.getBizModel().getOrderID());
45 map.put("supplierId",callRequest.getSupplier().getId());
46 redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, dataBaseModule.intValue());
47 DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
48 //再判断是否有退款成功的(全部退款,部分退款,退款中)
49 IMDoingOrderBean IMDoingOrderBean = pineappleDao.getIMDoingOrderBean(map);
50 if(StringUtil.isNull(IMDoingOrderBean)){
51 log.error(String.format("订单号:%s查询不到该订单数据,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
52 throw new BizException(String.format("订单号:%s查询不到该订单数据,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
53 }
54 //看是否全额退款 查询退款成功
55 checkRefundStatusBeanList = pineappleDao.childrenrefundStatusBySuccess(IMDoingOrderBean.getOrderCode());
56 if(PayOrderStatus.RefundSuccess.getCode()== IMDoingOrderBean.getOrderStatus().intValue()) {
57 if (StringUtil.isNull(checkRefundStatusBeanList) || checkRefundStatusBeanList.isEmpty()) {
58 log.error(String.format("订单号:%s查询不到退款成功记录,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
59 throw new BizException(String.format("订单号:%s查询不到退款成功记录,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
60 }
61 for (CheckRefundStatusBean bean : checkRefundStatusBeanList) {
62 bean.setRefundStatusdescription(PineappleRefundEnum.JH_06.getMsg());
63 bean.setRefundStatus(PineappleRefundEnum.JH_06.getCode());
64 } 44 }
65 checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_06.getCode()); 45 //1.查询退货表有没有记录
66 checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_06.getMsg()); 46 List<MemberProductBack> memberProductBackList= pineappleDao.getMemberProductBackByOrderSn(callRequest.getBizModel().getOrderID());
67 checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_06.getMsg()); 47 //5.如果退货表有记录,退款状态为店铺收货,判断退款金额状态
68 checkRefundStatusResponse.setChildrenrefundStatus(checkRefundStatusBeanList); 48 if(!StringUtil.isNull(memberProductBackList) && !memberProductBackList.isEmpty()){
49 MemberProductBack memberProductBack = memberProductBackList.stream().findFirst().get();
50 PineappleRefundEnum refundEnum = PineappleRefundEnum.resolveByPlatformRefundStatus(memberProductBack.getStateReturn());
51 //不予理会表示没有退款
52 if(!StringUtil.isNull(refundEnum) && PineappleRefundEnum.JH_05.getCode() != refundEnum.getCode()){
53 //如果退款状态是店铺收货需要判断该退款信息是否已付款
54 if(memberProductBack.getStateReturn().intValue() == MemberProductBackEnum.ShopDelivery.getCode()){
55 if(memberProductBack.getStateMoney() == 1){
56 checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_99.getCode());
57 checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_99.getMsg());
58 checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_99.getMsg());
59 checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
69 checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode()); 60 checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
70 checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg()); 61 checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
71 return checkRefundStatusResponse; 62 return checkRefundStatusResponse;
72 } 63 }
73 if(PayOrderStatus.HasReceived.getCode() == IMDoingOrderBean.getOrderStatus().intValue() || PayOrderStatus.HasDelive.getCode() == IMDoingOrderBean.getOrderStatus().intValue()
74 || PayOrderStatus.RefundDoing.getCode() == IMDoingOrderBean.getOrderStatus().intValue() ||PayOrderStatus.Finished.getCode() == IMDoingOrderBean.getOrderStatus().intValue() ){
75 //部分退款
76 if (!StringUtil.isNull(checkRefundStatusBeanList) && !checkRefundStatusBeanList.isEmpty()) {
77 for (CheckRefundStatusBean bean : checkRefundStatusBeanList) {
78 bean.setRefundStatusdescription(PineappleRefundEnum.JH_06.getMsg());
79 bean.setRefundStatus(PineappleRefundEnum.JH_06.getCode());
80 } 64 }
81 checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_99.getCode()); 65 checkRefundStatusResponse.setRefundStatus(refundEnum.getCode());
82 checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_99.getMsg()); 66 checkRefundStatusResponse.setSubmessage(refundEnum.getMsg());
83 checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_99.getMsg()); 67 checkRefundStatusResponse.setRefundStatusdescription(refundEnum.getMsg());
84 checkRefundStatusResponse.setChildrenrefundStatus(checkRefundStatusBeanList); 68 checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
85 checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode()); 69 checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
86 checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg()); 70 checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
87 return checkRefundStatusResponse; 71 return checkRefundStatusResponse;
88 }else{
89 checkRefundStatusBeanList = pineappleDao.childrenrefundStatusByCourse(IMDoingOrderBean.getOrderCode());
90 if(StringUtil.isNull(checkRefundStatusBeanList) || checkRefundStatusBeanList.isEmpty()) {
91 log.error(String.format("订单号:%s查询不到退款成功记录,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
92 throw new BizException(String.format("订单号:%s查询不到退款成功记录,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
93 } 72 }
94 Optional<CheckRefundStatusBean> entity = checkRefundStatusBeanList.stream().findFirst();
95 checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(entity.get().getRefundStatus())).getCode());
96 checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(entity.get().getRefundStatus())).getMsg());
97 checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(entity.get().getRefundStatus())).getMsg());
98 for (CheckRefundStatusBean bean : checkRefundStatusBeanList) {
99 bean.setRefundStatusdescription(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(bean.getRefundStatus())).getMsg());
100 bean.setRefundStatus(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(bean.getRefundStatus())).getCode());
101 } 73 }
74 //2.查询换货表有没有记录
75 List<MemberProductExchange> memberProductExchangeList = pineappleDao.getMemberProductExchangeByOrderSn(callRequest.getBizModel().getOrderID());
76 if(!StringUtil.isNull(memberProductExchangeList) && !memberProductExchangeList.isEmpty()){
77 MemberProductExchange memberProductExchange = memberProductExchangeList.stream().findFirst().get();
78 if(!StringUtil.isNull(memberProductExchange)){
79 PineappleExchangeEnum exchangeEnum = PineappleExchangeEnum.resolveByPlatformRefundStatus(memberProductExchange.getState());
80 checkRefundStatusResponse.setRefundStatus(exchangeEnum.getCode());
81 checkRefundStatusResponse.setSubmessage(exchangeEnum.getMsg());
82 checkRefundStatusResponse.setRefundStatusdescription(exchangeEnum.getMsg());
83 checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
102 checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode()); 84 checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
103 checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg()); 85 checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
104 checkRefundStatusResponse.setChildrenrefundStatus(checkRefundStatusBeanList);
105 return checkRefundStatusResponse; 86 return checkRefundStatusResponse;
106
107 } 87 }
88
108 } 89 }
90 //3.如果都没有记录需要查询seller_complaint(投诉表),根据order_id订单id查询
91 List<SellerComplaint> sellerComplaintList = pineappleDao.getSellerComplaintByOrderId(orders.getId());
92 if(!StringUtil.isNull(sellerComplaintList) && !sellerComplaintList.isEmpty()){
93 checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_99.getCode());
94 checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_99.getMsg());
95 checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_99.getMsg());
96 checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
97 checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
98 checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
99 return checkRefundStatusResponse;
109 } 100 }
110 checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_07.getCode()); 101 checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_07.getCode());
111 checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_07.getMsg()); 102 checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_07.getMsg());
112 checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_07.getMsg()); 103 checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_07.getMsg());
113 checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList()); 104 checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
114 checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode()); 105 checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
115 checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());*/ 106 checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
116 return checkRefundStatusResponse; 107 return checkRefundStatusResponse;
117 } 108 }
118 109
......