福利导出

This commit is contained in:
Paidax
2025-01-13 10:01:42 +08:00
parent bc86b632d3
commit 2047b44489
5 changed files with 69 additions and 22 deletions
@@ -824,6 +824,27 @@ public class WelfareSingleController {
//cnd.groupBy("wpus.selectUserId", "wpus.selectOptionId");
sql.setCondition(cnd);
List<NutMap> list = welfareSingleService.listMap(sql);
list.forEach(v->{
Map<String, String> addressMap = new HashMap<>();
String receiveAddress = v.getString("receiveAddress");
if (StrUtil.isNotBlank(receiveAddress)) {
List<String> addressList = Arrays.stream(receiveAddress.split("[,]")).toList();
for (String pair : addressList) {
// 2. 根据冒号分割键和值
String[] keyValue = pair.split("[:]", 2);
if (keyValue.length == 2) {
String key = keyValue[0].trim();
String value = keyValue[1].trim();
addressMap.put(key, value);
}
}
v.put("recipient", addressMap.get("收件人"));
v.put("address", addressMap.get("收货地址"));
v.put("phone", addressMap.get("联系方式"));
}
});
Map<String, List<NutMap>> optionGroupData = list.stream().collect(Collectors.groupingBy(v -> v.getString("optionName")));
List<ExcelExportEntity> exportEntities = new ArrayList<>();
@@ -834,11 +855,14 @@ public class WelfareSingleController {
exportEntities.add(new ExcelExportEntity("人员类型", "personType", 20));
exportEntities.add(new ExcelExportEntity("所在分工会", "unionname", 30));
exportEntities.add(new ExcelExportEntity("所在单位", "unitname", 50));
exportEntities.add(new ExcelExportEntity("选择份数", "selectNum", 20));
exportEntities.add(new ExcelExportEntity("选择份数", "selectNum", 10));
// if (Globals.MyConfig.getBoolean("isThreeUnit")) {
// exportEntities.add(new ExcelExportEntity("所在部门", "threeUnitName", 50));
// }
exportEntities.add(new ExcelExportEntity("收货地址", "receiveAddress", 100));
// exportEntities.add(new ExcelExportEntity("收货地址", "receiveAddress", 100));
exportEntities.add(new ExcelExportEntity("收货人", "recipient", 15));
exportEntities.add(new ExcelExportEntity("联系方式", "phone", 20));
exportEntities.add(new ExcelExportEntity("收货地址", "address", 60));
Workbook workbook = new XSSFWorkbook();
optionGroupData.forEach((k, v) -> {
@@ -850,7 +874,6 @@ public class WelfareSingleController {
service.createSheetForMap(workbook, exportParams, exportEntities, v);
});
try (ServletOutputStream outputStream = response.getOutputStream()) {
ViTool.excelResponse(response, projectName + ".xlsx");
workbook.write(outputStream);
@@ -31,7 +31,16 @@ public class WelfareExportEntityTc {
@Excel(name = "已选福利", width = 80d)
private String optionName;
@Excel(name = "收货信息", width = 100d)
@Excel(name = "收货", width = 15d)
private String recipient;
@Excel(name = "联系方式", width = 20d)
private String phone;
@Excel(name = "收货地址", width = 60d)
private String address;
// @Excel(name = "收货信息", width = 100d)
private String receiveAddress;
@Excel(name = "快递单号", width = 40d)
@@ -41,5 +50,4 @@ public class WelfareExportEntityTc {
private byte[] qzBytes;
private String userSign;
}
@@ -45,9 +45,7 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -1196,8 +1194,26 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
} else {
v.setQzBytes(null);
}
}
Map<String, String> addressMap = new HashMap<>();
String receiveAddress = v.getReceiveAddress();
if (StrUtil.isNotBlank(receiveAddress)) {
List<String> addressList = Arrays.stream(receiveAddress.split("[,]")).toList();
for (String pair : addressList) {
// 2. 根据冒号分割键和值
String[] keyValue = pair.split("[:]", 2);
if (keyValue.length == 2) {
String key = keyValue[0].trim();
String value = keyValue[1].trim();
addressMap.put(key, value);
}
}
v.setRecipient(addressMap.get("收件人"));
v.setPhone(addressMap.get("联系方式"));
v.setAddress(addressMap.get("收货地址"));
}
});
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.HSSF);
@@ -272,13 +272,13 @@ layout("/layouts/platform.html"){
v-if="judgmentAuthority">
导出报销表
</el-button>
<el-button :disabled="pageFormProjectType!==3"
<!--<el-button :disabled="pageFormProjectType!==3"
@click="reimbursementDialog=true"
icon="el-icon-printer" size="small"
type="primary"
v-if="judgmentAuthority">
导出发放名单
</el-button>
</el-button>-->
<el-button :disabled="pageFormProjectType!==3"
@click="openImportExpressExcel"
@@ -606,15 +606,15 @@ layout("/layouts/platform.html"){
<el-radio :label="item.id" border v-for="item in welfareOptions">{{item.optionName}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="人员类型" prop="personType"
:rules="{required:true,message: '请选择套餐', trigger: ['blur','change']}">
<el-radio-group v-model="reimbursementFormData.personType" size="small">
<el-radio label="在职人员" border>在职人员</el-radio>
<el-radio label="劳务派遣人员" border>劳务派遣人员</el-radio>
<el-radio label="空状态" border>空状态</el-radio>
<el-radio label="全部" border>全部</el-radio>
</el-radio-group>
</el-form-item>
<!-- <el-form-item label="人员类型" prop="personType"-->
<!-- :rules="{required:true,message: '请选择套餐', trigger: ['blur','change']}">-->
<!-- <el-radio-group v-model="reimbursementFormData.personType" size="small">-->
<!-- <el-radio label="在职人员" border>在职人员</el-radio>-->
<!-- <el-radio label="劳务派遣人员" border>劳务派遣人员</el-radio>-->
<!-- <el-radio label="空状态" border>空状态</el-radio>-->
<!-- <el-radio label="全部" border>全部</el-radio>-->
<!-- </el-radio-group>-->
<!-- </el-form-item>-->
</el-form>
<span class="dialog-footer" slot="footer">
<el-button @click="reimbursementDialog = false">取消</el-button>
@@ -140,7 +140,7 @@ layout("/layouts/platform.html"){
<!-- @click="exportByUnionGroup">按工会小组导出汇总表-->
<!-- </el-button>-->
</template>
<template
<!--<template
v-if="judgmentAuthority">
<el-button :disabled="!pageForm.projectId" @click="reimbursementDialog = true"
icon="el-icon-printer"
@@ -152,7 +152,7 @@ layout("/layouts/platform.html"){
size="small"
type="primary">管理员代选择
</el-button>
</template>
</template>-->
</template>
</table-tool>