From f0013b7c6e1467e1b7057d8cc6bb949cf4d35a56 Mon Sep 17 00:00:00 2001 From: zch Date: Tue, 14 Jan 2025 15:08:53 +0800 Subject: [PATCH] =?UTF-8?q?add(hwmom-mes):=20=E5=B7=A5=E5=BA=8F=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=85=B3=E8=81=94=E7=94=A8=E6=88=B7=E5=92=8C=E4=BA=A7?= =?UTF-8?q?=E7=BA=BF=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增工序信息关联用户和产线的接口和实现 - 在工序信息中添加关联用户和产线的列表字段 - 实现工序信息关联用户和产线的增删改查功能 - 优化工序信息查询接口,支持查询关联的用户和产线信息 --- .../ProdBaseProcessInfoController.java | 13 +- .../ProdBaseProcessProdLineController.java | 117 +++++++++ .../ProdBaseProcessUserController.java | 117 +++++++++ .../mes/domain/ProdBaseProcessInfo.java | 14 ++ .../mes/domain/ProdBaseProcessProdLine.java | 69 ++++++ .../mes/domain/ProdBaseProcessUser.java | 73 ++++++ .../mes/domain/bo/ProdBaseProcessInfoBo.java | 15 ++ .../domain/bo/ProdBaseProcessProdLineBo.java | 83 +++++++ .../mes/domain/bo/ProdBaseProcessUserBo.java | 81 +++++++ .../mes/domain/vo/ProdBaseProcessInfoVo.java | 17 +- .../domain/vo/ProdBaseProcessProdLineVo.java | 62 +++++ .../mes/domain/vo/ProdBaseProcessUserVo.java | 68 ++++++ .../mes/mapper/ProdBaseProcessInfoMapper.java | 111 +++++++++ .../mapper/ProdBaseProcessProdLineMapper.java | 15 ++ .../mes/mapper/ProdBaseProcessUserMapper.java | 15 ++ .../service/IProdBaseProcessInfoService.java | 8 + .../IProdBaseProcessProdLineService.java | 69 ++++++ .../service/IProdBaseProcessUserService.java | 69 ++++++ .../impl/ProdBaseProcessInfoServiceImpl.java | 171 ++++++++++++- .../ProdBaseProcessProdLineServiceImpl.java | 133 ++++++++++ .../impl/ProdBaseProcessUserServiceImpl.java | 134 +++++++++++ .../mapper/mes/ProdBaseProcessInfoMapper.xml | 227 ++++++++++++++++++ .../mes/ProdBaseProcessProdLineMapper.xml | 7 + .../mapper/mes/ProdBaseProcessUserMapper.xml | 7 + 24 files changed, 1692 insertions(+), 3 deletions(-) create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdBaseProcessProdLineController.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdBaseProcessUserController.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseProcessProdLine.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseProcessUser.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseProcessProdLineBo.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseProcessUserBo.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseProcessProdLineVo.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseProcessUserVo.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseProcessProdLineMapper.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseProcessUserMapper.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseProcessProdLineService.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseProcessUserService.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseProcessProdLineServiceImpl.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseProcessUserServiceImpl.java create mode 100644 ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseProcessProdLineMapper.xml create mode 100644 ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseProcessUserMapper.xml diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdBaseProcessInfoController.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdBaseProcessInfoController.java index 47dbd872..18be5f6c 100644 --- a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdBaseProcessInfoController.java +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdBaseProcessInfoController.java @@ -95,11 +95,22 @@ public class ProdBaseProcessInfoController extends BaseController { @SaCheckPermission("mes:baseProcessInfo:edit") @Log(title = "工序信息", businessType = BusinessType.UPDATE) @RepeatSubmit() - @PutMapping() + @PutMapping("/edit") public R edit(@Validated(EditGroup.class) @RequestBody ProdBaseProcessInfoBo bo) { return toAjax(prodBaseProcessInfoService.updateByBo(bo)); } + /** + * 修改工序信息 + */ + @SaCheckPermission("mes:baseProcessInfo:edit") + @Log(title = "工序信息", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping("/editUser") + public R editUser(@Validated(EditGroup.class) @RequestBody ProdBaseProcessInfoBo bo) { + return toAjax(prodBaseProcessInfoService.updateByBoUser(bo)); + } + /** * 删除工序信息 * diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdBaseProcessProdLineController.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdBaseProcessProdLineController.java new file mode 100644 index 00000000..2db606de --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdBaseProcessProdLineController.java @@ -0,0 +1,117 @@ +package org.dromara.mes.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.mes.domain.vo.ProdBaseProcessProdLineVo; +import org.dromara.mes.domain.bo.ProdBaseProcessProdLineBo; +import org.dromara.mes.service.IProdBaseProcessProdLineService; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 工序关联产线 + * 前端访问路由地址为:/mes/prodBaseProcessProdLine + * + * @author LionLi + * @date 2025-01-09 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/prodBaseProcessProdLine") +public class ProdBaseProcessProdLineController extends BaseController { + + private final IProdBaseProcessProdLineService prodBaseProcessProdLineService; + + /** + * 查询工序关联产线列表 + */ + @SaCheckPermission("mes:prodBaseProcessProdLine:list") + @GetMapping("/list") + public TableDataInfo list(ProdBaseProcessProdLineBo bo, PageQuery pageQuery) { + return prodBaseProcessProdLineService.queryPageList(bo, pageQuery); + } + + /** + * 导出工序关联产线列表 + */ + @SaCheckPermission("mes:prodBaseProcessProdLine:export") + @Log(title = "工序关联产线", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(ProdBaseProcessProdLineBo bo, HttpServletResponse response) { + List list = prodBaseProcessProdLineService.queryList(bo); + ExcelUtil.exportExcel(list, "工序关联产线", ProdBaseProcessProdLineVo.class, response); + } + + /** + * 获取工序关联产线详细信息 + * + * @param processId 主键 + */ + @SaCheckPermission("mes:prodBaseProcessProdLine:query") + @GetMapping("/{processId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long processId) { + return R.ok(prodBaseProcessProdLineService.queryById(processId)); + } + + /** + * 新增工序关联产线 + */ + @SaCheckPermission("mes:prodBaseProcessProdLine:add") + @Log(title = "工序关联产线", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody ProdBaseProcessProdLineBo bo) { + return toAjax(prodBaseProcessProdLineService.insertByBo(bo)); + } + + /** + * 修改工序关联产线 + */ + @SaCheckPermission("mes:prodBaseProcessProdLine:edit") + @Log(title = "工序关联产线", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody ProdBaseProcessProdLineBo bo) { + return toAjax(prodBaseProcessProdLineService.updateByBo(bo)); + } + + /** + * 删除工序关联产线 + * + * @param processIds 主键串 + */ + @SaCheckPermission("mes:prodBaseProcessProdLine:remove") + @Log(title = "工序关联产线", businessType = BusinessType.DELETE) + @DeleteMapping("/{processIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] processIds) { + return toAjax(prodBaseProcessProdLineService.deleteWithValidByIds(List.of(processIds), true)); + } + + + /** + * 下拉框查询工序关联产线列表 + */ + + @GetMapping("getProdBaseProcessProdLineList") + public R> getProdBaseProcessProdLinelist(ProdBaseProcessProdLineBo bo) { + List list = prodBaseProcessProdLineService.queryList(bo); + return R.ok(list); + } +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdBaseProcessUserController.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdBaseProcessUserController.java new file mode 100644 index 00000000..2c4e3ae8 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/controller/ProdBaseProcessUserController.java @@ -0,0 +1,117 @@ +package org.dromara.mes.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.mes.domain.vo.ProdBaseProcessUserVo; +import org.dromara.mes.domain.bo.ProdBaseProcessUserBo; +import org.dromara.mes.service.IProdBaseProcessUserService; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 工序关联人员 + * 前端访问路由地址为:/mes/prodBaseProcessUser + * + * @author zangch + * @date 2025-01-09 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/prodBaseProcessUser") +public class ProdBaseProcessUserController extends BaseController { + + private final IProdBaseProcessUserService prodBaseProcessUserService; + + /** + * 查询工序关联人员列表 + */ + @SaCheckPermission("mes:prodBaseProcessUser:list") + @GetMapping("/list") + public TableDataInfo list(ProdBaseProcessUserBo bo, PageQuery pageQuery) { + return prodBaseProcessUserService.queryPageList(bo, pageQuery); + } + + /** + * 导出工序关联人员列表 + */ + @SaCheckPermission("mes:prodBaseProcessUser:export") + @Log(title = "工序关联人员", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(ProdBaseProcessUserBo bo, HttpServletResponse response) { + List list = prodBaseProcessUserService.queryList(bo); + ExcelUtil.exportExcel(list, "工序关联人员", ProdBaseProcessUserVo.class, response); + } + + /** + * 获取工序关联人员详细信息 + * + * @param processId 主键 + */ + @SaCheckPermission("mes:prodBaseProcessUser:query") + @GetMapping("/{processId}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable Long processId) { + return R.ok(prodBaseProcessUserService.queryById(processId)); + } + + /** + * 新增工序关联人员 + */ + @SaCheckPermission("mes:prodBaseProcessUser:add") + @Log(title = "工序关联人员", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody ProdBaseProcessUserBo bo) { + return toAjax(prodBaseProcessUserService.insertByBo(bo)); + } + + /** + * 修改工序关联人员 + */ + @SaCheckPermission("mes:prodBaseProcessUser:edit") + @Log(title = "工序关联人员", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody ProdBaseProcessUserBo bo) { + return toAjax(prodBaseProcessUserService.updateByBo(bo)); + } + + /** + * 删除工序关联人员 + * + * @param processIds 主键串 + */ + @SaCheckPermission("mes:prodBaseProcessUser:remove") + @Log(title = "工序关联人员", businessType = BusinessType.DELETE) + @DeleteMapping("/{processIds}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] processIds) { + return toAjax(prodBaseProcessUserService.deleteWithValidByIds(List.of(processIds), true)); + } + + + /** + * 下拉框查询工序关联人员列表 + */ + + @GetMapping("getProdBaseProcessUserList") + public R> getProdBaseProcessUserlist(ProdBaseProcessUserBo bo) { + List list = prodBaseProcessUserService.queryList(bo); + return R.ok(list); + } +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseProcessInfo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseProcessInfo.java index 01c9eca1..9b9c10c2 100644 --- a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseProcessInfo.java +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseProcessInfo.java @@ -6,6 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serial; +import java.util.List; /** * 工序信息对象 prod_base_process_info @@ -62,5 +63,18 @@ public class ProdBaseProcessInfo extends TenantEntity { */ private String remark; + /** + * 工序关联产线信息 + */ + @TableField(exist = false) + private List prodBaseProcessProdlineList;//工序关联产线信息,映射字段 + + /** 工序关联人员信息 */ + @TableField(exist = false) + private List prodBaseProcessUserList;//工序关联人员信息,映射字段 + + @TableField(exist = false) + private String processPercentage;//映射字段 + } diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseProcessProdLine.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseProcessProdLine.java new file mode 100644 index 00000000..1a6a60b3 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseProcessProdLine.java @@ -0,0 +1,69 @@ +package org.dromara.mes.domain; + +import com.fasterxml.jackson.annotation.JsonInclude; +import org.dromara.common.tenant.core.TenantEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serial; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * 工序关联产线对象 prod_base_process_prod_line + * + * @author LionLi + * @date 2025-01-09 + */ +@Data +@EqualsAndHashCode() +@TableName("prod_base_process_prod_line") +public class ProdBaseProcessProdLine { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 工序ID + */ + private Long processId; + + /** + * 所属产线ID + */ + private Long prodLineId; + + + + /*删除继承BaseEntity*/ + /** + * 请求参数 + */ + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @TableField(exist = false) + private Map params = new HashMap<>(); + /** + * 创建部门 + */ + @TableField(fill = FieldFill.INSERT) + private Long createDept; + + /** + * 创建者 + */ + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** + * 租户编号 + */ + private String tenantId; +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseProcessUser.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseProcessUser.java new file mode 100644 index 00000000..4576ea18 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/ProdBaseProcessUser.java @@ -0,0 +1,73 @@ +package org.dromara.mes.domain; + +import com.fasterxml.jackson.annotation.JsonInclude; +import org.dromara.common.tenant.core.TenantEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serial; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * 工序关联人员对象 prod_base_process_user + * + * @author zangch + * @date 2025-01-09 + */ +@Data +@EqualsAndHashCode() +@TableName("prod_base_process_user") +public class ProdBaseProcessUser { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 工序ID + */ + private Long processId; + + /** + * 用户ID + */ + private Long userId; + + /** + * 用户名称 + */ + private String userName; + + + /*删除继承BaseEntity*/ + /** + * 请求参数 + */ + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @TableField(exist = false) + private Map params = new HashMap<>(); + /** + * 创建部门 + */ + @TableField(fill = FieldFill.INSERT) + private Long createDept; + + /** + * 创建者 + */ + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + /** + * 租户编号 + */ + private String tenantId; +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseProcessInfoBo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseProcessInfoBo.java index 8e4daea9..d9ff840b 100644 --- a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseProcessInfoBo.java +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseProcessInfoBo.java @@ -1,5 +1,6 @@ package org.dromara.mes.domain.bo; +import com.baomidou.mybatisplus.annotation.TableField; import org.dromara.mes.domain.ProdBaseProcessInfo; import org.dromara.common.mybatis.core.domain.BaseEntity; import org.dromara.common.core.validate.AddGroup; @@ -8,6 +9,10 @@ import io.github.linpeilie.annotations.AutoMapper; import lombok.Data; import lombok.EqualsAndHashCode; import jakarta.validation.constraints.*; +import org.dromara.mes.domain.ProdBaseProcessProdLine; +import org.dromara.mes.domain.ProdBaseProcessUser; + +import java.util.List; /** * 工序信息业务对象 prod_base_process_info @@ -65,4 +70,14 @@ public class ProdBaseProcessInfoBo extends BaseEntity { private String remark; + /** + * 工序关联产线信息 + */ + private List prodBaseProcessProdlineBoList;//工序关联产线信息,映射字段 + + /** 工序关联人员信息 */ + private List prodBaseProcessUserBoList;//工序关联人员信息,映射字段 + + private String processPercentageBo;//映射字段 + } diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseProcessProdLineBo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseProcessProdLineBo.java new file mode 100644 index 00000000..f1e4d151 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseProcessProdLineBo.java @@ -0,0 +1,83 @@ +package org.dromara.mes.domain.bo; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import org.dromara.mes.domain.ProdBaseProcessProdLine; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * 工序关联产线业务对象 prod_base_process_prod_line + * + * @author LionLi + * @date 2025-01-09 + */ +@Data +@EqualsAndHashCode() +@AutoMapper(target = ProdBaseProcessProdLine.class, reverseConvertGenerate = false) +public class ProdBaseProcessProdLineBo { + + /** + * 工序ID + */ + @NotNull(message = "工序ID不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long processId; + + /** + * 所属产线ID + */ + @NotNull(message = "所属产线ID不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long prodLineId; + + + /** + * 搜索值 + */ + @JsonIgnore + @TableField(exist = false) + private String searchValue; + + /** + * 创建部门 + */ + @TableField(fill = FieldFill.INSERT) + private Long createDept; + + /** + * 创建者 + */ + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + + /** + * 请求参数 + */ + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @TableField(exist = false) + private Map params = new HashMap<>(); + + /** + * 租户编号 + */ + @TableField(exist = false) + private String tenantId; + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseProcessUserBo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseProcessUserBo.java new file mode 100644 index 00000000..d3a1eb65 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/bo/ProdBaseProcessUserBo.java @@ -0,0 +1,81 @@ +package org.dromara.mes.domain.bo; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import org.dromara.mes.domain.ProdBaseProcessUser; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * 工序关联人员业务对象 prod_base_process_user + * + * @author zangch + * @date 2025-01-09 + */ +@Data +@EqualsAndHashCode() +@AutoMapper(target = ProdBaseProcessUser.class, reverseConvertGenerate = false) +public class ProdBaseProcessUserBo { + + /** + * 工序ID + */ + @NotNull(message = "工序ID不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long processId; + + /** + * 用户ID + */ + @NotNull(message = "用户ID不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long userId; + + /** + * 用户名称 + */ + private String userName; + + /** + * 搜索值 + */ + @JsonIgnore + @TableField(exist = false) + private String searchValue; + + /** + * 创建部门 + */ + @TableField(fill = FieldFill.INSERT) + private Long createDept; + + /** + * 创建者 + */ + @TableField(fill = FieldFill.INSERT) + private Long createBy; + + /** + * 创建时间 + */ + @TableField(fill = FieldFill.INSERT) + private Date createTime; + + + /** + * 请求参数 + */ + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @TableField(exist = false) + private Map params = new HashMap<>(); + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseProcessInfoVo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseProcessInfoVo.java index 638cacc4..d8bc63da 100644 --- a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseProcessInfoVo.java +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseProcessInfoVo.java @@ -1,5 +1,6 @@ package org.dromara.mes.domain.vo; +import com.baomidou.mybatisplus.annotation.TableField; import org.dromara.mes.domain.ProdBaseProcessInfo; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; @@ -7,11 +8,13 @@ import org.dromara.common.excel.annotation.ExcelDictFormat; import org.dromara.common.excel.convert.ExcelDictConvert; import io.github.linpeilie.annotations.AutoMapper; import lombok.Data; +import org.dromara.mes.domain.ProdBaseProcessProdLine; +import org.dromara.mes.domain.ProdBaseProcessUser; import java.io.Serial; import java.io.Serializable; import java.util.Date; - +import java.util.List; /** @@ -115,5 +118,17 @@ public class ProdBaseProcessInfoVo implements Serializable { @ExcelProperty(value = "更新时间") private Date updateTime; + /** + * 工序关联产线信息 + */ + + private List prodBaseProcessProdlineVoList;//工序关联产线信息,映射字段 + + /** 工序关联人员信息 */ + + private List prodBaseProcessUserVoList;//工序关联人员信息,映射字段 + + + private String processPercentageVo;//映射字段 } diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseProcessProdLineVo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseProcessProdLineVo.java new file mode 100644 index 00000000..ff80acff --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseProcessProdLineVo.java @@ -0,0 +1,62 @@ +package org.dromara.mes.domain.vo; + +import org.dromara.mes.domain.ProdBaseProcessProdLine; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 工序关联产线视图对象 prod_base_process_prod_line + * + * @author LionLi + * @date 2025-01-09 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = ProdBaseProcessProdLine.class) +public class ProdBaseProcessProdLineVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 工序ID + */ + @ExcelProperty(value = "工序ID") + private Long processId; + + /** + * 所属产线ID + */ + @ExcelProperty(value = "所属产线ID") + private Long prodLineId; + + /** + * 租户编号 + */ + @ExcelProperty(value = "租户编号") + private String tenantId; + + /** + * 创建人 + */ + @ExcelProperty(value = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @ExcelProperty(value = "创建时间") + private Date createTime; + + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseProcessUserVo.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseProcessUserVo.java new file mode 100644 index 00000000..3e3aca57 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/domain/vo/ProdBaseProcessUserVo.java @@ -0,0 +1,68 @@ +package org.dromara.mes.domain.vo; + +import org.dromara.mes.domain.ProdBaseProcessUser; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 工序关联人员视图对象 prod_base_process_user + * + * @author zangch + * @date 2025-01-09 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = ProdBaseProcessUser.class) +public class ProdBaseProcessUserVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 工序ID + */ + @ExcelProperty(value = "工序ID") + private Long processId; + + /** + * 用户ID + */ + @ExcelProperty(value = "用户ID") + private Long userId; + + /** + * 租户编号 + */ + @ExcelProperty(value = "租户编号") + private String tenantId; + + /** + * 用户名称 + */ + @ExcelProperty(value = "用户名称") + private String userName; + + /** + * 创建人 + */ + @ExcelProperty(value = "创建人") + private String createBy; + + /** + * 创建时间 + */ + @ExcelProperty(value = "创建时间") + private Date createTime; + + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseProcessInfoMapper.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseProcessInfoMapper.java index 266f79b3..a4b4990f 100644 --- a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseProcessInfoMapper.java +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseProcessInfoMapper.java @@ -1,9 +1,16 @@ package org.dromara.mes.mapper; import org.dromara.mes.domain.ProdBaseProcessInfo; +import org.dromara.mes.domain.ProdBaseProcessProdLine; +import org.dromara.mes.domain.ProdBaseProcessUser; +import org.dromara.mes.domain.bo.ProdBaseProcessInfoBo; +import org.dromara.mes.domain.bo.ProdBaseProcessProdLineBo; +import org.dromara.mes.domain.bo.ProdBaseProcessUserBo; import org.dromara.mes.domain.vo.ProdBaseProcessInfoVo; import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; +import java.util.List; + /** * 工序信息Mapper接口 * @@ -12,4 +19,108 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; */ public interface ProdBaseProcessInfoMapper extends BaseMapperPlus { + /** + * 查询工序信息 + * + * @param processId 工序信息主键 + * @return 工序信息 + */ + public ProdBaseProcessInfo selectProdBaseProcessInfoByProcessId(Long processId); + + /** + * 获取工序用户信息详细信息 + * @param processId 工序信息主键 + * @return 工序信息 + */ + public ProdBaseProcessInfo selectProdBaseProcessInfoUserByProcessId(Long processId); + + /** + * 查询工序信息列表 + * + * @param prodBaseProcessInfo 工序信息 + * @return 工序信息集合 + */ + public List selectProdBaseProcessInfoList(ProdBaseProcessInfoBo prodBaseProcessInfo); + + /** + * 新增工序信息 + * + * @param prodBaseProcessInfo 工序信息 + * @return 结果 + */ + public int insertProdBaseProcessInfo(ProdBaseProcessInfoBo prodBaseProcessInfo); + + /** + * 修改工序信息 + * + * @param prodBaseProcessInfo 工序信息 + * @return 结果 + */ + public int updateProdBaseProcessInfo(ProdBaseProcessInfoBo prodBaseProcessInfo); + + /** + * 删除工序信息 + * + * @param processId 工序信息主键 + * @return 结果 + */ + public int deleteProdBaseProcessInfoByProcessId(Long processId); + + /** + * 批量删除工序信息 + * + * @param processIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteProdBaseProcessInfoByProcessIds(Long[] processIds); + + /** + * 批量删除工序关联产线 + * + * @param processIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteProdBaseProcessProdlineByProcessIds(Long[] processIds); + + /** + * 批量新增工序关联产线 + * + * @param prodBaseProcessProdlineList 工序关联产线列表 + * @return 结果 + */ + public int batchProdBaseProcessProdline(List prodBaseProcessProdlineList); + + + /** + * 通过工序信息主键删除工序关联产线信息 + * + * @param processId 工序信息ID + * @return 结果 + */ + public int deleteProdBaseProcessProdlineByProcessId(Long processId); + + /** + * 批量删除工序关联人员 + * + * @param processIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteProdBaseProcessUserByProcessIds(Long[] processIds); + + /** + * 批量新增工序关联人员 + * + * @param prodBaseProcessUserList 工序关联人员列表 + * @return 结果 + */ + public int batchProdBaseProcessUser(List prodBaseProcessUserList); + + + /** + * 通过工序信息主键删除工序关联人员信息 + * + * @param processId 工序信息ID + * @return 结果 + */ + public int deleteProdBaseProcessUserByProcessId(Long processId); } diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseProcessProdLineMapper.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseProcessProdLineMapper.java new file mode 100644 index 00000000..4210a214 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseProcessProdLineMapper.java @@ -0,0 +1,15 @@ +package org.dromara.mes.mapper; + +import org.dromara.mes.domain.ProdBaseProcessProdLine; +import org.dromara.mes.domain.vo.ProdBaseProcessProdLineVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 工序关联产线Mapper接口 + * + * @author LionLi + * @date 2025-01-09 + */ +public interface ProdBaseProcessProdLineMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseProcessUserMapper.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseProcessUserMapper.java new file mode 100644 index 00000000..b402f29b --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/mapper/ProdBaseProcessUserMapper.java @@ -0,0 +1,15 @@ +package org.dromara.mes.mapper; + +import org.dromara.mes.domain.ProdBaseProcessUser; +import org.dromara.mes.domain.vo.ProdBaseProcessUserVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 工序关联人员Mapper接口 + * + * @author zangch + * @date 2025-01-09 + */ +public interface ProdBaseProcessUserMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseProcessInfoService.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseProcessInfoService.java index ff842986..b2910c03 100644 --- a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseProcessInfoService.java +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseProcessInfoService.java @@ -57,6 +57,14 @@ public interface IProdBaseProcessInfoService { */ Boolean updateByBo(ProdBaseProcessInfoBo bo); + /** + * 修改工序信息关联用户 + * + * @param bo 工序信息 + * @return 是否修改成功 + */ + Boolean updateByBoUser(ProdBaseProcessInfoBo bo); + /** * 校验并批量删除工序信息信息 * diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseProcessProdLineService.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseProcessProdLineService.java new file mode 100644 index 00000000..df81b3d3 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseProcessProdLineService.java @@ -0,0 +1,69 @@ +package org.dromara.mes.service; + +import org.dromara.mes.domain.ProdBaseProcessProdLine; +import org.dromara.mes.domain.vo.ProdBaseProcessProdLineVo; +import org.dromara.mes.domain.bo.ProdBaseProcessProdLineBo; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; + +import java.util.Collection; +import java.util.List; + +/** + * 工序关联产线Service接口 + * + * @author LionLi + * @date 2025-01-09 + */ +public interface IProdBaseProcessProdLineService { + + /** + * 查询工序关联产线 + * + * @param processId 主键 + * @return 工序关联产线 + */ + ProdBaseProcessProdLineVo queryById(Long processId); + + /** + * 分页查询工序关联产线列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 工序关联产线分页列表 + */ + TableDataInfo queryPageList(ProdBaseProcessProdLineBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的工序关联产线列表 + * + * @param bo 查询条件 + * @return 工序关联产线列表 + */ + List queryList(ProdBaseProcessProdLineBo bo); + + /** + * 新增工序关联产线 + * + * @param bo 工序关联产线 + * @return 是否新增成功 + */ + Boolean insertByBo(ProdBaseProcessProdLineBo bo); + + /** + * 修改工序关联产线 + * + * @param bo 工序关联产线 + * @return 是否修改成功 + */ + Boolean updateByBo(ProdBaseProcessProdLineBo bo); + + /** + * 校验并批量删除工序关联产线信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseProcessUserService.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseProcessUserService.java new file mode 100644 index 00000000..d5a454bb --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/IProdBaseProcessUserService.java @@ -0,0 +1,69 @@ +package org.dromara.mes.service; + +import org.dromara.mes.domain.ProdBaseProcessUser; +import org.dromara.mes.domain.vo.ProdBaseProcessUserVo; +import org.dromara.mes.domain.bo.ProdBaseProcessUserBo; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; + +import java.util.Collection; +import java.util.List; + +/** + * 工序关联人员Service接口 + * + * @author zangch + * @date 2025-01-09 + */ +public interface IProdBaseProcessUserService { + + /** + * 查询工序关联人员 + * + * @param processId 主键 + * @return 工序关联人员 + */ + ProdBaseProcessUserVo queryById(Long processId); + + /** + * 分页查询工序关联人员列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 工序关联人员分页列表 + */ + TableDataInfo queryPageList(ProdBaseProcessUserBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的工序关联人员列表 + * + * @param bo 查询条件 + * @return 工序关联人员列表 + */ + List queryList(ProdBaseProcessUserBo bo); + + /** + * 新增工序关联人员 + * + * @param bo 工序关联人员 + * @return 是否新增成功 + */ + Boolean insertByBo(ProdBaseProcessUserBo bo); + + /** + * 修改工序关联人员 + * + * @param bo 工序关联人员 + * @return 是否修改成功 + */ + Boolean updateByBo(ProdBaseProcessUserBo bo); + + /** + * 校验并批量删除工序关联人员信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseProcessInfoServiceImpl.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseProcessInfoServiceImpl.java index d2315644..0c784a44 100644 --- a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseProcessInfoServiceImpl.java +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseProcessInfoServiceImpl.java @@ -1,5 +1,9 @@ package org.dromara.mes.service.impl; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.util.ObjectUtil; +import org.dromara.common.core.exception.ServiceException; +import org.dromara.common.core.utils.DateUtils; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.mybatis.core.page.TableDataInfo; @@ -8,13 +12,24 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.github.yulichang.toolkit.JoinWrappers; import com.github.yulichang.wrapper.MPJLambdaWrapper; import lombok.RequiredArgsConstructor; +import org.dromara.common.satoken.utils.LoginHelper; +import org.dromara.mes.domain.ProdBaseProcessProdLine; +import org.dromara.mes.domain.ProdBaseProcessUser; +import org.dromara.mes.domain.bo.ProdBaseProcessProdLineBo; +import org.dromara.mes.domain.bo.ProdBaseProcessUserBo; +import org.dromara.mes.domain.vo.ProdBaseProcessProdLineVo; +import org.dromara.mes.domain.vo.ProdBaseProcessUserVo; +import org.dromara.mes.mapper.ProdBaseProcessProdLineMapper; +import org.dromara.mes.mapper.ProdBaseProcessUserMapper; import org.springframework.stereotype.Service; import org.dromara.mes.domain.bo.ProdBaseProcessInfoBo; import org.dromara.mes.domain.vo.ProdBaseProcessInfoVo; import org.dromara.mes.domain.ProdBaseProcessInfo; import org.dromara.mes.mapper.ProdBaseProcessInfoMapper; import org.dromara.mes.service.IProdBaseProcessInfoService; +import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Collection; @@ -31,6 +46,16 @@ public class ProdBaseProcessInfoServiceImpl implements IProdBaseProcessInfoServi private final ProdBaseProcessInfoMapper baseMapper; + private final ProdBaseProcessUserServiceImpl prodBaseProcessUserService; + + private final ProdBaseProcessProdLineServiceImpl prodBaseProcessProdlineService; + + private final ProdBaseProcessUserMapper prodBaseProcessUserMapper; + private final ProdBaseProcessProdLineMapper prodBaseProcessProdlineMapper; + + + + /** * 查询工序信息 * @@ -39,7 +64,23 @@ public class ProdBaseProcessInfoServiceImpl implements IProdBaseProcessInfoServi */ @Override public ProdBaseProcessInfoVo queryById(Long processId){ - return baseMapper.selectVoById(processId); + ProdBaseProcessInfoVo prodBaseProcessInfoVo = baseMapper.selectVoById(processId); + if (ObjectUtil.isNotEmpty(prodBaseProcessInfoVo)) { + // 关联人员 + ProdBaseProcessUserBo prodBaseProcessUserBo = new ProdBaseProcessUserBo(); + prodBaseProcessUserBo.setProcessId(processId); + List prodBaseProcessUserVoList = prodBaseProcessUserService.queryList(prodBaseProcessUserBo); + // 关联人员若有数据,则赋值给prodBaseProcessInfoVo + if(ObjectUtil.isNotEmpty(prodBaseProcessUserVoList)) prodBaseProcessInfoVo.setProdBaseProcessUserVoList(prodBaseProcessUserVoList); + + // 关联产线 + ProdBaseProcessProdLineBo prodBaseProcessProdlineBo = new ProdBaseProcessProdLineBo(); + prodBaseProcessProdlineBo.setProcessId(processId); + List prodBaseProcessProdlineVoList = prodBaseProcessProdlineService.queryList(prodBaseProcessProdlineBo); + // 关联产线若有数据,则赋值给prodBaseProcessInfoVo + if(ObjectUtil.isNotEmpty(prodBaseProcessProdlineVoList)) prodBaseProcessInfoVo.setProdBaseProcessProdlineVoList(prodBaseProcessProdlineVoList); + } + return prodBaseProcessInfoVo; } /** @@ -72,6 +113,17 @@ public class ProdBaseProcessInfoServiceImpl implements IProdBaseProcessInfoServi Map params = bo.getParams(); MPJLambdaWrapper lqw = JoinWrappers.lambda(ProdBaseProcessInfo.class) .selectAll(ProdBaseProcessInfo.class) + +/* // 关联人员 + .select(ProdBaseProcessUser::getUserId) + .select(ProdBaseProcessUser::getUserName) + .leftJoin(ProdBaseProcessUser.class, ProdBaseProcessUser::getProcessId, ProdBaseProcessInfo::getProcessId) + + // 关联产线 + .select(ProdBaseProcessProdLine::getProdLineId) + .leftJoin(ProdBaseProcessProdLine.class, ProdBaseProcessProdLine::getProcessId, ProdBaseProcessInfo::getProcessId)*/ + + .eq(bo.getProcessId() != null, ProdBaseProcessInfo::getProcessId, bo.getProcessId()) .eq(StringUtils.isNotBlank(bo.getProcessCode()), ProdBaseProcessInfo::getProcessCode, bo.getProcessCode()) .like(StringUtils.isNotBlank(bo.getProcessName()), ProdBaseProcessInfo::getProcessName, bo.getProcessName()) @@ -106,13 +158,76 @@ public class ProdBaseProcessInfoServiceImpl implements IProdBaseProcessInfoServi * @param bo 工序信息 * @return 是否修改成功 */ + @Transactional @Override public Boolean updateByBo(ProdBaseProcessInfoBo bo) { ProdBaseProcessInfo update = MapstructUtils.convert(bo, ProdBaseProcessInfo.class); + + String tenantId = LoginHelper.getTenantId(); + Long deptId = LoginHelper.getDeptId(); + Long userId = LoginHelper.getUserId(); + if (ObjectUtil.isNotEmpty(tenantId)) update.setTenantId(tenantId); + if (ObjectUtil.isNotEmpty(deptId)) update.setCreateDept(deptId); + if (ObjectUtil.isNotEmpty(userId)) update.setCreateBy(userId); + update.setCreateTime(DateUtils.getNowDate()); + + + validEntityBeforeSave(update); + + List prodBaseProcessProdlineList = new ArrayList<>(); + List prodBaseProcessProdlineBoList = bo.getProdBaseProcessProdlineBoList(); + if(ObjectUtil.isNotEmpty(prodBaseProcessProdlineBoList)){ + prodBaseProcessProdlineList = MapstructUtils.convert(prodBaseProcessProdlineBoList, ProdBaseProcessProdLine.class); + update.setProdBaseProcessProdlineList(prodBaseProcessProdlineList); + } + baseMapper.deleteProdBaseProcessProdlineByProcessId(update.getProcessId()); + try { + insertProdBaseProcessProdline(update); + }catch (Exception e){ + throw new ServiceException("该工序已关联产线!"); + } + return baseMapper.updateById(update) > 0; + } + + /** + * 修改工序信息关联人员 + * + * @param bo 工序信息 + * @return 是否修改成功 + */ + @Transactional + @Override + public Boolean updateByBoUser(ProdBaseProcessInfoBo bo) { + ProdBaseProcessInfo update = MapstructUtils.convert(bo, ProdBaseProcessInfo.class); + + String tenantId = LoginHelper.getTenantId();// 获取当前租户ID + Long deptId = LoginHelper.getDeptId();// 获取当前部门ID + Long userId = LoginHelper.getUserId();// 获取当前用户ID + if (ObjectUtil.isNotEmpty(tenantId)) update.setTenantId(tenantId);// 设置当前租户ID + if (ObjectUtil.isNotEmpty(deptId)) update.setCreateDept(deptId);// 设置当前部门ID + if (ObjectUtil.isNotEmpty(userId)) update.setCreateBy(userId);// 设置当前用户ID + update.setCreateTime(DateUtils.getNowDate());// 设置当前时间 + validEntityBeforeSave(update); + + List prodBaseProcessUserList = new ArrayList<>(); + List prodBaseProcessUserBoList = bo.getProdBaseProcessUserBoList(); + if(ObjectUtil.isNotEmpty(prodBaseProcessUserBoList)){ + prodBaseProcessUserList = MapstructUtils.convert(prodBaseProcessUserBoList, ProdBaseProcessUser.class); + } + baseMapper.deleteProdBaseProcessUserByProcessId(update.getProcessId()); + update.setProdBaseProcessUserList(prodBaseProcessUserList); + try { + insertProdBaseProcessUser(update); + }catch (Exception e){ + System.out.println(e.getMessage()); + throw new ServiceException("该工序已关联用户!"); + } return baseMapper.updateById(update) > 0; } + + /** * 保存前的数据校验 */ @@ -134,4 +249,58 @@ public class ProdBaseProcessInfoServiceImpl implements IProdBaseProcessInfoServi } return baseMapper.deleteByIds(ids) > 0; } + + /** + * 新增工序关联产线信息 + * + * @param prodBaseProcessInfo 工序信息对象 + */ + public void insertProdBaseProcessProdline(ProdBaseProcessInfo prodBaseProcessInfo) { + List prodBaseProcessProdlineList = prodBaseProcessInfo.getProdBaseProcessProdlineList(); + Long processId = prodBaseProcessInfo.getProcessId(); + if (ObjectUtil.isNotNull(prodBaseProcessProdlineList)) { + List list = new ArrayList(); + for (ProdBaseProcessProdLine prodBaseProcessProdline : prodBaseProcessProdlineList) { + prodBaseProcessProdline.setCreateBy(prodBaseProcessInfo.getCreateBy()); + prodBaseProcessProdline.setCreateTime(prodBaseProcessInfo.getCreateTime()); + prodBaseProcessProdline.setCreateDept(prodBaseProcessInfo.getCreateDept()); + prodBaseProcessProdline.setTenantId(prodBaseProcessInfo.getTenantId()); + list.add(prodBaseProcessProdline); + } + if (!list.isEmpty()) { + prodBaseProcessProdlineMapper.insertBatch(list); + } + } + } + /** + * 新增工序关联用户信息 + * + * @param prodBaseProcessInfo 工序信息对象 + */ + public void insertProdBaseProcessUser(ProdBaseProcessInfo prodBaseProcessInfo) { + List prodBaseProcessUserList = prodBaseProcessInfo.getProdBaseProcessUserList(); + Long processId = prodBaseProcessInfo.getProcessId(); + if (ObjectUtil.isNotNull(prodBaseProcessUserList)) { + List list = new ArrayList(); + for (ProdBaseProcessUser prodBaseProcessUser : prodBaseProcessUserList) { + prodBaseProcessUser.setCreateBy(prodBaseProcessInfo.getCreateBy()); + prodBaseProcessUser.setCreateTime(prodBaseProcessInfo.getCreateTime()); + prodBaseProcessUser.setCreateDept(prodBaseProcessInfo.getCreateDept()); + prodBaseProcessUser.setTenantId(prodBaseProcessInfo.getTenantId()); + + Long userId = prodBaseProcessUser.getUserId(); + + + + + list.add(prodBaseProcessUser); + } + if (!list.isEmpty()) { + prodBaseProcessUserMapper.insertBatch(list); + } + } + } + + + } diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseProcessProdLineServiceImpl.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseProcessProdLineServiceImpl.java new file mode 100644 index 00000000..f2e85200 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseProcessProdLineServiceImpl.java @@ -0,0 +1,133 @@ +package org.dromara.mes.service.impl; + +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.yulichang.toolkit.JoinWrappers; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.dromara.mes.domain.bo.ProdBaseProcessProdLineBo; +import org.dromara.mes.domain.vo.ProdBaseProcessProdLineVo; +import org.dromara.mes.domain.ProdBaseProcessProdLine; +import org.dromara.mes.mapper.ProdBaseProcessProdLineMapper; +import org.dromara.mes.service.IProdBaseProcessProdLineService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 工序关联产线Service业务层处理 + * + * @author LionLi + * @date 2025-01-09 + */ +@RequiredArgsConstructor +@Service +public class ProdBaseProcessProdLineServiceImpl implements IProdBaseProcessProdLineService { + + private final ProdBaseProcessProdLineMapper baseMapper; + + /** + * 查询工序关联产线 + * + * @param processId 主键 + * @return 工序关联产线 + */ + @Override + public ProdBaseProcessProdLineVo queryById(Long processId){ + return baseMapper.selectVoById(processId); + } + + /** + * 分页查询工序关联产线列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 工序关联产线分页列表 + */ + @Override + public TableDataInfo queryPageList(ProdBaseProcessProdLineBo bo, PageQuery pageQuery) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的工序关联产线列表 + * + * @param bo 查询条件 + * @return 工序关联产线列表 + */ + @Override + public List queryList(ProdBaseProcessProdLineBo bo) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private MPJLambdaWrapper buildQueryWrapper(ProdBaseProcessProdLineBo bo) { + Map params = bo.getParams(); + MPJLambdaWrapper lqw = JoinWrappers.lambda(ProdBaseProcessProdLine.class) + .selectAll(ProdBaseProcessProdLine.class) + .eq(bo.getProcessId() != null, ProdBaseProcessProdLine::getProcessId, bo.getProcessId()) + .eq(bo.getProdLineId() != null, ProdBaseProcessProdLine::getProdLineId, bo.getProdLineId()) + .orderByDesc(ProdBaseProcessProdLine::getCreateTime); + return lqw; + } + + /** + * 新增工序关联产线 + * + * @param bo 工序关联产线 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(ProdBaseProcessProdLineBo bo) { + ProdBaseProcessProdLine add = MapstructUtils.convert(bo, ProdBaseProcessProdLine.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setProcessId(add.getProcessId()); + } + return flag; + } + + /** + * 修改工序关联产线 + * + * @param bo 工序关联产线 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(ProdBaseProcessProdLineBo bo) { + ProdBaseProcessProdLine update = MapstructUtils.convert(bo, ProdBaseProcessProdLine.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(ProdBaseProcessProdLine entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 校验并批量删除工序关联产线信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteByIds(ids) > 0; + } +} diff --git a/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseProcessUserServiceImpl.java b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseProcessUserServiceImpl.java new file mode 100644 index 00000000..5f48228d --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/java/org/dromara/mes/service/impl/ProdBaseProcessUserServiceImpl.java @@ -0,0 +1,134 @@ +package org.dromara.mes.service.impl; + +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.github.yulichang.toolkit.JoinWrappers; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.dromara.mes.domain.bo.ProdBaseProcessUserBo; +import org.dromara.mes.domain.vo.ProdBaseProcessUserVo; +import org.dromara.mes.domain.ProdBaseProcessUser; +import org.dromara.mes.mapper.ProdBaseProcessUserMapper; +import org.dromara.mes.service.IProdBaseProcessUserService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 工序关联人员Service业务层处理 + * + * @author zangch + * @date 2025-01-09 + */ +@RequiredArgsConstructor +@Service +public class ProdBaseProcessUserServiceImpl implements IProdBaseProcessUserService { + + private final ProdBaseProcessUserMapper baseMapper; + + /** + * 查询工序关联人员 + * + * @param processId 主键 + * @return 工序关联人员 + */ + @Override + public ProdBaseProcessUserVo queryById(Long processId){ + return baseMapper.selectVoById(processId); + } + + /** + * 分页查询工序关联人员列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 工序关联人员分页列表 + */ + @Override + public TableDataInfo queryPageList(ProdBaseProcessUserBo bo, PageQuery pageQuery) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的工序关联人员列表 + * + * @param bo 查询条件 + * @return 工序关联人员列表 + */ + @Override + public List queryList(ProdBaseProcessUserBo bo) { + MPJLambdaWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private MPJLambdaWrapper buildQueryWrapper(ProdBaseProcessUserBo bo) { + Map params = bo.getParams(); + MPJLambdaWrapper lqw = JoinWrappers.lambda(ProdBaseProcessUser.class) + .selectAll(ProdBaseProcessUser.class) + .eq(bo.getProcessId() != null, ProdBaseProcessUser::getProcessId, bo.getProcessId()) + .eq(bo.getUserId() != null, ProdBaseProcessUser::getUserId, bo.getUserId()) + .like(StringUtils.isNotBlank(bo.getUserName()), ProdBaseProcessUser::getUserName, bo.getUserName()) + .orderByDesc(ProdBaseProcessUser::getCreateTime); + return lqw; + } + + /** + * 新增工序关联人员 + * + * @param bo 工序关联人员 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(ProdBaseProcessUserBo bo) { + ProdBaseProcessUser add = MapstructUtils.convert(bo, ProdBaseProcessUser.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setProcessId(add.getProcessId()); + } + return flag; + } + + /** + * 修改工序关联人员 + * + * @param bo 工序关联人员 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(ProdBaseProcessUserBo bo) { + ProdBaseProcessUser update = MapstructUtils.convert(bo, ProdBaseProcessUser.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(ProdBaseProcessUser entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 校验并批量删除工序关联人员信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteByIds(ids) > 0; + } +} diff --git a/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseProcessInfoMapper.xml b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseProcessInfoMapper.xml index 18d57939..4a07d0f1 100644 --- a/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseProcessInfoMapper.xml +++ b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseProcessInfoMapper.xml @@ -4,4 +4,231 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select process_id, + process_code, + process_name, + process_type, + process_floor, + production_time, + active_flag, + remark, + create_by, + create_time, + update_by, + update_time, + tenant_id + from prod_base_process_info + + + + + + + + + + insert into prod_base_process_info + + process_code, + process_name, + process_type, + process_floor, + production_time, + active_flag, + remark, + create_by, + create_time, + update_by, + update_time, + tenant_id, + + + #{processCode}, + #{processName}, + #{processType}, + #{processFloor}, + #{productionTime}, + #{activeFlag}, + #{remark}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + #{tenantId}, + + + + + update prod_base_process_info + + process_code = #{processCode}, + process_name = #{processName}, + process_type = #{processType}, + process_floor = #{processFloor}, + production_time = #{productionTime}, + active_flag = #{activeFlag}, + remark = #{remark}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + tenant_id = #{tenantId}, + + where process_id = #{processId} + + + + delete + from prod_base_process_info + where process_id = #{processId} + + + + delete from prod_base_process_info where process_id in + + #{processId} + + + + + delete from prod_base_process_prod_line where process_id in + + #{processId} + + + + + delete + from prod_base_process_prod_line + where process_id = #{processId} + + + + insert into prod_base_process_prod_line( process_id, prod_line_id) values + + ( #{item.processId}, #{item.prodlineId}) + + + + + delete from prod_base_process_user where process_id in + + #{processId} + + + + + delete from prod_base_process_user where process_id = #{processId} + + + + insert into prod_base_process_user( process_id, user_id, user_name, create_by, create_time,tenant_id) values + + ( #{item.processId}, #{item.userId}, #{item.userName}, #{item.createBy}, #{item.createTime}, #{item.tenantId}) + + diff --git a/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseProcessProdLineMapper.xml b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseProcessProdLineMapper.xml new file mode 100644 index 00000000..8ec747e4 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseProcessProdLineMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseProcessUserMapper.xml b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseProcessUserMapper.xml new file mode 100644 index 00000000..f5dfb377 --- /dev/null +++ b/ruoyi-modules/hwmom-mes/src/main/resources/mapper/mes/ProdBaseProcessUserMapper.xml @@ -0,0 +1,7 @@ + + + + +