一表一册分离出来

This commit is contained in:
方亮 2025-11-19 15:45:35 +08:00
parent 5c50c9e77f
commit fd0fa89905
5 changed files with 0 additions and 984 deletions

View File

@ -174,580 +174,4 @@ public class PmProjectController extends BaseController {
}
return error("系统异常,请联系管理员");
}
/**
* 三表一册
*/
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pro:month:list"))
@GetMapping("/getThreeForms")
@SysLog(title = "三表一册", businessType = OperaType.QUERY, module = "三表一册->三表一册列表")
public TableDataInfo getThreeForms(ProMonthTable proMonthTable) {
try {
startPage();
List<ProMonthTable> res = pmProjectService.getThreeForms(proMonthTable);
return getDataTable(res);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return getDataTableError(new ArrayList<>());
}
/**
* 每月数据
*/
// @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pro:month:list"))
@GetMapping("/getProMonthTableList")
@SysLog(title = "三表一册", businessType = OperaType.QUERY, module = "三表一册->每月数据")
public TableDataInfo getProMonthTableList(BmSubContract bmSubContract) {
try {
startPage();
List<ProMonthTable> res = pmProjectService.getProMonthTableList(bmSubContract);
return getDataTable(res);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return getDataTableError(new ArrayList<>());
}
/**
* 获取项目详情
*/
// @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pro:month:list"))
@GetMapping("/getProjectById")
@SysLog(title = "三表一册", businessType = OperaType.QUERY, module = "三表一册->获取项目详情")
public AjaxResult getProjectById(BmSubContract bmSubContract) {
try {
PmProjectVo res = pmProjectService.getProjectById(bmSubContract);
return success(res);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return error("系统异常,请联系管理员");
}
/**
* 农民工花名册
*/
// @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pro:month:list"))
@GetMapping("/getProMonthTableRosterList")
@SysLog(title = "三表一册", businessType = OperaType.QUERY, module = "三表一册->农民工花名册")
public AjaxResult getProMonthTableRosterList(ProMonthTableRosterVo proMonthTableRosterVo) {
try {
List<ProMonthTableRosterVo> res = pmProjectService.getProMonthTableRosterList(proMonthTableRosterVo);
return success(res);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return error("系统异常,请联系管理员");
}
/**
* 农民工实名制工资信息报审
*/
// @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pro:month:list"))
@GetMapping("/getUserSalaryApprovalList")
@SysLog(title = "三表一册", businessType = OperaType.QUERY, module = "三表一册->农民工实名制工资信息报审")
public AjaxResult getUserSalaryApprovalList(UserSalaryApprovalVo userSalaryApprovalVo) {
try {
List<UserSalaryApprovalVo> res = pmProjectService.getUserSalaryApprovalList(userSalaryApprovalVo);
return success(res);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return error("系统异常,请联系管理员");
}
/**
* 分包人员考勤明细
*/
// @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pro:month:list"))
@GetMapping("/getUserAttendanceList")
@SysLog(title = "三表一册", businessType = OperaType.UPDATE, module = "三表一册->分包人员考勤明细")
public AjaxResult getUserAttendanceList(UserAttendanceVo userAttendanceVo) {
try {
List<UserAttendanceVo> res = pmProjectService.getUserAttendanceList(userAttendanceVo);
return success(res);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return error("系统异常,请联系管理员");
}
/**
* 农民工工资支付表
*/
// @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pro:month:list"))
@GetMapping("/getUserWagePayList")
@SysLog(title = "三表一册", businessType = OperaType.QUERY, module = "三表一册->农民工工资支付表")
public AjaxResult getUserWagePayList(UserWagePayVo userWagePayVo) {
try {
List<UserWagePayVo> res = pmProjectService.getUserWagePayList(userWagePayVo);
return success(res);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return error("系统异常,请联系管理员");
}
/**
* 代扣代缴
*/
// @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pro:month:list"))
@PostMapping("/updateSalary")
@SysLog(title = "三表一册", businessType = OperaType.UPDATE, module = "三表一册->修改代扣代缴")
public AjaxResult updateSalary(@Validated @RequestBody List<UserWagePayVo> userWagePay) {
try {
int res = pmProjectService.updateSalary(userWagePay);
return toAjax(res);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return error("系统异常,请联系管理员");
}
/**
* 封档
*/
// @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pro:month:list"))
@PostMapping("/proAttDataUpdateRemind")
@SysLog(title = "三表一册", businessType = OperaType.UPDATE, module = "三表一册->考勤更新提醒")
public AjaxResult proAttDataUpdateRemind(@RequestBody List<MapBeanPo> list) {
try {
int res = pmProjectService.proAttDataUpdateRemind(list);
return toAjax(res);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return error("系统异常,请联系管理员");
}
/**
* 封档
*/
// @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pro:month:list"))
@PostMapping("/updateProMonthTable")
@SysLog(title = "三表一册", businessType = OperaType.UPDATE, module = "三表一册->封档")
public AjaxResult updateProMonthTable(@Validated @RequestBody ProMonthTable proMonthTable) {
try {
int res = pmProjectService.updateProMonthTable(proMonthTable);
return toAjax(res);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return error("系统异常,请联系管理员");
}
/**
* 月份和工程编号
* 封档状态
*/
@GetMapping("/getSealStatus")
@SysLog(title = "三表一册", businessType = OperaType.UPDATE, module = "三表一册->封档状态")
public AjaxResult getSealStatus(ProMonthTable proMonthTable) {
try {
return pmProjectService.getSealStatus(proMonthTable);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return error("系统异常,请联系管理员");
}
/**
* 获取项目列表
*/
@GetMapping("/updateThreeTableOneRoster")
@SysLog(title = "三表一册", businessType = OperaType.UPDATE, module = "三表一册->更新数据")
public AjaxResult updateThreeTableOneRoster(ProMonthTable proMonthTable) {
try {
return pmProjectService.updateThreeTableOneRoster(proMonthTable);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return error("系统异常,请联系管理员");
}
/**
* 回单上传
*/
// @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pro:month:list"))
@PostMapping("/updateProMonthTableRefund")
@SysLog(title = "三表一册", businessType = OperaType.UPDATE, module = "三表一册->回单上传")
public AjaxResult updateProMonthTableRefund(@RequestParam(value = "files",required = false) MultipartFile[] files, @RequestParam(value = "fileMsg",required = false) String fileMsg, @RequestParam(value = "params")String params) {
try {
params= Sm4Utils.decrypt(params);
fileMsg= Sm4Utils.decrypt(fileMsg);
List<WebFileDto> listFile = FastJsonHelper.jsonArrStrToBeanList(fileMsg, WebFileDto.class);
ProMonthTable proMonthTable = FastJsonHelper.jsonStrToBean(params, ProMonthTable.class);
int res = pmProjectService.updateProMonthTableRefund(proMonthTable,new FileBasicMsgDto(listFile, files));
return toAjax(res);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return error("系统异常,请联系管理员");
}
@PostMapping("/updateRefundFileById/{id}")
@SysLog(title = "三表一册", businessType = OperaType.DELETE, module = "三表一册->回单上传")
public AjaxResult updateRefundFileById(@PathVariable Long id) {
try {
return pmProjectService.updateRefundFileById(id);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return error("系统异常,请联系管理员");
}
/**
* 月度数据详情
*/
// @RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("pro:month:list"))
@GetMapping("/getProMonthTableById")
@SysLog(title = "三表一册", businessType = OperaType.QUERY, module = "三表一册->月度数据详情")
public AjaxResult getProMonthTableById(ProMonthTable proMonthTable) {
try {
ProMonthTable res = pmProjectService.getProMonthTableById(proMonthTable);
return success(res);
} catch (Exception e) {
logger.error(e.toString(), e);
}
return error("系统异常,请联系管理员");
}
/**
* 导出农民工花名册
*/
@PostMapping("/exportProMonthTableRoster")
@SysLog(title = "三表一册", businessType = OperaType.EXPORT, module = "三表一册->导出农民工花名册")
public void exportProMonthTableRoster(HttpServletResponse response, ProMonthTableRosterVo proMonthTableRosterVo) {
try {
List<ProMonthTableRosterVo> res = pmProjectService.getProMonthTableRosterList(proMonthTableRosterVo);
ExcelUtil<ProMonthTableRosterVo> util = new ExcelUtil<ProMonthTableRosterVo>(ProMonthTableRosterVo.class);
util.exportExcel(response, res, "导出农民工花名册");
} catch (Exception e) {
logger.error(e.toString(), e);
}
}
/**
* 导出农民工实名制工资信息报审
*/
@PostMapping("/exportUserSalaryApproval")
@SysLog(title = "三表一册", businessType = OperaType.EXPORT, module = "三表一册->导出农民工实名制工资信息报审")
public void exportUserSalaryApproval(HttpServletResponse response, UserSalaryApprovalVo userSalaryApprovalVo) {
try {
List<UserSalaryApprovalVo> res = pmProjectService.getUserSalaryApprovalList(userSalaryApprovalVo);
ExcelUtil<UserSalaryApprovalVo> util = new ExcelUtil<UserSalaryApprovalVo>(UserSalaryApprovalVo.class);
util.exportExcel(response, res, "农民工实名制工资信息报审");
} catch (Exception e) {
logger.error(e.toString(), e);
}
}
/**
* 导出分包人员考勤明细
*/
@PostMapping("/exportUserAttendance")
@SysLog(title = "三表一册", businessType = OperaType.EXPORT, module = "三表一册->导出分包人员考勤明细")
public void exportUserAttendance(HttpServletResponse response, UserAttendanceVo userAttendanceVo) {
try {
List<UserAttendanceVo> res = pmProjectService.getUserAttendanceList(userAttendanceVo);
if (res.size()>0){
// 1. 设置响应头告诉浏览器这是下载文件而非直接打开
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); // Excel 2007+ 格式
response.setCharacterEncoding("UTF-8");
// 文件名编码解决中文乱码问题
String fileName = URLEncoder.encode("分包人员考勤表.xlsx", "UTF-8");
response.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + fileName);
// 创建工作簿
Workbook workbook = new SXSSFWorkbook();
// 创建工作表
Sheet sheet = workbook.createSheet("分包人员考勤明细表");
String attendanceDay = res.get(0).getAttendanceDay();
List<WorkerAttDayVo> WorkerAttDayVoList = FastJsonHelper.jsonArrStrToBeanList(attendanceDay, WorkerAttDayVo.class);
// 构建表头
Row headerRow = sheet.createRow(0);
ArrayList<Object> headers = new ArrayList<>();
headers.add("项目名称");
headers.add("分包队伍全称");
headers.add("姓名");
headers.add("身份证号");
headers.add("职务/工种");
for (WorkerAttDayVo workerAttDayVo:WorkerAttDayVoList) {
headers.add(workerAttDayVo.getDay());
}
headers.add("出勤天数");
headers.add("签字");
headers.add("其他备注");
CellStyle headerCellStyle = createExcelUtilHeaderStyle(workbook);
for (int i = 0; i < headers.size(); i++) {
Cell cell = headerRow.createCell(i);
cell.setCellValue(headers.get(i).toString());
cell.setCellStyle(headerCellStyle); // 应用标准表头样式
}
CellStyle dataCellStyle = createExcelUtilDataStyle(workbook);
// 填充数据行
for (int i = 0; i < res.size(); i++) {
UserAttendanceVo userAttendanceVoNew = res.get(i);
Row dataRow = sheet.createRow(i + 1);
String attendanceDayNew = res.get(i).getAttendanceDay();
List<WorkerAttDayVo> WorkerAttDayVoNewList = FastJsonHelper.jsonArrStrToBeanList(attendanceDayNew, WorkerAttDayVo.class);
dataRow.createCell(0).setCellValue(userAttendanceVoNew.getProName());
dataRow.createCell(1).setCellValue(userAttendanceVoNew.getSubName());
dataRow.createCell(2).setCellValue(userAttendanceVoNew.getUserName());
dataRow.createCell(3).setCellValue(userAttendanceVoNew.getIdCard());
dataRow.createCell(4).setCellValue(userAttendanceVoNew.getWorkName());
// 填充出勤天数
for (int j = 0; j < WorkerAttDayVoNewList.size(); j++) {
dataRow.createCell(5 + j).setCellValue((WorkerAttDayVoNewList.get(j).getIsAtt()));
}
dataRow.createCell(5+WorkerAttDayVoNewList.size()).setCellValue(userAttendanceVoNew.getAttendanceNum());
dataRow.createCell(6+WorkerAttDayVoNewList.size()).setCellValue(userAttendanceVoNew.getSignature());
dataRow.createCell(7+WorkerAttDayVoNewList.size()).setCellValue(userAttendanceVoNew.getRemark());
}
OutputStream outputStream = response.getOutputStream();
workbook.write(outputStream);
// 刷新流确保数据完全输出
outputStream.flush();
}
} catch (Exception e) {
logger.error(e.toString(), e);
}
}
/**
* 导出农民工工资支付表
*/
@PostMapping("/exportUserWagePay")
@SysLog(title = "三表一册", businessType = OperaType.EXPORT, module = "三表一册->导出农民工工资支付表")
public void exportUserWagePay(HttpServletResponse response, UserWagePayVo userWagePayVo) {
try {
List<UserWagePayVo> res = pmProjectService.getUserWagePayList(userWagePayVo);
ExcelUtil<UserWagePayVo> util = new ExcelUtil<UserWagePayVo>(UserWagePayVo.class);
util.exportExcel(response, res, "农民工工资支付表");
} catch (Exception e) {
logger.error(e.toString(), e);
}
}
/**
* 导出三表一册
*/
@PostMapping("/exportThreeAndOne")
@SysLog(title = "三表一册", businessType = OperaType.EXPORT, module = "三表一册->导出三表一册")
public void exportThreeAndOne(HttpServletResponse response, UserWagePayVo userWagePayVo) throws IOException {
//农民工工资支付表
List<UserWagePayVo> userWagePayList = pmProjectService.getUserWagePayList(userWagePayVo);
//农民工实名制工资信息报审
UserSalaryApprovalVo userSalaryApprovalVo = new UserSalaryApprovalVo();
userSalaryApprovalVo.setMonthId(Long.valueOf(userWagePayVo.getMonthId()));
List<UserSalaryApprovalVo> userSalaryApprovalList = pmProjectService.getUserSalaryApprovalList(userSalaryApprovalVo);
//分包人员考勤明细
UserAttendanceVo userAttendanceVo = new UserAttendanceVo();
userAttendanceVo.setMonthId(Long.valueOf(userWagePayVo.getMonthId()));
List<UserAttendanceVo> userAttendanceList = pmProjectService.getUserAttendanceList(userAttendanceVo);
//农民工花名册
ProMonthTableRosterVo proMonthTableRosterVo = new ProMonthTableRosterVo();
proMonthTableRosterVo.setMonthId(Long.valueOf(userWagePayVo.getMonthId()));
List<ProMonthTableRosterVo> proMonthTableRosterList = pmProjectService.getProMonthTableRosterList(proMonthTableRosterVo);
// 2. 设置响应头下载Excel
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
// 文件名编码避免中文乱码
String fileName = URLEncoder.encode("三表一册", "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
// 3. 创建全局Workbook复用用于多Sheet
Workbook wb = new SXSSFWorkbook(); // SXSSFWorkbook大数据量导出避免OOM
try {
// 4. 为每个Sheet创建ExcelUtil并添加到Workbook
// 4.1 Sheet1农民工工资支付表
ExcelUtil<UserWagePayVo> wagePayExcel = new ExcelUtil<>(UserWagePayVo.class);
wagePayExcel.addSheet(wb, userWagePayList, "农民工工资支付", null);
// 4.2 Sheet2农民工实名制工资信息报审
ExcelUtil<UserSalaryApprovalVo> salaryApprovalExcel = new ExcelUtil<>(UserSalaryApprovalVo.class);
salaryApprovalExcel.addSheet(wb, userSalaryApprovalList, "农民工实名制工资信息报审", null);
// 4.3 Sheet3分包人员考勤明细
/*ExcelUtil<UserAttendanceVo> attendanceExcel = new ExcelUtil<>(UserAttendanceVo.class);
attendanceExcel.addSheet(wb, userAttendanceList, "分包人员考勤明细", null);*/
addSheet(wb, userAttendanceList, "分包人员考勤明细", response);
// 4.4 Sheet4农民工花名册
ExcelUtil<ProMonthTableRosterVo> rosterExcel = new ExcelUtil<>(ProMonthTableRosterVo.class);
rosterExcel.addSheet(wb, proMonthTableRosterList, "农民工花名册", null);
// 5. 将Workbook写入响应流
wb.write(response.getOutputStream());
response.flushBuffer(); // 强制刷新流
} catch (Exception e) {
e.printStackTrace();
// 异常处理返回错误信息
response.reset();
response.setContentType("text/plain;charset=utf-8");
response.getWriter().write("Excel导出失败" + e.getMessage());
} finally {
// 关闭流SXSSFWorkbook需手动清理临时文件
if (wb != null) {
wb.close();
}
}
}
/**
* 扩展为已有Workbook添加新Sheet用于多Sheet导出
* @param wb 已存在的Workbook
* @param list 新Sheet的数据
* @param sheetName 新Sheet名称
*/
public void addSheet(Workbook wb, List<UserAttendanceVo> list, String sheetName, HttpServletResponse response) throws IOException {
// 创建工作表
Sheet sheet = wb.createSheet(sheetName);
String attendanceDay = list.get(0).getAttendanceDay();
List<WorkerAttDayVo> WorkerAttDayVoList = FastJsonHelper.jsonArrStrToBeanList(attendanceDay, WorkerAttDayVo.class);
// 构建表头
Row headerRow = sheet.createRow(0);
ArrayList<Object> headers = new ArrayList<>();
headers.add("项目名称");
headers.add("分包队伍全称");
headers.add("姓名");
headers.add("身份证号");
headers.add("职务/工种");
for (WorkerAttDayVo workerAttDayVo:WorkerAttDayVoList) {
headers.add(workerAttDayVo.getDay());
}
headers.add("出勤天数");
headers.add("签字");
headers.add("其他备注");
CellStyle headerCellStyle = createExcelUtilHeaderStyle(wb);
for (int i = 0; i < headers.size(); i++) {
Cell cell = headerRow.createCell(i);
cell.setCellValue(headers.get(i).toString());
cell.setCellStyle(headerCellStyle); // 应用标准表头样式
}
CellStyle dataCellStyle = createExcelUtilDataStyle(wb);
// 填充数据行
for (int i = 0; i < list.size(); i++) {
UserAttendanceVo userAttendanceVoNew = list.get(i);
Row dataRow = sheet.createRow(i + 1);
String attendanceDayNew = list.get(i).getAttendanceDay();
List<WorkerAttDayVo> WorkerAttDayVoNewList = FastJsonHelper.jsonArrStrToBeanList(attendanceDayNew, WorkerAttDayVo.class);
dataRow.setRowStyle(dataCellStyle);
dataRow.createCell(0).setCellValue(userAttendanceVoNew.getProName());
dataRow.createCell(1).setCellValue(userAttendanceVoNew.getSubName());
dataRow.createCell(2).setCellValue(userAttendanceVoNew.getUserName());
dataRow.createCell(3).setCellValue(userAttendanceVoNew.getIdCard());
dataRow.createCell(4).setCellValue(userAttendanceVoNew.getWorkName());
// 填充出勤天数
for (int j = 0; j < WorkerAttDayVoNewList.size(); j++) {
dataRow.createCell(5 + j).setCellValue((WorkerAttDayVoNewList.get(j).getIsAtt()));
}
dataRow.createCell(5+WorkerAttDayVoNewList.size()).setCellValue(userAttendanceVoNew.getAttendanceNum());
dataRow.createCell(6+WorkerAttDayVoNewList.size()).setCellValue(userAttendanceVoNew.getSignature());
dataRow.createCell(7+WorkerAttDayVoNewList.size()).setCellValue(userAttendanceVoNew.getRemark());
}
}
// 预定义颜色索引与Excel内置颜色对应
private static final short GREY_BORDER_INDEX = IndexedColors.GREY_50_PERCENT.getIndex();
private static final short BLACK_FONT_INDEX = IndexedColors.WHITE.getIndex();
private static final short GREY_HEADER_BACKGROUND_INDEX = IndexedColors.GREY_25_PERCENT.getIndex();
/**
* 复用ExcelUtil的表头样式边框+居中对齐+灰色背景+加粗字体
* @param workbook 工作簿对象
* @return 标准表头样式
*/
public static CellStyle createExcelUtilHeaderStyle(Workbook workbook) {
CellStyle style = workbook.createCellStyle();
// 1. 边框配置使用short类型的颜色索引
style.setBorderRight(BorderStyle.THIN);
style.setRightBorderColor(GREY_BORDER_INDEX); // 灰色边框
style.setBorderLeft(BorderStyle.THIN);
style.setLeftBorderColor(GREY_BORDER_INDEX);
style.setBorderTop(BorderStyle.THIN);
style.setTopBorderColor(GREY_BORDER_INDEX);
style.setBorderBottom(BorderStyle.THIN);
style.setBottomBorderColor(GREY_BORDER_INDEX);
// 2. 对齐配置
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
// 3. 背景色配置使用Excel内置颜色索引
style.setFillForegroundColor(GREY_BORDER_INDEX);
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// 4. 字体配置字体颜色使用short类型索引
Font font = workbook.createFont();
font.setFontName("Arial");
font.setFontHeightInPoints((short) 10);
font.setBold(true);
font.setColor(BLACK_FONT_INDEX); // 黑色字体
style.setFont(font);
// 5. 文本格式
DataFormat dataFormat = workbook.createDataFormat();
style.setDataFormat(dataFormat.getFormat("@"));
return style;
}
/**
* 复用ExcelUtil的数据行样式边框+居中对齐+默认背景
* @param workbook 工作簿对象
* @return 标准数据行样式
*/
public static CellStyle createExcelUtilDataStyle(Workbook workbook) {
CellStyle style = workbook.createCellStyle();
// 1. 边框配置使用相同的灰色边框索引
style.setBorderRight(BorderStyle.THIN);
style.setRightBorderColor(GREY_BORDER_INDEX);
style.setBorderLeft(BorderStyle.THIN);
style.setLeftBorderColor(GREY_BORDER_INDEX);
style.setBorderTop(BorderStyle.THIN);
style.setTopBorderColor(GREY_BORDER_INDEX);
style.setBorderBottom(BorderStyle.THIN);
style.setBottomBorderColor(GREY_BORDER_INDEX);
// 2. 对齐配置
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
// 3. 字体配置
Font font = workbook.createFont();
font.setFontName("Arial");
font.setFontHeightInPoints((short) 10);
font.setBold(false);
font.setColor(BLACK_FONT_INDEX);
style.setFont(font);
// 4. 文本格式
DataFormat dataFormat = workbook.createDataFormat();
style.setDataFormat(dataFormat.getFormat("@"));
return style;
}
/**
* 封装数据单元格赋值逻辑
* @param row 数据行
* @param column 列索引
* @param value 单元格值
* @param style 单元格样式
*/
public static void setDataCell(Row row, int column, Object value, CellStyle style) {
Cell cell = row.createCell(column);
cell.setCellStyle(style);
// 处理null值
String cellValue = value == null ? "" : value.toString();
cell.setCellValue(cellValue);
}
}

View File

@ -76,58 +76,4 @@ public interface PmProjectMapper {
*/
Integer getPeoNum(BmSubContract bmSubContract);
/**
* 三表一册
*/
List<ProMonthTable> getThreeForms(ProMonthTable proMonthTable);
/**
* 获取项目详情
*/
PmProjectVo getProjectById(BmSubContract bmSubContract);
/**
* 每月数据
*/
List<ProMonthTable> getProMonthTableList(BmSubContract bmSubContract);
/**
* 农民工花名册
*/
List<ProMonthTableRosterVo> getProMonthTableRosterList(ProMonthTableRosterVo proMonthTableRosterVo);
/**
* 农民工实名制工资信息报审
*/
List<UserSalaryApprovalVo> getUserSalaryApprovalList(UserSalaryApprovalVo userSalaryApprovalVo);
/**
* 分包人员考勤明细
*/
List<UserAttendanceVo> getUserAttendanceList(UserAttendanceVo userAttendanceVo);
/**
* 农民工工资支付表
*/
List<UserWagePayVo> getUserWagePayList(UserWagePayVo userWagePayVo);
/**
* 封档
*/
int updateProMonthTable(ProMonthTable proMonthTable);
/**
* 月度数据详情
*/
ProMonthTable getProMonthTableById(ProMonthTable proMonthTable);
int updateSalary(List<UserWagePayVo> userWagePay);
int proAttDataUpdateRemind(List<MapBeanPo> list);
int getSealStatus(ProMonthTable proMonthTable);
int updateDataStatus(ProMonthTable proMonthTable);
void updateMonthSalary( @Param("netSalary") BigDecimal netSalary, @Param("monthId") String monthId);
}

View File

@ -47,63 +47,5 @@ public interface PmProjectService {
*/
Map<String, Object> getPeoNum(BmSubContract bmSubContract);
/**
* 三表一册
*/
List<ProMonthTable> getThreeForms(ProMonthTable proMonthTable);
/**
* 获取项目详情
*/
PmProjectVo getProjectById(BmSubContract bmSubContract);
/**
* 每月数据
*/
List<ProMonthTable> getProMonthTableList(BmSubContract bmSubContract);
/**
* 农民工花名册
*/
List<ProMonthTableRosterVo> getProMonthTableRosterList(ProMonthTableRosterVo proMonthTableRosterVo);
/**
* 农民工实名制工资信息报审
*/
List<UserSalaryApprovalVo> getUserSalaryApprovalList(UserSalaryApprovalVo userSalaryApprovalVo);
/**
* 分包人员考勤明细
*/
List<UserAttendanceVo> getUserAttendanceList(UserAttendanceVo userAttendanceVo);
/**
* 农民工工资支付表
*/
List<UserWagePayVo> getUserWagePayList(UserWagePayVo userWagePayVo);
/**
* 封档
*/
int updateProMonthTable(ProMonthTable proMonthTable);
/**
* 回单上传
*/
int updateProMonthTableRefund(ProMonthTable proMonthTable, FileBasicMsgDto fileBasicMsgDto);
/**
* 月度数据详情
*/
ProMonthTable getProMonthTableById(ProMonthTable proMonthTable);
int updateSalary(List<UserWagePayVo> userWagePay);
AjaxResult updateRefundFileById(Long id);
int proAttDataUpdateRemind(List<MapBeanPo> list);
AjaxResult getSealStatus(ProMonthTable proMonthTable);
AjaxResult updateThreeTableOneRoster(ProMonthTable proMonthTable);
}

View File

@ -171,171 +171,4 @@ public class PmProjectServiceImpl implements PmProjectService {
return map;
}
/**
* 三表一册
*/
@Override
public List<ProMonthTable> getThreeForms(ProMonthTable proMonthTable) {
return pmProjectMapper.getThreeForms(proMonthTable);
}
/**
* 获取项目详情
*/
@Override
public PmProjectVo getProjectById(BmSubContract bmSubContract) {
return pmProjectMapper.getProjectById(bmSubContract);
}
/**
* 每月数据
*/
@Override
public List<ProMonthTable> getProMonthTableList(BmSubContract bmSubContract) {
return pmProjectMapper.getProMonthTableList(bmSubContract);
}
/**
* 农民工花名册
*/
@Override
public List<ProMonthTableRosterVo> getProMonthTableRosterList(ProMonthTableRosterVo proMonthTableRosterVo) {
return pmProjectMapper.getProMonthTableRosterList(proMonthTableRosterVo);
}
/**
* 农民工实名制工资信息报审
*/
@Override
public List<UserSalaryApprovalVo> getUserSalaryApprovalList(UserSalaryApprovalVo userSalaryApprovalVo) {
return pmProjectMapper.getUserSalaryApprovalList(userSalaryApprovalVo);
}
/**
* 分包人员考勤明细
*/
@Override
public List<UserAttendanceVo> getUserAttendanceList(UserAttendanceVo userAttendanceVo) {
return pmProjectMapper.getUserAttendanceList(userAttendanceVo);
}
/**
* 农民工工资支付表
*/
@Override
public List<UserWagePayVo> getUserWagePayList(UserWagePayVo userWagePayVo) {
List<UserWagePayVo> list = pmProjectMapper.getUserWagePayList(userWagePayVo);
// 过滤掉attendanceNum为0的元素
List<UserWagePayVo> filteredList = list.stream()
.filter(vo -> vo.getAttendanceNum() != 0)
.collect(Collectors.toList());
return filteredList;
}
/**
* 封档
*/
@Override
public int updateProMonthTable(ProMonthTable proMonthTable) {
proMonthTable.setBlockTime(DateUtil.now());
SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
proMonthTable.setUpdateUser(sysUser.getUserId().intValue());
int i = pmProjectMapper.updateProMonthTable(proMonthTable);
if(i > 0){
//封挡成功所有在审核的当月补卡全部失败封档成功
RepairCardApplyDto cardApplyDto = new RepairCardApplyDto();
cardApplyDto.setRepairMonth(proMonthTable.getTableMonth());
cardApplyDto.setProId(Math.toIntExact(proMonthTable.getProId()));
int x = repairCardApplyService.autoAudit(cardApplyDto);
}
return i;
}
/**
* 回单上传
*/
@Override
@Transactional
public int updateProMonthTableRefund(ProMonthTable proMonthTable, FileBasicMsgDto fileBasicMsgDto) {
proMonthTable.setRefundStatus("1");
proMonthTable.setRefundTime(DateUtil.now());
SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
proMonthTable.setRefundUser(sysUser.getUserId().intValue());
int res = pmProjectMapper.updateProMonthTable(proMonthTable);
//添加到文件库和minio上
if(res > 0 && StringUtils.isNotNull(fileBasicMsgDto.getFiles())){
//存文件
List<WebFileDto> fileMsg = fileBasicMsgDto.getFileMsg();
String[] type = new String[fileMsg.size()];
for (int i = 0; i < fileMsg.size(); i++) {
type[i] = fileMsg.get(i).getType();
}
String userId = SecurityUtils.getUserId().toString();
List<UploadFileVo> uploadFileVos = fileUploadUtils.uploadFile(fileBasicMsgDto.getFiles(), Constants.TB_PRO_MONTH_TABLE, proMonthTable.getId().toString(), type,"", "");
}
return res;
}
/**
* 月度数据详情
*/
@Override
public ProMonthTable getProMonthTableById(ProMonthTable proMonthTable) {
ProMonthTable res =pmProjectMapper.getProMonthTableById(proMonthTable);
List<UploadFileVo> contractFile = fileUploadUtils.getFileList("", res.getId().toString(), Constants.TB_PRO_MONTH_TABLE, "");
res.setContractFile(contractFile);
return res;
}
@Override
public int updateSalary(List<UserWagePayVo> userWagePay) {
if(userWagePay != null && !userWagePay.isEmpty()){
int i = pmProjectMapper.updateSalary(userWagePay);
if(i>0){
BigDecimal sum = userWagePay.stream()
.map(UserWagePayVo::getActualMoney)
.reduce(BigDecimal.ZERO, BigDecimal::add);
pmProjectMapper.updateMonthSalary(sum, userWagePay.get(0).getMonthId());
}
return i;
}else{
return 0;
}
}
@Override
public AjaxResult updateRefundFileById(Long id) {
fileUploadUtils.delFileListById(id.toString(),"", "", "");
return AjaxResult.success();
}
@Override
public int proAttDataUpdateRemind(List<MapBeanPo> list) {
return pmProjectMapper.proAttDataUpdateRemind(list);
}
@Override
public AjaxResult getSealStatus(ProMonthTable proMonthTable) {
int i = pmProjectMapper.getSealStatus(proMonthTable);
String msg = "未封挡";
if(i==2){
msg = "已封挡";
}
return AjaxResult.success(msg);
}
@Override
public AjaxResult updateThreeTableOneRoster(ProMonthTable proMonthTable) {
try {
remoteJobService.update(proMonthTable.getTableMonth(), Math.toIntExact(proMonthTable.getProId()), SecurityConstants.INNER);
} catch (Exception e) {
e.printStackTrace();
}
int i = pmProjectMapper.updateDataStatus(proMonthTable);
return i>0?AjaxResult.success():AjaxResult.error();
}
}

View File

@ -203,134 +203,5 @@
<select id="getPeoNum" resultType="java.lang.Integer">
select count(1) from bm_worker_ein_pro_record where is_active='1' and pro_id = #{proId} and ein_status!=2
</select>
<select id="getThreeForms" resultType="com.bonus.bmw.domain.vo.ProMonthTable">
select psc.sub_company_name as subComName,
pp.pro_name as proName,
tpmt.pro_id as proId,
count(tpmt.id) as tableMonth,
sum(tpmt.sub_num) as subNum,
sum(tpmt.team_num) as teamNum,
sum(tpmt.pay_num) as payNum,
sum(tpmt.net_salary) as netSalary,
pp.pro_status as proStatus
from tb_pro_month_table tpmt
left join pm_project pp on pp.id = tpmt.pro_id
left join pm_sub_company psc on pp.sub_com_id = psc.id
<where>
tpmt.status != 0
<if test="proName != null">
and pp.pro_name LIKE CONCAT('%', #{proName}, '%')
</if>
<if test="proStatus != null">
and pp.pro_status = #{proStatus}
</if>
</where>
group by tpmt.pro_id
</select>
<select id="getProjectById" resultType="com.bonus.bmw.domain.vo.PmProjectVo">
select id,pro_name,pro_status,pro_type,vol_level,start_time,end_time,pro_address
from pm_project where id = #{proId}
</select>
<select id="getProMonthTableList" resultType="com.bonus.bmw.domain.vo.ProMonthTable">
select tpmt.id,tpmt.pro_id,tpmt.table_month,tpmt.roster_num,tpmt.attendance_num,tpmt.repair_num,tpmt.salary_num,tpmt.sub_num,
tpmt.gross_salary,tpmt.net_salary,tpmt.status,tpmt.block_time,tpmt.refund_status,tpmt.team_num,su.user_name as refund_user_name,
tpmt.refund_time,tpmt.is_update,tpmt.pay_num
from tb_pro_month_table tpmt
left join sys_user su on su.user_id = tpmt.refund_user
where pro_id = #{proId}
</select>
<select id="getProMonthTableRosterList" resultType="com.bonus.bmw.domain.vo.ProMonthTableRosterVo">
select id,pro_id,`month` as proMonth,month_id,sub_id,sub_name,team_id,team_name,user_id,user_name,sex,
work_id,work_name,unit_and_code,period,id_card,residence,phone,remark,out_time,on_duty,in_time
from tb_pro_month_table_roster where month_id =#{monthId}
<if test="subName != null">
and sub_name LIKE CONCAT('%', #{subName}, '%')
</if>
<if test="teamName != null">
and team_name LIKE CONCAT('%', #{teamName}, '%')
</if>
<if test="workName != null">
and work_name LIKE CONCAT('%', #{workName}, '%')
</if>
<if test="userName != null">
and user_name LIKE CONCAT('%', #{userName}, '%')
</if>
<if test="onDuty != null">
and on_duty = #{onDuty}
</if>
</select>
<select id="getUserSalaryApprovalList" resultType="com.bonus.bmw.domain.vo.UserSalaryApprovalVo">
select id,pro_id,`month`,team_id,team_name,user_name,user_id,id_card,phone,sub_id,
sub_name,bank_name,bank_card_code as bankCode,bank_identifier_code as bank_num,bank_number,contract_id as cons_id,price_wage,payment,pay_day,remark
from tb_pro_month_table_roster where month_id = #{monthId}
<if test="bankCode != null">
and bank_card_code LIKE CONCAT('%', #{bankCode}, '%')
</if>
<if test="teamName != null">
and team_name LIKE CONCAT('%', #{teamName}, '%')
</if>
<if test="userName != null">
and user_name LIKE CONCAT('%', #{userName}, '%')
</if>
</select>
<select id="getUserAttendanceList" resultType="com.bonus.bmw.domain.vo.UserAttendanceVo">
select id,pro_id,`month`,pro_name,month_day,sub_id,sub_name,user_name,
id_card,work_name,work_id,attendance_day,check_day,repair_num,attendance_num,signature,remark
from tb_pro_month_table_roster where month_id = #{monthId}
<if test="subName != null">
and sub_name LIKE CONCAT('%', #{subName}, '%')
</if>
<if test="userName != null">
and user_name LIKE CONCAT('%', #{userName}, '%')
</if>
</select>
<select id="getUserWagePayList" resultType="com.bonus.bmw.domain.vo.UserWagePayVo">
select id,pro_id,`month`,user_id,month_id,user_name,id_card,team_id,team_name,work_name,
attendance_num,pay_money,deduct_money,actual_money,bank_name,bank_card_code as bank_code,bank_identifier_code as bank_num,is_accord,
signature,remark,pay_day,bank_number,create_time,update_time,update_user
from tb_pro_month_table_roster where month_id = #{monthId}
<if test="bankCode != null">
and bank_card_code LIKE CONCAT('%', #{bankCode}, '%')
</if>
<if test="teamName != null">
and team_name LIKE CONCAT('%', #{teamName}, '%')
</if>
<if test="userName != null">
and user_name LIKE CONCAT('%', #{userName}, '%')
</if>
</select>
<select id="getProMonthTableById" resultType="com.bonus.bmw.domain.vo.ProMonthTable">
select id,pro_id,table_month,roster_num,attendance_num,repair_num,salary_num,sub_num,
gross_salary,net_salary,status,block_time,refund_status,team_num,refund_user,
refund_time,is_update,pay_num
from tb_pro_month_table where id = #{id}
</select>
<update id="updateSalary">
<foreach collection="list" item="item" separator=";">
update tb_pro_month_table_roster set deduct_money = #{item.deductMoney}, actual_money = #{item.actualMoney} where id = #{item.id}
</foreach>
</update>
<update id="proAttDataUpdateRemind">
<foreach collection="list" item="item" separator=";">
update tb_pro_month_table set is_update = '1' where pro_id = #{item.proId} and table_month = #{item.name}
</foreach>
</update>
<select id="getSealStatus" resultType="java.lang.Integer">
select
status
from tb_pro_month_table
where pro_id = #{proId} and table_month = #{tableMonth}
</select>
<update id="updateDataStatus">
update tb_pro_month_table set is_update = '0' where table_month = #{tableMonth}
</update>
<update id="updateMonthSalary">
update tb_pro_month_table set net_salary = #{netSalary} where id = #{monthId}
</update>
</mapper>