合并 mes 代码
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>yudao</artifactId>
|
||||
<artifactId>dsc-mes</artifactId>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
@@ -4,14 +4,87 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
|
||||
/**
|
||||
* product 错误码枚举类
|
||||
*
|
||||
* product 系统,使用 1-xxx-xxx-xxx 段
|
||||
* <p>
|
||||
* 1-030-400-000 ~ 1-030-599-999
|
||||
* <p>
|
||||
* 1-030-400(公共)-xxx
|
||||
* --------------------plan-----------------------
|
||||
* 1-030-411(plan-template)-xxx
|
||||
* 1-030-412(plan-template-column)-xxx
|
||||
* 1-030-413(plan-template-column-data)-xxx
|
||||
* 1-030-414(plan-template-item)-xxx
|
||||
* 1-030-415(factory_plan)-xxx
|
||||
* 1-030-416(factory_plan-column)-xxx
|
||||
* 1-030-417(factory_plan-column-data)-xxx
|
||||
* 1-030-418(factory_plan-item)-xxx
|
||||
* 1-030-419(factory_plan-item-data)-xxx
|
||||
* 1-030-420(company_plan)-xxx
|
||||
* 1-030-421(company_plan-column)-xxx
|
||||
* 1-030-422(company_plan-column-data)-xxx
|
||||
* 1-030-423(company_plan-item)-xxx
|
||||
* 1-030-424(company_plan-item-data)-xxx
|
||||
* -------------------------------------------
|
||||
* -----------------factory-------------------
|
||||
* 1-030-424 工厂模型(factory-model)
|
||||
* -------------------------------------------
|
||||
* -----------------schedule------------------
|
||||
* 1-030-425 排班配置(schedule-config)
|
||||
* 1-030-426 排班班组(schedule-team)
|
||||
* 1-030-427 排班班次(schedule-shift)
|
||||
* 1-030-428 排班规则(schedule-rule)
|
||||
* 1-030-429 排班数据(schedule-data)
|
||||
* -------------------------------------------
|
||||
*
|
||||
* @author ZT
|
||||
*/
|
||||
public interface ErrorCodeConstants {
|
||||
//通用
|
||||
ErrorCode CODE_GENERATION_SERVICE_CALL_FAILED = new ErrorCode(1_030_400_001, "编码生成服务调用失败");
|
||||
|
||||
//计划模板(plan-template)
|
||||
ErrorCode PLAN_TEMPLATE_NOT_EXISTS = new ErrorCode(1_030_411_001, "计划模板不存在");
|
||||
ErrorCode PLAN_TEMPLATE_PLAN_TYPE_IS_NULL = new ErrorCode(1_030_411_002, "计划模板类型为空");
|
||||
ErrorCode PLAN_TEMPLATE_PLAN_TYPE_NOT_EXISTS = new ErrorCode(1_030_411_003, "计划模板类型不存在");
|
||||
ErrorCode PLAN_TEMPLATE_PLAN_FAILED_TO_RETRIEVE_ENCODING = new ErrorCode(1_030_411_004, "计划模板编号获取失败");
|
||||
|
||||
//计划模板动态列(plan-template-column)
|
||||
ErrorCode PLAN_TEMPLATE_COLUMN_NOT_EXISTS = new ErrorCode(1_030_412_001, "计划模板动态列不存在");
|
||||
ErrorCode PLAN_TEMPLATE_COLUMN_OPERATION_ID_IS_NULL = new ErrorCode(1_030_412_002, "计划模板动态列操作标识为空");
|
||||
ErrorCode PLAN_TEMPLATE_COLUMN_ENCODING_INFORMATION_ALREADY_EXISTS = new ErrorCode(1_030_412_003, "计划模板动态列编码不能重复");
|
||||
|
||||
//计划模板动态列数据(plan-template-column-data)
|
||||
ErrorCode PLAN_TEMPLATE_COLUMN_DATA_NOT_EXISTS = new ErrorCode(1_030_413_001, "计划模板动态列结果不存在");
|
||||
|
||||
//计划模板项目(plan-template-item)
|
||||
ErrorCode PLAN_TEMPLATE_ITEM_NOT_EXISTS = new ErrorCode(1_030_414_001, "计划模板项目不存在");
|
||||
ErrorCode PLAN_TEMPLATE_ITEM_OPERATION_ID_IS_NULL = new ErrorCode(1_030_414_002, "计划模板动态列操作标识为空");
|
||||
|
||||
//1_030_424 工厂模型(factory-model)
|
||||
ErrorCode FACTORY_MODEL_NOT_EXISTS = new ErrorCode(1_030_424_001, "工厂模型不存在");
|
||||
ErrorCode FACTORY_MODEL_NODE_CODE_EXISTS = new ErrorCode(1_030_424_002, "节点编码已存在");
|
||||
ErrorCode FACTORY_MODEL_NODE_NAME_EXISTS = new ErrorCode(1_030_424_003, "节点名称已存在");
|
||||
|
||||
//1_030_425 排班配置(schedule-config)
|
||||
ErrorCode SCHEDULE_CONFIG_NOT_EXISTS = new ErrorCode(1_030_425_001, "排班配置不存在");
|
||||
ErrorCode SCHEDULE_CONFIG_CODE_EXISTS = new ErrorCode(1_030_425_002, "排班编码已存在");
|
||||
ErrorCode SCHEDULE_CONFIG_NAME_EXISTS = new ErrorCode(1_030_425_003, "排班名称已存在");
|
||||
|
||||
//1_030_426 排班班组(schedule-team)
|
||||
ErrorCode SCHEDULE_TEAM_NOT_EXISTS = new ErrorCode(1_030_426_001, "排班班组不存在");
|
||||
ErrorCode SCHEDULE_TEAM_NAME_EXISTS = new ErrorCode(1_030_426_002, "排班班组名称重复");
|
||||
ErrorCode SCHEDULE_TEAM_NOT_CREATE = new ErrorCode(1_030_426_003, "排班班组信息未创建");
|
||||
|
||||
//1_030_427 排班班次(schedule-shift)
|
||||
ErrorCode SCHEDULE_SHIFT_NOT_EXISTS = new ErrorCode(1_030_427_001, "排班班次不存在");
|
||||
ErrorCode SCHEDULE_SHIFT_NAME_EXISTS = new ErrorCode(1_030_427_002, "排班班次名称重复");
|
||||
ErrorCode SCHEDULE_SHIFT_NOT_CREATE = new ErrorCode(1_030_427_003, "排班班次信息未创建");
|
||||
|
||||
//1_030_428 排班规则(schedule-rule)
|
||||
ErrorCode SCHEDULE_RULE_NOT_EXISTS = new ErrorCode(1_030_428_001, "排班规则不存在");
|
||||
ErrorCode SCHEDULE_RULE_DATE_EXISTS = new ErrorCode(1_030_428_002, "排班日期重复");
|
||||
|
||||
//1_030_429 排班数据(schedule-data)
|
||||
ErrorCode SCHEDULE_DATA_NOT_EXISTS = new ErrorCode(1_030_429_001, "排班数据不存在");
|
||||
|
||||
// ========== 示例模块 1-001-000-000 ==========
|
||||
ErrorCode EXAMPLE_NOT_EXISTS = new ErrorCode(1_001_000_001, "示例不存在");
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.product.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 计划模板状态
|
||||
*
|
||||
* @author ZT
|
||||
*/
|
||||
@Getter
|
||||
public enum PlanTemplateTypeEnums {
|
||||
Month("M", "月计划", "PLN_TMPL_M"),
|
||||
Day("D", "日计划", "PLN_TMPL_D");
|
||||
|
||||
private final String type;
|
||||
private final String name;
|
||||
private final String codeRule;
|
||||
|
||||
PlanTemplateTypeEnums(String type, String name, String codeRule) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.codeRule = codeRule;
|
||||
}
|
||||
|
||||
// 根据code获取枚举
|
||||
public static String getCodeRuleByType(String type) {
|
||||
for (PlanTemplateTypeEnums templateTypeEnums : values()) {
|
||||
if (templateTypeEnums.type.equals(type)) {
|
||||
return templateTypeEnums.codeRule;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -131,21 +131,21 @@
|
||||
<build>
|
||||
<!-- 设置构建的 jar 包名 -->
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<plugins>
|
||||
<!-- 打包 -->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal> <!-- 将引入的 jar 打入其中 -->
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<!-- <plugins>-->
|
||||
<!-- <!– 打包 –>-->
|
||||
<!-- <plugin>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
|
||||
<!-- <version>${spring.boot.version}</version>-->
|
||||
<!-- <executions>-->
|
||||
<!-- <execution>-->
|
||||
<!-- <goals>-->
|
||||
<!-- <goal>repackage</goal> <!– 将引入的 jar 打入其中 –>-->
|
||||
<!-- </goals>-->
|
||||
<!-- </execution>-->
|
||||
<!-- </executions>-->
|
||||
<!-- </plugin>-->
|
||||
<!-- </plugins>-->
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
*
|
||||
* @author ZT
|
||||
*/
|
||||
@SpringBootApplication
|
||||
//@SpringBootApplication
|
||||
public class ProductServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.factory.model;
|
||||
|
||||
import cn.iocoder.yudao.framework.business.interceptor.BusinessControllerMarker;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.vo.BatchDeleteReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.factory.model.vo.*;
|
||||
import cn.iocoder.yudao.module.product.convert.factory.model.FactoryModelConvert;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.factory.model.FactoryModelDO;
|
||||
import cn.iocoder.yudao.module.product.service.factory.model.FactoryModelService;
|
||||
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.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 工厂模型")
|
||||
@RestController
|
||||
@RequestMapping("/mes/factory-model")
|
||||
@Validated
|
||||
public class FactoryModelController implements BusinessControllerMarker {
|
||||
|
||||
|
||||
@Resource
|
||||
private FactoryModelService factoryModelService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建工厂模型")
|
||||
@PreAuthorize("@ss.hasPermission('mes:factory-model:create')")
|
||||
public CommonResult<FactoryModelRespVO> createFactoryModel(@Valid @RequestBody FactoryModelCreateReqVO createReqVO) {
|
||||
return success(factoryModelService.createFactoryModel(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新工厂模型")
|
||||
@PreAuthorize("@ss.hasPermission('mes:factory-model:update')")
|
||||
public CommonResult<Boolean> updateFactoryModel(@Valid @RequestBody FactoryModelUpdateReqVO updateReqVO) {
|
||||
factoryModelService.updateFactoryModel(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除工厂模型")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('mes:factory-model:delete')")
|
||||
public CommonResult<Boolean> deleteFactoryModel(@RequestParam("id") Long id) {
|
||||
factoryModelService.deleteFactoryModel(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除工厂模型")
|
||||
@PreAuthorize("@ss.hasPermission('mes:factory-model:delete')")
|
||||
public CommonResult<Boolean> deleteFactoryModelList(@RequestBody BatchDeleteReqVO req) {
|
||||
factoryModelService.deleteFactoryModelListByIds(req.getIds());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得工厂模型")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('mes:factory-model:query')")
|
||||
public CommonResult<FactoryModelRespVO> getFactoryModel(@RequestParam("id") Long id) {
|
||||
FactoryModelDO factoryModel = factoryModelService.getFactoryModel(id);
|
||||
return success(FactoryModelConvert.INSTANCE.convert(factoryModel));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得工厂模型分页")
|
||||
@PreAuthorize("@ss.hasPermission('mes:factory-model:query')")
|
||||
public CommonResult<PageResult<FactoryModelRespVO>> getFactoryModelPage(@Valid FactoryModelPageReqVO pageReqVO) {
|
||||
PageResult<FactoryModelDO> pageResult = factoryModelService.getFactoryModelPage(pageReqVO);
|
||||
return success(FactoryModelConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@PutMapping("/process/bind")
|
||||
@Operation(summary = "绑定ERP工序")
|
||||
@PreAuthorize("@ss.hasPermission('mes:factory-model:update')")
|
||||
public CommonResult<Boolean> processBind(@Valid @RequestBody FactoryModelProcessBindReqVO processBindReqVO) {
|
||||
factoryModelService.processBind(processBindReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/process/unbind")
|
||||
@Operation(summary = "解绑ERP工序")
|
||||
@PreAuthorize("@ss.hasPermission('mes:factory-model:update')")
|
||||
public CommonResult<Boolean> processUnbind(@Valid @RequestBody FactoryModelProcessUnbindReqVO processUnbindReqVO) {
|
||||
factoryModelService.processUnbind(processUnbindReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/status")
|
||||
@Operation(summary = "启/停用模型")
|
||||
@PreAuthorize("@ss.hasPermission('mes:factory-model:update')")
|
||||
public CommonResult<Boolean> changeStatus(@Valid @RequestBody FactoryModelChangeStatusReqVO changeStatusReqVO) {
|
||||
factoryModelService.changeStatus(changeStatusReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/tree")
|
||||
@Operation(summary = "工厂模型树")
|
||||
@PreAuthorize("@ss.hasPermission('mes:factory-model:query')")
|
||||
public CommonResult<List<FactoryModeTreeRespVO>> tree(@RequestParam("parentId") Long parentId) {
|
||||
List<FactoryModelDO> data = factoryModelService.tree(parentId);
|
||||
return success(FactoryModelConvert.INSTANCE.convertList(data));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.factory.model.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 工厂模型 Tree Response VO")
|
||||
@Data
|
||||
public class FactoryModeTreeRespVO {
|
||||
@Schema(description = "节点id")
|
||||
private Long id;
|
||||
@Schema(description = "节点编码")
|
||||
private String nodeCoding;
|
||||
@Schema(description = "节点名称")
|
||||
private String nodeName;
|
||||
@Schema(description = "节点类型")
|
||||
private String nodeType;
|
||||
@Schema(description = "父级id")
|
||||
private Long parentId;
|
||||
@Schema(description = "父级编码")
|
||||
private String parentCoding;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.factory.model.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 工厂模型Base VO")
|
||||
@Data
|
||||
public class FactoryModelBaseVO {
|
||||
@Schema(description = "父级id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "父级id不能为空")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "父级编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "父级编码不能为空")
|
||||
private String parentCoding;
|
||||
|
||||
@Schema(description = "节点编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "节点编码不能为空")
|
||||
private String nodeCoding;
|
||||
|
||||
@Schema(description = "节点名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "节点名称不能为空")
|
||||
private String nodeName;
|
||||
|
||||
@Schema(description = "节点类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "节点类型不能为空")
|
||||
private String nodeType;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "ERP工艺路线编码")
|
||||
private String erpProcessRouteCoding;
|
||||
|
||||
@Schema(description = "ERP工序编码")
|
||||
private String erpProcessCoding;
|
||||
|
||||
@Schema(description = "ERP工序名称")
|
||||
private String erpProcessName;
|
||||
|
||||
@Schema(description = "状态")
|
||||
private String nodeStatus;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.factory.model.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 工厂模型修改 Request VO")
|
||||
@Data
|
||||
public class FactoryModelChangeStatusReqVO {
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "工厂模型主键不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "状态",requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "状态不能为空")
|
||||
private String nodeStatus;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.factory.model.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 工厂模型新增 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class FactoryModelCreateReqVO extends FactoryModelBaseVO{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.factory.model.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 工厂模型分页 Request VO")
|
||||
@Data
|
||||
public class FactoryModelPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "父级id")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "节点编码")
|
||||
private String nodeCoding;
|
||||
|
||||
@Schema(description = "节点名称")
|
||||
private String nodeName;
|
||||
|
||||
@Schema(description = "节点类型")
|
||||
private String nodeType;
|
||||
|
||||
@Schema(description = "ERP工序编码")
|
||||
private String erpProcessCoding;
|
||||
|
||||
@Schema(description = "ERP工序名称")
|
||||
private String erpProcessName;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.factory.model.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 工厂模型修改 Request VO")
|
||||
@Data
|
||||
public class FactoryModelProcessBindReqVO {
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "工厂模型主键不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "ERP工艺路线编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "ERP工艺路线编码不能为空")
|
||||
private String erpProcessRouteCoding;
|
||||
|
||||
@Schema(description = "ERP工序编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "ERP工序编码不能为空")
|
||||
private String erpProcessCoding;
|
||||
|
||||
@Schema(description = "ERP工序名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "ERP工序名称不能为空")
|
||||
private String erpProcessName;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.factory.model.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 工厂模型修改 Request VO")
|
||||
@Data
|
||||
public class FactoryModelProcessUnbindReqVO {
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "工厂模型主键不能为空")
|
||||
private Long id;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.factory.model.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 工厂模型 Response VO")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Data
|
||||
public class FactoryModelRespVO extends FactoryModelBaseVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.factory.model.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 工厂模型修改 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class FactoryModelUpdateReqVO extends FactoryModelBaseVO {
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "工厂模型主键不能为空")
|
||||
private Long id;
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.plan.template;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.business.interceptor.BusinessControllerMarker;
|
||||
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.pojo.vo.BatchDeleteReqVO;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.template.vo.PlanTemplateCopyReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.template.vo.PlanTemplatePageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.template.vo.PlanTemplateRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.template.vo.PlanTemplateSaveReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.plan.template.PlanTemplateDO;
|
||||
import cn.iocoder.yudao.module.product.service.plan.template.PlanTemplateService;
|
||||
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 = "管理后台 - 生产计划模板")
|
||||
@RestController
|
||||
@RequestMapping("/mes/product/plan/plan-template")
|
||||
@Validated
|
||||
public class PlanTemplateController implements BusinessControllerMarker {
|
||||
|
||||
@Resource
|
||||
private PlanTemplateService planTemplateService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建生产计划模板")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template:create')")
|
||||
public CommonResult<PlanTemplateRespVO> createPlanTemplate(@Valid @RequestBody PlanTemplateSaveReqVO createReqVO) {
|
||||
return success(planTemplateService.createPlanTemplate(createReqVO));
|
||||
}
|
||||
|
||||
@PostMapping("/copy")
|
||||
@Operation(summary = "复制生产计划模板")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template:copy')")
|
||||
public CommonResult<PlanTemplateRespVO> copyPlanTemplate(@Valid @RequestBody PlanTemplateCopyReqVO copyReqVO) {
|
||||
return success(planTemplateService.copyPlanTemplate(copyReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新生产计划模板")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template:update')")
|
||||
public CommonResult<Boolean> updatePlanTemplate(@Valid @RequestBody PlanTemplateSaveReqVO updateReqVO) {
|
||||
planTemplateService.updatePlanTemplate(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除生产计划模板")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template:delete')")
|
||||
public CommonResult<Boolean> deletePlanTemplate(@RequestParam("id") Long id) {
|
||||
planTemplateService.deletePlanTemplate(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除生产计划模板")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template:delete')")
|
||||
public CommonResult<Boolean> deletePlanTemplateList(@RequestBody BatchDeleteReqVO req) {
|
||||
planTemplateService.deletePlanTemplateListByIds(req.getIds());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得生产计划模板")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan-template:query')")
|
||||
public CommonResult<PlanTemplateRespVO> getPlanTemplate(@RequestParam("id") Long id) {
|
||||
PlanTemplateDO planTemplate = planTemplateService.getPlanTemplate(id);
|
||||
return success(BeanUtils.toBean(planTemplate, PlanTemplateRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得生产计划模板分页")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template:query')")
|
||||
public CommonResult<PageResult<PlanTemplateRespVO>> getPlanTemplatePage(@Valid PlanTemplatePageReqVO pageReqVO) {
|
||||
PageResult<PlanTemplateDO> pageResult = planTemplateService.getPlanTemplatePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, PlanTemplateRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出生产计划模板 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportPlanTemplateExcel(@Valid PlanTemplatePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<PlanTemplateDO> list = planTemplateService.getPlanTemplatePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "生产计划模板.xls", "数据", PlanTemplateRespVO.class,
|
||||
BeanUtils.toBean(list, PlanTemplateRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.plan.template.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 生产计划模板复制 Request VO")
|
||||
@Data
|
||||
public class PlanTemplateCopyReqVO {
|
||||
|
||||
@NotNull(message = "id不能为空")
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "16514")
|
||||
private Long id;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.plan.template.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
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 = "管理后台 - 生产计划模板分页 Request VO")
|
||||
@Data
|
||||
public class PlanTemplatePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "模板编码")
|
||||
private String templateCoding;
|
||||
|
||||
@Schema(description = "模板名称", example = "XX公司XX月计划模板")
|
||||
private String templateName;
|
||||
|
||||
@Schema(description = "模板类型(M:月计划,D:日计划)", example = "M", allowableValues = {"M", "D"})
|
||||
private String planType;
|
||||
|
||||
@Schema(description = "公司编码")
|
||||
private String belongCompanyCoding;
|
||||
|
||||
@Schema(description = "公司名称")
|
||||
private String belongCompanyName;
|
||||
|
||||
@Schema(description = "版本")
|
||||
private Integer templateVersion;
|
||||
|
||||
@Schema(description = "状态(0:未启用,1:启用)", example = "0", allowableValues = {"0", "1"})
|
||||
private String templateStatus;
|
||||
|
||||
@Schema(description = "创建时间(时间戳)")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.plan.template.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 生产计划模板 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class PlanTemplateRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "16514")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "模板编码")
|
||||
@ExcelProperty("模板编码")
|
||||
private String templateCoding;
|
||||
|
||||
@Schema(description = "模板名称")
|
||||
@ExcelProperty("模板名称")
|
||||
private String templateName;
|
||||
|
||||
@Schema(description = "模板类型(M:月计划,D:日计划)", example = "M", allowableValues = {"M", "D"})
|
||||
@ExcelProperty("模板类型")
|
||||
private String planType;
|
||||
|
||||
@Schema(description = "公司编码")
|
||||
@ExcelProperty("公司编码")
|
||||
private String belongCompanyCoding;
|
||||
|
||||
@Schema(description = "公司名称")
|
||||
@ExcelProperty("公司名称")
|
||||
private String belongCompanyName;
|
||||
|
||||
@Schema(description = "版本")
|
||||
@ExcelProperty("版本")
|
||||
private Integer templateVersion;
|
||||
|
||||
@Schema(description = "状态(0:未启用,1:启用)", example = "0", allowableValues = {"0", "1"})
|
||||
@ExcelProperty("状态")
|
||||
private String templateStatus;
|
||||
|
||||
@Schema(description = "创建时间(时间戳)")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.plan.template.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 生产计划模板新增/修改 Request VO")
|
||||
@Data
|
||||
public class PlanTemplateSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", example = "16514")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "模板编码(后台生成)")
|
||||
private String templateCoding;
|
||||
|
||||
@NotBlank(message = "模板名称不能为空")
|
||||
@Schema(description = "模板名称", example = "XX公司XX月计划模板", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String templateName;
|
||||
|
||||
@NotBlank(message = "模板类型不能为空")
|
||||
@Pattern(regexp = "[MD]", message = "只有M|D两种类型")
|
||||
@Schema(description = "模板类型(M:月计划,D:日计划)", example = "M", allowableValues = {"M", "D"}, requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String planType;
|
||||
|
||||
@NotBlank(message = "公司编码不能为空")
|
||||
@Schema(description = "公司编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String belongCompanyCoding;
|
||||
|
||||
@NotBlank(message = "公司名称不能为空")
|
||||
@Schema(description = "公司名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String belongCompanyName;
|
||||
|
||||
@Schema(description = "版本(后台生成)", example = "1")
|
||||
private Integer templateVersion;
|
||||
|
||||
@NotBlank(message = "状态不能为空")
|
||||
@Pattern(regexp = "[01]", message = "只有0|1两种状态")
|
||||
@Schema(description = "状态(0:未启用,1:启用)", example = "0", allowableValues = {"0", "1"})
|
||||
private String templateStatus;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumn;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.business.interceptor.BusinessControllerMarker;
|
||||
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.pojo.vo.BatchDeleteReqVO;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumn.vo.PlanTemplateColumnPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumn.vo.PlanTemplateColumnRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumn.vo.PlanTemplateColumnSaveReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.plan.templatecolumn.PlanTemplateColumnDO;
|
||||
import cn.iocoder.yudao.module.product.service.plan.templatecolumn.PlanTemplateColumnService;
|
||||
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 = "管理后台 - 生产计划模板动态列")
|
||||
@RestController
|
||||
@RequestMapping("/mes/product/plan/plan-template-column")
|
||||
@Validated
|
||||
public class PlanTemplateColumnController implements BusinessControllerMarker {
|
||||
|
||||
|
||||
@Resource
|
||||
private PlanTemplateColumnService planTemplateColumnService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建生产计划模板动态列")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-column:create')")
|
||||
public CommonResult<PlanTemplateColumnRespVO> createPlanTemplateColumn(@Valid @RequestBody PlanTemplateColumnSaveReqVO createReqVO) {
|
||||
return success(planTemplateColumnService.createPlanTemplateColumn(createReqVO));
|
||||
}
|
||||
|
||||
@PostMapping("/saveBatch")
|
||||
@Operation(summary = "创建生产计划模板动态列")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-column:save-batch')")
|
||||
public CommonResult<Boolean> saveBatchPlanTemplateColumn(@Valid @RequestBody List<PlanTemplateColumnSaveReqVO> saveReqVOList) {
|
||||
planTemplateColumnService.saveBatchPlanTemplateColumn(saveReqVOList);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新生产计划模板动态列")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-column:update')")
|
||||
public CommonResult<Boolean> updatePlanTemplateColumn(@Valid @RequestBody PlanTemplateColumnSaveReqVO updateReqVO) {
|
||||
planTemplateColumnService.updatePlanTemplateColumn(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除生产计划模板动态列")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-column:delete')")
|
||||
public CommonResult<Boolean> deletePlanTemplateColumn(@RequestParam("id") Long id) {
|
||||
planTemplateColumnService.deletePlanTemplateColumn(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除生产计划模板动态列")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-column:delete')")
|
||||
public CommonResult<Boolean> deletePlanTemplateColumnList(@RequestBody BatchDeleteReqVO req) {
|
||||
planTemplateColumnService.deletePlanTemplateColumnListByIds(req.getIds());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得生产计划模板动态列")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-column:query')")
|
||||
public CommonResult<PlanTemplateColumnRespVO> getPlanTemplateColumn(@RequestParam("id") Long id) {
|
||||
PlanTemplateColumnDO planTemplateColumn = planTemplateColumnService.getPlanTemplateColumn(id);
|
||||
return success(BeanUtils.toBean(planTemplateColumn, PlanTemplateColumnRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得生产计划模板动态列分页")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-column:query')")
|
||||
public CommonResult<PageResult<PlanTemplateColumnRespVO>> getPlanTemplateColumnPage(@Valid PlanTemplateColumnPageReqVO pageReqVO) {
|
||||
PageResult<PlanTemplateColumnDO> pageResult = planTemplateColumnService.getPlanTemplateColumnPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, PlanTemplateColumnRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出生产计划模板动态列 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-column:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportPlanTemplateColumnExcel(@Valid PlanTemplateColumnPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<PlanTemplateColumnDO> list = planTemplateColumnService.getPlanTemplateColumnPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "生产计划模板动态列.xls", "数据", PlanTemplateColumnRespVO.class,
|
||||
BeanUtils.toBean(list, PlanTemplateColumnRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumn.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 生产计划模板动态列分页 Request VO")
|
||||
@Data
|
||||
public class PlanTemplateColumnPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "模板id")
|
||||
private Long planTemplateId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumn.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 生产计划模板动态列 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class PlanTemplateColumnRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "12305")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "模板id")
|
||||
@ExcelProperty("模板id")
|
||||
private Long planTemplateId;
|
||||
|
||||
@Schema(description = "模板编码")
|
||||
@ExcelProperty("模板编码")
|
||||
private String planTemplateCoding;
|
||||
|
||||
@Schema(description = "列编码")
|
||||
@ExcelProperty("列编码")
|
||||
private String columnCoding;
|
||||
|
||||
@Schema(description = "列名称")
|
||||
@ExcelProperty("列名称")
|
||||
private String columnName;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumn.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 生产计划模板动态列新增/修改 Request VO")
|
||||
@Data
|
||||
public class PlanTemplateColumnSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", example = "12305")
|
||||
private Long id;
|
||||
|
||||
@NotNull(message = "模板id不能为空")
|
||||
@Schema(description = "模板id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long planTemplateId;
|
||||
|
||||
@NotBlank(message = "模板编码不能为空")
|
||||
@Schema(description = "模板编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String planTemplateCoding;
|
||||
|
||||
@NotBlank(message = "列编码不能为空")
|
||||
@Schema(description = "列编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String columnCoding;
|
||||
|
||||
@NotBlank(message = "列名称不能为空")
|
||||
@Schema(description = "列名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String columnName;
|
||||
|
||||
@NotBlank(message = "数据操作类型不能为空")
|
||||
@Pattern(regexp = "INSERT|UPDATE|DELETE", message = "只能使用INSERT|UPDATE|DELETE三种操作类型")
|
||||
@Schema(description = "操作类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "INSERT", allowableValues = {"INSERT","UPDATE","DELETE"})
|
||||
private String operation;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumndata;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.business.interceptor.BusinessControllerMarker;
|
||||
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.pojo.vo.BatchDeleteReqVO;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumndata.vo.PlanTemplateColumnDataPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumndata.vo.PlanTemplateColumnDataRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumndata.vo.PlanTemplateColumnDataSaveReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.plan.templatecolumndata.PlanTemplateColumnDataDO;
|
||||
import cn.iocoder.yudao.module.product.service.plan.templatecolumndata.PlanTemplateColumnDataService;
|
||||
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 = "管理后台 - 生产计划模板动态列数据")
|
||||
@RestController
|
||||
@RequestMapping("/mes/product/plan/plan-template-column-data")
|
||||
@Validated
|
||||
public class PlanTemplateColumnDataController implements BusinessControllerMarker {
|
||||
|
||||
|
||||
@Resource
|
||||
private PlanTemplateColumnDataService planTemplateColumnDataService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建生产计划模板动态列数据")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-column-data:create')")
|
||||
public CommonResult<PlanTemplateColumnDataRespVO> createPlanTemplateColumnData(@Valid @RequestBody PlanTemplateColumnDataSaveReqVO createReqVO) {
|
||||
return success(planTemplateColumnDataService.createPlanTemplateColumnData(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新生产计划模板动态列数据")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-column-data:update')")
|
||||
public CommonResult<Boolean> updatePlanTemplateColumnData(@Valid @RequestBody PlanTemplateColumnDataSaveReqVO updateReqVO) {
|
||||
planTemplateColumnDataService.updatePlanTemplateColumnData(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除生产计划模板动态列数据")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-column-data:delete')")
|
||||
public CommonResult<Boolean> deletePlanTemplateColumnData(@RequestParam("id") Long id) {
|
||||
planTemplateColumnDataService.deletePlanTemplateColumnData(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除生产计划模板动态列数据")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-column-data:delete')")
|
||||
public CommonResult<Boolean> deletePlanTemplateColumnDataList(@RequestBody BatchDeleteReqVO req) {
|
||||
planTemplateColumnDataService.deletePlanTemplateColumnDataListByIds(req.getIds());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得生产计划模板动态列数据")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-column-data:query')")
|
||||
public CommonResult<PlanTemplateColumnDataRespVO> getPlanTemplateColumnData(@RequestParam("id") Long id) {
|
||||
PlanTemplateColumnDataDO planTemplateColumnData = planTemplateColumnDataService.getPlanTemplateColumnData(id);
|
||||
return success(BeanUtils.toBean(planTemplateColumnData, PlanTemplateColumnDataRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得生产计划模板动态列数据分页")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-column-data:query')")
|
||||
public CommonResult<PageResult<PlanTemplateColumnDataRespVO>> getPlanTemplateColumnDataPage(@Valid PlanTemplateColumnDataPageReqVO pageReqVO) {
|
||||
PageResult<PlanTemplateColumnDataDO> pageResult = planTemplateColumnDataService.getPlanTemplateColumnDataPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, PlanTemplateColumnDataRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出生产计划模板动态列数据 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-column-data:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportPlanTemplateColumnDataExcel(@Valid PlanTemplateColumnDataPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<PlanTemplateColumnDataDO> list = planTemplateColumnDataService.getPlanTemplateColumnDataPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "生产计划模板动态列数据.xls", "数据", PlanTemplateColumnDataRespVO.class,
|
||||
BeanUtils.toBean(list, PlanTemplateColumnDataRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumndata.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 生产计划模板动态列数据分页 Request VO")
|
||||
@Data
|
||||
public class PlanTemplateColumnDataPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "模板id")
|
||||
private Long planTemplateTemplateId;
|
||||
|
||||
@Schema(description = "模板动态列id")
|
||||
private Long planTemplateColumnId;
|
||||
|
||||
@Schema(description = "模板明细id")
|
||||
private Long planTemplateItemId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumndata.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 生产计划模板动态列数据 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class PlanTemplateColumnDataRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "15546")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "模板id")
|
||||
@ExcelProperty("模板id")
|
||||
private Long planTemplateTemplateId;
|
||||
|
||||
@Schema(description = "模板动态列id")
|
||||
@ExcelProperty("模板动态列id")
|
||||
private Long planTemplateColumnId;
|
||||
|
||||
@Schema(description = "模板明细id")
|
||||
@ExcelProperty("模板明细id")
|
||||
private Long planTemplateItemId;
|
||||
|
||||
@Schema(description = "动态列编码")
|
||||
@ExcelProperty("动态列编码")
|
||||
private String columnCoding;
|
||||
|
||||
@Schema(description = "动态列值")
|
||||
@ExcelProperty("动态列值")
|
||||
private String columnValue;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumndata.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 生产计划模板动态列数据新增/修改 Request VO")
|
||||
@Data
|
||||
public class PlanTemplateColumnDataSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", example = "15546")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "模板id")
|
||||
private Long planTemplateTemplateId;
|
||||
|
||||
@Schema(description = "模板动态列id")
|
||||
private Long planTemplateColumnId;
|
||||
|
||||
@Schema(description = "模板明细id")
|
||||
private Long planTemplateItemId;
|
||||
|
||||
@Schema(description = "动态列编码")
|
||||
private String columnCoding;
|
||||
|
||||
@Schema(description = "动态列值")
|
||||
private String columnValue;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.plan.templateitem;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.business.interceptor.BusinessControllerMarker;
|
||||
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.pojo.vo.BatchDeleteReqVO;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templateitem.vo.PlanTemplateItemPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templateitem.vo.PlanTemplateItemRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templateitem.vo.PlanTemplateItemSaveReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.plan.templateitem.PlanTemplateItemDO;
|
||||
import cn.iocoder.yudao.module.product.service.plan.templateitem.PlanTemplateItemService;
|
||||
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 = "管理后台 - 生产计划模板项目")
|
||||
@RestController
|
||||
@RequestMapping("/mes/product/plan/plan-template-item")
|
||||
@Validated
|
||||
public class PlanTemplateItemController implements BusinessControllerMarker {
|
||||
|
||||
|
||||
@Resource
|
||||
private PlanTemplateItemService planTemplateItemService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建生产计划模板项目")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-item:create')")
|
||||
public CommonResult<PlanTemplateItemRespVO> createPlanTemplateItem(@Valid @RequestBody PlanTemplateItemSaveReqVO createReqVO) {
|
||||
return success(planTemplateItemService.createPlanTemplateItem(createReqVO));
|
||||
}
|
||||
|
||||
@PostMapping("/saveBatch")
|
||||
@Operation(summary = "创建生产计划模板项目")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-item:save-batch')")
|
||||
public CommonResult<Boolean> saveBatchPlanTemplateItem(@Valid @RequestBody List<PlanTemplateItemSaveReqVO> saveReqVOList) {
|
||||
planTemplateItemService.saveBatchPlanTemplateItem(saveReqVOList);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新生产计划模板项目")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-item:update')")
|
||||
public CommonResult<Boolean> updatePlanTemplateItem(@Valid @RequestBody PlanTemplateItemSaveReqVO updateReqVO) {
|
||||
planTemplateItemService.updatePlanTemplateItem(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除生产计划模板项目")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-item:delete')")
|
||||
public CommonResult<Boolean> deletePlanTemplateItem(@RequestParam("id") Long id) {
|
||||
planTemplateItemService.deletePlanTemplateItem(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除生产计划模板项目")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-item:delete')")
|
||||
public CommonResult<Boolean> deletePlanTemplateItemList(@RequestBody BatchDeleteReqVO req) {
|
||||
planTemplateItemService.deletePlanTemplateItemListByIds(req.getIds());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得生产计划模板项目")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-item:query')")
|
||||
public CommonResult<PlanTemplateItemRespVO> getPlanTemplateItem(@RequestParam("id") Long id) {
|
||||
PlanTemplateItemDO planTemplateItem = planTemplateItemService.getPlanTemplateItem(id);
|
||||
return success(BeanUtils.toBean(planTemplateItem, PlanTemplateItemRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得生产计划模板项目分页")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-item:query')")
|
||||
public CommonResult<PageResult<PlanTemplateItemRespVO>> getPlanTemplateItemPage(@Valid PlanTemplateItemPageReqVO pageReqVO) {
|
||||
return success(planTemplateItemService.getPlanTemplateItemPage(pageReqVO));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出生产计划模板项目 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('product:plan:plan-template-item:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportPlanTemplateItemExcel(@Valid @RequestBody PlanTemplateItemPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<PlanTemplateItemRespVO> list = planTemplateItemService.getPlanTemplateItemPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "生产计划模板项目.xls", "数据", PlanTemplateItemRespVO.class,
|
||||
list);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.plan.templateitem.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 生产计划模板项目分页 Request VO")
|
||||
@Data
|
||||
public class PlanTemplateItemPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "模板id", example = "26659")
|
||||
private Long planTemplateId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.plan.templateitem.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumndata.vo.PlanTemplateColumnDataRespVO;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
@Schema(description = "管理后台 - 生产计划模板项目 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class PlanTemplateItemRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "23213")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "模板id")
|
||||
@ExcelProperty("模板id")
|
||||
private Long planTemplateId;
|
||||
|
||||
@Schema(description = "模板编码")
|
||||
@ExcelProperty("模板编码")
|
||||
private String planTemplateCoding;
|
||||
|
||||
@Schema(description = "计量单位(数据字典)")
|
||||
@ExcelProperty("计量单位")
|
||||
private String unit;
|
||||
|
||||
@Schema(description = "是否生成订单(0:不生成,1:生成)")
|
||||
@ExcelProperty("是否生成订单")
|
||||
private String generateOrder;
|
||||
|
||||
@Schema(description = "录入方式", example = "1")
|
||||
@ExcelProperty("录入方式")
|
||||
private String writeType;
|
||||
|
||||
@Schema(description = "物料编码")
|
||||
@ExcelProperty("物料编码")
|
||||
private String materialCoding;
|
||||
|
||||
@Schema(description = "物料名称")
|
||||
@ExcelProperty("物料名称")
|
||||
private String materialName;
|
||||
|
||||
@Schema(description = "指标id")
|
||||
@ExcelProperty("指标id")
|
||||
private Long indicatorId;
|
||||
|
||||
@Schema(description = "指标编码")
|
||||
@ExcelProperty("指标编码")
|
||||
private String indicatorCoding;
|
||||
|
||||
@Schema(description = "所属公司")
|
||||
@ExcelProperty("所属公司")
|
||||
private String belongCompanyCoding;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "动态列")
|
||||
private Map<String, PlanTemplateColumnDataRespVO> columns;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.plan.templateitem.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumndata.vo.PlanTemplateColumnDataRespVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Schema(description = "管理后台 - 生产计划模板项目新增/修改 Request VO")
|
||||
@Data
|
||||
public class PlanTemplateItemSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", example = "23213")
|
||||
private Long id;
|
||||
|
||||
@NotNull(message = "模板id不能为空")
|
||||
@Schema(description = "模板id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long planTemplateId;
|
||||
|
||||
@NotBlank(message = "模板编码不能为空")
|
||||
@Schema(description = "模板编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String planTemplateCoding;
|
||||
|
||||
@Schema(description = "计量单位(数据字典)")
|
||||
private String unit;
|
||||
|
||||
@NotBlank(message = "是否生成订单不能为空")
|
||||
@Schema(description = "是否生成订单(0:不生成,1:生成)", example = "1", allowableValues = {"0","1",""}, requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String generateOrder;
|
||||
|
||||
@Schema(description = "录入方式", example = "1")
|
||||
private String writeType;
|
||||
|
||||
@NotBlank(message = "物料编码不能为空")
|
||||
@Schema(description = "物料编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String materialCoding;
|
||||
|
||||
@NotBlank(message = "物料名称不能为空")
|
||||
@Schema(description = "物料名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String materialName;
|
||||
|
||||
@NotNull(message = "指标id不能为空")
|
||||
@Schema(description = "指标id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long indicatorId;
|
||||
|
||||
@NotBlank(message = "指标编码不能为空")
|
||||
@Schema(description = "指标编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String indicatorCoding;
|
||||
|
||||
@Schema(description = "所属公司")
|
||||
private String belongCompanyCoding;
|
||||
|
||||
@Schema(description = "动态列")
|
||||
private Map<String, PlanTemplateColumnDataRespVO> columns;
|
||||
|
||||
@NotBlank(message = "操作类型不能为空")
|
||||
@Schema(description = "操作类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "INSERT", allowableValues = {"INSERT","UPDATE","DELETE"})
|
||||
private String operation;
|
||||
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.product;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.config;
|
||||
|
||||
import cn.iocoder.yudao.framework.business.interceptor.BusinessControllerMarker;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.vo.BatchDeleteReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.config.vo.ScheduleConfigPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.config.vo.ScheduleConfigRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.config.vo.ScheduleCreateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.config.vo.ScheduleUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.product.convert.schedule.config.ScheduleConfigConvert;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.config.ScheduleConfigDO;
|
||||
import cn.iocoder.yudao.module.product.service.schedule.config.ScheduleConfigService;
|
||||
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 static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 排班配置")
|
||||
@RestController
|
||||
@RequestMapping("/mes/schedule-config")
|
||||
@Validated
|
||||
public class ScheduleConfigController implements BusinessControllerMarker {
|
||||
|
||||
|
||||
@Resource
|
||||
private ScheduleConfigService scheduleConfigService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建排班配置")
|
||||
@PreAuthorize("@ss.hasPermission('mes:schedule-config:create')")
|
||||
public CommonResult<Long> createScheduleConfig(@Valid @RequestBody ScheduleCreateReqVO createReqVO) {
|
||||
return success(scheduleConfigService.createScheduleConfig(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新排班配置")
|
||||
@PreAuthorize("@ss.hasPermission('mes:schedule-config:update')")
|
||||
public CommonResult<Boolean> updateScheduleConfig(@Valid @RequestBody ScheduleUpdateReqVO updateReqVO) {
|
||||
scheduleConfigService.updateScheduleConfig(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除排班配置")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('mes:schedule-config:delete')")
|
||||
public CommonResult<Boolean> deleteScheduleConfig(@RequestParam("id") Long id) {
|
||||
scheduleConfigService.deleteScheduleConfig(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除排班配置")
|
||||
@PreAuthorize("@ss.hasPermission('mes:schedule-config:delete')")
|
||||
public CommonResult<Boolean> deleteScheduleConfigList(@RequestBody BatchDeleteReqVO req) {
|
||||
scheduleConfigService.deleteScheduleConfigListByIds(req.getIds());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得排班配置")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('mes:schedule-config:query')")
|
||||
public CommonResult<ScheduleConfigRespVO> getScheduleConfig(@RequestParam("id") Long id) {
|
||||
ScheduleConfigDO scheduleConfig = scheduleConfigService.getScheduleConfig(id);
|
||||
return success(ScheduleConfigConvert.INSTANCE.convert(scheduleConfig));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得排班配置分页")
|
||||
@PreAuthorize("@ss.hasPermission('mes:schedule-config:query')")
|
||||
public CommonResult<PageResult<ScheduleConfigRespVO>> getScheduleConfigPage(@Valid ScheduleConfigPageReqVO pageReqVO) {
|
||||
PageResult<ScheduleConfigDO> pageResult = scheduleConfigService.getScheduleConfigPage(pageReqVO);
|
||||
return success(ScheduleConfigConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.config.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 排班配置Base VO")
|
||||
@Data
|
||||
public class ScheduleConfigBaseVO {
|
||||
|
||||
@Schema(description = "工厂模型id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "工厂模型id不能为空")
|
||||
private Long factoryModelId;
|
||||
|
||||
@Schema(description = "工厂模型编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "工厂模型编码不能为空")
|
||||
private String factoryModelCoding;
|
||||
|
||||
@Schema(description = "排班编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "排班编码不能为空")
|
||||
private String configCoding;
|
||||
|
||||
@Schema(description = "排班名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "排班名称不能为空")
|
||||
private String configName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.config.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 排班配置新增 Request VO")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Data
|
||||
public class ScheduleConfigCreateReqVO extends ScheduleConfigBaseVO {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.config.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 排班配置分页 Request VO")
|
||||
@Data
|
||||
public class ScheduleConfigPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "工厂模型id")
|
||||
private Long factoryModelId;
|
||||
|
||||
@Schema(description = "工厂模型编码")
|
||||
private String factoryModelCoding;
|
||||
|
||||
@Schema(description = "排班编码")
|
||||
private String configCoding;
|
||||
|
||||
@Schema(description = "排班名称")
|
||||
private String configName;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.config.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 排班配置 Response VO")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Data
|
||||
public class ScheduleConfigRespVO extends ScheduleConfigBaseVO{
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.config.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 排班配置修改 Request VO")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Data
|
||||
public class ScheduleConfigUpdateReqVO extends ScheduleConfigBaseVO{
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "排班配置主键不能为空")
|
||||
private Long id;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.config.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.rule.vo.ScheduleRuleCreateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.shift.vo.ScheduleShiftCreateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.team.vo.ScheduleTeamCreateReqVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 排班新增 Request VO")
|
||||
@Data
|
||||
public class ScheduleCreateReqVO {
|
||||
|
||||
@Schema(description = "基本信息", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "基本信息不能为空")
|
||||
@Valid
|
||||
private ScheduleConfigCreateReqVO scheduleConfig;
|
||||
|
||||
@Schema(description = "排班班组信息")
|
||||
@Valid
|
||||
private List<ScheduleTeamCreateReqVO> scheduleTeams;
|
||||
|
||||
@Schema(description = "排班班次信息")
|
||||
@Valid
|
||||
private List<ScheduleShiftCreateReqVO> scheduleShifts;
|
||||
|
||||
@Schema(description = "排班规则信息")
|
||||
@Valid
|
||||
private List<ScheduleRuleCreateReqVO> scheduleRules;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.config.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.rule.vo.ScheduleRuleUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.shift.vo.ScheduleShiftUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.team.vo.ScheduleTeamUpdateReqVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "管理后台 - 排班修改 Request VO")
|
||||
@Data
|
||||
public class ScheduleUpdateReqVO {
|
||||
|
||||
@Schema(description = "基本信息", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "基本信息不能为空")
|
||||
@Valid
|
||||
private ScheduleConfigUpdateReqVO scheduleConfig;
|
||||
|
||||
@Schema(description = "排班班组信息")
|
||||
@Valid
|
||||
private List<ScheduleTeamUpdateReqVO> scheduleTeams;
|
||||
|
||||
@Schema(description = "排班班次信息")
|
||||
@Valid
|
||||
private List<ScheduleShiftUpdateReqVO> scheduleShifts;
|
||||
|
||||
@Schema(description = "排班规则信息")
|
||||
@Valid
|
||||
private List<ScheduleRuleUpdateReqVO> scheduleRules;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.data;
|
||||
|
||||
import cn.iocoder.yudao.framework.business.interceptor.BusinessControllerMarker;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.data.vo.ScheduleDataGenerateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.data.vo.ScheduleDataListReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.data.vo.ScheduleDataRespVO;
|
||||
import cn.iocoder.yudao.module.product.convert.schedule.data.ScheduleDataConvert;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.data.ScheduleDataDO;
|
||||
import cn.iocoder.yudao.module.product.service.schedule.data.ScheduleDataService;
|
||||
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.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 排班数据")
|
||||
@RestController
|
||||
@RequestMapping("/mes/schedule-data")
|
||||
@Validated
|
||||
public class ScheduleDataController implements BusinessControllerMarker {
|
||||
|
||||
@Resource
|
||||
private ScheduleDataService scheduleDataService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得排班数据列表")
|
||||
@PreAuthorize("@ss.hasPermission('mes:schedule-data:query')")
|
||||
public CommonResult<List<ScheduleDataRespVO>> getScheduleDataList(ScheduleDataListReqVO reqVO) {
|
||||
List<ScheduleDataDO> scheduleDataList = scheduleDataService.getScheduleDataList(reqVO);
|
||||
return success(ScheduleDataConvert.INSTANCE.convertList(scheduleDataList));
|
||||
}
|
||||
|
||||
@PostMapping("/generate")
|
||||
@Operation(summary = "生成排班数据")
|
||||
@PreAuthorize("@ss.hasPermission('mes:schedule-data:create')")
|
||||
public CommonResult<Boolean> generateScheduleData(@Valid @RequestBody ScheduleDataGenerateReqVO generateReqVO) {
|
||||
scheduleDataService.generateScheduleData(generateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.data.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
|
||||
@Schema(description = "管理后台 - 排班数据生成 Request VO")
|
||||
@Data
|
||||
public class ScheduleDataGenerateReqVO {
|
||||
@Schema(description = "排班配置id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "排班配置id不能为空")
|
||||
private Long scheduleConfigId;
|
||||
|
||||
@Schema(description = "开始时间", example = "2025-09-01")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate startTime;
|
||||
|
||||
@Schema(description = "结束时间", example = "2025-09-30")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate endTime;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.data.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
|
||||
@Schema(description = "管理后台 - 排班数据列表 Request VO")
|
||||
@Data
|
||||
public class ScheduleDataListReqVO {
|
||||
|
||||
@Schema(description = "班组配置id")
|
||||
private Long scheduleConfigId;
|
||||
|
||||
@Schema(description = "开始时间", example = "2025-09-01")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate startTime;
|
||||
|
||||
@Schema(description = "结束时间", example = "2025-10-01")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate endTime;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.data.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
|
||||
@Schema(description = "管理后台 - 排班数据 Response VO")
|
||||
@Data
|
||||
public class ScheduleDataRespVO {
|
||||
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "班组配置id")
|
||||
private Long scheduleConfigId;
|
||||
|
||||
@Schema(description = "班组配置编码")
|
||||
private String scheduleConfigCoding;
|
||||
|
||||
@Schema(description = "排班日期")
|
||||
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate scheduleDate;
|
||||
|
||||
@Schema(description = "班次id")
|
||||
private Long scheduleShiftId;
|
||||
|
||||
@Schema(description = "班组id")
|
||||
private Long scheduleTeamId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.rule;
|
||||
|
||||
import cn.iocoder.yudao.framework.business.interceptor.BusinessControllerMarker;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.rule.vo.ScheduleRulePageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.rule.vo.ScheduleRuleRespVO;
|
||||
import cn.iocoder.yudao.module.product.convert.schedule.rule.ScheduleRuleConvert;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.rule.ScheduleRuleDO;
|
||||
import cn.iocoder.yudao.module.product.service.schedule.rule.ScheduleRuleService;
|
||||
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.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 排班规则")
|
||||
@RestController
|
||||
@RequestMapping("/mes/schedule-rule")
|
||||
@Validated
|
||||
public class ScheduleRuleController implements BusinessControllerMarker {
|
||||
|
||||
|
||||
@Resource
|
||||
private ScheduleRuleService scheduleRuleService;
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得排班规则")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('mes:schedule-rule:query')")
|
||||
public CommonResult<ScheduleRuleRespVO> getScheduleRule(@RequestParam("id") Long id) {
|
||||
ScheduleRuleDO scheduleRule = scheduleRuleService.getScheduleRule(id);
|
||||
return success(ScheduleRuleConvert.INSTANCE.convert(scheduleRule));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得排班规则分页")
|
||||
@PreAuthorize("@ss.hasPermission('mes:schedule-rule:query')")
|
||||
public CommonResult<PageResult<ScheduleRuleRespVO>> getScheduleRulePage(@Valid ScheduleRulePageReqVO pageReqVO) {
|
||||
PageResult<ScheduleRuleDO> pageResult = scheduleRuleService.getScheduleRulePage(pageReqVO);
|
||||
return success(ScheduleRuleConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.rule.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
|
||||
@Schema(description = "管理后台 - 排班规则新增Request VO")
|
||||
@Data
|
||||
public class ScheduleRuleCreateReqVO {
|
||||
|
||||
@Schema(description = "排班日期", requiredMode = Schema.RequiredMode.REQUIRED, example = "2025-06-14")
|
||||
@NotNull(message = "排班日期不能为空")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate scheduleDate;
|
||||
|
||||
@Schema(description = "班次名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "班次名称不能为空")
|
||||
private String scheduleShiftName;
|
||||
|
||||
@Schema(description = "班组名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "班组名称不能为空")
|
||||
private String scheduleTeamName;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.rule.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 排班规则分页 Request VO")
|
||||
@Data
|
||||
public class ScheduleRulePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "班组配置id")
|
||||
private Long scheduleConfigId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.rule.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
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 = "管理后台 - 排班规则 Response VO")
|
||||
@Data
|
||||
public class ScheduleRuleRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "排班日期", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "排班日期不能为空")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime scheduleDate;
|
||||
|
||||
@Schema(description = "班次id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "班次id不能为空")
|
||||
private Long scheduleShiftId;
|
||||
|
||||
@Schema(description = "班组id", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "班组id不能为空")
|
||||
private Long scheduleTeamId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.rule.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
|
||||
@Schema(description = "管理后台 - 排班规则修改Request VO")
|
||||
@Data
|
||||
public class ScheduleRuleUpdateReqVO{
|
||||
@Schema(description = "排班规则主键,修改的项目赋值,新建的项目不赋值")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "排班日期", requiredMode = Schema.RequiredMode.REQUIRED, example = "2025-06-14")
|
||||
@NotNull(message = "排班日期不能为空")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||
private LocalDate scheduleDate;
|
||||
|
||||
@Schema(description = "班次名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "班次名称不能为空")
|
||||
private String scheduleShiftName;
|
||||
|
||||
@Schema(description = "班组名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "班组名称不能为空")
|
||||
private String scheduleTeamName;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.shift;
|
||||
|
||||
import cn.iocoder.yudao.framework.business.interceptor.BusinessControllerMarker;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.shift.vo.ScheduleShiftPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.shift.vo.ScheduleShiftRespVO;
|
||||
import cn.iocoder.yudao.module.product.convert.schedule.shift.ScheduleShiftConvert;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.shift.ScheduleShiftDO;
|
||||
import cn.iocoder.yudao.module.product.service.schedule.shift.ScheduleShiftService;
|
||||
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.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 排班班次")
|
||||
@RestController
|
||||
@RequestMapping("/mes/schedule-shift")
|
||||
@Validated
|
||||
public class ScheduleShiftController implements BusinessControllerMarker {
|
||||
|
||||
|
||||
@Resource
|
||||
private ScheduleShiftService scheduleShiftService;
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得排班班次")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('mes:schedule-shift:query')")
|
||||
public CommonResult<ScheduleShiftRespVO> getScheduleShift(@RequestParam("id") Long id) {
|
||||
ScheduleShiftDO scheduleShift = scheduleShiftService.getScheduleShift(id);
|
||||
return success(ScheduleShiftConvert.INSTANCE.convert(scheduleShift));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得排班班次分页")
|
||||
@PreAuthorize("@ss.hasPermission('mes:schedule-shift:query')")
|
||||
public CommonResult<PageResult<ScheduleShiftRespVO>> getScheduleShiftPage(@Valid ScheduleShiftPageReqVO pageReqVO) {
|
||||
PageResult<ScheduleShiftDO> pageResult = scheduleShiftService.getScheduleShiftPage(pageReqVO);
|
||||
return success(ScheduleShiftConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.shift.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalTime;
|
||||
|
||||
@Schema(description = "管理后台 - 排班班次新增 Request VO")
|
||||
@Data
|
||||
public class ScheduleShiftCreateReqVO {
|
||||
|
||||
@Schema(description = "班次名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "班次名称不能为空")
|
||||
private String shiftName;
|
||||
|
||||
@Schema(description = "开始时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "08:00:00")
|
||||
@NotNull(message = "开始时间不能为空")
|
||||
private LocalTime beginTime;
|
||||
|
||||
@Schema(description = "结束时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "08:00:00")
|
||||
@NotNull(message = "结束时间不能为空")
|
||||
private LocalTime endTime;
|
||||
|
||||
@Schema(description = "是否跨天", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "是否跨天不能为空")
|
||||
private String crossDay;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.shift.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 排班班次分页 Request VO")
|
||||
@Data
|
||||
public class ScheduleShiftPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "班组配置id")
|
||||
private Long scheduleConfigId;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.shift.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
|
||||
@Schema(description = "管理后台 - 排班班次 Response VO")
|
||||
@Data
|
||||
public class ScheduleShiftRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "班次名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String shiftName;
|
||||
|
||||
@Schema(description = "开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalTime beginTime;
|
||||
|
||||
@Schema(description = "结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@JsonFormat(pattern = "HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalTime endTime;
|
||||
|
||||
@Schema(description = "是否跨天", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String crossDay;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.shift.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalTime;
|
||||
|
||||
@Schema(description = "管理后台 - 排班班次修改 Request VO")
|
||||
@Data
|
||||
public class ScheduleShiftUpdateReqVO{
|
||||
|
||||
@Schema(description = "排班班次主键,修改的项目赋值,新建的项目不赋值")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "班次名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "班次名称不能为空")
|
||||
private String shiftName;
|
||||
|
||||
@Schema(description = "开始时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "08:00:00")
|
||||
@NotNull(message = "开始时间不能为空")
|
||||
private LocalTime beginTime;
|
||||
|
||||
@Schema(description = "结束时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "08:00:00")
|
||||
@NotNull(message = "结束时间不能为空")
|
||||
private LocalTime endTime;
|
||||
|
||||
@Schema(description = "是否跨天", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "是否跨天不能为空")
|
||||
private String crossDay;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.team;
|
||||
|
||||
import cn.iocoder.yudao.framework.business.interceptor.BusinessControllerMarker;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.team.vo.ScheduleTeamPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.team.vo.ScheduleTeamRespVO;
|
||||
import cn.iocoder.yudao.module.product.convert.schedule.team.ScheduleTeamConvert;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.team.ScheduleTeamDO;
|
||||
import cn.iocoder.yudao.module.product.service.schedule.team.ScheduleTeamService;
|
||||
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.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 排班班组")
|
||||
@RestController
|
||||
@RequestMapping("/mes/schedule-team")
|
||||
@Validated
|
||||
public class ScheduleTeamController implements BusinessControllerMarker {
|
||||
|
||||
|
||||
@Resource
|
||||
private ScheduleTeamService scheduleTeamService;
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得排班班组")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('mes:schedule-team:query')")
|
||||
public CommonResult<ScheduleTeamRespVO> getScheduleTeam(@RequestParam("id") Long id) {
|
||||
ScheduleTeamDO scheduleTeam = scheduleTeamService.getScheduleTeam(id);
|
||||
return success(ScheduleTeamConvert.INSTANCE.convert(scheduleTeam));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得排班班组分页")
|
||||
@PreAuthorize("@ss.hasPermission('mes:schedule-team:query')")
|
||||
public CommonResult<PageResult<ScheduleTeamRespVO>> getScheduleTeamPage(@Valid ScheduleTeamPageReqVO pageReqVO) {
|
||||
PageResult<ScheduleTeamDO> pageResult = scheduleTeamService.getScheduleTeamPage(pageReqVO);
|
||||
return success(ScheduleTeamConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.team.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 排班班组新增 Request VO")
|
||||
@Data
|
||||
public class ScheduleTeamCreateReqVO{
|
||||
|
||||
@Schema(description = "班组名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "班组名称不能为空")
|
||||
private String teamName;
|
||||
|
||||
@Schema(description = "班组用户", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "班组用户不能为空")
|
||||
private String userId;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.team.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 排班班组分页 Request VO")
|
||||
@Data
|
||||
public class ScheduleTeamPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "班组配置id")
|
||||
private Long scheduleConfigId;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.team.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 排班班组 Response VO")
|
||||
@Data
|
||||
public class ScheduleTeamRespVO {
|
||||
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "班组名称")
|
||||
private String teamName;
|
||||
|
||||
@Schema(description = "班组用户")
|
||||
private String userId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.schedule.team.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 排班班组修改 Request VO")
|
||||
@Data
|
||||
public class ScheduleTeamUpdateReqVO {
|
||||
@Schema(description = "排班班组主键,修改的项目赋值,新建的项目不赋值")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "班组名称", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "班组名称不能为空")
|
||||
private String teamName;
|
||||
|
||||
@Schema(description = "班组用户", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotBlank(message = "班组用户不能为空")
|
||||
private String userId;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.product.convert.factory.model;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.factory.model.vo.FactoryModeTreeRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.factory.model.vo.FactoryModelCreateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.factory.model.vo.FactoryModelRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.factory.model.vo.FactoryModelUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.factory.model.FactoryModelDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工厂模型 Convert
|
||||
*/
|
||||
@Mapper
|
||||
public interface FactoryModelConvert {
|
||||
FactoryModelConvert INSTANCE = Mappers.getMapper(FactoryModelConvert.class);
|
||||
|
||||
FactoryModelDO convert(FactoryModelCreateReqVO bean);
|
||||
FactoryModelDO convert(FactoryModelUpdateReqVO bean);
|
||||
FactoryModelRespVO convert(FactoryModelDO bean);
|
||||
List<FactoryModeTreeRespVO> convertList(List<FactoryModelDO> beans);
|
||||
PageResult<FactoryModelRespVO> convertPage(PageResult<FactoryModelDO> page);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.product.convert.schedule.config;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.config.vo.ScheduleConfigCreateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.config.vo.ScheduleConfigRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.config.vo.ScheduleConfigUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.config.ScheduleConfigDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface ScheduleConfigConvert {
|
||||
ScheduleConfigConvert INSTANCE = Mappers.getMapper(ScheduleConfigConvert.class);
|
||||
|
||||
ScheduleConfigDO convert(ScheduleConfigCreateReqVO bean);
|
||||
ScheduleConfigDO convert(ScheduleConfigUpdateReqVO bean);
|
||||
ScheduleConfigRespVO convert(ScheduleConfigDO bean);
|
||||
PageResult<ScheduleConfigRespVO> convertPage(PageResult<ScheduleConfigDO> page);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.product.convert.schedule.data;
|
||||
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.data.vo.ScheduleDataRespVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.data.ScheduleDataDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.rule.ScheduleRuleDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ScheduleDataConvert {
|
||||
ScheduleDataConvert INSTANCE = Mappers.getMapper(ScheduleDataConvert.class);
|
||||
|
||||
ScheduleDataRespVO convert(ScheduleDataDO bean);
|
||||
@Mapping(target="id", ignore = true)
|
||||
ScheduleDataDO convert(ScheduleRuleDO bean);
|
||||
List<ScheduleDataRespVO> convertList(List<ScheduleDataDO> beans);
|
||||
List<ScheduleDataDO> convertListByRule(List<ScheduleRuleDO> beans);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.product.convert.schedule.rule;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.rule.vo.ScheduleRuleCreateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.rule.vo.ScheduleRuleRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.rule.vo.ScheduleRuleUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.rule.ScheduleRuleDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface ScheduleRuleConvert {
|
||||
ScheduleRuleConvert INSTANCE = Mappers.getMapper(ScheduleRuleConvert.class);
|
||||
|
||||
ScheduleRuleDO convert(ScheduleRuleCreateReqVO bean);
|
||||
ScheduleRuleDO convert(ScheduleRuleUpdateReqVO bean);
|
||||
ScheduleRuleRespVO convert(ScheduleRuleDO bean);
|
||||
PageResult<ScheduleRuleRespVO> convertPage(PageResult<ScheduleRuleDO> page);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.product.convert.schedule.shift;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.shift.vo.ScheduleShiftCreateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.shift.vo.ScheduleShiftRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.shift.vo.ScheduleShiftUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.shift.ScheduleShiftDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ScheduleShiftConvert {
|
||||
|
||||
ScheduleShiftConvert INSTANCE = Mappers.getMapper(ScheduleShiftConvert.class);
|
||||
|
||||
ScheduleShiftDO convert(ScheduleShiftCreateReqVO bean);
|
||||
ScheduleShiftDO convert(ScheduleShiftUpdateReqVO bean);
|
||||
ScheduleShiftRespVO convert(ScheduleShiftDO bean);
|
||||
List<ScheduleShiftDO> convertListByCreateReqVO(List<ScheduleShiftCreateReqVO> beans);
|
||||
List<ScheduleShiftDO> convertListByUpdateReqVO(List<ScheduleShiftUpdateReqVO> beans);
|
||||
PageResult<ScheduleShiftRespVO> convertPage(PageResult<ScheduleShiftDO> page);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.product.convert.schedule.team;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.team.vo.ScheduleTeamCreateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.team.vo.ScheduleTeamRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.team.vo.ScheduleTeamUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.team.ScheduleTeamDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ScheduleTeamConvert {
|
||||
|
||||
ScheduleTeamConvert INSTANCE = Mappers.getMapper(ScheduleTeamConvert.class);
|
||||
|
||||
ScheduleTeamDO convert(ScheduleTeamCreateReqVO bean);
|
||||
|
||||
ScheduleTeamDO convert(ScheduleTeamUpdateReqVO bean);
|
||||
|
||||
ScheduleTeamRespVO convert(ScheduleTeamDO bean);
|
||||
|
||||
List<ScheduleTeamDO> convertListByCreateReqVO(List<ScheduleTeamCreateReqVO> beans);
|
||||
List<ScheduleTeamDO> convertListByUpdateReqVO(List<ScheduleTeamUpdateReqVO> beans);
|
||||
|
||||
PageResult<ScheduleTeamRespVO> convertPage(PageResult<ScheduleTeamDO> page);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package cn.iocoder.yudao.module.product.dal.dataobject.factory.model;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 工厂模型 DO
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@TableName("MES_FACT_MDL")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
/**
|
||||
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
||||
*/
|
||||
public class FactoryModelDO extends BusinessBaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 父级id
|
||||
*/
|
||||
@TableField("PRN_ID")
|
||||
private Long parentId;
|
||||
/**
|
||||
* 父级编码
|
||||
*/
|
||||
@TableField("PRN_CDG")
|
||||
private String parentCoding;
|
||||
/**
|
||||
* 节点编码
|
||||
*/
|
||||
@TableField("NDE_CDG")
|
||||
private String nodeCoding;
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
@TableField("NDE_NAME")
|
||||
private String nodeName;
|
||||
/**
|
||||
* 节点类型
|
||||
*/
|
||||
@TableField("NDE_TP")
|
||||
private String nodeType;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@TableField("SRT")
|
||||
private Integer sort;
|
||||
/**
|
||||
* ERP工艺路线编码
|
||||
*/
|
||||
@TableField("ERP_PRCS_RUT_CDG")
|
||||
private String erpProcessRouteCoding;
|
||||
/**
|
||||
* ERP工序编码
|
||||
*/
|
||||
@TableField("ERP_PRCS_CDG")
|
||||
private String erpProcessCoding;
|
||||
/**
|
||||
* ERP工序名称
|
||||
*/
|
||||
@TableField("ERP_PRCS_NAME")
|
||||
private String erpProcessName;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@TableField("NDE_STS")
|
||||
private String nodeStatus;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package cn.iocoder.yudao.module.product.dal.dataobject.plan.template;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.*;
|
||||
/**
|
||||
* 生产计划模板 DO
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@TableName("mes_pln_tmpl")
|
||||
@KeySequence("mes_pln_tmpl_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
/**
|
||||
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
||||
*/
|
||||
public class PlanTemplateDO extends BusinessBaseDO {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 模板编码
|
||||
*/
|
||||
@TableField("TMPL_CDG")
|
||||
private String templateCoding;
|
||||
/**
|
||||
* 模板名称
|
||||
*/
|
||||
@TableField("TMPL_NAME")
|
||||
private String templateName;
|
||||
/**
|
||||
* 模板类型
|
||||
*/
|
||||
@TableField("PLN_TP")
|
||||
private String planType;
|
||||
/**
|
||||
* 公司编码
|
||||
*/
|
||||
@TableField("BLG_CPN_CDG")
|
||||
private String belongCompanyCoding;
|
||||
/**
|
||||
* 公司名称
|
||||
*/
|
||||
@TableField("BLG_CPN_NAME")
|
||||
private String belongCompanyName;
|
||||
/**
|
||||
* 版本
|
||||
*/
|
||||
@TableField("TMPL_VER")
|
||||
private Integer templateVersion;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@TableField("TMPL_STS")
|
||||
private String templateStatus;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package cn.iocoder.yudao.module.product.dal.dataobject.plan.templatecolumn;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.*;
|
||||
/**
|
||||
* 生产计划模板动态列 DO
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@TableName("mes_pln_tmpl_coln")
|
||||
@KeySequence("mes_pln_tmpl_coln_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
/**
|
||||
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
||||
*/
|
||||
public class PlanTemplateColumnDO extends BusinessBaseDO {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 模板id
|
||||
*/
|
||||
@TableField("PLN_TMPL_ID")
|
||||
private Long planTemplateId;
|
||||
/**
|
||||
* 模板编码
|
||||
*/
|
||||
@TableField("PLN_TMPL_CDG")
|
||||
private String planTemplateCoding;
|
||||
/**
|
||||
* 列编码
|
||||
*/
|
||||
@TableField("COLN_CDG")
|
||||
private String columnCoding;
|
||||
/**
|
||||
* 列名称
|
||||
*/
|
||||
@TableField("COLN_NAME")
|
||||
private String columnName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package cn.iocoder.yudao.module.product.dal.dataobject.plan.templatecolumndata;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.*;
|
||||
/**
|
||||
* 生产计划模板动态列数据 DO
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@TableName("mes_pln_tmpl_coln_dat")
|
||||
@KeySequence("mes_pln_tmpl_coln_dat_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
/**
|
||||
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
||||
*/
|
||||
public class PlanTemplateColumnDataDO extends BusinessBaseDO {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 模板id
|
||||
*/
|
||||
@TableField("PLN_TMPL_ID")
|
||||
private Long planTemplateId;
|
||||
/**
|
||||
* 模板动态列id
|
||||
*/
|
||||
@TableField("PLN_TMPL_COLN_ID")
|
||||
private Long planTemplateColumnId;
|
||||
/**
|
||||
* 模板明细id
|
||||
*/
|
||||
@TableField("PLN_TMPL_ITM_ID")
|
||||
private Long planTemplateItemId;
|
||||
/**
|
||||
* 动态列编码
|
||||
*/
|
||||
@TableField("COLN_CDG")
|
||||
private String columnCoding;
|
||||
/**
|
||||
* 动态列值
|
||||
*/
|
||||
@TableField("COLN_VAL")
|
||||
private String columnValue;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package cn.iocoder.yudao.module.product.dal.dataobject.plan.templateitem;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.*;
|
||||
/**
|
||||
* 生产计划模板项目 DO
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@TableName("mes_pln_tmpl_itm")
|
||||
@KeySequence("mes_pln_tmpl_itm_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
/**
|
||||
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
||||
*/
|
||||
public class PlanTemplateItemDO extends BusinessBaseDO {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 模板id
|
||||
*/
|
||||
@TableField("PLN_TMPL_ID")
|
||||
private Long planTemplateId;
|
||||
/**
|
||||
* 模板编码
|
||||
*/
|
||||
@TableField("PLN_TMPL_CDG")
|
||||
private String planTemplateCoding;
|
||||
/**
|
||||
* 计量单位
|
||||
*/
|
||||
@TableField("UNT")
|
||||
private String unit;
|
||||
/**
|
||||
* 是否生成订单
|
||||
*/
|
||||
@TableField("GEN_ORD")
|
||||
private String generateOrder;
|
||||
/**
|
||||
* 录入方式
|
||||
*/
|
||||
@TableField("WR_TP")
|
||||
private String writeType;
|
||||
/**
|
||||
* 物料编码
|
||||
*/
|
||||
@TableField("MTRL_CDG")
|
||||
private String materialCoding;
|
||||
/**
|
||||
* 物料名称
|
||||
*/
|
||||
@TableField("MTRL_NAME")
|
||||
private String materialName;
|
||||
/**
|
||||
* 指标id
|
||||
*/
|
||||
@TableField("IND_ID")
|
||||
private Long indicatorId;
|
||||
/**
|
||||
* 指标编码
|
||||
*/
|
||||
@TableField("IND_CDG")
|
||||
private String indicatorCoding;
|
||||
/**
|
||||
* 所属公司
|
||||
*/
|
||||
@TableField("BLG_CPN_CDG")
|
||||
private String belongCompanyCoding;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.product.dal.dataobject.schedule.config;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 排班配置 DO
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@TableName("mes_schd_cfg")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
/**
|
||||
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
||||
*/
|
||||
public class ScheduleConfigDO extends BusinessBaseDO {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 工厂模型id
|
||||
*/
|
||||
@TableField("FACT_MDL_ID")
|
||||
private Long factoryModelId;
|
||||
/**
|
||||
* 工厂模型编码
|
||||
*/
|
||||
@TableField("FACT_MDL_CDG")
|
||||
private String factoryModelCoding;
|
||||
/**
|
||||
* 排班编码
|
||||
*/
|
||||
@TableField("CFG_CDG")
|
||||
private String configCoding;
|
||||
/**
|
||||
* 排班名称
|
||||
*/
|
||||
@TableField("CFG_NAME")
|
||||
private String configName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package cn.iocoder.yudao.module.product.dal.dataobject.schedule.data;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 排班数据 DO
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@TableName("mes_schd_dat")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
/**
|
||||
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
||||
*/
|
||||
public class ScheduleDataDO extends BusinessBaseDO {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 班组配置id
|
||||
*/
|
||||
@TableField("SCHD_CFG_ID")
|
||||
private Long scheduleConfigId;
|
||||
/**
|
||||
* 班组配置编码
|
||||
*/
|
||||
@TableField("SCHD_CFG_CDG")
|
||||
private String scheduleConfigCoding;
|
||||
/**
|
||||
* 排班日期
|
||||
*/
|
||||
@TableField("SCHD_DT")
|
||||
private LocalDate scheduleDate;
|
||||
/**
|
||||
* 班次id
|
||||
*/
|
||||
@TableField("SCHD_SHFT_ID")
|
||||
private Long scheduleShiftId;
|
||||
/**
|
||||
* 班组id
|
||||
*/
|
||||
@TableField("SCHD_TAM_ID")
|
||||
private Long scheduleTeamId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package cn.iocoder.yudao.module.product.dal.dataobject.schedule.rule;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 排班规则 DO
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@TableName("mes_schd_rul")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
/**
|
||||
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
||||
*/
|
||||
public class ScheduleRuleDO extends BusinessBaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 班组配置id
|
||||
*/
|
||||
@TableField("SCHD_CFG_ID")
|
||||
private Long scheduleConfigId;
|
||||
/**
|
||||
* 班组配置编码
|
||||
*/
|
||||
@TableField("SCHD_CFG_CDG")
|
||||
private String scheduleConfigCoding;
|
||||
/**
|
||||
* 排班日期
|
||||
*/
|
||||
@TableField("SCHD_DT")
|
||||
private LocalDate scheduleDate;
|
||||
/**
|
||||
* 班次id
|
||||
*/
|
||||
@TableField("SCHD_SHFT_ID")
|
||||
private Long scheduleShiftId;
|
||||
/**
|
||||
* 班组id
|
||||
*/
|
||||
@TableField("SCHD_TAM_ID")
|
||||
private Long scheduleTeamId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package cn.iocoder.yudao.module.product.dal.dataobject.schedule.shift;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalTime;
|
||||
|
||||
/**
|
||||
* 排班班次 DO
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@TableName("mes_schd_shft")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
/**
|
||||
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
||||
*/
|
||||
public class ScheduleShiftDO extends BusinessBaseDO {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 班组配置id
|
||||
*/
|
||||
@TableField("SCHD_CFG_ID")
|
||||
private Long scheduleConfigId;
|
||||
/**
|
||||
* 班组配置编码
|
||||
*/
|
||||
@TableField("SCHD_CFG_CDG")
|
||||
private String scheduleConfigCoding;
|
||||
/**
|
||||
* 班次名称
|
||||
*/
|
||||
@TableField("SHFT_NAME")
|
||||
private String shiftName;
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@TableField("BGN_TM")
|
||||
private LocalTime beginTime;
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@TableField("END_TM")
|
||||
private LocalTime endTime;
|
||||
/**
|
||||
* 是否跨天
|
||||
*/
|
||||
@TableField("CRS_DY")
|
||||
private String crossDay;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package cn.iocoder.yudao.module.product.dal.dataobject.schedule.team;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BusinessBaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 排班班组 DO
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@TableName("mes_schd_tam")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
/**
|
||||
* 支持业务基类继承:isBusiness=true 时继承 BusinessBaseDO,否则继承 BaseDO
|
||||
*/
|
||||
public class ScheduleTeamDO extends BusinessBaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
/**
|
||||
* 班组配置id
|
||||
*/
|
||||
@TableField("SCHD_CFG_ID")
|
||||
private Long scheduleConfigId;
|
||||
/**
|
||||
* 班组配置编码
|
||||
*/
|
||||
@TableField("SCHD_CFG_CDG")
|
||||
private String scheduleConfigCoding;
|
||||
/**
|
||||
* 班组名称
|
||||
*/
|
||||
@TableField("TAM_NAME")
|
||||
private String teamName;
|
||||
/**
|
||||
* 班组用户
|
||||
*/
|
||||
@TableField("USER_ID")
|
||||
private String userId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.product.dal.mysql.factory.model;
|
||||
|
||||
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.product.controller.admin.factory.model.vo.FactoryModelPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.factory.model.FactoryModelDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 工厂模型 Mapper
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Mapper
|
||||
public interface FactoryModelMapper extends BaseMapperX<FactoryModelDO> {
|
||||
|
||||
default PageResult<FactoryModelDO> selectPage(FactoryModelPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<FactoryModelDO>()
|
||||
.eqIfPresent(FactoryModelDO::getParentId, reqVO.getParentId())
|
||||
.likeIfPresent(FactoryModelDO::getNodeCoding, reqVO.getNodeCoding())
|
||||
.likeIfPresent(FactoryModelDO::getNodeName, reqVO.getNodeName())
|
||||
.eqIfPresent(FactoryModelDO::getNodeType, reqVO.getNodeType())
|
||||
.likeIfPresent(FactoryModelDO::getErpProcessCoding, reqVO.getErpProcessCoding())
|
||||
.likeIfPresent(FactoryModelDO::getErpProcessName, reqVO.getErpProcessName())
|
||||
.orderByAsc(FactoryModelDO::getSort)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.product.dal.mysql.plan.template;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.plan.template.PlanTemplateDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.template.vo.*;
|
||||
|
||||
/**
|
||||
* 生产计划模板 Mapper
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Mapper
|
||||
public interface PlanTemplateMapper extends BaseMapperX<PlanTemplateDO> {
|
||||
|
||||
default PageResult<PlanTemplateDO> selectPage(PlanTemplatePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<PlanTemplateDO>()
|
||||
.eqIfPresent(PlanTemplateDO::getTemplateCoding, reqVO.getTemplateCoding())
|
||||
.likeIfPresent(PlanTemplateDO::getTemplateName, reqVO.getTemplateName())
|
||||
.eqIfPresent(PlanTemplateDO::getPlanType, reqVO.getPlanType())
|
||||
.eqIfPresent(PlanTemplateDO::getBelongCompanyCoding, reqVO.getBelongCompanyCoding())
|
||||
.likeIfPresent(PlanTemplateDO::getBelongCompanyName, reqVO.getBelongCompanyName())
|
||||
.eqIfPresent(PlanTemplateDO::getTemplateVersion, reqVO.getTemplateVersion())
|
||||
.eqIfPresent(PlanTemplateDO::getTemplateStatus, reqVO.getTemplateStatus())
|
||||
.betweenIfPresent(PlanTemplateDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(PlanTemplateDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.product.dal.mysql.plan.templatecolumn;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.plan.templatecolumn.PlanTemplateColumnDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumn.vo.*;
|
||||
|
||||
/**
|
||||
* 生产计划模板动态列 Mapper
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Mapper
|
||||
public interface PlanTemplateColumnMapper extends BaseMapperX<PlanTemplateColumnDO> {
|
||||
|
||||
default PageResult<PlanTemplateColumnDO> selectPage(PlanTemplateColumnPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<PlanTemplateColumnDO>()
|
||||
.eqIfPresent(PlanTemplateColumnDO::getPlanTemplateId, reqVO.getPlanTemplateId())
|
||||
.orderByDesc(PlanTemplateColumnDO::getId));
|
||||
}
|
||||
|
||||
default void deleteByTemplateId(Long templateId) {
|
||||
delete(new LambdaQueryWrapperX<PlanTemplateColumnDO>()
|
||||
.eq(PlanTemplateColumnDO::getPlanTemplateId, templateId));
|
||||
}
|
||||
|
||||
default void deleteByTemplateIds(List<Long> templateIds) {
|
||||
delete(new LambdaQueryWrapperX<PlanTemplateColumnDO>()
|
||||
.in(PlanTemplateColumnDO::getPlanTemplateId, templateIds));
|
||||
}
|
||||
|
||||
default List<PlanTemplateColumnDO> selectByTemplateId(Long templateId) {
|
||||
return selectList(new LambdaQueryWrapperX<PlanTemplateColumnDO>()
|
||||
.eq(PlanTemplateColumnDO::getPlanTemplateId, templateId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package cn.iocoder.yudao.module.product.dal.mysql.plan.templatecolumndata;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.plan.templatecolumndata.PlanTemplateColumnDataDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumndata.vo.*;
|
||||
|
||||
/**
|
||||
* 生产计划模板动态列数据 Mapper
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Mapper
|
||||
public interface PlanTemplateColumnDataMapper extends BaseMapperX<PlanTemplateColumnDataDO> {
|
||||
|
||||
default PageResult<PlanTemplateColumnDataDO> selectPage(PlanTemplateColumnDataPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<PlanTemplateColumnDataDO>()
|
||||
.eqIfPresent(PlanTemplateColumnDataDO::getPlanTemplateColumnId, reqVO.getPlanTemplateColumnId())
|
||||
.eqIfPresent(PlanTemplateColumnDataDO::getPlanTemplateItemId, reqVO.getPlanTemplateItemId())
|
||||
.orderByDesc(PlanTemplateColumnDataDO::getId));
|
||||
}
|
||||
|
||||
default void deleteByTemplateId(Long templateId) {
|
||||
delete(new LambdaQueryWrapperX<PlanTemplateColumnDataDO>()
|
||||
.eq(PlanTemplateColumnDataDO::getPlanTemplateId, templateId));
|
||||
}
|
||||
|
||||
default void deleteByTemplateIds(List<Long> templateIds) {
|
||||
delete(new LambdaQueryWrapperX<PlanTemplateColumnDataDO>()
|
||||
.in(PlanTemplateColumnDataDO::getPlanTemplateId, templateIds));
|
||||
}
|
||||
|
||||
default void deleteByTemplateColumnId(Long templateColumnId) {
|
||||
delete(new LambdaQueryWrapperX<PlanTemplateColumnDataDO>()
|
||||
.eq(PlanTemplateColumnDataDO::getPlanTemplateId, templateColumnId));
|
||||
}
|
||||
|
||||
default void deleteByTemplateColumnIds(List<Long> templateColumnIds) {
|
||||
delete(new LambdaQueryWrapperX<PlanTemplateColumnDataDO>()
|
||||
.in(PlanTemplateColumnDataDO::getPlanTemplateColumnId, templateColumnIds));
|
||||
}
|
||||
|
||||
default void deleteByTemplateItemId(Long templateItemId) {
|
||||
delete(new LambdaQueryWrapperX<PlanTemplateColumnDataDO>()
|
||||
.eq(PlanTemplateColumnDataDO::getPlanTemplateItemId, templateItemId));
|
||||
}
|
||||
|
||||
default void deleteByTemplateItemIds(List<Long> templateItemIds) {
|
||||
delete(new LambdaQueryWrapperX<PlanTemplateColumnDataDO>()
|
||||
.in(PlanTemplateColumnDataDO::getPlanTemplateItemId, templateItemIds));
|
||||
}
|
||||
|
||||
default List<PlanTemplateColumnDataDO> selectByTemplateId(Long templateId) {
|
||||
return selectList(new LambdaQueryWrapperX<PlanTemplateColumnDataDO>()
|
||||
.eq(PlanTemplateColumnDataDO::getPlanTemplateId, templateId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.product.dal.mysql.plan.templateitem;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.plan.templateitem.PlanTemplateItemDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templateitem.vo.*;
|
||||
|
||||
/**
|
||||
* 生产计划模板项目 Mapper
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Mapper
|
||||
public interface PlanTemplateItemMapper extends BaseMapperX<PlanTemplateItemDO> {
|
||||
|
||||
default PageResult<PlanTemplateItemDO> selectPage(PlanTemplateItemPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<PlanTemplateItemDO>()
|
||||
.eqIfPresent(PlanTemplateItemDO::getPlanTemplateId, reqVO.getPlanTemplateId())
|
||||
.orderByDesc(PlanTemplateItemDO::getId));
|
||||
}
|
||||
|
||||
default void deleteByTemplateId(Long templateId){
|
||||
delete(new LambdaQueryWrapperX<PlanTemplateItemDO>()
|
||||
.eq(PlanTemplateItemDO::getPlanTemplateId, templateId));
|
||||
}
|
||||
|
||||
default void deleteByTemplateIds(List<Long> templateIds){
|
||||
delete(new LambdaQueryWrapperX<PlanTemplateItemDO>()
|
||||
.in(PlanTemplateItemDO::getPlanTemplateId, templateIds));
|
||||
}
|
||||
|
||||
default List<PlanTemplateItemDO> selectByTemplateId(Long templateId) {
|
||||
return selectList(new LambdaQueryWrapperX<PlanTemplateItemDO>()
|
||||
.eq(PlanTemplateItemDO::getPlanTemplateId, templateId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.product.dal.mysql.schedule.config;
|
||||
|
||||
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.product.controller.admin.schedule.config.vo.ScheduleConfigPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.config.ScheduleConfigDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 排班配置 Mapper
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Mapper
|
||||
public interface ScheduleConfigMapper extends BaseMapperX<ScheduleConfigDO> {
|
||||
|
||||
default PageResult<ScheduleConfigDO> selectPage(ScheduleConfigPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ScheduleConfigDO>()
|
||||
.eqIfPresent(ScheduleConfigDO::getFactoryModelId, reqVO.getFactoryModelId())
|
||||
.likeIfPresent(ScheduleConfigDO::getFactoryModelCoding, reqVO.getFactoryModelCoding())
|
||||
.likeIfPresent(ScheduleConfigDO::getConfigCoding, reqVO.getConfigCoding())
|
||||
.likeIfPresent(ScheduleConfigDO::getConfigName, reqVO.getConfigName())
|
||||
.orderByDesc(ScheduleConfigDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package cn.iocoder.yudao.module.product.dal.mysql.schedule.data;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.data.ScheduleDataDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 排班数据 Mapper
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Mapper
|
||||
public interface ScheduleDataMapper extends BaseMapperX<ScheduleDataDO> {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.product.dal.mysql.schedule.rule;
|
||||
|
||||
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.product.controller.admin.schedule.rule.vo.ScheduleRulePageReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.rule.ScheduleRuleDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 排班规则 Mapper
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Mapper
|
||||
public interface ScheduleRuleMapper extends BaseMapperX<ScheduleRuleDO> {
|
||||
|
||||
default PageResult<ScheduleRuleDO> selectPage(ScheduleRulePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ScheduleRuleDO>()
|
||||
.eqIfPresent(ScheduleRuleDO::getScheduleConfigId, reqVO.getScheduleConfigId())
|
||||
.orderByAsc(ScheduleRuleDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.product.dal.mysql.schedule.shift;
|
||||
|
||||
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.product.controller.admin.schedule.shift.vo.ScheduleShiftPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.shift.ScheduleShiftDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 排班班次 Mapper
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Mapper
|
||||
public interface ScheduleShiftMapper extends BaseMapperX<ScheduleShiftDO> {
|
||||
|
||||
default PageResult<ScheduleShiftDO> selectPage(ScheduleShiftPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ScheduleShiftDO>()
|
||||
.eqIfPresent(ScheduleShiftDO::getScheduleConfigId, reqVO.getScheduleConfigId())
|
||||
.orderByAsc(ScheduleShiftDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.product.dal.mysql.schedule.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.product.controller.admin.schedule.team.vo.ScheduleTeamPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.team.ScheduleTeamDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
* 排班班组 Mapper
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Mapper
|
||||
public interface ScheduleTeamMapper extends BaseMapperX<ScheduleTeamDO> {
|
||||
|
||||
default PageResult<ScheduleTeamDO> selectPage(ScheduleTeamPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<ScheduleTeamDO>()
|
||||
.eqIfPresent(ScheduleTeamDO::getScheduleConfigId, reqVO.getScheduleConfigId())
|
||||
.orderByAsc(ScheduleTeamDO::getId));
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ import org.springframework.security.config.annotation.web.configurers.AuthorizeH
|
||||
*
|
||||
* @author ZT
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@Configuration("productSecurityConfiguration")
|
||||
public class SecurityConfiguration {
|
||||
|
||||
@Bean
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package cn.iocoder.yudao.module.product.service.factory.model;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.product.controller.admin.factory.model.vo.*;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.factory.model.FactoryModelDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 工厂模型 Service 接口
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
public interface FactoryModelService {
|
||||
|
||||
/**
|
||||
* 创建工厂模型
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
FactoryModelRespVO createFactoryModel(@Valid FactoryModelCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新工厂模型
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateFactoryModel(@Valid FactoryModelUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除工厂模型
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteFactoryModel(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除工厂模型
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteFactoryModelListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得工厂模型
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 工厂模型
|
||||
*/
|
||||
FactoryModelDO getFactoryModel(Long id);
|
||||
|
||||
/**
|
||||
* 获得工厂模型分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 工厂模型分页
|
||||
*/
|
||||
PageResult<FactoryModelDO> getFactoryModelPage(FactoryModelPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 绑定ERP工序
|
||||
* @param processBindReqVO 绑定信息
|
||||
*/
|
||||
void processBind(@Valid FactoryModelProcessBindReqVO processBindReqVO);
|
||||
|
||||
/**
|
||||
* 解绑ERP工序
|
||||
* @param processUnbindReqVO 解绑信息
|
||||
*/
|
||||
void processUnbind(@Valid FactoryModelProcessUnbindReqVO processUnbindReqVO);
|
||||
|
||||
/**
|
||||
* 启/停用模型
|
||||
* @param changeStatusReqVO
|
||||
*/
|
||||
void changeStatus(@Valid FactoryModelChangeStatusReqVO changeStatusReqVO);
|
||||
|
||||
/**
|
||||
* 获取工厂模型树节点数据
|
||||
* @param parentId 父节点id
|
||||
* @return
|
||||
*/
|
||||
List<FactoryModelDO> tree(Long parentId);
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
package cn.iocoder.yudao.module.product.service.factory.model;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
|
||||
import cn.iocoder.yudao.module.product.controller.admin.factory.model.vo.*;
|
||||
import cn.iocoder.yudao.module.product.convert.factory.model.FactoryModelConvert;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.factory.model.FactoryModelDO;
|
||||
import cn.iocoder.yudao.module.product.dal.mysql.factory.model.FactoryModelMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*;
|
||||
|
||||
|
||||
/**
|
||||
* 工厂模型 Service 实现类
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class FactoryModelServiceImpl implements FactoryModelService {
|
||||
|
||||
@Resource
|
||||
private FactoryModelMapper factoryModelMapper;
|
||||
|
||||
@Override
|
||||
public FactoryModelRespVO createFactoryModel(FactoryModelCreateReqVO createReqVO) {
|
||||
// 校验存在
|
||||
validateFactoryModelNodeCodeUnique(null, createReqVO.getNodeCoding());
|
||||
validateFactoryModelNodeNameUnique(null, createReqVO.getNodeName());
|
||||
|
||||
// 插入
|
||||
FactoryModelDO factoryModel = FactoryModelConvert.INSTANCE.convert(createReqVO);
|
||||
factoryModelMapper.insert(factoryModel);
|
||||
// 返回
|
||||
return FactoryModelConvert.INSTANCE.convert(factoryModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFactoryModel(FactoryModelUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateFactoryModelExists(updateReqVO.getId());
|
||||
validateFactoryModelNodeCodeUnique(updateReqVO.getId(), updateReqVO.getNodeCoding());
|
||||
validateFactoryModelNodeNameUnique(updateReqVO.getId(), updateReqVO.getNodeName());
|
||||
|
||||
// 更新
|
||||
FactoryModelDO updateObj = FactoryModelConvert.INSTANCE.convert(updateReqVO);
|
||||
factoryModelMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteFactoryModel(Long id) {
|
||||
// 校验存在
|
||||
validateFactoryModelExists(id);
|
||||
// 删除
|
||||
factoryModelMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteFactoryModelListByIds(List<Long> ids) {
|
||||
// 校验存在
|
||||
validateFactoryModelExists(ids);
|
||||
// 删除
|
||||
factoryModelMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FactoryModelDO getFactoryModel(Long id) {
|
||||
return factoryModelMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<FactoryModelDO> getFactoryModelPage(FactoryModelPageReqVO pageReqVO) {
|
||||
return factoryModelMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processBind(FactoryModelProcessBindReqVO processBindReqVO) {
|
||||
validateFactoryModelExists(processBindReqVO.getId());
|
||||
FactoryModelDO factoryModel = factoryModelMapper.selectById(processBindReqVO.getId());
|
||||
factoryModel.setErpProcessCoding(processBindReqVO.getErpProcessCoding());
|
||||
factoryModel.setErpProcessName(processBindReqVO.getErpProcessName());
|
||||
factoryModel.setErpProcessRouteCoding(processBindReqVO.getErpProcessRouteCoding());
|
||||
factoryModelMapper.updateById(factoryModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processUnbind(FactoryModelProcessUnbindReqVO processUnbindReqVO) {
|
||||
validateFactoryModelExists(processUnbindReqVO.getId());
|
||||
FactoryModelDO factoryModel = factoryModelMapper.selectById(processUnbindReqVO.getId());
|
||||
factoryModel.setErpProcessCoding("");
|
||||
factoryModel.setErpProcessName("");
|
||||
factoryModel.setErpProcessRouteCoding("");
|
||||
factoryModelMapper.updateById(factoryModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeStatus(FactoryModelChangeStatusReqVO changeStatusReqVO) {
|
||||
validateFactoryModelExists(changeStatusReqVO.getId());
|
||||
factoryModelMapper.update(new LambdaUpdateWrapper<FactoryModelDO>()
|
||||
.eq(FactoryModelDO::getId, changeStatusReqVO.getId())
|
||||
.set(FactoryModelDO::getNodeStatus, changeStatusReqVO.getNodeStatus())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FactoryModelDO> tree(Long parentId) {
|
||||
return factoryModelMapper.selectList(new LambdaQueryWrapperX<FactoryModelDO>()
|
||||
.eq(FactoryModelDO::getParentId, parentId)
|
||||
.orderByAsc(FactoryModelDO::getSort));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验节点编码
|
||||
*/
|
||||
private void validateFactoryModelNodeCodeUnique(Long id, String nodeCoding) {
|
||||
boolean exists = factoryModelMapper.exists(new LambdaQueryWrapperX<FactoryModelDO>()
|
||||
.neIfPresent(FactoryModelDO::getId, id)
|
||||
.eq(FactoryModelDO::getNodeCoding, nodeCoding));
|
||||
if (exists) {
|
||||
throw exception(FACTORY_MODEL_NODE_CODE_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验节点名称
|
||||
*/
|
||||
private void validateFactoryModelNodeNameUnique(Long id, String nodeName) {
|
||||
boolean exists = factoryModelMapper.exists(new LambdaQueryWrapperX<FactoryModelDO>()
|
||||
.neIfPresent(FactoryModelDO::getId, id)
|
||||
.eq(FactoryModelDO::getNodeName, nodeName));
|
||||
if (exists) {
|
||||
throw exception(FACTORY_MODEL_NODE_NAME_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateFactoryModelExists(List<Long> ids) {
|
||||
List<FactoryModelDO> list = factoryModelMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
|
||||
throw exception(FACTORY_MODEL_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateFactoryModelExists(Long id) {
|
||||
if (factoryModelMapper.selectById(id) == null) {
|
||||
throw exception(FACTORY_MODEL_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package cn.iocoder.yudao.module.product.service.plan.template;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.template.vo.PlanTemplateCopyReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.template.vo.PlanTemplatePageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.template.vo.PlanTemplateRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.template.vo.PlanTemplateSaveReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.plan.template.PlanTemplateDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 生产计划模板 Service 接口
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
public interface PlanTemplateService {
|
||||
|
||||
/**
|
||||
* 创建生产计划模板
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
PlanTemplateRespVO createPlanTemplate(@Valid PlanTemplateSaveReqVO createReqVO);
|
||||
|
||||
/*
|
||||
* 复制生产计划模板
|
||||
* */
|
||||
PlanTemplateRespVO copyPlanTemplate(@Valid PlanTemplateCopyReqVO copyReqVO);
|
||||
|
||||
/**
|
||||
* 更新生产计划模板
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updatePlanTemplate(@Valid PlanTemplateSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除生产计划模板
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deletePlanTemplate(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除生产计划模板
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deletePlanTemplateListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得生产计划模板
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 生产计划模板
|
||||
*/
|
||||
PlanTemplateDO getPlanTemplate(Long id);
|
||||
|
||||
/**
|
||||
* 获得生产计划模板分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 生产计划模板分页
|
||||
*/
|
||||
PageResult<PlanTemplateDO> getPlanTemplatePage(PlanTemplatePageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
package cn.iocoder.yudao.module.product.service.plan.template;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||
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.product.controller.admin.plan.template.vo.PlanTemplateCopyReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.template.vo.PlanTemplatePageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.template.vo.PlanTemplateRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.template.vo.PlanTemplateSaveReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.plan.template.PlanTemplateDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.plan.templatecolumn.PlanTemplateColumnDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.plan.templatecolumndata.PlanTemplateColumnDataDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.plan.templateitem.PlanTemplateItemDO;
|
||||
import cn.iocoder.yudao.module.product.dal.mysql.plan.template.PlanTemplateMapper;
|
||||
import cn.iocoder.yudao.module.product.enums.ErrorCodeConstants;
|
||||
import cn.iocoder.yudao.module.product.enums.PlanTemplateTypeEnums;
|
||||
import cn.iocoder.yudao.module.product.service.plan.templatecolumn.PlanTemplateColumnService;
|
||||
import cn.iocoder.yudao.module.product.service.plan.templatecolumndata.PlanTemplateColumnDataService;
|
||||
import cn.iocoder.yudao.module.product.service.plan.templateitem.PlanTemplateItemService;
|
||||
import cn.iocoder.yudao.module.system.api.sequence.SequenceApi;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* 生产计划模板 Service 实现类
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class PlanTemplateServiceImpl implements PlanTemplateService {
|
||||
|
||||
@Resource
|
||||
private PlanTemplateMapper planTemplateMapper;
|
||||
@Resource
|
||||
private PlanTemplateColumnService planTemplateColumnService;
|
||||
@Resource
|
||||
private PlanTemplateColumnDataService planTemplateColumnDataService;
|
||||
@Resource
|
||||
private PlanTemplateItemService planTemplateItemService;
|
||||
|
||||
@Resource
|
||||
private SequenceApi sequenceApi;
|
||||
|
||||
@Override
|
||||
public PlanTemplateRespVO createPlanTemplate(PlanTemplateSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
PlanTemplateDO planTemplate = BeanUtils.toBean(createReqVO, PlanTemplateDO.class);
|
||||
planTemplate.setId(null);
|
||||
String coding = getCoding(planTemplate);
|
||||
planTemplate.setTemplateCoding(coding);
|
||||
planTemplateMapper.insert(planTemplate);
|
||||
// 返回
|
||||
return BeanUtils.toBean(planTemplate, PlanTemplateRespVO.class);
|
||||
}
|
||||
|
||||
//生成编码
|
||||
private String getCoding(PlanTemplateDO planTemplate){
|
||||
String planType = planTemplate.getPlanType();
|
||||
if (StringUtils.isBlank(planType)){
|
||||
throw new ServiceException(ErrorCodeConstants.PLAN_TEMPLATE_PLAN_TYPE_IS_NULL);
|
||||
}
|
||||
String codeRule = PlanTemplateTypeEnums.getCodeRuleByType(planType);
|
||||
if (StringUtils.isBlank(codeRule)){
|
||||
throw new ServiceException(ErrorCodeConstants.PLAN_TEMPLATE_PLAN_TYPE_NOT_EXISTS);
|
||||
}
|
||||
try {
|
||||
CommonResult<String> nextSequence = sequenceApi.getNextSequence(codeRule, null, null);
|
||||
if (nextSequence != null && nextSequence.getCode() != null && nextSequence.getCode() == 0){
|
||||
return nextSequence.getData();
|
||||
}else {
|
||||
throw new ServiceException(ErrorCodeConstants.PLAN_TEMPLATE_PLAN_FAILED_TO_RETRIEVE_ENCODING);
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new ServiceException(ErrorCodeConstants.CODE_GENERATION_SERVICE_CALL_FAILED);
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public PlanTemplateRespVO copyPlanTemplate(PlanTemplateCopyReqVO copyReqVO) {
|
||||
Long id = copyReqVO.getId();
|
||||
PlanTemplateDO planTemplate = planTemplateMapper.selectById(id);
|
||||
if (planTemplate == null){
|
||||
throw new ServiceException(ErrorCodeConstants.PLAN_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
planTemplate.setId(null);
|
||||
planTemplateMapper.insert(planTemplate);
|
||||
|
||||
List<PlanTemplateColumnDO> planTemplateColumnList = planTemplateColumnService.getPlanTemplateColumnListByTemplateId(id);
|
||||
if(!planTemplateColumnList.isEmpty()){
|
||||
for (PlanTemplateColumnDO planTemplateColumn : planTemplateColumnList) {
|
||||
planTemplateColumn.setId(null);
|
||||
planTemplateColumn.setPlanTemplateId(planTemplate.getDeptId());
|
||||
}
|
||||
}
|
||||
List<PlanTemplateColumnDataDO> planTemplateColumnDataList = planTemplateColumnDataService.getPlanTemplateColumnDataListByTemplateId(id);
|
||||
if(!planTemplateColumnDataList.isEmpty()){
|
||||
for (PlanTemplateColumnDataDO planTemplateColumnDataDO : planTemplateColumnDataList) {
|
||||
planTemplateColumnDataDO.setId(null);
|
||||
planTemplateColumnDataDO.setPlanTemplateId(planTemplate.getId());
|
||||
}
|
||||
}
|
||||
List<PlanTemplateItemDO> planTemplateItem = planTemplateItemService.getPlanTemplateItemByTemplateId(id);
|
||||
if (!planTemplateItem.isEmpty()){
|
||||
for (PlanTemplateItemDO planTemplateItemDO : planTemplateItem) {
|
||||
planTemplateItemDO.setId(null);
|
||||
planTemplateItemDO.setPlanTemplateId(planTemplate.getId());
|
||||
}
|
||||
}
|
||||
|
||||
planTemplateColumnService.batchCreatePlanTemplateColumn(planTemplateColumnList);
|
||||
planTemplateColumnDataService.batchCreatePlanTemplateColumnData(planTemplateColumnDataList);
|
||||
planTemplateItemService.batchCreatePlanTemplateItem(planTemplateItem);
|
||||
|
||||
return BeanUtils.toBean(planTemplate, PlanTemplateRespVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlanTemplate(PlanTemplateSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validatePlanTemplateExists(updateReqVO.getId());
|
||||
// 更新
|
||||
PlanTemplateDO updateObj = BeanUtils.toBean(updateReqVO, PlanTemplateDO.class);
|
||||
//以下信息不允许修改
|
||||
updateObj.setTemplateCoding(null);
|
||||
updateObj.setPlanType(null);
|
||||
|
||||
planTemplateMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void deletePlanTemplate(Long id) {
|
||||
// 校验存在
|
||||
validatePlanTemplateExists(id);
|
||||
// 删除
|
||||
deleteSubById(id);
|
||||
planTemplateMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void deletePlanTemplateListByIds(List<Long> ids) {
|
||||
// 校验存在
|
||||
validatePlanTemplateExists(ids);
|
||||
// 删除
|
||||
deleteSubByIds(ids);
|
||||
planTemplateMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validatePlanTemplateExists(List<Long> ids) {
|
||||
List<PlanTemplateDO> list = planTemplateMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
|
||||
throw exception(ErrorCodeConstants.PLAN_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validatePlanTemplateExists(Long id) {
|
||||
if (planTemplateMapper.selectById(id) == null) {
|
||||
throw exception(ErrorCodeConstants.PLAN_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteSubById(Long id){
|
||||
planTemplateColumnService.deletePlanTemplateColumnListByTemplateId(id);
|
||||
planTemplateColumnDataService.deletePlanTemplateColumnDataListByTemplateId(id);
|
||||
planTemplateItemService.deletePlanTemplateItemListByTemplateId(id);
|
||||
}
|
||||
|
||||
private void deleteSubByIds(List<Long> ids){
|
||||
planTemplateColumnService.deletePlanTemplateColumnListByTemplateIds(ids);
|
||||
planTemplateColumnDataService.deletePlanTemplateColumnDataListByTemplateIds(ids);
|
||||
planTemplateItemService.deletePlanTemplateItemListByTemplateIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlanTemplateDO getPlanTemplate(Long id) {
|
||||
return planTemplateMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PlanTemplateDO> getPlanTemplatePage(PlanTemplatePageReqVO pageReqVO) {
|
||||
return planTemplateMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package cn.iocoder.yudao.module.product.service.plan.templatecolumn;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumn.vo.PlanTemplateColumnPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumn.vo.PlanTemplateColumnRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumn.vo.PlanTemplateColumnSaveReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.plan.templatecolumn.PlanTemplateColumnDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 生产计划模板动态列 Service 接口
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
public interface PlanTemplateColumnService {
|
||||
|
||||
/**
|
||||
* 创建生产计划模板动态列
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
PlanTemplateColumnRespVO createPlanTemplateColumn(@Valid PlanTemplateColumnSaveReqVO createReqVO);
|
||||
|
||||
/*
|
||||
* 前端批量提交数据
|
||||
* */
|
||||
void saveBatchPlanTemplateColumn(@Valid List<PlanTemplateColumnSaveReqVO> saveReqVOList);
|
||||
|
||||
/*
|
||||
* 复制功能-批量添加数据
|
||||
* */
|
||||
void batchCreatePlanTemplateColumn(List<PlanTemplateColumnDO> columnDOList);
|
||||
|
||||
/**
|
||||
* 更新生产计划模板动态列
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updatePlanTemplateColumn(@Valid PlanTemplateColumnSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除生产计划模板动态列
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deletePlanTemplateColumn(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除生产计划模板动态列
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deletePlanTemplateColumnListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得生产计划模板动态列
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 生产计划模板动态列
|
||||
*/
|
||||
PlanTemplateColumnDO getPlanTemplateColumn(Long id);
|
||||
|
||||
/**
|
||||
* 获得生产计划模板动态列分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 生产计划模板动态列分页
|
||||
*/
|
||||
PageResult<PlanTemplateColumnDO> getPlanTemplateColumnPage(PlanTemplateColumnPageReqVO pageReqVO);
|
||||
|
||||
/*
|
||||
* 根据模板id删除动态列
|
||||
* */
|
||||
void deletePlanTemplateColumnListByTemplateId(Long templateId);
|
||||
|
||||
/*
|
||||
* 根据模板id批量删除动态列
|
||||
* */
|
||||
void deletePlanTemplateColumnListByTemplateIds(List<Long> templateIds);
|
||||
|
||||
/*
|
||||
* 根据模板id获取动态列
|
||||
* */
|
||||
List<PlanTemplateColumnDO> getPlanTemplateColumnListByTemplateId(Long templateId);
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
package cn.iocoder.yudao.module.product.service.plan.templatecolumn;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumn.vo.PlanTemplateColumnPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumn.vo.PlanTemplateColumnRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumn.vo.PlanTemplateColumnSaveReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.plan.templatecolumn.PlanTemplateColumnDO;
|
||||
import cn.iocoder.yudao.module.product.dal.mysql.plan.templatecolumn.PlanTemplateColumnMapper;
|
||||
import cn.iocoder.yudao.module.product.enums.ErrorCodeConstants;
|
||||
import cn.iocoder.yudao.module.product.service.plan.templatecolumndata.PlanTemplateColumnDataService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* 生产计划模板动态列 Service 实现类
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class PlanTemplateColumnServiceImpl implements PlanTemplateColumnService {
|
||||
|
||||
@Resource
|
||||
private PlanTemplateColumnMapper planTemplateColumnMapper;
|
||||
@Resource
|
||||
private PlanTemplateColumnDataService planTemplateColumnDataService;
|
||||
|
||||
@Override
|
||||
public PlanTemplateColumnRespVO createPlanTemplateColumn(PlanTemplateColumnSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
PlanTemplateColumnDO planTemplateColumn = BeanUtils.toBean(createReqVO, PlanTemplateColumnDO.class);
|
||||
planTemplateColumnMapper.insert(planTemplateColumn);
|
||||
// 返回
|
||||
return BeanUtils.toBean(planTemplateColumn, PlanTemplateColumnRespVO.class);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void saveBatchPlanTemplateColumn(List<PlanTemplateColumnSaveReqVO> columnSaveReqVOList) {
|
||||
//校验编码重复
|
||||
validatePlanTemplateColumnCode(columnSaveReqVOList);
|
||||
|
||||
List<PlanTemplateColumnDO> insertList = new ArrayList<>(columnSaveReqVOList.size());
|
||||
List<PlanTemplateColumnDO> updateList = new ArrayList<>(columnSaveReqVOList.size());
|
||||
List<Long> deleteList = new ArrayList<>(columnSaveReqVOList.size());
|
||||
for (PlanTemplateColumnSaveReqVO planTemplateColumnSaveReqVO : columnSaveReqVOList) {
|
||||
PlanTemplateColumnDO templateColumnDO = BeanUtils.toBean(planTemplateColumnSaveReqVO, PlanTemplateColumnDO.class);
|
||||
if ("INSERT".equalsIgnoreCase(planTemplateColumnSaveReqVO.getOperation())){
|
||||
templateColumnDO.setId(null);
|
||||
insertList.add(templateColumnDO);
|
||||
}else if ("UPDATE".equalsIgnoreCase(planTemplateColumnSaveReqVO.getOperation())){
|
||||
//不允许修改编码
|
||||
templateColumnDO.setColumnCoding(null);
|
||||
updateList.add(templateColumnDO);
|
||||
}else if ("DELETE".equalsIgnoreCase(planTemplateColumnSaveReqVO.getOperation())){
|
||||
deleteList.add(planTemplateColumnSaveReqVO.getId());
|
||||
}else {
|
||||
throw exception(ErrorCodeConstants.PLAN_TEMPLATE_COLUMN_OPERATION_ID_IS_NULL);
|
||||
}
|
||||
}
|
||||
planTemplateColumnMapper.insertBatch(insertList);
|
||||
planTemplateColumnMapper.updateById(updateList);
|
||||
planTemplateColumnMapper.deleteByIds(deleteList);
|
||||
}
|
||||
|
||||
private void validatePlanTemplateColumnCode(List<PlanTemplateColumnSaveReqVO> columnSaveReqVOList) {
|
||||
List<String> codings = columnSaveReqVOList.stream().filter(columSave -> "INSERT".equalsIgnoreCase(columSave.getOperation())).map(PlanTemplateColumnSaveReqVO::getColumnCoding).toList();
|
||||
Long selectCount = planTemplateColumnMapper.selectCount(new LambdaQueryWrapperX<PlanTemplateColumnDO>().in(PlanTemplateColumnDO::getColumnCoding, codings));
|
||||
if (selectCount != null && selectCount > 0) {
|
||||
throw exception(ErrorCodeConstants.PLAN_TEMPLATE_COLUMN_ENCODING_INFORMATION_ALREADY_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchCreatePlanTemplateColumn(List<PlanTemplateColumnDO> columnDOList) {
|
||||
// 批量插入
|
||||
planTemplateColumnMapper.insertBatch(columnDOList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlanTemplateColumn(PlanTemplateColumnSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validatePlanTemplateColumnExists(updateReqVO.getId());
|
||||
// 更新
|
||||
PlanTemplateColumnDO updateObj = BeanUtils.toBean(updateReqVO, PlanTemplateColumnDO.class);
|
||||
planTemplateColumnMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void deletePlanTemplateColumn(Long id) {
|
||||
// 校验存在
|
||||
validatePlanTemplateColumnExists(id);
|
||||
// 删除
|
||||
planTemplateColumnDataService.deletePlanTemplateColumnDataListByTemplateColumnId(id);
|
||||
planTemplateColumnMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void deletePlanTemplateColumnListByIds(List<Long> ids) {
|
||||
// 校验存在
|
||||
validatePlanTemplateColumnExists(ids);
|
||||
// 删除
|
||||
planTemplateColumnDataService.deletePlanTemplateColumnDataListByTemplateColumnIds(ids);
|
||||
planTemplateColumnMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validatePlanTemplateColumnExists(List<Long> ids) {
|
||||
List<PlanTemplateColumnDO> list = planTemplateColumnMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
|
||||
throw exception(ErrorCodeConstants.PLAN_TEMPLATE_COLUMN_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validatePlanTemplateColumnExists(Long id) {
|
||||
if (planTemplateColumnMapper.selectById(id) == null) {
|
||||
throw exception(ErrorCodeConstants.PLAN_TEMPLATE_COLUMN_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlanTemplateColumnDO getPlanTemplateColumn(Long id) {
|
||||
return planTemplateColumnMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PlanTemplateColumnDO> getPlanTemplateColumnPage(PlanTemplateColumnPageReqVO pageReqVO) {
|
||||
return planTemplateColumnMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePlanTemplateColumnListByTemplateId(Long templateId) {
|
||||
planTemplateColumnMapper.deleteByTemplateId(templateId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePlanTemplateColumnListByTemplateIds(List<Long> templateIds) {
|
||||
planTemplateColumnMapper.deleteByTemplateIds(templateIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PlanTemplateColumnDO> getPlanTemplateColumnListByTemplateId(Long templateId) {
|
||||
return planTemplateColumnMapper.selectByTemplateId(templateId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package cn.iocoder.yudao.module.product.service.plan.templatecolumndata;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumndata.vo.PlanTemplateColumnDataPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumndata.vo.PlanTemplateColumnDataRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumndata.vo.PlanTemplateColumnDataSaveReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.plan.templatecolumndata.PlanTemplateColumnDataDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 生产计划模板动态列数据 Service 接口
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
public interface PlanTemplateColumnDataService {
|
||||
|
||||
/**
|
||||
* 创建生产计划模板动态列数据
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
PlanTemplateColumnDataRespVO createPlanTemplateColumnData(@Valid PlanTemplateColumnDataSaveReqVO createReqVO);
|
||||
|
||||
/*
|
||||
* 批量添加数据-复制
|
||||
* */
|
||||
void batchCreatePlanTemplateColumnData(List<PlanTemplateColumnDataDO> columnDataDOList);
|
||||
|
||||
/**
|
||||
* 更新生产计划模板动态列数据
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updatePlanTemplateColumnData(@Valid PlanTemplateColumnDataSaveReqVO updateReqVO);
|
||||
|
||||
/*
|
||||
* 批量更新数据
|
||||
* */
|
||||
void batchUpdatePlanTemplateColumnData(@Valid List<PlanTemplateColumnDataDO> columnDataDOList);
|
||||
|
||||
/**
|
||||
* 删除生产计划模板动态列数据
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deletePlanTemplateColumnData(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除生产计划模板动态列数据
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deletePlanTemplateColumnDataListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得生产计划模板动态列数据
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 生产计划模板动态列数据
|
||||
*/
|
||||
PlanTemplateColumnDataDO getPlanTemplateColumnData(Long id);
|
||||
|
||||
/**
|
||||
* 获得生产计划模板动态列数据分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 生产计划模板动态列数据分页
|
||||
*/
|
||||
PageResult<PlanTemplateColumnDataDO> getPlanTemplateColumnDataPage(PlanTemplateColumnDataPageReqVO pageReqVO);
|
||||
|
||||
/*
|
||||
* 根据templateId删除动态列数据
|
||||
* */
|
||||
void deletePlanTemplateColumnDataListByTemplateId(Long templateId);
|
||||
|
||||
/*
|
||||
* 根据templateId批量删除动态列数据
|
||||
* */
|
||||
void deletePlanTemplateColumnDataListByTemplateIds(List<Long> templateIds);
|
||||
|
||||
/*
|
||||
* 根据TemplateColumnId删除动态列数据
|
||||
* */
|
||||
void deletePlanTemplateColumnDataListByTemplateColumnId(Long columnId);
|
||||
|
||||
/*
|
||||
* 根据TemplateColumnId批量删除动态列数据
|
||||
* */
|
||||
void deletePlanTemplateColumnDataListByTemplateColumnIds(List<Long> columnIds);
|
||||
|
||||
/*
|
||||
* 根据templateId删除动态列数据
|
||||
* */
|
||||
void deletePlanTemplateColumnDataListByTemplateItemId(Long templateItemId);
|
||||
|
||||
/*
|
||||
* 根据templateId批量删除动态列数据
|
||||
* */
|
||||
void deletePlanTemplateColumnDataListByTemplateItemIds(List<Long> templateItemIds);
|
||||
|
||||
List<PlanTemplateColumnDataDO> getPlanTemplateColumnDataListByTemplateId(Long templateId);
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package cn.iocoder.yudao.module.product.service.plan.templatecolumndata;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumndata.vo.PlanTemplateColumnDataPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumndata.vo.PlanTemplateColumnDataRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumndata.vo.PlanTemplateColumnDataSaveReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.plan.templatecolumndata.PlanTemplateColumnDataDO;
|
||||
import cn.iocoder.yudao.module.product.dal.mysql.plan.templatecolumndata.PlanTemplateColumnDataMapper;
|
||||
import cn.iocoder.yudao.module.product.enums.ErrorCodeConstants;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* 生产计划模板动态列数据 Service 实现类
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class PlanTemplateColumnDataServiceImpl implements PlanTemplateColumnDataService {
|
||||
|
||||
@Resource
|
||||
private PlanTemplateColumnDataMapper planTemplateColumnDataMapper;
|
||||
|
||||
@Override
|
||||
public PlanTemplateColumnDataRespVO createPlanTemplateColumnData(PlanTemplateColumnDataSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
PlanTemplateColumnDataDO planTemplateColumnData = BeanUtils.toBean(createReqVO, PlanTemplateColumnDataDO.class);
|
||||
planTemplateColumnDataMapper.insert(planTemplateColumnData);
|
||||
// 返回
|
||||
return BeanUtils.toBean(planTemplateColumnData, PlanTemplateColumnDataRespVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchCreatePlanTemplateColumnData(List<PlanTemplateColumnDataDO> columnDataDOList) {
|
||||
planTemplateColumnDataMapper.insertBatch(columnDataDOList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlanTemplateColumnData(PlanTemplateColumnDataSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validatePlanTemplateColumnDataExists(updateReqVO.getId());
|
||||
// 更新
|
||||
PlanTemplateColumnDataDO updateObj = BeanUtils.toBean(updateReqVO, PlanTemplateColumnDataDO.class);
|
||||
planTemplateColumnDataMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchUpdatePlanTemplateColumnData(List<PlanTemplateColumnDataDO> columnDataDOList) {
|
||||
planTemplateColumnDataMapper.updateById(columnDataDOList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePlanTemplateColumnData(Long id) {
|
||||
// 校验存在
|
||||
validatePlanTemplateColumnDataExists(id);
|
||||
// 删除
|
||||
planTemplateColumnDataMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePlanTemplateColumnDataListByIds(List<Long> ids) {
|
||||
// 校验存在
|
||||
validatePlanTemplateColumnDataExists(ids);
|
||||
// 删除
|
||||
planTemplateColumnDataMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validatePlanTemplateColumnDataExists(List<Long> ids) {
|
||||
List<PlanTemplateColumnDataDO> list = planTemplateColumnDataMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
|
||||
throw exception(ErrorCodeConstants.PLAN_TEMPLATE_COLUMN_DATA_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validatePlanTemplateColumnDataExists(Long id) {
|
||||
if (planTemplateColumnDataMapper.selectById(id) == null) {
|
||||
throw exception(ErrorCodeConstants.PLAN_TEMPLATE_COLUMN_DATA_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlanTemplateColumnDataDO getPlanTemplateColumnData(Long id) {
|
||||
return planTemplateColumnDataMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PlanTemplateColumnDataDO> getPlanTemplateColumnDataPage(PlanTemplateColumnDataPageReqVO pageReqVO) {
|
||||
return planTemplateColumnDataMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePlanTemplateColumnDataListByTemplateId(Long templateId) {
|
||||
planTemplateColumnDataMapper.deleteByTemplateId(templateId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePlanTemplateColumnDataListByTemplateIds(List<Long> templateIds) {
|
||||
planTemplateColumnDataMapper.deleteByTemplateIds(templateIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePlanTemplateColumnDataListByTemplateColumnId(Long templateColumnId) {
|
||||
planTemplateColumnDataMapper.deleteByTemplateColumnId(templateColumnId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePlanTemplateColumnDataListByTemplateColumnIds(List<Long> templateColumnIds) {
|
||||
planTemplateColumnDataMapper.deleteByTemplateColumnIds(templateColumnIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePlanTemplateColumnDataListByTemplateItemId(Long templateItemId) {
|
||||
planTemplateColumnDataMapper.deleteByTemplateItemId(templateItemId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePlanTemplateColumnDataListByTemplateItemIds(List<Long> templateItemIds) {
|
||||
planTemplateColumnDataMapper.deleteByTemplateItemIds(templateItemIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PlanTemplateColumnDataDO> getPlanTemplateColumnDataListByTemplateId(Long templateId) {
|
||||
return planTemplateColumnDataMapper.selectByTemplateId(templateId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package cn.iocoder.yudao.module.product.service.plan.templateitem;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templateitem.vo.PlanTemplateItemPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templateitem.vo.PlanTemplateItemRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templateitem.vo.PlanTemplateItemSaveReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.plan.templateitem.PlanTemplateItemDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 生产计划模板项目 Service 接口
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
public interface PlanTemplateItemService {
|
||||
|
||||
/**
|
||||
* 创建生产计划模板项目
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
PlanTemplateItemRespVO createPlanTemplateItem(@Valid PlanTemplateItemSaveReqVO createReqVO);
|
||||
|
||||
/*
|
||||
* 前端批量提交数据
|
||||
* */
|
||||
void saveBatchPlanTemplateItem(@Valid List<PlanTemplateItemSaveReqVO> saveReqVOList);
|
||||
|
||||
/*
|
||||
* 批量添加数据
|
||||
* */
|
||||
void batchCreatePlanTemplateItem(List<PlanTemplateItemDO> itemDOList);
|
||||
|
||||
/**
|
||||
* 更新生产计划模板项目
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updatePlanTemplateItem(@Valid PlanTemplateItemSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除生产计划模板项目
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deletePlanTemplateItem(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除生产计划模板项目
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deletePlanTemplateItemListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得生产计划模板项目
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 生产计划模板项目
|
||||
*/
|
||||
PlanTemplateItemDO getPlanTemplateItem(Long id);
|
||||
|
||||
/**
|
||||
* 获得生产计划模板项目分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 生产计划模板项目分页
|
||||
*/
|
||||
PageResult<PlanTemplateItemRespVO> getPlanTemplateItemPage(PlanTemplateItemPageReqVO pageReqVO);
|
||||
|
||||
/*
|
||||
* 根据templateId删除模板项目
|
||||
* */
|
||||
void deletePlanTemplateItemListByTemplateId(Long templateId);
|
||||
|
||||
/*
|
||||
* 根据templateId批量删除模板项目
|
||||
* */
|
||||
void deletePlanTemplateItemListByTemplateIds(List<Long> templateIds);
|
||||
|
||||
List<PlanTemplateItemDO> getPlanTemplateItemByTemplateId(Long templateId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
package cn.iocoder.yudao.module.product.service.plan.templateitem;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templatecolumndata.vo.PlanTemplateColumnDataRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templateitem.vo.PlanTemplateItemPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templateitem.vo.PlanTemplateItemRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.plan.templateitem.vo.PlanTemplateItemSaveReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.plan.templatecolumndata.PlanTemplateColumnDataDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.plan.templateitem.PlanTemplateItemDO;
|
||||
import cn.iocoder.yudao.module.product.dal.mysql.plan.templateitem.PlanTemplateItemMapper;
|
||||
import cn.iocoder.yudao.module.product.enums.ErrorCodeConstants;
|
||||
import cn.iocoder.yudao.module.product.service.plan.templatecolumndata.PlanTemplateColumnDataService;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* 生产计划模板项目 Service 实现类
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class PlanTemplateItemServiceImpl implements PlanTemplateItemService {
|
||||
|
||||
@Resource
|
||||
private PlanTemplateItemMapper planTemplateItemMapper;
|
||||
@Resource
|
||||
private PlanTemplateColumnDataService planTemplateColumnDataService;
|
||||
|
||||
@Override
|
||||
public PlanTemplateItemRespVO createPlanTemplateItem(PlanTemplateItemSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
PlanTemplateItemDO planTemplateItem = BeanUtils.toBean(createReqVO, PlanTemplateItemDO.class);
|
||||
planTemplateItemMapper.insert(planTemplateItem);
|
||||
// 返回
|
||||
return BeanUtils.toBean(planTemplateItem, PlanTemplateItemRespVO.class);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void saveBatchPlanTemplateItem(List<PlanTemplateItemSaveReqVO> saveReqVOList) {
|
||||
List<PlanTemplateItemDO> insertList = new ArrayList<>(saveReqVOList.size());
|
||||
List<PlanTemplateItemDO> updateList = new ArrayList<>(saveReqVOList.size());
|
||||
List<Long> deleteList = new ArrayList<>(saveReqVOList.size());
|
||||
List<PlanTemplateColumnDataDO> insertData = new ArrayList<>(saveReqVOList.size());
|
||||
List<PlanTemplateColumnDataDO> updateData = new ArrayList<>(saveReqVOList.size());
|
||||
//根据操作标识符,来判断数据的增删改
|
||||
for (PlanTemplateItemSaveReqVO planTemplateItemSaveReqVO : saveReqVOList) {
|
||||
PlanTemplateItemDO templateItemDO = BeanUtils.toBean(planTemplateItemSaveReqVO, PlanTemplateItemDO.class);
|
||||
if ("INSERT".equalsIgnoreCase(planTemplateItemSaveReqVO.getOperation())){
|
||||
long itemId = IdWorker.getId();
|
||||
templateItemDO.setId(itemId);
|
||||
insertList.add(templateItemDO);
|
||||
//处理动态列数据
|
||||
List<PlanTemplateColumnDataDO> planTemplateColumnDataDOS = handleColumnDataInsert(planTemplateItemSaveReqVO, itemId);
|
||||
insertData.addAll(planTemplateColumnDataDOS);
|
||||
}else if ("UPDATE".equalsIgnoreCase(planTemplateItemSaveReqVO.getOperation())){
|
||||
updateList.add(templateItemDO);
|
||||
//修改动态列数据
|
||||
List<PlanTemplateColumnDataDO> planTemplateColumnDataDOS = handleColumnDataUpdate(planTemplateItemSaveReqVO);
|
||||
updateData.addAll(planTemplateColumnDataDOS);
|
||||
}else if ("DELETE".equalsIgnoreCase(planTemplateItemSaveReqVO.getOperation())){
|
||||
deleteList.add(planTemplateItemSaveReqVO.getId());
|
||||
}else {
|
||||
throw exception(ErrorCodeConstants.PLAN_TEMPLATE_ITEM_OPERATION_ID_IS_NULL);
|
||||
}
|
||||
}
|
||||
if (!insertList.isEmpty()) {
|
||||
planTemplateItemMapper.insertBatch(insertList);
|
||||
}
|
||||
if (!updateList.isEmpty()) {
|
||||
planTemplateItemMapper.updateById(updateList);
|
||||
}
|
||||
if (!deleteList.isEmpty()) {
|
||||
//要同步删除子表数据,所以不要直接调用mapper
|
||||
deletePlanTemplateItemListByIds(deleteList);
|
||||
}
|
||||
//新增和修改动态列数据
|
||||
if (!insertData.isEmpty()) {
|
||||
planTemplateColumnDataService.batchCreatePlanTemplateColumnData(insertData);
|
||||
}
|
||||
if (!updateData.isEmpty()) {
|
||||
planTemplateColumnDataService.batchUpdatePlanTemplateColumnData(updateData);
|
||||
}
|
||||
}
|
||||
|
||||
//处理新增动态列数据,添加itemId,其他信息由前端处理
|
||||
private List<PlanTemplateColumnDataDO> handleColumnDataInsert(PlanTemplateItemSaveReqVO planTemplateItemSaveReqVO, long itemId) {
|
||||
Map<String, PlanTemplateColumnDataRespVO> columns = planTemplateItemSaveReqVO.getColumns();
|
||||
for (PlanTemplateColumnDataRespVO value : columns.values()) {
|
||||
value.setId(null);
|
||||
value.setPlanTemplateItemId(itemId);
|
||||
}
|
||||
return BeanUtils.toBean(columns.values().stream().toList(), PlanTemplateColumnDataDO.class);
|
||||
}
|
||||
|
||||
//更新动态列数据
|
||||
private List<PlanTemplateColumnDataDO> handleColumnDataUpdate(PlanTemplateItemSaveReqVO planTemplateItemSaveReqVO) {
|
||||
//新增动态列数据
|
||||
Map<String, PlanTemplateColumnDataRespVO> columns = planTemplateItemSaveReqVO.getColumns();
|
||||
return BeanUtils.toBean(columns.values().stream().toList(), PlanTemplateColumnDataDO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void batchCreatePlanTemplateItem(List<PlanTemplateItemDO> itemDOList) {
|
||||
planTemplateItemMapper.insertBatch(itemDOList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlanTemplateItem(PlanTemplateItemSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validatePlanTemplateItemExists(updateReqVO.getId());
|
||||
// 更新
|
||||
PlanTemplateItemDO updateObj = BeanUtils.toBean(updateReqVO, PlanTemplateItemDO.class);
|
||||
planTemplateItemMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void deletePlanTemplateItem(Long id) {
|
||||
// 校验存在
|
||||
validatePlanTemplateItemExists(id);
|
||||
// 删除
|
||||
planTemplateColumnDataService.deletePlanTemplateColumnDataListByTemplateItemId(id);
|
||||
planTemplateItemMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void deletePlanTemplateItemListByIds(List<Long> ids) {
|
||||
// 校验存在
|
||||
validatePlanTemplateItemExists(ids);
|
||||
// 删除
|
||||
planTemplateColumnDataService.deletePlanTemplateColumnDataListByTemplateItemIds(ids);
|
||||
planTemplateItemMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
private void validatePlanTemplateItemExists(List<Long> ids) {
|
||||
List<PlanTemplateItemDO> list = planTemplateItemMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
|
||||
throw exception(ErrorCodeConstants.PLAN_TEMPLATE_ITEM_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validatePlanTemplateItemExists(Long id) {
|
||||
if (planTemplateItemMapper.selectById(id) == null) {
|
||||
throw exception(ErrorCodeConstants.PLAN_TEMPLATE_ITEM_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlanTemplateItemDO getPlanTemplateItem(Long id) {
|
||||
return planTemplateItemMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PlanTemplateItemRespVO> getPlanTemplateItemPage(PlanTemplateItemPageReqVO pageReqVO) {
|
||||
PageResult<PlanTemplateItemDO> pageResult = planTemplateItemMapper.selectPage(pageReqVO);
|
||||
PageResult<PlanTemplateItemRespVO> voPageResult = BeanUtils.toBean(pageResult, PlanTemplateItemRespVO.class);
|
||||
List<PlanTemplateItemRespVO> resultList = voPageResult.getList();
|
||||
if (!resultList.isEmpty()) {
|
||||
List<PlanTemplateColumnDataDO> columnDataList = planTemplateColumnDataService.getPlanTemplateColumnDataListByTemplateId(pageReqVO.getPlanTemplateId());
|
||||
for (PlanTemplateItemRespVO templateItemRespVO : resultList) {
|
||||
Map<String, PlanTemplateColumnDataRespVO> map = new HashMap<>();
|
||||
templateItemRespVO.setColumns(map);
|
||||
for (PlanTemplateColumnDataDO planTemplateColumnDataDO : columnDataList) {
|
||||
if (planTemplateColumnDataDO.getPlanTemplateItemId().equals(templateItemRespVO.getId())) {
|
||||
PlanTemplateColumnDataRespVO columnDataRespVO = BeanUtils.toBean(planTemplateColumnDataDO, PlanTemplateColumnDataRespVO.class);
|
||||
map.put(planTemplateColumnDataDO.getColumnCoding(), columnDataRespVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return voPageResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePlanTemplateItemListByTemplateId(Long templateId) {
|
||||
planTemplateItemMapper.deleteByTemplateId(templateId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePlanTemplateItemListByTemplateIds(List<Long> templateIds) {
|
||||
planTemplateItemMapper.deleteByTemplateIds(templateIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PlanTemplateItemDO> getPlanTemplateItemByTemplateId(Long templateId) {
|
||||
return planTemplateItemMapper.selectByTemplateId(templateId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package cn.iocoder.yudao.module.product.service.schedule.config;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.config.vo.*;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.config.ScheduleConfigDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 排班配置 Service 接口
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
public interface ScheduleConfigService {
|
||||
|
||||
/**
|
||||
* 创建排班配置
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createScheduleConfig(@Valid ScheduleCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新排班配置
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateScheduleConfig(@Valid ScheduleUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除排班配置
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteScheduleConfig(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除排班配置
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteScheduleConfigListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得排班配置
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 排班配置
|
||||
*/
|
||||
ScheduleConfigDO getScheduleConfig(Long id);
|
||||
|
||||
/**
|
||||
* 获得排班配置分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 排班配置分页
|
||||
*/
|
||||
PageResult<ScheduleConfigDO> getScheduleConfigPage(ScheduleConfigPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,544 @@
|
||||
package cn.iocoder.yudao.module.product.service.schedule.config;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.config.vo.*;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.rule.vo.ScheduleRuleCreateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.rule.vo.ScheduleRuleUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.shift.vo.ScheduleShiftCreateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.shift.vo.ScheduleShiftUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.team.vo.ScheduleTeamCreateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.team.vo.ScheduleTeamUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.product.convert.schedule.config.ScheduleConfigConvert;
|
||||
import cn.iocoder.yudao.module.product.convert.schedule.shift.ScheduleShiftConvert;
|
||||
import cn.iocoder.yudao.module.product.convert.schedule.team.ScheduleTeamConvert;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.config.ScheduleConfigDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.data.ScheduleDataDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.rule.ScheduleRuleDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.shift.ScheduleShiftDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.team.ScheduleTeamDO;
|
||||
import cn.iocoder.yudao.module.product.dal.mysql.schedule.config.ScheduleConfigMapper;
|
||||
import cn.iocoder.yudao.module.product.dal.mysql.schedule.data.ScheduleDataMapper;
|
||||
import cn.iocoder.yudao.module.product.dal.mysql.schedule.rule.ScheduleRuleMapper;
|
||||
import cn.iocoder.yudao.module.product.dal.mysql.schedule.shift.ScheduleShiftMapper;
|
||||
import cn.iocoder.yudao.module.product.dal.mysql.schedule.team.ScheduleTeamMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*;
|
||||
|
||||
|
||||
/**
|
||||
* 排班配置 Service 实现类
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ScheduleConfigServiceImpl implements ScheduleConfigService {
|
||||
|
||||
@Resource
|
||||
private ScheduleConfigMapper scheduleConfigMapper;
|
||||
|
||||
@Resource
|
||||
private ScheduleTeamMapper scheduleTeamMapper;
|
||||
|
||||
@Resource
|
||||
private ScheduleShiftMapper scheduleShiftMapper;
|
||||
|
||||
@Resource
|
||||
private ScheduleRuleMapper scheduleRuleMapper;
|
||||
|
||||
@Resource
|
||||
private ScheduleDataMapper scheduleDataMapper;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public Long createScheduleConfig(ScheduleCreateReqVO createReqVO) {
|
||||
//基础信息处理
|
||||
//校验基础信息
|
||||
ScheduleConfigCreateReqVO scheduleConfigCreateReqVO = createReqVO.getScheduleConfig();
|
||||
validateScheduleConfigConfigCodingUnique(null, scheduleConfigCreateReqVO.getConfigCoding());
|
||||
validateScheduleConfigConfigNameUnique(null, scheduleConfigCreateReqVO.getConfigName());
|
||||
//插入基础信息
|
||||
ScheduleConfigDO scheduleConfig = ScheduleConfigConvert.INSTANCE.convert(scheduleConfigCreateReqVO);
|
||||
scheduleConfigMapper.insert(scheduleConfig);
|
||||
|
||||
//排班班组信息处理
|
||||
List<ScheduleTeamCreateReqVO> scheduleTeamCreateReqVOs = createReqVO.getScheduleTeams();
|
||||
Map<String, Long> teamNameIdMap = new HashMap<>(); //班组名称和id的map,用于保存rule
|
||||
if (CollectionUtils.isNotEmpty(scheduleTeamCreateReqVOs)) {
|
||||
//验证班组名称是否重复
|
||||
Set<String> seenNames = new HashSet<>();
|
||||
boolean hasDuplicate = false;
|
||||
for (ScheduleTeamCreateReqVO scheduleTeamCreateReqVO : scheduleTeamCreateReqVOs) {
|
||||
String teamName = scheduleTeamCreateReqVO.getTeamName();
|
||||
if (!seenNames.add(teamName)) {
|
||||
hasDuplicate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hasDuplicate) {
|
||||
throw exception(SCHEDULE_TEAM_NAME_EXISTS);
|
||||
}
|
||||
List<ScheduleTeamDO> scheduleTeams = ScheduleTeamConvert.INSTANCE.convertListByCreateReqVO(scheduleTeamCreateReqVOs);
|
||||
scheduleTeams.forEach(scheduleTeam -> {
|
||||
scheduleTeam.setScheduleConfigId(scheduleConfig.getId());
|
||||
scheduleTeam.setScheduleConfigCoding(scheduleConfig.getConfigCoding());
|
||||
});
|
||||
scheduleTeamMapper.insertBatch(scheduleTeams);
|
||||
scheduleTeams.forEach(team -> {
|
||||
teamNameIdMap.put(team.getTeamName(), team.getId());
|
||||
});
|
||||
}
|
||||
|
||||
//排班班次信息处理
|
||||
List<ScheduleShiftCreateReqVO> scheduleShiftCreateReqVOs = createReqVO.getScheduleShifts();
|
||||
Map<String, Long> shiftNameIdMap = new HashMap<>(); //班次名称和id的map,用于保存rule
|
||||
if (CollectionUtils.isNotEmpty(scheduleShiftCreateReqVOs)) {
|
||||
//验证班组次称是否重复
|
||||
Set<String> seenNames = new HashSet<>();
|
||||
boolean hasDuplicate = false;
|
||||
for (ScheduleShiftCreateReqVO scheduleShiftCreateReqVO : scheduleShiftCreateReqVOs) {
|
||||
String shiftName = scheduleShiftCreateReqVO.getShiftName();
|
||||
if (!seenNames.add(shiftName)) {
|
||||
hasDuplicate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hasDuplicate) {
|
||||
throw exception(SCHEDULE_SHIFT_NAME_EXISTS);
|
||||
}
|
||||
List<ScheduleShiftDO> scheduleShifts = ScheduleShiftConvert.INSTANCE.convertListByCreateReqVO(scheduleShiftCreateReqVOs);
|
||||
scheduleShifts.forEach(scheduleShift -> {
|
||||
scheduleShift.setScheduleConfigId(scheduleConfig.getId());
|
||||
scheduleShift.setScheduleConfigCoding(scheduleConfig.getConfigCoding());
|
||||
});
|
||||
scheduleShiftMapper.insertBatch(scheduleShifts);
|
||||
scheduleShifts.forEach(shift -> {
|
||||
shiftNameIdMap.put(shift.getShiftName(), shift.getId());
|
||||
});
|
||||
}
|
||||
|
||||
//排班规则信息处理
|
||||
List<ScheduleRuleCreateReqVO> scheduleRuleCreateReqVOs = createReqVO.getScheduleRules();
|
||||
if (CollectionUtils.isNotEmpty(scheduleRuleCreateReqVOs)) {
|
||||
//检测是否创建了班组
|
||||
if (MapUtils.isEmpty(teamNameIdMap)) {
|
||||
throw exception(SCHEDULE_TEAM_NOT_CREATE);
|
||||
}
|
||||
//检测是否创建了班次
|
||||
if (MapUtils.isEmpty(shiftNameIdMap)) {
|
||||
throw exception(SCHEDULE_SHIFT_NOT_CREATE);
|
||||
}
|
||||
//根据班次分组,检查班次的排班时间是否重复
|
||||
Map<String, List<ScheduleRuleCreateReqVO>> ruleShiftNameGroup = scheduleRuleCreateReqVOs.stream()
|
||||
.collect(Collectors.groupingBy(ScheduleRuleCreateReqVO::getScheduleShiftName));
|
||||
for (Map.Entry<String, List<ScheduleRuleCreateReqVO>> entry : ruleShiftNameGroup.entrySet()) {
|
||||
Set<String> seenNames = new HashSet<>();
|
||||
boolean hasDuplicate = false;
|
||||
for (ScheduleRuleCreateReqVO scheduleRuleCreateReqVO : entry.getValue()) {
|
||||
String date = scheduleRuleCreateReqVO.getScheduleDate().format(DateTimeFormatter.ofPattern(FORMAT_YEAR_MONTH_DAY));
|
||||
if (!seenNames.add(date)) {
|
||||
hasDuplicate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hasDuplicate) {
|
||||
throw exception(SCHEDULE_RULE_DATE_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
List<ScheduleRuleDO> scheduleRules = new ArrayList<>();
|
||||
//替换班组、班次的id
|
||||
for (ScheduleRuleCreateReqVO scheduleRuleCreateReqVO : scheduleRuleCreateReqVOs) {
|
||||
Long teamId = teamNameIdMap.get(scheduleRuleCreateReqVO.getScheduleTeamName());
|
||||
Long shiftId = shiftNameIdMap.get(scheduleRuleCreateReqVO.getScheduleShiftName());
|
||||
ScheduleRuleDO scheduleRuleDO = ScheduleRuleDO.builder()
|
||||
.scheduleConfigId(scheduleConfig.getId())
|
||||
.scheduleConfigCoding(scheduleConfig.getConfigCoding())
|
||||
.scheduleDate(scheduleRuleCreateReqVO.getScheduleDate())
|
||||
.scheduleTeamId(teamId)
|
||||
.scheduleShiftId(shiftId)
|
||||
.build();
|
||||
scheduleRules.add(scheduleRuleDO);
|
||||
}
|
||||
scheduleRuleMapper.insertBatch(scheduleRules);
|
||||
}
|
||||
return scheduleConfig.getId();
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateScheduleConfig(ScheduleUpdateReqVO updateReqVO) {
|
||||
//基础信息处理
|
||||
ScheduleConfigDO scheduleConfig = updateConfig(updateReqVO.getScheduleConfig());
|
||||
|
||||
//排班班组信息处理
|
||||
Map<String, Long> teamNameIdMap = updateScheduleTeam(updateReqVO.getScheduleTeams(), scheduleConfig.getId(), scheduleConfig.getConfigCoding());
|
||||
|
||||
//排班班次信息处理
|
||||
Map<String, Long> shiftNameIdMap = updateScheduleShift(updateReqVO.getScheduleShifts(), scheduleConfig.getId(), scheduleConfig.getConfigCoding());
|
||||
|
||||
//排班规则信息处理
|
||||
updateScheduleRule(updateReqVO.getScheduleRules(), teamNameIdMap, shiftNameIdMap, scheduleConfig.getId(), scheduleConfig.getConfigCoding());
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void deleteScheduleConfig(Long id) {
|
||||
cascadeDeleteConfig(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteScheduleConfigListByIds(List<Long> ids) {
|
||||
ids.forEach(this::cascadeDeleteConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScheduleConfigDO getScheduleConfig(Long id) {
|
||||
return scheduleConfigMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ScheduleConfigDO> getScheduleConfigPage(ScheduleConfigPageReqVO pageReqVO) {
|
||||
return scheduleConfigMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
private void validateScheduleConfigExists(List<Long> ids) {
|
||||
List<ScheduleConfigDO> list = scheduleConfigMapper.selectByIds(ids);
|
||||
if (CollUtil.isEmpty(list) || list.size() != ids.size()) {
|
||||
throw exception(SCHEDULE_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateScheduleConfigExists(Long id) {
|
||||
if (scheduleConfigMapper.selectById(id) == null) {
|
||||
throw exception(SCHEDULE_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验排班编码
|
||||
*/
|
||||
private void validateScheduleConfigConfigCodingUnique(Long id, String configCoding) {
|
||||
boolean exists = scheduleConfigMapper.exists(new LambdaQueryWrapperX<ScheduleConfigDO>()
|
||||
.neIfPresent(ScheduleConfigDO::getId, id)
|
||||
.eq(ScheduleConfigDO::getConfigCoding, configCoding));
|
||||
if (exists) {
|
||||
throw exception(SCHEDULE_CONFIG_CODE_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验排班名称
|
||||
*/
|
||||
private void validateScheduleConfigConfigNameUnique(Long id, String configName) {
|
||||
boolean exists = scheduleConfigMapper.exists(new LambdaQueryWrapperX<ScheduleConfigDO>()
|
||||
.neIfPresent(ScheduleConfigDO::getId, id)
|
||||
.eq(ScheduleConfigDO::getConfigName, configName));
|
||||
if (exists) {
|
||||
throw exception(SCHEDULE_CONFIG_NAME_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 级联删除排班配置
|
||||
*/
|
||||
private void cascadeDeleteConfig(Long id) {
|
||||
//校验存在
|
||||
validateScheduleConfigExists(id);
|
||||
scheduleConfigMapper.deleteById(id);
|
||||
//删除排班班组
|
||||
scheduleTeamMapper.delete(new LambdaQueryWrapperX<ScheduleTeamDO>().eq(ScheduleTeamDO::getScheduleConfigId, id));
|
||||
//删除排班班次
|
||||
scheduleShiftMapper.delete(new LambdaQueryWrapperX<ScheduleShiftDO>().eq(ScheduleShiftDO::getScheduleConfigId, id));
|
||||
//删除排班规则
|
||||
scheduleRuleMapper.delete(new LambdaQueryWrapperX<ScheduleRuleDO>().eq(ScheduleRuleDO::getScheduleConfigId, id));
|
||||
//删除排班数据
|
||||
scheduleDataMapper.delete(new LambdaQueryWrapperX<ScheduleDataDO>().eq(ScheduleDataDO::getScheduleConfigId, id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新排班配置
|
||||
*/
|
||||
private ScheduleConfigDO updateConfig(ScheduleConfigUpdateReqVO scheduleConfigUpdateReqVO) {
|
||||
//校验存在
|
||||
validateScheduleConfigExists(scheduleConfigUpdateReqVO.getId());
|
||||
validateScheduleConfigConfigCodingUnique(scheduleConfigUpdateReqVO.getId(), scheduleConfigUpdateReqVO.getConfigCoding());
|
||||
validateScheduleConfigConfigNameUnique(scheduleConfigUpdateReqVO.getId(), scheduleConfigUpdateReqVO.getConfigName());
|
||||
//更新
|
||||
ScheduleConfigDO scheduleConfig = ScheduleConfigConvert.INSTANCE.convert(scheduleConfigUpdateReqVO);
|
||||
scheduleConfigMapper.updateById(scheduleConfig);
|
||||
return scheduleConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* 排班班组信息处理
|
||||
*/
|
||||
private Map<String, Long> updateScheduleTeam(List<ScheduleTeamUpdateReqVO> scheduleTeamUpdateReqVOs, Long scheduleConfigId, String scheduleConfigCoding) {
|
||||
Map<String, Long> teamNameIdMap = new HashMap<>(); //班组名称和id的map,用于保存rule
|
||||
if (CollectionUtils.isEmpty(scheduleTeamUpdateReqVOs)) {
|
||||
//排班班组信息为空,删除已存在的排班班组
|
||||
scheduleTeamMapper.delete(new LambdaQueryWrapperX<ScheduleTeamDO>()
|
||||
.eq(ScheduleTeamDO::getScheduleConfigId, scheduleConfigId)
|
||||
);
|
||||
} else {
|
||||
//验证班组名称是否重复
|
||||
Set<String> seenNames = new HashSet<>();
|
||||
boolean hasDuplicate = false;
|
||||
for (ScheduleTeamUpdateReqVO scheduleTeamUpdateReqVO : scheduleTeamUpdateReqVOs) {
|
||||
String teamName = scheduleTeamUpdateReqVO.getTeamName();
|
||||
if (!seenNames.add(teamName)) {
|
||||
hasDuplicate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hasDuplicate) {
|
||||
throw exception(SCHEDULE_TEAM_NAME_EXISTS);
|
||||
}
|
||||
//转为实体类
|
||||
List<ScheduleTeamDO> scheduleTeams = ScheduleTeamConvert.INSTANCE.convertListByUpdateReqVO(scheduleTeamUpdateReqVOs);
|
||||
//需要更新的班组
|
||||
List<ScheduleTeamDO> scheduleTeamsUpdate = scheduleTeams.stream()
|
||||
.filter(st -> ObjectUtils.isNotEmpty(st.getId()))
|
||||
.toList();
|
||||
//需要更新的班组的id集合
|
||||
List<Long> updateReqIds = scheduleTeamsUpdate.stream()
|
||||
.map(ScheduleTeamDO::getId)
|
||||
.filter(ObjectUtils::isNotEmpty)
|
||||
.toList();
|
||||
//校验班组存在
|
||||
if (CollectionUtils.isNotEmpty(updateReqIds)) {
|
||||
List<ScheduleTeamDO> list = scheduleTeamMapper.selectByIds(updateReqIds);
|
||||
if (CollectionUtils.isEmpty(list) || list.size() != updateReqIds.size()) {
|
||||
throw exception(SCHEDULE_TEAM_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
//查询出原有的班组
|
||||
List<ScheduleTeamDO> existScheduleTeams = scheduleTeamMapper.selectList(new LambdaQueryWrapperX<ScheduleTeamDO>()
|
||||
.eq(ScheduleTeamDO::getScheduleConfigId, scheduleConfigId)
|
||||
);
|
||||
|
||||
//需要删除的班组
|
||||
List<ScheduleTeamDO> deleteScheduleTeams = existScheduleTeams.stream()
|
||||
.filter(st -> !updateReqIds.contains(st.getId()))
|
||||
.toList();
|
||||
//删除班组
|
||||
if (CollectionUtils.isNotEmpty(deleteScheduleTeams)) {
|
||||
scheduleTeamMapper.deleteByIds(deleteScheduleTeams);
|
||||
}
|
||||
|
||||
//更新班组
|
||||
scheduleTeamsUpdate.forEach(scheduleTeam -> {
|
||||
scheduleTeam.setScheduleConfigId(scheduleConfigId);
|
||||
scheduleTeam.setScheduleConfigCoding(scheduleConfigCoding);
|
||||
teamNameIdMap.put(scheduleTeam.getTeamName(), scheduleTeam.getId());
|
||||
});
|
||||
scheduleTeamMapper.updateById(scheduleTeamsUpdate);
|
||||
|
||||
//新建班组
|
||||
List<ScheduleTeamDO> scheduleTeamsCreate = scheduleTeams.stream()
|
||||
.filter(st -> ObjectUtils.isEmpty(st.getId()))
|
||||
.toList();
|
||||
scheduleTeamsCreate.forEach(scheduleTeam -> {
|
||||
scheduleTeam.setScheduleConfigId(scheduleConfigId);
|
||||
scheduleTeam.setScheduleConfigCoding(scheduleConfigCoding);
|
||||
});
|
||||
scheduleTeamMapper.insertBatch(scheduleTeamsCreate);
|
||||
|
||||
scheduleTeamsCreate.forEach(scheduleTeam -> {
|
||||
teamNameIdMap.put(scheduleTeam.getTeamName(), scheduleTeam.getId());
|
||||
});
|
||||
|
||||
}
|
||||
return teamNameIdMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 排班班次信息处理
|
||||
*/
|
||||
private Map<String, Long> updateScheduleShift(List<ScheduleShiftUpdateReqVO> scheduleShiftUpdateReqVOs, Long scheduleConfigId, String scheduleConfigCoding) {
|
||||
Map<String, Long> shiftNameIdMap = new HashMap<>(); //班次名称和id的map,用于保存rule
|
||||
if (CollectionUtils.isEmpty(scheduleShiftUpdateReqVOs)) {
|
||||
//排班班次信息为空,删除已存在的排班班次
|
||||
scheduleShiftMapper.delete(new LambdaQueryWrapperX<ScheduleShiftDO>()
|
||||
.eq(ScheduleShiftDO::getScheduleConfigId, scheduleConfigId)
|
||||
);
|
||||
} else {
|
||||
//验证班组次称是否重复
|
||||
Set<String> seenNames = new HashSet<>();
|
||||
boolean hasDuplicate = false;
|
||||
for (ScheduleShiftUpdateReqVO scheduleShiftUpdateReqVO : scheduleShiftUpdateReqVOs) {
|
||||
String shiftName = scheduleShiftUpdateReqVO.getShiftName();
|
||||
if (!seenNames.add(shiftName)) {
|
||||
hasDuplicate = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hasDuplicate) {
|
||||
throw exception(SCHEDULE_SHIFT_NAME_EXISTS);
|
||||
}
|
||||
//转为实体类
|
||||
List<ScheduleShiftDO> scheduleShifts = ScheduleShiftConvert.INSTANCE.convertListByUpdateReqVO(scheduleShiftUpdateReqVOs);
|
||||
//需要更新的班次
|
||||
List<ScheduleShiftDO> scheduleShiftsUpdate = scheduleShifts.stream()
|
||||
.filter(st -> ObjectUtils.isNotEmpty(st.getId()))
|
||||
.toList();
|
||||
//需要更新的班次id集合
|
||||
List<Long> updateReqIds = scheduleShiftsUpdate.stream()
|
||||
.map(ScheduleShiftDO::getId)
|
||||
.filter(ObjectUtils::isNotEmpty)
|
||||
.toList();
|
||||
//校验班次存在
|
||||
if (CollectionUtils.isNotEmpty(updateReqIds)) {
|
||||
List<ScheduleShiftDO> list = scheduleShiftMapper.selectByIds(updateReqIds);
|
||||
if (CollectionUtils.isEmpty(list) || list.size() != updateReqIds.size()) {
|
||||
throw exception(SCHEDULE_SHIFT_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
//查询出原有的班次
|
||||
List<ScheduleShiftDO> existScheduleShifts = scheduleShiftMapper.selectList(new LambdaQueryWrapperX<ScheduleShiftDO>()
|
||||
.eq(ScheduleShiftDO::getScheduleConfigId, scheduleConfigId)
|
||||
);
|
||||
|
||||
//需要删除的班次
|
||||
List<ScheduleShiftDO> deleteScheduleShifts = existScheduleShifts.stream()
|
||||
.filter(st -> !updateReqIds.contains(st.getId()))
|
||||
.toList();
|
||||
//删除班次
|
||||
if (CollectionUtils.isNotEmpty(deleteScheduleShifts)) {
|
||||
scheduleShiftMapper.deleteByIds(deleteScheduleShifts);
|
||||
}
|
||||
|
||||
//更新班次
|
||||
scheduleShiftsUpdate.forEach(scheduleShift -> {
|
||||
scheduleShift.setScheduleConfigId(scheduleConfigId);
|
||||
scheduleShift.setScheduleConfigCoding(scheduleConfigCoding);
|
||||
shiftNameIdMap.put(scheduleShift.getShiftName(), scheduleShift.getId());
|
||||
});
|
||||
scheduleShiftMapper.updateById(scheduleShiftsUpdate);
|
||||
|
||||
//新建班次
|
||||
List<ScheduleShiftDO> scheduleShiftsCreate = scheduleShifts.stream()
|
||||
.filter(st -> ObjectUtils.isEmpty(st.getId()))
|
||||
.toList();
|
||||
scheduleShiftsCreate.forEach(scheduleShift -> {
|
||||
scheduleShift.setScheduleConfigId(scheduleConfigId);
|
||||
scheduleShift.setScheduleConfigCoding(scheduleConfigCoding);
|
||||
});
|
||||
scheduleShiftMapper.insertBatch(scheduleShiftsCreate);
|
||||
|
||||
scheduleShiftsCreate.forEach(scheduleShift -> {
|
||||
shiftNameIdMap.put(scheduleShift.getShiftName(), scheduleShift.getId());
|
||||
});
|
||||
}
|
||||
return shiftNameIdMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 排班规则信息处理
|
||||
*/
|
||||
private void updateScheduleRule(List<ScheduleRuleUpdateReqVO> scheduleRuleUpdateReqVOs,
|
||||
Map<String, Long> teamNameIdMap,
|
||||
Map<String, Long> shiftNameIdMap,
|
||||
Long scheduleConfigId,
|
||||
String scheduleConfigCoding) {
|
||||
if (CollectionUtils.isEmpty(scheduleRuleUpdateReqVOs)) {
|
||||
//排班规则信息为空,删除已存在的排班规则
|
||||
scheduleRuleMapper.delete(new LambdaQueryWrapperX<ScheduleRuleDO>()
|
||||
.eq(ScheduleRuleDO::getScheduleConfigId, scheduleConfigId)
|
||||
);
|
||||
} else {
|
||||
//检查规则
|
||||
List<Long> updateReqIds = scheduleRuleUpdateReqVOs.stream()
|
||||
.map(ScheduleRuleUpdateReqVO::getId)
|
||||
.filter(ObjectUtils::isNotEmpty)
|
||||
.toList();
|
||||
if (CollectionUtils.isNotEmpty(updateReqIds)) {
|
||||
List<ScheduleRuleDO> list = scheduleRuleMapper.selectByIds(updateReqIds);
|
||||
if (CollectionUtils.isEmpty(list) || list.size() != updateReqIds.size()) {
|
||||
throw exception(SCHEDULE_RULE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
//检测是否创建了班组
|
||||
if (MapUtils.isEmpty(teamNameIdMap)) {
|
||||
throw exception(SCHEDULE_TEAM_NOT_CREATE);
|
||||
}
|
||||
//检测是否创建了班次
|
||||
if (MapUtils.isEmpty(shiftNameIdMap)) {
|
||||
throw exception(SCHEDULE_SHIFT_NOT_CREATE);
|
||||
}
|
||||
|
||||
//转为实体类
|
||||
List<ScheduleRuleDO> scheduleRules = new ArrayList<>();
|
||||
for (ScheduleRuleUpdateReqVO scheduleRuleUpdateReqVO : scheduleRuleUpdateReqVOs) {
|
||||
Long teamId = teamNameIdMap.get(scheduleRuleUpdateReqVO.getScheduleTeamName());
|
||||
Long shiftId = shiftNameIdMap.get(scheduleRuleUpdateReqVO.getScheduleShiftName());
|
||||
if (ObjectUtils.isEmpty(scheduleRuleUpdateReqVO.getId())) {
|
||||
ScheduleRuleDO scheduleRuleDO = ScheduleRuleDO.builder()
|
||||
.scheduleConfigId(scheduleConfigId)
|
||||
.scheduleConfigCoding(scheduleConfigCoding)
|
||||
.scheduleDate(scheduleRuleUpdateReqVO.getScheduleDate())
|
||||
.scheduleTeamId(teamId)
|
||||
.scheduleShiftId(shiftId)
|
||||
.build();
|
||||
scheduleRules.add(scheduleRuleDO);
|
||||
} else {
|
||||
ScheduleRuleDO scheduleRule = scheduleRuleMapper.selectById(scheduleRuleUpdateReqVO.getId());
|
||||
scheduleRule.setScheduleConfigId(scheduleConfigId);
|
||||
scheduleRule.setScheduleConfigCoding(scheduleConfigCoding);
|
||||
scheduleRule.setScheduleDate(scheduleRuleUpdateReqVO.getScheduleDate());
|
||||
scheduleRule.setScheduleTeamId(teamId);
|
||||
scheduleRule.setScheduleShiftId(shiftId);
|
||||
scheduleRules.add(scheduleRule);
|
||||
}
|
||||
}
|
||||
|
||||
//需要更新的规则
|
||||
List<ScheduleRuleDO> scheduleRulesUpdate = scheduleRules.stream()
|
||||
.filter(st -> ObjectUtils.isNotEmpty(st.getId()))
|
||||
.toList();
|
||||
|
||||
//查询出原有的规则
|
||||
List<ScheduleRuleDO> existScheduleRules = scheduleRuleMapper.selectList(new LambdaQueryWrapperX<ScheduleRuleDO>()
|
||||
.eq(ScheduleRuleDO::getScheduleConfigId, scheduleConfigId)
|
||||
);
|
||||
|
||||
//需要删除的规则
|
||||
List<ScheduleRuleDO> deleteScheduleRules = existScheduleRules.stream()
|
||||
.filter(st -> !updateReqIds.contains(st.getId()))
|
||||
.toList();
|
||||
//删除规则
|
||||
if (CollectionUtils.isNotEmpty(deleteScheduleRules)) {
|
||||
scheduleRuleMapper.deleteByIds(deleteScheduleRules);
|
||||
}
|
||||
|
||||
scheduleRuleMapper.updateById(scheduleRulesUpdate);
|
||||
|
||||
//新建规则
|
||||
List<ScheduleRuleDO> scheduleRulesCreate = scheduleRules.stream()
|
||||
.filter(st -> ObjectUtils.isEmpty(st.getId()))
|
||||
.toList();
|
||||
scheduleRuleMapper.insertBatch(scheduleRulesCreate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.product.service.schedule.data;
|
||||
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.data.vo.ScheduleDataGenerateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.schedule.data.vo.ScheduleDataListReqVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.schedule.data.ScheduleDataDO;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 排班数据 Service 接口
|
||||
*
|
||||
* @author 后台管理
|
||||
*/
|
||||
public interface ScheduleDataService {
|
||||
|
||||
/**
|
||||
* 获得排班数据列表
|
||||
*
|
||||
* @param reqVO 列表查询条件
|
||||
* @return
|
||||
*/
|
||||
List<ScheduleDataDO> getScheduleDataList(ScheduleDataListReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 生成排班数据
|
||||
* @param generateReqVO 生成信息
|
||||
*/
|
||||
void generateScheduleData(@Valid ScheduleDataGenerateReqVO generateReqVO);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user