c1eb215e lauka

添加菠萝派退款下载接口

1 个父辈 15888b7f
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
13 <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> 13 <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
14 <sourceFolder url="file://$MODULE_DIR$/src/main/resources/META-INF/conf" type="java-resource" /> 14 <sourceFolder url="file://$MODULE_DIR$/src/main/resources/META-INF/conf" type="java-resource" />
15 <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> 15 <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
16 <excludeFolder url="file://$MODULE_DIR$/target" />
17 </content> 16 </content>
18 <orderEntry type="inheritedJdk" /> 17 <orderEntry type="inheritedJdk" />
19 <orderEntry type="sourceFolder" forTests="false" /> 18 <orderEntry type="sourceFolder" forTests="false" />
......
...@@ -2,9 +2,11 @@ package com.sibu.orderHelper.mall.member.read; ...@@ -2,9 +2,11 @@ package com.sibu.orderHelper.mall.member.read;
2 2
3 import com.sibu.orderHelper.integral.model.DownloadProductBean; 3 import com.sibu.orderHelper.integral.model.DownloadProductBean;
4 import com.sibu.orderHelper.integral.model.DownloadProductSkuBean; 4 import com.sibu.orderHelper.integral.model.DownloadProductSkuBean;
5 import com.sibu.orderHelper.integral.model.GetRefundBean;
5 import com.sibu.orderHelper.integral.model.IMSupplierApp; 6 import com.sibu.orderHelper.integral.model.IMSupplierApp;
6 import com.sibu.orderHelper.integral.pineapple.model.*; 7 import com.sibu.orderHelper.integral.pineapple.model.*;
7 import com.sibu.orderHelper.integral.reponse.MemberAddressResponse; 8 import com.sibu.orderHelper.integral.reponse.MemberAddressResponse;
9 import com.sibu.orderHelper.integral.request.GetRefundRequest;
8 import com.sibu.orderHelper.integral.request.MemberAddressAddRequest; 10 import com.sibu.orderHelper.integral.request.MemberAddressAddRequest;
9 import org.apache.ibatis.annotations.Param; 11 import org.apache.ibatis.annotations.Param;
10 12
...@@ -128,4 +130,22 @@ public interface MemberReadDao { ...@@ -128,4 +130,22 @@ public interface MemberReadDao {
128 130
129 131
130 List<Seller> getSeller(@Param("id") String id); 132 List<Seller> getSeller(@Param("id") String id);
133
134
135 /**
136 * 退款单下载
137 * @param params
138 * @return
139 */
140 List<GetRefundBean> getGetRefundBean(Map<String,Object> params);
141
142
143 int countGetGetRefundBean(Map<String,Object> params);
144
145 /**
146 * 查询退款单的订单购买数量
147 * @param orderProductId
148 * @return
149 */
150 int countOrderProductNum(@Param("id") String orderProductId);
131 } 151 }
......
...@@ -461,4 +461,63 @@ ...@@ -461,4 +461,63 @@
461 select * from seller 461 select * from seller
462 where `id` = #{id} 462 where `id` = #{id}
463 </select> 463 </select>
464
465
466 <resultMap id="GetRefundBeanMap" type="com.sibu.orderHelper.integral.model.GetRefundBean">
467 <result column="member_back_code" property="refundno"/>
468 <result column="order_sn" property="platorderno"/>
469 <result column="order_product_id" property="subplatorderno"/>
470 <result column="back_money" property="refundamount"/>
471 <result column="create_time" property="createtime"/>
472 <result column="member_name" property="buyernick"/>
473 <result column="state_return" property="refundstatus"/>
474 <result column="state_money" property="stateMoney"/>
475 <result column="question" property="reason"/>
476 <result column="product_name" property="productname"/>
477 <result column="logistics_name" property="logisticname"/>
478 <result column="logistics_number" property="logisticno"/>
479 <result column="seller_name" property="sellernick"/>
480 <result column="money_order" property="totalamount"/>
481 <result column="order_state" property="orderstatus"/>
482 <result column="money_order" property="payamount"/>
483 </resultMap>
484
485
486 <select id="getGetRefundBean" parameterType="java.util.Map" resultMap="GetRefundBeanMap">
487 SELECT b.member_back_code,b.order_sn,b.order_product_id,b.back_money,b.create_time,b.member_name,
488 b.state_return,b.state_money,b.question,b.product_name,b.logistics_name,b.logistics_number ,b.seller_name,
489 o.money_order,o.order_state,o.remark
490 FROM member_product_back b LEFT JOIN orders o ON b.order_id = o.id
491 WHERE b.seller_id = #{supplierId}
492 <if test="beginTime!=null">
493 AND b.create_time >= #{beginTime}
494 </if>
495 <if test="endTime!=null">
496 <![CDATA[
497 and b.create_time <= #{endTime}
498 ]]>
499 </if>
500 ORDER by member_back_code DESC
501 limit ${PageIndex}, ${PageSize}
502 </select>
503
504
505 <select id="countGetGetRefundBean" parameterType="java.util.Map" resultType="java.lang.Integer">
506 SELECT count(*)
507 FROM member_product_back b
508 WHERE b.seller_id = #{supplierId}
509 <if test="beginTime!=null">
510 AND b.create_time >= #{beginTime}
511 </if>
512 <if test="endTime!=null">
513 <![CDATA[
514 and b.create_time <= #{endTime}
515 ]]>
516 </if>
517 </select>
518
519 <select id="countOrderProductNum" resultType="java.lang.Integer">
520 SELECT number FROM orders_product where id = #{id}
521 </select>
522
464 </mapper> 523 </mapper>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -22,9 +22,9 @@ public enum PineappleRefundEnum { ...@@ -22,9 +22,9 @@ public enum PineappleRefundEnum {
22 JH_03("JH_03", "买家已经退货等待卖家确认收货",Arrays.asList(MemberProductBackEnum.MemberDeliver.getCode())), 22 JH_03("JH_03", "买家已经退货等待卖家确认收货",Arrays.asList(MemberProductBackEnum.MemberDeliver.getCode())),
23 JH_04("JH_04", "卖家拒绝退款",Arrays.asList()), 23 JH_04("JH_04", "卖家拒绝退款",Arrays.asList()),
24 JH_05("JH_05", "退款关闭",new ArrayList<>(MemberProductBackEnum.Inattentive.getCode())), 24 JH_05("JH_05", "退款关闭",new ArrayList<>(MemberProductBackEnum.Inattentive.getCode())),
25 JH_06("JH_06", "退款成功",Arrays.asList()), 25 JH_06("JH_06", "退款成功",new ArrayList<>(MemberProductBackEnum.ShopDelivery.getCode())),
26 JH_07("JH_07", "没有退款",new ArrayList<>()), 26 JH_07("JH_07", "没有退款",new ArrayList<>()),
27 JH_99("JH_99", "其他",new ArrayList<>(MemberProductBackEnum.ShopDelivery.getCode())); 27 JH_99("JH_99", "其他",Arrays.asList());
28 28
29 29
30 30
......
1 package com.sibu.orderHelper.enums;
2
3
4 import com.alibaba.druid.util.StringUtils;
5 import com.sibu.orderHelper.integral.pineapple.enums.MemberProductBackEnum;
6 import org.apache.commons.lang3.EnumUtils;
7
8 import java.util.ArrayList;
9 import java.util.Arrays;
10 import java.util.List;
11
12 /**
13 * @author lauka
14 * @date 2018/03/30
15 * @description 菠萝派商城退款验证退款状态举类
16 */
17 public enum PineappleRefundMoneyStateEnum {
18 NOT_REFUND("1", "未退款",PineappleRefundEnum.JH_99),
19 REFUND_ACCOUNT("2", "退款到账户", PineappleRefundEnum.JH_06),
20 REFUND_BANK("3", "退款到银行",PineappleRefundEnum.JH_06),
21 REFUND_ING("4", "退款中",PineappleRefundEnum.JH_99),
22 REFUND_ERROR ("5", "退款失败",PineappleRefundEnum.JH_99),
23 REFUND_UNKNOWN("-1", "未知",PineappleRefundEnum.JH_99),;
24
25
26 private String code; // 错误代码
27 private String msg; // 错误消息
28 private PineappleRefundEnum pineappleRefundEnum;
29
30 PineappleRefundMoneyStateEnum(String code, String msg, PineappleRefundEnum pineappleRefundEnum) {
31 this.code = code;
32 this.msg = msg;
33 this.pineappleRefundEnum = pineappleRefundEnum;
34 }
35
36 public String getCode() {
37 return code;
38 }
39
40 public void setCode(String code) {
41 this.code = code;
42 }
43
44 public String getMsg() {
45 return msg;
46 }
47
48 public void setMsg(String msg) {
49 this.msg = msg;
50 }
51
52 public PineappleRefundEnum getPineappleRefundEnum() {
53 return pineappleRefundEnum;
54 }
55
56 public void setPineappleRefundEnum(PineappleRefundEnum pineappleRefundEnum) {
57 this.pineappleRefundEnum = pineappleRefundEnum;
58 }
59
60 public static PineappleRefundMoneyStateEnum resolveByPlatformRefundStatus(Integer platformOrderStatus) {
61 List<PineappleRefundMoneyStateEnum> enums = EnumUtils.getEnumList(PineappleRefundMoneyStateEnum.class);
62 PineappleRefundMoneyStateEnum result = enums.stream()
63 .filter(p -> p.code.equals(platformOrderStatus))
64 .findFirst()
65 .orElse(PineappleRefundMoneyStateEnum.REFUND_UNKNOWN);
66 return result;
67 }
68 }
...@@ -86,6 +86,9 @@ public class GetRefundBean implements Serializable{ ...@@ -86,6 +86,9 @@ public class GetRefundBean implements Serializable{
86 //商品外部商家编码 86 //商品外部商家编码
87 private String outerid; 87 private String outerid;
88 88
89 //退款状态
90 private Integer stateMoney;
91
89 public String getRefundno() { 92 public String getRefundno() {
90 return refundno; 93 return refundno;
91 } 94 }
...@@ -285,4 +288,12 @@ public class GetRefundBean implements Serializable{ ...@@ -285,4 +288,12 @@ public class GetRefundBean implements Serializable{
285 public void setOuterid(String outerid) { 288 public void setOuterid(String outerid) {
286 this.outerid = outerid; 289 this.outerid = outerid;
287 } 290 }
291
292 public Integer getStateMoney() {
293 return stateMoney;
294 }
295
296 public void setStateMoney(Integer stateMoney) {
297 this.stateMoney = stateMoney;
298 }
288 } 299 }
......
...@@ -166,6 +166,8 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest> ...@@ -166,6 +166,8 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
166 * 子订单数据 166 * 子订单数据
167 * @param ordersProduct 167 * @param ordersProduct
168 * @return 168 * @return
169 *
170 *
169 */ 171 */
170 private OrderGoodResponse getOrderGoodResponse(OrdersProduct ordersProduct){ 172 private OrderGoodResponse getOrderGoodResponse(OrdersProduct ordersProduct){
171 OrderGoodResponse orderGoodResponse = new OrderGoodResponse(); 173 OrderGoodResponse orderGoodResponse = new OrderGoodResponse();
......
...@@ -7,6 +7,7 @@ import com.sibu.orderHelper.common.util.StringUtil; ...@@ -7,6 +7,7 @@ import com.sibu.orderHelper.common.util.StringUtil;
7 import com.sibu.orderHelper.enums.PineappleEnum; 7 import com.sibu.orderHelper.enums.PineappleEnum;
8 import com.sibu.orderHelper.enums.PineappleMethodsEnum; 8 import com.sibu.orderHelper.enums.PineappleMethodsEnum;
9 import com.sibu.orderHelper.enums.PineappleRefundEnum; 9 import com.sibu.orderHelper.enums.PineappleRefundEnum;
10 import com.sibu.orderHelper.enums.PineappleRefundMoneyStateEnum;
10 import com.sibu.orderHelper.integral.dao.PineappleDao; 11 import com.sibu.orderHelper.integral.dao.PineappleDao;
11 import com.sibu.orderHelper.integral.model.GetRefundBean; 12 import com.sibu.orderHelper.integral.model.GetRefundBean;
12 import com.sibu.orderHelper.integral.model.PineappleOderDetailBean; 13 import com.sibu.orderHelper.integral.model.PineappleOderDetailBean;
...@@ -15,6 +16,7 @@ import com.sibu.orderHelper.integral.pineapple.exception.BizException; ...@@ -15,6 +16,7 @@ import com.sibu.orderHelper.integral.pineapple.exception.BizException;
15 import com.sibu.orderHelper.integral.pineapple.request.CallRequest; 16 import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
16 import com.sibu.orderHelper.integral.reponse.GetRefundResponse; 17 import com.sibu.orderHelper.integral.reponse.GetRefundResponse;
17 import com.sibu.orderHelper.integral.request.GetRefundRequest; 18 import com.sibu.orderHelper.integral.request.GetRefundRequest;
19 import com.sibu.orderHelper.mall.member.read.MemberReadDao;
18 import org.apache.log4j.Logger; 20 import org.apache.log4j.Logger;
19 import org.springframework.stereotype.Service; 21 import org.springframework.stereotype.Service;
20 22
...@@ -31,20 +33,44 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques ...@@ -31,20 +33,44 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques
31 @Resource 33 @Resource
32 private PineappleDao pineappleDao; 34 private PineappleDao pineappleDao;
33 35
36 @Resource
37 private MemberReadDao memberReadDao;
34 38
35 @Override 39 @Override
36 public GetRefundResponse call(CallRequest<GetRefundRequest> callRequest) throws Exception { 40 public GetRefundResponse call(CallRequest<GetRefundRequest> callRequest) throws Exception {
37 /*GetRefundResponse getRefundResponse =new GetRefundResponse(); 41 GetRefundResponse getRefundResponse =new GetRefundResponse();
38 Map<String,Object> params = new HashMap<>(); 42 Map<String,Object> params = new HashMap<>();
39 params.put("supplierId",callRequest.getSupplier().getId()); 43 params.put("supplierId",callRequest.getSupplier().getId());
40 params.put("beginTime",callRequest.getBizModel().getBeginTime()); 44 params.put("beginTime",callRequest.getBizModel().getBeginTime());
41 params.put("endTime",callRequest.getBizModel().getEndTime()); 45 params.put("endTime",callRequest.getBizModel().getEndTime());
42 params.put("pageNow",(callRequest.getBizModel().getPageIndex()- 1) * callRequest.getBizModel().getPageSize()); 46 params.put("PageIndex",(callRequest.getBizModel().getPageIndex()- 1) * callRequest.getBizModel().getPageSize());
43 params.put("PageSize",callRequest.getBizModel().getPageSize()); 47 params.put("PageSize",callRequest.getBizModel().getPageSize());
44 48
45 List<GetRefundBean> refundBeanList = pineappleDao.pageGetRefundBean(params); 49 List<GetRefundBean> refundBeanList = memberReadDao.getGetRefundBean(params);
46 if(!StringUtil.isNull(refundBeanList) && !refundBeanList.isEmpty()){ 50 if(!StringUtil.isNull(refundBeanList) && !refundBeanList.isEmpty()){
47 for(GetRefundBean getRefundBean:refundBeanList){ 51 for(GetRefundBean getRefundBean:refundBeanList){
52 int productNum = memberReadDao.countOrderProductNum(getRefundBean.getSubplatorderno());
53 getRefundBean.setProductnum(productNum);
54 OrderStatusEnum orderStatusEnum = OrderStatusEnum.resolveByPlatformOrderStatus(Integer.valueOf(getRefundBean.getOrderstatus()));
55 if(orderStatusEnum.getCode().equals(OrderStatusEnum.UNKNOWN.getCode())){
56 throw new BizException(String.format("菠萝派退款单下载,枚举查询订单状态报错,订单状态【{0}】转换失败",getRefundBean.getOrderstatus()));
57 }
58 getRefundBean.setOrderstatus(orderStatusEnum.getCode());
59 getRefundBean.setOrderstatusdesc(orderStatusEnum.getMsg());
60 PineappleRefundEnum pineappleRefundEnum = PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(getRefundBean.getRefundstatus()));
61 if(pineappleRefundEnum.getCode() == PineappleRefundEnum.JH_06.getCode()){
62 PineappleRefundMoneyStateEnum pineappleRefundMoneyStateEnum = PineappleRefundMoneyStateEnum.resolveByPlatformRefundStatus(getRefundBean.getStateMoney());
63 if(pineappleRefundMoneyStateEnum.getCode().equals(PineappleRefundMoneyStateEnum.REFUND_UNKNOWN.getCode())){
64 throw new BizException(String.format("菠萝派退款单下载,枚举查询退款状态报错,订单状态【{0}】转换失败",getRefundBean.getRefundstatus()));
65 }
66 getRefundBean.setRefundstatus(pineappleRefundMoneyStateEnum.getPineappleRefundEnum().getCode());
67 getRefundBean.setRefundstatusdesc(pineappleRefundMoneyStateEnum.getPineappleRefundEnum().getMsg());
68 }else{
69 getRefundBean.setRefundstatus(pineappleRefundEnum.getCode());
70 getRefundBean.setRefundstatusdesc(pineappleRefundEnum.getMsg());
71 }
72 }
73 /*for(GetRefundBean getRefundBean:refundBeanList){
48 Map<String,Object> map = new HashMap<>(); 74 Map<String,Object> map = new HashMap<>();
49 String redisMysqlDbConfig = ""; 75 String redisMysqlDbConfig = "";
50 Integer dataBaseModule = DbUtil.getOrderInWhichDataBase(getRefundBean.getPlatorderno()); 76 Integer dataBaseModule = DbUtil.getOrderInWhichDataBase(getRefundBean.getPlatorderno());
...@@ -54,7 +80,7 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques ...@@ -54,7 +80,7 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques
54 map.put("orderId1",getRefundBean.getSubplatorderno()); 80 map.put("orderId1",getRefundBean.getSubplatorderno());
55 redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, dataBaseModule.intValue()); 81 redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, dataBaseModule.intValue());
56 DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源 82 DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
57 PineappleOderDetailBean pineappleOderDetailBean = pineappleDao.getOneIMOrderById(map); 83 PineappleOderDetailBean pineappleOderDetailBean = null;
58 if(StringUtil.isNull(pineappleOderDetailBean)){ 84 if(StringUtil.isNull(pineappleOderDetailBean)){
59 log.error(String.format("订单号:%查询不到该订单信息,请求method:%s,appket:%s",getRefundBean.getSubplatorderno(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey())); 85 log.error(String.format("订单号:%查询不到该订单信息,请求method:%s,appket:%s",getRefundBean.getSubplatorderno(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey()));
60 throw new BizException(String.format("订单号:%查询不到该订单信息,请求method:%s,appket:%s",getRefundBean.getSubplatorderno(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey())); 86 throw new BizException(String.format("订单号:%查询不到该订单信息,请求method:%s,appket:%s",getRefundBean.getSubplatorderno(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey()));
...@@ -75,16 +101,16 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques ...@@ -75,16 +101,16 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques
75 getRefundBean.setRefundstatus(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(getRefundBean.getRefundstatus())).getCode()); 101 getRefundBean.setRefundstatus(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(getRefundBean.getRefundstatus())).getCode());
76 102
77 103
78 } 104 }*/
79 getRefundResponse.setTotalcount(refundBeanList.size()); 105 getRefundResponse.setTotalcount(memberReadDao.countGetGetRefundBean(params));
80 }else{ 106 }else{
81 getRefundResponse.setTotalcount(0); 107 getRefundResponse.setTotalcount(0);
82 } 108 }
83 getRefundResponse.setRefunds(refundBeanList); 109 getRefundResponse.setRefunds(refundBeanList);
84 getRefundResponse.setSuccess(true); 110 getRefundResponse.setSuccess(true);
85 getRefundResponse.setCode(PineappleEnum.SUCCESS.getCode()); 111 getRefundResponse.setCode(PineappleEnum.SUCCESS.getCode());
86 getRefundResponse.setMessage(PineappleEnum.SUCCESS.getMsg());*/ 112 getRefundResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
87 return null; 113 return getRefundResponse;
88 } 114 }
89 115
90 @Override 116 @Override
......