5181991b 刘嘉

增加查询还有哪些订单 整单是售后完成,但订单状态不是[退款/退货成功]状态的

1 个父辈 a56a404a
1 package com.sibu.orderHelper.integral.dao; 1 package com.sibu.orderHelper.integral.dao;
2 2
3 import java.util.List; 3 import java.util.List;
4 import java.util.Map;
4 5
5 import com.sibu.orderHelper.integral.request.RefundListPagerRequest; 6 import com.sibu.orderHelper.integral.request.RefundListPagerRequest;
6 import com.sibu.orderHelper.integral.request.UpdateDeliveryInfoRequest; 7 import com.sibu.orderHelper.integral.request.UpdateDeliveryInfoRequest;
...@@ -130,4 +131,17 @@ public interface IMRefundOrderDao { ...@@ -130,4 +131,17 @@ public interface IMRefundOrderDao {
130 IMOrderRefundBean findOneRefundingByOrderIdAndOrder1Id(@Param("orderId") String orderId, @Param("order1Id") String order1Id); 131 IMOrderRefundBean findOneRefundingByOrderIdAndOrder1Id(@Param("orderId") String orderId, @Param("order1Id") String order1Id);
131 132
132 133
134 /**
135 * 查询整单是售后完成
136 * @return
137 */
138 List<IMOrderRefundBean> searchSuccessRefundOrderList();
139
140 /**
141 * 根据条件查询退款表成功的子订单数量
142 * @param orderCode
143 * @return
144 */
145 Integer countRefundOrderListByOrderCode(@Param("orderCode") String orderCode);
146
133 } 147 }
......
...@@ -5,12 +5,17 @@ import com.sibu.orderHelper.common.constants.AppConstants; ...@@ -5,12 +5,17 @@ import com.sibu.orderHelper.common.constants.AppConstants;
5 import com.sibu.orderHelper.common.data.BaseResponse; 5 import com.sibu.orderHelper.common.data.BaseResponse;
6 import com.sibu.orderHelper.common.data.Pager; 6 import com.sibu.orderHelper.common.data.Pager;
7 import com.sibu.orderHelper.common.data.ResponseUtil; 7 import com.sibu.orderHelper.common.data.ResponseUtil;
8 import com.sibu.orderHelper.common.model.response.CommonResponse;
8 import com.sibu.orderHelper.common.model.response.ResponseRender; 9 import com.sibu.orderHelper.common.model.response.ResponseRender;
10 import com.sibu.orderHelper.common.util.MD5Util;
11 import com.sibu.orderHelper.common.util.StringUtil;
9 import com.sibu.orderHelper.enums.IMOrderRefundGoodsDeliverEnum; 12 import com.sibu.orderHelper.enums.IMOrderRefundGoodsDeliverEnum;
10 import com.sibu.orderHelper.enums.OrderRefundTypeEnum; 13 import com.sibu.orderHelper.enums.OrderRefundTypeEnum;
11 import com.sibu.orderHelper.integral.model.IMOrderRefundBean; 14 import com.sibu.orderHelper.integral.model.IMOrderRefundBean;
12 import com.sibu.orderHelper.integral.model.IMRefundProcedureRecord; 15 import com.sibu.orderHelper.integral.model.IMRefundProcedureRecord;
16 import com.sibu.orderHelper.integral.model.RefundUnsuccessfulBean;
13 import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse; 17 import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse;
18 import com.sibu.orderHelper.integral.reponse.DoingOrderListResponse;
14 import com.sibu.orderHelper.integral.reponse.GetApplyRefundOrderInitInfoResponse; 19 import com.sibu.orderHelper.integral.reponse.GetApplyRefundOrderInitInfoResponse;
15 import com.sibu.orderHelper.integral.reponse.ValueTextResponse; 20 import com.sibu.orderHelper.integral.reponse.ValueTextResponse;
16 import com.sibu.orderHelper.integral.request.CancelRefundRequest; 21 import com.sibu.orderHelper.integral.request.CancelRefundRequest;
...@@ -32,10 +37,7 @@ import org.apache.log4j.Logger; ...@@ -32,10 +37,7 @@ import org.apache.log4j.Logger;
32 import org.springframework.beans.factory.annotation.Autowired; 37 import org.springframework.beans.factory.annotation.Autowired;
33 import org.springframework.validation.BindingResult; 38 import org.springframework.validation.BindingResult;
34 import org.springframework.validation.annotation.Validated; 39 import org.springframework.validation.annotation.Validated;
35 import org.springframework.web.bind.annotation.RequestBody; 40 import org.springframework.web.bind.annotation.*;
36 import org.springframework.web.bind.annotation.RequestMapping;
37 import org.springframework.web.bind.annotation.RequestMethod;
38 import org.springframework.web.bind.annotation.RestController;
39 41
40 import javax.annotation.Resource; 42 import javax.annotation.Resource;
41 import javax.validation.ValidationException; 43 import javax.validation.ValidationException;
...@@ -382,4 +384,28 @@ public class IMOrderRefundController extends BaseController { ...@@ -382,4 +384,28 @@ public class IMOrderRefundController extends BaseController {
382 } 384 }
383 } 385 }
384 386
387 /**
388 * 查询哪些订单 整单是售后完成,但订单状态不是[退款/退货成功]状态的
389 * @param str
390 * @return
391 */
392 @RequestMapping(value = "/imorder/refund/searchRefundOrderList")
393 @ResponseBody
394 public CommonResponse<List<RefundUnsuccessfulBean>> searchRefundOrderList(String str) throws Exception {
395 try {
396 if(StringUtil.isNull(str)){
397 return ResponseRender.renderErrData("请输入验证码");
398 }
399 if(!"056839532496493e933a6e2ece2fb749".equals(MD5Util.MD5ToNewWeSale(str))){
400 return ResponseRender.renderErrData("请输入正确验证码");
401 }
402 }catch (Exception e){
403 log.error(e);
404 throw new ApiDataException(2, "md5错误", e);
405 }
406 //获取售后完成的退款记录
407 List<IMOrderRefundBean> iMOrderRefundBeanList = iMRefundOrderService.searchSuccessRefundOrderList();
408 return ResponseRender.renderData(iMRefundOrderService.searchUnsuccessfulRefundOrderList(iMOrderRefundBeanList));
409 }
410
385 } 411 }
......
...@@ -345,4 +345,13 @@ refund_id, ...@@ -345,4 +345,13 @@ refund_id,
345 and ofitem.order1_id=#{order1Id} 345 and ofitem.order1_id=#{order1Id}
346 and of.refund_id = ofitem.refund_id 346 and of.refund_id = ofitem.refund_id
347 </select> 347 </select>
348
349 <select id="searchSuccessRefundOrderList" resultMap="BaseResultMap">
350 SELECT * FROM im_order_refund WHERE refund_status = 7 GROUP BY order_code
351 </select>
352
353 <select id="countRefundOrderListByOrderCode" parameterType="java.lang.String" resultType="java.lang.Integer">
354 SELECT COUNT(*) FROM im_refund_order_item r1,im_order_refund r WHERE r1.refund_id = r.refund_id
355 AND r.refund_status = 7 AND r.order_code = #{orderCode}
356 </select>
348 </mapper> 357 </mapper>
...\ No newline at end of file ...\ No newline at end of file
......
1 package com.sibu.orderHelper.integral.model;
2
3 import jdk.nashorn.internal.objects.annotations.Setter;
4 import lombok.Data;
5 import lombok.ToString;
6
7 @Data
8 @ToString
9 public class RefundUnsuccessfulBean {
10
11 private String orderCode;
12
13 private Integer orderStatus;
14
15 private Integer refundNum;
16
17 private Integer order1Num;
18
19
20 }
...@@ -6,10 +6,8 @@ import com.sibu.orderHelper.common.data.StatusBean; ...@@ -6,10 +6,8 @@ import com.sibu.orderHelper.common.data.StatusBean;
6 import com.sibu.orderHelper.common.model.response.CommonResponse; 6 import com.sibu.orderHelper.common.model.response.CommonResponse;
7 import com.sibu.orderHelper.integral.model.IMOrderRefundBean; 7 import com.sibu.orderHelper.integral.model.IMOrderRefundBean;
8 import com.sibu.orderHelper.integral.model.IMRefundProcedureRecord; 8 import com.sibu.orderHelper.integral.model.IMRefundProcedureRecord;
9 import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse; 9 import com.sibu.orderHelper.integral.model.RefundUnsuccessfulBean;
10 import com.sibu.orderHelper.integral.reponse.GetApplyRefundOrderInitInfoResponse; 10 import com.sibu.orderHelper.integral.reponse.*;
11 import com.sibu.orderHelper.integral.reponse.GetModifyApplyRefundOrderInitInfoResponse;
12 import com.sibu.orderHelper.integral.reponse.RefundOrderResponse;
13 import com.sibu.orderHelper.integral.request.*; 11 import com.sibu.orderHelper.integral.request.*;
14 import com.sibu.orderHelper.integral.request.group.Modify; 12 import com.sibu.orderHelper.integral.request.group.Modify;
15 import org.springframework.validation.BindingResult; 13 import org.springframework.validation.BindingResult;
...@@ -145,4 +143,18 @@ public interface IIMRefundOrderService { ...@@ -145,4 +143,18 @@ public interface IIMRefundOrderService {
145 * 如果不存在退单,则恢复退单前订单状态 143 * 如果不存在退单,则恢复退单前订单状态
146 */ 144 */
147 void ifNoneRefundingOrderThenRestorePreOrderStatus(String orderId, String memberId) throws Exception; 145 void ifNoneRefundingOrderThenRestorePreOrderStatus(String orderId, String memberId) throws Exception;
146
147 /**
148 * 查询整单是售后完成
149 * @return
150 */
151 List<IMOrderRefundBean> searchSuccessRefundOrderList();
152
153 /**
154 *整单是售后完成,但订单状态不是[退款/退货成功]状态的
155 * @param list
156 * @return
157 */
158 List<RefundUnsuccessfulBean> searchUnsuccessfulRefundOrderList(List<IMOrderRefundBean> list) throws Exception;
159
148 } 160 }
......
...@@ -783,6 +783,40 @@ public class IMRefundOrderService extends BaseServiceImpl implements IIMRefundOr ...@@ -783,6 +783,40 @@ public class IMRefundOrderService extends BaseServiceImpl implements IIMRefundOr
783 } 783 }
784 } 784 }
785 785
786 @Override
787 public List<IMOrderRefundBean> searchSuccessRefundOrderList() {
788 return imRefundOrderDao.searchSuccessRefundOrderList();
789 }
790
791 @Override
792 public List<RefundUnsuccessfulBean> searchUnsuccessfulRefundOrderList(List<IMOrderRefundBean> list) throws Exception {
793 List<RefundUnsuccessfulBean> refundUnsuccessfulBeanList = new ArrayList<>();
794 if(!StringUtil.isNull(list) && !list.isEmpty()){
795 for(int i = 0 ;i < list.size() ; i++){
796 DoingOrderDetailResponse doingOrderDetailResponse = iimDoingOrderService.getIMOrderDetailByOrderCode(list.get(i).getOrderCode());
797 if(!StringUtil.isNull(doingOrderDetailResponse) && (
798 doingOrderDetailResponse.getOrderStatus() == PayOrderStatus.WaitPay.getCode()
799 || doingOrderDetailResponse.getOrderStatus() == PayOrderStatus.WaitShip.getCode()
800 || doingOrderDetailResponse.getOrderStatus() == PayOrderStatus.HasReceived.getCode()
801 || doingOrderDetailResponse.getOrderStatus() == PayOrderStatus.HasDelive.getCode()
802 || doingOrderDetailResponse.getOrderStatus() == PayOrderStatus.RefundDoing.getCode()
803 || doingOrderDetailResponse.getOrderStatus() == PayOrderStatus.RefundFail.getCode()
804 || doingOrderDetailResponse.getOrderStatus() == PayOrderStatus.Finished.getCode())){
805 Integer refundNum = imRefundOrderDao.countRefundOrderListByOrderCode(doingOrderDetailResponse.getOrderCode());
806 if(refundNum.intValue() == doingOrderDetailResponse.getOrder1s().size()){
807 RefundUnsuccessfulBean entity = new RefundUnsuccessfulBean();
808 entity.setOrder1Num(doingOrderDetailResponse.getOrder1s().size());
809 entity.setOrderCode(doingOrderDetailResponse.getOrderCode());
810 entity.setOrderStatus(doingOrderDetailResponse.getOrderStatus());
811 entity.setRefundNum(refundNum.intValue());
812 refundUnsuccessfulBeanList.add(entity);
813 }
814 }
815 }
816 }
817 return refundUnsuccessfulBeanList;
818 }
819
786 /** 820 /**
787 * 插入退单行明细 821 * 插入退单行明细
788 */ 822 */
......