dev-discount
胡锐 2 years ago
parent 3115f9590a
commit f22e34bbf2
  1. 91
      hai-order/src/main/java/com/web/controller/OrderRefundController.java
  2. 74
      hai-service/src/main/java/com/hai/order/model/ExportOrderRefundModel.java
  3. 19
      hai-service/src/main/java/com/hai/order/service/impl/OrderRefundServiceImpl.java

@ -1,5 +1,6 @@
package com.web.controller; package com.web.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@ -10,17 +11,22 @@ import com.hai.common.security.UserCenter;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighChildOrder; import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder; import com.hai.entity.HighOrder;
import com.hai.entity.HighOrderRefund;
import com.hai.model.HighUserModel; import com.hai.model.HighUserModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.order.model.CreateOrderChildModel; import com.hai.order.model.CreateOrderChildModel;
import com.hai.order.model.CreateOrderModel; import com.hai.order.model.CreateOrderModel;
import com.hai.order.model.ExportGasOrderModel;
import com.hai.order.model.ExportOrderRefundModel;
import com.hai.order.service.OrderPaySuccessService; import com.hai.order.service.OrderPaySuccessService;
import com.hai.order.service.OrderRefundService; import com.hai.order.service.OrderRefundService;
import com.hai.order.service.OrderService; import com.hai.order.service.OrderService;
import com.hai.order.type.OrderChildGoodsType; import com.hai.order.type.OrderChildGoodsType;
import com.hai.order.type.OrderChildStatus; import com.hai.order.type.OrderChildStatus;
import com.hai.order.type.OrderPayType; import com.hai.order.type.OrderPayType;
import com.hai.order.type.OrderRefundStatus;
import com.hai.order.utils.OrderUtil; import com.hai.order.utils.OrderUtil;
import com.web.config.SysConst;
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;
@ -32,8 +38,11 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.File;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
@Controller @Controller
@ -160,16 +169,27 @@ public class OrderRefundController {
@RequestParam(name = "refundOrderNo", required = false) String refundOrderNo, @RequestParam(name = "refundOrderNo", required = false) String refundOrderNo,
@RequestParam(name = "memPhone", required = false) String memPhone, @RequestParam(name = "memPhone", required = false) String memPhone,
@RequestParam(name = "goodsType", required = false) Integer goodsType, @RequestParam(name = "goodsType", required = false) Integer goodsType,
@RequestParam(name = "goodsName", required = false) String goodsName,
@RequestParam(name = "status", required = false) Integer status, @RequestParam(name = "status", required = false) Integer status,
@RequestParam(name = "createTimeS", required = false) Long createTimeS,
@RequestParam(name = "createTimeE", required = false) Long createTimeE,
@RequestParam(name = "refundTimeS", required = false) Long refundTimeS,
@RequestParam(name = "refundTimeE", required = false) Long refundTimeE,
@RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) { @RequestParam(name = "pageSize", required = true) Integer pageSize) {
try { try {
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("orderNo", orderNo); param.put("orderNo", orderNo);
param.put("orderChildNo", orderChildNo); param.put("orderChildNo", orderChildNo);
param.put("refundOrderNo", refundOrderNo);
param.put("memPhone", memPhone); param.put("memPhone", memPhone);
param.put("goodsType", goodsType); param.put("goodsType", goodsType);
param.put("goodsName", goodsName);
param.put("status", status); param.put("status", status);
param.put("createTimeS", createTimeS);
param.put("createTimeE", createTimeE);
param.put("refundTimeS", refundTimeS);
param.put("refundTimeE", refundTimeE);
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
return ResponseMsgUtil.success(new PageInfo<>(orderRefundService.getRefundOrderList(param))); return ResponseMsgUtil.success(new PageInfo<>(orderRefundService.getRefundOrderList(param)));
@ -180,4 +200,75 @@ public class OrderRefundController {
} }
} }
@RequestMapping(value="/excelRefund",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "导出退款")
public ResponseData excelRefund(@RequestParam(name = "orderNo", required = false) String orderNo,
@RequestParam(name = "orderChildNo", required = false) String orderChildNo,
@RequestParam(name = "refundOrderNo", required = false) String refundOrderNo,
@RequestParam(name = "memPhone", required = false) String memPhone,
@RequestParam(name = "goodsType", required = false) Integer goodsType,
@RequestParam(name = "goodsName", required = false) String goodsName,
@RequestParam(name = "status", required = false) Integer status,
@RequestParam(name = "createTimeS", required = false) Long createTimeS,
@RequestParam(name = "createTimeE", required = false) Long createTimeE,
@RequestParam(name = "refundTimeS", required = false) Long refundTimeS,
@RequestParam(name = "refundTimeE", required = false) Long refundTimeE) {
try {
Map<String, Object> param = new HashMap<>();
param.put("orderNo", orderNo);
param.put("orderChildNo", orderChildNo);
param.put("refundOrderNo", refundOrderNo);
param.put("memPhone", memPhone);
param.put("goodsType", goodsType);
param.put("goodsName", goodsName);
param.put("status", status);
param.put("createTimeS", createTimeS);
param.put("createTimeE", createTimeE);
param.put("refundTimeS", refundTimeS);
param.put("refundTimeE", refundTimeE);
List<HighOrderRefund> list = orderRefundService.getRefundOrderList(param);
List<ExportOrderRefundModel> orderRefundModelList = new ArrayList<>();
ExportOrderRefundModel orderRefundModel;
for (HighOrderRefund orderRefund : list) {
orderRefundModel = new ExportOrderRefundModel();
orderRefundModel.setOrderNo(orderRefund.getOrderNo());
orderRefundModel.setChildOrderNo(orderRefund.getOrderChildNo());
orderRefundModel.setMemPhone(orderRefund.getMemPhone());
orderRefundModel.setGoodsType(OrderChildGoodsType.getDataByType(orderRefund.getGoodsType()).getName());
orderRefundModel.setGoodsName(orderRefund.getGoodsName());
orderRefundModel.setRefundOrderNo(orderRefund.getRefundOrderNo());
orderRefundModel.setRefundGoodsNum(orderRefund.getRefundGoodsNum());
orderRefundModel.setReturnTotalPrice(orderRefund.getReturnTotalPrice());
orderRefundModel.setRefundPrice(orderRefund.getRefundPrice());
orderRefundModel.setRefundIntegral(orderRefund.getRefundIntegral());
orderRefundModel.setRefundStatus(OrderRefundStatus.getDataByType(orderRefund.getRefundStatus()).getName());
orderRefundModel.setCreateTime(orderRefund.getCreateTime());
orderRefundModel.setRefundTime(orderRefund.getRefundTime());
orderRefundModel.setRefundRemark(orderRefund.getRefundRemark());
orderRefundModelList.add(orderRefundModel);
}
String fileUrl = SysConst.getSysConfig().getFileUrl() + "/temporary/";
String pathName = System.currentTimeMillis()+".xlsx";
File file = new File(fileUrl);
if (!file.exists()) {
file.mkdirs();
}
EasyExcel.write(fileUrl+pathName)
.head(ExportOrderRefundModel.class)
.sheet("交易退款记录")
.doWrite(orderRefundModelList);
return ResponseMsgUtil.success(fileUrl+pathName);
} catch (Exception e) {
log.error("OrderRefundController -> excelRefund() error!",e);
return ResponseMsgUtil.exception(e);
}
}
} }

