交易流水到处,时间过滤

master
mhsnet 3 months ago
parent 0aca0785b5
commit 8e951859f1

@ -247,6 +247,18 @@ public class EnterpriseAccountBillServiceImpl extends ServiceImpl<EnterpriseAcco
enterpriseAccountBillQueryWrapper.lambda().like(EnterpriseAccountBillEntity::getCreatorUserId,value);
}
if(ObjectUtil.isNotEmpty(enterpriseAccountBillPagination.getCreatorTime())){
enterpriseAccountBillNum++;
List CreatorTimeList = JsonUtil.getJsonToList(enterpriseAccountBillPagination.getCreatorTime(),String.class);
Long fir = Long.valueOf(String.valueOf(CreatorTimeList.get(0)));
Long sec = Long.valueOf(String.valueOf(CreatorTimeList.get(1)));
enterpriseAccountBillQueryWrapper.lambda().ge(EnterpriseAccountBillEntity::getCreatorTime, new Date(fir))
.le(EnterpriseAccountBillEntity::getCreatorTime, DateUtil.stringToDate(DateUtil.daFormatYmd(sec) + " 23:59:59"));
}
}
List<String> intersection = generaterSwapUtil.getIntersection(intersectionList);

@ -1,18 +1,30 @@
package jnpf.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.hutool.core.util.ObjectUtil;
import jnpf.config.ConfigValueUtil;
import cn.xuyanwu.spring.file.storage.FileInfo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.base.ActionResult;
import jnpf.base.UserInfo;
import jnpf.base.model.ColumnDataModel;
import jnpf.base.util.VisualUtils;
import jnpf.exception.DataException;
import jnpf.model.visualJson.config.HeaderModel;
import jnpf.permission.entity.UserEntity;
import jnpf.service.*;
import jnpf.entity.*;
import jnpf.util.*;
import jnpf.model.enterpriseaccountbill.*;
import lombok.Cleanup;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@ -28,6 +40,7 @@ import java.util.stream.Collectors;
import jnpf.engine.entity.FlowTaskEntity;
import jnpf.exception.WorkFlowException;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
/**
* EnterpriseAccountBill
@ -48,6 +61,9 @@ public class EnterpriseAccountBillController {
@Autowired
private UserProvider userProvider;
@Autowired
private ConfigValueUtil configValueUtil;
@Autowired
private EnterpriseAccountBillService enterpriseAccountBillService;
@ -101,6 +117,137 @@ public class EnterpriseAccountBillController {
}
return ActionResult.success("创建成功");
}
/**
* Excel
*
* @return
*/
@Operation(summary = "导出Excel")
@PostMapping("/Actions/Export")
public ActionResult Export(@RequestBody EnterpriseAccountBillPagination enterpriseAccountBillPagination) throws IOException {
if (StringUtil.isEmpty(enterpriseAccountBillPagination.getSelectKey())){
return ActionResult.fail("请选择导出字段");
}
List<EnterpriseAccountBillEntity> list= enterpriseAccountBillService.getList(enterpriseAccountBillPagination);
List<Map<String, Object>> realList=new ArrayList<>();
for (EnterpriseAccountBillEntity entity : list) {
Map<String, Object> enterpriseAccountBillEntityMap=JsonUtil.entityToMap(entity);
enterpriseAccountBillEntityMap.put("id", enterpriseAccountBillEntityMap.get("id"));
//副表数据
//子表数据
realList.add(enterpriseAccountBillEntityMap);
}
//数据转换
realList = generaterSwapUtil.swapDataList(realList, EnterpriseAccountBillConstant.getFormData(), EnterpriseAccountBillConstant.getColumnData(), enterpriseAccountBillPagination.getModuleId(),false);
String[]keys=!StringUtil.isEmpty(enterpriseAccountBillPagination.getSelectKey())?enterpriseAccountBillPagination.getSelectKey():new String[0];
UserInfo userInfo=userProvider.get();
DownloadVO vo=this.creatModelExcel(configValueUtil.getTemporaryFilePath(),realList,keys,userInfo);
return ActionResult.success(vo);
}
/**
*
*/
public DownloadVO creatModelExcel(String path,List<Map<String, Object>>list,String[]keys,UserInfo userInfo){
DownloadVO vo=DownloadVO.builder().build();
List<ExcelExportEntity> entitys=new ArrayList<>();
if(keys.length>0){
for(String key:keys){
switch(key){
case "billNumber" :
entitys.add(new ExcelExportEntity("流水编号" ,"billNumber"));
break;
case "orderNumber" :
entitys.add(new ExcelExportEntity("订单编号" ,"orderNumber"));
break;
case "orderTypeId" :
entitys.add(new ExcelExportEntity("订单类型" ,"orderTypeId"));
break;
// case "billStatusId" :
// entitys.add(new ExcelExportEntity("单据状态" ,"billStatusId"));
// break;
case "incomeAmount" :
entitys.add(new ExcelExportEntity("收入(元)" ,"incomeAmount"));
break;
case "payoutAmount" :
entitys.add(new ExcelExportEntity("支出(元)" ,"payoutAmount"));
break;
case "accountBalance" :
entitys.add(new ExcelExportEntity("余额(元)" ,"accountBalance"));
break;
case "creatorUserId" :
entitys.add(new ExcelExportEntity("创建用户" ,"creatorUserId"));
break;
case "creatorTime" :
entitys.add(new ExcelExportEntity("创建时间" ,"creatorTime"));
break;
case "remark" :
entitys.add(new ExcelExportEntity("备注" ,"remark"));
break;
default:
break;
}
}
}
ExportParams exportParams = new ExportParams(null, "表单信息");
exportParams.setType(ExcelType.XSSF);
try{
@Cleanup Workbook workbook = new HSSFWorkbook();
if (entitys.size()>0){
if (list.size()==0){
list.add(new HashMap<>());
}
//去除空数据
List<Map<String, Object>> dataList = new ArrayList<>();
for (Map<String, Object> map : list) {
int i = 0;
for (String key : keys) {
//子表
if (key.toLowerCase().startsWith("tablefield")) {
String tableField = key.substring(0, key.indexOf("-" ));
String field = key.substring(key.indexOf("-" ) + 1);
Object o = map.get(tableField);
if (o != null) {
List<Map<String, Object>> childList = (List<Map<String, Object>>) o;
for (Map<String, Object> childMap : childList) {
if (childMap.get(field) != null) {
i++;
}
}
}
} else {
Object o = map.get(key);
if (o != null) {
i++;
}
}
}
if (i > 0) {
dataList.add(map);
}
}
//复杂表头-表头和数据处理
ColumnDataModel columnDataModel = JsonUtil.getJsonToBean(EnterpriseAccountBillConstant.getColumnData(), ColumnDataModel.class);
List<HeaderModel> complexHeaderList = columnDataModel.getComplexHeaderList();
if (!Objects.equals(columnDataModel.getType(), 3) && !Objects.equals(columnDataModel.getType(), 5)) {
entitys = VisualUtils.complexHeaderHandel(entitys, complexHeaderList);
dataList = VisualUtils.complexHeaderDataHandel(dataList, complexHeaderList);
}
workbook = ExcelExportUtil.exportExcel(exportParams, entitys, dataList);
}
String fileName = "表单信息" + DateUtil.dateNow("yyyyMMdd") + "_" + RandomUtil.uuId() + ".xlsx";
MultipartFile multipartFile = ExcelUtil.workbookToCommonsMultipartFile(workbook, fileName);
String temporaryFilePath = configValueUtil.getTemporaryFilePath();
FileInfo fileInfo = FileUploadUtils.uploadFile(multipartFile, temporaryFilePath, fileName);
vo.setName(fileInfo.getFilename());
vo.setUrl(UploaderUtil.uploaderFile(fileInfo.getFilename() + "#" + "Temporary") + "&name=" + fileName);
} catch (Exception e) {
log.error("信息导出Excel错误:{}", e.getMessage());
e.printStackTrace();
}
return vo;
}
/**
*
* @param id

@ -45,4 +45,7 @@ public class EnterpriseAccountBillPagination extends Pagination {
/** 创建用户 */
@JsonProperty("creatorUserId")
private Object creatorUserId;
/** 创建时间 */
@JsonProperty("creatorTime")
private Object creatorTime;
}

