|
|
@ -1,6 +1,8 @@ |
|
|
|
package com.bweb.controller; |
|
|
|
package com.bweb.controller; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
|
|
|
import com.bweb.config.SysConst; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.hai.common.exception.ErrorCode; |
|
|
|
import com.hai.common.exception.ErrorCode; |
|
|
@ -8,27 +10,20 @@ import com.hai.common.exception.ErrorHelp; |
|
|
|
import com.hai.common.exception.SysCode; |
|
|
|
import com.hai.common.exception.SysCode; |
|
|
|
import com.hai.common.security.UserCenter; |
|
|
|
import com.hai.common.security.UserCenter; |
|
|
|
import com.hai.common.utils.CoordCommonUtil; |
|
|
|
import com.hai.common.utils.CoordCommonUtil; |
|
|
|
|
|
|
|
import com.hai.common.utils.DateUtil; |
|
|
|
import com.hai.common.utils.PageUtil; |
|
|
|
import com.hai.common.utils.PageUtil; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.common.utils.ResponseMsgUtil; |
|
|
|
import com.hai.config.HuiLianTongUnionCardConfig; |
|
|
|
import com.hai.config.HuiLianTongUnionCardConfig; |
|
|
|
import com.hai.config.TuanYouConfig; |
|
|
|
import com.hai.config.TuanYouConfig; |
|
|
|
import com.hai.config.WxOrderConfig; |
|
|
|
import com.hai.config.WxOrderConfig; |
|
|
|
import com.hai.entity.HighChildOrder; |
|
|
|
import com.hai.entity.*; |
|
|
|
import com.hai.entity.HighGasOilPrice; |
|
|
|
import com.hai.enum_type.*; |
|
|
|
import com.hai.entity.HighMerchantStore; |
|
|
|
import com.hai.model.*; |
|
|
|
import com.hai.entity.HighOrder; |
|
|
|
|
|
|
|
import com.hai.enum_type.GasOilPriceStatusEnum; |
|
|
|
|
|
|
|
import com.hai.enum_type.MerStoreAmountSourceTypeEnum; |
|
|
|
|
|
|
|
import com.hai.enum_type.MerStoreAmountTypeEnum; |
|
|
|
|
|
|
|
import com.hai.enum_type.OrderPayTypeEnum; |
|
|
|
|
|
|
|
import com.hai.model.HighMerchantStoreModel; |
|
|
|
|
|
|
|
import com.hai.model.OrderRefundModel; |
|
|
|
|
|
|
|
import com.hai.model.ResponseData; |
|
|
|
|
|
|
|
import com.hai.model.UserInfoModel; |
|
|
|
|
|
|
|
import com.hai.msg.entity.MsgTopic; |
|
|
|
import com.hai.msg.entity.MsgTopic; |
|
|
|
import com.hai.service.*; |
|
|
|
import com.hai.service.*; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
@ -38,6 +33,7 @@ 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.util.*; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
@ -82,15 +78,39 @@ public class HighGasController { |
|
|
|
Map<String, Object> param = new HashMap<>();; |
|
|
|
Map<String, Object> param = new HashMap<>();; |
|
|
|
param.put("gasName", userInfoModel.getMerchantStore().getStoreName()); |
|
|
|
param.put("gasName", userInfoModel.getMerchantStore().getStoreName()); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> today = new HashMap<>(); |
|
|
|
Map<String, Object> history = new HashMap<>(); |
|
|
|
|
|
|
|
// 历史加油总金额
|
|
|
|
|
|
|
|
Map<String, Object> historyTotal = highOrderService.getGasHistoryOrderCount(userInfoModel.getMerchantStore().getId(), "2,3,4,6,7"); |
|
|
|
|
|
|
|
history.put("totalPrice", historyTotal.get("price")); |
|
|
|
|
|
|
|
history.put("totalCount", historyTotal.get("count")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 历史加油金额
|
|
|
|
|
|
|
|
Map<String, Object> historyIncomet = highOrderService.getGasHistoryOrderCount(userInfoModel.getMerchantStore().getId(), "2,3,6,7"); |
|
|
|
|
|
|
|
history.put("incomePrice", historyIncomet.get("price")); |
|
|
|
|
|
|
|
history.put("incomeCount", historyIncomet.get("count")); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> incometObject = highOrderService.getGasTheDayOrderCount(userInfoModel.getMerchantStore().getId(), "2,3,6,7"); |
|
|
|
// 历史退款
|
|
|
|
today.put("incomePrice", incometObject.get("price")); |
|
|
|
Map<String, Object> historyRefund = highOrderService.getGasHistoryOrderCount(userInfoModel.getMerchantStore().getId(), "4"); |
|
|
|
today.put("incomeCount", incometObject.get("count")); |
|
|
|
history.put("refundPrice", historyRefund.get("price")); |
|
|
|
|
|
|
|
history.put("refundCount", historyRefund.get("count")); |
|
|
|
|
|
|
|
param.put("history", history); |
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> refundObject = highOrderService.getGasTheDayOrderCount(userInfoModel.getMerchantStore().getId(), "4"); |
|
|
|
|
|
|
|
today.put("refundPrice", refundObject.get("price")); |
|
|
|
Map<String, Object> today = new HashMap<>(); |
|
|
|
today.put("refundCount", refundObject.get("count")); |
|
|
|
// 今日加油总金额
|
|
|
|
|
|
|
|
Map<String, Object> todayTotal = highOrderService.getGasTheDayOrderCount(userInfoModel.getMerchantStore().getId(), "2,3,4,6,7"); |
|
|
|
|
|
|
|
today.put("totalPrice", todayTotal.get("price")); |
|
|
|
|
|
|
|
today.put("totalCount", todayTotal.get("count")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 今日加油金额
|
|
|
|
|
|
|
|
Map<String, Object> todayIncomet = highOrderService.getGasTheDayOrderCount(userInfoModel.getMerchantStore().getId(), "2,3,6,7"); |
|
|
|
|
|
|
|
today.put("incomePrice", todayIncomet.get("price")); |
|
|
|
|
|
|
|
today.put("incomeCount", todayIncomet.get("count")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 今日退款
|
|
|
|
|
|
|
|
Map<String, Object> todayRefund = highOrderService.getGasTheDayOrderCount(userInfoModel.getMerchantStore().getId(), "4"); |
|
|
|
|
|
|
|
today.put("refundPrice", todayRefund.get("price")); |
|
|
|
|
|
|
|
today.put("refundCount", todayRefund.get("count")); |
|
|
|
param.put("today", today); |
|
|
|
param.put("today", today); |
|
|
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(param); |
|
|
|
return ResponseMsgUtil.success(param); |
|
|
@ -106,6 +126,8 @@ public class HighGasController { |
|
|
|
@ApiOperation(value = "查询油站订单列表") |
|
|
|
@ApiOperation(value = "查询油站订单列表") |
|
|
|
public ResponseData getGasOrderList(@RequestParam(name = "orderNo", required = false) String orderNo, |
|
|
|
public ResponseData getGasOrderList(@RequestParam(name = "orderNo", required = false) String orderNo, |
|
|
|
@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 = "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 { |
|
|
@ -117,6 +139,8 @@ public class HighGasController { |
|
|
|
Map<String, Object> param = new HashMap<>();; |
|
|
|
Map<String, Object> param = new HashMap<>();; |
|
|
|
param.put("storeId", userInfoModel.getMerchantStore().getId()); |
|
|
|
param.put("storeId", userInfoModel.getMerchantStore().getId()); |
|
|
|
param.put("orderNo", orderNo); |
|
|
|
param.put("orderNo", orderNo); |
|
|
|
|
|
|
|
param.put("createTimeS", createTimeS); |
|
|
|
|
|
|
|
param.put("createTimeE", createTimeE); |
|
|
|
|
|
|
|
|
|
|
|
if (status == null) { |
|
|
|
if (status == null) { |
|
|
|
param.put("status", "2,3,4,6,7"); |
|
|
|
param.put("status", "2,3,4,6,7"); |
|
|
@ -133,6 +157,85 @@ public class HighGasController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/exportGasOrder",method = RequestMethod.GET) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "导出油站订单") |
|
|
|
|
|
|
|
public ResponseData exportGasOrder(@RequestParam(name = "orderNo", required = false) String orderNo, |
|
|
|
|
|
|
|
@RequestParam(name = "status", required = false) Integer status, |
|
|
|
|
|
|
|
@RequestParam(name = "createTimeS", required = false) Long createTimeS, |
|
|
|
|
|
|
|
@RequestParam(name = "createTimeE", required = false) Long createTimeE) { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class); |
|
|
|
|
|
|
|
if (userInfoModel == null || userInfoModel.getMerchantStore() == null) { |
|
|
|
|
|
|
|
log.error("HighGasController -> disabledOil() error!",""); |
|
|
|
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Map<String, Object> param = new HashMap<>();; |
|
|
|
|
|
|
|
param.put("storeId", userInfoModel.getMerchantStore().getId()); |
|
|
|
|
|
|
|
param.put("orderNo", orderNo); |
|
|
|
|
|
|
|
param.put("createTimeS", createTimeS); |
|
|
|
|
|
|
|
param.put("createTimeE", createTimeE); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (status == null) { |
|
|
|
|
|
|
|
param.put("status", "2,3,4,6,7"); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
param.put("status", status); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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("优惠金额"); |
|
|
|
|
|
|
|
headList.add("创建时间"); |
|
|
|
|
|
|
|
headList.add("状态"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<List<Object>> dataList = new ArrayList<>(); |
|
|
|
|
|
|
|
List<Object> data; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<GasOrderModel> orderList = highOrderService.getGasOrderList(param); |
|
|
|
|
|
|
|
for (GasOrderModel orderModel: orderList) { |
|
|
|
|
|
|
|
data = new ArrayList<>(); |
|
|
|
|
|
|
|
data.add(orderModel.getOrderNo()); |
|
|
|
|
|
|
|
data.add(orderModel.getGasName()); |
|
|
|
|
|
|
|
data.add(orderModel.getGasOilType().equals(1) ? "汽油": "柴油"); |
|
|
|
|
|
|
|
data.add(orderModel.getGasOilNo() + "#"); |
|
|
|
|
|
|
|
data.add(orderModel.getGasGunNo() + "号"); |
|
|
|
|
|
|
|
data.add(orderModel.getGasPriceGun()); |
|
|
|
|
|
|
|
data.add(orderModel.getGasPricePreferences()); |
|
|
|
|
|
|
|
data.add(orderModel.getGasOilLiters()); |
|
|
|
|
|
|
|
data.add(orderModel.getTotalPrice()); |
|
|
|
|
|
|
|
data.add(orderModel.getPayRealPrice()); |
|
|
|
|
|
|
|
data.add(orderModel.getDeductionPrice()); |
|
|
|
|
|
|
|
data.add(DateUtil.date2String(orderModel.getCreateTime(), "yyyy-MM-dd HH:mm:ss")); |
|
|
|
|
|
|
|
data.add(DateUtil.date2String(orderModel.getCreateTime(), "yyyy-MM-dd HH:mm:ss")); |
|
|
|
|
|
|
|
data.add(OrderStatusEnum.getNameByType(orderModel.getStatus())); |
|
|
|
|
|
|
|
dataList.add(data); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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("HighGasController -> getGasOrderList() error!",e); |
|
|
|
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/getGasOrderDetail",method = RequestMethod.GET) |
|
|
|
@RequestMapping(value="/getGasOrderDetail",method = RequestMethod.GET) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "查询油站订单详情") |
|
|
|
@ApiOperation(value = "查询油站订单详情") |
|
|
@ -385,6 +488,22 @@ public class HighGasController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 生成头部 |
|
|
|
|
|
|
|
* @param headList |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private static 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; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* @RequestMapping(value="/refuelingOrderPush",method = RequestMethod.GET) |
|
|
|
/* @RequestMapping(value="/refuelingOrderPush",method = RequestMethod.GET) |
|
|
|
@ResponseBody |
|
|
|
@ResponseBody |
|
|
|
@ApiOperation(value = "推送订单") |
|
|
|
@ApiOperation(value = "推送订单") |
|
|
|