提交优选商品代码

dev-discount
袁野 3 years ago
parent 0e1623165a
commit eb8c609281
  1. 48
      hai-bweb/src/main/java/com/bweb/controller/HighOrderPreController.java
  2. 31
      hai-bweb/src/main/java/com/bweb/controller/HighRefundAuditController.java
  3. 85
      hai-bweb/src/main/java/com/bweb/model/ExportHighPreOrderModel.java
  4. 36
      hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java
  5. 2
      hai-service/src/main/java/com/hai/entity/HighRefundAudit.java
  6. 194
      hai-service/src/main/java/com/hai/model/HighOrderPreModel.java
  7. 35
      hai-service/src/main/java/com/hai/service/HighOrderPreService.java
  8. 12
      hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java
  9. 56
      hai-service/src/main/java/com/hai/service/impl/HighOrderPreServiceImpl.java
  10. 40
      hai-service/src/main/java/com/hai/service/impl/HighRefundAuditServiceImpl.java

@ -12,12 +12,14 @@ import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject; import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter; import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil; 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.HighGoodsType;
import com.hai.entity.HighOrder;
import com.hai.entity.HighOrderPre; import com.hai.entity.HighOrderPre;
import com.hai.model.HighOrderModel; import com.hai.model.*;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighOrderPreService; import com.hai.service.HighOrderPreService;
import com.hai.service.HighOrderService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -54,6 +56,10 @@ public class HighOrderPreController {
@Resource @Resource
private HighOrderPreService highOrderPreService; private HighOrderPreService highOrderPreService;
@Resource
private HighOrderService highOrderService;
@RequestMapping(value = "/getListPreOrder", method = RequestMethod.GET) @RequestMapping(value = "/getListPreOrder", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "获取预约订单列表") @ApiOperation(value = "获取预约订单列表")
@ -212,7 +218,7 @@ public class HighOrderPreController {
highOrderPres.setStatus(4); highOrderPres.setStatus(4);
highOrderPreService.updateOrderPre(highOrderPres); highOrderPreService.updateOrderPre(highOrderPres);
return ResponseMsgUtil.success("预约成功"); return ResponseMsgUtil.success("操作成功");
} catch (Exception e) { } catch (Exception e) {
log.error("HighAgentController --> insertAgent() error!", e); log.error("HighAgentController --> insertAgent() error!", e);
@ -277,7 +283,7 @@ public class HighOrderPreController {
} }
String name = "/goodsOrder/预约商品订单" + System.currentTimeMillis() + ".xlsx"; String name = "/goodsOrder/预约商品订单" + System.currentTimeMillis() + ".xlsx";
List<HighOrderPre> list = highOrderPreService.getListOrderPre(map); List<HighOrderPreModel> list = highOrderPreService.ExportPreOrderList(map);
String fileName = SysConst.getSysConfig().getFileUrl() + name; String fileName = SysConst.getSysConfig().getFileUrl() + name;
EasyExcel.write(fileName, ExportHighPreOrderModel.class).sheet("预约商品订单").doWrite(list); EasyExcel.write(fileName, ExportHighPreOrderModel.class).sheet("预约商品订单").doWrite(list);
return ResponseMsgUtil.success(name); 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);
}
}
} }

@ -8,11 +8,15 @@ import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject; import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter; import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil; 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.HighRefundAudit;
import com.hai.entity.OutRechargeOrder; import com.hai.entity.OutRechargeOrder;
import com.hai.model.HighAgentModel; import com.hai.model.HighAgentModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel; import com.hai.model.UserInfoModel;
import com.hai.service.HighOrderPreService;
import com.hai.service.HighOrderService;
import com.hai.service.HighRefundAuditService; import com.hai.service.HighRefundAuditService;
import com.hai.service.OutRechargeOrderService; import com.hai.service.OutRechargeOrderService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -49,6 +53,12 @@ public class HighRefundAuditController {
@Resource @Resource
private OutRechargeOrderService outRechargeOrderService; private OutRechargeOrderService outRechargeOrderService;
@Resource
private HighOrderService highOrderService;
@Resource
private HighOrderPreService highOrderPreService;
@Autowired @Autowired
private UserCenter userCenter; private UserCenter userCenter;
@ -97,7 +107,6 @@ public class HighRefundAuditController {
map.put("payTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeE)); map.put("payTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeE));
} }
PageHelper.startPage(pageNum,pageSize); PageHelper.startPage(pageNum,pageSize);
return ResponseMsgUtil.success(new PageInfo<>(highRefundAuditService.getListRefundAudit(map))); return ResponseMsgUtil.success(new PageInfo<>(highRefundAuditService.getListRefundAudit(map)));
@ -145,13 +154,24 @@ public class HighRefundAuditController {
HighRefundAudit highRefundAudit = highRefundAuditService.getRefundAuditById(id); HighRefundAudit highRefundAudit = highRefundAuditService.getRefundAuditById(id);
if (highRefundAudit.getRefundSource() == 1) {
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(highRefundAudit.getSourceOrderNo()); OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(highRefundAudit.getSourceOrderNo());
highRefundAudit.setStatus(2);
outRechargeOrder.setStatus(2); 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);
highRefundAuditService.updateRefundAudit(highRefundAudit); highRefundAuditService.updateRefundAudit(highRefundAudit);
outRechargeOrderService.updateOrder(outRechargeOrder);
return ResponseMsgUtil.success(highRefundAuditService.getRefundAuditById(id)); return ResponseMsgUtil.success(highRefundAuditService.getRefundAuditById(id));
@ -175,4 +195,7 @@ public class HighRefundAuditController {
} }
} }
} }

