工会关系人员

This commit is contained in:
Paidax
2024-12-30 16:19:04 +08:00
parent b776b4ebe0
commit 6445645597
15 changed files with 1082 additions and 46 deletions
@@ -127,6 +127,7 @@ public class WelfareListController {
""");
CndPlus cnd = CndPlus.create();
cnd.and(pageForm);
pageParam.participate(cnd, "wl");
cnd.and("wl.projectId", "=", projectId);
cnd.andEX("wus.selectOptionId", "=", optionId);
cnd.andEX("wl.unionid", "=", pageParam.getWelfareUnit());
@@ -144,7 +145,7 @@ public class WelfareListController {
cnd.andEX("wl.userState", "in", userStateArray);
}
cnd.andEX("wl.sex", "in", pageParam.getSex());
cnd.andEX("wl.sex", "=", pageParam.getSex());
cnd.andEX("wcn.courierNumber", "=", courierNumber);
@@ -732,12 +732,12 @@ public class WelfareSingleController {
try {
response.setContentType("application/octet-stream");
response.setHeader("content-disposition", "attachment;filename="
+ URLEncoder.encode(sysUnion.getUnioncode() + sysUnion.getUnionname() + welfareProject.getName() + "签收表.xlsx", "UTF-8"));
+ URLEncoder.encode(sysUnion.getUnioncode() + sysUnion.getUnionname() + welfareProject.getName() + "签收表.xls", "UTF-8"));
//获取这个福利项目下的所有数据
// List<NutMap> allUser = welfareSingleService.getUserByProjectId(projectId, month, unionGroupId);
// List<NutMap> userChoose = welfareSingleService.getUserChooseByProjectId(projectId, month, unionGroupId);
welfareSingleService.exportReceiveDetail(projectId, welfareUnitId, new ArrayList<>(), new ArrayList<>(), response.getOutputStream());
ViTool.excelResponse(response, sysUnion.getUnioncode() + sysUnion.getUnionname() + welfareProject.getName() + "签收表.xlsx");
ViTool.excelResponse(response, sysUnion.getUnioncode() + sysUnion.getUnionname() + welfareProject.getName() + "签收表.xls");
} catch (Exception e) {
e.printStackTrace();
}
@@ -1,6 +1,7 @@
package io.v.nutz.zhgh.welfare.model.template;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelTarget;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -36,7 +37,7 @@ public class WelfareExportEntityTc {
@Excel(name = "快递单号", width = 40d)
private String courierNumber;
@Excel(name = "实名签字", width = 20d, type = 2 , imageType = 2)
@Excel(name = "实名签字", width = 20d, type = 2 , imageType = 2, height = 12d)
private byte[] qzBytes;
private String userSign;
@@ -1,6 +1,5 @@
package io.v.nutz.zhgh.welfare.service.impl;
import cn.afterturn.easypoi.entity.ImageEntity;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.entity.ExportParams;
@@ -23,6 +22,7 @@ import io.v.nutz.zhgh.welfare.model.WelfareProject;
import io.v.nutz.zhgh.welfare.model.template.WelfareExportEntityTc;
import io.v.nutz.zhgh.welfare.service.WelfareSingleService;
import lombok.Data;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
@@ -45,7 +45,6 @@ import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.*;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -200,7 +199,7 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
* @return
*/
@Override
public NutMap pageData(String projectId, String month, String welfareUnitCode, String unionGroupId, String personType) {
public NutMap pageData(String projectId, String month, String welfareUnitCode, String unionGroupId, String personType) {
boolean isThreeUnit = Globals.MyConfig.getBoolean("isThreeUnit");
Sql welfareUnitSql = Sqls.create("""
SELECT
@@ -676,23 +675,25 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
SELECT
u.loginname,
u.username,
vwl.welfareUnitId as unionid,
gh.unionname as unionname,
IF(staffUnion.id IS NOT NULL, staffUnion.id, vwl.welfareUnitId) AS unionid,
IF(staffUnion.id IS NOT NULL, staffUnion.unionname, gh.unionname) AS unionname,
vwl.welfareSecondLevelUnitId as unitid,
dw.`name` as unitname,
wpus.userSign,
wpus.selectOptionId,
wpus.selectNum\s
wpus.selectNum
FROM
welfare_list vwl
LEFT join sys_user u on u.id = vwl.userId
left join sys_union gh on gh.id = vwl.welfareUnitId
left join sys_unit dw on dw.id = vwl.welfareSecondLevelUnitId
LEFT JOIN welfare_project_user_selection wpus ON wpus.selectUserId = vwl.userId\s
AND wpus.welfareId = @projectId\s
LEFT JOIN special_staff staff ON staff.userId = vwl.userId
LEFT JOIN sys_union staffUnion ON staff.unionRelationUnionId = staffUnion.id
LEFT JOIN sys_user u ON u.id = vwl.userId
LEFT JOIN sys_union gh ON gh.id = vwl.welfareUnitId
LEFT JOIN sys_unit dw ON dw.id = vwl.welfareSecondLevelUnitId
LEFT JOIN welfare_project_user_selection wpus ON wpus.selectUserId = vwl.userId
AND wpus.welfareId = @projectId
WHERE
projectId = @projectId
AND vwl.welfareUnitId = @unionId
AND (vwl.welfareUnitId = @unionId OR staffUnion.id = @unionId)
order by vwl.welfareUnitId,vwl.welfareSecondLevelUnitId
""");
@@ -721,7 +722,9 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
exportEntities.add(new ExcelExportEntity("姓名", "username", 10));
exportEntities.add(new ExcelExportEntity("工号", "loginname", 15));
// exportEntities.add(new ExcelExportEntity("所在分工会", "unionname", 20));
exportEntities.add(new ExcelExportEntity("所在单位", "unitname", 20));
ExcelExportEntity excelExportEntity1 = new ExcelExportEntity("所在单位", "unitname", 20);
excelExportEntity1.setWrap(true);
exportEntities.add(excelExportEntity1);
for (NutMap option : options) {
exportEntities.add(new ExcelExportEntity(option.getString("optionName"), option.getString("id"), 10));
@@ -729,10 +732,10 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
ExcelExportEntity excelExportEntity = new ExcelExportEntity();
excelExportEntity.setName("签字");
excelExportEntity.setKey("qzBytes");
excelExportEntity.setHeight(20);
excelExportEntity.setHeight(12);
excelExportEntity.setWidth(20);
excelExportEntity.setType(2);
excelExportEntity.setExportImageType(1);
excelExportEntity.setExportImageType(2);
exportEntities.add(excelExportEntity);
List<String> loginnames = list.stream().map(v -> v.getString("loginname")).distinct().collect(Collectors.toList());
@@ -770,18 +773,18 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
totalMap.put(option.getString("id"), selectNum);
}
dataList.add(totalMap);
ExportParams exportParams = new ExportParams();
/*ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, exportEntities, dataList);
workbook.write(outputStream);
/*Workbook workbook = new XSSFWorkbook();
ExcelExportService service = new ExcelExportService();
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
service.createSheetForMap(workbook, exportParams, exportEntities, dataList);
workbook.write(outputStream);*/
Workbook workbook = new HSSFWorkbook();
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.HSSF);
ExcelExportService service = new ExcelExportService();
service.createSheetForMap(workbook, exportParams, exportEntities, dataList);
workbook.write(outputStream);
// List<NutMap> result = new ArrayList<>();
// //查询这个福利下有哪些礼品
// WelfareProject welfareProject = dao().fetch(WelfareProject.class, projectId);
@@ -1196,14 +1199,21 @@ public class WelfareSingleServiceImpl extends ViServiceImpl<WelfareProject> impl
}
});
ExportParams exportParams = new ExportParams();
exportParams.setType(ExcelType.XSSF);
exportParams.setType(ExcelType.HSSF);
exportParams.setSheetName(project.getName());
try {
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, WelfareExportEntityTc.class, welfareExportEntityTcList);
ViTool.excelResponse(response, (project.getName() + (flag ? "已选名单" : "未选名单")) + ".xlsx");
ViTool.excelResponse(response, (project.getName() + (flag ? "已选名单" : "未选名单")) + ".xls");
Workbook workbook = new HSSFWorkbook();
ExcelExportService service = new ExcelExportService();
service.createSheet(workbook, exportParams, WelfareExportEntityTc.class, welfareExportEntityTcList);
ServletOutputStream outputStream = response.getOutputStream();
workbook.write(outputStream);
outputStream.close();
// Workbook workbook = ExcelExportUtil.exportExcel(exportParams, WelfareExportEntityTc.class, welfareExportEntityTcList);
// ServletOutputStream outputStream = response.getOutputStream();
// workbook.write(outputStream);
// outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}