c40e01b1 刘嘉

菠萝派接口- 检测退款换数据源

1 个父辈 95041489
......@@ -124,7 +124,7 @@ public interface MemberReadDao {
* @param id
* @return
*/
List<SellerComplaint> getSellerComplaintByOrderId(@Param("orderId") Integer id);
List<SellerComplaint> getSellerComplaintById(@Param("orderId") Integer id);
List<Seller> getSeller(@Param("id") String id);
......
......@@ -8,6 +8,7 @@ import com.sibu.orderHelper.enums.*;
import com.sibu.orderHelper.integral.dao.PineappleDao;
import com.sibu.orderHelper.integral.model.CheckRefundStatusBean;
import com.sibu.orderHelper.integral.model.IMDoingOrderBean;
import com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum;
import com.sibu.orderHelper.integral.pineapple.enums.MemberProductBackEnum;
import com.sibu.orderHelper.integral.pineapple.enums.PineappleExchangeEnum;
import com.sibu.orderHelper.integral.pineapple.exception.BizException;
......@@ -18,6 +19,7 @@ import com.sibu.orderHelper.integral.pineapple.model.SellerComplaint;
import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
import com.sibu.orderHelper.integral.reponse.CheckRefundStatusResponse;
import com.sibu.orderHelper.integral.request.CheckRefundStatusRequest;
import com.sibu.orderHelper.mall.member.read.MemberReadDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
......@@ -29,21 +31,25 @@ public class CheckRefundStatusBizServiceImpl extends AbstractBizService<CheckRef
private static Logger log = Logger.getLogger(CheckRefundStatusBizServiceImpl.class);
@Resource
private PineappleDao pineappleDao;
private MemberReadDao memberReadDao;
@Override
public CheckRefundStatusResponse call(CallRequest<CheckRefundStatusRequest> callRequest) throws Exception {
CheckRefundStatusResponse checkRefundStatusResponse = new CheckRefundStatusResponse();
Map<String,Object> params = new HashMap<>();
params.put("orderSn ",callRequest.getBizModel().getOrderID());
params.put("orderSn",callRequest.getBizModel().getOrderID());
params.put("sellerId",callRequest.getSupplier().getId());
Orders orders = pineappleDao.getOrdersByMap(params);
Orders orders = memberReadDao.getOrdersByMap(params);
if(StringUtil.isNull(orders)){
log.error(String.format("修改订单备注,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getOrderID()));
throw new BizException(String.format("修改订单备注,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getOrderID()));
log.error(String.format("检测订单退款,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getOrderID()));
throw new BizException(String.format("检测订单退款,获取订单数据业务异常,订单号:[%s]",callRequest.getBizModel().getOrderID()));
}
if(orders.getOrderState() == EJavaShopOrderStateEnum.RefundFail.getCode()){
log.error(String.format("检测订单退款,该订单已关闭,订单号:[%s]",callRequest.getBizModel().getOrderID()));
throw new BizException(String.format("检测订单退款,该订单已关闭,订单号:[%s]",callRequest.getBizModel().getOrderID()));
}
//1.查询退货表有没有记录
List<MemberProductBack> memberProductBackList= pineappleDao.getMemberProductBackByOrderSn(callRequest.getBizModel().getOrderID());
List<MemberProductBack> memberProductBackList= memberReadDao.getMemberProductBackByOrderSn(callRequest.getBizModel().getOrderID());
//5.如果退货表有记录,退款状态为店铺收货,判断退款金额状态
if(!StringUtil.isNull(memberProductBackList) && !memberProductBackList.isEmpty()){
MemberProductBack memberProductBack = memberProductBackList.stream().findFirst().get();
......@@ -60,6 +66,14 @@ public class CheckRefundStatusBizServiceImpl extends AbstractBizService<CheckRef
checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
return checkRefundStatusResponse;
}else{
checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_06.getCode());
checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_06.getMsg());
checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_06.getMsg());
checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
return checkRefundStatusResponse;
}
}
checkRefundStatusResponse.setRefundStatus(refundEnum.getCode());
......@@ -72,7 +86,7 @@ public class CheckRefundStatusBizServiceImpl extends AbstractBizService<CheckRef
}
}
//2.查询换货表有没有记录
List<MemberProductExchange> memberProductExchangeList = pineappleDao.getMemberProductExchangeByOrderSn(callRequest.getBizModel().getOrderID());
List<MemberProductExchange> memberProductExchangeList = memberReadDao.getMemberProductExchangeByOrderSn(callRequest.getBizModel().getOrderID());
if(!StringUtil.isNull(memberProductExchangeList) && !memberProductExchangeList.isEmpty()){
MemberProductExchange memberProductExchange = memberProductExchangeList.stream().findFirst().get();
if(!StringUtil.isNull(memberProductExchange)){
......@@ -88,7 +102,7 @@ public class CheckRefundStatusBizServiceImpl extends AbstractBizService<CheckRef
}
//3.如果都没有记录需要查询seller_complaint(投诉表),根据order_id订单id查询
List<SellerComplaint> sellerComplaintList = pineappleDao.getSellerComplaintByOrderId(orders.getId());
List<SellerComplaint> sellerComplaintList = memberReadDao.getSellerComplaintById(orders.getId());
if(!StringUtil.isNull(sellerComplaintList) && !sellerComplaintList.isEmpty()){
checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_99.getCode());
checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_99.getMsg());
......