bug修复,需求优化

This commit is contained in:
马三炮 2026-01-12 14:02:43 +08:00
parent 5fca926170
commit 069d321dc9
20 changed files with 236 additions and 66 deletions

View File

@ -24,12 +24,12 @@ import java.util.List;
public class WorkloadAndCarSummaryExcelExporter { 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_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_G = 6, COL_H = 7, COL_I = 8, COL_J = 9, COL_K = 10; 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[] 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_H, COL_I, COL_J, COL_K}; // 用车标题列H-K private static final int[] CAR_TITLE_COLS = {COL_J, COL_K,COL_L, COL_M}; // 用车标题列H-K
/** /**
* 导出方法纯POI手动构建所有内容 * 导出方法纯POI手动构建所有内容
@ -206,7 +206,7 @@ public class WorkloadAndCarSummaryExcelExporter {
Cell cell = row0.createCell(col); Cell cell = row0.createCell(col);
cell.setCellStyle(titleStyle); cell.setCellStyle(titleStyle);
} }
Cell carTitle = row0.getCell(COL_H); Cell carTitle = row0.getCell(COL_J);
carTitle.setCellValue(monthOnly + "月份用车清单"); carTitle.setCellValue(monthOnly + "月份用车清单");
// ========== 行1二级表头 ========== // ========== 行1二级表头 ==========
@ -216,13 +216,15 @@ public class WorkloadAndCarSummaryExcelExporter {
createCell(row1, COL_B, "运检站", headerStyle); createCell(row1, COL_B, "运检站", headerStyle);
createCell(row1, COL_C, "工作量类型", headerStyle); createCell(row1, COL_C, "工作量类型", headerStyle);
createCell(row1, COL_D, "工作量", headerStyle); createCell(row1, COL_D, "工作量", headerStyle);
createCell(row1, COL_E, "单价", headerStyle); createCell(row1, COL_E, "绩效单价", headerStyle);
createCell(row1, COL_F, "合计", headerStyle); createCell(row1, COL_F, "结算单价", headerStyle);
createCell(row1, COL_G, "绩效合计", headerStyle);
createCell(row1, COL_H, "结算合计", headerStyle);
// 用车表头 // 用车表头
createCell(row1, COL_H, "序号", headerStyle); createCell(row1, COL_J, "序号", headerStyle);
createCell(row1, COL_I, "运检站", headerStyle); createCell(row1, COL_K, "运检站", headerStyle);
createCell(row1, COL_J, "管理用车天数", headerStyle); createCell(row1, COL_L, "管理用车天数", headerStyle);
createCell(row1, COL_K, "分包用车天数", 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_C, workloadVo.getWorkloadCategoryName() == null ? "" : workloadVo.getWorkloadCategoryName(), contentStyle);
createCell(row, COL_D, workloadVo.getTotalWorkload() == null ? 0 : workloadVo.getTotalWorkload(), 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_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时置空 // 填充用车数据核心修改序号为0时置空
CarUseSummaryExcelVo carVo = i < carData.size() ? carData.get(i) : new CarUseSummaryExcelVo(); CarUseSummaryExcelVo carVo = i < carData.size() ? carData.get(i) : new CarUseSummaryExcelVo();
Integer carSerialNum = carVo.getSerialNumber(); Integer carSerialNum = carVo.getSerialNumber();
// 序号为0或null时置空否则填实际值 // 序号为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) { if (carSerialNum == null || carSerialNum == 0) {
createCell(row, COL_J, "", contentStyle); createCell(row, COL_J, "", contentStyle);
} else { } 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 // 分包用车天数序号为0/null时置空否则填实际值无值则0
if (carSerialNum == null || carSerialNum == 0) { if (carSerialNum == null || carSerialNum == 0) {
createCell(row, COL_K, "", contentStyle); createCell(row, COL_M, "", contentStyle);
} else { } 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); createCell(totalRow, COL_A, "合计", totalStyle);
int workloadTotal = 0; int workloadTotal = 0;
int settlementWorkloadTotal = 0;
for (WorkloadSummaryExcelVo vo : workloadData) { for (WorkloadSummaryExcelVo vo : workloadData) {
if (vo != null && vo.getTotalAmount() != null) { if (vo != null && vo.getTotalAmount() != null) {
workloadTotal += vo.getTotalAmount(); 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 manageCarTotal = 0;
int subCarTotal = 0; int subCarTotal = 0;
for (CarUseSummaryExcelVo vo : carData) { for (CarUseSummaryExcelVo vo : carData) {
@ -310,15 +318,16 @@ public class WorkloadAndCarSummaryExcelExporter {
} }
} }
// 确保J列管理用车天数合计和K列分包用车天数合计正常赋值 // 确保J列管理用车天数合计和K列分包用车天数合计正常赋值
createCell(totalRow, COL_J, manageCarTotal, totalStyle); createCell(totalRow, COL_L, manageCarTotal, totalStyle);
createCell(totalRow, COL_K, subCarTotal, totalStyle); createCell(totalRow, COL_M, subCarTotal, totalStyle);
// 合计行其他单元格填充空值+样式 // 合计行其他单元格填充空值+样式
createCell(totalRow, COL_B, "", totalStyle); createCell(totalRow, COL_B, "", totalStyle);
createCell(totalRow, COL_C, "", totalStyle); createCell(totalRow, COL_C, "", totalStyle);
createCell(totalRow, COL_D, "", totalStyle); createCell(totalRow, COL_D, "", totalStyle);
createCell(totalRow, COL_E, "", 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) { 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_A, COL_H));
sheet.addMergedRegion(new CellRangeAddress(0, 0, COL_H, COL_K)); 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列的合计值正常显示 // 核心修改用车合计行仅合并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) { 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) { for (int col : cols) {
sheet.autoSizeColumn(col); sheet.autoSizeColumn(col);
// 手动调整列宽避免自适应过窄 // 手动调整列宽避免自适应过窄

View File

@ -1,7 +1,5 @@
package com.bonus.digital.controller; 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.business.controller.tool.WorkloadSummaryExcelExporter;
import com.bonus.common.annotation.Log; import com.bonus.common.annotation.Log;
import com.bonus.common.core.controller.BaseController; import com.bonus.common.core.controller.BaseController;
@ -16,7 +14,6 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException; import java.time.format.DateTimeParseException;
@ -72,8 +69,10 @@ public class DayPlanController extends BaseController {
public AjaxResult addMonthlyPlan(@RequestBody List<DayPlanVo> dayPlanVoList) { public AjaxResult addMonthlyPlan(@RequestBody List<DayPlanVo> dayPlanVoList) {
try { try {
int res = dayPlanService.addMonthlyPlan(dayPlanVoList); int res = dayPlanService.addMonthlyPlan(dayPlanVoList);
if (res > 0) { if (res ==1) {
return AjaxResult.success(); return AjaxResult.success();
} else if (res ==2) {
return AjaxResult.error("新增失败,计划已存在");
} else { } else {
return AjaxResult.error("新增失败"); return AjaxResult.error("新增失败");
} }

View File

@ -3,16 +3,23 @@ package com.bonus.digital.controller;
import com.bonus.common.core.controller.BaseController; import com.bonus.common.core.controller.BaseController;
import com.bonus.common.core.domain.AjaxResult; import com.bonus.common.core.domain.AjaxResult;
import com.bonus.common.core.page.TableDataInfo; import com.bonus.common.core.page.TableDataInfo;
import com.bonus.digital.dao.InspectionStationVo; import com.bonus.common.utils.poi.ExcelUtil;
import com.bonus.digital.dao.PersonnelClassificationVo; import com.bonus.digital.dao.*;
import com.bonus.digital.dao.PersonnelVo;
import com.bonus.digital.dao.SelectDto;
import com.bonus.digital.service.PersonnelService; import com.bonus.digital.service.PersonnelService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.util.IOUtils;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; 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; import java.util.List;
/** /**
@ -153,4 +160,55 @@ public class PersonnelController extends BaseController {
} }
} }
/**
* 导入计划管理
*/
@PostMapping("/importPersonnel")
public AjaxResult importPersonnel(MultipartFile file) {
try {
ExcelUtil<PersonnelVo> util = new ExcelUtil<PersonnelVo>(PersonnelVo.class);
List<PersonnelVo> 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();
}
}
}
} }

