diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/MesCalPlanTeamController.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/MesCalPlanTeamController.java index 529fbbb..185d73b 100644 --- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/MesCalPlanTeamController.java +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/MesCalPlanTeamController.java @@ -1,11 +1,15 @@ package cn.iocoder.yudao.module.mes.controller.admin.cal.plan; +import cn.hutool.core.collection.CollUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.module.mes.controller.admin.cal.plan.vo.team.MesCalPlanTeamRespVO; import cn.iocoder.yudao.module.mes.controller.admin.cal.plan.vo.team.MesCalPlanTeamSaveReqVO; import cn.iocoder.yudao.module.mes.dal.dataobject.cal.plan.MesCalPlanTeamDO; +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.team.MesCalTeamDO; import cn.iocoder.yudao.module.mes.service.cal.plan.MesCalPlanTeamService; +import cn.iocoder.yudao.module.mes.service.cal.team.MesCalTeamService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; @@ -16,6 +20,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Map; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @@ -27,6 +32,8 @@ public class MesCalPlanTeamController { @Resource private MesCalPlanTeamService planTeamService; + @Resource + private MesCalTeamService teamService; @PostMapping("/create") @Operation(summary = "创建计划班组关联") @@ -50,8 +57,22 @@ public class MesCalPlanTeamController { @PreAuthorize("@ss.hasPermission('mes:cal-plan:query')") public CommonResult> getPlanTeamListByPlan(@RequestParam("planId") Long planId) { List list = planTeamService.getPlanTeamListByPlanId(planId); - // TODO @芋艿:拼装班组编码/名称,等 cal_team 迁移后对接 - return success(BeanUtils.toBean(list, MesCalPlanTeamRespVO.class)); + List respList = BeanUtils.toBean(list, MesCalPlanTeamRespVO.class); + // 拼装班组编码/名称 + if (CollUtil.isNotEmpty(respList)) { + // TODO @AI:teamService.getTeamMap(ids),里面调用 teamService.getTeamList(ids) + List teamIds = CollectionUtils.convertList(respList, MesCalPlanTeamRespVO::getTeamId); + Map teamMap = CollectionUtils.convertMap( + teamService.getTeamList(), MesCalTeamDO::getId); + respList.forEach(resp -> { + MesCalTeamDO team = teamMap.get(resp.getTeamId()); + if (team != null) { + resp.setTeamCode(team.getCode()); + resp.setTeamName(team.getName()); + } + }); + } + return success(respList); } } diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/vo/team/MesCalPlanTeamRespVO.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/vo/team/MesCalPlanTeamRespVO.java index 789daff..fc2a838 100644 --- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/vo/team/MesCalPlanTeamRespVO.java +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/vo/team/MesCalPlanTeamRespVO.java @@ -18,11 +18,9 @@ public class MesCalPlanTeamRespVO { @Schema(description = "班组编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") private Long teamId; - // TODO @芋艿:等 cal_team 迁移后,通过 teamId 关联查询填充 @Schema(description = "班组编码", example = "T001") private String teamCode; - // TODO @芋艿:等 cal_team 迁移后,通过 teamId 关联查询填充 @Schema(description = "班组名称", example = "A组") private String teamName; diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/MesCalTeamController.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/MesCalTeamController.java new file mode 100644 index 0000000..5ba5108 --- /dev/null +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/MesCalTeamController.java @@ -0,0 +1,101 @@ +package cn.iocoder.yudao.module.mes.controller.admin.cal.team; + +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.MesCalTeamPageReqVO; +import cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.MesCalTeamRespVO; +import cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.MesCalTeamSaveReqVO; +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.team.MesCalTeamDO; +import cn.iocoder.yudao.module.mes.service.cal.team.MesCalTeamService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.Valid; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.io.IOException; +import java.util.List; + +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - MES 班组") +@RestController +@RequestMapping("/mes/cal/team") +@Validated +public class MesCalTeamController { + + @Resource + private MesCalTeamService teamService; + + @PostMapping("/create") + @Operation(summary = "创建班组") + @PreAuthorize("@ss.hasPermission('mes:cal-team:create')") + public CommonResult createTeam(@Valid @RequestBody MesCalTeamSaveReqVO createReqVO) { + return success(teamService.createTeam(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新班组") + @PreAuthorize("@ss.hasPermission('mes:cal-team:update')") + public CommonResult updateTeam(@Valid @RequestBody MesCalTeamSaveReqVO updateReqVO) { + teamService.updateTeam(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除班组") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('mes:cal-team:delete')") + public CommonResult deleteTeam(@RequestParam("id") Long id) { + teamService.deleteTeam(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得班组") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('mes:cal-team:query')") + public CommonResult getTeam(@RequestParam("id") Long id) { + MesCalTeamDO team = teamService.getTeam(id); + return success(BeanUtils.toBean(team, MesCalTeamRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得班组分页") + @PreAuthorize("@ss.hasPermission('mes:cal-team:query')") + public CommonResult> getTeamPage(@Valid MesCalTeamPageReqVO pageReqVO) { + PageResult pageResult = teamService.getTeamPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, MesCalTeamRespVO.class)); + } + + @GetMapping("/list") + @Operation(summary = "获得班组列表") + @PreAuthorize("@ss.hasPermission('mes:cal-team:query')") + public CommonResult> getTeamList() { + List list = teamService.getTeamList(); + return success(BeanUtils.toBean(list, MesCalTeamRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出班组 Excel") + @PreAuthorize("@ss.hasPermission('mes:cal-team:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportTeamExcel(@Valid MesCalTeamPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = teamService.getTeamPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "班组.xls", "数据", MesCalTeamRespVO.class, + BeanUtils.toBean(list, MesCalTeamRespVO.class)); + } + +} diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/MesCalTeamMemberController.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/MesCalTeamMemberController.java new file mode 100644 index 0000000..bef76d9 --- /dev/null +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/MesCalTeamMemberController.java @@ -0,0 +1,88 @@ +package cn.iocoder.yudao.module.mes.controller.admin.cal.team; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.member.MesCalTeamMemberPageReqVO; +import cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.member.MesCalTeamMemberRespVO; +import cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.member.MesCalTeamMemberSaveReqVO; +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.team.MesCalTeamMemberDO; +import cn.iocoder.yudao.module.mes.service.cal.team.MesCalTeamMemberService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.validation.Valid; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.Collection; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - MES 班组成员") +@RestController +@RequestMapping("/mes/cal/team-member") +@Validated +public class MesCalTeamMemberController { + + @Resource + private MesCalTeamMemberService teamMemberService; + + @PostMapping("/create") + @Operation(summary = "创建班组成员") + @PreAuthorize("@ss.hasPermission('mes:cal-team:create')") + public CommonResult createTeamMember(@Valid @RequestBody MesCalTeamMemberSaveReqVO createReqVO) { + return success(teamMemberService.createTeamMember(createReqVO)); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除班组成员") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('mes:cal-team:delete')") + public CommonResult deleteTeamMember(@RequestParam("id") Long id) { + teamMemberService.deleteTeamMember(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得班组成员") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('mes:cal-team:query')") + public CommonResult getTeamMember(@RequestParam("id") Long id) { + MesCalTeamMemberDO member = teamMemberService.getTeamMember(id); + return success(BeanUtils.toBean(member, MesCalTeamMemberRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得班组成员分页") + @PreAuthorize("@ss.hasPermission('mes:cal-team:query')") + public CommonResult> getTeamMemberPage(@Valid MesCalTeamMemberPageReqVO pageReqVO) { + PageResult pageResult = teamMemberService.getTeamMemberPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, MesCalTeamMemberRespVO.class)); + } + + // TODO @AI:getTeamMemberListByTeam、getTeamMemberListByTeamIds 融合下,允许传递 teamId、teamIds; + + @GetMapping("/list-by-team") + @Operation(summary = "获得指定班组的成员列表") + @Parameter(name = "teamId", description = "班组编号", required = true) + @PreAuthorize("@ss.hasPermission('mes:cal-team:query')") + public CommonResult> getTeamMemberListByTeam(@RequestParam("teamId") Long teamId) { + List list = teamMemberService.getTeamMemberListByTeamId(teamId); + return success(BeanUtils.toBean(list, MesCalTeamMemberRespVO.class)); + } + + @GetMapping("/list-by-team-ids") + @Operation(summary = "获得指定多个班组的成员列表") + @Parameter(name = "teamIds", description = "班组编号列表", required = true) + @PreAuthorize("@ss.hasPermission('mes:cal-team:query')") + public CommonResult> getTeamMemberListByTeamIds( + @RequestParam("teamIds") Collection teamIds) { + List list = teamMemberService.getTeamMemberListByTeamIds(teamIds); + return success(BeanUtils.toBean(list, MesCalTeamMemberRespVO.class)); + } + +} diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/MesCalTeamShiftController.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/MesCalTeamShiftController.java new file mode 100644 index 0000000..9bf9995 --- /dev/null +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/MesCalTeamShiftController.java @@ -0,0 +1,40 @@ +package cn.iocoder.yudao.module.mes.controller.admin.cal.team; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.shift.MesCalTeamShiftListReqVO; +import cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.shift.MesCalTeamShiftRespVO; +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.team.MesCalTeamShiftDO; +import cn.iocoder.yudao.module.mes.service.cal.team.MesCalTeamShiftService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.validation.Valid; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +@Tag(name = "管理后台 - MES 班组排班") +@RestController +@RequestMapping("/mes/cal/team-shift") +@Validated +public class MesCalTeamShiftController { + + @Resource + private MesCalTeamShiftService teamShiftService; + + @GetMapping("/list") + @Operation(summary = "获得班组排班列表") + @PreAuthorize("@ss.hasPermission('mes:cal-team-shift:query')") + public CommonResult> getTeamShiftList(@Valid MesCalTeamShiftListReqVO reqVO) { + List list = teamShiftService.getTeamShiftList(reqVO); + return success(BeanUtils.toBean(list, MesCalTeamShiftRespVO.class)); + } + +} diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/MesCalTeamPageReqVO.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/MesCalTeamPageReqVO.java new file mode 100644 index 0000000..ddc3681 --- /dev/null +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/MesCalTeamPageReqVO.java @@ -0,0 +1,24 @@ +package cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Schema(description = "管理后台 - MES 班组分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class MesCalTeamPageReqVO extends PageParam { + + @Schema(description = "班组编码", example = "TEAM-A") + private String code; + + @Schema(description = "班组名称", example = "注塑") + private String name; + + @Schema(description = "班组类型", example = "1") + private Integer calendarType; + +} diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/MesCalTeamRespVO.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/MesCalTeamRespVO.java new file mode 100644 index 0000000..d829e04 --- /dev/null +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/MesCalTeamRespVO.java @@ -0,0 +1,51 @@ +package cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo; + +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; +import cn.idev.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - MES 班组 Response VO") +@Data +@ExcelIgnoreUnannotated +public class MesCalTeamRespVO { + + @Schema(description = "班组编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + @ExcelProperty("班组编号") + private Long id; + + @Schema(description = "班组编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "TEAM-A") + @ExcelProperty("班组编码") + private String code; + + @Schema(description = "班组名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "注塑A组") + @ExcelProperty("班组名称") + private String name; + + @Schema(description = "班组类型", example = "1") + @ExcelProperty("班组类型") + private Integer calendarType; + + @Schema(description = "备注") + @ExcelProperty("备注") + private String remark; + + @Schema(description = "预留字段1") + private String attribute1; + + @Schema(description = "预留字段2") + private String attribute2; + + @Schema(description = "预留字段3") + private Integer attribute3; + + @Schema(description = "预留字段4") + private Integer attribute4; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/MesCalTeamSaveReqVO.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/MesCalTeamSaveReqVO.java new file mode 100644 index 0000000..df316c9 --- /dev/null +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/MesCalTeamSaveReqVO.java @@ -0,0 +1,40 @@ +package cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; +import lombok.Data; + +@Schema(description = "管理后台 - MES 班组新增/修改 Request VO") +@Data +public class MesCalTeamSaveReqVO { + + @Schema(description = "班组编号", example = "1024") + private Long id; + + @Schema(description = "班组编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "TEAM-A") + @NotEmpty(message = "班组编码不能为空") + private String code; + + @Schema(description = "班组名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "注塑A组") + @NotEmpty(message = "班组名称不能为空") + private String name; + + @Schema(description = "班组类型", example = "1") + private Integer calendarType; + + @Schema(description = "备注") + private String remark; + + @Schema(description = "预留字段1") + private String attribute1; + + @Schema(description = "预留字段2") + private String attribute2; + + @Schema(description = "预留字段3") + private Integer attribute3; + + @Schema(description = "预留字段4") + private Integer attribute4; + +} diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/member/MesCalTeamMemberPageReqVO.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/member/MesCalTeamMemberPageReqVO.java new file mode 100644 index 0000000..c225375 --- /dev/null +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/member/MesCalTeamMemberPageReqVO.java @@ -0,0 +1,20 @@ +package cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.member; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Schema(description = "管理后台 - MES 班组成员分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class MesCalTeamMemberPageReqVO extends PageParam { + + @Schema(description = "班组编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "201") + @NotNull(message = "班组编号不能为空") + private Long teamId; + +} diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/member/MesCalTeamMemberRespVO.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/member/MesCalTeamMemberRespVO.java new file mode 100644 index 0000000..649054f --- /dev/null +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/member/MesCalTeamMemberRespVO.java @@ -0,0 +1,48 @@ +package cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.member; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - MES 班组成员 Response VO") +@Data +public class MesCalTeamMemberRespVO { + + @Schema(description = "班组成员编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long id; + + @Schema(description = "班组编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "201") + private Long teamId; + + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Long userId; + + @Schema(description = "用户名", example = "admin") + private String userName; + + @Schema(description = "用户昵称", example = "管理员") + private String nickname; + + @Schema(description = "电话", example = "13800138000") + private String telephone; + + @Schema(description = "备注") + private String remark; + + @Schema(description = "预留字段1") + private String attribute1; + + @Schema(description = "预留字段2") + private String attribute2; + + @Schema(description = "预留字段3") + private Integer attribute3; + + @Schema(description = "预留字段4") + private Integer attribute4; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; + +} diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/member/MesCalTeamMemberSaveReqVO.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/member/MesCalTeamMemberSaveReqVO.java new file mode 100644 index 0000000..8d2a934 --- /dev/null +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/member/MesCalTeamMemberSaveReqVO.java @@ -0,0 +1,37 @@ +package cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.member; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +@Schema(description = "管理后台 - MES 班组成员新增 Request VO") +@Data +public class MesCalTeamMemberSaveReqVO { + + @Schema(description = "班组成员编号", example = "1024") + private Long id; + + @Schema(description = "班组编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "201") + @NotNull(message = "班组编号不能为空") + private Long teamId; + + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotNull(message = "用户编号不能为空") + private Long userId; + + @Schema(description = "备注") + private String remark; + + @Schema(description = "预留字段1") + private String attribute1; + + @Schema(description = "预留字段2") + private String attribute2; + + @Schema(description = "预留字段3") + private Integer attribute3; + + @Schema(description = "预留字段4") + private Integer attribute4; + +} diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/shift/MesCalTeamShiftListReqVO.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/shift/MesCalTeamShiftListReqVO.java new file mode 100644 index 0000000..9895364 --- /dev/null +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/shift/MesCalTeamShiftListReqVO.java @@ -0,0 +1,29 @@ +package cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.shift; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - MES 班组排班列表 Request VO") +@Data +public class MesCalTeamShiftListReqVO { + + @Schema(description = "班组编号", example = "201") + private Long teamId; + + @Schema(description = "排班计划编号", example = "1") + private Long planId; + + @Schema(description = "开始日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime startDay; + + @Schema(description = "结束日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime endDay; + +} diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/shift/MesCalTeamShiftRespVO.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/shift/MesCalTeamShiftRespVO.java new file mode 100644 index 0000000..8019d5e --- /dev/null +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/shift/MesCalTeamShiftRespVO.java @@ -0,0 +1,54 @@ +package cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.shift; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - MES 班组排班 Response VO") +@Data +public class MesCalTeamShiftRespVO { + + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") + private Long id; + + @Schema(description = "排班计划编号", example = "1") + private Long planId; + + @Schema(description = "班组编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "201") + private Long teamId; + + @Schema(description = "班组名称", example = "注塑A组") + private String teamName; + + @Schema(description = "班次编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Long shiftId; + + @Schema(description = "班次名称", example = "白班") + private String shiftName; + + @Schema(description = "日期", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime day; + + @Schema(description = "排序", example = "1") + private Integer sort; + + @Schema(description = "备注") + private String remark; + + @Schema(description = "预留字段1") + private String attribute1; + + @Schema(description = "预留字段2") + private String attribute2; + + @Schema(description = "预留字段3") + private Integer attribute3; + + @Schema(description = "预留字段4") + private Integer attribute4; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + private LocalDateTime createTime; + +} diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/cal/plan/MesCalPlanTeamDO.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/cal/plan/MesCalPlanTeamDO.java index b66c0dc..6ad2419 100644 --- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/cal/plan/MesCalPlanTeamDO.java +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/cal/plan/MesCalPlanTeamDO.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.mes.dal.dataobject.cal.plan; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.team.MesCalTeamDO; import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; @@ -35,7 +36,7 @@ public class MesCalPlanTeamDO extends BaseDO { /** * 班组编号 * - * TODO @AI:关联 cal_team 表,等 cal_team 迁移后补充 + * 关联 {@link MesCalTeamDO#getId()} */ private Long teamId; /** diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/cal/team/MesCalTeamDO.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/cal/team/MesCalTeamDO.java new file mode 100644 index 0000000..9ec8abf --- /dev/null +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/cal/team/MesCalTeamDO.java @@ -0,0 +1,65 @@ +package cn.iocoder.yudao.module.mes.dal.dataobject.cal.team; + +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.module.mes.enums.cal.MesCalCalendarTypeEnum; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +/** + * MES 班组 DO + * + * @author 芋道源码 + */ +@TableName("mes_cal_team") +@KeySequence("mes_cal_team_seq") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class MesCalTeamDO extends BaseDO { + + /** + * 班组编号 + */ + @TableId + private Long id; + /** + * 班组编码 + */ + private String code; + /** + * 班组名称 + */ + private String name; + /** + * 班组类型 + * + * 枚举 {@link MesCalCalendarTypeEnum} + */ + private Integer calendarType; + /** + * 备注 + */ + private String remark; + /** + * 预留字段1 + */ + private String attribute1; + /** + * 预留字段2 + */ + private String attribute2; + /** + * 预留字段3 + */ + private Integer attribute3; + /** + * 预留字段4 + */ + private Integer attribute4; + +} diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/cal/team/MesCalTeamMemberDO.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/cal/team/MesCalTeamMemberDO.java new file mode 100644 index 0000000..d641fd7 --- /dev/null +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/cal/team/MesCalTeamMemberDO.java @@ -0,0 +1,62 @@ +package cn.iocoder.yudao.module.mes.dal.dataobject.cal.team; + +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +/** + * MES 班组成员 DO + * + * @author 芋道源码 + */ +@TableName("mes_cal_team_member") +@KeySequence("mes_cal_team_member_seq") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class MesCalTeamMemberDO extends BaseDO { + + /** + * 班组成员编号 + */ + @TableId + private Long id; + /** + * 班组编号 + * + * 关联 {@link MesCalTeamDO#getId()} + */ + private Long teamId; + /** + * 用户编号 + * + * 关联 system_users 表 + */ + private Long userId; + /** + * 备注 + */ + private String remark; + /** + * 预留字段1 + */ + private String attribute1; + /** + * 预留字段2 + */ + private String attribute2; + /** + * 预留字段3 + */ + private Integer attribute3; + /** + * 预留字段4 + */ + private Integer attribute4; + +} diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/cal/team/MesCalTeamShiftDO.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/cal/team/MesCalTeamShiftDO.java new file mode 100644 index 0000000..51d97ef --- /dev/null +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/cal/team/MesCalTeamShiftDO.java @@ -0,0 +1,80 @@ +package cn.iocoder.yudao.module.mes.dal.dataobject.cal.team; + +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.plan.MesCalPlanDO; +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.plan.MesCalPlanShiftDO; +import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +import java.time.LocalDateTime; + +/** + * MES 班组排班 DO + * + * @author 芋道源码 + */ +@TableName("mes_cal_team_shift") +@KeySequence("mes_cal_team_shift_seq") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class MesCalTeamShiftDO extends BaseDO { + + /** + * 编号 + */ + @TableId + private Long id; + /** + * 排班计划编号 + * + * 关联 {@link MesCalPlanDO#getId()} + */ + private Long planId; + /** + * 班组编号 + * + * 关联 {@link MesCalTeamDO#getId()} + */ + private Long teamId; + /** + * 班次编号 + * + * 关联 {@link MesCalPlanShiftDO#getId()} + */ + private Long shiftId; + /** + * 日期 + */ + private LocalDateTime day; + /** + * 排序 + */ + private Integer sort; + /** + * 备注 + */ + private String remark; + /** + * 预留字段1 + */ + private String attribute1; + /** + * 预留字段2 + */ + private String attribute2; + /** + * 预留字段3 + */ + private Integer attribute3; + /** + * 预留字段4 + */ + private Integer attribute4; + +} diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/cal/team/MesCalTeamMapper.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/cal/team/MesCalTeamMapper.java new file mode 100644 index 0000000..0befc1c --- /dev/null +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/cal/team/MesCalTeamMapper.java @@ -0,0 +1,30 @@ +package cn.iocoder.yudao.module.mes.dal.mysql.cal.team; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.MesCalTeamPageReqVO; +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.team.MesCalTeamDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * MES 班组 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface MesCalTeamMapper extends BaseMapperX { + + default PageResult selectPage(MesCalTeamPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(MesCalTeamDO::getCode, reqVO.getCode()) + .likeIfPresent(MesCalTeamDO::getName, reqVO.getName()) + .eqIfPresent(MesCalTeamDO::getCalendarType, reqVO.getCalendarType()) + .orderByDesc(MesCalTeamDO::getId)); + } + + default MesCalTeamDO selectByCode(String code) { + return selectOne(MesCalTeamDO::getCode, code); + } + +} diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/cal/team/MesCalTeamMemberMapper.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/cal/team/MesCalTeamMemberMapper.java new file mode 100644 index 0000000..1588d3d --- /dev/null +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/cal/team/MesCalTeamMemberMapper.java @@ -0,0 +1,45 @@ +package cn.iocoder.yudao.module.mes.dal.mysql.cal.team; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.member.MesCalTeamMemberPageReqVO; +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.team.MesCalTeamMemberDO; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Collection; +import java.util.List; + +/** + * MES 班组成员 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface MesCalTeamMemberMapper extends BaseMapperX { + + default PageResult selectPage(MesCalTeamMemberPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(MesCalTeamMemberDO::getTeamId, reqVO.getTeamId()) + .orderByDesc(MesCalTeamMemberDO::getId)); + } + + default List selectListByTeamId(Long teamId) { + return selectList(MesCalTeamMemberDO::getTeamId, teamId); + } + + default List selectListByTeamIds(Collection teamIds) { + return selectList(MesCalTeamMemberDO::getTeamId, teamIds); + } + + default MesCalTeamMemberDO selectByUserIdExcludeId(Long userId, Long excludeId) { + return selectOne(new LambdaQueryWrapperX() + .eq(MesCalTeamMemberDO::getUserId, userId) + .neIfPresent(MesCalTeamMemberDO::getId, excludeId)); + } + + default void deleteByTeamId(Long teamId) { + delete(MesCalTeamMemberDO::getTeamId, teamId); + } + +} diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/cal/team/MesCalTeamShiftMapper.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/cal/team/MesCalTeamShiftMapper.java new file mode 100644 index 0000000..979d80f --- /dev/null +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/cal/team/MesCalTeamShiftMapper.java @@ -0,0 +1,40 @@ +package cn.iocoder.yudao.module.mes.dal.mysql.cal.team; + +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.shift.MesCalTeamShiftListReqVO; +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.team.MesCalTeamShiftDO; +import org.apache.ibatis.annotations.Mapper; + +import java.time.LocalDateTime; +import java.util.List; + +/** + * MES 班组排班 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface MesCalTeamShiftMapper extends BaseMapperX { + + default List selectList(MesCalTeamShiftListReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(MesCalTeamShiftDO::getTeamId, reqVO.getTeamId()) + .eqIfPresent(MesCalTeamShiftDO::getPlanId, reqVO.getPlanId()) + .geIfPresent(MesCalTeamShiftDO::getDay, reqVO.getStartDay()) + .leIfPresent(MesCalTeamShiftDO::getDay, reqVO.getEndDay()) + .orderByAsc(MesCalTeamShiftDO::getDay) + .orderByAsc(MesCalTeamShiftDO::getSort)); + } + + default MesCalTeamShiftDO selectByDayAndTeamId(LocalDateTime day, Long teamId) { + return selectOne(new LambdaQueryWrapperX() + .eq(MesCalTeamShiftDO::getDay, day) + .eq(MesCalTeamShiftDO::getTeamId, teamId)); + } + + default void deleteByPlanId(Long planId) { + delete(MesCalTeamShiftDO::getPlanId, planId); + } + +} diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/cal/plan/MesCalPlanServiceImpl.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/cal/plan/MesCalPlanServiceImpl.java index 2e94f0b..d28d31b 100644 --- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/cal/plan/MesCalPlanServiceImpl.java +++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/cal/plan/MesCalPlanServiceImpl.java @@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.mes.dal.dataobject.cal.plan.MesCalPlanDO; import cn.iocoder.yudao.module.mes.dal.mysql.cal.plan.MesCalPlanMapper; import cn.iocoder.yudao.module.mes.enums.cal.MesCalPlanStatusEnum; import cn.iocoder.yudao.module.mes.enums.cal.MesCalShiftTypeEnum; +import cn.iocoder.yudao.module.mes.service.cal.team.MesCalTeamShiftService; import cn.hutool.core.util.ObjUtil; import jakarta.annotation.Resource; import org.springframework.context.annotation.Lazy; @@ -35,6 +36,9 @@ public class MesCalPlanServiceImpl implements MesCalPlanService { @Resource @Lazy private MesCalPlanTeamService planTeamService; + @Resource + @Lazy + private MesCalTeamShiftService teamShiftService; @Override @Transactional(rollbackFor = Exception.class) @@ -85,7 +89,10 @@ public class MesCalPlanServiceImpl implements MesCalPlanService { updateObj.setId(id); updateObj.setStatus(MesCalPlanStatusEnum.CONFIRMED.getStatus()); planMapper.updateById(updateObj); - // TODO @芋艿:确认时调用 calTeamshiftService.genRecords(planId) 生成排班记录,等 cal_team_shift 迁移后 + + // 3. 生成班组排班记录 + // TODO @AI:方法名,不要缩写; + teamShiftService.genRecords(id); } @Override