代码提交
This commit is contained in:
parent
399149c347
commit
0933d1106b
|
|
@ -0,0 +1,112 @@
|
|||
package com.bonus.business.controller.tool;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
|
||||
import com.bonus.digital.dao.ExportMonthPlanPersonVo;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
public class MonthPlanExcelExporter {
|
||||
|
||||
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
/**
|
||||
* 将原始数据转换为按日期展开的 Map 列表(用于 EasyExcel 导出)
|
||||
*
|
||||
* @param dataList 原始数据列表
|
||||
* @param year 年份,如 2025
|
||||
* @param month 月份,如 10
|
||||
* @return List<Map<String, Object>> 用于 EasyExcel writeMap
|
||||
*/
|
||||
public static List<Map<String, Object>> convertToDailyMapList(
|
||||
List<ExportMonthPlanPersonVo> dataList, int year, int month) {
|
||||
|
||||
// 获取该月最大天数
|
||||
int daysInMonth = LocalDate.of(year, month, 1).lengthOfMonth();
|
||||
|
||||
// 构建表头顺序(固定列 + 动态日期列)
|
||||
List<String> headers = Arrays.asList(
|
||||
"运检站", "姓名", "性别", "岗位", "人员性质", "分类"
|
||||
);
|
||||
List<String> dateHeaders = new ArrayList<>();
|
||||
for (int d = 1; d <= daysInMonth; d++) {
|
||||
dateHeaders.add(d + "日");
|
||||
}
|
||||
|
||||
// 按 (运检站 + 姓名) 分组
|
||||
Map<String, Map<String, Object>> rowMap = new LinkedHashMap<>();
|
||||
|
||||
for (ExportMonthPlanPersonVo item : dataList) {
|
||||
String key = item.getInspectionStationName() + "_" + item.getName();
|
||||
|
||||
// 初始化行数据
|
||||
rowMap.computeIfAbsent(key, k -> {
|
||||
Map<String, Object> row = new LinkedHashMap<>();
|
||||
row.put("运检站", item.getInspectionStationName());
|
||||
row.put("姓名", item.getName());
|
||||
row.put("性别", item.getSex());
|
||||
row.put("岗位", item.getPositionName());
|
||||
row.put("人员性质", item.getPersonnelNatureName());
|
||||
row.put("分类", item.getPersonnelClassificationName());
|
||||
|
||||
// 初始化所有日期列为 ""
|
||||
for (String dh : dateHeaders) {
|
||||
row.put(dh, "");
|
||||
}
|
||||
return row;
|
||||
});
|
||||
|
||||
// 解析日期范围
|
||||
LocalDate start = LocalDate.parse(item.getPlannedStartTime(), DATE_FORMATTER);
|
||||
LocalDate end = LocalDate.parse(item.getPlannedEndTime(), DATE_FORMATTER);
|
||||
|
||||
// 遍历每一天
|
||||
for (LocalDate date = start; !date.isAfter(end); date = date.plusDays(1)) {
|
||||
if (date.getYear() == year && date.getMonthValue() == month) {
|
||||
int day = date.getDayOfMonth();
|
||||
String dateKey = day + "日";
|
||||
String currentContent = (String) rowMap.get(key).get(dateKey);
|
||||
String newContent = item.getWorkContent();
|
||||
|
||||
// 如果当天已有内容,用换行拼接
|
||||
if (currentContent == null || currentContent.trim().isEmpty()) {
|
||||
rowMap.get(key).put(dateKey, newContent);
|
||||
} else {
|
||||
rowMap.get(key).put(dateKey, currentContent + "\n" + newContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new ArrayList<>(rowMap.values());
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出 Excel 到 HttpServletResponse(Web 场景)
|
||||
*/
|
||||
public static void exportToExcel(HttpServletResponse response,
|
||||
List<ExportMonthPlanPersonVo> dataList,
|
||||
int year, int month,
|
||||
String sheetName) throws IOException {
|
||||
|
||||
List<Map<String, Object>> mapList = convertToDailyMapList(dataList, year, month);
|
||||
|
||||
// 设置响应头
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
String fileName = URLEncoder.encode(sheetName, "UTF-8");
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
|
||||
|
||||
// 使用 EasyExcel 导出
|
||||
EasyExcel.write(response.getOutputStream())
|
||||
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
|
||||
.autoCloseStream(true)
|
||||
.sheet(sheetName)
|
||||
.doWrite(mapList);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
package com.bonus.digital.controller;
|
||||
|
||||
import com.bonus.business.controller.tool.MonthPlanExcelExporter;
|
||||
import com.bonus.common.annotation.Log;
|
||||
import com.bonus.common.core.controller.BaseController;
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.common.core.page.TableDataInfo;
|
||||
import com.bonus.common.enums.BusinessType;
|
||||
import com.bonus.digital.dao.ExportMonthPlanPersonVo;
|
||||
import com.bonus.digital.dao.MonthlyPlanVo;
|
||||
import com.bonus.digital.service.MonthlyPlanService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
* @date 2025/12/16
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/monthlyPlan")
|
||||
public class DayPlanController extends BaseController {
|
||||
|
||||
@Resource
|
||||
private MonthlyPlanService monthlyPlanService;
|
||||
|
||||
/**
|
||||
* 月计划列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monthly:plan:list')")
|
||||
@GetMapping("/getMonthlyPlanList")
|
||||
public TableDataInfo getMonthlyPlanList(MonthlyPlanVo monthlyPlanVo) {
|
||||
try {
|
||||
startPage();
|
||||
List<MonthlyPlanVo> list = monthlyPlanService.getPlanMajorList(monthlyPlanVo);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
return getDataTable(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增月计划
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monthly:plan:add')")
|
||||
@PostMapping("/addMonthlyPlan")
|
||||
public AjaxResult addMonthlyPlan(MonthlyPlanVo monthlyPlanVo) {
|
||||
try {
|
||||
int res = monthlyPlanService.addMonthlyPlanList(monthlyPlanVo);
|
||||
if (res > 0) {
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
return AjaxResult.error("新增失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("系统异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除月计划
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monthly:plan:del')")
|
||||
@PostMapping("/delMonthlyPlan")
|
||||
public AjaxResult delMonthlyPlan(MonthlyPlanVo monthlyPlanVo) {
|
||||
try {
|
||||
int res = monthlyPlanService.delMonthlyPlanList(monthlyPlanVo);
|
||||
if (res > 0) {
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
return AjaxResult.error("删除失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("系统异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改月计划
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monthly:plan:update')")
|
||||
@PostMapping("/updateMonthlyPlan")
|
||||
public AjaxResult updateMonthlyPlan(MonthlyPlanVo monthlyPlanVo) {
|
||||
try {
|
||||
int res = monthlyPlanService.updateMonthlyPlan(monthlyPlanVo);
|
||||
if (res > 0) {
|
||||
return AjaxResult.success();
|
||||
} else {
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("系统异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
@Log(title = "导出人员安排表", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('monthly:plan:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MonthlyPlanVo monthlyPlanVo) throws IOException {
|
||||
List<ExportMonthPlanPersonVo> list = monthlyPlanService.exportMonthlyPlanPerson(monthlyPlanVo);
|
||||
MonthPlanExcelExporter.exportToExcel(response, list, 2025, 10, "10月运检人员安排");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,13 @@
|
|||
package com.bonus.digital.controller;
|
||||
|
||||
import com.bonus.business.controller.tool.MonthPlanExcelExporter;
|
||||
import com.bonus.common.annotation.Log;
|
||||
import com.bonus.common.core.controller.BaseController;
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.common.core.page.TableDataInfo;
|
||||
import com.bonus.common.enums.BusinessType;
|
||||
import com.bonus.digital.dao.MonthlyPlanVo;
|
||||
import com.bonus.digital.dao.ExportMonthPlanPersonVo;
|
||||
import com.bonus.digital.service.MonthlyPlanService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
|
@ -13,7 +17,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
|
|
@ -28,18 +35,30 @@ public class MonthlyPlanController extends BaseController {
|
|||
private MonthlyPlanService monthlyPlanService;
|
||||
|
||||
/**
|
||||
* 月计划列表
|
||||
* 月计划列表(带分页)
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monthly:plan:list')")
|
||||
@GetMapping("/getMonthlyPlanList")
|
||||
public TableDataInfo getMonthlyPlanList(MonthlyPlanVo monthlyPlanVo)
|
||||
{
|
||||
public TableDataInfo getMonthlyPlanList(MonthlyPlanVo monthlyPlanVo) {
|
||||
try {
|
||||
startPage();
|
||||
List<MonthlyPlanVo> list = monthlyPlanService.getPlanMajorList(monthlyPlanVo);
|
||||
return getDataTable(list);
|
||||
}catch (Exception e) {
|
||||
return getDataTable(null);
|
||||
} catch (Exception e) {
|
||||
return getDataTable(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 月计划列表(不带分页)
|
||||
*/
|
||||
@GetMapping("/getMonthlyPlanLists")
|
||||
public AjaxResult getMonthlyPlanLists(MonthlyPlanVo monthlyPlanVo) {
|
||||
try {
|
||||
List<MonthlyPlanVo> list = monthlyPlanService.getPlanMajorList(monthlyPlanVo);
|
||||
return AjaxResult.success(list);
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("请求错误");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -48,17 +67,16 @@ public class MonthlyPlanController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monthly:plan:add')")
|
||||
@PostMapping("/addMonthlyPlan")
|
||||
public AjaxResult addMonthlyPlan(MonthlyPlanVo monthlyPlanVo)
|
||||
{
|
||||
public AjaxResult addMonthlyPlan(MonthlyPlanVo monthlyPlanVo) {
|
||||
try {
|
||||
int res = monthlyPlanService.addMonthlyPlanList(monthlyPlanVo);
|
||||
int res = monthlyPlanService.addMonthlyPlanList(monthlyPlanVo);
|
||||
if (res > 0) {
|
||||
return AjaxResult.success();
|
||||
}else {
|
||||
} else {
|
||||
return AjaxResult.error("新增失败");
|
||||
}
|
||||
}catch (Exception e) {
|
||||
return AjaxResult.error("系统异常,请联系管理员");
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("系统异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -67,17 +85,16 @@ public class MonthlyPlanController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monthly:plan:del')")
|
||||
@PostMapping("/delMonthlyPlan")
|
||||
public AjaxResult delMonthlyPlan(MonthlyPlanVo monthlyPlanVo)
|
||||
{
|
||||
public AjaxResult delMonthlyPlan(MonthlyPlanVo monthlyPlanVo) {
|
||||
try {
|
||||
int res = monthlyPlanService.delMonthlyPlanList(monthlyPlanVo);
|
||||
int res = monthlyPlanService.delMonthlyPlanList(monthlyPlanVo);
|
||||
if (res > 0) {
|
||||
return AjaxResult.success();
|
||||
}else {
|
||||
} else {
|
||||
return AjaxResult.error("删除失败");
|
||||
}
|
||||
}catch (Exception e) {
|
||||
return AjaxResult.error("系统异常,请联系管理员");
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("系统异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -86,17 +103,24 @@ public class MonthlyPlanController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monthly:plan:update')")
|
||||
@PostMapping("/updateMonthlyPlan")
|
||||
public AjaxResult updateMonthlyPlan(MonthlyPlanVo monthlyPlanVo)
|
||||
{
|
||||
public AjaxResult updateMonthlyPlan(MonthlyPlanVo monthlyPlanVo) {
|
||||
try {
|
||||
int res = monthlyPlanService.updateMonthlyPlan(monthlyPlanVo);
|
||||
int res = monthlyPlanService.updateMonthlyPlan(monthlyPlanVo);
|
||||
if (res > 0) {
|
||||
return AjaxResult.success();
|
||||
}else {
|
||||
} else {
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
}catch (Exception e) {
|
||||
return AjaxResult.error("系统异常,请联系管理员");
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("系统异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
@Log(title = "导出人员安排表", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('monthly:plan:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, MonthlyPlanVo monthlyPlanVo) throws IOException {
|
||||
List<ExportMonthPlanPersonVo> list = monthlyPlanService.exportMonthlyPlanPerson(monthlyPlanVo);
|
||||
MonthPlanExcelExporter.exportToExcel(response, list, 2025, 10, "10月运检人员安排");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,18 +29,30 @@ public class PlanManagementController extends BaseController {
|
|||
private PlanManagementService planManagementService;
|
||||
|
||||
/**
|
||||
* 计划管理表列表
|
||||
* 计划管理表列表(带分页)
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('plan:management:list')")
|
||||
@GetMapping("/getPlanManagementList")
|
||||
public TableDataInfo getPlanManagementList(PlanManagementVo planManagementVo)
|
||||
{
|
||||
public TableDataInfo getPlanManagementList(PlanManagementVo planManagementVo) {
|
||||
try {
|
||||
startPage();
|
||||
List<PlanManagementVo> list = planManagementService.getPlanManagementList(planManagementVo);
|
||||
return getDataTable(list);
|
||||
}catch (Exception e) {
|
||||
return getDataTable(null);
|
||||
} catch (Exception e) {
|
||||
return getDataTable(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 计划管理表列表(不带分页)
|
||||
*/
|
||||
@GetMapping("/getPlanManagementLists")
|
||||
public AjaxResult getPlanManagementLists(PlanManagementVo planManagementVo) {
|
||||
try {
|
||||
List<PlanManagementVo> list = planManagementService.getPlanManagementList(planManagementVo);
|
||||
return AjaxResult.success(list);
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("请求错误");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -49,17 +61,16 @@ public class PlanManagementController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('plan:management:add')")
|
||||
@PostMapping("/addPlanManagement")
|
||||
public AjaxResult addPlanManagement(@RequestBody PlanManagementVo planManagementVo)
|
||||
{
|
||||
public AjaxResult addPlanManagement(@RequestBody PlanManagementVo planManagementVo) {
|
||||
try {
|
||||
int res = planManagementService.addPlanManagement(planManagementVo);
|
||||
int res = planManagementService.addPlanManagement(planManagementVo);
|
||||
if (res > 0) {
|
||||
return AjaxResult.success();
|
||||
}else {
|
||||
} else {
|
||||
return AjaxResult.error("新增失败");
|
||||
}
|
||||
}catch (Exception e) {
|
||||
return AjaxResult.error("系统异常,请联系管理员");
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("系统异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -68,17 +79,16 @@ public class PlanManagementController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('plan:management:del')")
|
||||
@PostMapping("/delPlanManagement")
|
||||
public AjaxResult delPlanManagement(@RequestBody PlanManagementVo planManagementVo)
|
||||
{
|
||||
public AjaxResult delPlanManagement(@RequestBody PlanManagementVo planManagementVo) {
|
||||
try {
|
||||
int res = planManagementService.delPlanManagement(planManagementVo);
|
||||
int res = planManagementService.delPlanManagement(planManagementVo);
|
||||
if (res > 0) {
|
||||
return AjaxResult.success();
|
||||
}else {
|
||||
} else {
|
||||
return AjaxResult.error("删除失败");
|
||||
}
|
||||
}catch (Exception e) {
|
||||
return AjaxResult.error("系统异常,请联系管理员");
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("系统异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -87,17 +97,16 @@ public class PlanManagementController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('plan:management:update')")
|
||||
@PostMapping("/updatePlanManagement")
|
||||
public AjaxResult updatePlanManagement(@RequestBody PlanManagementVo planManagementVo)
|
||||
{
|
||||
public AjaxResult updatePlanManagement(@RequestBody PlanManagementVo planManagementVo) {
|
||||
try {
|
||||
int res = planManagementService.updatePlanManagement(planManagementVo);
|
||||
int res = planManagementService.updatePlanManagement(planManagementVo);
|
||||
if (res > 0) {
|
||||
return AjaxResult.success();
|
||||
}else {
|
||||
} else {
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
}catch (Exception e) {
|
||||
return AjaxResult.error("系统异常,请联系管理员");
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("系统异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -106,15 +115,14 @@ public class PlanManagementController extends BaseController {
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('plan:management:import')")
|
||||
@PostMapping("/importPlanManagement")
|
||||
public AjaxResult importPlanManagement(MultipartFile file)
|
||||
{
|
||||
public AjaxResult importPlanManagement(MultipartFile file) {
|
||||
try {
|
||||
ExcelUtil<PlanManagementVo> util = new ExcelUtil<PlanManagementVo>(PlanManagementVo.class);
|
||||
List<PlanManagementVo> planManagementList = util.importExcel(file.getInputStream());
|
||||
String message = planManagementService.importPlanManagement(planManagementList);
|
||||
return success(message);
|
||||
}catch (Exception e) {
|
||||
return AjaxResult.error("系统异常,请联系管理员");
|
||||
} catch (Exception e) {
|
||||
return AjaxResult.error("系统异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
package com.bonus.digital.dao;
|
||||
|
||||
import com.bonus.common.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/12/17 - 15:32
|
||||
*/
|
||||
@Data
|
||||
public class ExportMonthPlanPersonVo {
|
||||
@Excel(name = "运检站")
|
||||
private String inspectionStationName;
|
||||
@Excel(name = "作业内容")
|
||||
private String workContent;
|
||||
@Excel(name = "计划开始时间")
|
||||
private String plannedStartTime;
|
||||
@Excel(name = "计划结束时间")
|
||||
private String plannedEndTime;
|
||||
private String planPersonnel;
|
||||
@Excel(name = "姓名")
|
||||
private String name;
|
||||
@Excel(name = "性别")
|
||||
private String sex;
|
||||
@Excel(name = "岗位")
|
||||
private String positionName;
|
||||
@Excel(name = "人员性质")
|
||||
private String personnelNatureName;
|
||||
@Excel(name = "分类")
|
||||
private String personnelClassificationName;
|
||||
}
|
||||
|
|
@ -51,4 +51,8 @@ public interface MonthlyPlanMapper {
|
|||
* 修改月计划
|
||||
*/
|
||||
int updateMonthlyPlan(MonthlyPlanVo monthlyPlanVo);
|
||||
|
||||
List<MonthlyPlanVo> getMonthlyPlanPerson(MonthlyPlanVo monthlyPlanVo);
|
||||
|
||||
List<MonthlyPlanVo> getPlanMajorListByMonth(MonthlyPlanVo monthlyPlanVo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.digital.service;
|
||||
|
||||
import com.bonus.digital.dao.MonthlyPlanVo;
|
||||
import com.bonus.digital.dao.ExportMonthPlanPersonVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -24,4 +25,6 @@ public interface MonthlyPlanService {
|
|||
* 修改月计划
|
||||
*/
|
||||
int updateMonthlyPlan(MonthlyPlanVo monthlyPlanVo);
|
||||
|
||||
List<ExportMonthPlanPersonVo> exportMonthlyPlanPerson(MonthlyPlanVo monthlyPlanVo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
package com.bonus.digital.service.impl;
|
||||
|
||||
import com.bonus.common.utils.SecurityUtils;
|
||||
import com.bonus.digital.dao.MonthlyPlanVo;
|
||||
import com.bonus.digital.dao.PersonnelArrangementVo;
|
||||
import com.bonus.digital.dao.PersonnelVo;
|
||||
import com.bonus.digital.dao.WorkloadVo;
|
||||
import com.bonus.digital.dao.*;
|
||||
import com.bonus.digital.mapper.MonthlyPlanMapper;
|
||||
import com.bonus.digital.mapper.PersonnelMapper;
|
||||
import com.bonus.digital.service.MonthlyPlanService;
|
||||
|
|
@ -13,10 +10,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author 马三炮
|
||||
|
|
@ -117,4 +111,31 @@ public class MonthlyPlanServiceImpl implements MonthlyPlanService {
|
|||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExportMonthPlanPersonVo> exportMonthlyPlanPerson(MonthlyPlanVo monthlyPlanVo) {
|
||||
List<MonthlyPlanVo> monthlyPlanVoList = monthlyPlanMapper.getPlanMajorListByMonth(monthlyPlanVo);
|
||||
List<ExportMonthPlanPersonVo> plannedList= new ArrayList<>();
|
||||
for (MonthlyPlanVo monthlyPlanVo2 : monthlyPlanVoList) {
|
||||
//获取每个月计划投入的管理人员
|
||||
List<String> plannedIdList = Arrays.asList(monthlyPlanVo2.getPlanPersonnel().split(","));
|
||||
PersonnelVo personnelVo = new PersonnelVo();
|
||||
personnelVo.setIdList(plannedIdList);
|
||||
List<PersonnelVo> personnelList = personnelMapper.getPersonnelList(personnelVo);
|
||||
for (PersonnelVo vo : personnelList) {
|
||||
ExportMonthPlanPersonVo exportMonthPlanPersonVo = new ExportMonthPlanPersonVo();
|
||||
exportMonthPlanPersonVo.setInspectionStationName(monthlyPlanVo2.getInspectionStationName());
|
||||
exportMonthPlanPersonVo.setWorkContent(monthlyPlanVo2.getWorkContent());
|
||||
exportMonthPlanPersonVo.setPlannedStartTime(monthlyPlanVo2.getPlannedStartTime());
|
||||
exportMonthPlanPersonVo.setPlannedEndTime(monthlyPlanVo2.getPlannedEndTime());
|
||||
exportMonthPlanPersonVo.setName(vo.getName());
|
||||
exportMonthPlanPersonVo.setSex(vo.getSex());
|
||||
exportMonthPlanPersonVo.setPositionName(vo.getPositionName());
|
||||
exportMonthPlanPersonVo.setPersonnelNatureName(vo.getPersonnelNatureName());
|
||||
exportMonthPlanPersonVo.setPersonnelClassificationName(vo.getPersonnelClassificationName());
|
||||
plannedList.add(exportMonthPlanPersonVo);
|
||||
}
|
||||
}
|
||||
return plannedList;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,4 +126,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select personnel_arrangement_id,monthly_plan_id,"day",personnel_names
|
||||
from tb_personnel_arrangement where monthly_plan_id = #{monthlyPlanId}
|
||||
</select>
|
||||
<select id="getMonthlyPlanPerson" resultType="com.bonus.digital.dao.MonthlyPlanVo">
|
||||
|
||||
</select>
|
||||
<select id="getPlanMajorListByMonth" resultType="com.bonus.digital.dao.MonthlyPlanVo">
|
||||
select tmp.inspection_station_name,
|
||||
tmp.work_content,
|
||||
tmp.planned_start_time,
|
||||
tmp.planned_end_time,
|
||||
tmp.plan_personnel
|
||||
from tb_monthly_plan tmp
|
||||
where tmp.is_active = '1' and tmp.monthly_plan = #{monthlyPlan}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="getPersonnelList" resultType="com.bonus.digital.dao.PersonnelVo">
|
||||
select tis.id,
|
||||
tis.inspectionStationId,
|
||||
tis.inspection_station_id as inspectionStationId,
|
||||
tis.name,
|
||||
tis.sex,
|
||||
tis.phone,
|
||||
|
|
@ -63,7 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
tpc3.personnel_classification_name as personnelClassificationName,
|
||||
tis.long_term_secondment,
|
||||
tis.create_user
|
||||
from tb_inspection_station tis
|
||||
from tb_personnel tis
|
||||
left join tb_inspection_station tis2 on tis.inspection_station_id = tis2.inspection_station_id
|
||||
left join tb_personnel_classification tpc on tis.position_id = tpc.personnel_classification_id
|
||||
left join tb_personnel_classification tpc2 on tis.personnel_nature_id = tpc2.personnel_classification_id
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import com.bonus.framework.security.handle.LogoutSuccessHandlerImpl;
|
|||
|
||||
/**
|
||||
* spring security配置
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@EnableMethodSecurity(prePostEnabled = true, securedEnabled = true)
|
||||
|
|
@ -35,7 +35,7 @@ public class SecurityConfig
|
|||
*/
|
||||
@Autowired
|
||||
private UserDetailsService userDetailsService;
|
||||
|
||||
|
||||
/**
|
||||
* 认证失败处理类
|
||||
*/
|
||||
|
|
@ -53,7 +53,7 @@ public class SecurityConfig
|
|||
*/
|
||||
@Autowired
|
||||
private JwtAuthenticationTokenFilter authenticationTokenFilter;
|
||||
|
||||
|
||||
/**
|
||||
* 跨域过滤器
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue