v1.1 后台-账单-导出
This commit is contained in:
@@ -6,10 +6,13 @@ import com.accompany.admin.vo.ChargeRecordAdminVo;
|
||||
import com.accompany.admin.vo.ChargeRecordCountryVo;
|
||||
import com.accompany.admin.vo.ChargeRecordPersonAdminVo;
|
||||
import com.accompany.business.constant.ChargeChannelEnum;
|
||||
import com.accompany.business.util.ReplaceDomainUtil;
|
||||
import com.accompany.common.constant.Constant;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
import com.accompany.common.utils.BlankUtil;
|
||||
import com.accompany.common.utils.DateTimeUtil;
|
||||
import com.accompany.common.utils.UUIDUitl;
|
||||
import com.accompany.core.exception.ServiceException;
|
||||
import com.accompany.core.model.Users;
|
||||
import com.accompany.core.service.user.UsersBaseService;
|
||||
import com.accompany.payment.mapper.ChargeRecordMapper;
|
||||
@@ -20,6 +23,7 @@ import com.accompany.payment.model.ChargeRecordExample;
|
||||
import com.accompany.payment.vo.ChargeRecordDetailVo;
|
||||
import com.accompany.payment.vo.ChargeRecordStatisVo;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
@@ -197,6 +201,29 @@ public class ChargeRecordAdminService extends BaseService {
|
||||
(example)->chargeRecordMapper.selectByExample(example));
|
||||
}
|
||||
|
||||
public void exportUserChargeRecord(ServletOutputStream outputStream,
|
||||
Long erbanNo, String channel, Byte searchType, String chargeRecordId, String startDate, String endDate) throws Exception {
|
||||
List<ChargeRecordPersonAdminVo> data = new ArrayList<>();
|
||||
|
||||
Users users = null;
|
||||
Long uid = 0L;
|
||||
if (Constant.ChargeRecordSearchType.PERSONAL.equals(searchType)){
|
||||
users = usersBaseService.getUsersByErBanNo(erbanNo);
|
||||
if (users == null) {
|
||||
throw new ServiceException(BusiStatus.PARAMERROR);
|
||||
}
|
||||
uid = users.getUid();
|
||||
}
|
||||
|
||||
PageInfo<ChargeRecord> pageInfo = queryUserChargeRecord(uid, channel,
|
||||
searchType, chargeRecordId, 1, Integer.MAX_VALUE, startDate, endDate);
|
||||
if (CollectionUtils.isNotEmpty(pageInfo.getList())){
|
||||
data.addAll(convertPersonVo(pageInfo.getList()));
|
||||
}
|
||||
|
||||
EasyExcel.write(outputStream, ChargeRecordPersonAdminVo.class).sheet("用户充值记录").doWrite(data);
|
||||
}
|
||||
|
||||
public PageInfo<ChargeRecord> queryManualChargeRecord(Long uid, String channel, Byte searchType, String chargeRecordId, Integer pageNum, Integer pageSize, String startDate, String endDate) throws Exception{
|
||||
return queryChargeRecord(uid, channel, searchType, chargeRecordId, pageNum, pageSize, startDate, endDate,
|
||||
(example)->manualChargeRecordMapper.selectByExample(example));
|
||||
@@ -310,4 +337,27 @@ public class ChargeRecordAdminService extends BaseService {
|
||||
chargeRecord.setCreateTime(new Date());
|
||||
manualChargeRecordMapper.insertSelective(chargeRecord);
|
||||
}
|
||||
|
||||
public void exportManualChargeRecord(ServletOutputStream outputStream,
|
||||
Long erbanNo, String channel, Byte searchType, String chargeRecordId, String startDate, String endDate) throws Exception {
|
||||
List<ChargeRecordPersonAdminVo> data = new ArrayList<>();
|
||||
|
||||
Users users = null;
|
||||
Long uid = 0L;
|
||||
if (Constant.ChargeRecordSearchType.PERSONAL.equals(searchType)){
|
||||
users = usersBaseService.getUsersByErBanNo(erbanNo);
|
||||
if (users == null) {
|
||||
throw new ServiceException(BusiStatus.PARAMERROR);
|
||||
}
|
||||
uid = users.getUid();
|
||||
}
|
||||
|
||||
PageInfo<ChargeRecord> pageInfo = queryManualChargeRecord(uid, channel,
|
||||
searchType, chargeRecordId, 1, Integer.MAX_VALUE, startDate, endDate);
|
||||
if (CollectionUtils.isNotEmpty(pageInfo.getList())){
|
||||
data.addAll(convertPersonVo(pageInfo.getList()));
|
||||
}
|
||||
|
||||
EasyExcel.write(outputStream, ChargeRecordPersonAdminVo.class).sheet("用户手动充值记录").doWrite(data);
|
||||
}
|
||||
}
|
||||
|
@@ -51,6 +51,7 @@ public class ChargeRecordPersonAdminVo {
|
||||
@ExcelProperty("创建时间")
|
||||
public String createTime;
|
||||
|
||||
@ExcelProperty("客户端系统/银行账号")
|
||||
public String chargeApp;
|
||||
}
|
||||
|
||||
|
@@ -30,6 +30,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
|
||||
@@ -211,6 +212,17 @@ public class ChargeRecordAdminController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/personal/export")
|
||||
@ResponseBody
|
||||
public void exportUserChargeRecord(HttpServletResponse response, Long erbanNo, String channel, Byte searchType, String chargeRecordId, String startDate, String endDate) throws Exception {
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
// 这里URLEncoder.encode可以防止中文乱码
|
||||
String excelName = URLEncoder.encode("用户充值记录", "UTF-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + excelName + ExcelTypeEnum.XLSX.getValue());
|
||||
chargeRecordAdminService.exportUserChargeRecord(response.getOutputStream(), erbanNo, channel, searchType, chargeRecordId, startDate, endDate);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/manual/list", method = RequestMethod.GET)
|
||||
@ResponseBody
|
||||
public void getManualChargeRecord(Long erbanNo, String channel, Byte searchType, String chargeRecordId, String startDate, String endDate) {
|
||||
@@ -260,6 +272,17 @@ public class ChargeRecordAdminController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/manual/export")
|
||||
@ResponseBody
|
||||
public void exportManualChargeRecord(HttpServletResponse response, Long erbanNo, String channel, Byte searchType, String chargeRecordId, String startDate, String endDate) throws Exception {
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
// 这里URLEncoder.encode可以防止中文乱码
|
||||
String excelName = URLEncoder.encode("用户手动充值记录", "UTF-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + excelName + ExcelTypeEnum.XLSX.getValue());
|
||||
chargeRecordAdminService.exportManualChargeRecord(response.getOutputStream(), erbanNo, channel, searchType, chargeRecordId, startDate, endDate);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/manual/add", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public BusiResult<Void> addManualChargeRecord(String account, Long erbanNo, String channel, Byte status,
|
||||
|
@@ -30,6 +30,14 @@
|
||||
<h1 id="itemTitle"></h1>
|
||||
</section>
|
||||
<section class="content-body">
|
||||
<form id="form2" action="" method="post" target="_blank">
|
||||
<input type="hidden" name="erbanNo" id="exportErbanNo">
|
||||
<input type="hidden" name="searchType" id="exportSearchType">
|
||||
<input type="hidden" name="startDate" id="exportStartDate">
|
||||
<input type="hidden" name="endDate" id="exportEndDate">
|
||||
<input type="hidden" name="channel" id="exportChannel">
|
||||
<input type="hidden" name="chargeRecordId" id="exportChargeRecordId">
|
||||
</form>
|
||||
<div id="toolbar">
|
||||
<div id="userMessage">
|
||||
<div class="avatar"><img src="" alt=""></div>
|
||||
@@ -58,6 +66,7 @@
|
||||
</div>
|
||||
<div class="btn-group">
|
||||
<button id="btnSearch" class="btn btn-primary">查询</button>
|
||||
<button id="btnExport" class="btn btn-primary">导出</button>
|
||||
<button id="btnAddRecord" class="btn btn-default">新增</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -260,6 +269,19 @@
|
||||
TableHelper.doRefresh('#table');
|
||||
})
|
||||
|
||||
// 导出excel
|
||||
$('#btnExport').on('click',function () {
|
||||
var form=$("#form2");
|
||||
form.attr("action","/admin/chargeRecord/manual/export.action");
|
||||
$('#exportErbanNo').val($('#erbanNo').val());
|
||||
$('#exportSearchType').val($('#searchType').val());
|
||||
$('#exportStartDate').val($('#startDate').val());
|
||||
$('#exportEndDate').val($('#endDate').val());
|
||||
$('#exportChannel').val($('#channel').val());
|
||||
$('#exportChargeRecordId').val($('#chargeRecordId').val());
|
||||
form.submit();
|
||||
})
|
||||
|
||||
var picker1 = $("#startDate").datetimepicker({
|
||||
format: 'yyyy-mm-dd hh:ii:00',
|
||||
autoclose: true
|
||||
|
@@ -30,6 +30,14 @@
|
||||
<h1 id="itemTitle"></h1>
|
||||
</section>
|
||||
<section class="content-body">
|
||||
<form id="form2" action="" method="post" target="_blank">
|
||||
<input type="hidden" name="erbanNo" id="exportErbanNo">
|
||||
<input type="hidden" name="searchType" id="exportSearchType">
|
||||
<input type="hidden" name="startDate" id="exportStartDate">
|
||||
<input type="hidden" name="endDate" id="exportEndDate">
|
||||
<input type="hidden" name="channel" id="exportChannel">
|
||||
<input type="hidden" name="chargeRecordId" id="exportChargeRecordId">
|
||||
</form>
|
||||
<div id="toolbar">
|
||||
<div id="userMessage">
|
||||
<div class="avatar"><img src="" alt=""></div>
|
||||
@@ -55,9 +63,11 @@
|
||||
<input type="text" id="chargeRecordId" name="chargeRecordId">
|
||||
开始时间:<input type="text" name="startDate" id="startDate" class="input-sm">
|
||||
结束时间:<input type="text" name="endDate" id="endDate" class="input-sm">
|
||||
<button id="btnSearch" class="btn btn-sm btn-primary">查询</button>
|
||||
</div>
|
||||
|
||||
<div class="btn-group">
|
||||
<button id="btnSearch" class="btn btn-primary">查询</button>
|
||||
<button id="btnExport" class="btn btn-default">导出</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="table"></div>
|
||||
</section>
|
||||
@@ -185,6 +195,20 @@
|
||||
}
|
||||
TableHelper.doRefresh('#table');
|
||||
})
|
||||
|
||||
// 导出excel
|
||||
$('#btnExport').on('click',function () {
|
||||
var form=$("#form2");
|
||||
form.attr("action","/admin/chargeRecord/personal/export.action");
|
||||
$('#exportErbanNo').val($('#erbanNo').val());
|
||||
$('#exportSearchType').val($('#searchType').val());
|
||||
$('#exportStartDate').val($('#startDate').val());
|
||||
$('#exportEndDate').val($('#endDate').val());
|
||||
$('#exportChannel').val($('#channel').val());
|
||||
$('#exportChargeRecordId').val($('#chargeRecordId').val());
|
||||
form.submit();
|
||||
})
|
||||
|
||||
var picker1 = $("#startDate").datetimepicker({
|
||||
format: 'yyyy-mm-dd hh:ii:00',
|
||||
autoclose: true
|
||||
|
Reference in New Issue
Block a user