@ -0,0 +1,74 @@
package com.hai.order.model;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 订单退款模型
* @className: ExportGasOrderModel
* @author: HuRui
* @date: 2022/10/28
**/
@Data
public class ExportOrderRefundModel {
@ColumnWidth(25)
@ExcelProperty("交易单号")
private String orderNo;
@ColumnWidth(25)
@ExcelProperty("产品单号")
private String childOrderNo;
@ColumnWidth(15)
@ExcelProperty("客户电话")
private String memPhone;
@ColumnWidth(15)
@ExcelProperty("产品类型")
private String goodsType;
@ColumnWidth(30)
@ExcelProperty("产品名称")
private String goodsName;
@ColumnWidth(25)
@ExcelProperty("退款单号")
private String refundOrderNo;
@ColumnWidth(15)
@ExcelProperty("退款数量")
private Integer refundGoodsNum;
@ColumnWidth(15)
@ExcelProperty("退款总额")
private BigDecimal returnTotalPrice;
@ColumnWidth(15)
@ExcelProperty("退款金额")
private BigDecimal refundPrice;
@ColumnWidth(15)
@ExcelProperty("退款积分")
private Integer refundIntegral;
@ColumnWidth(15)
@ExcelProperty("退款状态")
private String refundStatus;
@ColumnWidth(15)
@ExcelProperty("创建时间")
private Date createTime;
@ColumnWidth(15)
@ExcelProperty("退款时间")
private Date refundTime;
@ColumnWidth(50)
@ExcelProperty("退款备注")
private String refundRemark;
}

@ -147,8 +147,23 @@ public class OrderRefundServiceImpl implements OrderRefundService {
criteria.andGoodsNameLike("%"+MapUtils.getString(param, "goodsName")+"%"); criteria.andGoodsNameLike("%"+MapUtils.getString(param, "goodsName")+"%");
} }
if (StringUtils.isNotBlank(MapUtils.getString(param, "goodsName"))) { if (MapUtils.getInteger(param, "status") != null) {
criteria.andGoodsNameLike("%"+MapUtils.getString(param, "goodsName")+"%"); criteria.andRefundStatusEqualTo(MapUtils.getInteger(param, "status"));
}
if (MapUtils.getLong(param, "createTimeS") != null) {
criteria.andCreateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(param, "createTimeS")));
}
if (MapUtils.getLong(param, "createTimeE") != null) {
criteria.andCreateTimeLessThanOrEqualTo(new Date(MapUtils.getLong(param, "createTimeE")));
}
if (MapUtils.getLong(param, "refundTimeS") != null) {
criteria.andRefundTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(param, "refundTimeS")));
}
if (MapUtils.getLong(param, "refundTimeE") != null) {
criteria.andRefundTimeLessThanOrEqualTo(new Date(MapUtils.getLong(param, "refundTimeE")));
} }
example.setOrderByClause("create_time desc"); example.setOrderByClause("create_time desc");

Loading…
Cancel
Save