36dffeef 刘嘉

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

1 个父辈 b4c2c689
......@@ -106,7 +106,27 @@ public interface PineappleDao {
*/
List<CourierCompany> getCourierCompanyByName(Map<String,Object> params);
/**
* 根据订单号查询退货信息
* @param orderSn
* @return
*/
List<MemberProductBack> getMemberProductBackByOrderSn(@Param("orderSn") String orderSn);
/**
* 根据订单号查询换货信息
* @param orderSn
* @return
*/
List<MemberProductExchange> getMemberProductExchangeByOrderSn(@Param("orderSn") String orderSn);
/**
* 根据订单ID查询投诉表
* @param id
* @return
*/
List<SellerComplaint> getSellerComplaintByOrderId(@Param("orderId") Integer id);
}
......
......@@ -310,4 +310,133 @@
from `courier_company`
where company_name LIKE concat('%',#{name},'%') AND seller_id =#{sellerId}
</select>
<!--退货表实体-->
<resultMap id="memberProductBackResult" type="com.sibu.orderHelper.integral.pineapple.model.MemberProductBack">
<result property="id" column="id" />
<result property="sellerId" column="seller_id" />
<result property="sellerName" column="seller_name" />
<result property="orderId" column="order_id" />
<result property="orderSn" column="order_sn" />
<result property="orderProductId" column="order_product_id" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="memberId" column="member_id" />
<result property="memberName" column="member_name" />
<result property="provinceId" column="province_id" />
<result property="cityId" column="city_id" />
<result property="areaId" column="area_id" />
<result property="addressAll" column="address_all" />
<result property="addressInfo" column="address_info" />
<result property="zipCode" column="zip_code" />
<result property="contactPhone" column="contact_phone" />
<result property="contactName" column="contact_name" />
<result property="logisticsId" column="logistics_id" />
<result property="logisticsName" column="logistics_name" />
<result property="logisticsMark" column="logistics_mark" />
<result property="logisticsNumber" column="logistics_number" />
<result property="question" column="question" />
<result property="image" column="image" />
<result property="stateReturn" column="state_return" />
<result property="stateMoney" column="state_money" />
<result property="number" column="number" />
<result property="backMoney" column="back_money" />
<result property="backIntegral" column="back_integral" />
<result property="backIntegralMoney" column="back_integral_money" />
<result property="backCouponUserId" column="back_coupon_user_id" />
<result property="backMoneyTime" column="back_money_time" />
<result property="optId" column="opt_id" />
<result property="optName" column="opt_name" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<!--根据订单号查询换货信息-->
<select id="getMemberProductBackByOrderSn" parameterType="java.lang.String" resultMap="memberProductBackResult">
SELECT * FROM member_product_back WHERE order_sn = #{orderSn} AND state_return IN ('1','2','3','4') ORDER BY create_time
</select>
<!--换货实体类-->
<resultMap id="memberProductExchangeResult" type="com.sibu.orderHelper.integral.pineapple.model.MemberProductExchange">
<result property="id" column="id" />
<result property="sellerId" column="seller_id" />
<result property="sellerName" column="seller_name" />
<result property="orderId" column="order_id" />
<result property="orderSn" column="order_sn" />
<result property="orderProductId" column="order_product_id" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="memberId" column="member_id" />
<result property="memberName" column="member_name" />
<result property="provinceId" column="province_id" />
<result property="cityId" column="city_id" />
<result property="areaId" column="area_id" />
<result property="addressAll" column="address_all" />
<result property="addressInfo" column="address_info" />
<result property="zipCode" column="zip_code" />
<result property="changeName" column="change_name" />
<result property="phone" column="phone" />
<result property="logisticsId" column="logistics_id" />
<result property="logisticsName" column="logistics_name" />
<result property="logisticsMark" column="logistics_mark" />
<result property="logisticsNumber" column="logistics_number" />
<result property="provinceId2" column="province_id2" />
<result property="cityId2" column="city_id2" />
<result property="areaId2" column="area_id2" />
<result property="addressAll2" column="address_all2" />
<result property="addressInfo2" column="address_info2" />
<result property="zipCode2" column="zip_code2" />
<result property="changeName2" column="change_name2" />
<result property="phone2" column="phone2" />
<result property="logisticsId2" column="logistics_id2" />
<result property="logisticsName2" column="logistics_name2" />
<result property="logisticsMark2" column="logistics_mark2" />
<result property="logisticsNumber2" column="logistics_number2" />
<result property="number" column="number" />
<result property="question" column="question" />
<result property="image" column="image" />
<result property="name" column="name" />
<result property="state" column="state" />
<result property="optId" column="opt_id" />
<result property="optName" column="opt_name" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<!--根据订单号查询换货信息-->
<select id="getMemberProductExchangeByOrderSn" parameterType="java.lang.String" resultMap="memberProductExchangeResult">
SELECT * FROM member_product_exchange WHERE order_sn = #{orderSn} AND state IN ('1','2','3','4') ORDER BY create_time
</select>
<!-- 投诉表实体-->
<resultMap id="sellerComplaintResult" type="com.sibu.orderHelper.integral.pineapple.model.SellerComplaint">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="orderId" column="order_id" />
<result property="orderProductId" column="order_product_id" />
<result property="productBackId" column="product_back_id" />
<result property="productExchangeId" column="product_exchange_id" />
<result property="content" column="content" />
<result property="image" column="image" />
<result property="complaintTime" column="complaint_time" />
<result property="sellerId" column="seller_id" />
<result property="sellerComplaintTime" column="seller_complaint_time" />
<result property="sellerCompContent" column="seller_comp_content" />
<result property="sellerCompImage" column="seller_comp_image" />
<result property="state" column="state" />
<result property="optId" column="opt_id" />
<result property="optContent" column="opt_content" />
<result property="userContent" column="user_content" />
<result property="createTime" column="create_time" />
<result property="optTime" column="opt_time" />
</resultMap>
<!-- 根据条件查询投诉表-->
<select id="getSellerComplaintById" parameterType="java.lang.Integer" resultMap="sellerComplaintResult">
SELECT * FROM seller_complaint WHERE order_id = #{orderId} AND state IN (1,3,4) ORDER BY create_time
</select>
</mapper>
\ No newline at end of file
......
......@@ -2,7 +2,9 @@ package com.sibu.orderHelper.enums;
import com.alibaba.druid.util.StringUtils;
import com.sibu.orderHelper.integral.pineapple.enums.MemberProductBackEnum;
import com.sibu.orderHelper.integral.pineapple.enums.OrderStatusEnum;
import com.sibu.orderHelper.integral.pineapple.model.MemberProductBack;
import org.apache.commons.lang3.EnumUtils;
import java.util.ArrayList;
......@@ -15,14 +17,16 @@ import java.util.List;
* @description 菠萝派商城退款验证退款状态举类
*/
public enum PineappleRefundEnum {
JH_01("JH_01", "买家已经申请退款等待卖家同意",Arrays.asList(OrderRefundStatusEnum.WAIT_SELLER_AUDIT.getCode())),
JH_02("JH_02", "卖家已经同意退款等待买家退货", Arrays.asList(OrderRefundStatusEnum.WAIT_CUSTOMER_REFUND_GOODS.getCode(),OrderRefundStatusEnum.AGREE_CHANGE_GOODS.getCode())),
JH_03("JH_03", "买家已经退货等待卖家确认收货",Arrays.asList(OrderRefundStatusEnum.WAIT_SELLER_RECEIVE_GOODS.getCode(),OrderRefundStatusEnum.WAIT_SELLER_AUDIT_RECEIVE_GOODS.getCode())),
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())),
JH_05("JH_05", "退款关闭",new ArrayList<>()),
JH_06("JH_06", "退款成功",Arrays.asList(OrderRefundStatusEnum.SELLER_REFUNDING_MONEY_SUCCESS.getCode())),
JH_01("JH_01", "买家已经申请退款等待卖家同意",Arrays.asList(MemberProductBackEnum.Pending.getCode())),
JH_02("JH_02", "卖家已经同意退款等待买家退货", Arrays.asList(MemberProductBackEnum.AuditSucceess.getCode())),
JH_03("JH_03", "买家已经退货等待卖家确认收货",Arrays.asList(MemberProductBackEnum.MemberDeliver.getCode())),
JH_04("JH_04", "卖家拒绝退款",Arrays.asList()),
JH_05("JH_05", "退款关闭",new ArrayList<>(MemberProductBackEnum.Inattentive.getCode())),
JH_06("JH_06", "退款成功",Arrays.asList()),
JH_07("JH_07", "没有退款",new ArrayList<>()),
JH_99("JH_99", "其他",new ArrayList<>());
JH_99("JH_99", "其他",new ArrayList<>(MemberProductBackEnum.ShopDelivery.getCode()));
private String code; // 错误代码
private String msg; // 错误消息
......
package com.sibu.orderHelper.integral.pineapple.enums;
import com.alibaba.druid.util.StringUtils;
import org.apache.commons.lang3.EnumUtils;
import java.util.List;
/**
* @author LauKa
* @contact a062431@vip.qq.com
* @date 2018/05/15
* @description 新系统退款表状态 1、未处理;2、审核通过;3、用户发货,4、店铺收货;5、不予处理'
*/
public enum MemberProductBackEnum {
Pending(1, "未处理"), AuditSucceess(2, "审核通过"), MemberDeliver(3, "用户发货"),
ShopDelivery(4, "店铺收货"), Inattentive(5, "不予处理");
private int code; // 错误代码
private String msg; // 错误消息
public int getCode() {
return code;
}
public String getMsg() {
return msg;
}
MemberProductBackEnum(int code, String msg) {
this.code = code;
this.msg = msg;
}
public static MemberProductBackEnum valueOf(int code) { // 手写的从int到enum的转换函数
List<MemberProductBackEnum> enums = EnumUtils.getEnumList(MemberProductBackEnum.class);
MemberProductBackEnum result = enums.stream()
.filter(p -> p.getCode() == code)
.findFirst()
.orElse(null);
return result;
}
public static MemberProductBackEnum resolve(String code) {
List<MemberProductBackEnum> enums = EnumUtils.getEnumList(MemberProductBackEnum.class);
MemberProductBackEnum result = enums.stream()
.filter(p -> StringUtils.equalsIgnoreCase(String.valueOf(p.getCode()), code))
.findFirst()
.orElse(null);
return result;
}
}
package com.sibu.orderHelper.integral.pineapple.enums;
import com.alibaba.druid.util.StringUtils;
import org.apache.commons.lang3.EnumUtils;
import java.util.List;
/**
* @author LauKa
* @contact a062431@vip.qq.com
* @date 2018/05/15
* @description 新系统换货表状态 换货状态:1、未处理;2、审核通过;3、用户发回退件;4、商家收到退件;5、商家发出换件;6、原件退还;7、不处理
*/
public enum MemberProductExchangeEnum {
Pending(1, "未处理"), AuditSucceess(2, "审核通过"), MemberDeliver(3, "用户发回退件"),
ShopDelivery(4, "商家收到退件"),ShopExchange(5,"商家发出换件"),ReturnOld(6,"原件退还"), Inattentive(7, "不予处理");
private int code; // 错误代码
private String msg; // 错误消息
public int getCode() {
return code;
}
public String getMsg() {
return msg;
}
MemberProductExchangeEnum(int code, String msg) {
this.code = code;
this.msg = msg;
}
public static MemberProductExchangeEnum valueOf(int code) { // 手写的从int到enum的转换函数
List<MemberProductExchangeEnum> enums = EnumUtils.getEnumList(MemberProductExchangeEnum.class);
MemberProductExchangeEnum result = enums.stream()
.filter(p -> p.getCode() == code)
.findFirst()
.orElse(null);
return result;
}
public static MemberProductExchangeEnum resolve(String code) {
List<MemberProductExchangeEnum> enums = EnumUtils.getEnumList(MemberProductExchangeEnum.class);
MemberProductExchangeEnum result = enums.stream()
.filter(p -> StringUtils.equalsIgnoreCase(String.valueOf(p.getCode()), code))
.findFirst()
.orElse(null);
return result;
}
}
package com.sibu.orderHelper.integral.pineapple.enums;
import com.alibaba.druid.util.StringUtils;
import org.apache.commons.lang3.EnumUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @author lauka
* @date 2018/03/30
* @description 菠萝派商城退款验证换货状态举类
*/
public enum PineappleExchangeEnum {
JH_01("JH_01", "买家已经申请退款等待卖家同意",Arrays.asList(MemberProductExchangeEnum.Pending.getCode())),
JH_02("JH_02", "卖家已经同意退款等待买家退货", Arrays.asList(MemberProductExchangeEnum.AuditSucceess.getCode())),
JH_03("JH_03", "买家已经退货等待卖家确认收货",Arrays.asList(MemberProductExchangeEnum.MemberDeliver.getCode())),
JH_04("JH_04", "卖家拒绝退款",Arrays.asList()),
JH_05("JH_05", "退款关闭",new ArrayList<>(MemberProductExchangeEnum.Inattentive.getCode())),
JH_06("JH_06", "退款成功",Arrays.asList()),
JH_07("JH_07", "没有退款",Arrays.asList(MemberProductExchangeEnum.ReturnOld.getCode(),MemberProductExchangeEnum.ShopExchange.getCode())),
JH_99("JH_99", "其他",new ArrayList<>(MemberProductExchangeEnum.ShopDelivery.getCode()));
private String code; // 错误代码
private String msg; // 错误消息
List<Integer> mallOrderStatus;
PineappleExchangeEnum(String code, String msg, List<Integer> mallOrderStatus) {
this.code = code;
this.msg = msg;
this.mallOrderStatus = mallOrderStatus;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public static PineappleExchangeEnum resolve(String code) {
List<PineappleExchangeEnum> enums = EnumUtils.getEnumList(PineappleExchangeEnum.class);
PineappleExchangeEnum result = enums.stream()
.filter(p -> StringUtils.equalsIgnoreCase(p.code, code))
.findFirst()
.orElse(PineappleExchangeEnum.JH_99);
return result;
}
public static PineappleExchangeEnum resolveByPlatformRefundStatus(Integer platformOrderStatus) {
List<PineappleExchangeEnum> enums = EnumUtils.getEnumList(PineappleExchangeEnum.class);
PineappleExchangeEnum result = enums.stream()
.filter(p -> p.mallOrderStatus != null && p.mallOrderStatus.contains(platformOrderStatus))
.findFirst()
.orElse(PineappleExchangeEnum.JH_99);
return result;
}
}
package com.sibu.orderHelper.integral.pineapple.model;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
@Data
@ToString
public class MemberProductBack implements Serializable{
private java.lang.Integer id;
private java.lang.Integer sellerId;
private java.lang.String sellerName;
private java.lang.Integer orderId;
private java.lang.String orderSn;
private java.lang.Integer orderProductId;
private java.lang.Integer productId;
private java.lang.String productName;
private java.lang.Integer memberId;
private java.lang.String memberName;
private java.lang.Integer provinceId;
private java.lang.Integer cityId;
private java.lang.Integer areaId;
private java.lang.String addressAll;
private java.lang.String addressInfo;
private java.lang.String zipCode;
private java.lang.String contactPhone;
private java.lang.String contactName;
private java.lang.Integer logisticsId;
private java.lang.String logisticsName;
private java.lang.String logisticsMark;
private java.lang.String logisticsNumber;
private java.lang.String question;
private java.lang.String image;
private java.lang.Integer stateReturn;
private java.lang.Integer stateMoney;
private java.lang.Integer number;
private java.math.BigDecimal backMoney;
private java.lang.Integer backIntegral;
private java.math.BigDecimal backIntegralMoney;
private java.lang.Integer backCouponUserId;
private java.util.Date backMoneyTime;
private java.lang.Integer optId;
private java.lang.String optName;
private java.lang.String remark;
private java.util.Date createTime;
private java.util.Date updateTime;
}
package com.sibu.orderHelper.integral.pineapple.model;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
@Data
@ToString
public class MemberProductExchange implements Serializable {
private java.lang.Integer id;
private java.lang.Integer sellerId;
private java.lang.String sellerName;
private java.lang.Integer orderId;
private java.lang.String orderSn;
private java.lang.Integer orderProductId;
private java.lang.Integer productId;
private java.lang.String productName;
private java.lang.Integer memberId;
private java.lang.String memberName;
private java.lang.Integer provinceId;
private java.lang.Integer cityId;
private java.lang.Integer areaId;
private java.lang.String addressAll;
private java.lang.String addressInfo;
private java.lang.String zipCode;
private java.lang.String changeName;
private java.lang.String phone;
private java.lang.Integer logisticsId;
private java.lang.String logisticsName;
private java.lang.String logisticsMark;
private java.lang.String logisticsNumber;
private java.lang.Integer provinceId2;
private java.lang.Integer cityId2;
private java.lang.Integer areaId2;
private java.lang.String addressAll2;
private java.lang.String addressInfo2;
private java.lang.String zipCode2;
private java.lang.String changeName2;
private java.lang.String phone2;
private java.lang.Integer logisticsId2;
private java.lang.String logisticsName2;
private java.lang.String logisticsMark2;
private java.lang.String logisticsNumber2;
private java.lang.Integer number;
private java.lang.String question;
private java.lang.String image;
private java.lang.String name;
private java.lang.Integer state;
private java.lang.Integer optId;
private java.lang.String optName;
private java.lang.String remark;
private java.util.Date createTime;
private java.util.Date updateTime;
}
package com.sibu.orderHelper.integral.pineapple.model;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
@Data
@ToString
public class SellerComplaint implements Serializable {
private java.lang.Integer id; //id
private java.lang.Integer userId; //投诉人ID
private java.lang.String userName; //投诉人账户
private java.lang.Integer orderId; //订单ID
private java.lang.Integer orderProductId; //网单ID
private java.lang.Integer productBackId; //退货管理id,如没有置为0
private java.lang.Integer productExchangeId; //换货管理id,如没有置为0
private java.lang.String content; //投诉内容
private java.lang.String image; //投诉图片
private java.util.Date complaintTime; //投诉时间
private java.lang.Integer sellerId; //投诉商家
private java.util.Date sellerComplaintTime; //商家申诉时间
private java.lang.String sellerCompContent; //商家申诉内容
private java.lang.String sellerCompImage; //商家申诉图片
private java.lang.Integer state; //状态:1、买家投诉待审核;2、买家投诉不通过;3、买家投诉通过;4、卖家申诉待审核;5、卖家申诉不通过;6、卖家申诉通过;
private java.lang.Integer optId; //平台处理人ID
private java.lang.String optContent; //平台处理结果
private java.lang.String userContent; //客户反馈意见
private java.util.Date createTime; //创建时间
private java.util.Date optTime; //处理时间
}
......@@ -8,7 +8,13 @@ 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.MemberProductBackEnum;
import com.sibu.orderHelper.integral.pineapple.enums.PineappleExchangeEnum;
import com.sibu.orderHelper.integral.pineapple.exception.BizException;
import com.sibu.orderHelper.integral.pineapple.model.MemberProductBack;
import com.sibu.orderHelper.integral.pineapple.model.MemberProductExchange;
import com.sibu.orderHelper.integral.pineapple.model.Orders;
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;
......@@ -29,90 +35,75 @@ public class CheckRefundStatusBizServiceImpl extends AbstractBizService<CheckRef
public CheckRefundStatusResponse call(CallRequest<CheckRefundStatusRequest> callRequest) throws Exception {
CheckRefundStatusResponse checkRefundStatusResponse = new CheckRefundStatusResponse();
Map<String,Object> params = new HashMap<>();
params.put("orderCode",callRequest.getBizModel().getOrderID());
List<CheckRefundStatusBean> checkRefundStatusBeanList = new ArrayList<>();
/*
//先判断是否有退款
if(pineappleDao.countCheckRefundStatusResponse(params)>0){
Map<String,Object> map = new HashMap<>();
String redisMysqlDbConfig = "";
Integer dataBaseModule = DbUtil.getOrderInWhichDataBase(callRequest.getBizModel().getOrderID());
String tableIndex = DbUtil.getOrderInWhichTable(callRequest.getBizModel().getOrderID());
map.put("doingOrderTable","im_doing_order_" + tableIndex);
map.put("orderStatus", IMOrderStatus.RefundSuccess);
map.put("orderCode",callRequest.getBizModel().getOrderID());
map.put("supplierId",callRequest.getSupplier().getId());
redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, dataBaseModule.intValue());
DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
//再判断是否有退款成功的(全部退款,部分退款,退款中)
IMDoingOrderBean IMDoingOrderBean = pineappleDao.getIMDoingOrderBean(map);
if(StringUtil.isNull(IMDoingOrderBean)){
log.error(String.format("订单号:%s查询不到该订单数据,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
throw new BizException(String.format("订单号:%s查询不到该订单数据,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
}
//看是否全额退款 查询退款成功
checkRefundStatusBeanList = pineappleDao.childrenrefundStatusBySuccess(IMDoingOrderBean.getOrderCode());
if(PayOrderStatus.RefundSuccess.getCode()== IMDoingOrderBean.getOrderStatus().intValue()) {
if (StringUtil.isNull(checkRefundStatusBeanList) || checkRefundStatusBeanList.isEmpty()) {
log.error(String.format("订单号:%s查询不到退款成功记录,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
throw new BizException(String.format("订单号:%s查询不到退款成功记录,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
}
for (CheckRefundStatusBean bean : checkRefundStatusBeanList) {
bean.setRefundStatusdescription(PineappleRefundEnum.JH_06.getMsg());
bean.setRefundStatus(PineappleRefundEnum.JH_06.getCode());
params.put("orderSn ",callRequest.getBizModel().getOrderID());
params.put("sellerId",callRequest.getSupplier().getId());
Orders orders = pineappleDao.getOrdersByMap(params);
if(StringUtil.isNull(orders)){
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());
//5.如果退货表有记录,退款状态为店铺收货,判断退款金额状态
if(!StringUtil.isNull(memberProductBackList) && !memberProductBackList.isEmpty()){
MemberProductBack memberProductBack = memberProductBackList.stream().findFirst().get();
PineappleRefundEnum refundEnum = PineappleRefundEnum.resolveByPlatformRefundStatus(memberProductBack.getStateReturn());
//不予理会表示没有退款
if(!StringUtil.isNull(refundEnum) && PineappleRefundEnum.JH_05.getCode() != refundEnum.getCode()){
//如果退款状态是店铺收货需要判断该退款信息是否已付款
if(memberProductBack.getStateReturn().intValue() == MemberProductBackEnum.ShopDelivery.getCode()){
if(memberProductBack.getStateMoney() == 1){
checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_99.getCode());
checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_99.getMsg());
checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_99.getMsg());
checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
return checkRefundStatusResponse;
}
}
checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_06.getCode());
checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_06.getMsg());
checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_06.getMsg());
checkRefundStatusResponse.setChildrenrefundStatus(checkRefundStatusBeanList);
checkRefundStatusResponse.setRefundStatus(refundEnum.getCode());
checkRefundStatusResponse.setSubmessage(refundEnum.getMsg());
checkRefundStatusResponse.setRefundStatusdescription(refundEnum.getMsg());
checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
return checkRefundStatusResponse;
}
if(PayOrderStatus.HasReceived.getCode() == IMDoingOrderBean.getOrderStatus().intValue() || PayOrderStatus.HasDelive.getCode() == IMDoingOrderBean.getOrderStatus().intValue()
|| PayOrderStatus.RefundDoing.getCode() == IMDoingOrderBean.getOrderStatus().intValue() ||PayOrderStatus.Finished.getCode() == IMDoingOrderBean.getOrderStatus().intValue() ){
//部分退款
if (!StringUtil.isNull(checkRefundStatusBeanList) && !checkRefundStatusBeanList.isEmpty()) {
for (CheckRefundStatusBean bean : checkRefundStatusBeanList) {
bean.setRefundStatusdescription(PineappleRefundEnum.JH_06.getMsg());
bean.setRefundStatus(PineappleRefundEnum.JH_06.getCode());
}
checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_99.getCode());
checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_99.getMsg());
checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_99.getMsg());
checkRefundStatusResponse.setChildrenrefundStatus(checkRefundStatusBeanList);
checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
return checkRefundStatusResponse;
}else{
checkRefundStatusBeanList = pineappleDao.childrenrefundStatusByCourse(IMDoingOrderBean.getOrderCode());
if(StringUtil.isNull(checkRefundStatusBeanList) || checkRefundStatusBeanList.isEmpty()) {
log.error(String.format("订单号:%s查询不到退款成功记录,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
throw new BizException(String.format("订单号:%s查询不到退款成功记录,请求method:%s,appket:%s", callRequest.getBizModel().getOrderID(), callRequest.getRequest().getMethod(), callRequest.getRequest().getAppkey()));
}
Optional<CheckRefundStatusBean> entity = checkRefundStatusBeanList.stream().findFirst();
checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(entity.get().getRefundStatus())).getCode());
checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(entity.get().getRefundStatus())).getMsg());
checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(entity.get().getRefundStatus())).getMsg());
for (CheckRefundStatusBean bean : checkRefundStatusBeanList) {
bean.setRefundStatusdescription(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(bean.getRefundStatus())).getMsg());
bean.setRefundStatus(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(bean.getRefundStatus())).getCode());
}
checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
checkRefundStatusResponse.setChildrenrefundStatus(checkRefundStatusBeanList);
return checkRefundStatusResponse;
}
}
//2.查询换货表有没有记录
List<MemberProductExchange> memberProductExchangeList = pineappleDao.getMemberProductExchangeByOrderSn(callRequest.getBizModel().getOrderID());
if(!StringUtil.isNull(memberProductExchangeList) && !memberProductExchangeList.isEmpty()){
MemberProductExchange memberProductExchange = memberProductExchangeList.stream().findFirst().get();
if(!StringUtil.isNull(memberProductExchange)){
PineappleExchangeEnum exchangeEnum = PineappleExchangeEnum.resolveByPlatformRefundStatus(memberProductExchange.getState());
checkRefundStatusResponse.setRefundStatus(exchangeEnum.getCode());
checkRefundStatusResponse.setSubmessage(exchangeEnum.getMsg());
checkRefundStatusResponse.setRefundStatusdescription(exchangeEnum.getMsg());
checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
return checkRefundStatusResponse;
}
}
//3.如果都没有记录需要查询seller_complaint(投诉表),根据order_id订单id查询
List<SellerComplaint> sellerComplaintList = pineappleDao.getSellerComplaintByOrderId(orders.getId());
if(!StringUtil.isNull(sellerComplaintList) && !sellerComplaintList.isEmpty()){
checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_99.getCode());
checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_99.getMsg());
checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_99.getMsg());
checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
return checkRefundStatusResponse;
}
checkRefundStatusResponse.setRefundStatus(PineappleRefundEnum.JH_07.getCode());
checkRefundStatusResponse.setSubmessage(PineappleRefundEnum.JH_07.getMsg());
checkRefundStatusResponse.setRefundStatusdescription(PineappleRefundEnum.JH_07.getMsg());
checkRefundStatusResponse.setChildrenrefundStatus(new ArrayList());
checkRefundStatusResponse.setCode(PineappleEnum.SUCCESS.getCode());
checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());*/
checkRefundStatusResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
return checkRefundStatusResponse;
}
......