提交代码

master
胡锐 10 months ago
parent 7ed69e6279
commit 22f497b1a3
  1. 211
      hai-order/src/main/java/com/web/controller/business/OrderOilCardController.java
  2. 12
      hai-service/src/main/java/com/hai/config/ChongQingCNPCService.java
  3. 38
      hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java
  4. 7
      hai-service/src/main/java/com/hai/order/service/OrderService.java
  5. 29
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java

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

@ -54,6 +54,18 @@ public class ChongQingCNPCService {
return request("sendCNPCTicket", map);
}
/**
* 电子券作废
* @param couponNo 电子券编号
* @param random 随机数
*/
public static JSONObject invalidCoupon(String couponNo, String random) throws Exception {
Map<String, Object> map = new HashMap<>();
map.put("couponNo", couponNo);
map.put("random", random);
return request("invalidCoupon", map);
}
/**
* 获取中石油跨界券核销码
* @param couponNo

@ -1231,4 +1231,42 @@ public interface HighOrderMapperExt {
})
Map<String, Object> HltCardNoTopUpStatistic();
@Select("<script>" +
" select " +
" a.order_no orderNo," +
" a.mem_phone memPhone," +
" b.goods_spec_name oildCard, " +
" b.goods_actual_price goodsActualPrice," +
" (b.goods_price - b.goods_actual_price) givePrice," +
" b.goods_price goodsPrice, " +
" a.pay_real_price payRealPrice, " +
" case a.order_status " +
" when 1 then '待支付'" +
" when 2 then '已支付'" +
" when 3 then '已完成'" +
" when 4 then '已退款'" +
" when 5 then '已取消'" +
" end orderStatus," +
" a.create_time createTime," +
" b.pay_time payTime, " +
" b.refund_time refundTime," +
" a.exception_status exceptionStatus " +
" from high_order a" +
" LEFT JOIN high_child_order b on b.order_id = a.id " +
" where a.product_type = 16" +
" <if test='param.orderNo != null'> and a.order_no LIKE concat('%',#{param.orderNo},'%') </if>" +
" <if test='param.oilCardNo != null'> and b.goods_spec_name LIKE concat('%',#{param.oilCardNo},'%') </if>" +
" <if test='param.memPhone != null'> and a.mem_phone LIKE concat('%',#{param.memPhone},'%') </if>" +
" <if test='param.createTimeS != null'> <![CDATA[ and a.create_time >= #{param.createTimeS} ]]> </if>" +
" <if test='param.createTimeE != null'> <![CDATA[ and a.create_time <= #{param.createTimeE} ]]> </if>" +
" <if test='param.payTimeS != null'> <![CDATA[ and a.pay_time >= #{param.payTimeS} ]]> </if>" +
" <if test='param.payTimeE != null'> <![CDATA[ and a.pay_time <= #{param.payTimeE} ]]> </if>" +
" <if test='param.refundTimeS != null'> <![CDATA[ and a.refund_time >= #{param.refundTimeS} ]]> </if>" +
" <if test='param.refundTimeE != null'> <![CDATA[ and a.refund_time <= #{param.refundTimeE} ]]> </if>" +
" <if test='param.status != null'> <![CDATA[ and a.order_status = #{param.status} ]]> </if>" +
" ORDER BY a.create_time desc" +
" </script>")
List<Map<String,Object>> getOilCardOrderList(@Param("param") Map<String,Object> param);
}

@ -146,4 +146,11 @@ public interface OrderService {
* @Return com.alibaba.fastjson.JSONObject
*/
JSONObject createOrderCombine(CreateCombine createCombine) throws Exception;
/**
* 查询油卡充值订单
* @param param
* @return
*/
List<Map<String,Object>> getOilCardOrderList(Map<String,Object> param) throws Exception;
}

@ -1097,4 +1097,33 @@ public class OrderServiceImpl implements OrderService {
return null;
}
@Override
public List<Map<String, Object>> getOilCardOrderList(Map<String, Object> param) throws Exception {
if (MapUtils.getLong(param, "createTimeS") != null) {
param.put("createTimeS", DateUtil.date2String(new Date(MapUtils.getLong(param, "createTimeS")), DateUtil.Y_M_D_HMS));
}
if (MapUtils.getLong(param, "createTimeE") != null) {
param.put("createTimeE", DateUtil.date2String(new Date(MapUtils.getLong(param, "createTimeE")), DateUtil.Y_M_D_HMS));
}
if (MapUtils.getLong(param, "payTimeS") != null) {
param.put("payTimeS", DateUtil.date2String(new Date(MapUtils.getLong(param, "payTimeS")), DateUtil.Y_M_D_HMS));
}
if (MapUtils.getLong(param, "payTimeE") != null) {
param.put("payTimeE", DateUtil.date2String(new Date(MapUtils.getLong(param, "payTimeE")), DateUtil.Y_M_D_HMS));
}
if (MapUtils.getLong(param, "refundTimeS") != null) {
param.put("refundTimeS", DateUtil.date2String(new Date(MapUtils.getLong(param, "refundTimeS")), DateUtil.Y_M_D_HMS));
}
if (MapUtils.getLong(param, "refundTimeE") != null) {
param.put("refundTimeE", DateUtil.date2String(new Date(MapUtils.getLong(param, "refundTimeE")), DateUtil.Y_M_D_HMS));
}
return orderMapper.getOilCardOrderList(param);
}
}

Loading…
Cancel
Save