5181991b 刘嘉

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

1 个父辈 a56a404a
package com.sibu.orderHelper.integral.dao;
import java.util.List;
import java.util.Map;
import com.sibu.orderHelper.integral.request.RefundListPagerRequest;
import com.sibu.orderHelper.integral.request.UpdateDeliveryInfoRequest;
......@@ -130,4 +131,17 @@ public interface IMRefundOrderDao {
IMOrderRefundBean findOneRefundingByOrderIdAndOrder1Id(@Param("orderId") String orderId, @Param("order1Id") String order1Id);
/**
* 查询整单是售后完成
* @return
*/
List<IMOrderRefundBean> searchSuccessRefundOrderList();
/**
* 根据条件查询退款表成功的子订单数量
* @param orderCode
* @return
*/
Integer countRefundOrderListByOrderCode(@Param("orderCode") String orderCode);
}
......
......@@ -5,12 +5,17 @@ import com.sibu.orderHelper.common.constants.AppConstants;
import com.sibu.orderHelper.common.data.BaseResponse;
import com.sibu.orderHelper.common.data.Pager;
import com.sibu.orderHelper.common.data.ResponseUtil;
import com.sibu.orderHelper.common.model.response.CommonResponse;
import com.sibu.orderHelper.common.model.response.ResponseRender;
import com.sibu.orderHelper.common.util.MD5Util;
import com.sibu.orderHelper.common.util.StringUtil;
import com.sibu.orderHelper.enums.IMOrderRefundGoodsDeliverEnum;
import com.sibu.orderHelper.enums.OrderRefundTypeEnum;
import com.sibu.orderHelper.integral.model.IMOrderRefundBean;
import com.sibu.orderHelper.integral.model.IMRefundProcedureRecord;
import com.sibu.orderHelper.integral.model.RefundUnsuccessfulBean;
import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse;
import com.sibu.orderHelper.integral.reponse.DoingOrderListResponse;
import com.sibu.orderHelper.integral.reponse.GetApplyRefundOrderInitInfoResponse;
import com.sibu.orderHelper.integral.reponse.ValueTextResponse;
import com.sibu.orderHelper.integral.request.CancelRefundRequest;
......@@ -32,10 +37,7 @@ import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.ValidationException;
......@@ -382,4 +384,28 @@ public class IMOrderRefundController extends BaseController {
}
}
/**
* 查询哪些订单 整单是售后完成,但订单状态不是[退款/退货成功]状态的
* @param str
* @return
*/
@RequestMapping(value = "/imorder/refund/searchRefundOrderList")
@ResponseBody
public CommonResponse<List<RefundUnsuccessfulBean>> searchRefundOrderList(String str) throws Exception {
try {
if(StringUtil.isNull(str)){
return ResponseRender.renderErrData("请输入验证码");
}
if(!"056839532496493e933a6e2ece2fb749".equals(MD5Util.MD5ToNewWeSale(str))){
return ResponseRender.renderErrData("请输入正确验证码");
}
}catch (Exception e){
log.error(e);
throw new ApiDataException(2, "md5错误", e);
}
//获取售后完成的退款记录
List<IMOrderRefundBean> iMOrderRefundBeanList = iMRefundOrderService.searchSuccessRefundOrderList();
return ResponseRender.renderData(iMRefundOrderService.searchUnsuccessfulRefundOrderList(iMOrderRefundBeanList));
}
}
......
......@@ -345,4 +345,13 @@ refund_id,
and ofitem.order1_id=#{order1Id}
and of.refund_id = ofitem.refund_id
</select>
<select id="searchSuccessRefundOrderList" resultMap="BaseResultMap">
SELECT * FROM im_order_refund WHERE refund_status = 7 GROUP BY order_code
</select>
<select id="countRefundOrderListByOrderCode" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT COUNT(*) FROM im_refund_order_item r1,im_order_refund r WHERE r1.refund_id = r.refund_id
AND r.refund_status = 7 AND r.order_code = #{orderCode}
</select>
</mapper>
\ No newline at end of file
......
package com.sibu.orderHelper.integral.model;
import jdk.nashorn.internal.objects.annotations.Setter;
import lombok.Data;
import lombok.ToString;
@Data
@ToString
public class RefundUnsuccessfulBean {
private String orderCode;
private Integer orderStatus;
private Integer refundNum;
private Integer order1Num;
}
......@@ -6,10 +6,8 @@ import com.sibu.orderHelper.common.data.StatusBean;
import com.sibu.orderHelper.common.model.response.CommonResponse;
import com.sibu.orderHelper.integral.model.IMOrderRefundBean;
import com.sibu.orderHelper.integral.model.IMRefundProcedureRecord;
import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse;
import com.sibu.orderHelper.integral.reponse.GetApplyRefundOrderInitInfoResponse;
import com.sibu.orderHelper.integral.reponse.GetModifyApplyRefundOrderInitInfoResponse;
import com.sibu.orderHelper.integral.reponse.RefundOrderResponse;
import com.sibu.orderHelper.integral.model.RefundUnsuccessfulBean;
import com.sibu.orderHelper.integral.reponse.*;
import com.sibu.orderHelper.integral.request.*;
import com.sibu.orderHelper.integral.request.group.Modify;
import org.springframework.validation.BindingResult;
......@@ -145,4 +143,18 @@ public interface IIMRefundOrderService {
* 如果不存在退单,则恢复退单前订单状态
*/
void ifNoneRefundingOrderThenRestorePreOrderStatus(String orderId, String memberId) throws Exception;
/**
* 查询整单是售后完成
* @return
*/
List<IMOrderRefundBean> searchSuccessRefundOrderList();
/**
*整单是售后完成,但订单状态不是[退款/退货成功]状态的
* @param list
* @return
*/
List<RefundUnsuccessfulBean> searchUnsuccessfulRefundOrderList(List<IMOrderRefundBean> list) throws Exception;
}
......
......@@ -783,6 +783,40 @@ public class IMRefundOrderService extends BaseServiceImpl implements IIMRefundOr
}
}
@Override
public List<IMOrderRefundBean> searchSuccessRefundOrderList() {
return imRefundOrderDao.searchSuccessRefundOrderList();
}
@Override
public List<RefundUnsuccessfulBean> searchUnsuccessfulRefundOrderList(List<IMOrderRefundBean> list) throws Exception {
List<RefundUnsuccessfulBean> refundUnsuccessfulBeanList = new ArrayList<>();
if(!StringUtil.isNull(list) && !list.isEmpty()){
for(int i = 0 ;i < list.size() ; i++){
DoingOrderDetailResponse doingOrderDetailResponse = iimDoingOrderService.getIMOrderDetailByOrderCode(list.get(i).getOrderCode());
if(!StringUtil.isNull(doingOrderDetailResponse) && (
doingOrderDetailResponse.getOrderStatus() == PayOrderStatus.WaitPay.getCode()
|| doingOrderDetailResponse.getOrderStatus() == PayOrderStatus.WaitShip.getCode()
|| doingOrderDetailResponse.getOrderStatus() == PayOrderStatus.HasReceived.getCode()
|| doingOrderDetailResponse.getOrderStatus() == PayOrderStatus.HasDelive.getCode()
|| doingOrderDetailResponse.getOrderStatus() == PayOrderStatus.RefundDoing.getCode()
|| doingOrderDetailResponse.getOrderStatus() == PayOrderStatus.RefundFail.getCode()
|| doingOrderDetailResponse.getOrderStatus() == PayOrderStatus.Finished.getCode())){
Integer refundNum = imRefundOrderDao.countRefundOrderListByOrderCode(doingOrderDetailResponse.getOrderCode());
if(refundNum.intValue() == doingOrderDetailResponse.getOrder1s().size()){
RefundUnsuccessfulBean entity = new RefundUnsuccessfulBean();
entity.setOrder1Num(doingOrderDetailResponse.getOrder1s().size());
entity.setOrderCode(doingOrderDetailResponse.getOrderCode());
entity.setOrderStatus(doingOrderDetailResponse.getOrderStatus());
entity.setRefundNum(refundNum.intValue());
refundUnsuccessfulBeanList.add(entity);
}
}
}
}
return refundUnsuccessfulBeanList;
}
/**
* 插入退单行明细
*/
......