View File

@ -143,7 +143,7 @@ public class PlanManagementController extends BaseController {
return success(message); return success(message);
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage()); log.error(e.getMessage());
return AjaxResult.error("系统异常,请联系管理员"); return AjaxResult.error("模板错误");
} }
} }

View File

@ -212,4 +212,15 @@ public class MonthlyPlanVo {
*/ */
private String nowDate; private String nowDate;
/**
* 结算单价
*/
private int settlementUnitPrice;
/**
* 结算合计
*/
private Integer settlementTotalAmount;
} }

View File

@ -1,5 +1,6 @@
package com.bonus.digital.dao; package com.bonus.digital.dao;
import com.bonus.common.annotation.Excel;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
@ -26,23 +27,27 @@ public class PersonnelVo {
/** /**
* 单位名称 * 单位名称
*/ */
@Excel(name = "人员所属")
private String inspectionStationName; private String inspectionStationName;
/** /**
* 姓名 * 姓名
*/ */
@Excel(name = "姓名")
private String name; private String name;
/** /**
* 性别 * 性别
*/ */
@Excel(name = "性别")
private String sex; private String sex;
/** /**
* 电话 * 电话
*/ */
@Excel(name = "电话")
private String phone; private String phone;
/** /**
@ -53,6 +58,7 @@ public class PersonnelVo {
/** /**
* 岗位 * 岗位
*/ */
@Excel(name = "岗位")
private String positionName; private String positionName;
/** /**
@ -63,6 +69,7 @@ public class PersonnelVo {
/** /**
* 人员性质 * 人员性质
*/ */
@Excel(name = "人员性质")
private String personnelNatureName; private String personnelNatureName;
/** /**
@ -73,6 +80,7 @@ public class PersonnelVo {
/** /**
* 人员分类 * 人员分类
*/ */
@Excel(name = "人员分类")
private String personnelClassificationName; private String personnelClassificationName;
/** /**

View File

@ -1,6 +1,7 @@
package com.bonus.digital.dao; package com.bonus.digital.dao;
import com.bonus.common.annotation.Excel; import com.bonus.common.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
@ -38,24 +39,24 @@ public class PlanManagementVo {
/** /**
* 实施部门 * 实施部门
*/ */
@Excel(name = "实施部门")
private Integer inspectionStationId; private Integer inspectionStationId;
/** /**
* 实施部门 * 实施部门
*/ */
@Excel(name = "实施部门")
private String inspectionStationName; private String inspectionStationName;
/** /**
* 计划开始时间 * 计划开始时间
*/ */
@Excel(name = "计划开始时间") @Excel(name = "计划开始时间",dateFormat ="yyyy-MM-dd" )
private String stareDate; private String stareDate;
/** /**
* 计划结束时间 * 计划结束时间
*/ */
@Excel(name = "计划结束时间") @Excel(name = "计划结束时间" ,dateFormat ="yyyy-MM-dd")
private String endDate; private String endDate;
/** /**

View File

@ -52,7 +52,12 @@ public class WorkloadCategoryVo {
private Date updateTime; private Date updateTime;
/** /**
* 单价 * 绩效单价
*/ */
private int unitPrice; private int unitPrice;
/**
* 结算单价
*/
private int settlementUnitPrice;
} }

