增加订单的导出接口
This commit is contained in:
parent
682de75a23
commit
4b9f46cba4
@ -101,11 +101,11 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<!-- <dependency>-->
|
||||||
<groupId>org.apache.poi</groupId>
|
<!-- <groupId>org.apache.poi</groupId>-->
|
||||||
<artifactId>poi-ooxml</artifactId>
|
<!-- <artifactId>poi-ooxml</artifactId>-->
|
||||||
<version>3.9</version>
|
<!-- <version>3.9</version>-->
|
||||||
</dependency>
|
<!-- </dependency>-->
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@ -4,6 +4,9 @@ import cn.hutool.core.date.DateField;
|
|||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUnit;
|
import cn.hutool.core.date.DateUnit;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.poi.excel.ExcelWriter;
|
||||||
|
import com.xhpc.common.core.utils.StringUtils;
|
||||||
|
import com.xhpc.common.core.utils.poi.ExcelUtil;
|
||||||
import com.xhpc.common.core.web.controller.BaseController;
|
import com.xhpc.common.core.web.controller.BaseController;
|
||||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||||
@ -15,17 +18,18 @@ import com.xhpc.order.dto.XhpcChargeHistoryOrder;
|
|||||||
import com.xhpc.order.service.IXhpcChargeOrderService;
|
import com.xhpc.order.service.IXhpcChargeOrderService;
|
||||||
import com.xhpc.order.service.IXhpcHistoryOrderService;
|
import com.xhpc.order.service.IXhpcHistoryOrderService;
|
||||||
import com.xhpc.order.service.IXhpcStatisticsService;
|
import com.xhpc.order.service.IXhpcStatisticsService;
|
||||||
|
import com.xhpc.system.api.domain.SysUser;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -84,6 +88,31 @@ public class XhpcHistoryOrderController extends BaseController {
|
|||||||
return xhpcHistoryOrderService.getById(historyOrderId);
|
return xhpcHistoryOrderService.getById(historyOrderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 历史订单导出
|
||||||
|
* @param response 返回数据流
|
||||||
|
* @param map 参数集
|
||||||
|
* @throws IOException 文件创建异常
|
||||||
|
*/
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void getListPage(HttpServletResponse response, @RequestBody Map map) throws IOException {
|
||||||
|
|
||||||
|
String phone = map.get("phone").toString();
|
||||||
|
String transactionNumber = map.get("transactionNumber").toString();
|
||||||
|
Integer status = StringUtils.isNotEmpty(map.get("transactionNumber").toString())? Integer.valueOf(map.get("transactionNumber").toString()) : null ;
|
||||||
|
String chargingStationName = map.get("chargingStationName").toString();
|
||||||
|
Long operatorId = StringUtils.isNotEmpty(map.get("operatorId").toString())? Long.parseLong(map.get("operatorId").toString()) : null;
|
||||||
|
Integer source = StringUtils.isNotEmpty(map.get("source").toString())? Integer.valueOf(map.get("source").toString()): null;
|
||||||
|
String startTime = map.get("startTime").toString();
|
||||||
|
String endTime = map.get("endTime").toString();
|
||||||
|
Long userId = StringUtils.isNotEmpty(map.get("userId").toString())? Long.parseLong(map.get("userId").toString()): null;
|
||||||
|
Integer type = StringUtils.isNotEmpty(map.get("type").toString())? Integer.valueOf(map.get("type").toString()): null;
|
||||||
|
|
||||||
|
xhpcHistoryOrderService.export(response, phone, transactionNumber, status, chargingStationName, operatorId, source, startTime, endTime, userId, type);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 终端统计
|
* 终端统计
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -4,6 +4,8 @@ import com.xhpc.common.core.web.domain.AjaxResult;
|
|||||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||||
import com.xhpc.order.dto.XhpcChargeHistoryOrder;
|
import com.xhpc.order.dto.XhpcChargeHistoryOrder;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -52,6 +54,14 @@ public interface IXhpcHistoryOrderService {
|
|||||||
*/
|
*/
|
||||||
List<Map<String,Object>> getListPage(String phone,String transactionNumber,Integer status,String chargingStationName,Long operatorId,Integer source,String startTime,String endTime,Long userId,Integer type);
|
List<Map<String,Object>> getListPage(String phone,String transactionNumber,Integer status,String chargingStationName,Long operatorId,Integer source,String startTime,String endTime,Long userId,Integer type);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 历史订单记录导出(PC)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
void export(HttpServletResponse response, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String startTime, String endTime, Long userId, Integer type) throws IOException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 历史订单详情(PC)
|
* 历史订单详情(PC)
|
||||||
* @param historyOrderId 历史订单id
|
* @param historyOrderId 历史订单id
|
||||||
|
|||||||
@ -3,6 +3,9 @@ package com.xhpc.order.service.impl;
|
|||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUnit;
|
import cn.hutool.core.date.DateUnit;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.io.IoUtil;
|
||||||
|
import cn.hutool.poi.excel.ExcelUtil;
|
||||||
|
import cn.hutool.poi.excel.ExcelWriter;
|
||||||
import com.xhpc.common.api.SmsService;
|
import com.xhpc.common.api.SmsService;
|
||||||
import com.xhpc.common.core.utils.SecurityUtils;
|
import com.xhpc.common.core.utils.SecurityUtils;
|
||||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
@ -20,6 +23,10 @@ import org.slf4j.LoggerFactory;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
@ -32,7 +39,7 @@ import java.util.concurrent.Executors;
|
|||||||
@Service
|
@Service
|
||||||
public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
||||||
|
|
||||||
@Autowired
|
@Resource
|
||||||
private XhpcHistoryOrderMapper xhpcHistoryOrderMapper;
|
private XhpcHistoryOrderMapper xhpcHistoryOrderMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -54,26 +61,31 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> list(Long userId) {
|
public List<Map<String, Object>> list(Long userId) {
|
||||||
|
|
||||||
return xhpcHistoryOrderMapper.list(userId);
|
return xhpcHistoryOrderMapper.list(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int update(XhpcHistoryOrder xhpcHistoryOrder) {
|
public int update(XhpcHistoryOrder xhpcHistoryOrder) {
|
||||||
|
|
||||||
return xhpcHistoryOrderMapper.update(xhpcHistoryOrder);
|
return xhpcHistoryOrderMapper.update(xhpcHistoryOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult gethistotyOrderMessage(Long userId, Long historyOrderId, Integer type, Long chargingOrderId) {
|
public AjaxResult gethistotyOrderMessage(Long userId, Long historyOrderId, Integer type, Long chargingOrderId) {
|
||||||
|
|
||||||
return AjaxResult.success(xhpcHistoryOrderMapper.gethistotyOrderMessage(userId, historyOrderId, type, chargingOrderId));
|
return AjaxResult.success(xhpcHistoryOrderMapper.gethistotyOrderMessage(userId, historyOrderId, type, chargingOrderId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insert(XhpcHistoryOrder xhpcHistoryOrder) {
|
public void insert(XhpcHistoryOrder xhpcHistoryOrder) {
|
||||||
|
|
||||||
xhpcHistoryOrderMapper.insert(xhpcHistoryOrder);
|
xhpcHistoryOrderMapper.insert(xhpcHistoryOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> getListPage(String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String startTime, String endTime, Long userId, Integer type) {
|
public List<Map<String, Object>> getListPage(String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String startTime, String endTime, Long userId, Integer type) {
|
||||||
|
|
||||||
Integer number = 0;
|
Integer number = 0;
|
||||||
if (!"".equals(phone) && phone != null && !"".equals(source) && source != null) {
|
if (!"".equals(phone) && phone != null && !"".equals(source) && source != null) {
|
||||||
number = 3;
|
number = 3;
|
||||||
@ -107,8 +119,60 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void export(HttpServletResponse response, String phone, String transactionNumber, Integer status, String chargingStationName, Long operatorId, Integer source, String startTime, String endTime, Long userId, Integer type) throws IOException {
|
||||||
|
|
||||||
|
List<Map<String, Object>> list = getListPage(phone, transactionNumber, status, chargingStationName, operatorId, source, startTime, endTime, userId, type);
|
||||||
|
// 通过工具类创建writer,默认创建xls格式
|
||||||
|
ExcelWriter writer = ExcelUtil.getWriter();
|
||||||
|
writer.addHeaderAlias("historyOrderId", "历史订单ID");
|
||||||
|
writer.addHeaderAlias("serialNumber", "订单号");
|
||||||
|
writer.addHeaderAlias("chargingStationName", "电站名称");
|
||||||
|
writer.addHeaderAlias("pileSerialNumber", "桩编号");
|
||||||
|
writer.addHeaderAlias("terminalName", "终端名称");
|
||||||
|
writer.addHeaderAlias("operatorId", "运营商ID");
|
||||||
|
writer.addHeaderAlias("operatorName", "运营商名称");
|
||||||
|
writer.addHeaderAlias("power", "功率");
|
||||||
|
writer.addHeaderAlias("type", "桩类型(1直流(慢) 2交流(快)");
|
||||||
|
writer.addHeaderAlias("orderType", "状态1 自动结算 2 平台结算");
|
||||||
|
writer.addHeaderAlias("startSoc", "开始soc");
|
||||||
|
writer.addHeaderAlias("endSoc", "结束soc");
|
||||||
|
// writer.addHeaderAlias("internetSerialNumber", "电站名称");
|
||||||
|
writer.addHeaderAlias("totalPrice", "订单总价");
|
||||||
|
writer.addHeaderAlias("actPrice", "实际价格");
|
||||||
|
// writer.addHeaderAlias("confirmResult", "历史订单ID");
|
||||||
|
writer.addHeaderAlias("chargingTime", "累计充电时间");
|
||||||
|
writer.addHeaderAlias("chargingDegree", "充电度数");
|
||||||
|
writer.addHeaderAlias("startTime", "开始充电时间");
|
||||||
|
writer.addHeaderAlias("endTime", "结束充电时间");
|
||||||
|
writer.addHeaderAlias("updateTime", "结算时间");
|
||||||
|
writer.addHeaderAlias("source", "订单来源(0C端用户 1流量用户)");
|
||||||
|
// writer.addHeaderAlias("plateNum", "电站名称");
|
||||||
|
// writer.addHeaderAlias("disputeOrderStatus", "桩编号");
|
||||||
|
|
||||||
|
// 默认的,未添加alias的属性也会写出,如果想只写出加了别名的字段,可以调用此方法排除之
|
||||||
|
writer.setOnlyAlias(true);
|
||||||
|
// 一次性写出内容,使用默认样式,强制输出标题
|
||||||
|
writer.write(list, true);
|
||||||
|
//out为OutputStream,需要写出到的目标流
|
||||||
|
|
||||||
|
//response为HttpServletResponse对象
|
||||||
|
response.setContentType("application/vnd.ms-excel;charset=utf-8");
|
||||||
|
//test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
|
||||||
|
response.setHeader("Content-Disposition", "attachment;filename=历史订单列表.xls");
|
||||||
|
ServletOutputStream out = response.getOutputStream();
|
||||||
|
|
||||||
|
writer.flush(out, true);
|
||||||
|
// 关闭writer,释放内存
|
||||||
|
writer.close();
|
||||||
|
//此处记得关闭输出Servlet流
|
||||||
|
IoUtil.close(out);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult getById(Long historyOrderId) {
|
public AjaxResult getById(Long historyOrderId) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Map<String, Object> byId = xhpcHistoryOrderMapper.getById(historyOrderId);
|
Map<String, Object> byId = xhpcHistoryOrderMapper.getById(historyOrderId);
|
||||||
if (byId != null) {
|
if (byId != null) {
|
||||||
@ -123,16 +187,19 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Map<String, Object>> getReatTimeList(String startTime, String endTime, Long rateModelId) {
|
public List<Map<String, Object>> getReatTimeList(String startTime, String endTime, Long rateModelId) {
|
||||||
|
|
||||||
return xhpcHistoryOrderMapper.getReatTimeList(startTime, endTime, rateModelId);
|
return xhpcHistoryOrderMapper.getReatTimeList(startTime, endTime, rateModelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<XhpcChargeHistoryOrder> getStatistisList(int number, int state) {
|
public List<XhpcChargeHistoryOrder> getStatistisList(int number, int state) {
|
||||||
|
|
||||||
return xhpcHistoryOrderMapper.getStatistisList(number, state);
|
return xhpcHistoryOrderMapper.getStatistisList(number, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateXhpcHistoryOrder(Long historyOrderId, Integer state) {
|
public void updateXhpcHistoryOrder(Long historyOrderId, Integer state) {
|
||||||
|
|
||||||
xhpcHistoryOrderMapper.updateXhpcHistoryOrder(historyOrderId, state);
|
xhpcHistoryOrderMapper.updateXhpcHistoryOrder(historyOrderId, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,6 +491,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
executorService.execute(new Runnable() {
|
executorService.execute(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
xhpcRealTimeOrderService.addPileEndOrder(xhpcHistoryOrder, xhpcChargeOrder, xhpcChargeOrder.getSerialNumber(), 1);
|
xhpcRealTimeOrderService.addPileEndOrder(xhpcHistoryOrder, xhpcChargeOrder, xhpcChargeOrder.getSerialNumber(), 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -449,6 +517,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
* 历史信息费率时段
|
* 历史信息费率时段
|
||||||
*/
|
*/
|
||||||
private Map<String, Object> getRateTime(String serialNumber, String actPrice) {
|
private Map<String, Object> getRateTime(String serialNumber, String actPrice) {
|
||||||
|
|
||||||
BigDecimal powerPriceTotal = new BigDecimal(0);
|
BigDecimal powerPriceTotal = new BigDecimal(0);
|
||||||
BigDecimal servicePriceTotal = new BigDecimal(0);
|
BigDecimal servicePriceTotal = new BigDecimal(0);
|
||||||
//累计充电时间、计费模型、开始时间、结束时间、已充金额
|
//累计充电时间、计费模型、开始时间、结束时间、已充金额
|
||||||
@ -479,6 +548,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> getBigDecimal(String actPrice, BigDecimal powerPriceTotal, BigDecimal servicePriceTotal, XhpcChargeOrder chargeOrder, Long rateModelId, Date startTime2, Date updateTime2, BigDecimal chargingDegree, List<Map<String, Object>> list) {
|
private Map<String, Object> getBigDecimal(String actPrice, BigDecimal powerPriceTotal, BigDecimal servicePriceTotal, XhpcChargeOrder chargeOrder, Long rateModelId, Date startTime2, Date updateTime2, BigDecimal chargingDegree, List<Map<String, Object>> list) {
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
//算出相差时间,分
|
//算出相差时间,分
|
||||||
BigDecimal decimal = new BigDecimal((updateTime2.getTime() - startTime2.getTime()) / 60000).setScale(2);
|
BigDecimal decimal = new BigDecimal((updateTime2.getTime() - startTime2.getTime()) / 60000).setScale(2);
|
||||||
@ -537,6 +607,7 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> getRateTimeList(String startTime, String endTime, BigDecimal degree, BigDecimal powerPrice, BigDecimal servicePrice) {
|
private Map<String, Object> getRateTimeList(String startTime, String endTime, BigDecimal degree, BigDecimal powerPrice, BigDecimal servicePrice) {
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
BigDecimal v = new BigDecimal((DateUtil.parse(endTime).getTime() - DateUtil.parse(startTime).getTime()) / 60000).multiply(degree);
|
BigDecimal v = new BigDecimal((DateUtil.parse(endTime).getTime() - DateUtil.parse(startTime).getTime()) / 60000).multiply(degree);
|
||||||
BigDecimal multiply = powerPrice.add(servicePrice).multiply(v).setScale(2, BigDecimal.ROUND_DOWN);
|
BigDecimal multiply = powerPrice.add(servicePrice).multiply(v).setScale(2, BigDecimal.ROUND_DOWN);
|
||||||
@ -549,7 +620,6 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param rateModelId 费率id
|
* @param rateModelId 费率id
|
||||||
* @param startTime2 开始时间
|
* @param startTime2 开始时间
|
||||||
* @param updateTime2 结算时间
|
* @param updateTime2 结算时间
|
||||||
@ -599,8 +669,10 @@ public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private BigDecimal getRateTimeList(String startTime, String endTime, BigDecimal degree, BigDecimal powerPrice) {
|
private BigDecimal getRateTimeList(String startTime, String endTime, BigDecimal degree, BigDecimal powerPrice) {
|
||||||
|
|
||||||
BigDecimal v = new BigDecimal((DateUtil.parse(endTime).getTime() - DateUtil.parse(startTime).getTime()) / 60000).multiply(degree);
|
BigDecimal v = new BigDecimal((DateUtil.parse(endTime).getTime() - DateUtil.parse(startTime).getTime()) / 60000).multiply(degree);
|
||||||
BigDecimal multiply = powerPrice.multiply(v).setScale(2, BigDecimal.ROUND_DOWN);
|
BigDecimal multiply = powerPrice.multiply(v).setScale(2, BigDecimal.ROUND_DOWN);
|
||||||
return multiply;
|
return multiply;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,10 +14,10 @@ spring:
|
|||||||
nacos:
|
nacos:
|
||||||
discovery:
|
discovery:
|
||||||
# 服务注册地址
|
# 服务注册地址
|
||||||
server-addr: 172.31.183.135:8848
|
server-addr: 118.24.137.203:8848
|
||||||
config:
|
config:
|
||||||
# 配置中心地址
|
# 配置中心地址
|
||||||
server-addr: 172.31.183.135:8848
|
server-addr: 118.24.137.203:8848
|
||||||
# 配置文件格式
|
# 配置文件格式
|
||||||
file-extension: yml
|
file-extension: yml
|
||||||
# 共享配置
|
# 共享配置
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.xhpc.payment.controller;
|
|||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUnit;
|
import cn.hutool.core.date.DateUnit;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.xhpc.common.core.utils.StringUtils;
|
||||||
import com.xhpc.common.core.web.controller.BaseController;
|
import com.xhpc.common.core.web.controller.BaseController;
|
||||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||||
@ -12,11 +13,10 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
@ -50,13 +50,32 @@ public class XhpcRechargeOrderController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
//@PreAuthorize(hasPermi = "refund:order:page")
|
//@PreAuthorize(hasPermi = "refund:order:page")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public TableDataInfo page(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type) {
|
public TableDataInfo page(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type) {
|
||||||
startPage();
|
startPage();
|
||||||
List<Map<String, Object>> list = iXhpcRechargeOrderService.page(phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type);
|
List<Map<String, Object>> list = iXhpcRechargeOrderService.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值订单页表导出
|
||||||
|
*/
|
||||||
|
//@PreAuthorize(hasPermi = "refund:order:page")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void page(HttpServletResponse response, @RequestBody Map map) throws IOException {
|
||||||
|
|
||||||
|
String phone = map.get("phone").toString();
|
||||||
|
String rechargeOrderNumber= map.get("rechargeOrderNumber").toString();
|
||||||
|
String status= map.get("status").toString();
|
||||||
|
String createTimeStart= map.get("createTimeStart").toString();
|
||||||
|
String createTimeEnd= map.get("createTimeEnd").toString();
|
||||||
|
Integer type= StringUtils.isNotEmpty(map.get("type").toString())? Integer.valueOf(map.get("type").toString()): null;
|
||||||
|
|
||||||
|
iXhpcRechargeOrderService.export(response, phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计
|
* 统计
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -12,6 +12,8 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -107,6 +109,23 @@ public class XhpcRefundOrderController extends BaseController {
|
|||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, @RequestBody Map map) throws IOException {
|
||||||
|
|
||||||
|
String phone = map.get("phone").toString();
|
||||||
|
String refundOrderNumber= map.get("refundOrderNumber").toString();
|
||||||
|
String status= map.get("status").toString();
|
||||||
|
String createTimeStart= map.get("createTimeStart").toString();
|
||||||
|
String createTimeEnd= map.get("createTimeEnd").toString();
|
||||||
|
Integer type= StringUtils.isNotEmpty(map.get("type").toString())? Integer.valueOf(map.get("type").toString()): null;
|
||||||
|
|
||||||
|
iXhpcRefundOrderService.export(response, phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计
|
* 统计
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -2,6 +2,8 @@ package com.xhpc.payment.service;
|
|||||||
|
|
||||||
import com.xhpc.payment.domain.XhpcRechargeOrder;
|
import com.xhpc.payment.domain.XhpcRechargeOrder;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -40,6 +42,20 @@ public interface IXhpcRechargeOrderService {
|
|||||||
*/
|
*/
|
||||||
public List<Map<String, Object>> page(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type);
|
public List<Map<String, Object>> page(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值订单分页列表
|
||||||
|
*
|
||||||
|
* @param phone
|
||||||
|
* @param rechargeOrderNumber
|
||||||
|
* @param status
|
||||||
|
* @param createTimeStart
|
||||||
|
* @param createTimeEnd
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public void export(HttpServletResponse response, String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type) throws IOException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计
|
* 统计
|
||||||
*
|
*
|
||||||
|
|||||||
@ -4,6 +4,8 @@ import com.xhpc.common.core.web.domain.AjaxResult;
|
|||||||
import com.xhpc.payment.domain.XhpcRefundOrder;
|
import com.xhpc.payment.domain.XhpcRefundOrder;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -43,6 +45,20 @@ public interface IXhpcRefundOrderService {
|
|||||||
public List<Map<String, Object>> page(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type);
|
public List<Map<String, Object>> page(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd,Integer type);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款订单分页列表导出
|
||||||
|
*
|
||||||
|
* @param phone
|
||||||
|
* @param refundOrderNumber
|
||||||
|
* @param status
|
||||||
|
* @param createTimeStart
|
||||||
|
* @param createTimeEnd
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public void export(HttpServletResponse response, String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type) throws IOException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退款订单分页列表
|
* 退款订单分页列表
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
package com.xhpc.payment.service.impl;
|
package com.xhpc.payment.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.IoUtil;
|
||||||
|
import cn.hutool.poi.excel.ExcelUtil;
|
||||||
|
import cn.hutool.poi.excel.ExcelWriter;
|
||||||
import com.xhpc.common.core.constant.StatusConstants;
|
import com.xhpc.common.core.constant.StatusConstants;
|
||||||
import com.xhpc.common.core.utils.StringUtils;
|
import com.xhpc.common.core.utils.StringUtils;
|
||||||
import com.xhpc.payment.domain.XhpcRechargeOrder;
|
import com.xhpc.payment.domain.XhpcRechargeOrder;
|
||||||
@ -9,6 +12,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -66,6 +72,45 @@ public class XhpcRechargeOrderServiceImpl implements IXhpcRechargeOrderService {
|
|||||||
return xhpcRechargeOrderMapper.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type);
|
return xhpcRechargeOrderMapper.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void export(HttpServletResponse response, String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type) throws IOException {
|
||||||
|
List list = xhpcRechargeOrderMapper.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type);
|
||||||
|
|
||||||
|
// 通过工具类创建writer,默认创建xls格式
|
||||||
|
ExcelWriter writer = ExcelUtil.getWriter();
|
||||||
|
writer.addHeaderAlias("rechargeOrderId", "充值订单id");
|
||||||
|
writer.addHeaderAlias("rechargeOrderNumber", "充值订单编号");
|
||||||
|
writer.addHeaderAlias("userId", "C端用户id");
|
||||||
|
writer.addHeaderAlias("amount", "退款金额");
|
||||||
|
writer.addHeaderAlias("alipayNumber", "账号");
|
||||||
|
writer.addHeaderAlias("prepayid", "微信编号");
|
||||||
|
writer.addHeaderAlias("type", "充值渠道(1微信 2支付宝)");
|
||||||
|
writer.addHeaderAlias("status", "状态(0待支付 1充值成功,2充值失败)");
|
||||||
|
writer.addHeaderAlias("createTime", "充值时间");
|
||||||
|
writer.addHeaderAlias("phone", "账号");
|
||||||
|
writer.addHeaderAlias("statusName", "充值状态");
|
||||||
|
|
||||||
|
// 默认的,未添加alias的属性也会写出,如果想只写出加了别名的字段,可以调用此方法排除之
|
||||||
|
writer.setOnlyAlias(true);
|
||||||
|
// 一次性写出内容,使用默认样式,强制输出标题
|
||||||
|
writer.write(list, true);
|
||||||
|
//out为OutputStream,需要写出到的目标流
|
||||||
|
|
||||||
|
//response为HttpServletResponse对象
|
||||||
|
response.setContentType("application/vnd.ms-excel;charset=utf-8");
|
||||||
|
//test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
|
||||||
|
response.setHeader("Content-Disposition", "attachment;filename=充值订单列表.xls");
|
||||||
|
ServletOutputStream out = response.getOutputStream();
|
||||||
|
|
||||||
|
writer.flush(out, true);
|
||||||
|
// 关闭writer,释放内存
|
||||||
|
writer.close();
|
||||||
|
//此处记得关闭输出Servlet流
|
||||||
|
IoUtil.close(out);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String sumMoney(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type) {
|
public String sumMoney(String phone, String rechargeOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type) {
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,8 @@
|
|||||||
package com.xhpc.payment.service.impl;
|
package com.xhpc.payment.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.IoUtil;
|
||||||
|
import cn.hutool.poi.excel.ExcelUtil;
|
||||||
|
import cn.hutool.poi.excel.ExcelWriter;
|
||||||
import com.xhpc.common.core.constant.HttpStatus;
|
import com.xhpc.common.core.constant.HttpStatus;
|
||||||
import com.xhpc.common.core.constant.StatusConstants;
|
import com.xhpc.common.core.constant.StatusConstants;
|
||||||
import com.xhpc.common.core.utils.StringUtils;
|
import com.xhpc.common.core.utils.StringUtils;
|
||||||
@ -13,6 +16,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -68,6 +74,46 @@ public class XhpcRefundOrderServiceImpl implements IXhpcRefundOrderService {
|
|||||||
return xhpcRefundOrderMapper.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type);
|
return xhpcRefundOrderMapper.page(phone, rechargeOrderNumber, status, createTimeStart, createTimeEnd,type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void export(HttpServletResponse response, String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type) throws IOException {
|
||||||
|
List list = xhpcRefundOrderMapper.page(phone, refundOrderNumber, status, createTimeStart, createTimeEnd,type);
|
||||||
|
|
||||||
|
// 通过工具类创建writer,默认创建xls格式
|
||||||
|
ExcelWriter writer = ExcelUtil.getWriter();
|
||||||
|
writer.addHeaderAlias("refundOrderId", "退款订单id");
|
||||||
|
writer.addHeaderAlias("refundOrderNumber", "退款订单编号");
|
||||||
|
// writer.addHeaderAlias("alipayId", "电站名称");
|
||||||
|
// writer.addHeaderAlias("openId", "桩编号");
|
||||||
|
writer.addHeaderAlias("userId", "C端用户id");
|
||||||
|
writer.addHeaderAlias("amount", "退款金额");
|
||||||
|
writer.addHeaderAlias("examineStatus", "审核状态(0审核中 1审核通过,2审核失败)");
|
||||||
|
writer.addHeaderAlias("status", "状态(0退款中 1退款成功,2退款失败,3退款异常)");
|
||||||
|
writer.addHeaderAlias("createTime", "退款时间");
|
||||||
|
writer.addHeaderAlias("phone", "账号");
|
||||||
|
writer.addHeaderAlias("statusName", "退款状态");
|
||||||
|
writer.addHeaderAlias("examineStatusName", "审核状态名称");
|
||||||
|
|
||||||
|
// 默认的,未添加alias的属性也会写出,如果想只写出加了别名的字段,可以调用此方法排除之
|
||||||
|
writer.setOnlyAlias(true);
|
||||||
|
// 一次性写出内容,使用默认样式,强制输出标题
|
||||||
|
writer.write(list, true);
|
||||||
|
//out为OutputStream,需要写出到的目标流
|
||||||
|
|
||||||
|
//response为HttpServletResponse对象
|
||||||
|
response.setContentType("application/vnd.ms-excel;charset=utf-8");
|
||||||
|
//test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
|
||||||
|
response.setHeader("Content-Disposition", "attachment;filename=退款订单列表.xls");
|
||||||
|
ServletOutputStream out = response.getOutputStream();
|
||||||
|
|
||||||
|
writer.flush(out, true);
|
||||||
|
// 关闭writer,释放内存
|
||||||
|
writer.close();
|
||||||
|
//此处记得关闭输出Servlet流
|
||||||
|
IoUtil.close(out);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String sumMoney(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type) {
|
public String sumMoney(String phone, String refundOrderNumber, String status, String createTimeStart, String createTimeEnd, Integer type) {
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user