Commit 68f4abaf by 郑云飞 Committed by zhengyunfei

所有退款方式都可以部分退款

部分退款后还可以继续退款
parent a8bae801
...@@ -40,7 +40,6 @@ public class WxController { ...@@ -40,7 +40,6 @@ public class WxController {
} }
/** /**
* 微信支付 * 微信支付
* *
...@@ -65,15 +64,13 @@ public class WxController { ...@@ -65,15 +64,13 @@ public class WxController {
} }
/** /**
* 回调测试 * 回调测试
*/ */
@RequestMapping(value = "/testNotifyOk/{id}", method = RequestMethod.GET) @RequestMapping(value = "/testNotifyOk/{id}", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public String testNotifyOk(@PathVariable Integer id){ public String testNotifyOk(@PathVariable Integer id) {
if(id == null) return null; if (id == null) return null;
this.wxServiceImpl.handleNotifyOk(id); this.wxServiceImpl.handleNotifyOk(id);
...@@ -100,20 +97,17 @@ public class WxController { ...@@ -100,20 +97,17 @@ public class WxController {
@RequestMapping(value = "/wxRefund", method = RequestMethod.POST) @RequestMapping(value = "/wxRefund", method = RequestMethod.POST)
public Result wxRefund(Integer userId, Integer orderId, HttpServletRequest request) { public Result wxRefund(Integer userId, Integer orderId, HttpServletRequest request) {
try { try {
return wxService.wxRefund(userId, orderId,"", request); return wxService.wxRefund(userId, orderId, "", request);
} catch (Exception e) { } catch (Exception e) {
return new Result(103); return new Result(103);
} }
} }
// @RequestMapping(value = "/asd", method = {RequestMethod.POST, RequestMethod.GET}) // @RequestMapping(value = "/asd", method = {RequestMethod.POST, RequestMethod.GET})
// public void asd(String outTradeNo) throws IOException, JDOMException { // public void asd(String outTradeNo) throws IOException, JDOMException {
// wxService.asd(outTradeNo); // wxService.asd(outTradeNo);
// } // }
} }
\ No newline at end of file
...@@ -30,6 +30,8 @@ public class OrderMain { ...@@ -30,6 +30,8 @@ public class OrderMain {
// 关联查询对象: 关联用户表 // 关联查询对象: 关联用户表
@TableField(exist = false) @TableField(exist = false)
private Customer customer; private Customer customer;
@TableField(exist = false)
private OrderRefund orderRefund;
//提交订单校验错误信息 //提交订单校验错误信息
@TableField(exist = false) @TableField(exist = false)
...@@ -76,6 +78,8 @@ public class OrderMain { ...@@ -76,6 +78,8 @@ public class OrderMain {
//数据库字段 //数据库字段
private Integer id; // id主键 private Integer id; // id主键
@TableField(exist = false)
private Integer zid; // id主键
private Integer customerid; // 客户id private Integer customerid; // 客户id
private Integer productid; // 商品id,关联商品信息表id private Integer productid; // 商品id,关联商品信息表id
private Integer addressid;//地址id,关联地址表 private Integer addressid;//地址id,关联地址表
......
package com.yunniu.farming.webadmin.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName(value = "order_refund")
public class OrderRefund implements Serializable {
/**
* id
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 订单主表id
*/
@TableField(value = "order_mian_id")
private Long orderMianId;
/**
* 退款类型(1:仅退款,2退货退款)
*/
@TableField(value = "refund_type")
private String refundType;
/**
* 是否部分退(0是,1否)
*/
@TableField(value = "portion")
private String portion;
/**
* 退款编码
*/
@TableField(value = "refund_code")
private String refundCode;
/**
* 退款状态(1退款申请,2申请通过,3申请拒绝,4待退货,5退款成功,6待退款)
*/
@TableField(value = "refund_status")
private String refundStatus;
/**
* 退款金额
*/
@TableField(value = "refund_money")
private Double refundMoney;
/**
* 退款申请时间
*/
@TableField(value = "refund_time")
private Date refundTime;
/**
* 退款完成时间
*/
@TableField(value = "refund_suc_time")
private Date refundSucTime;
/**
* 退款原因
*/
@TableField(value = "refund_reason")
private String refundReason;
/**
* 退款图片
*/
@TableField(value = "refund_img")
private String refundImg;
/**
* 退款详情
*/
@TableField(value = "refund_detail")
private String refundDetail;
}
\ No newline at end of file
...@@ -43,9 +43,9 @@ public class OrderSub { ...@@ -43,9 +43,9 @@ public class OrderSub {
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
private String sdef1; //自定义项1 退款状态 1申请退款,2申请成功,3申请拒绝,4退款成功 private String sdef1; //自定义项1 退款状态 1申请退款,2申请成功,3申请拒绝,4退款成功
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
private String sdef2; //自定义项2 private String sdef2; //自定义项2 退款成功数量
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
private String sdef3; //自定义项3 private String sdef3; //自定义项3 退款申请中的数量
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
private String sdef4; //自定义项4 private String sdef4; //自定义项4
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
......
...@@ -4,16 +4,11 @@ import com.alibaba.fastjson.JSON; ...@@ -4,16 +4,11 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yunniu.farming.util.StringHelper; import com.yunniu.farming.util.StringHelper;
import com.yunniu.farming.webadmin.dao.GroupBuyDao; import com.yunniu.farming.webadmin.dao.*;
import com.yunniu.farming.webadmin.dao.GroupOrderDao; import com.yunniu.farming.webadmin.model.*;
import com.yunniu.farming.webadmin.dao.OrderMainDao;
import com.yunniu.farming.webadmin.dao.OrderSubDao;
import com.yunniu.farming.webadmin.model.GroupBuy;
import com.yunniu.farming.webadmin.model.GroupOrder;
import com.yunniu.farming.webadmin.model.OrderMain;
import com.yunniu.farming.webadmin.model.OrderSub;
import com.yunniu.farming.webadmin.service.GroupOrderService; import com.yunniu.farming.webadmin.service.GroupOrderService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.aspectj.weaver.ast.Var;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -40,15 +35,18 @@ public class GroupOrderServiceImpl implements GroupOrderService { ...@@ -40,15 +35,18 @@ public class GroupOrderServiceImpl implements GroupOrderService {
private OrderMainDao orderMainDao; private OrderMainDao orderMainDao;
@Autowired @Autowired
private OrderSubDao orderSubDao; private OrderSubDao orderSubDao;
@Autowired
private OrderRefundMapper refundMapper;
/** /**
* 保存团购订单 * 保存团购订单
*
* @param item * @param item
* @return * @return
*/ */
@Override @Override
public GroupOrder addGroupOrder(OrderMain item) { public GroupOrder addGroupOrder(OrderMain item) {
if (item.getAreaId() == null){ if (item.getAreaId() == null) {
throw new RuntimeException("缺少小区id参数"); throw new RuntimeException("缺少小区id参数");
} }
if (item.getGroupBuyId() == null) { if (item.getGroupBuyId() == null) {
...@@ -82,7 +80,7 @@ public class GroupOrderServiceImpl implements GroupOrderService { ...@@ -82,7 +80,7 @@ public class GroupOrderServiceImpl implements GroupOrderService {
order.setCreateTime(new Date()); order.setCreateTime(new Date());
orderDao.insert(order); orderDao.insert(order);
return order; return order;
}else { } else {
groupOrder.setGroupSize(groupOrder.getGroupSize() + 1); groupOrder.setGroupSize(groupOrder.getGroupSize() + 1);
if (Objects.equals(groupOrder.getGroupSize(), groupBuy.getGroupSize())) { if (Objects.equals(groupOrder.getGroupSize(), groupBuy.getGroupSize())) {
groupOrder.setGroupStatus("1"); groupOrder.setGroupStatus("1");
...@@ -94,6 +92,7 @@ public class GroupOrderServiceImpl implements GroupOrderService { ...@@ -94,6 +92,7 @@ public class GroupOrderServiceImpl implements GroupOrderService {
/** /**
* 查询团购订单列表 * 查询团购订单列表
*
* @param item * @param item
* @return * @return
*/ */
...@@ -105,13 +104,14 @@ public class GroupOrderServiceImpl implements GroupOrderService { ...@@ -105,13 +104,14 @@ public class GroupOrderServiceImpl implements GroupOrderService {
/** /**
* 团购订单详情 * 团购订单详情
*
* @param id * @param id
* @return * @return
*/ */
@Override @Override
public GroupOrder findById(Long id) { public GroupOrder findById(Long id) {
GroupOrder order = orderDao.detailById(id); GroupOrder order = orderDao.detailById(id);
if (order.getSuccessTime()!= null) { if (order.getSuccessTime() != null) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
order.setSuccessTimeStr(formatter.format(order.getSuccessTime())); order.setSuccessTimeStr(formatter.format(order.getSuccessTime()));
} }
...@@ -120,6 +120,7 @@ public class GroupOrderServiceImpl implements GroupOrderService { ...@@ -120,6 +120,7 @@ public class GroupOrderServiceImpl implements GroupOrderService {
/** /**
* 团购订单用户信息列表 * 团购订单用户信息列表
*
* @param item * @param item
* @return * @return
*/ */
...@@ -131,6 +132,7 @@ public class GroupOrderServiceImpl implements GroupOrderService { ...@@ -131,6 +132,7 @@ public class GroupOrderServiceImpl implements GroupOrderService {
/** /**
* 购买商品列表 * 购买商品列表
*
* @param item 用户列表id * @param item 用户列表id
* @return * @return
*/ */
...@@ -141,18 +143,28 @@ public class GroupOrderServiceImpl implements GroupOrderService { ...@@ -141,18 +143,28 @@ public class GroupOrderServiceImpl implements GroupOrderService {
/** /**
* 退款回调修改退款状态 * 退款回调修改退款状态
*
* @param outRefundNo * @param outRefundNo
* @return * @return
*/ */
@Override @Override
public boolean updateRefundStatus(String outRefundNo) { public boolean updateRefundStatus(String outRefundNo) {
OrderMain order = orderDao.getBySdef1(outRefundNo); OrderRefund orderRefund = refundMapper.selectOne(Wrappers.<OrderRefund>lambdaQuery()
order.setIrefundstatus(OrderMain.STATUS_REFUND_SUC); .eq(OrderRefund::getRefundCode, outRefundNo)
order.setIstatus(OrderMain.STATUS_COMPLETE); .eq(OrderRefund::getRefundStatus, 6));
int update = orderMainDao.updateById(order); orderRefund.setRefundStatus("5");
int update = refundMapper.updateById(orderRefund);
OrderMain order = orderMainDao.selectById(orderRefund.getOrderMianId());
if (orderRefund.getPortion().equals("1")) {
order.setIrefundstatus(OrderMain.STATUS_REFUND_SUC);
order.setIstatus(OrderMain.STATUS_COMPLETE);
orderMainDao.updateById(order);
}
List<OrderSub> orderSubs = this.orderSubDao.selectList(Wrappers.<OrderSub>lambdaQuery().eq(OrderSub::getMainid, order.getId()).eq(OrderSub::getSdef1, 2)); List<OrderSub> orderSubs = this.orderSubDao.selectList(Wrappers.<OrderSub>lambdaQuery().eq(OrderSub::getMainid, order.getId()).eq(OrderSub::getSdef1, 2));
orderSubs.forEach(sub->{ orderSubs.forEach(sub -> {
sub.setSdef1("4"); sub.setSdef1("4");
sub.setSdef2(sub.getSdef3());
sub.setSdef3("0");
orderSubDao.updateById(sub); orderSubDao.updateById(sub);
}); });
if (update > 0) { if (update > 0) {
...@@ -188,6 +200,7 @@ public class GroupOrderServiceImpl implements GroupOrderService { ...@@ -188,6 +200,7 @@ public class GroupOrderServiceImpl implements GroupOrderService {
/** /**
* 完成 * 完成
*
* @param id * @param id
* @return * @return
*/ */
...@@ -200,6 +213,7 @@ public class GroupOrderServiceImpl implements GroupOrderService { ...@@ -200,6 +213,7 @@ public class GroupOrderServiceImpl implements GroupOrderService {
/** /**
* 支付成功后判断团购订单是否成团 * 支付成功后判断团购订单是否成团
*
* @param curOrder * @param curOrder
*/ */
public void isSuccess(OrderMain curOrder) { public void isSuccess(OrderMain curOrder) {
......
...@@ -2,24 +2,21 @@ package com.yunniu.farming.webadmin.service.impl; ...@@ -2,24 +2,21 @@ package com.yunniu.farming.webadmin.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yunniu.farming.result.Result; import com.yunniu.farming.result.Result;
import com.yunniu.farming.util.DateTools; import com.yunniu.farming.util.DateTools;
import com.yunniu.farming.util.DateUtils; import com.yunniu.farming.util.DateUtils;
import com.yunniu.farming.util.StringHelper; import com.yunniu.farming.util.StringHelper;
import com.yunniu.farming.util.WxPayAppUtils; import com.yunniu.farming.util.WxPayAppUtils;
import com.yunniu.farming.webadmin.dao.CustomerDao; import com.yunniu.farming.webadmin.dao.*;
import com.yunniu.farming.webadmin.dao.IntegralrecDao; import com.yunniu.farming.webadmin.model.*;
import com.yunniu.farming.webadmin.dao.OrderMainDao;
import com.yunniu.farming.webadmin.dao.OrderSubDao;
import com.yunniu.farming.webadmin.model.GroupOrder;
import com.yunniu.farming.webadmin.model.Integralrec;
import com.yunniu.farming.webadmin.model.OrderMain;
import com.yunniu.farming.webadmin.model.OrderSub;
import com.yunniu.farming.webadmin.service.GroupOrderService; import com.yunniu.farming.webadmin.service.GroupOrderService;
import com.yunniu.farming.webadmin.service.WxService; import com.yunniu.farming.webadmin.service.WxService;
import com.yunniu.farming.wx.WxConfigUtil; import com.yunniu.farming.wx.WxConfigUtil;
import lombok.Data;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -40,191 +37,190 @@ import java.util.Map; ...@@ -40,191 +37,190 @@ import java.util.Map;
public class OrderMainServiceImpl { public class OrderMainServiceImpl {
@Autowired @Autowired
private OrderMainDao orderMainDao; private OrderMainDao orderMainDao;
@Autowired @Autowired
private OrderSubDao orderSubDao; private OrderSubDao orderSubDao;
@Autowired @Autowired
private CustomerDao customerDao; private CustomerDao customerDao;
@Autowired @Autowired
private IntegralrecDao integralrecDao; private IntegralrecDao integralrecDao;
@Autowired @Autowired
private GroupOrderService orderService; private GroupOrderService orderService;
@Autowired
private OrderRefundMapper refundMapper;
@Autowired @Autowired
@Lazy @Lazy
private WxService wxService; private WxService wxService;
/** /**
* 分页查询所有数据 * 分页查询所有数据
* @return *
*/ * @return
public List<OrderMain> selectByParamPageList(OrderMain doc) { */
return this.orderMainDao.selectByParamPageList(doc); public List<OrderMain> selectByParamPageList(OrderMain doc) {
} return this.orderMainDao.selectByParamPageList(doc);
}
/** /**
* FRICE TODO 带参 常规查询 * FRICE TODO 带参 常规查询
* */
*/ public List<OrderMain> findByParam(OrderMain doc) {
public List<OrderMain> findByParam(OrderMain doc) { return this.orderMainDao.selectByParam(doc);
return this.orderMainDao.selectByParam(doc); }
}
/** /**
* 根据id删除用户 * 根据id删除用户
* */
*/ public Result deleteByid(int id) {
public Result deleteByid(int id) {
int i = this.orderMainDao.deleteById(id); int i = this.orderMainDao.deleteById(id);
if(i > 0){ if (i > 0) {
return Result.success("删除成功"); return Result.success("删除成功");
} }
return Result.error(); return Result.error();
} }
/** /**
* 按照订单主表ID查找全部数据 * 按照订单主表ID查找全部数据
*/ */
public OrderMain findByid(Integer id) { public OrderMain findByid(Integer id) {
OrderMain u = this.orderMainDao.selectByPrimaryKey(id); OrderMain u = this.orderMainDao.selectByPrimaryKey(id);
return u; return u;
} }
/**
/** * 创建订单
* 创建订单 *
* @return * @return
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public OrderMain addOrder(OrderMain item) { public OrderMain addOrder(OrderMain item) {
if (item.getId() == null) { if (item.getId() == null) {
if (item.getItype() != null && item.getItype().equals(OrderMain.ITYPE_GROUP)){ if (item.getItype() != null && item.getItype().equals(OrderMain.ITYPE_GROUP)) {
GroupOrder order = orderService.addGroupOrder(item); GroupOrder order = orderService.addGroupOrder(item);
item.setGroupOrderId(order.getId()); item.setGroupOrderId(order.getId());
} }
// 单据日期 // 单据日期
item.setSorderdate(DateTools.getDate("yyyy-MM-dd")); item.setSorderdate(DateTools.getDate("yyyy-MM-dd"));
// 提交订单时间 // 提交订单时间
item.setTordertime(DateUtils.getToday().getTime()); item.setTordertime(DateUtils.getToday().getTime());
// 单据编号: 当前系统时间+随机4位数 // 单据编号: 当前系统时间+随机4位数
item.setSorderno(StringHelper.getOrderno()); item.setSorderno(StringHelper.getOrderno());
// 状态初始化 // 状态初始化
if (item.getIpaystatus() == null) { if (item.getIpaystatus() == null) {
item.setIpaystatus(OrderMain.PAY_STATUS_NO);// 未支付 item.setIpaystatus(OrderMain.PAY_STATUS_NO);// 未支付
} }
if (item.getItype() == null) { if (item.getItype() == null) {
item.setItype(OrderMain.ITYPE_TAKE);//外卖订单 item.setItype(OrderMain.ITYPE_TAKE);//外卖订单
} }
item.setIstatus(OrderMain.STATUS_NOPAY);//未付款 item.setIstatus(OrderMain.STATUS_NOPAY);//未付款
item.setIpaytype(10);//微信支付 item.setIpaytype(10);//微信支付
// 1.保存主表信息 // 1.保存主表信息
int i = this.orderMainDao.insert(item); int i = this.orderMainDao.insert(item);
// 2.批量保存订单子表信息
if (item.getSubs() != null && item.getSubs().size() > 0) {
for (OrderSub sub : item.getSubs()) {
sub.setMainid(item.getId());// 添加 主表id
}
// 调用 子表批量保存方法
this.orderSubDao.insertBatch(item.getSubs());
}
}
return item;
}
/**
* 创建订单
* @return
*/
public Result addIntOrder(OrderMain item) {
if(item.getDactscore() == null || item.getDactscore() <= 0){
return Result.error("创建订单失败");
}
if (item.getItype().equals(OrderMain.ITYPE_GROUP)){
GroupOrder order = orderService.addGroupOrder(item);
item.setGroupOrderId(order.getId());
}
// 单据日期
item.setSorderdate(DateTools.getDate("yyyy-MM-dd"));
// 提交订单时间
item.setTordertime(DateUtils.getToday().getTime());
// 单据编号: 当前系统时间+随机4位数
item.setSorderno(StringHelper.getOrderno());
// 状态初始化
if (item.getIpaystatus() == null) {
item.setIpaystatus(OrderMain.PAY_STATUS_NO);// 未支付
}
if (item.getItype() == null) {
item.setItype(OrderMain.ITYPE_TAKE);//外卖订单
}
item.setIstatus(OrderMain.STATUS_NOPAY);//未付款
item.setIpaytype(30);//积分支付 // 2.批量保存订单子表信息
if (item.getSubs() != null && item.getSubs().size() > 0) {
for (OrderSub sub : item.getSubs()) {
sub.setMainid(item.getId());// 添加 主表id
}
// 调用 子表批量保存方法
this.orderSubDao.insertBatch(item.getSubs());
}
}
return item;
}
/**
* 创建订单
*
* @return
*/
public Result addIntOrder(OrderMain item) {
if (item.getDactscore() == null || item.getDactscore() <= 0) {
return Result.error("创建订单失败");
}
// 1.保存主表信息 if (item.getItype().equals(OrderMain.ITYPE_GROUP)) {
int i = this.orderMainDao.insert(item); GroupOrder order = orderService.addGroupOrder(item);
item.setGroupOrderId(order.getId());
}
// 单据日期
item.setSorderdate(DateTools.getDate("yyyy-MM-dd"));
// 提交订单时间
item.setTordertime(DateUtils.getToday().getTime());
// 单据编号: 当前系统时间+随机4位数
item.setSorderno(StringHelper.getOrderno());
// 状态初始化
if (item.getIpaystatus() == null) {
item.setIpaystatus(OrderMain.PAY_STATUS_NO);// 未支付
}
if (item.getItype() == null) {
item.setItype(OrderMain.ITYPE_TAKE);//外卖订单
}
item.setIstatus(OrderMain.STATUS_NOPAY);//未付款
// 2.批量保存订单子表信息 item.setIpaytype(30);//积分支付
if (item.getSubs() != null && item.getSubs().size() > 0) {
for (OrderSub sub : item.getSubs()) {
sub.setMainid(item.getId());// 添加 主表id
}
// 调用 子表批量保存方法
this.orderSubDao.insertBatch(item.getSubs());
}
return Result.success(item); // 1.保存主表信息
} int i = this.orderMainDao.insert(item);
// 2.批量保存订单子表信息
if (item.getSubs() != null && item.getSubs().size() > 0) {
for (OrderSub sub : item.getSubs()) {
sub.setMainid(item.getId());// 添加 主表id
}
// 调用 子表批量保存方法
this.orderSubDao.insertBatch(item.getSubs());
}
return Result.success(item);
}
/** /**
* @编辑 * @编辑
*/ */
public Result update(OrderMain doc) { public Result update(OrderMain doc) {
if (doc.getId() == null) return Result.error(); if (doc.getId() == null) return Result.error();
OrderMain orderMain = this.orderMainDao.selectById(doc.getId()); OrderMain orderMain = this.orderMainDao.selectById(doc.getId());
if (orderMain == null){ if (orderMain == null) {
return Result.error("订单信息不存在"); return Result.error("订单信息不存在");
} }
//判断用户积分是否足够 //判断用户积分是否足够
if(doc.getDactscore() != null){ if (doc.getDactscore() != null) {
// 查询该用户的积分 // 查询该用户的积分
Integralrec integralrec = new Integralrec(); Integralrec integralrec = new Integralrec();
integralrec.setCustomerid(orderMain.getCustomerid()); integralrec.setCustomerid(orderMain.getCustomerid());
Double aDouble = this.integralrecDao.sumIntegral(integralrec); Double aDouble = this.integralrecDao.sumIntegral(integralrec);
if(aDouble == null || aDouble < 0) return Result.error("用户积分不足"); if (aDouble == null || aDouble < 0) return Result.error("用户积分不足");
// 用户收入积分减去支付积分要大于订单积分价格 // 用户收入积分减去支付积分要大于订单积分价格
// 用户余额要大于支付额 // 用户余额要大于支付额
if((aDouble!=null ? aDouble : 0) < doc.getDactscore()) { if ((aDouble != null ? aDouble : 0) < doc.getDactscore()) {
return Result.error("积分不足"); return Result.error("积分不足");
} }
...@@ -232,7 +228,7 @@ public class OrderMainServiceImpl { ...@@ -232,7 +228,7 @@ public class OrderMainServiceImpl {
int i = this.orderMainDao.updateById(doc); int i = this.orderMainDao.updateById(doc);
if(i > 0){ if (i > 0) {
return Result.success("修改成功"); return Result.success("修改成功");
} }
...@@ -241,143 +237,154 @@ public class OrderMainServiceImpl { ...@@ -241,143 +237,154 @@ public class OrderMainServiceImpl {
} }
//根据多参数查询订单数量 //根据多参数查询订单数量
public int findOrderNum(OrderMain orderMain) { public int findOrderNum(OrderMain orderMain) {
return orderMainDao.countOrderNum(orderMain); return orderMainDao.countOrderNum(orderMain);
} }
//根据多参数查询订单金额 //根据多参数查询订单金额
public Double findOrderMoney(OrderMain orderMain) { public Double findOrderMoney(OrderMain orderMain) {
return orderMainDao.countOrderMoney(orderMain); return orderMainDao.countOrderMoney(orderMain);
} }
//更改订单服务中 //更改订单服务中
public Result updateFwStatus(OrderMain order) { public Result updateFwStatus(OrderMain order) {
if(order.getId() == null){ if (order.getId() == null) {
return Result.error(); return Result.error();
} }
//待收货 //待收货
order.setIstatus(OrderMain.STATUS_WAITING); order.setIstatus(OrderMain.STATUS_WAITING);
this.orderMainDao.updateById(order); this.orderMainDao.updateById(order);
return Result.success(); return Result.success();
} }
//更改订单已完成 //更改订单已完成
public Result updateOkStatus(OrderMain order) { public Result updateOkStatus(OrderMain order) {
if(order.getId() == null){ if (order.getId() == null) {
return Result.error(); return Result.error();
} }
//已完成 //已完成
order.setIstatus(OrderMain.STATUS_COMPLETE); order.setIstatus(OrderMain.STATUS_COMPLETE);
//完成时间 //完成时间
order.setTovertime(new Date()); order.setTovertime(new Date());
this.orderMainDao.updateById(order); this.orderMainDao.updateById(order);
return Result.success("成功"); return Result.success("成功");
} }
/** /**
* 更改订单退款申请通过 * 更改订单退款申请通过
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Result refundApplicationPass(OrderMain order) { public Result refundApplicationPass(OrderMain order) {
if(order.getId() == null){ if (order.getId() == null) {
return Result.error(); return Result.error();
} }
OrderMain orderMain = this.orderMainDao.selectById(order.getId()); // OrderMain orderMain = this.orderMainDao.selectById(order.getId());
if (orderMain.getIrefundstatus().equals(OrderMain.STATUS_REFUND_ONLY)) { OrderRefund orderRefund = refundMapper.selectOne(Wrappers.<OrderRefund>lambdaQuery()
this.refundReceive(orderMain); .eq(OrderRefund::getOrderMianId, order.getId())
} else { .eq(OrderRefund::getRefundStatus, 1));
orderMain.setIrefundstatus(OrderMain.STATUS_RETURN_GOODS); if (orderRefund.getRefundType().equals("1")) {
this.orderMainDao.updateById(orderMain); this.refundReceive(order);
List<OrderSub> orderSubs = this.orderSubDao.selectList(Wrappers.<OrderSub>lambdaQuery().eq(OrderSub::getMainid, order.getId()).eq(OrderSub::getSdef1, 1)); } else {
orderSubs.forEach(sub->{ orderRefund.setRefundStatus("4");
sub.setSdef1("2"); refundMapper.updateById(orderRefund);
orderSubDao.updateById(sub); List<OrderSub> orderSubs = this.orderSubDao.selectList(Wrappers.<OrderSub>lambdaQuery().eq(OrderSub::getMainid, order.getId()).eq(OrderSub::getSdef1, 1));
}); orderSubs.forEach(sub -> {
} sub.setSdef1("2");
return Result.success("成功"); orderSubDao.updateById(sub);
} });
}
/** return Result.success("成功");
* 更改订单退款申请拒绝 }
*/
@Transactional(rollbackFor = Exception.class) /**
public Result refundApplicationRefuse(OrderMain order) { * 更改订单退款申请拒绝
if(order.getId() == null){ */
return Result.error(); @Transactional(rollbackFor = Exception.class)
} public Result refundApplicationRefuse(OrderMain order) {
order.setIrefundstatus(OrderMain.STATUS_REFUND_REFUSE); if (order.getId() == null) {
this.orderMainDao.updateById(order); return Result.error();
List<OrderSub> orderSubs = this.orderSubDao.selectList(Wrappers.<OrderSub>lambdaQuery().eq(OrderSub::getMainid, order.getId()).eq(OrderSub::getSdef1, 1)); }
orderSubs.forEach(sub->{ order.setIrefundstatus(OrderMain.STATUS_REFUND_REFUSE);
sub.setSdef1("3"); this.orderMainDao.updateById(order);
orderSubDao.updateById(sub); OrderRefund orderRefund = refundMapper.selectOne(Wrappers.<OrderRefund>lambdaQuery()
}); .eq(OrderRefund::getOrderMianId, order.getId())
return Result.success("成功"); .eq(OrderRefund::getRefundStatus, 1));
} orderRefund.setRefundStatus("3");
refundMapper.updateById(orderRefund);
/** List<OrderSub> orderSubs = this.orderSubDao.selectList(Wrappers.<OrderSub>lambdaQuery().eq(OrderSub::getMainid, order.getId()).eq(OrderSub::getSdef1, 1));
* 已收到退回货物,开始退款 orderSubs.forEach(sub -> {
* @param order sub.setSdef1("3");
* @return sub.setSdef3("0");
*/ orderSubDao.updateById(sub);
@Transactional(rollbackFor = Exception.class) });
public Result refundReceive(OrderMain order) { return Result.success("成功");
// 根据id获取订单信息 }
OrderMain orderMain = this.orderMainDao.selectById(order.getId());
orderMain.setIrefundstatus(OrderMain.STATUS_REFUND);
this.orderMainDao.updateById(orderMain);
log.info("收货成功,开始退款:{}", JSON.toJSONString(orderMain));
try {
wxService.wxRefund(orderMain.getCustomerid(), orderMain.getId(), "用户申请退款", null);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
return Result.success("成功");
}
@Transactional(rollbackFor = Exception.class)
public Result cancelOrder(OrderMain order) {
if(order.getId() == null){
return Result.error();
}
/**
* 已收到退回货物,开始退款
*
* @param order
* @return
*/
@Transactional(rollbackFor = Exception.class)
public Result refundReceive(OrderMain order) {
// 根据id获取订单信息
OrderMain orderMain = this.orderMainDao.selectById(order.getId()); OrderMain orderMain = this.orderMainDao.selectById(order.getId());
OrderRefund orderRefund = refundMapper.selectOne(Wrappers.<OrderRefund>lambdaQuery()
.eq(OrderRefund::getOrderMianId, order.getId())
.eq(OrderRefund::getRefundStatus, 1));
orderRefund.setRefundStatus("6");
refundMapper.updateById(orderRefund);
this.orderMainDao.updateById(orderMain);
log.info("收货成功,开始退款:{}", JSON.toJSONString(orderMain));
try {
wxService.wxRefund(orderMain.getCustomerid(), orderMain.getId(), "用户申请退款", null);
} catch (Exception e) {
throw new RuntimeException(e.getMessage());
}
return Result.success("成功");
}
//已支付订单 无法取消 @Transactional(rollbackFor = Exception.class)
if(orderMain.getIpaystatus().equals(OrderMain.PAY_STATUS_OK)){ public Result cancelOrder(OrderMain order) {
try {
wxService.wxRefund(orderMain.getCustomerid(), orderMain.getId(), "用户申请退款", null); if (order.getId() == null) {
} catch (Exception e) { return Result.error();
throw new RuntimeException(e);
}
} }
//已取消 OrderMain orderMain = this.orderMainDao.selectById(order.getId());
order.setIstatus(OrderMain.STATUS_CANCEL);
this.orderMainDao.updateById(order); //已支付订单 无法取消
if (orderMain.getIpaystatus().equals(OrderMain.PAY_STATUS_OK)) {
try {
wxService.wxRefund(orderMain.getCustomerid(), orderMain.getId(), "用户申请退款", null);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return Result.success("成功"); //已取消
order.setIstatus(OrderMain.STATUS_CANCEL);
} this.orderMainDao.updateById(order);
return Result.success("成功");
}
//app支付 //app支付
...@@ -387,7 +394,7 @@ public class OrderMainServiceImpl { ...@@ -387,7 +394,7 @@ public class OrderMainServiceImpl {
return new Result(102); return new Result(102);
} }
//商品名称封装 //商品名称封装
String prodNames = "Q&A."+order.getSorderno(); String prodNames = "Q&A." + order.getSorderno();
DecimalFormat decimalFormat = new DecimalFormat("###################"); DecimalFormat decimalFormat = new DecimalFormat("###################");
...@@ -406,8 +413,8 @@ public class OrderMainServiceImpl { ...@@ -406,8 +413,8 @@ public class OrderMainServiceImpl {
//将订单信息也返回页面 //将订单信息也返回页面
Map<String, Object> mr = new HashMap<String, Object>(); Map<String, Object> mr = new HashMap<String, Object>();
mr.put("order_id", order.getId()); mr.put("order_id", order.getId());
mr.put("result_code",wxPayData.get("result_code")); mr.put("result_code", wxPayData.get("result_code"));
//将状态码属性移除 //将状态码属性移除
wxPayData.remove("result_code"); wxPayData.remove("result_code");
...@@ -419,187 +426,214 @@ public class OrderMainServiceImpl { ...@@ -419,187 +426,214 @@ public class OrderMainServiceImpl {
} }
//商品 订单逻辑处理
protected void handleCommProuctOrder(OrderMain co) {
//商品 订单逻辑处理 if (co == null) return;
protected void handleCommProuctOrder(OrderMain co) {
if(co == null) return;
// 支付回调标志,防止 多次回调 // 支付回调标志,防止 多次回调
if (StringUtils.isEmpty(co.getSdef4())) { if (StringUtils.isEmpty(co.getSdef4())) {
//支会回调标志 //支会回调标志
co.setIstatus(OrderMain.STATUS_WAITING);//待收货 co.setIstatus(OrderMain.STATUS_WAITING);//待收货
co.setIpaystatus(OrderMain.PAY_STATUS_OK);//支付成功 co.setIpaystatus(OrderMain.PAY_STATUS_OK);//支付成功
co.setTpaytime(new Date());//支付时间 co.setTpaytime(new Date());//支付时间
co.setSdef4("1"); co.setSdef4("1");
this.update(co); this.update(co);
//判断是否 有抵扣的积分 //判断是否 有抵扣的积分
if(co.getDactscore() != null && co.getDactscore() > 0) { if (co.getDactscore() != null && co.getDactscore() > 0) {
//扣除用户抵扣所用的积分 //扣除用户抵扣所用的积分
Integralrec integralrec = new Integralrec(); Integralrec integralrec = new Integralrec();
integralrec.setDexpend(co.getDactscore()); integralrec.setDexpend(co.getDactscore());
integralrec.setOrderid(co.getId()); integralrec.setOrderid(co.getId());
integralrec.setCustomerid(co.getCustomerid()); integralrec.setCustomerid(co.getCustomerid());
integralrec.setItype(Integralrec.INTEGRALREC_ORDOUT);//下单抵扣 integralrec.setItype(Integralrec.INTEGRALREC_ORDOUT);//下单抵扣
integralrec.setSdesc("下单抵扣"); integralrec.setSdesc("下单抵扣");
integralrec.setSoprdate(DateTools.getDate("yyyy-MM-dd")); integralrec.setSoprdate(DateTools.getDate("yyyy-MM-dd"));
integralrec.setToprtime(new Date()); integralrec.setToprtime(new Date());
integralrecDao.insertSelective(integralrec); integralrecDao.insertSelective(integralrec);
} }
//奖励用户下单返利积分 1元= 10积分 //奖励用户下单返利积分 1元= 10积分
if(co.getDactmoney() != null && co.getDactmoney() > 0) { if (co.getDactmoney() != null && co.getDactmoney() > 0) {
//保留整数位 //保留整数位
double floor = Math.floor(co.getDactmoney()); double floor = Math.floor(co.getDactmoney());
double dincome = floor * 10; double dincome = floor * 10;
if(dincome > 0){ if (dincome > 0) {
//增加积分收入记录 //增加积分收入记录
Integralrec inte = new Integralrec(); Integralrec inte = new Integralrec();
inte.setDincome(dincome); inte.setDincome(dincome);
inte.setOrderid(co.getId()); inte.setOrderid(co.getId());
inte.setCustomerid(co.getCustomerid()); inte.setCustomerid(co.getCustomerid());
inte.setItype(Integralrec.INTEGRALREC_NEWORD);//下单返利 inte.setItype(Integralrec.INTEGRALREC_NEWORD);//下单返利
inte.setSdesc("下单返利"); inte.setSdesc("下单返利");
inte.setSoprdate(DateTools.getDate("yyyy-MM-dd")); inte.setSoprdate(DateTools.getDate("yyyy-MM-dd"));
inte.setToprtime(new Date()); inte.setToprtime(new Date());
integralrecDao.insertSelective(inte); integralrecDao.insertSelective(inte);
} }
} }
} }
} }
//积分支付 //积分支付
public Result integralPay(Integer userId,Integer orderId) { public Result integralPay(Integer userId, Integer orderId) {
OrderMain ord = orderMainDao.selectByPrimaryKey(orderId); OrderMain ord = orderMainDao.selectByPrimaryKey(orderId);
if (ord == null || !ord.getCustomerid().equals(userId)) { if (ord == null || !ord.getCustomerid().equals(userId)) {
return Result.error("订单参数错误"); return Result.error("订单参数错误");
} }
//积分金额 //积分金额
if(ord.getDactscore() == null){ if (ord.getDactscore() == null) {
return Result.error("订单参数错误"); return Result.error("订单参数错误");
} }
//支付状态 //支付状态
if(!ord.getIpaystatus().equals(OrderMain.PAY_STATUS_NO)){ if (!ord.getIpaystatus().equals(OrderMain.PAY_STATUS_NO)) {
return Result.error("订单参数错误"); return Result.error("订单参数错误");
} }
//订单状态 //订单状态
if(!ord.getIstatus().equals(OrderMain.STATUS_NOPAY)){ if (!ord.getIstatus().equals(OrderMain.STATUS_NOPAY)) {
return Result.error("订单参数错误"); return Result.error("订单参数错误");
} }
//判断用户积分是否足够 //判断用户积分是否足够
// 查询该用户的积分 // 查询该用户的积分
Integralrec inte = new Integralrec(); Integralrec inte = new Integralrec();
inte.setCustomerid(ord.getCustomerid()); inte.setCustomerid(ord.getCustomerid());
Double inteNum = this.integralrecDao.sumIntegral(inte); Double inteNum = this.integralrecDao.sumIntegral(inte);
if(inteNum == null || inteNum < 0) return Result.error("积分不足,无法支付"); if (inteNum == null || inteNum < 0) return Result.error("积分不足,无法支付");
// 用户收入积分减去支付积分要大于订单积分价格 // 用户收入积分减去支付积分要大于订单积分价格
if((inteNum!=null ? inteNum : 0) < ord.getDactscore()) { if ((inteNum != null ? inteNum : 0) < ord.getDactscore()) {
return Result.error("积分不足,无法支付"); return Result.error("积分不足,无法支付");
} }
//扣除用户积分 //扣除用户积分
Integralrec integralrec = new Integralrec(); Integralrec integralrec = new Integralrec();
integralrec.setOrderid(orderId); integralrec.setOrderid(orderId);
integralrec.setItype(Integralrec.INTEGRALREC_DUIPRO); integralrec.setItype(Integralrec.INTEGRALREC_DUIPRO);
integralrec.setDexpend(ord.getDactscore()); integralrec.setDexpend(ord.getDactscore());
integralrec.setCustomerid(userId); integralrec.setCustomerid(userId);
integralrec.setSdesc("兑换商品"); integralrec.setSdesc("兑换商品");
integralrec.setSoprdate(DateTools.getDate("yyyy-MM-dd")); integralrec.setSoprdate(DateTools.getDate("yyyy-MM-dd"));
integralrec.setToprtime(new Date()); integralrec.setToprtime(new Date());
int res = integralrecDao.insert(integralrec); int res = integralrecDao.insert(integralrec);
if (res <= 0){ if (res <= 0) {
return Result.success("支付失败"); return Result.success("支付失败");
} }
//改变订单状态 //改变订单状态
//待发货 //待发货
ord.setIstatus(OrderMain.STATUS_YESPAY); ord.setIstatus(OrderMain.STATUS_YESPAY);
//已支付 //已支付
ord.setIpaystatus(OrderMain.FLAG_Y); ord.setIpaystatus(OrderMain.FLAG_Y);
//支付时间 //支付时间
ord.setTpaytime(new Date());//支付时间 ord.setTpaytime(new Date());//支付时间
this.orderMainDao.updateById(ord); this.orderMainDao.updateById(ord);
return Result.success("支付成功"); return Result.success("支付成功");
} }
/** /**
* 获取用户最后一次填写的地址信息 * 获取用户最后一次填写的地址信息
* *
* @param userId 用户id * @param userId 用户id
* @return * @return
*/ */
public Result getLastOrderAddres(Integer userId) { public Result getLastOrderAddres(Integer userId) {
return Result.success(this.orderMainDao.getLastOrderAddres(userId)); return Result.success(this.orderMainDao.getLastOrderAddres(userId));
} }
/** /**
* 申请退款 * 申请退款
* *
* @param order * @param order
* @param ids * @param ids
* @return * @return
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Result refundOrder(OrderMain order, JSONArray ids) { public Result refundOrder(OrderMain order, JSONArray ids) {
OrderMain orderMain = this.orderMainDao.selectById(order.getId()); OrderMain orderMain = this.orderMainDao.selectById(order.getId());
orderMain.setSrefundreason(order.getSrefundreason()); // orderMain.setSrefundreason(order.getSrefundreason());
orderMain.setSrefundpic(order.getSrefundpic()); // orderMain.setSrefundpic(order.getSrefundpic());
orderMain.setIrefundstatus(order.getIrefundstatus()); // orderMain.setIrefundstatus(order.getIrefundstatus());
Double refundmoney = Double.valueOf(0.0); OrderRefund orderRefund = new OrderRefund();
if (CollectionUtils.isNotEmpty(ids)) { Double refundmoney = Double.valueOf(0.0);
List<OrderSub> orderSubs = this.orderSubDao.selectList(Wrappers.<OrderSub>lambdaQuery().eq(OrderSub::getMainid, order.getId()).in(OrderSub::getId, ids)); if (CollectionUtils.isNotEmpty(ids)) {
for (OrderSub sub : orderSubs) { List<JSONObject> objects = JSON.parseArray(ids.toJSONString(), JSONObject.class);
sub.setSdef1("1"); List<OrderSub> orderSubs = this.orderSubDao.selectList(Wrappers.<OrderSub>lambdaQuery().eq(OrderSub::getMainid, order.getId()));
refundmoney = refundmoney + sub.getDprosum(); for (JSONObject id : objects) {
this.orderSubDao.updateById(sub); int num = (int) id.get("num");
} OrderSub sub = orderSubs.stream().filter(orderSub -> orderSub.getId().equals(id.get("id")) ).findAny().get();
}else { if (ObjectUtils.isNotEmpty(sub)) {
refundmoney = orderMain.getDactmoney(); if ((sub.getIpronum() - (sub.getSdef3() != null ? Integer.parseInt(sub.getSdef3()) : 0)) < num) {
} return Result.error("退款数量不能大于购买数量");
orderMain.setIrefundmoney(refundmoney); }
this.orderMainDao.updateById(orderMain); if (sub.getIpronum() > num) {
return Result.success("成功"); orderRefund.setPortion("0");
} } else {
orderRefund.setPortion("1");
public List<OrderMain> selectByParamPageRefundGroupList(OrderMain item) { }
return this.orderMainDao.selectByParamPageRefundGroupList(item); sub.setSdef1("1");
} sub.setSdef3(((sub.getSdef3() != null ? Integer.parseInt(sub.getSdef3()) : 0) + num) + "");
refundmoney = refundmoney + (sub.getSgoodprice() * num);
public Result saveCourierNumber(OrderMain order) { this.orderSubDao.updateById(sub);
OrderMain orderMain = this.orderMainDao.selectById(order.getId()); }
orderMain.setIrefundstatus(OrderMain.STATUS_REFUND); }
orderMain.setCouriernumber(order.getCouriernumber()); if (orderSubs.size() > ids.size()) {
this.orderMainDao.updateById(orderMain); orderRefund.setPortion("0");
return Result.success("成功"); }
} } else {
refundmoney = orderMain.getDactmoney();
/** }
* 仅退款 orderRefund.setOrderMianId(Long.valueOf(orderMain.getId()));
* @param order orderRefund.setRefundDetail(ids.toJSONString());
* @return orderRefund.setRefundMoney(refundmoney);
*/ orderRefund.setRefundReason(order.getSrefundreason());
public Result refundOnly(OrderMain order) { orderRefund.setRefundImg(order.getSrefundpic());
OrderMain orderMain = this.orderMainDao.selectById(order.getId()); orderRefund.setRefundTime(new Date());
orderMain.setIrefundstatus(OrderMain.STATUS_REFUND_ONLY); orderRefund.setRefundType(order.getIrefundstatus() == 106 ? "1" : "2");
this.orderMainDao.updateById(orderMain); orderRefund.setRefundStatus("1");
return Result.success("成功"); refundMapper.insert(orderRefund);
} // orderMain.setIrefundmoney(refundmoney);
// this.orderMainDao.updateById(orderMain);
return Result.success("成功");
}
public List<OrderMain> selectByParamPageRefundGroupList(OrderMain item) {
return this.orderMainDao.selectByParamPageRefundGroupList(item);
}
public Result saveCourierNumber(OrderMain order) {
OrderMain orderMain = this.orderMainDao.selectById(order.getId());
orderMain.setIrefundstatus(OrderMain.STATUS_REFUND);
orderMain.setCouriernumber(order.getCouriernumber());
this.orderMainDao.updateById(orderMain);
return Result.success("成功");
}
/**
* 仅退款
*
* @param order
* @return
*/
public Result refundOnly(OrderMain order) {
OrderMain orderMain = this.orderMainDao.selectById(order.getId());
orderMain.setIrefundstatus(OrderMain.STATUS_REFUND_ONLY);
this.orderMainDao.updateById(orderMain);
return Result.success("成功");
}
} }
...@@ -2,11 +2,9 @@ package com.yunniu.farming.webadmin.service.impl; ...@@ -2,11 +2,9 @@ package com.yunniu.farming.webadmin.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yunniu.farming.util.*; import com.yunniu.farming.util.*;
import com.yunniu.farming.webadmin.dao.CustomerDao; import com.yunniu.farming.webadmin.dao.*;
import com.yunniu.farming.webadmin.dao.GroupBuyDao;
import com.yunniu.farming.webadmin.dao.IntegralrecDao;
import com.yunniu.farming.webadmin.dao.OrderMainDao;
import com.yunniu.farming.webadmin.model.*; import com.yunniu.farming.webadmin.model.*;
import com.yunniu.farming.webadmin.service.WxService; import com.yunniu.farming.webadmin.service.WxService;
import com.yunniu.farming.wx.WxConfigUtil; import com.yunniu.farming.wx.WxConfigUtil;
...@@ -49,6 +47,9 @@ public class WxServiceImpl implements WxService { ...@@ -49,6 +47,9 @@ public class WxServiceImpl implements WxService {
@Autowired @Autowired
private GroupBuyDao groupBuyDao; private GroupBuyDao groupBuyDao;
@Autowired
private OrderRefundMapper refundMapper;
private String[] imageUrl = {"https://yuezhi-1314984551.cos.ap-shanghai.myqcloud.com/register/41e98a7cc2834450b41927219197d713.jpeg" private String[] imageUrl = {"https://yuezhi-1314984551.cos.ap-shanghai.myqcloud.com/register/41e98a7cc2834450b41927219197d713.jpeg"
, "https://yuezhi-1314984551.cos.ap-shanghai.myqcloud.com/register/65daa7ab2a9c46c99a580874c73465e3.jpeg" , "https://yuezhi-1314984551.cos.ap-shanghai.myqcloud.com/register/65daa7ab2a9c46c99a580874c73465e3.jpeg"
, "https://yuezhi-1314984551.cos.ap-shanghai.myqcloud.com/register/056bb47d0b274ab7b430ddd522b18ee3.jpeg" , "https://yuezhi-1314984551.cos.ap-shanghai.myqcloud.com/register/056bb47d0b274ab7b430ddd522b18ee3.jpeg"
...@@ -243,9 +244,14 @@ public class WxServiceImpl implements WxService { ...@@ -243,9 +244,14 @@ public class WxServiceImpl implements WxService {
order.setSrefundreason(srefundreason); // 退款理由 order.setSrefundreason(srefundreason); // 退款理由
order.setIrefundstatus(OrderMain.STATUS_CANCEL); order.setIrefundstatus(OrderMain.STATUS_CANCEL);
} }
order.setTrefundtime(new Date()); // order.setTrefundtime(new Date());
order.setRefundorderno(StringHelper.getOrderno()); // order.setRefundorderno(StringHelper.getOrderno());
orderMainDao.updateById(order); // orderMainDao.updateById(order);
OrderRefund refund = refundMapper.selectOne(Wrappers.<OrderRefund>lambdaQuery()
.eq(OrderRefund::getOrderMianId, order.getId())
.eq(OrderRefund::getRefundStatus, 6));
refund.setRefundCode(StringHelper.getOrderno());
refundMapper.updateById(refund);
double tradeMoney = order.getDactmoney(); double tradeMoney = order.getDactmoney();
DecimalFormat decimalFormat = new DecimalFormat("###################"); DecimalFormat decimalFormat = new DecimalFormat("###################");
...@@ -257,15 +263,15 @@ public class WxServiceImpl implements WxService { ...@@ -257,15 +263,15 @@ public class WxServiceImpl implements WxService {
parameters.put("out_trade_no", order.getSorderno()); // 商户订单号 parameters.put("out_trade_no", order.getSorderno()); // 商户订单号
parameters.put("refund_fee_type", "CNY"); // 默认人民币:CNY parameters.put("refund_fee_type", "CNY"); // 默认人民币:CNY
parameters.put("total_fee", decimalFormat.format(tradeMoney * 100)); // 订单总金额 parameters.put("total_fee", decimalFormat.format(tradeMoney * 100)); // 订单总金额
if (order.getIrefundstatus().equals(OrderMain.STATUS_APPLICATION)) { if (refund.getRefundStatus().equals(1)) {
parameters.put("refund_fee", decimalFormat.format(order.getIrefundmoney() * 100)); // 订单总金额 parameters.put("refund_fee", decimalFormat.format(refund.getRefundMoney() * 100)); // 订单总金额
}else { }else {
parameters.put("refund_fee", decimalFormat.format(order.getIrefundmoney() * 100)); // 退款金额 parameters.put("refund_fee", decimalFormat.format(refund.getRefundMoney() * 100)); // 退款金额
} }
//parameters.put("profit_sharing", "Y"); //parameters.put("profit_sharing", "Y");
// 用户端实际ip // 用户端实际ip
parameters.put("notify_url", WxConfigUtil.refund_notify_url); // 接收微信支付异步通知回调地址 parameters.put("notify_url", WxConfigUtil.refund_notify_url); // 接收微信支付异步通知回调地址
parameters.put("out_refund_no", order.getRefundorderno()); parameters.put("out_refund_no", refund.getRefundCode());
System.out.println("sign=====" + parameters); System.out.println("sign=====" + parameters);
// 设置签名 // 设置签名
String sign = WxUtil.createSignMD5(parameters); String sign = WxUtil.createSignMD5(parameters);
......
...@@ -15,10 +15,10 @@ public class WxConfigUtil { ...@@ -15,10 +15,10 @@ public class WxConfigUtil {
public final static String UNIFIED_ORDER_URL = "https://api.mch.weixin.qq.com/pay/unifiedorder"; public final static String UNIFIED_ORDER_URL = "https://api.mch.weixin.qq.com/pay/unifiedorder";
public final static String PROFIT_SHARING_URL = "https://api.mch.weixin.qq.com/secapi/pay/profitsharing"; public final static String PROFIT_SHARING_URL = "https://api.mch.weixin.qq.com/secapi/pay/profitsharing";
public final static String PROFIT_SHARING_ADDRECEIVER = "https://api.mch.weixin.qq.com/pay/profitsharingaddreceiver"; public final static String PROFIT_SHARING_ADDRECEIVER = "https://api.mch.weixin.qq.com/pay/profitsharingaddreceiver";
// public final static String notify_url = "http://farming.nyinhong.com/wx/notify"; // 订单回调接口 public final static String notify_url = "http://felo.nyinhong.com/wx/notify"; // 订单回调接口
public final static String notify_url = "https://qpxdnyy.com/wx/notify"; // 订单回调接口 // public final static String notify_url = "https://qpxdnyy.com/wx/notify"; // 订单回调接口
// public final static String refund_notify_url = "http://farming.nyinhong.com/wx/wxRefundNotify"; // 订单回调接口 public final static String refund_notify_url = "http://felo.nyinhong.com/wx/wxRefundNotify"; // 订单回调接口
public final static String refund_notify_url = "https://qpxdnyy.com/wx/wxRefundNotify"; // 订单回调接口 // public final static String refund_notify_url = "https://qpxdnyy.com/wx/wxRefundNotify"; // 订单回调接口
public final static String REFUND_ORDER_URL = "https://api.mch.weixin.qq.com/secapi/pay/refund"; public final static String REFUND_ORDER_URL = "https://api.mch.weixin.qq.com/secapi/pay/refund";
public static String GET_MINICODE_URL = "https://api.weixin.qq.com/wxa/getwxacodeunlimit"; public static String GET_MINICODE_URL = "https://api.weixin.qq.com/wxa/getwxacodeunlimit";
......
...@@ -3,6 +3,7 @@ package com.yunniu.farming.wx; ...@@ -3,6 +3,7 @@ package com.yunniu.farming.wx;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yunniu.farming.util.HttpClientUtil; import com.yunniu.farming.util.HttpClientUtil;
import org.apache.commons.codec.digest.DigestUtils;
import org.jdom.JDOMException; import org.jdom.JDOMException;
import javax.crypto.Mac; import javax.crypto.Mac;
...@@ -102,8 +103,8 @@ public class WxUtil { ...@@ -102,8 +103,8 @@ public class WxUtil {
} }
} }
sb.append("key=" + WxConfigUtil.API_KEY); sb.append("key=" + WxConfigUtil.API_KEY);
String sign = MD5(sb.toString()); String sign = DigestUtils.md5Hex(sb.toString());
return sign; return sign.toUpperCase();
} }
......
#spring.datasource.url=jdbc:mysql://152.136.113.101:3306/farming?autoReconnect=true&useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&serverTimezone=GMT%2B8 #spring.datasource.url=jdbc:mysql://152.136.113.101:3306/farming?autoReconnect=true&useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&serverTimezone=GMT%2B8
#spring.datasource.username=root #spring.datasource.username=root
#spring.datasource.password=Root_123456 #spring.datasource.password=Root_123456
spring.datasource.url=jdbc:mysql://localhost:3306/farming?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai #spring.datasource.url=jdbc:mysql://localhost:3306/farming?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username=farming #spring.datasource.username=farming
spring.datasource.password=PKWB6psxa7FBApZB #spring.datasource.password=PKWB6psxa7FBApZB
#spring.datasource.url=jdbc:mysql://db1.prd.jianghuxx.com:3317/farming?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai spring.datasource.url=jdbc:mysql://db1.prd.jianghuxx.com:3317/farming?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
#spring.datasource.username=root spring.datasource.username=root
#spring.datasource.password=4f9fa23639242790 spring.datasource.password=4f9fa23639242790
#7LwimZ27FqEnzIPg #7LwimZ27FqEnzIPg
##47.101.199.10 ##47.101.199.10
spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
......
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
<!-- 以下为商品相关字段 --> <!-- 以下为商品相关字段 -->
<result column="zsproductname" property="sproductname" jdbcType="VARCHAR"/> <result column="zsproductname" property="sproductname" jdbcType="VARCHAR"/>
<result column="zspshortpic" property="spshortpic" jdbcType="VARCHAR"/> <result column="zspshortpic" property="spshortpic" jdbcType="VARCHAR"/>
<result column="zsdef2" property="sdef2" jdbcType="VARCHAR"/>
</collection> </collection>
</resultMap> </resultMap>
...@@ -191,7 +192,7 @@ ...@@ -191,7 +192,7 @@
</select> </select>
<resultMap id="ResultMap" type="com.yunniu.farming.webadmin.model.OrderMain"> <resultMap id="ResultMap" type="com.yunniu.farming.webadmin.model.OrderMain">
<id column="id" property="id" jdbcType="INTEGER"/> <result column="id" property="id" jdbcType="INTEGER"/>
<result column="customerid" property="customerid" jdbcType="INTEGER"/> <result column="customerid" property="customerid" jdbcType="INTEGER"/>
<result column="addressid" property="addressid" jdbcType="INTEGER"/> <result column="addressid" property="addressid" jdbcType="INTEGER"/>
<result column="sorderno" property="sorderno" jdbcType="VARCHAR"/> <result column="sorderno" property="sorderno" jdbcType="VARCHAR"/>
...@@ -233,6 +234,17 @@ ...@@ -233,6 +234,17 @@
<result column="groupBuyId" property="groupBuyId" jdbcType="BIGINT"/> <result column="groupBuyId" property="groupBuyId" jdbcType="BIGINT"/>
<result column="groupBuyName" property="groupBuyName" jdbcType="VARCHAR"/> <result column="groupBuyName" property="groupBuyName" jdbcType="VARCHAR"/>
<association property="customer" column="customerid" select="selectCustomer"/> <association property="customer" column="customerid" select="selectCustomer"/>
<collection property="orderRefund" javaType="com.yunniu.farming.webadmin.model.OrderRefund">
<result column="refund_type" jdbcType="CHAR" property="refundType" />
<result column="portion" jdbcType="CHAR" property="portion" />
<result column="refund_code" jdbcType="VARCHAR" property="refundCode" />
<result column="refund_status" jdbcType="CHAR" property="refundStatus" />
<result column="refund_money" jdbcType="DOUBLE" property="refundMoney" />
<result column="refund_time" jdbcType="TIMESTAMP" property="refundTime" />
<result column="refund_reason" jdbcType="VARCHAR" property="refundReason" />
<result column="refund_img" jdbcType="VARCHAR" property="refundImg" />
<result column="refund_detail" jdbcType="VARCHAR" property="refundDetail" />
</collection>
<!-- FRICE TODO 一对多 关联查询 --> <!-- FRICE TODO 一对多 关联查询 -->
<collection property="subs" ofType="com.yunniu.farming.webadmin.model.OrderSub" select="selectOrderSub" column="id"/> <collection property="subs" ofType="com.yunniu.farming.webadmin.model.OrderSub" select="selectOrderSub" column="id"/>
...@@ -265,10 +277,52 @@ ...@@ -265,10 +277,52 @@
<!-- 带参数分页查询 S --> <!-- 带参数分页查询 S -->
<select id="selectByParamPageList" resultMap="ResultMap" <select id="selectByParamPageList" resultMap="ResultMap"
parameterType="com.yunniu.farming.webadmin.model.OrderMain"> parameterType="com.yunniu.farming.webadmin.model.OrderMain">
SELECT SELECT ordermain.id
<include refid="Full_Column_List"/> , customerid
, addressid
, sorderno
, sorderdate
, tordertime
, tovertime
, dplanmoney
, dactmoney
, dactscore
, ipaystatus
, tpaytime
, refundorderno
, irefundmoney
, trefundtime
, srefundreason
, srefundpic
, refund.couriernumber
, istatus
, itype
, group_order_id
, productid
, ipaytype
, shareuid
, sremark
, sdef1
, sdef2
, sdef3
, sdef4
, sdef5
, idef6
, idef7
, ddef8
, ddef9
, ddef10
, scusaddr
, scuname
, scuphone
, sprovince
, scity
, sregion
, refund.refund_status as irefundstatus
<!-- 关联子表信息 --> <!-- 关联子表信息 -->
FROM order_main ordermain FROM order_main ordermain
left join order_refund refund
on ordermain.id = refund.order_mian_id AND refund.id = (select MAX(id) from order_refund where order_mian_id = ordermain.id)
<where> <where>
<if test="appflag == null or appflag == ''"> <if test="appflag == null or appflag == ''">
ordermain.itype = 10 ordermain.itype = 10
...@@ -303,6 +357,7 @@ ...@@ -303,6 +357,7 @@
AND ordermain.sorderdate <![CDATA[ <= ]]> #{endDate,jdbcType=VARCHAR} AND ordermain.sorderdate <![CDATA[ <= ]]> #{endDate,jdbcType=VARCHAR}
</if> </if>
</where> </where>
group by ordermain.id
<!-- 以时间倒序显示 --> <!-- 以时间倒序显示 -->
ORDER BY ordermain.tordertime DESC ORDER BY ordermain.tordertime DESC
</select> </select>
...@@ -321,6 +376,7 @@ ...@@ -321,6 +376,7 @@
sub.sgoodprice AS zsgoodprice, sub.sgoodprice AS zsgoodprice,
sub.sproductname AS zsproductname, sub.sproductname AS zsproductname,
sub.spshortpic AS zspshortpic, sub.spshortpic AS zspshortpic,
ifnull(sub.sdef2, 0) as zsdef2,
go.remark go.remark
FROM order_main ordermain FROM order_main ordermain
LEFT JOIN order_sub sub ON ordermain.id = sub.mainid LEFT JOIN order_sub sub ON ordermain.id = sub.mainid
...@@ -410,18 +466,119 @@ ...@@ -410,18 +466,119 @@
order by tordertime desc limit 1 order by tordertime desc limit 1
</select> </select>
<select id="selectByParamPageRefundGroupList" resultMap="ResultMap">
<resultMap id="RefundResultMap" type="com.yunniu.farming.webadmin.model.OrderMain">
<id column="zid" property="zid" jdbcType="INTEGER"/>
<result column="id" property="id" jdbcType="INTEGER"/>
<result column="customerid" property="customerid" jdbcType="INTEGER"/>
<result column="addressid" property="addressid" jdbcType="INTEGER"/>
<result column="sorderno" property="sorderno" jdbcType="VARCHAR"/>
<result column="scusaddr" property="scusaddr" jdbcType="VARCHAR"/>
<result column="scuname" property="scuname" jdbcType="VARCHAR"/>
<result column="scuphone" property="scuphone" jdbcType="VARCHAR"/>
<result column="sprovince" property="sprovince" jdbcType="VARCHAR"/>
<result column="scity" property="scity" jdbcType="VARCHAR"/>
<result column="sregion" property="sregion" jdbcType="VARCHAR"/>
<result column="sorderdate" property="sorderdate" jdbcType="CHAR"/>
<result column="tordertime" property="tordertime" jdbcType="TIMESTAMP"/>
<result column="tovertime" property="tovertime" jdbcType="TIMESTAMP"/>
<result column="dplanmoney" property="dplanmoney" jdbcType="DECIMAL"/>
<result column="dactmoney" property="dactmoney" jdbcType="DECIMAL"/>
<result column="dactscore" property="dactscore" jdbcType="DECIMAL"/>
<result column="ipaystatus" property="ipaystatus" jdbcType="INTEGER"/>
<result column="group_order_id" property="groupOrderId" jdbcType="INTEGER"/>
<result column="irefundstatus" property="irefundstatus" jdbcType="INTEGER"/>
<result column="irefundmoney" property="irefundmoney" jdbcType="INTEGER"/>
<result column="tpaytime" property="tpaytime" jdbcType="TIMESTAMP"/>
<result column="trefundtime" property="trefundtime" jdbcType="TIMESTAMP"/>
<result column="istatus" property="istatus" jdbcType="INTEGER"/>
<result column="itype" property="itype" jdbcType="INTEGER"/>
<result column="srefundreason" property="srefundreason" jdbcType="VARCHAR"/>
<result column="srefundpic" property="srefundpic" jdbcType="VARCHAR"/>
<result column="couriernumber" property="couriernumber" jdbcType="VARCHAR"/>
<result column="productid" property="productid" jdbcType="INTEGER"/>
<result column="ipaytype" property="ipaytype" jdbcType="INTEGER"/>
<result column="sremark" property="sremark" jdbcType="VARCHAR"/>
<result column="remark" property="remark" jdbcType="VARCHAR"/>
<result column="sdef1" property="sdef1" jdbcType="VARCHAR"/>
<result column="sdef2" property="sdef2" jdbcType="VARCHAR"/>
<result column="sdef3" property="sdef3" jdbcType="VARCHAR"/>
<result column="sdef4" property="sdef4" jdbcType="VARCHAR"/>
<result column="sdef5" property="sdef5" jdbcType="VARCHAR"/>
<result column="idef6" property="idef6" jdbcType="INTEGER"/>
<result column="idef7" property="idef7" jdbcType="INTEGER"/>
<result column="ddef8" property="ddef8" jdbcType="DECIMAL"/>
<result column="ddef9" property="ddef9" jdbcType="DECIMAL"/>
<result column="ddef10" property="ddef10" jdbcType="TIMESTAMP"/>
<result column="groupBuyId" property="groupBuyId" jdbcType="BIGINT"/>
<result column="groupBuyName" property="groupBuyName" jdbcType="VARCHAR"/>
<association property="customer" column="customerid" select="selectCustomer"/>
<association property="orderRefund" javaType="com.yunniu.farming.webadmin.model.OrderRefund">
<result column="refund_type" jdbcType="CHAR" property="refundType" />
<result column="portion" jdbcType="CHAR" property="portion" />
<result column="refund_code" jdbcType="VARCHAR" property="refundCode" />
<result column="refund_status" jdbcType="CHAR" property="refundStatus" />
<result column="refund_money" jdbcType="DOUBLE" property="refundMoney" />
<result column="refund_time" jdbcType="TIMESTAMP" property="refundTime" />
<result column="refund_reason" jdbcType="VARCHAR" property="refundReason" />
<result column="refund_img" jdbcType="VARCHAR" property="refundImg" />
<result column="refund_detail" jdbcType="VARCHAR" property="refundDetail" />
</association>
</resultMap>
<select id="selectByParamPageRefundGroupList" resultMap="RefundResultMap">
SELECT SELECT
<include refid="Full_Column_List"/> ordermain.id,
<!-- 关联子表信息 --> ordermain.customerid,
,gb.id as groupBuyId ordermain.addressid,
,gb.group_buy_title as groupBuyName ordermain.sorderno,
FROM order_main ordermain ordermain.sorderdate,
left join group_order go on ordermain.group_order_id = go.id ordermain.tordertime,
left join group_buy gb on go.group_buy_id = gb.id ordermain.tovertime,
ordermain.dplanmoney,
ordermain.dactmoney,
ordermain.dactscore,
ordermain.ipaystatus,
ordermain.tpaytime,
ordermain.couriernumber,
ordermain.istatus,
ordermain.itype,
ordermain.group_order_id,
ordermain.productid,
ordermain.ipaytype,
ordermain.shareuid,
ordermain.sremark,
ordermain.sdef1,
ordermain.sdef2,
ordermain.sdef3,
ordermain.ddef8,
ordermain.scusaddr,
ordermain.scuname,
ordermain.scuphone,
ordermain.sprovince,
ordermain.scity,
ordermain.sregion,
orderRefund.id as zid,
orderRefund.refund_type,
orderRefund.portion,
orderRefund.refund_code,
orderRefund.refund_status,
orderRefund.refund_money,
orderRefund.refund_time,
orderRefund.refund_suc_time,
orderRefund.refund_reason,
orderRefund.refund_img,
orderRefund.refund_detail,
gb.id AS groupBuyId,
gb.group_buy_title AS groupBuyName
FROM
order_refund AS orderRefund
LEFT JOIN order_main AS ordermain ON orderRefund.order_mian_id = ordermain.id
LEFT JOIN group_order go ON ordermain.group_order_id = go.id
LEFT JOIN group_buy gb ON go.group_buy_id = gb.id
<where> <where>
ordermain.group_order_id IS NOT NULL ordermain.group_order_id IS NOT NULL
AND ordermain.irefundstatus IS NOT NULL and orderRefund.order_mian_id is not null
<if test="id != null"> <if test="id != null">
AND ordermain.id = #{id,jdbcType=INTEGER} AND ordermain.id = #{id,jdbcType=INTEGER}
</if> </if>
...@@ -453,6 +610,6 @@ ...@@ -453,6 +610,6 @@
</if> </if>
</where> </where>
<!-- 以时间倒序显示 --> <!-- 以时间倒序显示 -->
ORDER BY ordermain.tordertime DESC ORDER BY orderRefund.refund_time DESC
</select> </select>
</mapper> </mapper>
...@@ -422,8 +422,8 @@ ...@@ -422,8 +422,8 @@
groupBuy.areaIdList = areaIdList; groupBuy.areaIdList = areaIdList;
groupBuy.products = products; groupBuy.products = products;
groupBuy.goodsImgArr = goodsImgArr; groupBuy.goodsImgArr = goodsImgArr;
groupBuy.groupBuyPic = groupBuyPic; // groupBuy.groupBuyPic = groupBuyPic;
// groupBuy.groupBuyPic = "https://yuezhi-1314984551.cos.ap-shanghai.myqcloud.com/register/0f2f3ca914fa4e36ad644f61a3a3a243.jpeg"; groupBuy.groupBuyPic = "https://yuezhi-1314984551.cos.ap-shanghai.myqcloud.com/register/0f2f3ca914fa4e36ad644f61a3a3a243.jpeg";
groupBuy.startTime = startTime; groupBuy.startTime = startTime;
groupBuy.endTime = endTime; groupBuy.endTime = endTime;
$.ajax({ $.ajax({
......
...@@ -83,12 +83,12 @@ ...@@ -83,12 +83,12 @@
<script type="text/html" id="table-handle"> <script type="text/html" id="table-handle">
<i class="layui-icon layui-icon-form" lay-event="orderDetail" title="订单详情"></i> <i class="layui-icon layui-icon-form" lay-event="orderDetail" title="订单详情"></i>
<!-- 101退款申请中 102待退货 103待退款 104退款成功 105退款拒绝--> <!-- 101退款申请中 102待退货 103待退款 104退款成功 105退款拒绝-->
{{#if (d.irefundstatus == 101) { }} {{#if (d.orderRefund.refundStatus == 1 && d.orderRefund.refundType == 1) { }}
<i class="layui-icon layui-icon-ok" lay-event="pass" title="退款申请通过"></i> <i class="layui-icon layui-icon-ok" lay-event="pass" title="退款申请通过"></i>
<i class="layui-icon layui-icon-close" lay-event="refuse" title="退款申请拒绝"></i> <i class="layui-icon layui-icon-close" lay-event="refuse" title="退款申请拒绝"></i>
{{# }else if(d.irefundstatus == 103){ }} {{# }else if(d.irefundstatus == 103){ }}
<i class="layui-icon layui-icon-component" lay-event="receive" title="退款已收货"></i> <i class="layui-icon layui-icon-component" lay-event="receive" title="退款已收货"></i>
{{# }else if(d.irefundstatus == 106){ }} {{# }else if(d.orderRefund.refundStatus == 1 && d.orderRefund.refundType == 2){ }}
<i class="layui-icon layui-icon-ok" lay-event="pass" title="仅退款申请通过"></i> <i class="layui-icon layui-icon-ok" lay-event="pass" title="仅退款申请通过"></i>
<i class="layui-icon layui-icon-close" lay-event="refuse" title="仅退款申请拒绝"></i> <i class="layui-icon layui-icon-close" lay-event="refuse" title="仅退款申请拒绝"></i>
{{# } }} {{# } }}
...@@ -165,27 +165,28 @@ ...@@ -165,27 +165,28 @@
str += "<span style=''>" + d.customer.swxnick ? d.customer.swxnick : '' + "</span>" str += "<span style=''>" + d.customer.swxnick ? d.customer.swxnick : '' + "</span>"
} }
} }
return str; return str;
} }
} }
,{ ,{
title: "订单金额", title: "订单金额",
width: 150, width: 150,
templet: function(d) { templet: function(d) {
var str = ""; var str = "";
str += '金额:<span style="color:red;"> '+(d.dactmoney ? d.dactmoney : 0)+ '</span>&nbsp'; str += '金额:<span style="color:red;"> '+(d.dactmoney ? d.dactmoney : 0)+ '</span>&nbsp';
str += '积分:<span style="color:red;"> '+(d.dactscore ? d.dactscore : 0)+ '</span>'; str += '积分:<span style="color:red;"> '+(d.dactscore ? d.dactscore : 0)+ '</span>';
str += '</div>'; str += '</div>';
return str ? str : ""; return str ? str : "";
} }
} }
, {field: 'irefundmoney', width: 150, title: '退款金额'} , {width: 150, title: '退款金额',
templet: function(d) {
var str = "";
str += '<span> '+(d.orderRefund.refundMoney ? d.orderRefund.refundMoney : 0)+ '</span>&nbsp';
str += '</div>';
return str ? str : "";
}
}
,{ ,{
title: "订单状态", title: "订单状态",
width: 200, width: 200,
...@@ -209,12 +210,12 @@ ...@@ -209,12 +210,12 @@
str += ' <span>' + status + '</span>'; str += ' <span>' + status + '</span>';
// 101退款申请中 102待退货 103待退款 104退款成功 // 101退款申请中 102待退货 103待退款 104退款成功
var refundStatus = ""; var refundStatus = "";
if (d.irefundstatus == 101) refundStatus = "<span class='layui-badge layui-bg-red'>退款申请</span>"; if (d.orderRefund.refundStatus == 1 && d.orderRefund.refundType == 1) refundStatus = "<span class='layui-badge layui-bg-red'>退款申请</span>";
if (d.irefundstatus == 102) refundStatus = "<span class='layui-badge layui-bg-orange'>待退货</span>"; if (d.orderRefund.refundStatus == 4) refundStatus = "<span class='layui-badge layui-bg-orange'>待退货</span>";
if (d.irefundstatus == 103) refundStatus = "<span class='layui-badge layui-bg-orange'>待退款</span>"; if (d.orderRefund.refundStatus == 6) refundStatus = "<span class='layui-badge layui-bg-orange'>待退款</span>";
if (d.irefundstatus == 104) refundStatus = "<span class='layui-badge layui-bg-green'>退款成功</span>"; if (d.orderRefund.refundStatus == 5) refundStatus = "<span class='layui-badge layui-bg-green'>退款成功</span>";
if (d.irefundstatus == 105) refundStatus = "<span class='layui-badge layui-bg-cyan'>退款拒绝</span>"; if (d.orderRefund.refundStatus == 3) refundStatus = "<span class='layui-badge layui-bg-cyan'>退款拒绝</span>";
if (d.irefundstatus == 106) refundStatus = "<span class='layui-badge layui-bg-red'>仅退款申请</span>"; if (d.orderRefund.refundStatus == 1 && d.orderRefund.refundType == 2) refundStatus = "<span class='layui-badge layui-bg-red'>仅退款申请</span>";
str += ' <span>' + refundStatus + '</span>'; str += ' <span>' + refundStatus + '</span>';
str += '</div>'; str += '</div>';
return str ? str : ""; return str ? str : "";
...@@ -222,18 +223,32 @@ ...@@ -222,18 +223,32 @@
} }
, {field: 'tordertime', width: 100, title: '下单日期'} , {field: 'tordertime', width: 100, title: '下单日期'}
, {field: 'sremark', width: 100,title: '备注'} , {field: 'sremark', width: 100,title: '备注'}
, {field: 'trefundtime', width: 100, title: '退款时间'} , {width: 100, title: '退款时间',
templet: function(d) {
var str = "";
str += '<span> '+(d.orderRefund.refundSucTime ? d.orderRefund.refundSucTime : "")+ '</span>&nbsp';
str += '</div>';
return str ? str : "";
}
}
,{ ,{
width: 100, width: 100,
title: "退款图片", title: "退款图片",
align: "center", align: "center",
templet: function(d) { templet: function(d) {
return d.srefundpic ? '<div><img id="zi' + d.id + '" src="' + d.srefundpic + return d.orderRefund.refundImg ? '<div><img id="zi' + d.id + '" src="' + d.orderRefund.refundImg +
'" onmouseover="bigImg(this)" onmouseout="smallImg()" onclick="tolook(src)" style="height:20px;"></div>' : '" onmouseover="bigImg(this)" onmouseout="smallImg()" onclick="tolook(src)" style="height:20px;"></div>' :
''; '';
} }
} }
, {field: 'srefundreason', width: 100, title: '退款理由'} , {width: 100, title: '退款理由',
templet: function(d) {
var str = "";
str += '<span> '+(d.orderRefund.refundReason ? d.orderRefund.refundReason : "")+ '</span>&nbsp';
str += '</div>';
return str ? str : "";
}
}
, {field: 'couriernumber', width: 120, title: '退款快递单号'} , {field: 'couriernumber', width: 120, title: '退款快递单号'}
, {field: 'scusaddr', width: 100, title: '地址'} , {field: 'scusaddr', width: 100, title: '地址'}
, {field: 'scuname', width: 100, title: '联系姓名'} , {field: 'scuname', width: 100, title: '联系姓名'}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment