c1eb215e lauka

添加菠萝派退款下载接口

1 个父辈 15888b7f
......@@ -13,7 +13,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources/META-INF/conf" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
......
......@@ -2,9 +2,11 @@ package com.sibu.orderHelper.mall.member.read;
import com.sibu.orderHelper.integral.model.DownloadProductBean;
import com.sibu.orderHelper.integral.model.DownloadProductSkuBean;
import com.sibu.orderHelper.integral.model.GetRefundBean;
import com.sibu.orderHelper.integral.model.IMSupplierApp;
import com.sibu.orderHelper.integral.pineapple.model.*;
import com.sibu.orderHelper.integral.reponse.MemberAddressResponse;
import com.sibu.orderHelper.integral.request.GetRefundRequest;
import com.sibu.orderHelper.integral.request.MemberAddressAddRequest;
import org.apache.ibatis.annotations.Param;
......@@ -128,4 +130,22 @@ public interface MemberReadDao {
List<Seller> getSeller(@Param("id") String id);
/**
* 退款单下载
* @param params
* @return
*/
List<GetRefundBean> getGetRefundBean(Map<String,Object> params);
int countGetGetRefundBean(Map<String,Object> params);
/**
* 查询退款单的订单购买数量
* @param orderProductId
* @return
*/
int countOrderProductNum(@Param("id") String orderProductId);
}
......
......@@ -461,4 +461,63 @@
select * from seller
where `id` = #{id}
</select>
<resultMap id="GetRefundBeanMap" type="com.sibu.orderHelper.integral.model.GetRefundBean">
<result column="member_back_code" property="refundno"/>
<result column="order_sn" property="platorderno"/>
<result column="order_product_id" property="subplatorderno"/>
<result column="back_money" property="refundamount"/>
<result column="create_time" property="createtime"/>
<result column="member_name" property="buyernick"/>
<result column="state_return" property="refundstatus"/>
<result column="state_money" property="stateMoney"/>
<result column="question" property="reason"/>
<result column="product_name" property="productname"/>
<result column="logistics_name" property="logisticname"/>
<result column="logistics_number" property="logisticno"/>
<result column="seller_name" property="sellernick"/>
<result column="money_order" property="totalamount"/>
<result column="order_state" property="orderstatus"/>
<result column="money_order" property="payamount"/>
</resultMap>
<select id="getGetRefundBean" parameterType="java.util.Map" resultMap="GetRefundBeanMap">
SELECT b.member_back_code,b.order_sn,b.order_product_id,b.back_money,b.create_time,b.member_name,
b.state_return,b.state_money,b.question,b.product_name,b.logistics_name,b.logistics_number ,b.seller_name,
o.money_order,o.order_state,o.remark
FROM member_product_back b LEFT JOIN orders o ON b.order_id = o.id
WHERE b.seller_id = #{supplierId}
<if test="beginTime!=null">
AND b.create_time >= #{beginTime}
</if>
<if test="endTime!=null">
<![CDATA[
and b.create_time <= #{endTime}
]]>
</if>
ORDER by member_back_code DESC
limit ${PageIndex}, ${PageSize}
</select>
<select id="countGetGetRefundBean" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT count(*)
FROM member_product_back b
WHERE b.seller_id = #{supplierId}
<if test="beginTime!=null">
AND b.create_time >= #{beginTime}
</if>
<if test="endTime!=null">
<![CDATA[
and b.create_time <= #{endTime}
]]>
</if>
</select>
<select id="countOrderProductNum" resultType="java.lang.Integer">
SELECT number FROM orders_product where id = #{id}
</select>
</mapper>
\ No newline at end of file
......
......@@ -22,9 +22,9 @@ public enum PineappleRefundEnum {
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_06("JH_06", "退款成功",new ArrayList<>(MemberProductBackEnum.ShopDelivery.getCode())),
JH_07("JH_07", "没有退款",new ArrayList<>()),
JH_99("JH_99", "其他",new ArrayList<>(MemberProductBackEnum.ShopDelivery.getCode()));
JH_99("JH_99", "其他",Arrays.asList());
......
package com.sibu.orderHelper.enums;
import com.alibaba.druid.util.StringUtils;
import com.sibu.orderHelper.integral.pineapple.enums.MemberProductBackEnum;
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 PineappleRefundMoneyStateEnum {
NOT_REFUND("1", "未退款",PineappleRefundEnum.JH_99),
REFUND_ACCOUNT("2", "退款到账户", PineappleRefundEnum.JH_06),
REFUND_BANK("3", "退款到银行",PineappleRefundEnum.JH_06),
REFUND_ING("4", "退款中",PineappleRefundEnum.JH_99),
REFUND_ERROR ("5", "退款失败",PineappleRefundEnum.JH_99),
REFUND_UNKNOWN("-1", "未知",PineappleRefundEnum.JH_99),;
private String code; // 错误代码
private String msg; // 错误消息
private PineappleRefundEnum pineappleRefundEnum;
PineappleRefundMoneyStateEnum(String code, String msg, PineappleRefundEnum pineappleRefundEnum) {
this.code = code;
this.msg = msg;
this.pineappleRefundEnum = pineappleRefundEnum;
}
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 PineappleRefundEnum getPineappleRefundEnum() {
return pineappleRefundEnum;
}
public void setPineappleRefundEnum(PineappleRefundEnum pineappleRefundEnum) {
this.pineappleRefundEnum = pineappleRefundEnum;
}
public static PineappleRefundMoneyStateEnum resolveByPlatformRefundStatus(Integer platformOrderStatus) {
List<PineappleRefundMoneyStateEnum> enums = EnumUtils.getEnumList(PineappleRefundMoneyStateEnum.class);
PineappleRefundMoneyStateEnum result = enums.stream()
.filter(p -> p.code.equals(platformOrderStatus))
.findFirst()
.orElse(PineappleRefundMoneyStateEnum.REFUND_UNKNOWN);
return result;
}
}
......@@ -86,6 +86,9 @@ public class GetRefundBean implements Serializable{
//商品外部商家编码
private String outerid;
//退款状态
private Integer stateMoney;
public String getRefundno() {
return refundno;
}
......@@ -285,4 +288,12 @@ public class GetRefundBean implements Serializable{
public void setOuterid(String outerid) {
this.outerid = outerid;
}
public Integer getStateMoney() {
return stateMoney;
}
public void setStateMoney(Integer stateMoney) {
this.stateMoney = stateMoney;
}
}
......
......@@ -166,6 +166,8 @@ public class GetOrderBizServiceImpl extends AbstractBizService<GetOrderRequest>
* 子订单数据
* @param ordersProduct
* @return
*
*
*/
private OrderGoodResponse getOrderGoodResponse(OrdersProduct ordersProduct){
OrderGoodResponse orderGoodResponse = new OrderGoodResponse();
......
......@@ -7,6 +7,7 @@ import com.sibu.orderHelper.common.util.StringUtil;
import com.sibu.orderHelper.enums.PineappleEnum;
import com.sibu.orderHelper.enums.PineappleMethodsEnum;
import com.sibu.orderHelper.enums.PineappleRefundEnum;
import com.sibu.orderHelper.enums.PineappleRefundMoneyStateEnum;
import com.sibu.orderHelper.integral.dao.PineappleDao;
import com.sibu.orderHelper.integral.model.GetRefundBean;
import com.sibu.orderHelper.integral.model.PineappleOderDetailBean;
......@@ -15,6 +16,7 @@ import com.sibu.orderHelper.integral.pineapple.exception.BizException;
import com.sibu.orderHelper.integral.pineapple.request.CallRequest;
import com.sibu.orderHelper.integral.reponse.GetRefundResponse;
import com.sibu.orderHelper.integral.request.GetRefundRequest;
import com.sibu.orderHelper.mall.member.read.MemberReadDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
......@@ -31,20 +33,44 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques
@Resource
private PineappleDao pineappleDao;
@Resource
private MemberReadDao memberReadDao;
@Override
public GetRefundResponse call(CallRequest<GetRefundRequest> callRequest) throws Exception {
/*GetRefundResponse getRefundResponse =new GetRefundResponse();
GetRefundResponse getRefundResponse =new GetRefundResponse();
Map<String,Object> params = new HashMap<>();
params.put("supplierId",callRequest.getSupplier().getId());
params.put("beginTime",callRequest.getBizModel().getBeginTime());
params.put("endTime",callRequest.getBizModel().getEndTime());
params.put("pageNow",(callRequest.getBizModel().getPageIndex()- 1) * callRequest.getBizModel().getPageSize());
params.put("PageIndex",(callRequest.getBizModel().getPageIndex()- 1) * callRequest.getBizModel().getPageSize());
params.put("PageSize",callRequest.getBizModel().getPageSize());
List<GetRefundBean> refundBeanList = pineappleDao.pageGetRefundBean(params);
List<GetRefundBean> refundBeanList = memberReadDao.getGetRefundBean(params);
if(!StringUtil.isNull(refundBeanList) && !refundBeanList.isEmpty()){
for(GetRefundBean getRefundBean:refundBeanList){
int productNum = memberReadDao.countOrderProductNum(getRefundBean.getSubplatorderno());
getRefundBean.setProductnum(productNum);
OrderStatusEnum orderStatusEnum = OrderStatusEnum.resolveByPlatformOrderStatus(Integer.valueOf(getRefundBean.getOrderstatus()));
if(orderStatusEnum.getCode().equals(OrderStatusEnum.UNKNOWN.getCode())){
throw new BizException(String.format("菠萝派退款单下载,枚举查询订单状态报错,订单状态【{0}】转换失败",getRefundBean.getOrderstatus()));
}
getRefundBean.setOrderstatus(orderStatusEnum.getCode());
getRefundBean.setOrderstatusdesc(orderStatusEnum.getMsg());
PineappleRefundEnum pineappleRefundEnum = PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(getRefundBean.getRefundstatus()));
if(pineappleRefundEnum.getCode() == PineappleRefundEnum.JH_06.getCode()){
PineappleRefundMoneyStateEnum pineappleRefundMoneyStateEnum = PineappleRefundMoneyStateEnum.resolveByPlatformRefundStatus(getRefundBean.getStateMoney());
if(pineappleRefundMoneyStateEnum.getCode().equals(PineappleRefundMoneyStateEnum.REFUND_UNKNOWN.getCode())){
throw new BizException(String.format("菠萝派退款单下载,枚举查询退款状态报错,订单状态【{0}】转换失败",getRefundBean.getRefundstatus()));
}
getRefundBean.setRefundstatus(pineappleRefundMoneyStateEnum.getPineappleRefundEnum().getCode());
getRefundBean.setRefundstatusdesc(pineappleRefundMoneyStateEnum.getPineappleRefundEnum().getMsg());
}else{
getRefundBean.setRefundstatus(pineappleRefundEnum.getCode());
getRefundBean.setRefundstatusdesc(pineappleRefundEnum.getMsg());
}
}
/*for(GetRefundBean getRefundBean:refundBeanList){
Map<String,Object> map = new HashMap<>();
String redisMysqlDbConfig = "";
Integer dataBaseModule = DbUtil.getOrderInWhichDataBase(getRefundBean.getPlatorderno());
......@@ -54,7 +80,7 @@ public class GetRefundBizServiceImpl extends AbstractBizService<GetRefundReques
map.put("orderId1",getRefundBean.getSubplatorderno());
redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, dataBaseModule.intValue());
DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源
PineappleOderDetailBean pineappleOderDetailBean = pineappleDao.getOneIMOrderById(map);
PineappleOderDetailBean pineappleOderDetailBean = null;
if(StringUtil.isNull(pineappleOderDetailBean)){
log.error(String.format("订单号:%查询不到该订单信息,请求method:%s,appket:%s",getRefundBean.getSubplatorderno(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey()));
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
getRefundBean.setRefundstatus(PineappleRefundEnum.resolveByPlatformRefundStatus(Integer.valueOf(getRefundBean.getRefundstatus())).getCode());
}
getRefundResponse.setTotalcount(refundBeanList.size());
}*/
getRefundResponse.setTotalcount(memberReadDao.countGetGetRefundBean(params));
}else{
getRefundResponse.setTotalcount(0);
}
getRefundResponse.setRefunds(refundBeanList);
getRefundResponse.setSuccess(true);
getRefundResponse.setCode(PineappleEnum.SUCCESS.getCode());
getRefundResponse.setMessage(PineappleEnum.SUCCESS.getMsg());*/
return null;
getRefundResponse.setMessage(PineappleEnum.SUCCESS.getMsg());
return getRefundResponse;
}
@Override
......