@ -15,6 +15,14 @@
</el-input>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="创建时间">
<JnpfDateRangePicker v-model="query.creatorTime"
format="yyyy-MM-dd HH:mm:ss" startPlaceholder="开始日期"
endPlaceholder="结束日期" >
</JnpfDateRangePicker>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="订单类型">
<JnpfSelect v-model="query.orderTypeId" placeholder="请选择" clearable :options="orderTypeIdOptions"
@ -23,13 +31,13 @@
</el-form-item>
</el-col>
<template v-if="showAll">
<el-col :span="6">
<!-- <el-col :span="6">
<el-form-item label="单据状态">
<JnpfSelect v-model="query.billStatusId" placeholder="请选择" clearable :options="billStatusIdOptions"
:props="billStatusIdProps" multiple>
</JnpfSelect>
</el-form-item>
</el-col>
</el-col> -->
<el-col :span="6">
<el-form-item label="备注">
<el-input v-model="query.remark" placeholder="请输入" clearable>
@ -58,14 +66,16 @@
</el-row>
<div class="JNPF-common-layout-main JNPF-flex-main">
<div class="JNPF-common-head">
<!-- <div>
<el-button
<div>
<!-- <el-button
type="primary"
icon="icon-ym icon-ym-btn-add"
@click="addOrUpdateHandle()"
>新增
</el-button> -->
<el-button type="text" icon="icon-ym icon-ym-btn-download" @click="exportData()" >导出
</el-button>
</div> -->
</div>
<div class="JNPF-common-head-right">
<el-tooltip content="高级查询" placement="top" v-if="true">
<el-link icon="icon-ym icon-ym-filter JNPF-common-head-icon" :underline="false"
@ -85,8 +95,8 @@
</el-table-column>
<el-table-column prop="orderTypeId" label="订单类型" width="100px" align="center">
</el-table-column>
<el-table-column prop="billStatusId" label="单据状态" width="100px" align="center">
</el-table-column>
<!-- <el-table-column prop="billStatusId" label="单据状态" width="100px" align="center">
</el-table-column> -->
<el-table-column prop="incomeAmount" label="收入(元)" width="100px" align="center">
<template slot-scope="scope">

Loading…
Cancel
Save