@ -3,6 +3,7 @@ package com.bweb.model;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
public class ExportHighPreOrderModel { public class ExportHighPreOrderModel {
@ExcelProperty("预约订单号") @ExcelProperty("预约订单号")
@ -15,10 +16,7 @@ public class ExportHighPreOrderModel {
private String goodsName; private String goodsName;
@ExcelProperty("支付金额") @ExcelProperty("支付金额")
private String payRealPrice; private BigDecimal payRealPrice;
@ExcelProperty("预约时间")
private String preTime;
@ExcelProperty("用户姓名") @ExcelProperty("用户姓名")
private String preUserName; private String preUserName;
@ -29,11 +27,26 @@ public class ExportHighPreOrderModel {
@ExcelProperty("预约用户备注") @ExcelProperty("预约用户备注")
private String preUserRemark; private String preUserRemark;
@ExcelProperty("预约失败说明")
private String statusFailDesc;
@ExcelProperty("到达时间") @ExcelProperty("到达时间")
private BigDecimal reachTime; private Date reachTime;
@ExcelProperty("到达地点") @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() { public String getPreOrderNo() {
return preOrderNo; return preOrderNo;
@ -59,22 +72,14 @@ public class ExportHighPreOrderModel {
this.goodsName = goodsName; this.goodsName = goodsName;
} }
public String getPayRealPrice() { public BigDecimal getPayRealPrice() {
return payRealPrice; return payRealPrice;
} }
public void setPayRealPrice(String payRealPrice) { public void setPayRealPrice(BigDecimal payRealPrice) {
this.payRealPrice = payRealPrice; this.payRealPrice = payRealPrice;
} }
public String getPreTime() {
return preTime;
}
public void setPreTime(String preTime) {
this.preTime = preTime;
}
public String getPreUserName() { public String getPreUserName() {
return preUserName; return preUserName;
} }
@ -99,19 +104,59 @@ public class ExportHighPreOrderModel {
this.preUserRemark = preUserRemark; this.preUserRemark = preUserRemark;
} }
public BigDecimal getReachTime() { public String getStatusFailDesc() {
return statusFailDesc;
}
public void setStatusFailDesc(String statusFailDesc) {
this.statusFailDesc = statusFailDesc;
}
public Date getReachTime() {
return reachTime; return reachTime;
} }
public void setReachTime(BigDecimal reachTime) { public void setReachTime(Date reachTime) {
this.reachTime = reachTime; this.reachTime = reachTime;
} }
public BigDecimal getReachAddress() { public String getReachAddress() {
return reachAddress; return reachAddress;
} }
public void setReachAddress(BigDecimal reachAddress) { public void setReachAddress(String reachAddress) {
this.reachAddress = 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;
}
} }

@ -3,6 +3,7 @@ package com.hai.dao;
import com.hai.entity.HighOrder; import com.hai.entity.HighOrder;
import com.hai.model.HighOrderData; import com.hai.model.HighOrderData;
import com.hai.model.HighOrderModel; import com.hai.model.HighOrderModel;
import com.hai.model.HighOrderPreModel;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results; import org.apache.ibatis.annotations.Results;
@ -586,4 +587,39 @@ public interface HighOrderMapperExt {
List<Map<String,Object>> selectFinishGasOrder(); List<Map<String,Object>> selectFinishGasOrder();
@Select({"<script>" +
" SELECT" +
" op.pre_order_no preOrderNo , " +
" op.order_no orderNo , " +
" op.pay_real_price payRealPrice , " +
" op.goods_name goodsName , " +
" op.pre_user_name preUserName , " +
" op.pre_user_phone preUserPhone , " +
" op.pre_user_remark preUserRemark , " +
" op.status_fail_desc statusFailDesc , " +
" op.reach_time reachTime , " +
" op.reach_address reachAddress , " +
" ms.store_name storeName , " +
" ms.address address , " +
" op.create_time createTime , " +
" case op.status when 1 then '预约中' when 2 then '预约成功' when 3 then '预约完成' when 4 then '预约失败' end status" +
" FROM" +
" high_order_pre op join high_merchant_store ms on op.merchant_store_id = ms.id " +
" WHERE" +
" 1=1" +
" <if test='map.companyId != null'> and op.company_id = #{map.companyId} </if> " +
" <if test='map.merchantStoreId != null'> and op.merchant_store_id = #{map.merchantStoreId} </if>",
" <if test='map.merchantId != null'> and op.merchant_id = #{map.merchantId} </if> " +
" <if test='map.orderNo != null'> and op.order_no = #{map.orderNo}</if>",
" <if test='map.preOrderNo != null'> and op.pre_order_no = #{map.preOrderNo} </if>",
" <if test='map.pre_user_name != null'> and op.pre_user_name = #{map.pre_user_name} </if>",
" <if test='map.pre_user_phone != null'> and op.preUserName = #{map.pre_user_phone} </if>",
" <if test='map.goods_name != null'> and op.goodsName = #{map.goods_name} </if>",
" <if test='map.status != null'> and op.status = #{map.status} </if>",
" <if test='map.createTimeS != null'> <![CDATA[ and op.create_time >= #{map.createTimeS} ]]> </if>",
" <if test='map.createTimeE != null'> <![CDATA[ and op.create_time <= #{map.createTimeE} ]]> </if>",
" ORDER BY op.create_time desc" +
"</script>"})
List<HighOrderPreModel> ExportPreOrderList(@Param("map") Map<String,Object> map);
} }

@ -20,7 +20,7 @@ public class HighRefundAudit implements Serializable {
private Integer id; private Integer id;
/** /**
* 退款来源 1话费 * 退款来源 1话费 2优选商品
*/ */
private Integer refundSource; private Integer refundSource;

@ -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;
}
}

@ -1,6 +1,10 @@
package com.hai.service; package com.hai.service;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder;
import com.hai.entity.HighOrderPre; import com.hai.entity.HighOrderPre;
import com.hai.model.HighOrderPreModel;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -15,6 +19,16 @@ public interface HighOrderPreService {
**/ **/
List<HighOrderPre> getListOrderPre(Map<String , Object> map); List<HighOrderPre> getListOrderPre(Map<String , Object> map);
/**
* @Author Sum1Dream
* @name ExportPreOrderList.java
* @Description // 查询导出订单
* @Date 12:09 下午 2021/11/22
* @Param [java.util.Map<java.lang.String,java.lang.Object>]
* @return java.util.List<com.hai.model.HighOrderPreModel>
*/
List<HighOrderPreModel> ExportPreOrderList(Map<String , Object> map);
/** /**
* @Author Sum1Dream * @Author Sum1Dream
* @Description // 根据订单ID查询订单 * @Description // 根据订单ID查询订单
@ -40,6 +54,16 @@ public interface HighOrderPreService {
**/ **/
HighOrderPre findByOrderNo(String orderNo); 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 * @Author Sum1Dream
* @Description // 新增订单 * @Description // 新增订单
@ -63,4 +87,15 @@ public interface HighOrderPreService {
* @param preOrderId * @param preOrderId
*/ */
void orderComplete(Long 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;
} }

@ -356,8 +356,16 @@ public class HighCouponServiceImpl implements HighCouponService {
criteria.andDisplayAreaEqualTo(MapUtils.getInteger(map, "displayArea")); criteria.andDisplayAreaEqualTo(MapUtils.getInteger(map, "displayArea"));
} }
if (MapUtils.getInteger(map, "couponSource") != null) { if (MapUtils.getInteger(map, "displayArea") != null) {
criteria.andCouponSourceEqualTo(MapUtils.getInteger(map, "couponSource")); 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) { if (MapUtils.getInteger(map, "status") != null) {

@ -4,10 +4,15 @@ import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
import com.hai.common.utils.DateUtil; import com.hai.common.utils.DateUtil;
import com.hai.config.WxOrderConfig;
import com.hai.dao.HighOrderMapper;
import com.hai.dao.HighOrderPreMapper; import com.hai.dao.HighOrderPreMapper;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder; import com.hai.entity.HighOrder;
import com.hai.entity.HighOrderPre; import com.hai.entity.HighOrderPre;
import com.hai.entity.HighOrderPreExample; import com.hai.entity.HighOrderPreExample;
import com.hai.model.HighOrderPreModel;
import com.hai.model.OrderRefundModel;
import com.hai.service.HighOrderPreService; import com.hai.service.HighOrderPreService;
import com.hai.service.HighOrderService; import com.hai.service.HighOrderService;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
@ -30,6 +35,12 @@ public class HighOrderPreServiceImpl implements HighOrderPreService {
@Resource @Resource
private HighOrderService highOrderService; private HighOrderService highOrderService;
@Resource
private HighOrderMapper highOrderMapper;
@Resource
private HighOrderPreService highOrderPreService;
@Override @Override
public List<HighOrderPre> getListOrderPre(Map<String, Object> map) { public List<HighOrderPre> getListOrderPre(Map<String, Object> map) {
HighOrderPreExample example = new HighOrderPreExample(); HighOrderPreExample example = new HighOrderPreExample();
@ -86,9 +97,16 @@ public class HighOrderPreServiceImpl implements HighOrderPreService {
criteria.andPreUserNameLike("%" + MapUtils.getString(map, "preUserName") + "%"); criteria.andPreUserNameLike("%" + MapUtils.getString(map, "preUserName") + "%");
} }
example.setOrderByClause("create_time desc");
return highOrderPreMapper.selectByExample(example); return highOrderPreMapper.selectByExample(example);
} }
@Override
public List<HighOrderPreModel> ExportPreOrderList(Map<String, Object> map) {
return highOrderMapper.ExportPreOrderList(map);
}
@Override @Override
public HighOrderPre findByOrderId(Long orderId) { public HighOrderPre findByOrderId(Long orderId) {
return highOrderPreMapper.selectByPrimaryKey(orderId); return highOrderPreMapper.selectByPrimaryKey(orderId);
@ -107,6 +125,23 @@ public class HighOrderPreServiceImpl implements HighOrderPreService {
@Override @Override
public HighOrderPre findByOrderNo(String orderNo) { public HighOrderPre findByOrderNo(String orderNo) {
HighOrderPreExample example = new HighOrderPreExample();
example.createCriteria().andOrderNoEqualTo(orderNo);
List<HighOrderPre> 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<HighOrderPre> list = highOrderPreMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null; return null;
} }
@ -139,4 +174,25 @@ public class HighOrderPreServiceImpl implements HighOrderPreService {
highOrderService.childOrderComplete(orderPre.getChildOrderId()); 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);
}
}
}
} }

@ -2,11 +2,10 @@ package com.hai.service.impl;
import com.hai.common.utils.DateUtil; import com.hai.common.utils.DateUtil;
import com.hai.dao.HighRefundAuditMapper; import com.hai.dao.HighRefundAuditMapper;
import com.hai.entity.HighRefundAudit; import com.hai.entity.*;
import com.hai.entity.HighRefundAuditExample;
import com.hai.entity.OutRechargeOrder;
import com.hai.entity.OutRechargeOrderExample;
import com.hai.model.UserInfoModel; import com.hai.model.UserInfoModel;
import com.hai.service.HighOrderPreService;
import com.hai.service.HighOrderService;
import com.hai.service.HighRefundAuditService; import com.hai.service.HighRefundAuditService;
import com.hai.service.OutRechargeOrderService; import com.hai.service.OutRechargeOrderService;
import io.swagger.models.auth.In; import io.swagger.models.auth.In;
@ -31,6 +30,12 @@ public class HighRefundAuditServiceImpl implements HighRefundAuditService {
@Resource @Resource
private OutRechargeOrderService outRechargeOrderService; private OutRechargeOrderService outRechargeOrderService;
@Resource
private HighOrderService highOrderService;
@Resource
private HighOrderPreService highOrderPreService;
@Override @Override
public List<HighRefundAudit> getListRefundAudit(Map<String, String> map) { public List<HighRefundAudit> getListRefundAudit(Map<String, String> map) {
@ -85,20 +90,35 @@ public class HighRefundAuditServiceImpl implements HighRefundAuditService {
@Transactional(propagation= Propagation.REQUIRES_NEW) @Transactional(propagation= Propagation.REQUIRES_NEW)
public void insertRefundAudit(HighRefundAudit highRefundAudit , UserInfoModel userInfoModel) { public void insertRefundAudit(HighRefundAudit highRefundAudit , UserInfoModel userInfoModel) {
if (highRefundAudit.getRefundSource() == 1) {
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(highRefundAudit.getSourceOrderNo()); 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.setCompanId(userInfoModel.getBsCompany().getId().intValue());
highRefundAudit.setStatus(0); highRefundAudit.setStatus(0);
highRefundAudit.setRefundPrice(outRechargeOrder.getPayPrice());
highRefundAudit.setCreatedTime(new Date()); highRefundAudit.setCreatedTime(new Date());
highRefundAudit.setCreatedUserId(userInfoModel.getSecUser().getId().intValue()); highRefundAudit.setCreatedUserId(userInfoModel.getSecUser().getId().intValue());
highRefundAudit.setCreatedUserName(userInfoModel.getSecUser().getUserName()); 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); highRefundAuditMapper.insert(highRefundAudit);
} }

Loading…
Cancel
Save