From eb8c609281180183fcb6af97409291f5028ecb76 Mon Sep 17 00:00:00 2001 From: yuanye <418471657@qq.com> Date: Tue, 23 Nov 2021 13:39:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BC=98=E9=80=89=E5=95=86?= =?UTF-8?q?=E5=93=81=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/HighOrderPreController.java | 48 ++++- .../controller/HighRefundAuditController.java | 33 ++- .../bweb/model/ExportHighPreOrderModel.java | 85 ++++++-- .../java/com/hai/dao/HighOrderMapperExt.java | 36 ++++ .../java/com/hai/entity/HighRefundAudit.java | 4 +- .../java/com/hai/model/HighOrderPreModel.java | 194 ++++++++++++++++++ .../com/hai/service/HighOrderPreService.java | 35 ++++ .../service/impl/HighCouponServiceImpl.java | 12 +- .../service/impl/HighOrderPreServiceImpl.java | 56 +++++ .../impl/HighRefundAuditServiceImpl.java | 42 +++- 10 files changed, 500 insertions(+), 45 deletions(-) create mode 100644 hai-service/src/main/java/com/hai/model/HighOrderPreModel.java diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighOrderPreController.java b/hai-bweb/src/main/java/com/bweb/controller/HighOrderPreController.java index 5dbd74a2..15f54463 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighOrderPreController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighOrderPreController.java @@ -12,12 +12,14 @@ import com.hai.common.exception.SysCode; import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; import com.hai.common.utils.ResponseMsgUtil; +import com.hai.config.WxOrderConfig; +import com.hai.entity.HighChildOrder; import com.hai.entity.HighGoodsType; +import com.hai.entity.HighOrder; import com.hai.entity.HighOrderPre; -import com.hai.model.HighOrderModel; -import com.hai.model.ResponseData; -import com.hai.model.UserInfoModel; +import com.hai.model.*; import com.hai.service.HighOrderPreService; +import com.hai.service.HighOrderService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; @@ -54,6 +56,10 @@ public class HighOrderPreController { @Resource private HighOrderPreService highOrderPreService; + @Resource + private HighOrderService highOrderService; + + @RequestMapping(value = "/getListPreOrder", method = RequestMethod.GET) @ResponseBody @ApiOperation(value = "获取预约订单列表") @@ -212,7 +218,7 @@ public class HighOrderPreController { highOrderPres.setStatus(4); highOrderPreService.updateOrderPre(highOrderPres); - return ResponseMsgUtil.success("预约成功"); + return ResponseMsgUtil.success("操作成功"); } catch (Exception e) { log.error("HighAgentController --> insertAgent() error!", e); @@ -277,7 +283,7 @@ public class HighOrderPreController { } String name = "/goodsOrder/预约商品订单" + System.currentTimeMillis() + ".xlsx"; - List list = highOrderPreService.getListOrderPre(map); + List list = highOrderPreService.ExportPreOrderList(map); String fileName = SysConst.getSysConfig().getFileUrl() + name; EasyExcel.write(fileName, ExportHighPreOrderModel.class).sheet("预约商品订单").doWrite(list); return ResponseMsgUtil.success(name); @@ -288,4 +294,36 @@ public class HighOrderPreController { } } + @RequestMapping(value = "/orderToRefund", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "订单退款") + public ResponseData orderToRefund(@RequestParam(name = "orderId", required = false) Long orderId, + HttpServletRequest request) { + try { + + HighOrderPre highOrderPre = highOrderPreService.findByOrderId(orderId); + + HighChildOrder highChildOrder = highOrderService.getChildOrderById(highOrderPre.getChildOrderId()); + + HighOrder highOrder = highOrderService.getOrderById(orderId); + + if (highOrder == null) { + log.error("orderToRefund error!", "未找到订单"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单"); + } + + if (highOrder.getOrderStatus() != 6) { + log.error("orderToRefund error!", "无法退款,订单不处于退款中状态"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单不处于退款中状态"); + } + + highOrderPreService.orderToRefund(highChildOrder , highOrder , highOrderPre); + + return ResponseMsgUtil.success("退款成功"); + + } catch (Exception e){ + throw new RuntimeException(e); + } + } + } diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighRefundAuditController.java b/hai-bweb/src/main/java/com/bweb/controller/HighRefundAuditController.java index 6c63e9a0..82476f1a 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighRefundAuditController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighRefundAuditController.java @@ -8,11 +8,15 @@ import com.hai.common.exception.SysCode; import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; import com.hai.common.utils.ResponseMsgUtil; +import com.hai.entity.HighOrder; +import com.hai.entity.HighOrderPre; import com.hai.entity.HighRefundAudit; import com.hai.entity.OutRechargeOrder; import com.hai.model.HighAgentModel; import com.hai.model.ResponseData; import com.hai.model.UserInfoModel; +import com.hai.service.HighOrderPreService; +import com.hai.service.HighOrderService; import com.hai.service.HighRefundAuditService; import com.hai.service.OutRechargeOrderService; import io.swagger.annotations.Api; @@ -49,6 +53,12 @@ public class HighRefundAuditController { @Resource private OutRechargeOrderService outRechargeOrderService; + @Resource + private HighOrderService highOrderService; + + @Resource + private HighOrderPreService highOrderPreService; + @Autowired private UserCenter userCenter; @@ -97,7 +107,6 @@ public class HighRefundAuditController { map.put("payTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeE)); } - PageHelper.startPage(pageNum,pageSize); return ResponseMsgUtil.success(new PageInfo<>(highRefundAuditService.getListRefundAudit(map))); @@ -145,13 +154,24 @@ public class HighRefundAuditController { HighRefundAudit highRefundAudit = highRefundAuditService.getRefundAuditById(id); - OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(highRefundAudit.getSourceOrderNo()); + if (highRefundAudit.getRefundSource() == 1) { + OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(highRefundAudit.getSourceOrderNo()); + outRechargeOrder.setStatus(2); + outRechargeOrderService.updateOrder(outRechargeOrder); + } else { + HighOrder highOrder = highOrderService.getOrderByOrderNo(highRefundAudit.getSourceOrderNo()); + highOrder.setOrderStatus(2); + highOrderService.updateOrder(highOrder); + HighOrderPre highOrderPre = highOrderPreService.findByRefund(highRefundAudit.getSourceOrderNo()); + highOrderPre.setStatus(4); + highOrderPre.setExt1("退款驳回"); + highOrderPreService.updateOrderPre(highOrderPre); + } + - highRefundAudit.setStatus(2); - outRechargeOrder.setStatus(2); + highRefundAudit.setStatus(2); highRefundAuditService.updateRefundAudit(highRefundAudit); - outRechargeOrderService.updateOrder(outRechargeOrder); return ResponseMsgUtil.success(highRefundAuditService.getRefundAuditById(id)); @@ -175,4 +195,7 @@ public class HighRefundAuditController { } } + + + } diff --git a/hai-bweb/src/main/java/com/bweb/model/ExportHighPreOrderModel.java b/hai-bweb/src/main/java/com/bweb/model/ExportHighPreOrderModel.java index 7efd9cdc..0703e6d7 100644 --- a/hai-bweb/src/main/java/com/bweb/model/ExportHighPreOrderModel.java +++ b/hai-bweb/src/main/java/com/bweb/model/ExportHighPreOrderModel.java @@ -3,6 +3,7 @@ package com.bweb.model; import com.alibaba.excel.annotation.ExcelProperty; import java.math.BigDecimal; +import java.util.Date; public class ExportHighPreOrderModel { @ExcelProperty("预约订单号") @@ -15,10 +16,7 @@ public class ExportHighPreOrderModel { private String goodsName; @ExcelProperty("支付金额") - private String payRealPrice; - - @ExcelProperty("预约时间") - private String preTime; + private BigDecimal payRealPrice; @ExcelProperty("用户姓名") private String preUserName; @@ -29,11 +27,26 @@ public class ExportHighPreOrderModel { @ExcelProperty("预约用户备注") private String preUserRemark; + @ExcelProperty("预约失败说明") + private String statusFailDesc; + @ExcelProperty("到达时间") - private BigDecimal reachTime; + private Date reachTime; @ExcelProperty("到达地点") - private BigDecimal reachAddress; + private String reachAddress; + + @ExcelProperty("门店名称") + private String storeName; + + @ExcelProperty("门店地址") + private String address; + + @ExcelProperty("创建时间") + private Date createTime; + + @ExcelProperty("状态") + private String status; public String getPreOrderNo() { return preOrderNo; @@ -59,22 +72,14 @@ public class ExportHighPreOrderModel { this.goodsName = goodsName; } - public String getPayRealPrice() { + public BigDecimal getPayRealPrice() { return payRealPrice; } - public void setPayRealPrice(String payRealPrice) { + public void setPayRealPrice(BigDecimal payRealPrice) { this.payRealPrice = payRealPrice; } - public String getPreTime() { - return preTime; - } - - public void setPreTime(String preTime) { - this.preTime = preTime; - } - public String getPreUserName() { return preUserName; } @@ -99,19 +104,59 @@ public class ExportHighPreOrderModel { this.preUserRemark = preUserRemark; } - public BigDecimal getReachTime() { + public String getStatusFailDesc() { + return statusFailDesc; + } + + public void setStatusFailDesc(String statusFailDesc) { + this.statusFailDesc = statusFailDesc; + } + + public Date getReachTime() { return reachTime; } - public void setReachTime(BigDecimal reachTime) { + public void setReachTime(Date reachTime) { this.reachTime = reachTime; } - public BigDecimal getReachAddress() { + public String getReachAddress() { return reachAddress; } - public void setReachAddress(BigDecimal reachAddress) { + public void setReachAddress(String reachAddress) { this.reachAddress = reachAddress; } + + public String getStoreName() { + return storeName; + } + + public void setStoreName(String storeName) { + this.storeName = storeName; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } } diff --git a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java index c2bc992b..425a1e2e 100644 --- a/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java @@ -3,6 +3,7 @@ package com.hai.dao; import com.hai.entity.HighOrder; import com.hai.model.HighOrderData; import com.hai.model.HighOrderModel; +import com.hai.model.HighOrderPreModel; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.Results; @@ -586,4 +587,39 @@ public interface HighOrderMapperExt { List> selectFinishGasOrder(); + @Select({""}) + List ExportPreOrderList(@Param("map") Map map); + } diff --git a/hai-service/src/main/java/com/hai/entity/HighRefundAudit.java b/hai-service/src/main/java/com/hai/entity/HighRefundAudit.java index 5133b74e..32a14cee 100644 --- a/hai-service/src/main/java/com/hai/entity/HighRefundAudit.java +++ b/hai-service/src/main/java/com/hai/entity/HighRefundAudit.java @@ -20,7 +20,7 @@ public class HighRefundAudit implements Serializable { private Integer id; /** - * 退款来源 1:话费 + * 退款来源 1:话费 2:优选商品 */ private Integer refundSource; @@ -335,4 +335,4 @@ public class HighRefundAudit implements Serializable { sb.append("]"); return sb.toString(); } -} \ No newline at end of file +} diff --git a/hai-service/src/main/java/com/hai/model/HighOrderPreModel.java b/hai-service/src/main/java/com/hai/model/HighOrderPreModel.java new file mode 100644 index 00000000..b7cfaca5 --- /dev/null +++ b/hai-service/src/main/java/com/hai/model/HighOrderPreModel.java @@ -0,0 +1,194 @@ +package com.hai.model; + +import com.alibaba.excel.annotation.ExcelProperty; + +import java.math.BigDecimal; +import java.util.Date; + +public class HighOrderPreModel { + /** + * 预约订单号 + */ + private String preOrderNo; + + /** + * 支付订单号 + */ + private String orderNo; + + /** + * 实付金额 + */ + private BigDecimal payRealPrice; + + + /** + * 商品名称 + */ + private String goodsName; + + + /** + * 预约用户姓名 + */ + private String preUserName; + + /** + * 预约用户手机号 + */ + private String preUserPhone; + + /** + * 预约用户备注 + */ + private String preUserRemark; + + /** + * 状态 1.预约中 2. 预约成功 3.预约完成 4.预约失败 5.预约取消 + */ + private String status; + + /** + * 预约失败说明 + */ + private String statusFailDesc; + + + /** + * 到达时间 + */ + private Date reachTime; + + /** + * 到达地点 + */ + private String reachAddress; + + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 门店名称 + */ + private String storeName; + + /** + * 门店地址 + */ + private String address; + + public String getPreOrderNo() { + return preOrderNo; + } + + public void setPreOrderNo(String preOrderNo) { + this.preOrderNo = preOrderNo; + } + + public String getOrderNo() { + return orderNo; + } + + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + + public BigDecimal getPayRealPrice() { + return payRealPrice; + } + + public void setPayRealPrice(BigDecimal payRealPrice) { + this.payRealPrice = payRealPrice; + } + + public String getGoodsName() { + return goodsName; + } + + public void setGoodsName(String goodsName) { + this.goodsName = goodsName; + } + + public String getPreUserName() { + return preUserName; + } + + public void setPreUserName(String preUserName) { + this.preUserName = preUserName; + } + + public String getPreUserPhone() { + return preUserPhone; + } + + public void setPreUserPhone(String preUserPhone) { + this.preUserPhone = preUserPhone; + } + + public String getPreUserRemark() { + return preUserRemark; + } + + public void setPreUserRemark(String preUserRemark) { + this.preUserRemark = preUserRemark; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getStatusFailDesc() { + return statusFailDesc; + } + + public void setStatusFailDesc(String statusFailDesc) { + this.statusFailDesc = statusFailDesc; + } + + public Date getReachTime() { + return reachTime; + } + + public void setReachTime(Date reachTime) { + this.reachTime = reachTime; + } + + public String getReachAddress() { + return reachAddress; + } + + public void setReachAddress(String reachAddress) { + this.reachAddress = reachAddress; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getStoreName() { + return storeName; + } + + public void setStoreName(String storeName) { + this.storeName = storeName; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } +} diff --git a/hai-service/src/main/java/com/hai/service/HighOrderPreService.java b/hai-service/src/main/java/com/hai/service/HighOrderPreService.java index 81c5a643..dff0c2c5 100644 --- a/hai-service/src/main/java/com/hai/service/HighOrderPreService.java +++ b/hai-service/src/main/java/com/hai/service/HighOrderPreService.java @@ -1,6 +1,10 @@ package com.hai.service; +import com.hai.entity.HighChildOrder; +import com.hai.entity.HighOrder; import com.hai.entity.HighOrderPre; +import com.hai.model.HighOrderPreModel; + import java.util.List; import java.util.Map; @@ -15,6 +19,16 @@ public interface HighOrderPreService { **/ List getListOrderPre(Map map); + /** + * @Author Sum1Dream + * @name ExportPreOrderList.java + * @Description // 查询导出订单 + * @Date 12:09 下午 2021/11/22 + * @Param [java.util.Map] + * @return java.util.List + */ + List ExportPreOrderList(Map map); + /** * @Author Sum1Dream * @Description // 根据订单ID查询订单 @@ -40,6 +54,16 @@ public interface HighOrderPreService { **/ HighOrderPre findByOrderNo(String orderNo); + /** + * @Author Sum1Dream + * @name findByRefund.java + * @Description // 查询退款中订单 + * @Date 3:09 下午 2021/11/22 + * @Param [java.lang.String] + * @return com.hai.entity.HighOrderPre + */ + HighOrderPre findByRefund(String orderNo); + /*** * @Author Sum1Dream * @Description // 新增订单 @@ -63,4 +87,15 @@ public interface HighOrderPreService { * @param preOrderId */ void orderComplete(Long preOrderId); + + + /** + * @Author Sum1Dream + * @name orderToRefund.java + * @Description // 预约订单退款 + * @Date 5:34 下午 2021/11/22 + * @Param [java.lang.Long] + * @return void + */ + void orderToRefund(HighChildOrder highChildOrder , HighOrder highOrder , HighOrderPre highOrderPre) throws Exception; } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java index dcc80d75..cba36210 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java @@ -356,8 +356,16 @@ public class HighCouponServiceImpl implements HighCouponService { criteria.andDisplayAreaEqualTo(MapUtils.getInteger(map, "displayArea")); } - if (MapUtils.getInteger(map, "couponSource") != null) { - criteria.andCouponSourceEqualTo(MapUtils.getInteger(map, "couponSource")); + if (MapUtils.getInteger(map, "displayArea") != null) { + criteria.andDisplayAreaEqualTo(MapUtils.getInteger(map, "displayArea")); + } + + if (MapUtils.getInteger(map, "brandId") != null) { + criteria.andBrandIdEqualTo(MapUtils.getInteger(map, "brandId")); + } + + if (MapUtils.getInteger(map, "goodsTypeId") != null) { + criteria.andGoodsTypeIdEqualTo(MapUtils.getInteger(map, "goodsTypeId")); } if (MapUtils.getInteger(map, "status") != null) { diff --git a/hai-service/src/main/java/com/hai/service/impl/HighOrderPreServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighOrderPreServiceImpl.java index 68e5fea4..2ed27137 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighOrderPreServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighOrderPreServiceImpl.java @@ -4,10 +4,15 @@ import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.utils.DateUtil; +import com.hai.config.WxOrderConfig; +import com.hai.dao.HighOrderMapper; import com.hai.dao.HighOrderPreMapper; +import com.hai.entity.HighChildOrder; import com.hai.entity.HighOrder; import com.hai.entity.HighOrderPre; import com.hai.entity.HighOrderPreExample; +import com.hai.model.HighOrderPreModel; +import com.hai.model.OrderRefundModel; import com.hai.service.HighOrderPreService; import com.hai.service.HighOrderService; import org.apache.commons.collections4.MapUtils; @@ -30,6 +35,12 @@ public class HighOrderPreServiceImpl implements HighOrderPreService { @Resource private HighOrderService highOrderService; + @Resource + private HighOrderMapper highOrderMapper; + + @Resource + private HighOrderPreService highOrderPreService; + @Override public List getListOrderPre(Map map) { HighOrderPreExample example = new HighOrderPreExample(); @@ -86,9 +97,16 @@ public class HighOrderPreServiceImpl implements HighOrderPreService { criteria.andPreUserNameLike("%" + MapUtils.getString(map, "preUserName") + "%"); } + example.setOrderByClause("create_time desc"); + return highOrderPreMapper.selectByExample(example); } + @Override + public List ExportPreOrderList(Map map) { + return highOrderMapper.ExportPreOrderList(map); + } + @Override public HighOrderPre findByOrderId(Long orderId) { return highOrderPreMapper.selectByPrimaryKey(orderId); @@ -107,6 +125,23 @@ public class HighOrderPreServiceImpl implements HighOrderPreService { @Override public HighOrderPre findByOrderNo(String orderNo) { + HighOrderPreExample example = new HighOrderPreExample(); + example.createCriteria().andOrderNoEqualTo(orderNo); + List list = highOrderPreMapper.selectByExample(example); + if (list.size() > 0) { + return list.get(0); + } + return null; + } + + @Override + public HighOrderPre findByRefund(String orderNo) { + HighOrderPreExample example = new HighOrderPreExample(); + example.createCriteria().andOrderNoEqualTo(orderNo).andExt1EqualTo("退款中"); + List list = highOrderPreMapper.selectByExample(example); + if (list.size() > 0) { + return list.get(0); + } return null; } @@ -139,4 +174,25 @@ public class HighOrderPreServiceImpl implements HighOrderPreService { highOrderService.childOrderComplete(orderPre.getChildOrderId()); } + + @Override + @Transactional(propagation= Propagation.REQUIRES_NEW) + public void orderToRefund(HighChildOrder highChildOrder, HighOrder highOrder, HighOrderPre highOrderPre) throws Exception { + // 支付方式: 1:支付宝 2:微信 3:金币 4:汇联通工会卡 5:银联 + if (highOrder.getPayType() == 2) { + // 微信退款 + OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(),highOrder.getPayRealPrice(), highOrder.getPayRealPrice()); + if(orderRefundModel.getResult_code().equals("SUCCESS")) { + highChildOrder.setChildOrdeStatus(5); + highOrder.setOrderStatus(5); + highOrder.setRefundTime(new Date()); + highOrder.setRefundPrice(highOrder.getPayRealPrice()); + highOrderService.updateOrderDetail(highOrder); + highOrderService.updateChildOrder(highChildOrder); + highOrderPre.setExt1("退款成功"); + highOrderPreService.updateOrderPre(highOrderPre); + + } + } + } } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighRefundAuditServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighRefundAuditServiceImpl.java index 708a54f0..6705d819 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighRefundAuditServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighRefundAuditServiceImpl.java @@ -2,11 +2,10 @@ package com.hai.service.impl; import com.hai.common.utils.DateUtil; import com.hai.dao.HighRefundAuditMapper; -import com.hai.entity.HighRefundAudit; -import com.hai.entity.HighRefundAuditExample; -import com.hai.entity.OutRechargeOrder; -import com.hai.entity.OutRechargeOrderExample; +import com.hai.entity.*; import com.hai.model.UserInfoModel; +import com.hai.service.HighOrderPreService; +import com.hai.service.HighOrderService; import com.hai.service.HighRefundAuditService; import com.hai.service.OutRechargeOrderService; import io.swagger.models.auth.In; @@ -31,6 +30,12 @@ public class HighRefundAuditServiceImpl implements HighRefundAuditService { @Resource private OutRechargeOrderService outRechargeOrderService; + @Resource + private HighOrderService highOrderService; + + @Resource + private HighOrderPreService highOrderPreService; + @Override public List getListRefundAudit(Map map) { @@ -85,20 +90,35 @@ public class HighRefundAuditServiceImpl implements HighRefundAuditService { @Transactional(propagation= Propagation.REQUIRES_NEW) public void insertRefundAudit(HighRefundAudit highRefundAudit , UserInfoModel userInfoModel) { - OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(highRefundAudit.getSourceOrderNo()); + if (highRefundAudit.getRefundSource() == 1) { + OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(highRefundAudit.getSourceOrderNo()); + highRefundAudit.setRefundPrice(outRechargeOrder.getPayPrice()); + highRefundAudit.setPayType(outRechargeOrder.getPayType()); + highRefundAudit.setPayTime(outRechargeOrder.getPayTime()); + highRefundAudit.setExt1(String.valueOf(outRechargeOrder.getId())); + outRechargeOrder.setStatus(6); + outRechargeOrderService.updateOrder(outRechargeOrder); + } else { + HighOrder highOrder = highOrderService.getOrderByOrderNo(highRefundAudit.getSourceOrderNo()); + highRefundAudit.setRefundPrice(highOrder.getPayPrice()); + highRefundAudit.setPayType(highOrder.getPayType()); + highRefundAudit.setPayTime(highOrder.getPayTime()); + highRefundAudit.setExt1(String.valueOf(highOrder.getId())); + highOrder.setOrderStatus(6); + + HighOrderPre highOrderPre = highOrderPreService.findByOrderNo(highRefundAudit.getSourceOrderNo()); + highOrderPre.setExt1("退款中"); + + highOrderService.updateOrder(highOrder); + highOrderPreService.updateOrderPre(highOrderPre); + } highRefundAudit.setCompanId(userInfoModel.getBsCompany().getId().intValue()); highRefundAudit.setStatus(0); - highRefundAudit.setRefundPrice(outRechargeOrder.getPayPrice()); highRefundAudit.setCreatedTime(new Date()); highRefundAudit.setCreatedUserId(userInfoModel.getSecUser().getId().intValue()); highRefundAudit.setCreatedUserName(userInfoModel.getSecUser().getUserName()); - highRefundAudit.setPayType(outRechargeOrder.getPayType()); - highRefundAudit.setPayTime(outRechargeOrder.getPayTime()); - highRefundAudit.setExt1(String.valueOf(outRechargeOrder.getId())); - outRechargeOrder.setStatus(6); - outRechargeOrderService.updateOrder(outRechargeOrder); highRefundAuditMapper.insert(highRefundAudit); }