View File

@ -26,11 +26,19 @@ public class WorkloadSummaryExcelVo {
@ColumnWidth(10) @ColumnWidth(10)
private Integer totalWorkload; private Integer totalWorkload;
@ExcelProperty(value = "单价", index = 4) // E列 @ExcelProperty(value = "绩效单价", index = 4) // E列
@ColumnWidth(10) @ColumnWidth(10)
private Integer unitPrice; 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) @ColumnWidth(12)
private Integer totalAmount; private Integer totalAmount;
@ExcelProperty(value = "结算合计", index = 7) // H列
@ColumnWidth(10)
private Integer settlementTotalAmount;
} }

View File

@ -43,4 +43,9 @@ public class WorkloadVo {
* 数据来源0月计划1日计划 * 数据来源0月计划1日计划
*/ */
private String dataSource; private String dataSource;
/**
* 结算单价
*/
private int settlementUnitPrice;
} }

View File

@ -43,4 +43,6 @@ public interface PersonnelService {
* @return * @return
*/ */
List<SelectDto> getPersonnelClassificationSelect(String category); List<SelectDto> getPersonnelClassificationSelect(String category);
String importPersonnel(List<PersonnelVo> planManagementList);
} }

View File

@ -35,6 +35,11 @@ public class DayPlanServiceImpl implements DayPlanService {
for (DayPlanVo dayPlanVo1 : dayPlanVo) { for (DayPlanVo dayPlanVo1 : dayPlanVo) {
dayPlanVo1.setCreateUser(SecurityUtils.getUserId().toString()); dayPlanVo1.setCreateUser(SecurityUtils.getUserId().toString());
dayPlanVo1.setCreateTime(new Date()); dayPlanVo1.setCreateTime(new Date());
//查看当前计划是否存在
DayPlanVo res = dayPlanMapper.getDayPlanById(dayPlanVo1);
if (res != null) {
return 2;
}
dayPlanMapper.addMonthlyPlan(dayPlanVo1); dayPlanMapper.addMonthlyPlan(dayPlanVo1);
} }
return 1; return 1;
@ -57,6 +62,9 @@ public class DayPlanServiceImpl implements DayPlanService {
//保存工作量信息 //保存工作量信息
List<WorkloadVo> workloadVoList = dayPlanVo.getWorkloadList(); List<WorkloadVo> workloadVoList = dayPlanVo.getWorkloadList();
if (workloadVoList != null && !workloadVoList.isEmpty()) { if (workloadVoList != null && !workloadVoList.isEmpty()) {
MonthlyPlanVo monthlyPlanVo = new MonthlyPlanVo();
monthlyPlanVo.setMonthlyPlanId(dayPlanVo.getMonthlyPlanId());
monthlyPlanMapper.delWorkload(monthlyPlanVo);
for (WorkloadVo w : workloadVoList) { for (WorkloadVo w : workloadVoList) {
w.setPlanId(dayPlanVo.getDayPlanId()); w.setPlanId(dayPlanVo.getDayPlanId());
w.setDataSource("1"); w.setDataSource("1");

View File

@ -216,8 +216,10 @@ public class MonthlyPlanServiceImpl implements MonthlyPlanService {
exportVo.setInspectionStationName(vo.getInspectionStationName()); // 运检站 exportVo.setInspectionStationName(vo.getInspectionStationName()); // 运检站
exportVo.setWorkloadCategoryName(vo.getWorkloadCategoryName()); // 工作量类别 exportVo.setWorkloadCategoryName(vo.getWorkloadCategoryName()); // 工作量类别
exportVo.setTotalWorkload(vo.getTotalWorkload()); // 总工作量 exportVo.setTotalWorkload(vo.getTotalWorkload()); // 总工作量
exportVo.setUnitPrice(vo.getUnitPrice()); // 单价 exportVo.setUnitPrice(vo.getUnitPrice()/100); // 绩效单价
exportVo.setTotalAmount(vo.getTotalAmount()); // 合计金额 exportVo.setTotalAmount(vo.getTotalAmount()/100); // 合计金额
exportVo.setSettlementUnitPrice(vo.getSettlementUnitPrice()/100);// 结算单价
exportVo.setSettlementTotalAmount(vo.getSettlementTotalAmount()/100);//结算合计
exportList.add(exportVo); exportList.add(exportVo);
} }

View File

@ -3,12 +3,17 @@ package com.bonus.digital.service.impl;
import com.bonus.common.utils.AesUtil; import com.bonus.common.utils.AesUtil;
import com.bonus.common.utils.SecurityUtils; import com.bonus.common.utils.SecurityUtils;
import com.bonus.common.utils.StringUtils; 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.PersonnelVo;
import com.bonus.digital.dao.SelectDto; 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.mapper.PersonnelMapper;
import com.bonus.digital.service.PersonnelService; import com.bonus.digital.service.PersonnelService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date; import java.util.Date;
@ -25,6 +30,11 @@ public class PersonnelServiceImpl implements PersonnelService {
@Resource @Resource
private PersonnelMapper personnelMapper; private PersonnelMapper personnelMapper;
@Resource
private InspectionStationMapper inspectionStationMapper;
@Resource
private PersonnelClassificationMapper personnelClassificationMapper;
/** /**
* 获取人员管理列表 * 获取人员管理列表
@ -103,4 +113,34 @@ public class PersonnelServiceImpl implements PersonnelService {
public List<SelectDto> getPersonnelClassificationSelect(String category) { public List<SelectDto> getPersonnelClassificationSelect(String category) {
return personnelMapper.getPersonnelClassificationSelect(category); return personnelMapper.getPersonnelClassificationSelect(category);
} }
@Override
@Transactional
public String importPersonnel(List<PersonnelVo> 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 "导入成功";
}
} }

View File

@ -88,12 +88,14 @@ public class PlanManagementServiceImpl implements PlanManagementService {
//获取当前 //获取当前
InspectionStationVo inspectionStationVo = new InspectionStationVo(); InspectionStationVo inspectionStationVo = new InspectionStationVo();
inspectionStationVo.setInspectionStationName(planManagementVo.getInspectionStationName()); inspectionStationVo.setInspectionStationName(planManagementVo.getInspectionStationName());
inspectionStationVo =inspectionStationMapper.getInspectionStationDetail(inspectionStationVo); InspectionStationVo inspectionStationOld =inspectionStationMapper.getInspectionStationDetail(inspectionStationVo);
planManagementVo.setInspectionStationId(inspectionStationVo.getInspectionStationId()); if (inspectionStationOld!=null){
Long userId = SecurityUtils.getUserId(); planManagementVo.setInspectionStationId(inspectionStationOld.getInspectionStationId());
planManagementVo.setCreateUser(userId.toString()); Long userId = SecurityUtils.getUserId();
planManagementVo.setCreateTime(new Date()); planManagementVo.setCreateUser(userId.toString());
planManagementMapper.addPlanManagement(planManagementVo); planManagementVo.setCreateTime(new Date());
planManagementMapper.addPlanManagement(planManagementVo);
}
} }
return "导入成功"; return "导入成功";
} }

View File

@ -193,6 +193,7 @@
tmp.inspection_station_name, tmp.inspection_station_name,
tw.workload_category_name, tw.workload_category_name,
IFNULL(tw.unit_price, 0) as unit_price, 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) 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
from tb_day_plan tdp from tb_day_plan tdp
@ -257,7 +258,13 @@
tb_day_plan tdp tb_day_plan tdp
left join tb_monthly_plan tmp on tdp.monthly_plan_id = tmp.monthly_plan_id 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 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'
<if test="dayPlan!= null " >
AND tdp.day_plan = #{dayPlan}
</if>
<if test="monthlyPlanId!= null " >
AND tdp.monthly_plan_id = #{monthlyPlanId}
</if>
</select> </select>
</mapper> </mapper>

View File

@ -18,8 +18,8 @@
values (#{monthlyPlanId},#{day},#{personnelNames}) values (#{monthlyPlanId},#{day},#{personnelNames})
</insert> </insert>
<insert id="addWorkload"> <insert id="addWorkload">
insert into tb_workload (plan_id,workload_category_id,workload_category_name,unit_price,workload_num,data_source) 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}) values (#{planId},#{workloadCategoryId},#{workloadCategoryName},#{unitPrice},#{workloadNum},#{dataSource},#{settlementUnitPrice})
</insert> </insert>
<update id="updateMonthlyPlan"> <update id="updateMonthlyPlan">
update tb_monthly_plan update tb_monthly_plan
@ -192,8 +192,10 @@
tmp.inspection_station_name, tmp.inspection_station_name,
tw.workload_category_name, tw.workload_category_name,
IFNULL(tw.unit_price, 0) as unit_price, 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) 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 from tb_monthly_plan tmp
left join tb_workload tw left join tb_workload tw
on tw.plan_id = tmp.monthly_plan_id on tw.plan_id = tmp.monthly_plan_id

View File

@ -4,8 +4,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.digital.mapper.WorkloadCategoryMapper"> <mapper namespace="com.bonus.digital.mapper.WorkloadCategoryMapper">
<insert id="addWorkloadCategory"> <insert id="addWorkloadCategory">
insert into tb_workload_category (workload_category_name,remark,create_user,create_time,unit_price) insert into tb_workload_category (workload_category_name,remark,create_user,create_time,unit_price,settlement_unit_price)
values (#{workloadCategoryName},#{remark},#{createUser},#{createTime},#{unitPrice}) values (#{workloadCategoryName},#{remark},#{createUser},#{createTime},#{unitPrice},#{settlementUnitPrice})
</insert> </insert>
<update id="updateWorkloadCategory"> <update id="updateWorkloadCategory">
update tb_workload_category update tb_workload_category
@ -25,6 +25,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime!= null " > <if test="updateTime!= null " >
update_time=#{updateTime}, update_time=#{updateTime},
</if> </if>
<if test="settlementUnitPrice!= null " >
settlement_unit_price=#{settlementUnitPrice},
</if>
</trim> </trim>
where workload_category_id = #{workloadCategoryId} where workload_category_id = #{workloadCategoryId}
</update> </update>
@ -33,18 +36,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<select id="getWorkloadCategoryList" resultType="com.bonus.digital.dao.WorkloadCategoryVo"> <select id="getWorkloadCategoryList" resultType="com.bonus.digital.dao.WorkloadCategoryVo">
select workload_category_id,workload_category_name,remark,unit_price select workload_category_id,workload_category_name,remark,unit_price,settlement_unit_price
from tb_workload_category where is_active = '1' from tb_workload_category where is_active = '1'
<if test="workloadCategoryName !=null and workloadCategoryName != ''"> <if test="workloadCategoryName !=null and workloadCategoryName != ''">
and workload_category_name like concat('%',#{workloadCategoryName},'%') and workload_category_name like concat('%',#{workloadCategoryName},'%')
</if> </if>
</select> </select>
<select id="getWorkloadList" resultType="com.bonus.digital.dao.WorkloadVo"> <select id="getWorkloadList" resultType="com.bonus.digital.dao.WorkloadVo">
select workload_id,plan_id,workload_category_id,workload_category_name,unit_price,workload_num,data_source select workload_id,plan_id,workload_category_id,workload_category_name,unit_price,workload_num,data_source,settlement_unit_price
from tb_workload where plan_id = #{planId} and data_source = #{dataSource} from tb_workload where plan_id = #{planId} and data_source = #{dataSource}
</select> </select>
<select id="getWorkloadCategoryByName" resultType="com.bonus.digital.dao.WorkloadCategoryVo"> <select id="getWorkloadCategoryByName" resultType="com.bonus.digital.dao.WorkloadCategoryVo">
select workload_category_id,workload_category_name,remark,unit_price select workload_category_id,workload_category_name,remark,unit_price,settlement_unit_price
from tb_workload_category where is_active = '1' and workload_category_name = #{workloadCategoryName} from tb_workload_category where is_active = '1' and workload_category_name = #{workloadCategoryName}
</select> </select>