人员任命导入导出接口修改
This commit is contained in:
@ -29,6 +29,7 @@ import org.dromara.other.service.IOthYs7DeviceService;
|
|||||||
import org.dromara.project.domain.BusProject;
|
import org.dromara.project.domain.BusProject;
|
||||||
import org.dromara.project.domain.vo.project.BusProjectSafetyDayVo;
|
import org.dromara.project.domain.vo.project.BusProjectSafetyDayVo;
|
||||||
import org.dromara.project.domain.vo.projectnews.BusProjectNewsVo;
|
import org.dromara.project.domain.vo.projectnews.BusProjectNewsVo;
|
||||||
|
import org.dromara.project.service.IBusProjectNewsService;
|
||||||
import org.dromara.project.service.IBusProjectService;
|
import org.dromara.project.service.IBusProjectService;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -68,6 +69,8 @@ public class ProjectBigScreenController {
|
|||||||
|
|
||||||
private final IBusProjectService projectService;
|
private final IBusProjectService projectService;
|
||||||
|
|
||||||
|
private final IBusProjectNewsService projectNewsService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询项目土地统计
|
* 查询项目土地统计
|
||||||
*/
|
*/
|
||||||
@ -144,14 +147,15 @@ public class ProjectBigScreenController {
|
|||||||
@GetMapping("/news/{projectId}")
|
@GetMapping("/news/{projectId}")
|
||||||
public R<List<BusProjectNewsVo>> getProjectNews(@NotNull(message = "主键不能为空")
|
public R<List<BusProjectNewsVo>> getProjectNews(@NotNull(message = "主键不能为空")
|
||||||
@PathVariable Long projectId) {
|
@PathVariable Long projectId) {
|
||||||
List<BusCorporateEvents> busCorporateEvents = projectBigScreenMapper.getBusCorporateEvents();
|
// List<BusCorporateEvents> busCorporateEvents = projectBigScreenMapper.getBusCorporateEvents();
|
||||||
return R.ok(busCorporateEvents.stream().map(event -> {
|
// return R.ok(busCorporateEvents.stream().map(event -> {
|
||||||
BusProjectNewsVo vo = new BusProjectNewsVo();
|
// BusProjectNewsVo vo = new BusProjectNewsVo();
|
||||||
vo.setId(event.getId());
|
// vo.setId(event.getId());
|
||||||
vo.setTitle(event.getHeadline());
|
// vo.setTitle(event.getHeadline());
|
||||||
vo.setContent(event.getContent());
|
// vo.setContent(event.getContent());
|
||||||
return vo;
|
// return vo;
|
||||||
}).toList());
|
// }).toList());
|
||||||
|
return R.ok(projectNewsService.getLimtVoByProjectId(projectId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -17,8 +17,8 @@ import java.util.List;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface ProjectBigScreenMapper {
|
public interface ProjectBigScreenMapper {
|
||||||
|
|
||||||
@Select("select * from bus_corporate_events limit 10")
|
// @Select("select * from bus_corporate_events limit 10")
|
||||||
List<BusCorporateEvents> getBusCorporateEvents();
|
// List<BusCorporateEvents> getBusCorporateEvents();
|
||||||
//
|
//
|
||||||
// @Select("select * from sys_project_introduce where project_id = #{projectId}")
|
// @Select("select * from sys_project_introduce where project_id = #{projectId}")
|
||||||
// List<SysProjectIntroduce> selectByProjectId(@Param("projectId") Long projectId);
|
// List<SysProjectIntroduce> selectByProjectId(@Param("projectId") Long projectId);
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import java.util.Collections;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
@ -24,9 +23,7 @@ import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
//import org.dromara.design.domain.DesUserExcelData;
|
//import org.dromara.design.domain.DesUserExcelData;
|
||||||
import org.dromara.design.domain.DesUserExcelData;
|
import org.dromara.design.domain.DesUserExcelData;
|
||||||
import org.dromara.design.domain.dto.ExcelData;
|
|
||||||
import org.dromara.design.domain.dto.desUser.DesUserBatchDto;
|
import org.dromara.design.domain.dto.desUser.DesUserBatchDto;
|
||||||
import org.dromara.design.domain.dto.volumecatalog.DesVolumeCatalogCreateReq;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||||
@ -88,41 +85,6 @@ public class DesUserController extends BaseController {
|
|||||||
desUserService.exportExcelByProjectId(deptId, response);
|
desUserService.exportExcelByProjectId(deptId, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导入卷册目录
|
|
||||||
*/
|
|
||||||
@SaCheckPermission("design:user:importData")
|
|
||||||
@Log(title = "导入卷册目录", businessType = BusinessType.IMPORT)
|
|
||||||
@PostMapping("/importData")
|
|
||||||
public R<Void> importData(@RequestParam("file") MultipartFile file,Long projectId) throws IOException {
|
|
||||||
if (projectId == null) {
|
|
||||||
return R.fail("项目ID不能为空");
|
|
||||||
}
|
|
||||||
List<DesUserExcelData> dataList = readExcel(file);
|
|
||||||
if (CollectionUtils.isEmpty(dataList)) {
|
|
||||||
throw new ServerException("导入数据为空");
|
|
||||||
}
|
|
||||||
Collections.reverse(dataList);
|
|
||||||
List<DesUserBo> desUserBos = new ArrayList<>();
|
|
||||||
for (DesUserExcelData desUserBo : dataList) {
|
|
||||||
DesUserBo userBo = new DesUserBo();
|
|
||||||
userBo.setProjectId(projectId);
|
|
||||||
userBo.setUserId(desUserBo.getUserId());
|
|
||||||
userBo.setUserName(desUserBo.getUser());
|
|
||||||
userBo.setUserType(desUserBo.getUserTypeId());
|
|
||||||
if (!"1".equals(desUserBo.getUserTypeId())) {
|
|
||||||
userBo.setUserMajor(desUserBo.getUserMajorId());
|
|
||||||
}
|
|
||||||
desUserBos.add(userBo);
|
|
||||||
}
|
|
||||||
DesUserBatchDto dto = new DesUserBatchDto();
|
|
||||||
dto.setProjectId(projectId);
|
|
||||||
dto.setList(desUserBos);
|
|
||||||
desUserService.batchAddOrUpdate(dto);
|
|
||||||
return toAjax(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取设计人员详细信息
|
* 获取设计人员详细信息
|
||||||
*
|
*
|
||||||
@ -180,131 +142,5 @@ public class DesUserController extends BaseController {
|
|||||||
return toAjax(desUserService.batchAddOrUpdate(dto));
|
return toAjax(desUserService.batchAddOrUpdate(dto));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<DesUserExcelData> readExcel(MultipartFile file) throws IOException {
|
|
||||||
List<DesUserExcelData> dataList = new ArrayList<>();
|
|
||||||
|
|
||||||
try (InputStream inputStream = file.getInputStream();
|
|
||||||
XSSFWorkbook workbook = new XSSFWorkbook(inputStream)) {
|
|
||||||
|
|
||||||
XSSFSheet sheet = workbook.getSheetAt(0);
|
|
||||||
|
|
||||||
// 从第二行(index=1)开始读取数据,跳过表头
|
|
||||||
for (int rowIndex = 1; rowIndex <= sheet.getLastRowNum(); rowIndex++) {
|
|
||||||
Row row = sheet.getRow(rowIndex);
|
|
||||||
if (hasValidData(row)) {
|
|
||||||
String userMajor = getCellValue(row.getCell(0));
|
|
||||||
String userMajorId = getCellValue(row.getCell(1));
|
|
||||||
String user = getCellValue(row.getCell(2));
|
|
||||||
Long userId = Long.valueOf(getCellValue(row.getCell(3)));
|
|
||||||
String userType = getCellValue(row.getCell(4));
|
|
||||||
String userTypeId = getCellValue(row.getCell(5));
|
|
||||||
if (!"1".equals(userMajorId)) {
|
|
||||||
if (user == null || user.isEmpty()){
|
|
||||||
throw new ServerException("设计人员不能为空");
|
|
||||||
}
|
|
||||||
if (userType == null || userType.isEmpty()){
|
|
||||||
throw new ServerException("人员类型不能为空");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DesUserExcelData excelData = new DesUserExcelData(
|
|
||||||
userMajor,userMajorId,user, userId, userType,
|
|
||||||
userTypeId
|
|
||||||
);
|
|
||||||
dataList.add(excelData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return dataList;
|
|
||||||
}
|
|
||||||
private static boolean hasValidData(Row row) {
|
|
||||||
// 遍历行中的所有单元格
|
|
||||||
for (int cellIndex = 0; cellIndex < row.getLastCellNum(); cellIndex++) {
|
|
||||||
Cell cell = row.getCell(cellIndex, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
|
||||||
String cellValue = getCellValue(cell).trim();
|
|
||||||
|
|
||||||
// 只要有一个单元格有非空值,就认为是有效行
|
|
||||||
if (!cellValue.isEmpty()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getCellValue(Cell cell) {
|
|
||||||
if (cell == null) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
// 使用CellType枚举判断单元格类型(POI 4.0+版本推荐方式)
|
|
||||||
CellType cellType = cell.getCellType();
|
|
||||||
// 对于公式单元格,获取其计算结果的类型
|
|
||||||
if (cellType == CellType.FORMULA) {
|
|
||||||
cellType = cell.getCachedFormulaResultType();
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (cellType) {
|
|
||||||
case STRING:
|
|
||||||
return cell.getStringCellValue().trim();
|
|
||||||
case NUMERIC:
|
|
||||||
if (DateUtil.isCellDateFormatted(cell)) {
|
|
||||||
Date date = cell.getDateCellValue();
|
|
||||||
return date.toString();
|
|
||||||
} else {
|
|
||||||
// 处理数字类型,避免科学计数法
|
|
||||||
return String.valueOf((long) cell.getNumericCellValue());
|
|
||||||
}
|
|
||||||
case BOOLEAN:
|
|
||||||
return String.valueOf(cell.getBooleanCellValue());
|
|
||||||
default:
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static LocalDate getLocalDateValue(Cell cell) {
|
|
||||||
if (cell == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
CellType cellType = cell.getCellType();
|
|
||||||
if (cellType == CellType.FORMULA) {
|
|
||||||
cellType = cell.getCachedFormulaResultType();
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (cellType == CellType.NUMERIC) {
|
|
||||||
if (DateUtil.isCellDateFormatted(cell)) {
|
|
||||||
Date date = cell.getDateCellValue();
|
|
||||||
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
|
||||||
} else {
|
|
||||||
// 如果是数字但不是日期,就尝试转为 LocalDate (例如 20250730)
|
|
||||||
double numericValue = cell.getNumericCellValue();
|
|
||||||
String text = String.valueOf((long) numericValue);
|
|
||||||
return LocalDate.parse(text);
|
|
||||||
}
|
|
||||||
} else if (cellType == CellType.STRING) {
|
|
||||||
String text = cell.getStringCellValue().trim();
|
|
||||||
if (text.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
// 尝试解析不同格式
|
|
||||||
try {
|
|
||||||
return LocalDate.parse(text); // 默认 ISO 格式 yyyy-MM-dd
|
|
||||||
} catch (Exception e) {
|
|
||||||
// 如果 Excel 是 yyyy/MM/dd 或 yyyy.MM.dd,可以额外处理
|
|
||||||
try {
|
|
||||||
return LocalDate.parse(text, java.time.format.DateTimeFormatter.ofPattern("yyyy/MM/dd"));
|
|
||||||
} catch (Exception ignored) {}
|
|
||||||
try {
|
|
||||||
return LocalDate.parse(text, java.time.format.DateTimeFormatter.ofPattern("yyyy.MM.dd"));
|
|
||||||
} catch (Exception ignored) {}
|
|
||||||
return null; // 不识别的格式就返回 null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,6 @@ package org.dromara.design.domain;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author 铁憨憨
|
* @Author 铁憨憨
|
||||||
* @Date 2025/8/12 22:53
|
* @Date 2025/8/12 22:53
|
||||||
@ -13,18 +11,27 @@ import java.time.LocalDate;
|
|||||||
public class DesUserExcelData {
|
public class DesUserExcelData {
|
||||||
private String userMajor;
|
private String userMajor;
|
||||||
private String userMajorId;
|
private String userMajorId;
|
||||||
private String user;
|
private String sheji;
|
||||||
private Long userId;
|
private Long shejiId;
|
||||||
private String userType;
|
private String jiaoshe;
|
||||||
private String userTypeId;
|
private Long jiaosheId;
|
||||||
|
private String shenhe;
|
||||||
|
private Long shenheId;
|
||||||
|
private String shendin;
|
||||||
|
private Long shendinId;
|
||||||
|
|
||||||
// 构造函数
|
// 构造函数
|
||||||
public DesUserExcelData(String userMajor, String userMajorId, String user, Long userId, String userType, String userTypeId) {
|
public DesUserExcelData(String userMajor,String userMajorId,String sheji,Long shejiId, String jiaoshe,
|
||||||
|
Long jiaosheId,String shenhe,Long shenheId,String shendin,Long shendinId) {
|
||||||
this.userMajor = userMajor;
|
this.userMajor = userMajor;
|
||||||
this.userMajorId = userMajorId;
|
this.userMajorId = userMajorId;
|
||||||
this.user = user;
|
this.sheji = sheji;
|
||||||
this.userId = userId;
|
this.shejiId = shejiId;
|
||||||
this.userType = userType;
|
this.jiaoshe = jiaoshe;
|
||||||
this.userTypeId = userTypeId;
|
this.jiaosheId = jiaosheId;
|
||||||
|
this.shenhe = shenhe;
|
||||||
|
this.shenheId = shenheId;
|
||||||
|
this.shendin = shendin;
|
||||||
|
this.shendinId = shendinId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -263,22 +263,11 @@ public class DesUserServiceImpl extends ServiceImpl<DesUserMapper, DesUser> impl
|
|||||||
row.createCell(3).setCellValue(entry.getKey()); // D列:人员名称
|
row.createCell(3).setCellValue(entry.getKey()); // D列:人员名称
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
}
|
}
|
||||||
rowIndex = 0;
|
|
||||||
// 填充专业和专业ID(A列和B列)
|
|
||||||
for (Map.Entry<String, String> entry : userTypeMap.entrySet()) {
|
|
||||||
Row row = dataSheet.getRow(rowIndex);
|
|
||||||
if (row == null) {
|
|
||||||
row = dataSheet.createRow(rowIndex);
|
|
||||||
}
|
|
||||||
row.createCell(4).setCellValue(entry.getValue()); // A列:专业ID
|
|
||||||
row.createCell(5).setCellValue(entry.getKey()); // B列:专业名称
|
|
||||||
rowIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 主 Sheet 设置表头
|
// 主 Sheet 设置表头
|
||||||
Row sheetRow = mainSheet.createRow(0);
|
Row sheetRow = mainSheet.createRow(0);
|
||||||
String[] headers = {"专业", "专业编码",
|
String[] headers = {"专业", "专业编码",
|
||||||
"设计人员", "设计人员编码", "人员类型", "人员人员编码"};
|
"设计人员", "设计人员编码", "校审人员", "校审人员编码", "审核人员", "审核人员编码","审定人员", "审定人员编码"};
|
||||||
for (int i = 0; i < headers.length; i++) {
|
for (int i = 0; i < headers.length; i++) {
|
||||||
Cell cell = sheetRow.createCell(i);
|
Cell cell = sheetRow.createCell(i);
|
||||||
cell.setCellValue(headers[i]);
|
cell.setCellValue(headers[i]);
|
||||||
@ -287,16 +276,19 @@ public class DesUserServiceImpl extends ServiceImpl<DesUserMapper, DesUser> impl
|
|||||||
// 6. 设置专业下拉列表(第二列)
|
// 6. 设置专业下拉列表(第二列)
|
||||||
setMajorDropdown(mainSheet, uniqueMajors.size());
|
setMajorDropdown(mainSheet, uniqueMajors.size());
|
||||||
|
|
||||||
|
int rowCount = 2;
|
||||||
// 8. 设置人员下拉列表(第四列)
|
// 8. 设置人员下拉列表(第四列)
|
||||||
setPersonDropdown(mainSheet, userList.size());
|
for (int i = 0; i < 4; i++) {
|
||||||
|
setPersonDropdown(mainSheet, userList.size(),rowCount);
|
||||||
setTypeDropdown(mainSheet, typeList.size());
|
rowCount += 2;
|
||||||
|
}
|
||||||
|
|
||||||
String formulaTemplate = "IFERROR(INDEX(DropdownData!$B$1:$B$" + uniqueMajors.size() + ", MATCH(A{rowNum}, DropdownData!$A$1:$A$" + uniqueMajors.size() + ", 0)),\"\")";
|
String formulaTemplate = "IFERROR(INDEX(DropdownData!$B$1:$B$" + uniqueMajors.size() + ", MATCH(A{rowNum}, DropdownData!$A$1:$A$" + uniqueMajors.size() + ", 0)),\"\")";
|
||||||
|
|
||||||
String formulaTemplate1 = "IFERROR(INDEX(DropdownData!$D$1:$D$" + userList.size() + ", MATCH(C{rowNum}, DropdownData!$C$1:$C$" + userList.size() + ", 0)),\"\")";
|
String formulaTemplate1 = "IFERROR(INDEX(DropdownData!$D$1:$D$" + userList.size() + ", MATCH(C{rowNum}, DropdownData!$C$1:$C$" + userList.size() + ", 0)),\"\")";
|
||||||
String formulaTemplate2 = "IFERROR(INDEX(DropdownData!$F$1:$F$" + userTypeMap.size() + ", MATCH(E{rowNum}, DropdownData!$E$1:$E$" + userTypeMap.size() + ", 0)),\"\")";
|
String formulaTemplate2 = "IFERROR(INDEX(DropdownData!$D$1:$D$" + userList.size() + ", MATCH(E{rowNum}, DropdownData!$C$1:$C$" + userList.size() + ", 0)),\"\")";
|
||||||
|
String formulaTemplate3 = "IFERROR(INDEX(DropdownData!$D$1:$D$" + userList.size() + ", MATCH(G{rowNum}, DropdownData!$C$1:$C$" + userList.size() + ", 0)),\"\")";
|
||||||
|
String formulaTemplate4 = "IFERROR(INDEX(DropdownData!$D$1:$D$" + userList.size() + ", MATCH(I{rowNum}, DropdownData!$C$1:$C$" + userList.size() + ", 0)),\"\")";
|
||||||
|
|
||||||
|
|
||||||
for (int i = 1; i <= 100; i++) { // 从第2行到101行
|
for (int i = 1; i <= 100; i++) { // 从第2行到101行
|
||||||
@ -329,6 +321,25 @@ public class DesUserServiceImpl extends ServiceImpl<DesUserMapper, DesUser> impl
|
|||||||
idCell3.setCellFormula(formula2);
|
idCell3.setCellFormula(formula2);
|
||||||
idCell3.setCellStyle(protectedStyle);
|
idCell3.setCellStyle(protectedStyle);
|
||||||
|
|
||||||
|
|
||||||
|
String formula3 = formulaTemplate3.replace("{rowNum}", String.valueOf(currentRowNum));
|
||||||
|
|
||||||
|
Cell cell4 = row.createCell(6);
|
||||||
|
cell4.setCellStyle(editableStyle);
|
||||||
|
|
||||||
|
Cell idCell4 = row.createCell(7);
|
||||||
|
idCell4.setCellFormula(formula3);
|
||||||
|
idCell4.setCellStyle(protectedStyle);
|
||||||
|
|
||||||
|
|
||||||
|
String formula4 = formulaTemplate4.replace("{rowNum}", String.valueOf(currentRowNum));
|
||||||
|
|
||||||
|
Cell cell5 = row.createCell(8);
|
||||||
|
cell5.setCellStyle(editableStyle);
|
||||||
|
|
||||||
|
Cell idCell5 = row.createCell(9);
|
||||||
|
idCell5.setCellFormula(formula4);
|
||||||
|
idCell5.setCellStyle(protectedStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -341,11 +352,15 @@ public class DesUserServiceImpl extends ServiceImpl<DesUserMapper, DesUser> impl
|
|||||||
|
|
||||||
// 调整列宽
|
// 调整列宽
|
||||||
mainSheet.setColumnWidth(0, 20 * 200);
|
mainSheet.setColumnWidth(0, 20 * 200);
|
||||||
mainSheet.setColumnWidth(1, 20 * 300);
|
mainSheet.setColumnWidth(1, 20 * 100);
|
||||||
mainSheet.setColumnWidth(2, 20 * 200);
|
mainSheet.setColumnWidth(2, 20 * 120);
|
||||||
mainSheet.setColumnWidth(3, 20 * 300);
|
mainSheet.setColumnWidth(3, 20 * 300);
|
||||||
mainSheet.setColumnWidth(4, 20 * 200);
|
mainSheet.setColumnWidth(4, 20 * 120);
|
||||||
mainSheet.setColumnWidth(5, 20 * 300);
|
mainSheet.setColumnWidth(5, 20 * 300);
|
||||||
|
mainSheet.setColumnWidth(6, 20 * 120);
|
||||||
|
mainSheet.setColumnWidth(7, 20 * 300);
|
||||||
|
mainSheet.setColumnWidth(8, 20 * 120);
|
||||||
|
mainSheet.setColumnWidth(9, 20 * 300);
|
||||||
// 2. 设置响应头
|
// 2. 设置响应头
|
||||||
// 设置响应头,指定Excel格式和下载文件名
|
// 设置响应头,指定Excel格式和下载文件名
|
||||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
@ -404,7 +419,7 @@ public class DesUserServiceImpl extends ServiceImpl<DesUserMapper, DesUser> impl
|
|||||||
/**
|
/**
|
||||||
* 设置人员下拉列表(第四列,索引3)
|
* 设置人员下拉列表(第四列,索引3)
|
||||||
*/
|
*/
|
||||||
private void setPersonDropdown(Sheet mainSheet, int personCount) {
|
private void setPersonDropdown(Sheet mainSheet, int personCount, Integer rowCount) {
|
||||||
DataValidationHelper helper = mainSheet.getDataValidationHelper();
|
DataValidationHelper helper = mainSheet.getDataValidationHelper();
|
||||||
|
|
||||||
// 人员数据范围:数据Sheet的C列(从第1行到人员数量行)
|
// 人员数据范围:数据Sheet的C列(从第1行到人员数量行)
|
||||||
@ -412,29 +427,6 @@ public class DesUserServiceImpl extends ServiceImpl<DesUserMapper, DesUser> impl
|
|||||||
|
|
||||||
DataValidationConstraint constraint = helper.createFormulaListConstraint(personRange);
|
DataValidationConstraint constraint = helper.createFormulaListConstraint(personRange);
|
||||||
// 作用范围:第2行到100行,第四列
|
// 作用范围:第2行到100行,第四列
|
||||||
CellRangeAddressList addressList = new CellRangeAddressList(1, 100, 2, 2);
|
CellRangeAddressList addressList = new CellRangeAddressList(1, 100, rowCount, rowCount);
|
||||||
|
|
||||||
DataValidation validation = helper.createValidation(constraint, addressList);
|
|
||||||
validation.setShowErrorBox(true);
|
|
||||||
mainSheet.addValidationData(validation);
|
|
||||||
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 设置人员下拉列表(第四列,索引3)
|
|
||||||
*/
|
|
||||||
private void setTypeDropdown(Sheet mainSheet, int personCount) {
|
|
||||||
DataValidationHelper helper = mainSheet.getDataValidationHelper();
|
|
||||||
|
|
||||||
// 人员数据范围:数据Sheet的C列(从第1行到人员数量行)
|
|
||||||
String personRange = "DropdownData!$E$1:$E$" + personCount;
|
|
||||||
|
|
||||||
DataValidationConstraint constraint = helper.createFormulaListConstraint(personRange);
|
|
||||||
// 作用范围:第2行到100行,第四列
|
|
||||||
CellRangeAddressList addressList = new CellRangeAddressList(1, 100, 4, 4);
|
|
||||||
|
|
||||||
DataValidation validation = helper.createValidation(constraint, addressList);
|
|
||||||
validation.setShowErrorBox(true);
|
|
||||||
mainSheet.addValidationData(validation);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,4 +20,9 @@ public class BusProjectNewsQueryReq implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Long projectId;
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 标题
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package org.dromara.project.service;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.project.domain.BusProjectNews;
|
import org.dromara.project.domain.BusProjectNews;
|
||||||
@ -122,4 +123,5 @@ public interface IBusProjectNewsService extends IService<BusProjectNews> {
|
|||||||
*/
|
*/
|
||||||
List<BusProjectNewsVo> getVoList(List<BusProjectNews> projectNewsList);
|
List<BusProjectNewsVo> getVoList(List<BusProjectNews> projectNewsList);
|
||||||
|
|
||||||
|
List<BusProjectNewsVo> getLimtVoByProjectId(Long projectId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -225,6 +225,7 @@ public class BusProjectNewsServiceImpl extends ServiceImpl<BusProjectNewsMapper,
|
|||||||
LambdaQueryWrapper<BusProjectNews> lqw = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<BusProjectNews> lqw = new LambdaQueryWrapper<>();
|
||||||
Long projectId = req.getProjectId();
|
Long projectId = req.getProjectId();
|
||||||
lqw.eq(ObjectUtils.isNotEmpty(projectId), BusProjectNews::getProjectId, projectId);
|
lqw.eq(ObjectUtils.isNotEmpty(projectId), BusProjectNews::getProjectId, projectId);
|
||||||
|
lqw.eq(ObjectUtils.isNotEmpty(req.getTitle()), BusProjectNews::getTitle, req.getTitle());
|
||||||
return lqw;
|
return lqw;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,4 +261,10 @@ public class BusProjectNewsServiceImpl extends ServiceImpl<BusProjectNewsMapper,
|
|||||||
return projectNewsList.stream().map(this::getVo).toList();
|
return projectNewsList.stream().map(this::getVo).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BusProjectNewsVo> getLimtVoByProjectId(Long projectId) {
|
||||||
|
|
||||||
|
return baseMapper.selectVoList(new LambdaQueryWrapper<BusProjectNews>().eq(BusProjectNews::getProjectId, projectId).last("limit 10"));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user