产线管理

This commit is contained in:
zc
2026-06-18 14:26:55 +08:00
parent ee01b284ee
commit 71cf559a19
41 changed files with 2865 additions and 31 deletions

View File

@@ -11,11 +11,16 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.dromara.x.file.storage.core.FileInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import top.continew.starter.core.exception.BusinessException;
import top.mes.admin.common.constant.CacheConstants;
import top.mes.admin.common.util.PictureUtils;
import top.mes.admin.peopleBranch.model.query.BranchQuery;
import top.mes.admin.peopleBranch.service.BranchService;
import top.mes.admin.system.enums.OptionCategoryEnum;
import top.mes.admin.system.model.query.*;
import top.mes.admin.system.model.resp.file.FileUploadResp;
@@ -43,11 +48,13 @@ import java.util.List;
@RequestMapping("/common")
public class CommonController {
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
private final FileService fileService;
private final DeptService deptService;
private final MenuService menuService;
private final UserService userService;
private final RoleService roleService;
private final BranchService branchService;
private final DictItemService dictItemService;
private final OptionService optionService;
@@ -57,11 +64,11 @@ public class CommonController {
ValidationUtils.throwIf(file::isEmpty, "文件不能为空");
FileInfo fileInfo = fileService.upload(file, true);
return FileUploadResp.builder()
.id(fileInfo.getId())
.url(fileInfo.getUrl())
.thUrl(fileInfo.getThUrl())
.metadata(fileInfo.getMetadata())
.build();
.id(fileInfo.getId())
.url(fileInfo.getUrl())
.thUrl(fileInfo.getThUrl())
.metadata(fileInfo.getMetadata())
.build();
}
@Operation(summary = "上传文件", description = "上传文件")
@@ -70,11 +77,11 @@ public class CommonController {
ValidationUtils.throwIf(file::isEmpty, "文件不能为空");
FileInfo fileInfo = fileService.upload(file, savePath, null, false, false);
return FileUploadResp.builder()
.id(fileInfo.getId())
.url(fileInfo.getUrl())
.thUrl(fileInfo.getThUrl())
.metadata(fileInfo.getMetadata())
.build();
.id(fileInfo.getId())
.url(fileInfo.getUrl())
.thUrl(fileInfo.getThUrl())
.metadata(fileInfo.getMetadata())
.build();
}
@Operation(summary = "上传文件", description = "上传文件")
@@ -98,17 +105,21 @@ public class CommonController {
// 直接在内存中压缩图片,避免使用临时文件
file = PictureUtils.compressImage(inputStream, file.getOriginalFilename(), quality);
} catch (IOException e) {
throw new RuntimeException(e);
throw new BusinessException("图片异常:压缩失败!");
}
}
FileInfo fileInfo = fileService.upload(file, savePath, null, false, false);
return FileUploadResp.builder()
.id(fileInfo.getId())
.url(fileInfo.getUrl())
.thUrl(fileInfo.getThUrl())
.metadata(fileInfo.getMetadata())
.build();
try {
FileInfo fileInfo = fileService.upload(file, savePath, null, true, true);
return FileUploadResp.builder()
.id(fileInfo.getId())
.url(fileInfo.getUrl())
.thUrl(fileInfo.getThUrl())
.metadata(fileInfo.getMetadata())
.build();
} catch (Exception e) {
throw new BusinessException("图片上传失败!");
}
}
@Operation(summary = "查询部门树", description = "查询树结构的部门列表")
@@ -117,6 +128,12 @@ public class CommonController {
return deptService.tree(query, sortQuery, true);
}
@Operation(summary = "查询部门树", description = "查询树结构的部门列表")
@GetMapping("/tree/branch")
public List<Tree<String>> listBranchTree(BranchQuery query) {
return branchService.tree(query);
}
@Operation(summary = "查询菜单树", description = "查询树结构的菜单列表")
@GetMapping("/tree/menu")
public List<Tree<Long>> listMenuTree(MenuQuery query, SortQuery sortQuery) {

View File

@@ -0,0 +1,82 @@
package top.mes.admin.controller.peopleBranch;
import cn.dev33.satoken.annotation.SaCheckPermission;
import cn.hutool.core.lang.tree.Tree;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import top.continew.starter.log.annotation.Log;
import top.mes.admin.peopleBranch.model.query.BranchQuery;
import top.mes.admin.peopleBranch.model.req.BranchReq;
import top.mes.admin.peopleBranch.model.resp.BranchResp;
import top.mes.admin.peopleBranch.service.BranchService;
import java.util.List;
/**
* 部门管理管理 API
*
* @author zc
* @since 2025/03/19 17:46
*/
@Tag(name = "部门管理管理 API")
@RestController
@RequiredArgsConstructor
@RequestMapping("/sysPeople/branch")
public class BranchController {
private final BranchService branchService;
/**
* 查询部门树形结构
*
* @param branchQuery
* @return
*/
@Log(ignore = true)
@SaCheckPermission("sysPeople:branch:tree")
@GetMapping("/tree")
public List<Tree<String>> selectBranchTree(BranchQuery branchQuery) {
return branchService.selectBranchTree(branchQuery);
}
/**
* 获取部门管理详细信息
*/
@SaCheckPermission("sysPeople:branch:query")
@GetMapping(value = "/{id}")
public BranchResp getInfo(@PathVariable("id") String id) {
return branchService.selectBranchById(id);
}
/**
* 新增部门管理
*/
@SaCheckPermission("sysPeople:branch:add")
@Log(module = "新增部门")
@PostMapping
public String add(@RequestBody BranchReq branchReq) {
return branchService.insertBranch(branchReq);
}
/**
* 修改部门管理
*/
@SaCheckPermission("sysPeople:branch:edit")
@Log(module = "修改部门")
@PutMapping("/{id}")
public void edit(@PathVariable("id") String id, @RequestBody BranchReq branchReq) {
branchService.updateBranch(branchReq, id);
}
/**
* 删除部门管理
*/
@SaCheckPermission("sysPeople:branch:remove")
@Log(module = "删除部门")
@DeleteMapping("/{id}")
public void remove(@PathVariable("id") String id) {
branchService.deleteBranchById(id);
}
}

View File

@@ -0,0 +1,81 @@
package top.mes.admin.controller.peopleBranch;
import cn.dev33.satoken.annotation.SaCheckPermission;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import top.continew.starter.core.validation.ValidationUtils;
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
import top.continew.starter.extension.crud.enums.Api;
import top.continew.starter.extension.crud.model.resp.LabelValueResp;
import top.continew.starter.log.annotation.Log;
import top.mes.admin.common.controller.BaseController;
import top.mes.admin.peopleBranch.model.query.PeopleQuery;
import top.mes.admin.peopleBranch.model.req.PeopleImportReq;
import top.mes.admin.peopleBranch.model.req.PeopleReq;
import top.mes.admin.peopleBranch.model.resp.PeopleImportParseResp;
import top.mes.admin.peopleBranch.model.resp.PeopleImportResp;
import top.mes.admin.peopleBranch.model.resp.PeopleResp;
import top.mes.admin.peopleBranch.service.PeopleService;
import top.mes.admin.system.service.ImportExcelService;
import java.io.IOException;
import java.util.List;
/**
* 人员管理管理 API
*
* @author zc
* @since 2025/03/21 18:10
*/
@Tag(name = "人员管理管理 API")
@RequiredArgsConstructor
@RestController
@Slf4j
@CrudRequestMapping(value = "/sysPeople/people", api = {Api.PAGE, Api.DETAIL, Api.ADD, Api.UPDATE, Api.DELETE, Api.EXPORT})
public class PeopleController extends BaseController<PeopleService, PeopleResp, PeopleResp, PeopleQuery, PeopleReq> {
private final ImportExcelService importExcelService;
@GetMapping(value = "/getPeopleNameList")
public List<LabelValueResp> getPeopleNameList(PeopleQuery peopleQuery) {
return baseService.getPeopleNameList(peopleQuery);
}
@Log(ignore = true)
@Operation(summary = "下载导入模板", description = "下载导入模板")
@SaCheckPermission("sysPeople:people:import")
@GetMapping(value = "/import/template", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
public void downloadImportTemplate(HttpServletResponse response) throws IOException {
importExcelService.downloadImportTemplate(response, "people.xlsx", "人员导入模板.xlsx");
}
//导入相关
@Log(ignore = true)
@Operation(summary = "解析导入数据", description = "解析导入数据")
@SaCheckPermission("sysPeople:people:import")
@PostMapping("/import/parse")
public PeopleImportParseResp parseImport(@NotNull(message = "文件不能为空") MultipartFile file) {
ValidationUtils.throwIf(file::isEmpty, "文件不能为空");
return baseService.parseImport(file);
}
@Log(ignore = true)
@Operation(summary = "导入数据", description = "导入数据")
@SaCheckPermission("sysPeople:people:import")
@PostMapping(value = "/import")
public PeopleImportResp importUser(@Validated @RequestBody PeopleImportReq req) {
return baseService.importPeople(req);
}
}

View File

@@ -0,0 +1,29 @@
package top.mes.admin.controller.production;
import top.continew.starter.extension.crud.enums.Api;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;
import lombok.RequiredArgsConstructor;
import top.continew.starter.extension.crud.annotation.CrudRequestMapping;
import top.mes.admin.common.controller.BaseController;
import top.mes.admin.production.model.query.ProductionLineQuery;
import top.mes.admin.production.model.req.ProductionLineReq;
import top.mes.admin.production.model.resp.ProductionLineResp;
import top.mes.admin.production.service.ProductionLineService;
/**
* 产线基础管理 API
*
* @author zc
* @since 2026/06/17 14:07
*/
@Tag(name = "产线基础管理 API")
@RestController
@RequiredArgsConstructor
@CrudRequestMapping(value = "/production/productionLine", api = {Api.PAGE, Api.DETAIL, Api.ADD, Api.UPDATE, Api.DELETE, Api.EXPORT})
public class ProductionLineController extends BaseController<ProductionLineService, ProductionLineResp, ProductionLineResp, ProductionLineQuery, ProductionLineReq> {
}