diff --git a/bonus-business/src/main/java/com/bonus/business/controller/tool/WorkloadAndCarSummaryExcelExporter.java b/bonus-business/src/main/java/com/bonus/business/controller/tool/WorkloadAndCarSummaryExcelExporter.java index 102c82a..bd000d6 100644 --- a/bonus-business/src/main/java/com/bonus/business/controller/tool/WorkloadAndCarSummaryExcelExporter.java +++ b/bonus-business/src/main/java/com/bonus/business/controller/tool/WorkloadAndCarSummaryExcelExporter.java @@ -24,12 +24,12 @@ import java.util.List; public class WorkloadAndCarSummaryExcelExporter { // 列索引常量 - private static final int COL_A = 0, COL_B = 1, COL_C = 2, COL_D = 3, COL_E = 4, COL_F = 5; - private static final int COL_G = 6, COL_H = 7, COL_I = 8, COL_J = 9, COL_K = 10; + private static final int COL_A = 0, COL_B = 1, COL_C = 2, COL_D = 3, COL_E = 4, COL_F = 5,COL_G = 6, COL_H = 7; + private static final int COL_I = 8, COL_J = 9, COL_K = 10, COL_L = 11, COL_M = 12; // 标题合并区域列范围 - private static final int[] WORKLOAD_TITLE_COLS = {COL_A, COL_B, COL_C, COL_D, COL_E, COL_F}; // 工作量标题列(A-F) - private static final int[] CAR_TITLE_COLS = {COL_H, COL_I, COL_J, COL_K}; // 用车标题列(H-K) + private static final int[] WORKLOAD_TITLE_COLS = {COL_A, COL_B, COL_C, COL_D, COL_E,COL_F,COL_G,COL_H}; // 工作量标题列(A-F) + private static final int[] CAR_TITLE_COLS = {COL_J, COL_K,COL_L, COL_M}; // 用车标题列(H-K) /** * 导出方法(纯POI手动构建所有内容) @@ -206,7 +206,7 @@ public class WorkloadAndCarSummaryExcelExporter { Cell cell = row0.createCell(col); cell.setCellStyle(titleStyle); } - Cell carTitle = row0.getCell(COL_H); + Cell carTitle = row0.getCell(COL_J); carTitle.setCellValue(monthOnly + "月份用车清单"); // ========== 行1:二级表头 ========== @@ -216,13 +216,15 @@ public class WorkloadAndCarSummaryExcelExporter { createCell(row1, COL_B, "运检站", headerStyle); createCell(row1, COL_C, "工作量类型", headerStyle); createCell(row1, COL_D, "工作量", headerStyle); - createCell(row1, COL_E, "单价", headerStyle); - createCell(row1, COL_F, "合计", headerStyle); + createCell(row1, COL_E, "绩效单价", headerStyle); + createCell(row1, COL_F, "结算单价", headerStyle); + createCell(row1, COL_G, "绩效合计", headerStyle); + createCell(row1, COL_H, "结算合计", headerStyle); // 用车表头 - createCell(row1, COL_H, "序号", headerStyle); - createCell(row1, COL_I, "运检站", headerStyle); - createCell(row1, COL_J, "管理用车天数", headerStyle); - createCell(row1, COL_K, "分包用车天数", headerStyle); + createCell(row1, COL_J, "序号", headerStyle); + createCell(row1, COL_K, "运检站", headerStyle); + createCell(row1, COL_L, "管理用车天数", headerStyle); + createCell(row1, COL_M, "分包用车天数", headerStyle); } /** @@ -244,30 +246,32 @@ public class WorkloadAndCarSummaryExcelExporter { createCell(row, COL_C, workloadVo.getWorkloadCategoryName() == null ? "" : workloadVo.getWorkloadCategoryName(), contentStyle); createCell(row, COL_D, workloadVo.getTotalWorkload() == null ? 0 : workloadVo.getTotalWorkload(), contentStyle); createCell(row, COL_E, workloadVo.getUnitPrice() == null ? 0 : workloadVo.getUnitPrice(), contentStyle); - createCell(row, COL_F, workloadVo.getTotalAmount() == null ? 0 : workloadVo.getTotalAmount(), contentStyle); + createCell(row, COL_F, workloadVo.getSettlementUnitPrice() == null ? 0 : workloadVo.getSettlementUnitPrice(), contentStyle); + createCell(row, COL_G, workloadVo.getTotalAmount() == null ? 0 : workloadVo.getTotalAmount(), contentStyle); + createCell(row, COL_H, workloadVo.getSettlementTotalAmount() == null ? 0 : workloadVo.getSettlementTotalAmount(), contentStyle); // 填充用车数据(核心修改:序号为0时置空) CarUseSummaryExcelVo carVo = i < carData.size() ? carData.get(i) : new CarUseSummaryExcelVo(); Integer carSerialNum = carVo.getSerialNumber(); // 序号:为0或null时置空,否则填实际值 - if (carSerialNum == null || carSerialNum == 0) { - createCell(row, COL_H, "", contentStyle); - } else { - createCell(row, COL_H, carSerialNum, contentStyle); - } - // 运检站:保留原有逻辑 - createCell(row, COL_I, carVo.getInspectionStationName() == null ? "" : carVo.getInspectionStationName(), contentStyle); - // 管理用车天数:序号为0/null时置空,否则填实际值(无值则0) if (carSerialNum == null || carSerialNum == 0) { createCell(row, COL_J, "", contentStyle); } else { - createCell(row, COL_J, carVo.getTotalManageCarDays() == null ? 0 : carVo.getTotalManageCarDays(), contentStyle); + createCell(row, COL_J, carSerialNum, contentStyle); + } + // 运检站:保留原有逻辑 + createCell(row, COL_K, carVo.getInspectionStationName() == null ? "" : carVo.getInspectionStationName(), contentStyle); + // 管理用车天数:序号为0/null时置空,否则填实际值(无值则0) + if (carSerialNum == null || carSerialNum == 0) { + createCell(row, COL_L, "", contentStyle); + } else { + createCell(row, COL_L, carVo.getTotalManageCarDays() == null ? 0 : carVo.getTotalManageCarDays(), contentStyle); } // 分包用车天数:序号为0/null时置空,否则填实际值(无值则0) if (carSerialNum == null || carSerialNum == 0) { - createCell(row, COL_K, "", contentStyle); + createCell(row, COL_M, "", contentStyle); } else { - createCell(row, COL_K, carVo.getTotalSubCarDays() == null ? 0 : carVo.getTotalSubCarDays(), contentStyle); + createCell(row, COL_M, carVo.getTotalSubCarDays() == null ? 0 : carVo.getTotalSubCarDays(), contentStyle); } } } @@ -284,15 +288,19 @@ public class WorkloadAndCarSummaryExcelExporter { // 工作量合计 createCell(totalRow, COL_A, "合计", totalStyle); int workloadTotal = 0; + int settlementWorkloadTotal = 0; for (WorkloadSummaryExcelVo vo : workloadData) { if (vo != null && vo.getTotalAmount() != null) { workloadTotal += vo.getTotalAmount(); } + if (vo != null && vo.getSettlementTotalAmount() != null) { + settlementWorkloadTotal += vo.getSettlementTotalAmount(); + } } - createCell(totalRow, COL_F, workloadTotal, totalStyle); - + createCell(totalRow, COL_G, workloadTotal, totalStyle); + createCell(totalRow, COL_H, settlementWorkloadTotal, totalStyle); // 用车合计 - createCell(totalRow, COL_H, "合计", totalStyle); + createCell(totalRow, COL_J, "合计", totalStyle); int manageCarTotal = 0; int subCarTotal = 0; for (CarUseSummaryExcelVo vo : carData) { @@ -310,15 +318,16 @@ public class WorkloadAndCarSummaryExcelExporter { } } // 确保J列(管理用车天数合计)和K列(分包用车天数合计)正常赋值 - createCell(totalRow, COL_J, manageCarTotal, totalStyle); - createCell(totalRow, COL_K, subCarTotal, totalStyle); + createCell(totalRow, COL_L, manageCarTotal, totalStyle); + createCell(totalRow, COL_M, subCarTotal, totalStyle); // 合计行其他单元格填充空值+样式 createCell(totalRow, COL_B, "", totalStyle); createCell(totalRow, COL_C, "", totalStyle); createCell(totalRow, COL_D, "", totalStyle); createCell(totalRow, COL_E, "", totalStyle); - createCell(totalRow, COL_I, "", totalStyle); + createCell(totalRow, COL_F, "", totalStyle); + createCell(totalRow, COL_K, "", totalStyle); } /** @@ -326,19 +335,19 @@ public class WorkloadAndCarSummaryExcelExporter { */ private static void setMergedRegions(Sheet sheet, int totalRowNum) { // 一级标题合并 - sheet.addMergedRegion(new CellRangeAddress(0, 0, COL_A, COL_F)); - sheet.addMergedRegion(new CellRangeAddress(0, 0, COL_H, COL_K)); + sheet.addMergedRegion(new CellRangeAddress(0, 0, COL_A, COL_H)); + sheet.addMergedRegion(new CellRangeAddress(0, 0, COL_J, COL_M)); // 合计行合并 - sheet.addMergedRegion(new CellRangeAddress(totalRowNum, totalRowNum, COL_A, COL_E)); + sheet.addMergedRegion(new CellRangeAddress(totalRowNum, totalRowNum, COL_A, COL_F)); // 核心修改:用车合计行仅合并H-I列,不再合并J列,确保J列和K列的合计值正常显示 - sheet.addMergedRegion(new CellRangeAddress(totalRowNum, totalRowNum, COL_H, COL_I)); + sheet.addMergedRegion(new CellRangeAddress(totalRowNum, totalRowNum, COL_J, COL_K)); } /** * 自适应列宽 */ private static void autoSizeColumns(Sheet sheet) { - int[] cols = {COL_A, COL_B, COL_C, COL_D, COL_E, COL_F, COL_H, COL_I, COL_J, COL_K}; + int[] cols = {COL_A, COL_B, COL_C, COL_D, COL_E, COL_F, COL_G, COL_H, COL_J, COL_K, COL_L, COL_M}; for (int col : cols) { sheet.autoSizeColumn(col); // 手动调整列宽(避免自适应过窄) diff --git a/bonus-business/src/main/java/com/bonus/digital/controller/DayPlanController.java b/bonus-business/src/main/java/com/bonus/digital/controller/DayPlanController.java index 855284f..5a1cfde 100644 --- a/bonus-business/src/main/java/com/bonus/digital/controller/DayPlanController.java +++ b/bonus-business/src/main/java/com/bonus/digital/controller/DayPlanController.java @@ -1,7 +1,5 @@ package com.bonus.digital.controller; -import com.bonus.business.controller.tool.MonthPlanExcelExporter; -import com.bonus.business.controller.tool.WorkloadAndCarSummaryExcelExporter; import com.bonus.business.controller.tool.WorkloadSummaryExcelExporter; import com.bonus.common.annotation.Log; import com.bonus.common.core.controller.BaseController; @@ -16,7 +14,6 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; @@ -72,8 +69,10 @@ public class DayPlanController extends BaseController { public AjaxResult addMonthlyPlan(@RequestBody List dayPlanVoList) { try { int res = dayPlanService.addMonthlyPlan(dayPlanVoList); - if (res > 0) { + if (res ==1) { return AjaxResult.success(); + } else if (res ==2) { + return AjaxResult.error("新增失败,计划已存在"); } else { return AjaxResult.error("新增失败"); } diff --git a/bonus-business/src/main/java/com/bonus/digital/controller/PersonnelController.java b/bonus-business/src/main/java/com/bonus/digital/controller/PersonnelController.java index c2d568b..8206547 100644 --- a/bonus-business/src/main/java/com/bonus/digital/controller/PersonnelController.java +++ b/bonus-business/src/main/java/com/bonus/digital/controller/PersonnelController.java @@ -3,16 +3,23 @@ package com.bonus.digital.controller; import com.bonus.common.core.controller.BaseController; import com.bonus.common.core.domain.AjaxResult; import com.bonus.common.core.page.TableDataInfo; -import com.bonus.digital.dao.InspectionStationVo; -import com.bonus.digital.dao.PersonnelClassificationVo; -import com.bonus.digital.dao.PersonnelVo; -import com.bonus.digital.dao.SelectDto; +import com.bonus.common.utils.poi.ExcelUtil; +import com.bonus.digital.dao.*; import com.bonus.digital.service.PersonnelService; +import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.apache.poi.util.IOUtils; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.InputStream; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.List; /** @@ -153,4 +160,55 @@ public class PersonnelController extends BaseController { } } + /** + * 导入计划管理 + */ + @PostMapping("/importPersonnel") + public AjaxResult importPersonnel(MultipartFile file) { + try { + ExcelUtil util = new ExcelUtil(PersonnelVo.class); + List planManagementList = util.importExcel(file.getInputStream()); + String message = personnelService.importPersonnel(planManagementList); + return success(message); + } catch (Exception e) { + log.error(e.getMessage()); + return AjaxResult.error("模板错误"); + } + } + + @ApiOperation("人员模板下载") + @PostMapping("/downloadPersonnelExcel") + public void downloadPersonnelExcel(HttpServletRequest request, HttpServletResponse response) { + InputStream inputStream = null; + ServletOutputStream servletOutputStream = null; + try { + String path = "download/" + "人员导入模板.xlsx"; + inputStream = this.getClass().getClassLoader().getResourceAsStream(path); + response.setContentType("application/vnd.ms-excel"); + response.addHeader("Cache-Control", "no-cache, no-store, must-revalidate"); + response.addHeader("charset", "utf-8"); + response.addHeader("Pragma", "no-cache"); + String encodeName = URLEncoder.encode("人员导入模板.xlsx", StandardCharsets.UTF_8.toString()); + response.setHeader("Content-Disposition", "attachment; filename=\"" + encodeName + "\"; filename*=utf-8''" + encodeName); + servletOutputStream = response.getOutputStream(); + IOUtils.copy(inputStream, servletOutputStream); + response.flushBuffer(); + log.info("文件下载成功!!"); + } catch (Exception e) { + log.error(e.getMessage()); + e.printStackTrace(); + } finally { + try { + if (servletOutputStream != null) { + servletOutputStream.close(); + } + if (inputStream != null) { + inputStream.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } diff --git a/bonus-business/src/main/java/com/bonus/digital/controller/PlanManagementController.java b/bonus-business/src/main/java/com/bonus/digital/controller/PlanManagementController.java index ee66f86..b3e6ad9 100644 --- a/bonus-business/src/main/java/com/bonus/digital/controller/PlanManagementController.java +++ b/bonus-business/src/main/java/com/bonus/digital/controller/PlanManagementController.java @@ -143,7 +143,7 @@ public class PlanManagementController extends BaseController { return success(message); } catch (Exception e) { log.error(e.getMessage()); - return AjaxResult.error("系统异常,请联系管理员"); + return AjaxResult.error("模板错误"); } } diff --git a/bonus-business/src/main/java/com/bonus/digital/dao/MonthlyPlanVo.java b/bonus-business/src/main/java/com/bonus/digital/dao/MonthlyPlanVo.java index 4ce63f1..7ca81fd 100644 --- a/bonus-business/src/main/java/com/bonus/digital/dao/MonthlyPlanVo.java +++ b/bonus-business/src/main/java/com/bonus/digital/dao/MonthlyPlanVo.java @@ -212,4 +212,15 @@ public class MonthlyPlanVo { */ private String nowDate; + + /** + * 结算单价(元) + */ + private int settlementUnitPrice; + + /** + * 结算合计(元) + */ + private Integer settlementTotalAmount; + } diff --git a/bonus-business/src/main/java/com/bonus/digital/dao/PersonnelVo.java b/bonus-business/src/main/java/com/bonus/digital/dao/PersonnelVo.java index 36c77d7..062f626 100644 --- a/bonus-business/src/main/java/com/bonus/digital/dao/PersonnelVo.java +++ b/bonus-business/src/main/java/com/bonus/digital/dao/PersonnelVo.java @@ -1,5 +1,6 @@ package com.bonus.digital.dao; +import com.bonus.common.annotation.Excel; import lombok.Data; import java.util.Date; @@ -26,23 +27,27 @@ public class PersonnelVo { /** * 单位名称 */ + @Excel(name = "人员所属") private String inspectionStationName; /** * 姓名 */ + @Excel(name = "姓名") private String name; /** * 性别 */ + @Excel(name = "性别") private String sex; /** * 电话 */ + @Excel(name = "电话") private String phone; /** @@ -53,6 +58,7 @@ public class PersonnelVo { /** * 岗位 */ + @Excel(name = "岗位") private String positionName; /** @@ -63,6 +69,7 @@ public class PersonnelVo { /** * 人员性质 */ + @Excel(name = "人员性质") private String personnelNatureName; /** @@ -73,6 +80,7 @@ public class PersonnelVo { /** * 人员分类 */ + @Excel(name = "人员分类") private String personnelClassificationName; /** diff --git a/bonus-business/src/main/java/com/bonus/digital/dao/PlanManagementVo.java b/bonus-business/src/main/java/com/bonus/digital/dao/PlanManagementVo.java index a347637..13a8103 100644 --- a/bonus-business/src/main/java/com/bonus/digital/dao/PlanManagementVo.java +++ b/bonus-business/src/main/java/com/bonus/digital/dao/PlanManagementVo.java @@ -1,6 +1,7 @@ package com.bonus.digital.dao; import com.bonus.common.annotation.Excel; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.util.Date; @@ -38,24 +39,24 @@ public class PlanManagementVo { /** * 实施部门 */ - @Excel(name = "实施部门") private Integer inspectionStationId; /** * 实施部门 */ + @Excel(name = "实施部门") private String inspectionStationName; /** * 计划开始时间 */ - @Excel(name = "计划开始时间") + @Excel(name = "计划开始时间",dateFormat ="yyyy-MM-dd" ) private String stareDate; /** * 计划结束时间 */ - @Excel(name = "计划结束时间") + @Excel(name = "计划结束时间" ,dateFormat ="yyyy-MM-dd") private String endDate; /** diff --git a/bonus-business/src/main/java/com/bonus/digital/dao/WorkloadCategoryVo.java b/bonus-business/src/main/java/com/bonus/digital/dao/WorkloadCategoryVo.java index e50c405..dfb2a95 100644 --- a/bonus-business/src/main/java/com/bonus/digital/dao/WorkloadCategoryVo.java +++ b/bonus-business/src/main/java/com/bonus/digital/dao/WorkloadCategoryVo.java @@ -52,7 +52,12 @@ public class WorkloadCategoryVo { private Date updateTime; /** - * 单价(元) + * 绩效单价(元) */ private int unitPrice; + + /** + * 结算单价(元) + */ + private int settlementUnitPrice; } diff --git a/bonus-business/src/main/java/com/bonus/digital/dao/WorkloadSummaryExcelVo.java b/bonus-business/src/main/java/com/bonus/digital/dao/WorkloadSummaryExcelVo.java index 0ff5b87..f3c5409 100644 --- a/bonus-business/src/main/java/com/bonus/digital/dao/WorkloadSummaryExcelVo.java +++ b/bonus-business/src/main/java/com/bonus/digital/dao/WorkloadSummaryExcelVo.java @@ -26,11 +26,19 @@ public class WorkloadSummaryExcelVo { @ColumnWidth(10) private Integer totalWorkload; - @ExcelProperty(value = "单价", index = 4) // E列 + @ExcelProperty(value = "绩效单价", index = 4) // E列 @ColumnWidth(10) private Integer unitPrice; - @ExcelProperty(value = "合计", index = 5) // F列 + @ExcelProperty(value = "结算单价", index = 5) // G列 + @ColumnWidth(10) + private Integer settlementUnitPrice; + + @ExcelProperty(value = "绩效合计", index = 6) // F列 @ColumnWidth(12) private Integer totalAmount; + + @ExcelProperty(value = "结算合计", index = 7) // H列 + @ColumnWidth(10) + private Integer settlementTotalAmount; } diff --git a/bonus-business/src/main/java/com/bonus/digital/dao/WorkloadVo.java b/bonus-business/src/main/java/com/bonus/digital/dao/WorkloadVo.java index 34c1dd8..ac7e537 100644 --- a/bonus-business/src/main/java/com/bonus/digital/dao/WorkloadVo.java +++ b/bonus-business/src/main/java/com/bonus/digital/dao/WorkloadVo.java @@ -43,4 +43,9 @@ public class WorkloadVo { * 数据来源:0月计划:1日计划 */ private String dataSource; + + /** + * 结算单价(元) + */ + private int settlementUnitPrice; } diff --git a/bonus-business/src/main/java/com/bonus/digital/service/PersonnelService.java b/bonus-business/src/main/java/com/bonus/digital/service/PersonnelService.java index c35793a..dc3988c 100644 --- a/bonus-business/src/main/java/com/bonus/digital/service/PersonnelService.java +++ b/bonus-business/src/main/java/com/bonus/digital/service/PersonnelService.java @@ -43,4 +43,6 @@ public interface PersonnelService { * @return */ List getPersonnelClassificationSelect(String category); + + String importPersonnel(List planManagementList); } diff --git a/bonus-business/src/main/java/com/bonus/digital/service/impl/DayPlanServiceImpl.java b/bonus-business/src/main/java/com/bonus/digital/service/impl/DayPlanServiceImpl.java index 7c2d3dc..9f17290 100644 --- a/bonus-business/src/main/java/com/bonus/digital/service/impl/DayPlanServiceImpl.java +++ b/bonus-business/src/main/java/com/bonus/digital/service/impl/DayPlanServiceImpl.java @@ -35,6 +35,11 @@ public class DayPlanServiceImpl implements DayPlanService { for (DayPlanVo dayPlanVo1 : dayPlanVo) { dayPlanVo1.setCreateUser(SecurityUtils.getUserId().toString()); dayPlanVo1.setCreateTime(new Date()); + //查看当前计划是否存在 + DayPlanVo res = dayPlanMapper.getDayPlanById(dayPlanVo1); + if (res != null) { + return 2; + } dayPlanMapper.addMonthlyPlan(dayPlanVo1); } return 1; @@ -57,6 +62,9 @@ public class DayPlanServiceImpl implements DayPlanService { //保存工作量信息 List workloadVoList = dayPlanVo.getWorkloadList(); if (workloadVoList != null && !workloadVoList.isEmpty()) { + MonthlyPlanVo monthlyPlanVo = new MonthlyPlanVo(); + monthlyPlanVo.setMonthlyPlanId(dayPlanVo.getMonthlyPlanId()); + monthlyPlanMapper.delWorkload(monthlyPlanVo); for (WorkloadVo w : workloadVoList) { w.setPlanId(dayPlanVo.getDayPlanId()); w.setDataSource("1"); diff --git a/bonus-business/src/main/java/com/bonus/digital/service/impl/MonthlyPlanServiceImpl.java b/bonus-business/src/main/java/com/bonus/digital/service/impl/MonthlyPlanServiceImpl.java index ece8694..69beab9 100644 --- a/bonus-business/src/main/java/com/bonus/digital/service/impl/MonthlyPlanServiceImpl.java +++ b/bonus-business/src/main/java/com/bonus/digital/service/impl/MonthlyPlanServiceImpl.java @@ -216,8 +216,10 @@ public class MonthlyPlanServiceImpl implements MonthlyPlanService { exportVo.setInspectionStationName(vo.getInspectionStationName()); // 运检站 exportVo.setWorkloadCategoryName(vo.getWorkloadCategoryName()); // 工作量类别 exportVo.setTotalWorkload(vo.getTotalWorkload()); // 总工作量 - exportVo.setUnitPrice(vo.getUnitPrice()); // 单价 - exportVo.setTotalAmount(vo.getTotalAmount()); // 合计金额 + exportVo.setUnitPrice(vo.getUnitPrice()/100); // 绩效单价 + exportVo.setTotalAmount(vo.getTotalAmount()/100); // 合计金额 + exportVo.setSettlementUnitPrice(vo.getSettlementUnitPrice()/100);// 结算单价 + exportVo.setSettlementTotalAmount(vo.getSettlementTotalAmount()/100);//结算合计 exportList.add(exportVo); } diff --git a/bonus-business/src/main/java/com/bonus/digital/service/impl/PersonnelServiceImpl.java b/bonus-business/src/main/java/com/bonus/digital/service/impl/PersonnelServiceImpl.java index 6e5101f..df618f2 100644 --- a/bonus-business/src/main/java/com/bonus/digital/service/impl/PersonnelServiceImpl.java +++ b/bonus-business/src/main/java/com/bonus/digital/service/impl/PersonnelServiceImpl.java @@ -3,12 +3,17 @@ package com.bonus.digital.service.impl; import com.bonus.common.utils.AesUtil; import com.bonus.common.utils.SecurityUtils; import com.bonus.common.utils.StringUtils; +import com.bonus.digital.dao.InspectionStationVo; +import com.bonus.digital.dao.PersonnelClassificationVo; import com.bonus.digital.dao.PersonnelVo; import com.bonus.digital.dao.SelectDto; +import com.bonus.digital.mapper.InspectionStationMapper; +import com.bonus.digital.mapper.PersonnelClassificationMapper; import com.bonus.digital.mapper.PersonnelMapper; import com.bonus.digital.service.PersonnelService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.Date; @@ -25,6 +30,11 @@ public class PersonnelServiceImpl implements PersonnelService { @Resource private PersonnelMapper personnelMapper; + @Resource + private InspectionStationMapper inspectionStationMapper; + + @Resource + private PersonnelClassificationMapper personnelClassificationMapper; /** * 获取人员管理列表 @@ -103,4 +113,34 @@ public class PersonnelServiceImpl implements PersonnelService { public List getPersonnelClassificationSelect(String category) { return personnelMapper.getPersonnelClassificationSelect(category); } + + @Override + @Transactional + public String importPersonnel(List planManagementList) { + for (PersonnelVo planManagement : planManagementList) { + //获取运检站信息 + InspectionStationVo inspectionStationVo = new InspectionStationVo(); + inspectionStationVo.setInspectionStationName(planManagement.getInspectionStationName()); + InspectionStationVo inspectionStationOld =inspectionStationMapper.getInspectionStationDetail(inspectionStationVo); + planManagement.setInspectionStationId(inspectionStationOld.getInspectionStationId()); + //人员分类 + PersonnelClassificationVo personnelClassificationVo = new PersonnelClassificationVo(); + personnelClassificationVo.setPersonnelClassificationName(planManagement.getPersonnelClassificationName()); + personnelClassificationVo.setCategory("0"); + PersonnelClassificationVo res = personnelClassificationMapper.getClassification(personnelClassificationVo); + planManagement.setPersonnelClassificationId(res.getPersonnelClassificationId()); + //人员性质 + personnelClassificationVo.setPersonnelClassificationName(planManagement.getPersonnelNatureName()); + personnelClassificationVo.setCategory("1"); + PersonnelClassificationVo res1 = personnelClassificationMapper.getClassification(personnelClassificationVo); + planManagement.setPersonnelNatureId(res1.getPersonnelClassificationId()); + //岗位 + personnelClassificationVo.setPersonnelClassificationName(planManagement.getPositionName()); + personnelClassificationVo.setCategory("2"); + PersonnelClassificationVo res2 = personnelClassificationMapper.getClassification(personnelClassificationVo); + planManagement.setPositionId(res2.getPersonnelClassificationId()); + addPersonnel(planManagement); + } + return "导入成功"; + } } diff --git a/bonus-business/src/main/java/com/bonus/digital/service/impl/PlanManagementServiceImpl.java b/bonus-business/src/main/java/com/bonus/digital/service/impl/PlanManagementServiceImpl.java index 873adf9..012af1c 100644 --- a/bonus-business/src/main/java/com/bonus/digital/service/impl/PlanManagementServiceImpl.java +++ b/bonus-business/src/main/java/com/bonus/digital/service/impl/PlanManagementServiceImpl.java @@ -88,12 +88,14 @@ public class PlanManagementServiceImpl implements PlanManagementService { //获取当前 InspectionStationVo inspectionStationVo = new InspectionStationVo(); inspectionStationVo.setInspectionStationName(planManagementVo.getInspectionStationName()); - inspectionStationVo =inspectionStationMapper.getInspectionStationDetail(inspectionStationVo); - planManagementVo.setInspectionStationId(inspectionStationVo.getInspectionStationId()); - Long userId = SecurityUtils.getUserId(); - planManagementVo.setCreateUser(userId.toString()); - planManagementVo.setCreateTime(new Date()); - planManagementMapper.addPlanManagement(planManagementVo); + InspectionStationVo inspectionStationOld =inspectionStationMapper.getInspectionStationDetail(inspectionStationVo); + if (inspectionStationOld!=null){ + planManagementVo.setInspectionStationId(inspectionStationOld.getInspectionStationId()); + Long userId = SecurityUtils.getUserId(); + planManagementVo.setCreateUser(userId.toString()); + planManagementVo.setCreateTime(new Date()); + planManagementMapper.addPlanManagement(planManagementVo); + } } return "导入成功"; } diff --git a/bonus-business/src/main/resources/download/人员导入模板.xlsx b/bonus-business/src/main/resources/download/人员导入模板.xlsx new file mode 100644 index 0000000..81431de Binary files /dev/null and b/bonus-business/src/main/resources/download/人员导入模板.xlsx differ diff --git a/bonus-business/src/main/resources/download/计划导入模板.xlsx b/bonus-business/src/main/resources/download/计划导入模板.xlsx index 592935d..81a9906 100644 Binary files a/bonus-business/src/main/resources/download/计划导入模板.xlsx and b/bonus-business/src/main/resources/download/计划导入模板.xlsx differ diff --git a/bonus-business/src/main/resources/mapper/DayPlanMapper.xml b/bonus-business/src/main/resources/mapper/DayPlanMapper.xml index e88e0e0..543fa68 100644 --- a/bonus-business/src/main/resources/mapper/DayPlanMapper.xml +++ b/bonus-business/src/main/resources/mapper/DayPlanMapper.xml @@ -193,6 +193,7 @@ tmp.inspection_station_name, tw.workload_category_name, IFNULL(tw.unit_price, 0) as unit_price, + IFNULL(tw.settlement_unit_price, 0) as s, IFNULL(SUM(tw.workload_num), 0) as total_workload, IFNULL(SUM(tw.workload_num), 0) * IFNULL(tw.unit_price, 0) as total_amount from tb_day_plan tdp @@ -257,7 +258,13 @@ tb_day_plan tdp left join tb_monthly_plan tmp on tdp.monthly_plan_id = tmp.monthly_plan_id left join tb_plan_major tpm on tmp.plan_major_id = tpm.plan_major_id - where day_plan_id = #{dayPlanId} + where tdp.day_plan_id = #{dayPlanId} and tdp.is_active = '1' + + AND tdp.day_plan = #{dayPlan} + + + AND tdp.monthly_plan_id = #{monthlyPlanId} + diff --git a/bonus-business/src/main/resources/mapper/MonthPlanMapper.xml b/bonus-business/src/main/resources/mapper/MonthPlanMapper.xml index a336bd3..a46ad8f 100644 --- a/bonus-business/src/main/resources/mapper/MonthPlanMapper.xml +++ b/bonus-business/src/main/resources/mapper/MonthPlanMapper.xml @@ -18,8 +18,8 @@ values (#{monthlyPlanId},#{day},#{personnelNames}) - insert into tb_workload (plan_id,workload_category_id,workload_category_name,unit_price,workload_num,data_source) - values (#{planId},#{workloadCategoryId},#{workloadCategoryName},#{unitPrice},#{workloadNum},#{dataSource}) + insert into tb_workload (plan_id,workload_category_id,workload_category_name,unit_price,workload_num,data_source,settlement_unit_price) + values (#{planId},#{workloadCategoryId},#{workloadCategoryName},#{unitPrice},#{workloadNum},#{dataSource},#{settlementUnitPrice}) update tb_monthly_plan @@ -192,8 +192,10 @@ tmp.inspection_station_name, tw.workload_category_name, IFNULL(tw.unit_price, 0) as unit_price, + IFNULL(tw.settlement_unit_price, 0) as settlementUnitPrice, IFNULL(SUM(tw.workload_num), 0) as total_workload, - IFNULL(SUM(tw.workload_num), 0) * IFNULL(tw.unit_price, 0) as total_amount + IFNULL(SUM(tw.workload_num), 0) * IFNULL(tw.unit_price, 0) as total_amount, + IFNULL(SUM(tw.workload_num), 0) * IFNULL(tw.settlement_unit_price, 0) as settlementTotalAmount from tb_monthly_plan tmp left join tb_workload tw on tw.plan_id = tmp.monthly_plan_id diff --git a/bonus-business/src/main/resources/mapper/WorkloadCategoryMapper.xml b/bonus-business/src/main/resources/mapper/WorkloadCategoryMapper.xml index dbf324b..8d4d42d 100644 --- a/bonus-business/src/main/resources/mapper/WorkloadCategoryMapper.xml +++ b/bonus-business/src/main/resources/mapper/WorkloadCategoryMapper.xml @@ -4,8 +4,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - insert into tb_workload_category (workload_category_name,remark,create_user,create_time,unit_price) - values (#{workloadCategoryName},#{remark},#{createUser},#{createTime},#{unitPrice}) + insert into tb_workload_category (workload_category_name,remark,create_user,create_time,unit_price,settlement_unit_price) + values (#{workloadCategoryName},#{remark},#{createUser},#{createTime},#{unitPrice},#{settlementUnitPrice}) update tb_workload_category @@ -25,6 +25,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_time=#{updateTime}, + + settlement_unit_price=#{settlementUnitPrice}, + where workload_category_id = #{workloadCategoryId} @@ -33,18 +36,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"