parent
7ed69e6279
commit
22f497b1a3
@ -0,0 +1,211 @@ |
|||||||
|
package com.web.controller.business; |
||||||
|
|
||||||
|
import com.alibaba.excel.EasyExcel; |
||||||
|
import com.github.pagehelper.PageHelper; |
||||||
|
import com.github.pagehelper.PageInfo; |
||||||
|
import com.hai.common.exception.ErrorCode; |
||||||
|
import com.hai.common.exception.ErrorHelp; |
||||||
|
import com.hai.common.exception.SysCode; |
||||||
|
import com.hai.common.security.UserCenter; |
||||||
|
import com.hai.common.utils.DateUtil; |
||||||
|
import com.hai.common.utils.ResponseMsgUtil; |
||||||
|
import com.hai.entity.HighGasOrder; |
||||||
|
import com.hai.enum_type.MerchantStoreSourceType; |
||||||
|
import com.hai.enum_type.UserObjectTypeEnum; |
||||||
|
import com.hai.enum_type.UserRoleTypeEnum; |
||||||
|
import com.hai.model.ResponseData; |
||||||
|
import com.hai.model.UserInfoModel; |
||||||
|
import com.hai.order.model.ExportGasOrderModel; |
||||||
|
import com.hai.order.service.OrderService; |
||||||
|
import com.hai.order.service.OrderServiceExt; |
||||||
|
import com.hai.order.type.OrderOilStatus; |
||||||
|
import com.hai.order.type.OrderPayType; |
||||||
|
import com.hai.service.HighGasOrderService; |
||||||
|
import com.web.config.SysConst; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import org.apache.commons.collections4.MapUtils; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.slf4j.Logger; |
||||||
|
import org.slf4j.LoggerFactory; |
||||||
|
import org.springframework.stereotype.Controller; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestMethod; |
||||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.io.File; |
||||||
|
import java.math.BigDecimal; |
||||||
|
import java.util.*; |
||||||
|
|
||||||
|
@Controller |
||||||
|
@RequestMapping(value = "oilCard") |
||||||
|
@Api(value = "油卡充值业务") |
||||||
|
public class OrderOilCardController { |
||||||
|
|
||||||
|
private static Logger log = LoggerFactory.getLogger(OrderOilCardController.class); |
||||||
|
|
||||||
|
@Resource |
||||||
|
private UserCenter userCenter; |
||||||
|
|
||||||
|
@Resource |
||||||
|
private OrderService orderService; |
||||||
|
|
||||||
|
@Resource |
||||||
|
private OrderServiceExt orderServiceExt; |
||||||
|
|
||||||
|
@RequestMapping(value="/getOilCardOrderList",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "查询油卡充值订单列表") |
||||||
|
public ResponseData getOilCardOrderList(@RequestParam(name = "orderNo", required = false) String orderNo, |
||||||
|
@RequestParam(name = "oilCardNo", required = false) String oilCardNo, |
||||||
|
@RequestParam(name = "memPhone", required = false) String memPhone, |
||||||
|
@RequestParam(name = "payType", required = false) Integer payType, |
||||||
|
@RequestParam(name = "status", required = false) Integer status, |
||||||
|
@RequestParam(name = "createTimeS", required = false) Long createTimeS, |
||||||
|
@RequestParam(name = "createTimeE", required = false) Long createTimeE, |
||||||
|
@RequestParam(name = "payTimeS", required = false) Long payTimeS, |
||||||
|
@RequestParam(name = "payTimeE", required = false) Long payTimeE, |
||||||
|
@RequestParam(name = "refundTimeS", required = false) Long refundTimeS, |
||||||
|
@RequestParam(name = "refundTimeE", required = false) Long refundTimeE, |
||||||
|
@RequestParam(name = "pageNum", required = true) Integer pageNum, |
||||||
|
@RequestParam(name = "pageSize", required = true) Integer pageSize |
||||||
|
) { |
||||||
|
try { |
||||||
|
Map<String, Object> param = new HashMap<>(); |
||||||
|
param.put("orderNo", orderNo); |
||||||
|
param.put("memPhone", memPhone); |
||||||
|
param.put("oilCardNo", oilCardNo); |
||||||
|
param.put("payType", payType); |
||||||
|
param.put("status", status); |
||||||
|
param.put("createTimeS", createTimeS); |
||||||
|
param.put("createTimeE", createTimeE); |
||||||
|
param.put("payTimeS", payTimeS); |
||||||
|
param.put("payTimeE", payTimeE); |
||||||
|
param.put("refundTimeS", refundTimeS); |
||||||
|
param.put("refundTimeE", refundTimeE); |
||||||
|
|
||||||
|
PageHelper.startPage(pageNum, pageSize); |
||||||
|
return ResponseMsgUtil.success(new PageInfo<>(orderService.getOilCardOrderList(param))); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("OrderOilCardController -> getOilCardOrderList() error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value="/getOrderDetail",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "查询订单详情") |
||||||
|
public ResponseData getOrderDetail(@RequestParam(name = "orderNo", required = true) String orderNo) { |
||||||
|
try { |
||||||
|
|
||||||
|
return ResponseMsgUtil.success(orderService.getOrderDetailByNo(orderNo)); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("OrderExtController -> getGasOrderDetail() error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value="/exportOilCardOrder",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "导出油卡充值订单") |
||||||
|
public ResponseData exportOilCardOrder(@RequestParam(name = "orderNo", required = false) String orderNo, |
||||||
|
@RequestParam(name = "oilCardNo", required = false) String oilCardNo, |
||||||
|
@RequestParam(name = "memPhone", required = false) String memPhone, |
||||||
|
@RequestParam(name = "payType", required = false) Integer payType, |
||||||
|
@RequestParam(name = "status", required = false) Integer status, |
||||||
|
@RequestParam(name = "createTimeS", required = false) Long createTimeS, |
||||||
|
@RequestParam(name = "createTimeE", required = false) Long createTimeE, |
||||||
|
@RequestParam(name = "payTimeS", required = false) Long payTimeS, |
||||||
|
@RequestParam(name = "payTimeE", required = false) Long payTimeE, |
||||||
|
@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("memPhone", memPhone); |
||||||
|
param.put("oilCardNo", oilCardNo); |
||||||
|
param.put("payType", payType); |
||||||
|
param.put("status", status); |
||||||
|
param.put("createTimeS", createTimeS); |
||||||
|
param.put("createTimeE", createTimeE); |
||||||
|
param.put("payTimeS", payTimeS); |
||||||
|
param.put("payTimeE", payTimeE); |
||||||
|
param.put("refundTimeS", refundTimeS); |
||||||
|
param.put("refundTimeE", refundTimeE); |
||||||
|
|
||||||
|
// 查询数据
|
||||||
|
List<Map<String, Object>> orderList = orderService.getOilCardOrderList(param); |
||||||
|
|
||||||
|
List<List<Object>> dataList = new ArrayList<>(); |
||||||
|
List<Object> data; |
||||||
|
|
||||||
|
for (Map<String,Object> order : orderList) { |
||||||
|
data = new ArrayList<>(); |
||||||
|
data.add(MapUtils.getString(order, "orderNo")); |
||||||
|
data.add(MapUtils.getString(order, "memPhone")); |
||||||
|
data.add(MapUtils.getString(order, "oildCard")); |
||||||
|
data.add(MapUtils.getString(order, "goodsActualPrice")); |
||||||
|
data.add(MapUtils.getString(order, "givePrice")); |
||||||
|
data.add(MapUtils.getString(order, "goodsPrice")); |
||||||
|
data.add(MapUtils.getString(order, "payRealPrice")); |
||||||
|
data.add(MapUtils.getString(order, "createTime")); |
||||||
|
data.add(MapUtils.getString(order, "payTime")); |
||||||
|
data.add(MapUtils.getString(order, "refundTime")); |
||||||
|
data.add(MapUtils.getString(order, "orderStatus")); |
||||||
|
dataList.add(data); |
||||||
|
} |
||||||
|
|
||||||
|
List<String> headList = new ArrayList<>();; |
||||||
|
headList.add("交易单号"); |
||||||
|
headList.add("客户电话"); |
||||||
|
headList.add("油卡卡号"); |
||||||
|
headList.add("充值金额"); |
||||||
|
headList.add("赠送金额"); |
||||||
|
headList.add("实际到账金额"); |
||||||
|
headList.add("支付金额"); |
||||||
|
headList.add("创建时间"); |
||||||
|
headList.add("支付时间"); |
||||||
|
headList.add("退款时间"); |
||||||
|
headList.add("交易状态"); |
||||||
|
|
||||||
|
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(generationHead(headList)) |
||||||
|
.sheet("交易订单") |
||||||
|
.doWrite(dataList); |
||||||
|
return ResponseMsgUtil.success(pathName); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("OrderExtController -> exportGasOrderList() error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 生成头部 |
||||||
|
* @param headList |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
private List<List<String>> generationHead(List<String> headList) { |
||||||
|
List<List<String>> list = new ArrayList<>(); |
||||||
|
List<String> head; |
||||||
|
for (String headStr : headList) { |
||||||
|
head = new ArrayList<>(); |
||||||
|
head.add(headStr); |
||||||
|
list.add(head); |
||||||
|
} |
||||||
|
return list; |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue