diff --git a/.gitignore b/.gitignore index e55eb64b5..31e75d825 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,7 @@ target/ *.iml *.ipr *.class +*.json target/* ### NetBeans ### diff --git a/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/controller/admin/file/FileController.java b/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/controller/admin/file/FileController.java index 0720e8a44..d9c2f8c83 100644 --- a/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/controller/admin/file/FileController.java +++ b/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/controller/admin/file/FileController.java @@ -63,6 +63,7 @@ public class FileController { @PermitAll @Operation(summary = "下载文件") @Parameter(name = "configId", description = "配置编号", required = true) + @OperateLog(enable = false) public void getFileContent(HttpServletRequest request, HttpServletResponse response, @PathVariable("configId") Long configId) throws Exception { diff --git a/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/job/logger/AccessLogCleanJob.java b/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/job/logger/AccessLogCleanJob.java index 177368f77..ec825523d 100644 --- a/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/job/logger/AccessLogCleanJob.java +++ b/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/job/logger/AccessLogCleanJob.java @@ -4,6 +4,7 @@ import com.cf.imes.framework.organ.core.aop.OrganIgnore; import com.cf.imes.module.infra.service.logger.ApiAccessLogService; /*import com.xxl.job.core.handler.annotation.XxlJob;*/ import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -30,11 +31,12 @@ public class AccessLogCleanJob { */ private static final Integer DELETE_LIMIT = 100; - /* @XxlJob("accessLogCleanJob") + /* @XxlJob("accessLogCleanJob")*/ @OrganIgnore + /* @Scheduled(cron = "0 0 * * * ?")*/ public void execute() { Integer count = apiAccessLogService.cleanAccessLog(JOB_CLEAN_RETAIN_DAY, DELETE_LIMIT); log.info("[execute][定时执行清理访问日志数量 ({}) 个]", count); - }*/ + } } diff --git a/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/job/logger/ErrorLogCleanJob.java b/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/job/logger/ErrorLogCleanJob.java index 7d56c9b70..3d98a41b3 100644 --- a/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/job/logger/ErrorLogCleanJob.java +++ b/cf-module-infra/cf-module-infra-biz/src/main/java/com/cf/imes/module/infra/job/logger/ErrorLogCleanJob.java @@ -4,6 +4,7 @@ import com.cf.imes.framework.organ.core.aop.OrganIgnore; import com.cf.imes.module.infra.service.logger.ApiErrorLogService; /*import com.xxl.job.core.handler.annotation.XxlJob;*/ import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -30,11 +31,12 @@ public class ErrorLogCleanJob { */ private static final Integer DELETE_LIMIT = 100; - /* @XxlJob("errorLogCleanJob") + /*@XxlJob("errorLogCleanJob")*/ @OrganIgnore + /*@Scheduled(cron = "0 0 2 * * ?")*/ public void execute() { Integer count = apiErrorLogService.cleanErrorLog(JOB_CLEAN_RETAIN_DAY,DELETE_LIMIT); log.info("[execute][定时执行清理错误日志数量 ({}) 个]", count); - }*/ + } } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/pom.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/pom.xml index 487363bfc..95f6078ec 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/pom.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/pom.xml @@ -129,6 +129,10 @@ jakarta.servlet jakarta.servlet-api + + uk.co.jemos.podam + podam + diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/OptimizePlanController.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/OptimizePlanController.java index 937bc7051..d6557acbd 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/OptimizePlanController.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/OptimizePlanController.java @@ -4,7 +4,9 @@ import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.framework.operatelog.core.annotations.OperateLog; import com.cf.imes.module.executor.controller.admin.plan.vo.*; import com.cf.imes.module.executor.service.optimizeplan.OptimizePlanService; +import com.cf.imes.module.system.api.dataSource.DataSourceApi; import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.security.access.prepost.PreAuthorize; @@ -15,6 +17,7 @@ import javax.annotation.Resource; import javax.validation.Valid; import javax.validation.constraints.NotNull; import java.util.List; +import java.util.Map; /** * @author there @@ -74,11 +77,23 @@ public class OptimizePlanController { } @GetMapping("/getOptimizePlanParam") - @Operation(summary = "获取优化排单参数 (未完成)") + @Operation(summary = "获取优化排单参数 (mock)") @PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')") - public CommonResult getOptimizePlanParam (@RequestParam @Valid @NotNull(message = "排单id不能空") Long planId) { + @Parameter(name = "planId", description = "排单id", required = false) + public CommonResult getOptimizePlanParam (@RequestParam (required = false) Long planId) { + /* OptimizeParamRespVO data = RandomUtils.randomPojo(OptimizeParamRespVO.class); + return CommonResult.success(data);*/ //todo - return CommonResult.success(optimizePlanService.getOptimizePlanParam(planId)); + OptimizeParamRespVO optimizePlanParam = optimizePlanService.getOptimizePlanParam(planId); + return CommonResult.success(optimizePlanParam); } + + @GetMapping("/getLabelDataSourceValue") + @Operation(summary = "获取标签数据源value") + @PreAuthorize("@ss.hasPermission('executor:optimize-plate:create')") + public CommonResult> getLabelDataSourceValue(@Valid GetSourceDataReq req ) { + return CommonResult.success( optimizePlanService.getLabelDataSourceValue(req)); + + } } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/BlockPlaceMessage.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/BlockPlaceMessage.java new file mode 100644 index 000000000..2133b01d3 --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/BlockPlaceMessage.java @@ -0,0 +1,56 @@ +package com.cf.imes.module.executor.controller.admin.plan.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +/** + * @author Beal + */ +@Data +public class BlockPlaceMessage { + + @Schema(description = "自增板信息") + private String zzInfo; + @Schema(description = "大板ID") + private Integer bi; + @Schema(description = "小板号") + private Long bo; + @Schema(description = "位置X") + private Double x; + @Schema(description = "位置Y") + private Double y; + @Schema(description = "优化顺序") + private Double pi; + @Schema(description = "放置方式") + private Double ps; + @Schema(description = "开料顺序") + private Double ci; + @Schema(description = "下刀点位置") + private Double ca; + @Schema(description = "下刀点") + private Double cp; + @Schema(description = "未移动") + private Boolean ia; + @Schema(description = "是否重叠isOverlap") + private Boolean io; + @Schema(description = "是否排钻") + private Boolean dh; + @Schema(description = "是否造型") + private Boolean dm; + @Schema(description = "超限板 标识") + private Integer of; + @Schema(description = "板类型 普通=0 自增=1 ,余料=2(失效)") + private Integer type; + @Schema(description = "点阵") + private List points; + @Schema(description = "原造型偏移信息") + private OldSizeOutOff olgSizeOutOff; + @Schema(description = "尺寸扩展信息(造型)") + private SizeOutOff sizeOutOff; + @Schema(description = "跟优化位置 漂移多少?X") + private Double placeOffX; + @Schema(description = "跟优化位置 漂移多少?Y") + private Double placeOffY; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ContourData.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ContourData.java new file mode 100644 index 000000000..0db985f4e --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ContourData.java @@ -0,0 +1,9 @@ +package com.cf.imes.module.executor.controller.admin.plan.dto; + +import java.awt.Point; +import java.util.ArrayList; + +public class ContourData { + private ArrayList pts; //点集(二维向量(x,y)) + private Integer[] buls; //凸度(0直线段 >0逆时针方向 <0顺时针方向) +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/HoleDetail.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/HoleDetail.java new file mode 100644 index 000000000..a71ec0607 --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/HoleDetail.java @@ -0,0 +1,37 @@ +package com.cf.imes.module.executor.controller.admin.plan.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.swing.*; + +/** + * @projectName: cf_imes_server + * @author: 晨丰科技 + * @date: 2024/3/22 16:58 + */ +@Data +public class HoleDetail { + + private Integer holeId; + @Schema(description = "孔类别 大孔 = 0, 小孔 = 10, 木削 = 20, 木削大孔 = 21, 层板钉 = 30, 通孔 = 40, 造型孔 = -10, 连接杆 = 50") + private Integer holeType; + @Schema(description = "面 正面 = 0, 反面 = 1, 侧面 = 2, 左侧面 = 21, 右侧面 = 22, 上侧面 = 23, 下侧面 = 24, 弧形侧面 = 29, 异形侧面 = 30") + private Integer face; + @Schema(description = "坐标x") + private Integer pointX; + @Schema(description = "坐标y") + private Integer pointY; + @Schema(description = "坐标z") + private Integer pointZ; + @Schema(description = "半径") + private Integer radius; + @Schema(description = "深度") + private Integer depth; + @Schema(description = "起点坐标") + private Integer endPoint; + private Integer pointX2; + private Integer pointY2; + private Integer angle; + +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/Material.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/Material.java new file mode 100644 index 000000000..b25cdc051 --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/Material.java @@ -0,0 +1,87 @@ +package com.cf.imes.module.executor.controller.admin.plan.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import java.util.Date; +import java.util.List; + +/** + * @author Beal + */ +@Data +public class Material { + + @Schema(description = "生产单id") + private String orderId; + @Schema(description = "商品id") + private Integer goodsId; + @Schema(description = "商品名称") + private String goodsName; + @Schema(description = "规范") + private String specification; + @Schema(description = "材质") + private String metrial; + @Schema(description = "颜色") + private String color; + @Schema(description = "品牌") + private String brank; + @Schema(description = "宽") + private Integer width; + @Schema(description = "长") + private Integer length; + @Schema(description = "厚") + private Integer thickness; + @Schema(description = "修边值") + private Integer border; + @Schema(description = "开料刀直径") + private Integer cutDia; + @Schema(description = "开料间隙") + private Integer cutGap; + @Schema(description = "IsSorted") + private Boolean isSorted; + @Schema(description = "大板数") + private Integer boardCount; + @Schema(description = "最小大板ID") + private Integer minBoardId; + @Schema(description = "最大大板ID") + private Integer maxBoardId; + @Schema(description = "平均利用率") + private Double avgLyr_All; + @Schema(description = "前N平均利用率") + private Integer avgLyr_NoLastOne; + @Schema(description = "尾张利用率") + private Double lyr_LastOne; + @Schema(description = "组织id") + private Integer organId; + @Schema(description = "使用板信息列表") + private List usedBoardMessageList; + @Schema(description = "小板信息列表") + private List blockPlaceMessageList; + @Schema(description = "状态") + private Integer state; + @Schema(description = "有波纹") + private Boolean hasWave; + @Schema(description = "板材原宽") + private Integer orgWidth; + @Schema(description = "板材原长") + private Integer orgLength; + @Schema(description = "余料板数") + private Integer boardCountRemain; + @Schema(description = "余料板情况") + private String remainBoardMessage; + @Schema(description = "预洗值") + private Integer preCutValue; + @Schema(description = "废料板列表") + private List scrapBoardList; + @Schema(description = "是否辅助开料") + private Boolean helpCut; + @Schema(description = "同刀辅助 厚度") + private Integer sameKnifeHelpCutGap; + @Schema(description = "开料刀ID") + private Integer cutKnifeID; + @Schema(description = "辅助刀ID") + private Integer helpKnifeID; + @Schema(description = "最后保存时间") + private Date lastSaveDate; + +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ModelDetail.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ModelDetail.java new file mode 100644 index 000000000..2ebdc911d --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ModelDetail.java @@ -0,0 +1,32 @@ +package com.cf.imes.module.executor.controller.admin.plan.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +/** + * @projectName: cf_imes_server + * @author: 晨丰科技 + * @date: 2024/3/22 16:53 + */ +@Data +public class ModelDetail { + + @Schema(description = "造型ID") + private Integer modelId; + @Schema(description = "线ID") + private Integer lineId; + @Schema(description = "面 正面 = 0, 反面 = 1, 侧面 = 2, 左侧面 = 21, 右侧面 = 22, 上侧面 = 23, 下侧面 = 24, 弧形侧面 = 29, 异形侧面 = 30") + private Integer face; + @Schema(description = "刀号") + private String knifeName; + @Schema(description = "刀半径") + private Integer knifeRadius; + @Schema(description = "深度") + private Integer depth; + @Schema(description = "造型轮廓") + private OriginModelingData originModeling; + private List modelPoint; + private List modelOffSet; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ModelOffSet.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ModelOffSet.java new file mode 100644 index 000000000..24771acee --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ModelOffSet.java @@ -0,0 +1,19 @@ +package com.cf.imes.module.executor.controller.admin.plan.dto; + +import io.swagger.v3.oas.annotations.media.Schema; + +/** + * @projectName: cf_imes_server + * @author: 晨丰科技 + * @date: 2024/3/22 16:51 + */ +public class ModelOffSet { + + private String name; + @Schema(description = "面 正面 = 0, 反面 = 1, 侧面 = 2, 左侧面 = 21, 右侧面 = 22, 上侧面 = 23, 下侧面 = 24, 弧形侧面 = 29, 异形侧面 = 30") + private Integer face; + private Integer value; + private Integer radius; + private Integer deep; + private Integer angle; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ModelPoint.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ModelPoint.java new file mode 100644 index 000000000..17d265a1f --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ModelPoint.java @@ -0,0 +1,16 @@ +package com.cf.imes.module.executor.controller.admin.plan.dto; + +/** + * @projectName: cf_imes_server + * @author: 晨丰科技 + * @date: 2024/3/22 16:49 + */ +public class ModelPoint { + private Integer lineId; + private Integer pointId; + private Integer pointX; + private Integer pointY; + private Integer radius; + private Integer depth; + private Integer curve; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/OldPointDetail.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/OldPointDetail.java new file mode 100644 index 000000000..e2269dc58 --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/OldPointDetail.java @@ -0,0 +1,24 @@ +package com.cf.imes.module.executor.controller.admin.plan.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @projectName: cf_imes_server + * @author: 晨丰科技 + * @date: 2024/3/22 17:00 + */ +@Data +public class OldPointDetail { + @Schema(description = "点id") + private Long pointId; + @Schema(description = "x") + private Double pointX; + @Schema(description = "y") + private Double pointY; + @Schema(description = "曲线") + private Double curve; + @Schema(description = "密封尺寸") + private Double sealSize; + +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/OldSizeOutOff.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/OldSizeOutOff.java new file mode 100644 index 000000000..d83d54eb6 --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/OldSizeOutOff.java @@ -0,0 +1,24 @@ +package com.cf.imes.module.executor.controller.admin.plan.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @author Beal + */ +@Data +public class OldSizeOutOff { + private Integer left; + private Integer right; + private Integer upper; + private Integer under; + @Schema(description = "板外扩宽") + private Integer width; + @Schema(description = "板外扩长") + private Integer length; + @Schema(description = "排版外扩宽") + private Integer outWidth; + @Schema(description = "排版外扩长") + private Integer outLength; + private Boolean hasDone; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/OriginModelingData.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/OriginModelingData.java new file mode 100644 index 000000000..d97ca273b --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/OriginModelingData.java @@ -0,0 +1,24 @@ +package com.cf.imes.module.executor.controller.admin.plan.dto; + +import io.swagger.v3.oas.annotations.media.Schema; + +import java.util.Dictionary; + +public class OriginModelingData { + @Schema(description = "轮郭") + private ContourData outline; + @Schema(description = "孔轮廓") + private Dictionary holes; + @Schema(description ="厚度" ) + private Integer thickness; + @Schema(description = "0正面、1反面、2侧面") + private Integer dir; + @Schema(description = "刀半径") + private Integer knifeRadius; + @Schema(description = "槽加长") + private Integer addLen; + @Schema(description = "槽加宽") + private Integer addWidth; + @Schema(description = "槽加深") + private Integer addDepth; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/Point.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/Point.java new file mode 100644 index 000000000..c8550b3ba --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/Point.java @@ -0,0 +1,12 @@ +package com.cf.imes.module.executor.controller.admin.plan.dto; + +import lombok.Data; + +/** + * @author Beal + */ +@Data +public class Point { + private Double x; + private Double y; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/PointDetail.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/PointDetail.java new file mode 100644 index 000000000..50173769f --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/PointDetail.java @@ -0,0 +1,24 @@ +package com.cf.imes.module.executor.controller.admin.plan.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @projectName: cf_imes_server + * @author: 晨丰科技 + * @date: 2024/3/22 16:57 + */ +@Data +public class PointDetail { + + @Schema(description = "点id") + private Long pointId; + @Schema(description = "x") + private Double pointX; + @Schema(description = "y") + private Double pointY; + @Schema(description = "曲线") + private Double curve; + @Schema(description = "密封尺寸") + private Double sealSize; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ScrapBlock.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ScrapBlock.java new file mode 100644 index 000000000..b9d7b3702 --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ScrapBlock.java @@ -0,0 +1,31 @@ +package com.cf.imes.module.executor.controller.admin.plan.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +/** + * @author Beal + */ +@Data +public class ScrapBlock { + @Schema(description = "余料号") + private Long scrapNo; + @Schema(description = "是否异形") + private Boolean isUnRegular; + @Schema(description = "是否重叠") + private Boolean isOverlap; + @Schema(description = "是否已录入") + private Boolean isInstored; + private List points; + private String remark; + @Schema(description = "坐标X") + private Double placeX; + @Schema(description = "坐标Y") + private Double placeY; + @Schema(description = "开料宽") + private Double placeWidth; + @Schema(description = "开料长") + private Double placeLength; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ScrapBoard.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ScrapBoard.java new file mode 100644 index 000000000..1f2c159a9 --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ScrapBoard.java @@ -0,0 +1,45 @@ +package com.cf.imes.module.executor.controller.admin.plan.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * @author Beal + */ +@NoArgsConstructor +@Data +public class ScrapBoard { + + @Schema(description ="源排单号") + private String planCode; + @Schema(description ="使用排单号") + private String usedPlanCode; + @Schema(description ="ID") + private Long id; + @Schema(description ="排单ID") + private Long planId; + @Schema(description ="源排单ID") + private Long oldPlanId; + @Schema(description ="未使用 = 0, 已使用 = 1") + private Integer status; + @Schema(description ="正面 = 0, 正面右转 = 1, 正面后转 = 2, 正面左转 = 3, 反面 = 4, 反面右转 = 5, 反面后转 = 6, 反面左转 = 7") + private Integer placedStyle; + @Schema(description ="仓库") + private String storeHouse; + @Schema(description ="Count") + private Integer count; + @Schema(description ="备注") + private String remark; + @Schema(description ="OutLineJson") + private String outLineJson; + @Schema(description ="组织id") + private Integer organId; + @Schema(description ="原始多段线") + private List basePolyline; + @Schema(description ="放置的多段线") + private List placedPolyline; + private Boolean isUsed; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ScrapPt.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ScrapPt.java new file mode 100644 index 000000000..895d77ab9 --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/ScrapPt.java @@ -0,0 +1,13 @@ +package com.cf.imes.module.executor.controller.admin.plan.dto; + +import lombok.Data; + +/** + * @author Beal + */ +@Data +public class ScrapPt { + private Double x; + private Double y; + private Double bul; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/SideHoleDetail.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/SideHoleDetail.java new file mode 100644 index 000000000..cf2203bba --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/SideHoleDetail.java @@ -0,0 +1,25 @@ +package com.cf.imes.module.executor.controller.admin.plan.dto; + +import lombok.Data; + +/** + * @projectName: cf_imes_server + * @author: 晨丰科技 + * @date: 2024/3/22 18:02 + */ +@Data +public class SideHoleDetail { + + private Integer holeID; + private Integer holeType; // 请定义HoleType枚举类型 + private Integer face; // 请定义FaceType枚举类型 + private Integer pointX; + private Integer pointY; + private Integer pointZ; + private Integer radius; + private Integer depth; + private String endPoint; + private Integer pointX2; + private Integer pointY2; + private Integer angle; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/SideModelDetail.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/SideModelDetail.java new file mode 100644 index 000000000..3b66e2fc9 --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/SideModelDetail.java @@ -0,0 +1,24 @@ +package com.cf.imes.module.executor.controller.admin.plan.dto; + +import lombok.Data; + +import java.util.List; + +/** + * @projectName: cf_imes_server + * @author: 晨丰科技 + * @date: 2024/3/22 17:59 + */ +@Data +public class SideModelDetail { + + private Integer modelId; + private Integer lineId; + private int face; + private String knifeName; + private Integer knifeRadius; + private Integer depth; + private OriginModelingData originModeling; + private List modelPoint; + private List modelOffSet; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/SizeOutOff.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/SizeOutOff.java new file mode 100644 index 000000000..bdbc82a67 --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/SizeOutOff.java @@ -0,0 +1,24 @@ +package com.cf.imes.module.executor.controller.admin.plan.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @author Beal + */ +@Data +public class SizeOutOff { + private Double left; + private Double right; + private Double upper; + private Double under; + @Schema(description = "板外扩宽") + private Double width; + @Schema(description = "板外扩长") + private Double length; + @Schema(description = "排版外扩 宽") + private Double outWidth; + @Schema(description = "排版外扩 长") + private Double outLength; + private Boolean hasDone; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/UsedBoardMessage.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/UsedBoardMessage.java new file mode 100644 index 000000000..c3d865300 --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/dto/UsedBoardMessage.java @@ -0,0 +1,39 @@ +package com.cf.imes.module.executor.controller.admin.plan.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +/** + * @author Beal + */ +@Data +public class UsedBoardMessage { + @Schema(description = "大板id") + private Integer bi; + @Schema(description = "宽") + private Integer w; + @Schema(description = "长度") + private Integer l; + @Schema(description = "余料板ID") + private Integer si; + @Schema(description = "仓库号") + private String so; + @Schema(description = "余料板号,大板为空") + private String no; + @Schema(description = "RM") + private String rm; + @Schema(description = "是否锁定") + private Boolean lK; + @Schema(description = "余料母板") + private List scrapPtList; + @Schema(description = "余料空间") + private List scrapBlocks; + @Schema(description = "左边不能加工区域,有造型") + private Boolean le; + @Schema(description = "右边不能加工区域,有造型") + private Boolean re; + @Schema(description = "WLs") + private List wLs; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/GetSourceDataReq.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/GetSourceDataReq.java new file mode 100644 index 000000000..888014517 --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/GetSourceDataReq.java @@ -0,0 +1,29 @@ +package com.cf.imes.module.executor.controller.admin.plan.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; + +/** + * @author Beal + */ +@Data +@Schema(description = "") +public class GetSourceDataReq { + @Schema(description = "生产单id") + @NotNull(message = "生产单id不能空") + private Long orderId; + + @Schema(description = "数据源id") + @NotNull(message = "数据源id不能空") + private Long dataSourceId; + + @Schema(description = "排单id") + private Long planId; + + @Schema(description = "包裹id") + private Long packageId; + + +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/OptimizeParamRespVO.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/OptimizeParamRespVO.java index 312ab43aa..f087d6740 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/OptimizeParamRespVO.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/OptimizeParamRespVO.java @@ -1,12 +1,14 @@ package com.cf.imes.module.executor.controller.admin.plan.vo; -import com.cf.imes.module.executor.controller.admin.goods.vo.GoodsRespVO; +import com.cf.imes.module.executor.controller.admin.plan.dto.Material; import com.cf.imes.module.executor.controller.admin.plate.vo.PlateRespVO; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; +import lombok.NoArgsConstructor; -import java.time.LocalDateTime; import java.util.Date; import java.util.List; @@ -17,6 +19,9 @@ import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT * @author Beal */ @Data +@Builder +@AllArgsConstructor +@NoArgsConstructor public class OptimizeParamRespVO { @Schema(description = "排单id") private Long planId; @@ -28,12 +33,11 @@ public class OptimizeParamRespVO { private Integer type; @Schema(description = "排单状态 0 新单,1 板材已申请,2 开料中,3 已开料") private Integer status; - @Schema(description = "是否支付") - private Boolean isPay; @Schema(description = "机台 ID") private Long machineId; @Schema(description = "计划时间") - private LocalDateTime planTime; + @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) + private Date planTime; @Schema(description = "生产单号") private String orderNos; @Schema(description = "排单优化文件地址") @@ -47,13 +51,16 @@ public class OptimizeParamRespVO { @Schema(description = "生产时间") @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) private Date produceTime; - @Schema(description = "生产单列表") private List orderList; - - @Schema(description = "商品列表") - private List goodsList; - + @Schema(description = "大板使用信息列表") + private List materialList; + /*@Schema(description = "商品列表") + private List goodsList;*/ @Schema(description = "小板列表") private List plateList; + @Schema(description = "区域删除") + private Boolean areaDeleted; + @Schema(description = "源id") + private Long sourceNo; } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/KaiLiaoSize.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/KaiLiaoSize.java new file mode 100644 index 000000000..5140b947c --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/KaiLiaoSize.java @@ -0,0 +1,12 @@ +package com.cf.imes.module.executor.controller.admin.plate.vo; + +import lombok.Data; + +/** + * @author Beal + */ +@Data +public class KaiLiaoSize { + private Double width; + private Double height; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/OffSet.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/OffSet.java new file mode 100644 index 000000000..9f5a7b8d5 --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/OffSet.java @@ -0,0 +1,13 @@ +package com.cf.imes.module.executor.controller.admin.plate.vo; + +import lombok.Data; + +/** + * @author Beal + */ +@Data +public class OffSet { + private Integer x; + private Integer y; + private Integer z; +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/PlateDetailVO.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/PlateDetailVO.java new file mode 100644 index 000000000..f487ca817 --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/PlateDetailVO.java @@ -0,0 +1,45 @@ +package com.cf.imes.module.executor.controller.admin.plate.vo; + +import com.cf.imes.module.executor.controller.admin.plan.dto.*; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.util.List; + +/** + * @author Beal + */ +@Data +public class PlateDetailVO { + + @Schema(description = "生产单id") + private Long orderId; + + @Schema(description = "点详情列表") + private List pointDetailList; + + @Schema(description = "孔详情列表") + private List holeDetailList; + + @Schema(description = "造型列表") + private List modelDetailList; + + @Schema(description = "偏移量") + private OffSet offSet; + + @Schema(description = "是否新版本") + private Boolean newVersion; + + @Schema(description = "原始点详情列表") + private List olgPointDetailList; + + @Schema(description = "开料尺寸") + private KaiLiaoSize kaiLiaoSize; + + @Schema(description = "边模型详情列表") + private List sideModelDetails; + + @Schema(description = "边孔详情") + private List sideHoleDetailList; + +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/PlateRespVO.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/PlateRespVO.java index 0cbb50e00..a1da4ff49 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/PlateRespVO.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plate/vo/PlateRespVO.java @@ -9,6 +9,9 @@ import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDateTime; import com.alibaba.excel.annotation.*; +/** + * @author Beal + */ @Schema(description = "管理后台 - 生产单板件 Response VO") @Data @ExcelIgnoreUnannotated @@ -163,4 +166,8 @@ public class PlateRespVO { @Schema(description = "板材材质") private String material; + @Schema(description = "小板详情列表") + private List plateDetailList; + + } \ No newline at end of file diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/order/OrderMapper.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/order/OrderMapper.java index f700e0880..55a32572f 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/order/OrderMapper.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/order/OrderMapper.java @@ -17,6 +17,7 @@ import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Map; /** * 生产单表 order_{N} Mapper @@ -88,4 +89,5 @@ public interface OrderMapper extends BaseMapperX { return selectList(wrapper); } + Map selectDynamicSqlString(@Param("sqlStr") String sqlStr); } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/framework/rpc/config/RpcConfiguration.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/framework/rpc/config/RpcConfiguration.java index aad32aed5..5db36b523 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/framework/rpc/config/RpcConfiguration.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/framework/rpc/config/RpcConfiguration.java @@ -1,6 +1,7 @@ package com.cf.imes.module.executor.framework.rpc.config; import com.cf.imes.module.infra.api.file.FileApi; +import com.cf.imes.module.system.api.dataSource.DataSourceApi; import com.cf.imes.module.system.api.machine.MachineApi; import com.cf.imes.module.system.api.process.ProcessGroupApi; import com.cf.imes.module.system.api.user.AdminUserApi; diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/optimizeplan/OptimizePlanService.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/optimizeplan/OptimizePlanService.java index e80f34025..48c7fdb75 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/optimizeplan/OptimizePlanService.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/optimizeplan/OptimizePlanService.java @@ -3,6 +3,7 @@ package com.cf.imes.module.executor.service.optimizeplan; import com.cf.imes.module.executor.controller.admin.plan.vo.*; import java.util.List; +import java.util.Map; public interface OptimizePlanService { List getPlateListByPlanId(Long planId); @@ -16,4 +17,6 @@ public interface OptimizePlanService { OptimizeParamResVO getOptimizeParam(Long planId); OptimizeParamRespVO getOptimizePlanParam(Long planId); + + Map getLabelDataSourceValue(GetSourceDataReq req); } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/optimizeplan/OptimizePlanServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/optimizeplan/OptimizePlanServiceImpl.java index e762b82dd..5aac5d760 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/optimizeplan/OptimizePlanServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/optimizeplan/OptimizePlanServiceImpl.java @@ -5,7 +5,9 @@ import cn.hutool.core.util.StrUtil; import com.cf.imes.framework.common.util.json.JsonUtils; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.framework.mybatis.core.query.MPJLambdaWrapperX; +import com.cf.imes.module.executor.controller.admin.plan.dto.Material; import com.cf.imes.module.executor.controller.admin.plan.vo.*; +import com.cf.imes.module.executor.controller.admin.plate.vo.PlateDetailVO; import com.cf.imes.module.executor.dal.dataobject.goods.GoodsDO; import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO; import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO; @@ -15,12 +17,15 @@ import com.cf.imes.module.executor.dal.dataobject.remainplaten.OutlineDTO; import com.cf.imes.module.executor.dal.dataobject.remainplaten.PointDTO; import com.cf.imes.module.executor.dal.dataobject.remainplaten.RemainPlateDO; import com.cf.imes.module.executor.dal.mysql.goods.GoodsMapper; +import com.cf.imes.module.executor.dal.mysql.order.OrderMapper; import com.cf.imes.module.executor.dal.mysql.plan.PlanMapper; import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper; import com.cf.imes.module.executor.dal.mysql.remainplaten.RemainPlateMapper; +import com.cf.imes.module.executor.util.RandomUtils; import com.cf.imes.module.executor.util.RectangleChecker; import com.cf.imes.module.infra.api.file.FileApi; import com.cf.imes.module.infra.api.file.dto.FileCreateReqDTO; +import com.cf.imes.module.system.api.dataSource.DataSourceApi; import com.github.yulichang.wrapper.MPJLambdaWrapper; import org.springframework.stereotype.Service; @@ -58,6 +63,12 @@ public class OptimizePlanServiceImpl implements OptimizePlanService { @Resource private GoodsMapper goodsMapper; + @Resource + private DataSourceApi dataSourceApi; + + @Resource + private OrderMapper orderMapper; + @Override public List getPlateListByPlanId(Long planId) { return planMapper.selectPlateListByPlanId(planId); @@ -202,7 +213,38 @@ public class OptimizePlanServiceImpl implements OptimizePlanService { @Override public OptimizeParamRespVO getOptimizePlanParam(Long planId) { - return planMapper.getOptimizePlanParam(planId); + + OptimizeParamRespVO optimizePlanParam = planMapper.getOptimizePlanParam(planId); + + if(Objects.isNull(optimizePlanParam)) { + return RandomUtils.randomPojo(OptimizeParamRespVO.class); + } + //暂时先mock + ArrayList list = new ArrayList<>(); + list.add(RandomUtils.randomPojo(Material.class)); + list.add(RandomUtils.randomPojo(Material.class)); + ArrayList plateDetailVOS = new ArrayList<>(); + plateDetailVOS.add(RandomUtils.randomPojo(PlateDetailVO.class)); + plateDetailVOS.add(RandomUtils.randomPojo(PlateDetailVO.class)); + plateDetailVOS.add(RandomUtils.randomPojo(PlateDetailVO.class)); + if( CollectionUtil.isNotEmpty(optimizePlanParam.getPlateList())) { + optimizePlanParam.getPlateList().get(0).setPlateDetailList(plateDetailVOS); + } + optimizePlanParam.setMaterialList(list); + return optimizePlanParam; + } + + @Override + public Map getLabelDataSourceValue(GetSourceDataReq req) { + String sqlStr = dataSourceApi.getSqlById(req.getDataSourceId()).getCheckedData(); + String sql = sqlStr.replace("#{orderId}", req.getOrderId() + ""); + if(!Objects.isNull(req.getPackageId())) { + sql = sql.replace("#{packageId}", req.getPackageId() + ""); + } + if(!Objects.isNull(req.getPlanId())) { + sql = sql.replace("#{planId}", req.getPlanId() + ""); + } + return orderMapper.selectDynamicSqlString(sql); } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/RandomUtils.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/RandomUtils.java new file mode 100644 index 000000000..0968fcb99 --- /dev/null +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/RandomUtils.java @@ -0,0 +1,137 @@ +package com.cf.imes.module.executor.util; + +import cn.hutool.core.date.LocalDateTimeUtil; +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.RandomUtil; +import cn.hutool.core.util.StrUtil; +import com.cf.imes.framework.common.enums.CommonStatusEnum; +import uk.co.jemos.podam.api.PodamFactory; +import uk.co.jemos.podam.api.PodamFactoryImpl; + +import java.lang.reflect.Type; +import java.time.LocalDateTime; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Set; +import java.util.function.Consumer; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +/** + * 随机工具类 + * + * @author 晨丰科技 + */ +public class RandomUtils { + + private static final int RANDOM_STRING_LENGTH = 10; + + private static final int TINYINT_MAX = 127; + + private static final int RANDOM_DATE_MAX = 30; + + private static final int RANDOM_COLLECTION_LENGTH = 5; + + private static final PodamFactory PODAM_FACTORY = new PodamFactoryImpl(); + + static { + // 字符串 + PODAM_FACTORY.getStrategy().addOrReplaceTypeManufacturer(String.class, + (dataProviderStrategy, attributeMetadata, map) -> randomString()); + // Integer + PODAM_FACTORY.getStrategy().addOrReplaceTypeManufacturer(Integer.class, (dataProviderStrategy, attributeMetadata, map) -> { + // 如果是 status 的字段,返回 0 或 1 + if ("status".equals(attributeMetadata.getAttributeName())) { + return RandomUtil.randomEle(CommonStatusEnum.values()).getStatus(); + } + // 如果是 type、status 结尾的字段,返回 tinyint 范围 + if (StrUtil.endWithAnyIgnoreCase(attributeMetadata.getAttributeName(), + "type", "status", "category", "scope", "result")) { + return RandomUtil.randomInt(0, TINYINT_MAX + 1); + } + return RandomUtil.randomInt(); + }); + // LocalDateTime + PODAM_FACTORY.getStrategy().addOrReplaceTypeManufacturer(LocalDateTime.class, + (dataProviderStrategy, attributeMetadata, map) -> randomLocalDateTime()); + // Boolean + PODAM_FACTORY.getStrategy().addOrReplaceTypeManufacturer(Boolean.class, (dataProviderStrategy, attributeMetadata, map) -> { + // 如果是 deleted 的字段,返回非删除 + if ("deleted".equals(attributeMetadata.getAttributeName())) { + return false; + } + return RandomUtil.randomBoolean(); + }); + } + + public static String randomString() { + return RandomUtil.randomString(RANDOM_STRING_LENGTH); + } + + public static Long randomLongId() { + return RandomUtil.randomLong(0, Long.MAX_VALUE); + } + + public static Integer randomInteger() { + return RandomUtil.randomInt(0, Integer.MAX_VALUE); + } + + public static Date randomDate() { + return RandomUtil.randomDay(0, RANDOM_DATE_MAX); + } + + public static LocalDateTime randomLocalDateTime() { + // 设置 Nano 为零的原因,避免 MySQL、H2 存储不到时间戳 + return LocalDateTimeUtil.of(randomDate()).withNano(0); + } + + public static Short randomShort() { + return (short) RandomUtil.randomInt(0, Short.MAX_VALUE); + } + + public static Set randomSet(Class clazz) { + return Stream.iterate(0, i -> i).limit(RandomUtil.randomInt(1, RANDOM_COLLECTION_LENGTH)) + .map(i -> randomPojo(clazz)).collect(Collectors.toSet()); + } + + public static Integer randomCommonStatus() { + return RandomUtil.randomEle(CommonStatusEnum.values()).getStatus(); + } + + public static String randomEmail() { + return randomString() + "@qq.com"; + } + + public static String randomURL() { + return "https://www.cf.com/" + randomString(); + } + + @SafeVarargs + public static T randomPojo(Class clazz, Consumer... consumers) { + T pojo = PODAM_FACTORY.manufacturePojo(clazz); + // 非空时,回调逻辑。通过它,可以实现 Pojo 的进一步处理 + if (ArrayUtil.isNotEmpty(consumers)) { + Arrays.stream(consumers).forEach(consumer -> consumer.accept(pojo)); + } + return pojo; + } + + @SafeVarargs + public static T randomPojo(Class clazz, Type type, Consumer... consumers) { + T pojo = PODAM_FACTORY.manufacturePojo(clazz, type); + // 非空时,回调逻辑。通过它,可以实现 Pojo 的进一步处理 + if (ArrayUtil.isNotEmpty(consumers)) { + Arrays.stream(consumers).forEach(consumer -> consumer.accept(pojo)); + } + return pojo; + } + + @SafeVarargs + public static List randomPojoList(Class clazz, Consumer... consumers) { + int size = RandomUtil.randomInt(1, RANDOM_COLLECTION_LENGTH); + return Stream.iterate(0, i -> i).limit(size).map(o -> randomPojo(clazz, consumers)) + .collect(Collectors.toList()); + } + +} diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/deviseData/IOriginModelingData.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/deviseData/IOriginModelingData.java index dbe1d05d6..1312a3d81 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/deviseData/IOriginModelingData.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/util/deviseData/IOriginModelingData.java @@ -1,11 +1,13 @@ package com.cf.imes.module.executor.util.deviseData; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; +import javax.swing.*; import java.util.Dictionary; /** @@ -18,12 +20,20 @@ import java.util.Dictionary; @Accessors(chain = false) // 设置 chain = false,避免生产单导入有问 public class IOriginModelingData { - private IContourData outline; //轮郭 - private Dictionary holes; //孔轮廓 - private Integer thickness; //厚度 - private Integer dir; // 0正面、1反面、2侧面 - private Integer knifeRadius; //刀半径 - private Integer addLen; //槽加长 - private Integer addWidth; //槽加宽 - private Integer addDepth; //槽加深 + @Schema(description = "轮郭") + private IContourData outline; + @Schema(description = "孔轮廓") + private Dictionary holes; + @Schema(description ="厚度" ) + private Integer thickness; + @Schema(description = "0正面、1反面、2侧面") + private Integer dir; + @Schema(description = "刀半径") + private Integer knifeRadius; + @Schema(description = "槽加长") + private Integer addLen; + @Schema(description = "槽加宽") + private Integer addWidth; + @Schema(description = "槽加深") + private Integer addDepth; } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderMapper.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderMapper.xml index 28a429977..da90f0fa5 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderMapper.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/order/OrderMapper.xml @@ -12,4 +12,8 @@ ${ew.customSqlSegment} group by orderId, p.id + + \ No newline at end of file diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plan/PlanMapper.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plan/PlanMapper.xml index 46ab15c25..3dc647fc5 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plan/PlanMapper.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plan/PlanMapper.xml @@ -20,25 +20,26 @@ - + - - - + + - - - + + + - - - - - + + + + + + + @@ -54,21 +55,58 @@ + - - + - + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file diff --git a/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/api/dataSource/DataSourceApi.java b/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/api/dataSource/DataSourceApi.java new file mode 100644 index 000000000..02b7127ab --- /dev/null +++ b/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/api/dataSource/DataSourceApi.java @@ -0,0 +1,23 @@ +package com.cf.imes.module.system.api.dataSource; + +import com.cf.imes.framework.common.pojo.CommonResult; +import com.cf.imes.module.system.enums.ApiConstants; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +/** + * @author Beal + */ +@FeignClient(name = ApiConstants.NAME) // TODO 晨丰:fallbackFactory = +@Tag(name = "RPC 服务 - 数据源") +public interface DataSourceApi { + + String PREFIX = ApiConstants.PREFIX + "/dataSource"; + + @GetMapping(PREFIX + "/getSqlById") + @Operation(summary = "获得数据源sql") + CommonResult getSqlById(@RequestParam(value = "id") Long id); +} diff --git a/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java b/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java index f064b2bb1..1390fd524 100644 --- a/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java +++ b/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java @@ -183,10 +183,13 @@ public interface ErrorCodeConstants { ErrorCode MACHINE_NOT_EXISTS = new ErrorCode(1_002_029_000, "机台不存在"); ErrorCode MACHINE_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_029_001, "机台模板不存在"); ErrorCode DEFAULT_TEMPLATE_COUNT = new ErrorCode(1_002_029_002, "默认模板数量异常"); + ErrorCode DEFAULT_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_029_003, "该类型机台默认模板不存在"); // ========== 标签模板 1-002-300-000 ========== ErrorCode LABEL_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_300_000, "标签模板不存在"); ErrorCode LABEL_NOT_EXISTS = new ErrorCode(1_002_300_001, "标签不存在"); + ErrorCode DEFAULT_LABEL_NOT_EXISTS = new ErrorCode(1_002_300_002, "该类型标签默认模板不存在"); + ErrorCode MACHINE_USE_LABEL = new ErrorCode(1_002_300_003, "无法删除已有机台使用标签"); // ========== 系统数据源 1_002_301_000 ========== ErrorCode DATA_SOURCE_NOT_EXISTS = new ErrorCode(1_002_301_000, "系统数据源不存在"); diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/datasource/DataSourceApiImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/datasource/DataSourceApiImpl.java new file mode 100644 index 000000000..068a4273b --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/api/datasource/DataSourceApiImpl.java @@ -0,0 +1,29 @@ +package com.cf.imes.module.system.api.datasource; + +import com.cf.imes.framework.common.exception.ErrorCode; +import com.cf.imes.framework.common.pojo.CommonResult; +import com.cf.imes.module.system.api.dataSource.DataSourceApi; +import com.cf.imes.module.system.dal.dataobject.datasource.DataSourceDO; +import com.cf.imes.module.system.dal.mysql.datasource.DataSourceMapper; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.Objects; + +import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; + +@RestController +public class DataSourceApiImpl implements DataSourceApi { + + @Resource + private DataSourceMapper dataSourceMapper; + + @Override + public CommonResult getSqlById(Long id) { + DataSourceDO dataSourceDO = dataSourceMapper.selectById(id); + if(Objects.isNull(dataSourceDO)) { + throw exception(new ErrorCode(2133,"数据源不存在")); + } + return CommonResult.success(dataSourceDO.getSqlStr()) ; + } +} diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/datasource/DataSourceController.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/datasource/DataSourceController.java index 84dcb628d..1eb6a5633 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/datasource/DataSourceController.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/datasource/DataSourceController.java @@ -39,7 +39,7 @@ public class DataSourceController { @Resource private DataSourceService dataSourceService; - @PostMapping("/create") + /* @PostMapping("/create") @Operation(summary = "创建系统数据源") @PreAuthorize("@ss.hasPermission('system:data-source:create')") public CommonResult createDataSource(@Valid @RequestBody DataSourceSaveReqVO createReqVO) { @@ -78,15 +78,16 @@ public class DataSourceController { public CommonResult> getDataSourcePage(@Valid DataSourcePageReqVO pageReqVO) { PageResult pageResult = dataSourceService.getDataSourcePage(pageReqVO); return success(BeanUtils.toBean(pageResult, DataSourceRespVO.class)); - } + }*/ @GetMapping("/list") @Operation(summary = "获得系统数据源列表") - @Parameter(name = "type", description = "类型", required = false) @PreAuthorize("@ss.hasPermission('system:data-source:query')") - public CommonResult> list( @RequestParam(value = "type", required = false) Integer type) { - List list = dataSourceService.list(type); - return success(BeanUtils.toBean(list, DataSourceRespVO.class)); + public CommonResult> list( ) { + return success(dataSourceService.list()); + + /*List list = + return success(BeanUtils.toBean(list, DataSourceRespVO.class));*/ } @GetMapping("/export-excel") diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/datasource/vo/DataSourcePageReqVO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/datasource/vo/DataSourcePageReqVO.java index 517ac8913..cc2f663dd 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/datasource/vo/DataSourcePageReqVO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/datasource/vo/DataSourcePageReqVO.java @@ -19,7 +19,7 @@ public class DataSourcePageReqVO extends PageParam { private String name; @Schema(description = "sql") - private String sql; + private String sqlStr; @Schema(description = "数据源类型", example = "2") private Integer type; diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/datasource/vo/DataSourceRespVO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/datasource/vo/DataSourceRespVO.java index 5e797cf0c..51c7312af 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/datasource/vo/DataSourceRespVO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/datasource/vo/DataSourceRespVO.java @@ -1,5 +1,6 @@ package com.cf.imes.module.system.controller.admin.datasource.vo; +import com.cf.imes.module.system.dal.dataobject.datasource.DataSourceFiledDO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import java.util.*; @@ -23,7 +24,7 @@ public class DataSourceRespVO { @Schema(description = "sql", requiredMode = Schema.RequiredMode.REQUIRED) @ExcelProperty("sql") - private String sql; + private String sqlStr; @Schema(description = "数据源类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") @ExcelProperty("数据源类型") @@ -33,4 +34,7 @@ public class DataSourceRespVO { @ExcelProperty("创建时间") private LocalDateTime createTime; + @Schema(description = "字段列表") + private List filedList; + } \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/label/LabelController.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/label/LabelController.java index e7d5b7a6e..d2094fab1 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/label/LabelController.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/label/LabelController.java @@ -6,12 +6,10 @@ import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.excel.core.util.ExcelUtils; import com.cf.imes.framework.operatelog.core.annotations.OperateLog; -import com.cf.imes.module.system.controller.admin.label.vo.LabelElementRespVO; import com.cf.imes.module.system.controller.admin.label.vo.LabelPageReqVO; import com.cf.imes.module.system.controller.admin.label.vo.LabelRespVO; import com.cf.imes.module.system.controller.admin.label.vo.LabelSaveReqVO; import com.cf.imes.module.system.dal.dataobject.lable.LabelDO; -import com.cf.imes.module.system.dal.dataobject.lable.LabelElementDO; import com.cf.imes.module.system.service.lable.LabelService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -40,6 +38,7 @@ public class LabelController { @PostMapping("/create") @Operation(summary = "创建标签") @PreAuthorize("@ss.hasPermission('system:label:create')") + @OperateLog(enable = false) public CommonResult createLabel(@Valid @RequestBody LabelSaveReqVO createReqVO) { return success(labelService.createLabel(createReqVO)); } @@ -47,6 +46,7 @@ public class LabelController { @PutMapping("/update") @Operation(summary = "更新标签") @PreAuthorize("@ss.hasPermission('system:label:update')") + @OperateLog(enable = false) public CommonResult updateLabel(@Valid @RequestBody LabelSaveReqVO updateReqVO) { labelService.updateLabel(updateReqVO); return success(true); @@ -65,6 +65,7 @@ public class LabelController { @Operation(summary = "获得标签") @Parameter(name = "id", description = "编号", required = true, example = "1024") @PreAuthorize("@ss.hasPermission('system:label:query')") + @OperateLog(enable = false) public CommonResult getLabel(@RequestParam("id") Long id) { return success(labelService.getLabel(id)); } @@ -72,6 +73,7 @@ public class LabelController { @GetMapping("/page") @Operation(summary = "获得标签分页") @PreAuthorize("@ss.hasPermission('system:label:query')") + @OperateLog(enable = false) public CommonResult> getLabelPage(@Valid LabelPageReqVO pageReqVO) { PageResult pageResult = labelService.getLabelPage(pageReqVO); return success(BeanUtils.toBean(pageResult, LabelRespVO.class)); @@ -81,13 +83,15 @@ public class LabelController { @Operation(summary = "获得标签列表") @Parameter(name = "type", description = "类型", required = false, example = "1024") @PreAuthorize("@ss.hasPermission('system:label:query')") - public CommonResult> getLabel(@RequestParam("type") String type) { + @OperateLog(enable = false) + public CommonResult> getList(@RequestParam("type") String type) { return success(BeanUtils.toBean(labelService.list(type), LabelRespVO.class)); } @GetMapping("/group-list") @Operation(summary = "获得分组标签列表") @PreAuthorize("@ss.hasPermission('system:label:query')") + @OperateLog(enable = false) public CommonResult>> getGroupList() { return success(labelService.getGroupList()); } @@ -105,14 +109,4 @@ public class LabelController { BeanUtils.toBean(list, LabelRespVO.class)); } - // ==================== 子表(标签元素) ==================== - - @GetMapping("/label-element/list-by-label-id") - @Operation(summary = "获得标签元素列表") - @Parameter(name = "labelId", description = "标签id") - @PreAuthorize("@ss.hasPermission('system:label:query')") - public CommonResult> getLabelElementListByLabelId(@RequestParam("labelId") Long labelId) { - return success(labelService.getLabelElementListByLabelId(labelId)); - } - } \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/label/vo/LabelElementRespVO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/label/vo/LabelElementRespVO.java index 2a06f2a56..341693176 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/label/vo/LabelElementRespVO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/label/vo/LabelElementRespVO.java @@ -1,10 +1,17 @@ package com.cf.imes.module.system.controller.admin.label.vo; +import com.alibaba.fastjson.JSONObject; import com.cf.imes.module.system.dal.dataobject.labelelementproperty.LabelElementPropertyDO; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; +import lombok.NoArgsConstructor; @Data +@Builder +@AllArgsConstructor +@NoArgsConstructor public class LabelElementRespVO { @Schema(description = "主键") @@ -17,6 +24,8 @@ public class LabelElementRespVO { private String type; @Schema(description = "数据源id") private Long sourceId; + /*@Schema(description = "标签元素属性") + private LabelElementPropertyDO propertyDO;*/ @Schema(description = "标签元素属性") - private LabelElementPropertyDO propertyDO; + private JSONObject propertyDO; } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/label/vo/LabelElementSaveReqVO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/label/vo/LabelElementSaveReqVO.java index 7e8c5be07..0b71ea7ed 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/label/vo/LabelElementSaveReqVO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/label/vo/LabelElementSaveReqVO.java @@ -1,5 +1,6 @@ package com.cf.imes.module.system.controller.admin.label.vo; +import com.alibaba.fastjson.JSONObject; import com.cf.imes.module.system.dal.dataobject.labelelementproperty.LabelElementPropertyDO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -19,6 +20,8 @@ public class LabelElementSaveReqVO { private String type; @Schema(description = "数据源id") private Long sourceId; + /*@Schema(description = "标签元素属性") + private LabelElementPropertyDO propertyDO;*/ @Schema(description = "标签元素属性") - private LabelElementPropertyDO propertyDO; + private JSONObject propertyDO; } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/label/vo/LabelRespVO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/label/vo/LabelRespVO.java index 31449baf8..ef07d4bf9 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/label/vo/LabelRespVO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/label/vo/LabelRespVO.java @@ -46,7 +46,10 @@ public class LabelRespVO { @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) private LocalDateTime createTime; - @Schema(description = "标签元素模板列表") - private List labelElements; + /*@Schema(description = "标签元素模板列表") + private List labelElements;*/ + + @Schema(description = "配置") + private String template; } \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/label/vo/LabelSaveReqVO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/label/vo/LabelSaveReqVO.java index 13e3d151d..173d1dd08 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/label/vo/LabelSaveReqVO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/label/vo/LabelSaveReqVO.java @@ -1,5 +1,6 @@ package com.cf.imes.module.system.controller.admin.label.vo; +import co.elastic.clients.elasticsearch.watcher.DeactivateWatchRequest; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -34,7 +35,10 @@ public class LabelSaveReqVO { @NotNull(message = "高度不能为空") private Integer height; - @Schema(description = "标签元素模板列表") - private List elements; + /*@Schema(description = "标签元素模板列表") + private List elements;*/ + + @Schema(description = "配置") + private String template; } \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/labeltemplate/LabelTemplateController.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/labeltemplate/LabelTemplateController.java index 2a27db9d0..2b55d7faa 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/labeltemplate/LabelTemplateController.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/labeltemplate/LabelTemplateController.java @@ -1,27 +1,21 @@ package com.cf.imes.module.system.controller.admin.labeltemplate; -import com.cf.imes.module.system.dal.dataobject.labeltemplate.LabelElementTemplateDO; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; import org.springframework.security.access.prepost.PreAuthorize; import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Operation; - import java.util.*; import java.io.IOException; - import com.cf.imes.framework.common.pojo.PageParam; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.framework.common.util.object.BeanUtils; import static com.cf.imes.framework.common.pojo.CommonResult.success; - import com.cf.imes.framework.excel.core.util.ExcelUtils; - import com.cf.imes.framework.operatelog.core.annotations.OperateLog; import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.*; - import com.cf.imes.module.system.controller.admin.labeltemplate.vo.*; import com.cf.imes.module.system.dal.dataobject.labeltemplate.LabelTemplateDO; import com.cf.imes.module.system.service.labeltemplate.LabelTemplateService; @@ -41,6 +35,7 @@ public class LabelTemplateController { @PostMapping("/create") @Operation(summary = "创建标签模板") @PreAuthorize("@ss.hasPermission('system:label-template:create')") + @OperateLog(enable = false) public CommonResult createLabelTemplate(@Valid @RequestBody LabelTemplateSaveReqVO createReqVO) { return success(labelTemplateService.createLabelTemplate(createReqVO)); } @@ -48,6 +43,7 @@ public class LabelTemplateController { @PutMapping("/update") @Operation(summary = "更新标签模板") @PreAuthorize("@ss.hasPermission('system:label-template:update')") + @OperateLog(enable = false) public CommonResult updateLabelTemplate(@Valid @RequestBody LabelTemplateSaveReqVO updateReqVO) { labelTemplateService.updateLabelTemplate(updateReqVO); return success(true); @@ -66,6 +62,7 @@ public class LabelTemplateController { @Operation(summary = "获得标签模板") @Parameter(name = "id", description = "编号", required = true, example = "1024") @PreAuthorize("@ss.hasPermission('system:label-template:query')") + @OperateLog(enable = false) public CommonResult getLabelTemplate(@RequestParam("id") Long id) { return success(labelTemplateService.getLabelTemplate(id)); } @@ -73,6 +70,7 @@ public class LabelTemplateController { @GetMapping("/page") @Operation(summary = "获得标签模板分页") @PreAuthorize("@ss.hasPermission('system:label-template:query')") + @OperateLog(enable = false) public CommonResult> getLabelTemplatePage(@Valid LabelTemplatePageReqVO pageReqVO) { PageResult pageResult = labelTemplateService.getLabelTemplatePage(pageReqVO); return success(BeanUtils.toBean(pageResult, LabelTemplateRespVO.class)); @@ -81,10 +79,20 @@ public class LabelTemplateController { @GetMapping("/group-list") @Operation(summary = "获得分组标签模板列表") @PreAuthorize("@ss.hasPermission('system:label-template:query')") + @OperateLog(enable = false) public CommonResult>> getGroupList() { return success(labelTemplateService.getGroupList()); } + @GetMapping("/getDefault") + @Operation(summary = "获得默认标签模板") + @Parameter(name = "type", description = "标签类型", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:label-template:query')") + @OperateLog(enable = false) + public CommonResult getDefaultLabelTemplate(@RequestParam("type") String type) { + return success(labelTemplateService.getDefaultLabelTemplate(type)); + } + @GetMapping("/export-excel") @Operation(summary = "导出标签模板 Excel") @PreAuthorize("@ss.hasPermission('system:label-template:export')") @@ -98,14 +106,5 @@ public class LabelTemplateController { BeanUtils.toBean(list, LabelTemplateRespVO.class)); } - // ==================== 子表(标签元素模板) ==================== - - @GetMapping("/label-element-template/list-by-label-template-id") - @Operation(summary = "获得标签元素模板列表") - @Parameter(name = "labelTemplateId", description = "标签模板id") - @PreAuthorize("@ss.hasPermission('system:label-template:query')") - public CommonResult> getLabelElementTemplateListByLabelTemplateId(@RequestParam("labelTemplateId") Long labelTemplateId) { - return success(labelTemplateService.getLabelElementTemplateListByLabelTemplateId(labelTemplateId)); - } } \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/labeltemplate/vo/LabelElementTemplateRespVO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/labeltemplate/vo/LabelElementTemplateRespVO.java index 7ad8da3aa..b2ef20a14 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/labeltemplate/vo/LabelElementTemplateRespVO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/labeltemplate/vo/LabelElementTemplateRespVO.java @@ -1,10 +1,19 @@ package com.cf.imes.module.system.controller.admin.labeltemplate.vo; +import com.alibaba.fastjson.JSONObject; import com.cf.imes.module.system.dal.dataobject.labelelementproperty.LabelElementPropertyDO; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Map; @Data +@Builder +@AllArgsConstructor +@NoArgsConstructor public class LabelElementTemplateRespVO { @Schema(description = "主键") @@ -17,6 +26,10 @@ public class LabelElementTemplateRespVO { private String type; @Schema(description = "数据源id") private Long sourceId; + /*@Schema(description = "标签元素属性") + private LabelElementPropertyDO propertyDO;*/ + /*@Schema(description = "标签元素属性") + private Map propertyDO;*/ @Schema(description = "标签元素属性") - private LabelElementPropertyDO propertyDO; + private JSONObject propertyDO; } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/labeltemplate/vo/LabelElementTemplateSaveReqVO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/labeltemplate/vo/LabelElementTemplateSaveReqVO.java index 4a851c3c2..d0b53d881 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/labeltemplate/vo/LabelElementTemplateSaveReqVO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/labeltemplate/vo/LabelElementTemplateSaveReqVO.java @@ -1,9 +1,12 @@ package com.cf.imes.module.system.controller.admin.labeltemplate.vo; +import com.alibaba.fastjson.JSONObject; import com.cf.imes.module.system.dal.dataobject.labelelementproperty.LabelElementPropertyDO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import java.util.Map; + /** * @author there */ @@ -19,6 +22,11 @@ public class LabelElementTemplateSaveReqVO { private String type; @Schema(description = "数据源id") private Long sourceId; + /*@Schema(description = "标签元素属性") + private LabelElementPropertyDO propertyDO;*/ + /*@Schema(description = "标签元素属性") + + private Map propertyDO;*/ @Schema(description = "标签元素属性") - private LabelElementPropertyDO propertyDO; + private JSONObject propertyDO; } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/labeltemplate/vo/LabelTemplateRespVO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/labeltemplate/vo/LabelTemplateRespVO.java index 6d53045e4..cb583dc56 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/labeltemplate/vo/LabelTemplateRespVO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/labeltemplate/vo/LabelTemplateRespVO.java @@ -1,12 +1,9 @@ package com.cf.imes.module.system.controller.admin.labeltemplate.vo; -import com.cf.imes.module.system.dal.dataobject.labeltemplate.LabelElementTemplateDO; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; -import java.util.*; -import java.util.*; -import org.springframework.format.annotation.DateTimeFormat; + import java.time.LocalDateTime; import com.alibaba.excel.annotation.*; @@ -47,7 +44,9 @@ public class LabelTemplateRespVO { @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) private LocalDateTime createTime; - @Schema(description = "标签元素模板列表") - private List labelElementTemplates; + /*@Schema(description = "标签元素模板列表") + private List labelElementTemplates;*/ + @Schema(description = "配置") + private String template; } \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/labeltemplate/vo/LabelTemplateSaveReqVO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/labeltemplate/vo/LabelTemplateSaveReqVO.java index be096acb7..3f9e08b79 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/labeltemplate/vo/LabelTemplateSaveReqVO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/labeltemplate/vo/LabelTemplateSaveReqVO.java @@ -1,11 +1,9 @@ package com.cf.imes.module.system.controller.admin.labeltemplate.vo; -import com.cf.imes.module.system.dal.dataobject.labeltemplate.LabelElementTemplateDO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; -import java.util.*; @Schema(description = "管理后台 - 标签模板新增/修改 Request VO") @Data @@ -34,7 +32,9 @@ public class LabelTemplateSaveReqVO { @NotNull(message = "高度不能为空") private Integer height; - @Schema(description = "标签元素模板列表") - private List elements; + /*@Schema(description = "标签元素模板列表") + private List elements;*/ + @Schema(description = "配置") + private String template; } \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/MachineAuthController.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/MachineAuthController.java new file mode 100644 index 000000000..0b4242bf2 --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/MachineAuthController.java @@ -0,0 +1,69 @@ +package com.cf.imes.module.system.controller.admin.machine; + +import com.cf.imes.framework.common.pojo.CommonResult; +import com.cf.imes.framework.common.pojo.PageResult; +import com.cf.imes.framework.common.util.object.BeanUtils; +import com.cf.imes.module.system.controller.admin.machine.vo.*; +import com.cf.imes.module.system.dal.dataobject.machinetemplate.MachineTemplateDO; +import com.cf.imes.module.system.service.machine.MachineTemplateService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; +import java.util.stream.Collectors; + +import static com.cf.imes.framework.common.pojo.CommonResult.success; + +/** + * @author Beal + */ +@RestController +@Tag(name = "机台模板授权") +@RequestMapping("/system/machine-template-auth") +public class MachineAuthController { + + @Resource + private MachineTemplateService machineTemplateService; + + @PostMapping("organ-auth-template") + @Operation(summary = "组织模板授权") + @PreAuthorize("@ss.hasPermission('machine-template::query')") + public CommonResult auth(@RequestBody MachineOrgAuthReq vo) { + return success(machineTemplateService.auth(vo)); + } + + @GetMapping("organ-template-page") + @Operation(summary = "组织模板授权分页列表") + @PreAuthorize("@ss.hasPermission('machine-template::query')") + public CommonResult> organTemplatePage(OrganTemplatePage page) { + return success(machineTemplateService.organTemplatePage(page)); + } + + @GetMapping("organ-template-by-organId") + @Operation(summary = "根据组织id查询组织模板授权") + @PreAuthorize("@ss.hasPermission('machine-template::query')") + @Parameter(name = "organId", description = "组织id", required = true, example = "1") + public CommonResult organTemplateByOrganId(@RequestParam Long organId ) { + return success(machineTemplateService.organTemplateByOrganId(organId)); + } + + @GetMapping("page-template-machine-auth") + @Operation(summary = "授权机台模板分页") + @PreAuthorize("@ss.hasPermission('machine-template::query')") + public CommonResult> pageTemplateAuth(MachinePageReqVO pageParam) { + PageResult page = machineTemplateService.page(pageParam); + List list = page.getList().stream().map(e->TemplateAutoResp.builder() + .id(e.getId()) + .machineType(e.getMachineType()) + .templateName(e.getName()) + .isDefault(e.getIsDefault()) + .build() + ).collect(Collectors.toList()); + + return success(new PageResult(list, page.getTotal())); + } +} diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/MachineController.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/MachineController.java index e4abf82e5..cde20529d 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/MachineController.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/MachineController.java @@ -1,6 +1,7 @@ package com.cf.imes.module.system.controller.admin.machine; import com.cf.imes.framework.es.core.valid.UpdateGroup; +import com.cf.imes.framework.operatelog.core.annotations.OperateLog; import com.cf.imes.module.system.controller.admin.machine.vo.*; import com.cf.imes.module.system.dal.dataobject.machine.MachineDO; import com.cf.imes.module.system.service.machine.MachineService; @@ -36,22 +37,24 @@ public class MachineController { private MachineTemplateService machineTemplateService; @PutMapping("/create-cutting") - @Operation(summary = "创建开料机台") + @Operation(summary = "创建机台") @PreAuthorize("@ss.hasPermission('machine::create')") + @OperateLog(logArgs = false) public CommonResult createCutting(@Valid @RequestBody CuttingSaveReqVO createReqVO) { return success(machineService.createCutting(createReqVO)); } @PostMapping("/update-cutting") - @Operation(summary = "更新开料机台") + @Operation(summary = "更新机台") @PreAuthorize("@ss.hasPermission('machine::update')") + @OperateLog(logArgs = false) public CommonResult update( @RequestBody @Validated(UpdateGroup.class) CuttingSaveReqVO updateReqVO) { machineService.updateCutting(updateReqVO); return success(true); } @DeleteMapping("/delete-cutting") - @Operation(summary = "删除开料机台") + @Operation(summary = "删除机台") @Parameter(name = "id", description = "编号", required = true) @PreAuthorize("@ss.hasPermission('machine::delete')") public CommonResult delete(@RequestParam("id") Long id) { @@ -60,7 +63,7 @@ public class MachineController { } @DeleteMapping("/batch-delete-cutting") - @Operation(summary = "批量删除开料机台") + @Operation(summary = "批量删除机台") @Parameter(name = "id", description = "编号", required = true) @PreAuthorize("@ss.hasPermission('machine::delete')") public CommonResult batchDeleteCutting(@RequestParam("ids") List ids) { @@ -69,7 +72,7 @@ public class MachineController { } @GetMapping("/get-cutting") - @Operation(summary = "获得开料机台") + @Operation(summary = "获得机台") @Parameter(name = "id", description = "编号", required = true, example = "1024") @PreAuthorize("@ss.hasPermission('machine::query')") public CommonResult get(@RequestParam("id") Long id) { @@ -86,18 +89,19 @@ public class MachineController { } @GetMapping("getDefaultCutting") - @Operation(summary = "获得默认开料机台模板") + @Operation(summary = "获得默认机台模板") + @Parameter(name = "machineType", description = "机台类型", required = true, example = "1") @PreAuthorize("@ss.hasPermission('machine::query')") - public CommonResult getDefaultCutting() { - return success(machineTemplateService.getDefaultCutting()); + public CommonResult getDefaultCutting(@RequestParam Integer machineType) { + return success(machineTemplateService.getDefaultCutting(machineType)); } - @GetMapping("getDefaultDrill") + /* @GetMapping("getDefaultDrill") @Operation(summary = "获得默认钻孔机台模板") @PreAuthorize("@ss.hasPermission('machine::query')") public CommonResult getDefaultDrill() { return success(machineTemplateService.getDefaultDrill()); - } + }*/ /*@GetMapping("/export-excel") @Operation(summary = "导出机台 Excel") @@ -112,47 +116,6 @@ public class MachineController { BeanUtils.toBean(list, MachineRespVO.class)); }*/ - @PutMapping("/create-drill") - @Operation(summary = "创建钻孔机台") - @PreAuthorize("@ss.hasPermission('machine::create')") - public CommonResult createDrill(@Valid @RequestBody DrillSaveReqVO createReqVO) { - return success(machineService.createDrill(createReqVO)); - } - - @PostMapping("/update-drill") - @Operation(summary = "更新钻孔机台") - @PreAuthorize("@ss.hasPermission('machine::update')") - public CommonResult updateDrill( @RequestBody @Validated(UpdateGroup.class) DrillSaveReqVO updateReqVO) { - machineService.updateDrill(updateReqVO); - return success(true); - } - - @DeleteMapping("/delete-drill") - @Operation(summary = "删除钻孔机台") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('machine::delete')") - public CommonResult deleteDrill(@RequestParam("id") Long id) { - machineService.deleteDrill(id); - return success(true); - } - - @DeleteMapping("/batch-delete-drill") - @Operation(summary = "批量删除钻孔机台") - @Parameter(name = "id", description = "编号", required = true) - @PreAuthorize("@ss.hasPermission('machine::delete')") - public CommonResult batchDeleteDrill(@RequestParam("ids") List ids) { - machineService.batchDeleteDrill(ids); - return success(true); - } - - @GetMapping("/get-drill") - @Operation(summary = "获得钻孔机台") - @Parameter(name = "id", description = "编号", required = true, example = "1024") - @PreAuthorize("@ss.hasPermission('machine::query')") - public CommonResult getDrill(@RequestParam("id") Long id) { - DrillRespVO respVO = machineService.getDrill(id); - return success(respVO); - } @GetMapping("getMachineTree") @Operation(summary = "获得机台树") diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/MachineTemplateController.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/MachineTemplateController.java index e22bcdc3b..e6891eb9a 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/MachineTemplateController.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/MachineTemplateController.java @@ -3,6 +3,8 @@ package com.cf.imes.module.system.controller.admin.machine; import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.framework.common.pojo.PageParam; import com.cf.imes.framework.common.pojo.PageResult; +import com.cf.imes.framework.common.util.object.BeanUtils; +import com.cf.imes.framework.operatelog.core.annotations.OperateLog; import com.cf.imes.module.system.controller.admin.machine.vo.*; import com.cf.imes.module.system.dal.dataobject.machinetemplate.MachineTemplateDO; import com.cf.imes.module.system.service.machine.MachineTemplateService; @@ -47,82 +49,47 @@ public class MachineTemplateController { return success(machineTemplateService.page(pageParam)); } - @PutMapping("drill-machine") - @Operation(summary = "新增钻孔机台模板配置") - @PreAuthorize("@ss.hasPermission('machine-template::create')") - public CommonResult createDrillTemplate(@RequestBody DrillTemplateSaveReqVO reqVO) { - return success(machineTemplateService.createDrillTemplate(reqVO)); - } - - @PostMapping("drill-machine") - @Operation(summary = "修改钻孔机台模板配置") - @PreAuthorize("@ss.hasPermission('machine-template::update')") - public CommonResult updateDrillTemplate(@RequestBody DrillTemplateSaveReqVO reqVO) { - return success(machineTemplateService.updateDrillTemplate(reqVO)); - } - - @GetMapping("drill-machine") - @Operation(summary = "获取钻孔机台模板配置") - @PreAuthorize("@ss.hasPermission('machine-template::query')") - public CommonResult getDrillTemplateById(@RequestParam("id") Long id) { - return success(machineTemplateService.getDirllTemplateById(id)); - } - - @DeleteMapping("drill-machine") - @Operation(summary = "删除钻孔机台模板配置") - @PreAuthorize("@ss.hasPermission('machine-template::delete')") - public CommonResult deleteDrillTemplate(@RequestParam("id") Long id) { - return success(machineTemplateService.deleteDrillTemplate(id)); - } - - @DeleteMapping("batch-delete-drill") - @Operation(summary = "批量删除钻孔机台模板配置") - @PreAuthorize("@ss.hasPermission('machine-template::delete')") - public CommonResult batchDeleteDrillTemplate(@RequestParam("ids") List ids) { - return success(machineTemplateService.batchDeleteDrillTemplate(ids)); - } @PutMapping("cutting-machine") - @Operation(summary = "新增开料机台模板配置") + @Operation(summary = "新增机台模板配置") @PreAuthorize("@ss.hasPermission('machine-template::create')") + @OperateLog(logArgs = false) public CommonResult createCuttingTemplate(@RequestBody CuttingTemplateSaveReqVO reqVO) { return success(machineTemplateService.createCuttingTemplate(reqVO)); } @PostMapping("cutting-machine") - @Operation(summary = "修改开料机台模板配置") + @Operation(summary = "修改机台模板配置") @PreAuthorize("@ss.hasPermission('machine-template::update')") + @OperateLog(logArgs = false) public CommonResult updateCuttingTemplate(@RequestBody CuttingTemplateSaveReqVO reqVO) { return success(machineTemplateService.updateCuttingTemplate(reqVO)); } @GetMapping("cutting-machine") - @Operation(summary = "获取开料机台模板配置") + @Operation(summary = "获取机台模板配置") @PreAuthorize("@ss.hasPermission('machine-template::query')") public CommonResult getCuttingTemplateById(@RequestParam("id") String id) { return success(machineTemplateService.getCuttingTemplateById(id)); } @DeleteMapping("cutting-machine") - @Operation(summary = "删除开料机台模板配置") + @Operation(summary = "删除机台模板配置") @PreAuthorize("@ss.hasPermission('machine-template::delete')") public CommonResult deleteCutting(@RequestParam("id") Long id) { return success(machineTemplateService.deleteCuttingTemplate(id)); } @DeleteMapping("batch-delete-cutting") - @Operation(summary = "批量删除开料机台模板配置") + @Operation(summary = "批量删除机台模板配置") @PreAuthorize("@ss.hasPermission('machine-template::delete')") public CommonResult batchDeleteCutting(@RequestParam("id") List ids) { return success(machineTemplateService.batchDeleteCuttingTemplate(ids)); } - @PostMapping("auth-template") - @Operation(summary = "用户模板授权") - @PreAuthorize("@ss.hasPermission('machine-template::query')") - public CommonResult auth(@RequestBody MachineAuthVO vo) { - return success(machineTemplateService.auth(vo)); - } + + + } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/AuthTemplatePage.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/AuthTemplatePage.java new file mode 100644 index 000000000..d96f2dedf --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/AuthTemplatePage.java @@ -0,0 +1,19 @@ +package com.cf.imes.module.system.controller.admin.machine.vo; + +import com.cf.imes.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + + +/** + * @author Beal + */ +@Data +public class AuthTemplatePage extends PageParam { + @Schema(description = "组织id") + private Long organId; + @Schema(description = "用户昵称") + private String nickname; + @Schema(description = "机台模板名称") + private String templateName; +} diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/AuthTemplateResp.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/AuthTemplateResp.java new file mode 100644 index 000000000..5a0c36851 --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/AuthTemplateResp.java @@ -0,0 +1,37 @@ +package com.cf.imes.module.system.controller.admin.machine.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; +import java.util.List; + +import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT; + +/** + * @author Beal + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class AuthTemplateResp { + @Schema(description = "组织id") + private Long organId; + @Schema(description = "组织名称") + private String organName; + @Schema(description = "用户id") + private Long userId; + @Schema(description = "用户昵称") + private String nickname; + @Schema(description = "更新时间") + @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) + private Date updateTime; + @Schema(description = "机台模板列表") + private List authTemplateList; +} diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/AuthVO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/AuthVO.java new file mode 100644 index 000000000..84f847311 --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/AuthVO.java @@ -0,0 +1,17 @@ +package com.cf.imes.module.system.controller.admin.machine.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @author Beal + */ +@Data +public class AuthVO { + @Schema(description ="加工模式 开料机加工模式 默认true,显示开料机工作模式(是否排钻/造型,sc)配置") + private Boolean showPriorFacing; + @Schema(description = "双工位") + private Boolean showDualWorkstation; + @Schema(description = "自动贴标") + private Boolean showAutoNotePrinter; +} diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/AutoTemplateVO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/AutoTemplateVO.java new file mode 100644 index 000000000..d6a2a409d --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/AutoTemplateVO.java @@ -0,0 +1,19 @@ +package com.cf.imes.module.system.controller.admin.machine.vo; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @author Beal + */ +@Data +public class AutoTemplateVO { + @Schema(description = "机台模板id") + private Long templateId; + @Schema(description = "机台模板名称") + private String templateName; + + @JsonIgnore + private Long userId; +} diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/CuttingRespVO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/CuttingRespVO.java index 35742e551..afee00671 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/CuttingRespVO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/CuttingRespVO.java @@ -1,5 +1,6 @@ package com.cf.imes.module.system.controller.admin.machine.vo; +import com.alibaba.fastjson.JSONObject; import com.cf.imes.module.system.dal.dataobject.machine.CuttingSettingDO; import io.swagger.v3.oas.annotations.media.Schema; import lombok.*; @@ -10,6 +11,9 @@ import com.alibaba.excel.annotation.*; @Schema(description = "管理后台 - 机台 Response VO") @Data @ExcelIgnoreUnannotated +@Builder +@NoArgsConstructor +@AllArgsConstructor public class CuttingRespVO { @Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "14092") @@ -31,8 +35,11 @@ public class CuttingRespVO { @ExcelProperty("创建时间") private LocalDateTime createTime; + /* @Schema(description = "机台配置") + private CuttingSettingDO machineSettingDO;*/ + @Schema(description = "机台配置") - private CuttingSettingDO machineSettingDO; + private JSONObject machineSettingDO; } \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/CuttingSaveReqVO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/CuttingSaveReqVO.java index e66651ca6..050b58128 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/CuttingSaveReqVO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/CuttingSaveReqVO.java @@ -1,5 +1,6 @@ package com.cf.imes.module.system.controller.admin.machine.vo; +import com.alibaba.fastjson.JSONObject; import com.cf.imes.framework.es.core.valid.UpdateGroup; import com.cf.imes.module.system.dal.dataobject.machine.CuttingSettingDO; import io.swagger.v3.oas.annotations.media.Schema; @@ -32,9 +33,13 @@ public class CuttingSaveReqVO { @NotNull(message = "标签id不能空") private Long labelId; - @Schema(description = "机台配置") + /* @Schema(description = "机台配置") @Valid - private CuttingSettingDO machineSettingDO; + private CuttingSettingDO machineSettingDO;*/ + + @Schema(description = "机台配置") + private JSONObject machineSettingDO; + /* @Schema(description = "样式配置") @Valid diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/CuttingTemplateRespVO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/CuttingTemplateRespVO.java index 5ffb142a4..ebca14e90 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/CuttingTemplateRespVO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/CuttingTemplateRespVO.java @@ -1,6 +1,7 @@ package com.cf.imes.module.system.controller.admin.machine.vo; import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.fastjson.JSONObject; import com.cf.imes.module.system.dal.dataobject.machinetemplate.CuttingTemplateMachineDO; import com.cf.imes.module.system.dal.dataobject.machinetemplate.DrillTemplateMachineDO; import io.swagger.v3.oas.annotations.media.Schema; @@ -35,6 +36,9 @@ public class CuttingTemplateRespVO { @ExcelProperty("创建时间") private LocalDateTime createTime; + /*@Schema(description = "开料机台模板配置") + private CuttingTemplateMachineDO cuttingTemplateMachineDO;*/ + @Schema(description = "开料机台模板配置") - private CuttingTemplateMachineDO cuttingTemplateMachineDO; + private JSONObject cuttingTemplateMachineDO; } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/CuttingTemplateSaveReqVO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/CuttingTemplateSaveReqVO.java index ea6d9be87..33c3c6701 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/CuttingTemplateSaveReqVO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/CuttingTemplateSaveReqVO.java @@ -1,5 +1,6 @@ package com.cf.imes.module.system.controller.admin.machine.vo; +import com.alibaba.fastjson.JSONObject; import com.cf.imes.framework.es.core.valid.UpdateGroup; import com.cf.imes.module.system.dal.dataobject.machinetemplate.CuttingTemplateMachineDO; import io.swagger.v3.oas.annotations.media.Schema; @@ -29,7 +30,11 @@ public class CuttingTemplateSaveReqVO { @NotNull(message = "标签id不能空") private Long labelId;*/ + /* @Schema(description = "管理理后台 - 开料机台模板新增/修改 Request VO") + @NotNull(message = "开料机台配置不能空") + private CuttingTemplateMachineDO setting;*/ + @Schema(description = "管理理后台 - 开料机台模板新增/修改 Request VO") @NotNull(message = "开料机台配置不能空") - private CuttingTemplateMachineDO setting; + private JSONObject setting; } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/MachineAuth.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/MachineAuth.java new file mode 100644 index 000000000..48944c4c5 --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/MachineAuth.java @@ -0,0 +1,19 @@ +package com.cf.imes.module.system.controller.admin.machine.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @author Beal + */ +@Data +public class MachineAuth { + @Schema(description = "机台模板id") + private Long machineId; + @Schema(description ="加工模式 开料机加工模式 默认true,显示开料机工作模式(是否排钻/造型,sc)配置") + private Boolean showPriorFacing; + @Schema(description = "双工位") + private Boolean showDualWorkstation; + @Schema(description = "自动贴标") + private Boolean showAutoNotePrinter; +} diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/MachineAuthVO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/MachineAuthVO.java index 0e6280468..f133c287f 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/MachineAuthVO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/MachineAuthVO.java @@ -14,6 +14,5 @@ public class MachineAuthVO { @NotNull(message = "用户id不能空") private Long userId; - @NotEmpty(message = "机台配置id不能空") private List machinesIds; } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/MachineOrgAuthReq.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/MachineOrgAuthReq.java new file mode 100644 index 000000000..6af97f83b --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/MachineOrgAuthReq.java @@ -0,0 +1,21 @@ +package com.cf.imes.module.system.controller.admin.machine.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + + +import java.util.List; + +/** + * @author Beal + */ +@Data +public class MachineOrgAuthReq { + + @Schema(description = "组织id") + private Long organId; + @Schema(description = "权限列表") + private List machineAuthList; + + +} diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/OrganTemplatePage.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/OrganTemplatePage.java new file mode 100644 index 000000000..8a23ac2cb --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/OrganTemplatePage.java @@ -0,0 +1,17 @@ +package com.cf.imes.module.system.controller.admin.machine.vo; + +import com.cf.imes.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @author Beal + */ +@Data +public class OrganTemplatePage extends PageParam { + @Schema(description = "组织id") + private Long organId; + @Schema(description = "机台模板名称") + private String templateName; + +} diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/OrganTemplateResp.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/OrganTemplateResp.java new file mode 100644 index 000000000..9e3cd5766 --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/OrganTemplateResp.java @@ -0,0 +1,33 @@ +package com.cf.imes.module.system.controller.admin.machine.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; +import java.util.List; + +import static com.cf.imes.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +import static com.cf.imes.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT; + +/** + * @author Beal + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class OrganTemplateResp { + @Schema(description = "组织id") + private Long organId; + @Schema(description = "组织名称") + private String organName; + @Schema(description = "更新时间") + @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) + private Date updateTime; + @Schema(description = "机台模板列表") + private List authTemplateList; +} diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/OrganTemplateVO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/OrganTemplateVO.java new file mode 100644 index 000000000..ea4000e45 --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/OrganTemplateVO.java @@ -0,0 +1,28 @@ +package com.cf.imes.module.system.controller.admin.machine.vo; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @author Beal + */ +@Data +public class OrganTemplateVO { + @Schema(description = "机台模板id") + private Long templateId; + @Schema(description = "机台模板名称") + private String templateName; + @Schema(description = "机台模板类型") + private Integer machineType; + @Schema(description ="加工模式 开料机加工模式 默认true,显示开料机工作模式(是否排钻/造型,sc)配置") + private Boolean showPriorFacing; + @Schema(description = "双工位") + private Boolean showDualWorkstation; + @Schema(description = "自动贴标") + private Boolean showAutoNotePrinter; + + @JsonIgnore + private Long organId; + +} diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/TemplateAutoResp.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/TemplateAutoResp.java new file mode 100644 index 000000000..fc355bf43 --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/machine/vo/TemplateAutoResp.java @@ -0,0 +1,40 @@ +package com.cf.imes.module.system.controller.admin.machine.vo; + +import com.baomidou.mybatisplus.annotation.TableId; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @author Beal + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class TemplateAutoResp { + @Schema(description = "机台模板id") + private Long id; + /** + * 名称 + */ + @Schema(description = "机台模板名称") + private String templateName; + /** + * 1机台设备 2CNC设备 + */ + @Schema(description = "机台模板类别") + private Integer machineType; + /** + * 是否默认模板 + */ + private Boolean isDefault; + @Schema(description ="加工模式 开料机加工模式 默认true,显示开料机工作模式(是否排钻/造型,sc)配置") + private Boolean showPriorFacing = false; + @Schema(description = "双工位") + private Boolean showDualWorkstation = false; + @Schema(description = "自动贴标") + private Boolean showAutoNotePrinter = false; +} diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/organ/OrganController.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/organ/OrganController.java index 02fc4c207..d4140754d 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/organ/OrganController.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/controller/admin/organ/OrganController.java @@ -1,5 +1,6 @@ package com.cf.imes.module.system.controller.admin.organ; +import com.cf.imes.framework.common.enums.CommonStatusEnum; import com.cf.imes.framework.common.pojo.CommonResult; import com.cf.imes.framework.common.pojo.PageParam; import com.cf.imes.framework.common.pojo.PageResult; @@ -25,8 +26,10 @@ import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.IOException; import java.util.List; +import java.util.Map; import static com.cf.imes.framework.common.pojo.CommonResult.success; +import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertList; import static com.cf.imes.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; @Tag(name = "管理后台 - 组织") @@ -109,4 +112,12 @@ public class OrganController { BeanUtils.toBean(list, OrganRespVO.class)); } + + @GetMapping({"/list-all-simple", "/simple-list"}) + @Operation(summary = "获取组织精简信息列表", description = "主要用于前端的下拉选项") + @Parameter(name = "name", description = "组织名称", required = false, example = "xxx") + public CommonResult> getSimpleOrganList(@RequestParam(required = false, value = "name") String name) { + return success(organService.getSimpleOrganList(name)); + } + } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/convert/machine/MachineConvert.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/convert/machine/MachineConvert.java new file mode 100644 index 000000000..2045eee11 --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/convert/machine/MachineConvert.java @@ -0,0 +1,36 @@ +package com.cf.imes.module.system.convert.machine; + +import com.alibaba.fastjson.JSON; +import com.cf.imes.module.system.controller.admin.machine.vo.CuttingRespVO; +import com.cf.imes.module.system.controller.admin.machine.vo.CuttingSaveReqVO; +import com.cf.imes.module.system.dal.dataobject.machine.MachineDO; + +/** + * @author Beal + */ +public class MachineConvert { + + public static MachineDO convert(CuttingSaveReqVO createReqVO) { + return MachineDO.builder() + .machineType(createReqVO.getMachineType()) + .name(createReqVO.getName()) + .id(createReqVO.getId()) + .labelId(createReqVO.getLabelId()) + .setting(createReqVO.getMachineSettingDO().toJSONString()) + .build(); + + } + + public static CuttingRespVO convert(MachineDO machineDO) { + return CuttingRespVO.builder() + .id(machineDO.getId()) + .machineSettingDO(JSON.parseObject(machineDO.getSetting())) + .createTime(machineDO.getCreateTime()) + .labelId(machineDO.getLabelId()) + .name(machineDO.getName()) + .machineType(machineDO.getMachineType()) + .labelId(machineDO.getLabelId()) + .build(); + + } +} diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/convert/machine/MachineTemplateConvert.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/convert/machine/MachineTemplateConvert.java new file mode 100644 index 000000000..3b79adb59 --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/convert/machine/MachineTemplateConvert.java @@ -0,0 +1,43 @@ +package com.cf.imes.module.system.convert.machine; + +import com.alibaba.fastjson.JSON; +import com.cf.imes.module.system.controller.admin.machine.vo.CuttingRespVO; +import com.cf.imes.module.system.controller.admin.machine.vo.CuttingTemplateRespVO; +import com.cf.imes.module.system.controller.admin.machine.vo.CuttingTemplateSaveReqVO; +import com.cf.imes.module.system.dal.dataobject.machinetemplate.MachineTemplateDO; + +/** + * @author Beal + */ +public class MachineTemplateConvert { + + public static CuttingRespVO convert(MachineTemplateDO templateDO) { + return CuttingRespVO.builder() + .labelId(templateDO.getId()) + .machineType(templateDO.getMachineType()) + .id(templateDO.getId()) + .name(templateDO.getName()) + .createTime(templateDO.getCreateTime()) + .machineSettingDO(JSON.parseObject(templateDO.getSetting())) + .build(); + } + + public static MachineTemplateDO convert(CuttingTemplateSaveReqVO reqVO) { + return MachineTemplateDO.builder() + .machineType(reqVO.getMachineType()) + .id(reqVO.getId()) + .name(reqVO.getName()) + .setting(reqVO.getSetting().toJSONString()) + .build(); + } + + public static CuttingTemplateRespVO convert1(MachineTemplateDO templateDO) { + return CuttingTemplateRespVO.builder() + .machineType(templateDO.getMachineType()) + .id(templateDO.getId()) + .name(templateDO.getName()) + .createTime(templateDO.getCreateTime()) + .cuttingTemplateMachineDO(JSON.parseObject(templateDO.getSetting())) + .build(); + } +} diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/datasource/DataSourceDO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/datasource/DataSourceDO.java index e97146753..e86fad02a 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/datasource/DataSourceDO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/datasource/DataSourceDO.java @@ -34,7 +34,7 @@ public class DataSourceDO extends BaseDO { /** * sql */ - private String sql; + private String sqlStr; /** * 数据源类型 */ diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/datasource/DataSourceFiledDO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/datasource/DataSourceFiledDO.java new file mode 100644 index 000000000..76d339d26 --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/datasource/DataSourceFiledDO.java @@ -0,0 +1,21 @@ +package com.cf.imes.module.system.dal.dataobject.datasource; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; + +/** + * @author Beal + */ +@Data +@TableName("system_data_source_field") +public class DataSourceFiledDO { + @TableId + private Long id; + + private Long sourceId; + + private String name; + + private String key; +} diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/labeltemplate/LabelElementTemplateDO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/labeltemplate/LabelElementTemplateDO.java deleted file mode 100644 index e588d8b5b..000000000 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/labeltemplate/LabelElementTemplateDO.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.cf.imes.module.system.dal.dataobject.labeltemplate; - -import lombok.*; -import java.util.*; -import java.time.LocalDateTime; -import java.time.LocalDateTime; -import com.baomidou.mybatisplus.annotation.*; -import com.cf.imes.framework.mybatis.core.dataobject.BaseDO; - -/** - * 标签元素模板 DO - * - * @author 晨丰科技 - */ -@TableName("system_label_element_template") -@KeySequence("system_label_element_template_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class LabelElementTemplateDO extends BaseDO { - - /** - * 注释 - */ - @TableId - private Long id; - /** - * 标签模板id - */ - private Long labelTemplateId; - /** - * 标签元素名称 - */ - private String name; - /** - * 元素类型 - */ - private String type; - /** - * 数据源id - */ - private Long sourceId; - -} \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/labeltemplate/LabelTemplateDO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/labeltemplate/LabelTemplateDO.java index b882c6588..e9a2f4270 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/labeltemplate/LabelTemplateDO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/labeltemplate/LabelTemplateDO.java @@ -47,5 +47,13 @@ public class LabelTemplateDO extends BaseDO { * 高度 */ private Integer height; + /** + * 是否默认 + */ + private Boolean isDefault; + /** + * 配置 + */ + private String template; } \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/lable/LabelDO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/lable/LabelDO.java index a0a4a7897..87ad61358 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/lable/LabelDO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/lable/LabelDO.java @@ -47,5 +47,9 @@ public class LabelDO extends OrganBaseDO { * 高度 */ private Integer height; + /** + * 配置 + */ + private String template; } \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/lable/LabelElementDO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/lable/LabelElementDO.java deleted file mode 100644 index ce660f568..000000000 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/lable/LabelElementDO.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.cf.imes.module.system.dal.dataobject.lable; - -import com.baomidou.mybatisplus.annotation.KeySequence; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.cf.imes.framework.mybatis.core.dataobject.BaseDO; -import com.cf.imes.framework.organ.core.db.OrganBaseDO; -import lombok.*; - -/** - * 标签元素模板 DO - * - * @author 晨丰科技 - */ -@TableName("system_label_element") -@KeySequence("system_label_element_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 -@Data -@EqualsAndHashCode(callSuper = true) -@ToString(callSuper = true) -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class LabelElementDO extends OrganBaseDO { - - /** - * 注释 - */ - @TableId - private Long id; - /** - * 标签模板id - */ - private Long labelId; - /** - * 标签元素名称 - */ - private String name; - /** - * 元素类型 - */ - private String type; - /** - * 数据源id - */ - private Long sourceId; - -} \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machine/CuttingSettingDO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machine/CuttingSettingDO.java index 9e4cf7c1e..b8abf43eb 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machine/CuttingSettingDO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machine/CuttingSettingDO.java @@ -26,7 +26,7 @@ public class CuttingSettingDO extends ESDocument { @Schema(description = "默认0,工位1原点位置") private Integer originPoIntegerPosition; @Schema(description = "工作原点Z0基准面") - private String originZ0Position; + private Integer originZ0Position; @Schema(description = "排版基准点") private String layoutBenchmark; @Schema(description = "排版基准点跟随大板定位") @@ -161,10 +161,10 @@ public class CuttingSettingDO extends ESDocument { //高级设置 - @Schema(description ="默认true,显示开料机工作模式(是否排钻/造型,sc)配置") + @Schema(description ="加工模式 开料机加工模式 默认true,显示开料机工作模式(是否排钻/造型,sc)配置") private Boolean showPriorFacing; @Schema(description = "双工位") - private Boolean dualWorkstation; + private Boolean showDualWorkstation; @Schema(description = "自动贴标") private Boolean showAutoNotePrinter; @Schema(description = "排版方式") @@ -239,7 +239,7 @@ public class CuttingSettingDO extends ESDocument { @Schema(description = "默认false,启用自定义板件编号") - private Boolean allowBlockNo_Note; + private Boolean showAllowBlockNo_Note; @Schema(description = "默认空,机台备注") private String remark; @@ -249,17 +249,17 @@ public class CuttingSettingDO extends ESDocument { @Schema(description = "默认{0}_{1}_{2},导出zip文件名") private List exportOrderPathName; @Schema(description = "大板NC正(A)面文件名") - private String largePlateNcPositiveFileName; + private List largePlateNcPositiveFileName; @Schema(description = "大板NC反(B)面文件名") - private String largePlateNcNegativeFileName; + private List largePlateNcNegativeFileName; @Schema(description = "小板NC正(A)面文件名") - private String smallPlateNcPositiveFileName; + private List smallPlateNcPositiveFileName; @Schema(description = "小板NC反(B)面文件名") - private String smallPlateNcNegativeFileName; + private List smallPlateNcNegativeFileName; @Schema(description = "大板DXF(排版图)文件名") - private String largePlateDxfLayoutFileName; + private List largePlateDxfLayoutFileName; @Schema(description = "小板DXF(孔槽加工图)文件名") - private String smallPlateDxfProcessingFileName; + private List smallPlateDxfProcessingFileName; @Schema(description = "导出大板NC反(B)面文件") private String exportLargePlateNcNegativeFile; @Schema(description = "合并大板NC正反(AB)面文件") @@ -553,7 +553,7 @@ public class CuttingSettingDO extends ESDocument { @Schema(description = "轴停止指令") private String axisStopInstruction; @Schema(description = "是否预启动") - private String preStartEnabled; + private Boolean preStartEnabled; @Schema(description = "高级加工") private Boolean advancedProcessingEnabled; @Schema(description = "集合加工") diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machine/MachineDO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machine/MachineDO.java index 9fae2468d..21bbdde38 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machine/MachineDO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machine/MachineDO.java @@ -35,10 +35,14 @@ public class MachineDO extends OrganBaseDO { /** * 1机台设备 2CNC设备 */ - private Long machineType; + private Integer machineType; /** * 标签id */ private Long labelId; + /** + * 配置 + */ + private String setting; } \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machine/UserMachineDO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machine/UserMachineDO.java index c1b5a58d4..a6c6b2153 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machine/UserMachineDO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machine/UserMachineDO.java @@ -20,5 +20,4 @@ public class UserMachineDO { private Long id; private Long userId; private Long machineId; - private Long organId; } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machinetemplate/CuttingTemplateMachineDO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machinetemplate/CuttingTemplateMachineDO.java index fe3fa3540..53244f0ed 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machinetemplate/CuttingTemplateMachineDO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machinetemplate/CuttingTemplateMachineDO.java @@ -30,7 +30,7 @@ public class CuttingTemplateMachineDO extends ESDocument { @Schema(description = "默认0,工位1原点位置") private Integer originPoIntegerPosition; @Schema(description = "工作原点Z0基准面") - private String originZ0Position; + private Integer originZ0Position; @Schema(description = "排版基准点") private String layoutBenchmark; @Schema(description = "排版基准点跟随大板定位") @@ -165,10 +165,10 @@ public class CuttingTemplateMachineDO extends ESDocument { //高级设置 - @Schema(description ="默认true,显示开料机工作模式(是否排钻/造型,sc)配置") + @Schema(description ="加工模式 开料机加工模式 默认true,显示开料机工作模式(是否排钻/造型,sc)配置") private Boolean showPriorFacing; @Schema(description = "双工位") - private Boolean dualWorkstation; + private Boolean showDualWorkstation; @Schema(description = "自动贴标") private Boolean showAutoNotePrinter; @Schema(description = "排版方式") @@ -243,7 +243,7 @@ public class CuttingTemplateMachineDO extends ESDocument { @Schema(description = "默认false,启用自定义板件编号") - private Boolean allowBlockNo_Note; + private Boolean showAllowBlockNo_Note; @Schema(description = "默认空,机台备注") private String remark; @@ -253,17 +253,17 @@ public class CuttingTemplateMachineDO extends ESDocument { @Schema(description = "默认{0}_{1}_{2},导出zip文件名") private List exportOrderPathName; @Schema(description = "大板NC正(A)面文件名") - private String largePlateNcPositiveFileName; + private List largePlateNcPositiveFileName; @Schema(description = "大板NC反(B)面文件名") - private String largePlateNcNegativeFileName; + private List largePlateNcNegativeFileName; @Schema(description = "小板NC正(A)面文件名") - private String smallPlateNcPositiveFileName; + private List smallPlateNcPositiveFileName; @Schema(description = "小板NC反(B)面文件名") - private String smallPlateNcNegativeFileName; + private List smallPlateNcNegativeFileName; @Schema(description = "大板DXF(排版图)文件名") - private String largePlateDxfLayoutFileName; + private List largePlateDxfLayoutFileName; @Schema(description = "小板DXF(孔槽加工图)文件名") - private String smallPlateDxfProcessingFileName; + private List smallPlateDxfProcessingFileName; @Schema(description = "导出大板NC反(B)面文件") private String exportLargePlateNcNegativeFile; @Schema(description = "合并大板NC正反(AB)面文件") @@ -557,7 +557,7 @@ public class CuttingTemplateMachineDO extends ESDocument { @Schema(description = "轴停止指令") private String axisStopInstruction; @Schema(description = "是否预启动") - private String preStartEnabled; + private Boolean preStartEnabled; @Schema(description = "高级加工") private Boolean advancedProcessingEnabled; @Schema(description = "集合加工") diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machinetemplate/MachineTemplateDO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machinetemplate/MachineTemplateDO.java index b78d3e711..05a0a8454 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machinetemplate/MachineTemplateDO.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machinetemplate/MachineTemplateDO.java @@ -32,6 +32,10 @@ public class MachineTemplateDO extends BaseDO { * 是否默认模板 */ private Boolean isDefault; + /** + * 机台模板配置 + */ + private String setting; /** * 标签id diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machinetemplate/OrganMachineDO.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machinetemplate/OrganMachineDO.java new file mode 100644 index 000000000..53eedcc3f --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/dataobject/machinetemplate/OrganMachineDO.java @@ -0,0 +1,39 @@ +package com.cf.imes.module.system.dal.dataobject.machinetemplate; + +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + * @author Beal + */ +@Data +@TableName("system_organ_machine") +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class OrganMachineDO { + @TableId + private Long id; + private Long organId; + private Long machineId; + private LocalDateTime createTime; + /** + * 加工模式 开料机加工模式 默认true,显示开料机工作模式(是否排钻/造型,sc)配置 + */ + private Boolean showPriorFacing; + /** + * 双工位 + */ + private Boolean showDualWorkstation; + /** + * 自动贴标 + */ + private Boolean showAutoNotePrinter; +} diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/datasource/DataSourceMapper.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/datasource/DataSourceMapper.java index dbc007c5c..f6f2abb80 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/datasource/DataSourceMapper.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/datasource/DataSourceMapper.java @@ -20,10 +20,11 @@ public interface DataSourceMapper extends BaseMapperX { default PageResult selectPage(DataSourcePageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .likeIfPresent(DataSourceDO::getName, reqVO.getName()) - .eqIfPresent(DataSourceDO::getSql, reqVO.getSql()) + .eqIfPresent(DataSourceDO::getSqlStr, reqVO.getSqlStr()) .eqIfPresent(DataSourceDO::getType, reqVO.getType()) .betweenIfPresent(DataSourceDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(DataSourceDO::getId)); } + List selectListVO(); } \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/label/LabelElementMapper.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/label/LabelElementMapper.java deleted file mode 100644 index 14ddc93b5..000000000 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/label/LabelElementMapper.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.cf.imes.module.system.dal.mysql.label; - -import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX; -import com.cf.imes.module.system.dal.dataobject.lable.LabelElementDO; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - -/** - * 标签元素模板 Mapper - * - * @author 晨丰科技 - */ -@Mapper -public interface LabelElementMapper extends BaseMapperX { - - default List selectListByLabelId(Long labelTemplateId) { - return selectList(LabelElementDO::getLabelId, labelTemplateId); - } - - default int deleteByLabelId(Long labelTemplateId) { - return delete(LabelElementDO::getLabelId, labelTemplateId); - } - -} \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/labeltemplate/LabelElementTemplateMapper.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/labeltemplate/LabelElementTemplateMapper.java deleted file mode 100644 index 6e2011b80..000000000 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/labeltemplate/LabelElementTemplateMapper.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.cf.imes.module.system.dal.mysql.labeltemplate; - -import java.util.*; - -import com.cf.imes.framework.common.pojo.PageResult; -import com.cf.imes.framework.common.pojo.PageParam; -import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; -import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX; -import com.cf.imes.module.system.dal.dataobject.labeltemplate.LabelElementTemplateDO; -import org.apache.ibatis.annotations.Mapper; - -/** - * 标签元素模板 Mapper - * - * @author 晨丰科技 - */ -@Mapper -public interface LabelElementTemplateMapper extends BaseMapperX { - - default List selectListByLabelTemplateId(Long labelTemplateId) { - return selectList(LabelElementTemplateDO::getLabelTemplateId, labelTemplateId); - } - - default int deleteByLabelTemplateId(Long labelTemplateId) { - return delete(LabelElementTemplateDO::getLabelTemplateId, labelTemplateId); - } - -} \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/machinetemplate/MachineTemplateMapper.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/machinetemplate/MachineTemplateMapper.java index 791983eb7..bb4b56d91 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/machinetemplate/MachineTemplateMapper.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/machinetemplate/MachineTemplateMapper.java @@ -1,14 +1,18 @@ package com.cf.imes.module.system.dal.mysql.machinetemplate; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; -import com.cf.imes.module.system.controller.admin.machine.vo.MachinePageReqVO; +import com.cf.imes.module.system.controller.admin.machine.vo.*; import com.cf.imes.module.system.dal.dataobject.machinetemplate.MachineTemplateDO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.Collection; import java.util.List; +import java.util.Map; /** * @author there @@ -19,9 +23,21 @@ public interface MachineTemplateMapper extends BaseMapperX { default PageResult selectPage(MachinePageReqVO reqVO, Collection ids) { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(MachineTemplateDO::getMachineType, reqVO.getMachineType()) - .inIfPresent(MachineTemplateDO::getId, ids) + //.inIfPresent(MachineTemplateDO::getId, ids) .likeIfPresent(MachineTemplateDO::getName, reqVO.getName()) .betweenIfPresent(MachineTemplateDO::getCreateTime, reqVO.getCreateTime()) .orderByDesc(MachineTemplateDO::getCreateTime)); } + + Page selectAuthTemplatePage(@Param("page") IPage authTemplateRespPage, @Param("vo") AuthTemplatePage page); + + List selectAuthTemplateList(Map map); + + //Page selectOrganTemplatePage(@Param("page") Page respPage, @Param("vo") OrganTemplatePage page); + + List selectOrganTemplateList(Map map); + + Page selectOrganTemplatePage(@Param("page") Page respPage, @Param("vo") OrganTemplatePage page); + + OrganTemplateResp selectOrganTemplate(Long organId); } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/machinetemplate/OrganMachineMapper.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/machinetemplate/OrganMachineMapper.java new file mode 100644 index 000000000..ca247dff2 --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/dal/mysql/machinetemplate/OrganMachineMapper.java @@ -0,0 +1,10 @@ +package com.cf.imes.module.system.dal.mysql.machinetemplate; + +import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX; +import com.cf.imes.module.system.dal.dataobject.machinetemplate.OrganMachineDO; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface OrganMachineMapper extends BaseMapperX { + +} diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/datasource/DataSourceService.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/datasource/DataSourceService.java index 357191da4..ef479826c 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/datasource/DataSourceService.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/datasource/DataSourceService.java @@ -54,4 +54,6 @@ public interface DataSourceService { PageResult getDataSourcePage(DataSourcePageReqVO pageReqVO); List list(Integer type); + + List list(); } \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/datasource/DataSourceServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/datasource/DataSourceServiceImpl.java index 71b84518d..1cb9c58cf 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/datasource/DataSourceServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/datasource/DataSourceServiceImpl.java @@ -75,4 +75,9 @@ public class DataSourceServiceImpl implements DataSourceService { return dataSourceMapper.selectList(new LambdaQueryWrapperX().eqIfPresent(DataSourceDO::getType, type)); } + @Override + public List list() { + return dataSourceMapper.selectListVO(); + } + } \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/labeltemplate/LabelTemplateService.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/labeltemplate/LabelTemplateService.java index a7759ff84..1459f6fb2 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/labeltemplate/LabelTemplateService.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/labeltemplate/LabelTemplateService.java @@ -2,10 +2,8 @@ package com.cf.imes.module.system.service.labeltemplate; import java.util.*; import com.cf.imes.module.system.controller.admin.labeltemplate.vo.*; -import com.cf.imes.module.system.dal.dataobject.labeltemplate.LabelElementTemplateDO; import com.cf.imes.module.system.dal.dataobject.labeltemplate.LabelTemplateDO; import com.cf.imes.framework.common.pojo.PageResult; -import com.cf.imes.framework.common.pojo.PageParam; import javax.validation.Valid; @@ -56,13 +54,13 @@ public interface LabelTemplateService { // ==================== 子表(标签元素模板) ==================== - /** - * 获得标签元素模板列表 - * - * @param labelTemplateId 标签模板id - * @return 标签元素模板列表 - */ - List getLabelElementTemplateListByLabelTemplateId(Long labelTemplateId); Map> getGroupList(); + + /** + * 获得默认标签模板 + * @param type + * @return + */ + LabelTemplateRespVO getDefaultLabelTemplate(String type); } \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/labeltemplate/LabelTemplateServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/labeltemplate/LabelTemplateServiceImpl.java index 9e189d2cb..623ac8be7 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/labeltemplate/LabelTemplateServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/labeltemplate/LabelTemplateServiceImpl.java @@ -1,39 +1,18 @@ package com.cf.imes.module.system.service.labeltemplate; import cn.hutool.core.collection.CollectionUtil; -import cn.hutool.core.convert.Convert; -import cn.hutool.core.lang.TypeReference; -import co.elastic.clients.elasticsearch.ElasticsearchClient; -import co.elastic.clients.elasticsearch._types.FieldValue; -import co.elastic.clients.elasticsearch._types.query_dsl.TermsQuery; -import co.elastic.clients.elasticsearch.core.DeleteByQueryRequest; -import co.elastic.clients.elasticsearch.core.SearchResponse; -import co.elastic.clients.elasticsearch.core.search.Hit; -import com.cf.imes.framework.common.exception.ServiceException; -import com.cf.imes.framework.es.core.service.ESDocumentService; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; -import com.cf.imes.module.system.dal.dataobject.labelelementproperty.LabelElementPropertyDO; -import com.cf.imes.module.system.dal.dataobject.labeltemplate.LabelElementTemplateDO; -import com.cf.imes.module.system.dal.dataobject.machine.CuttingSettingDO; -import com.cf.imes.module.system.dal.mysql.labeltemplate.LabelElementTemplateMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; -import org.springframework.transaction.annotation.Transactional; - -import java.io.IOException; import java.util.*; import java.util.stream.Collectors; - import com.cf.imes.module.system.controller.admin.labeltemplate.vo.*; import com.cf.imes.module.system.dal.dataobject.labeltemplate.LabelTemplateDO; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.module.system.dal.mysql.labeltemplate.LabelTemplateMapper; - import javax.annotation.Resource; - -import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR; import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; @@ -49,136 +28,33 @@ public class LabelTemplateServiceImpl implements LabelTemplateService { @Resource private LabelTemplateMapper labelTemplateMapper; - @Resource - private LabelElementTemplateMapper labelElementTemplateMapper; - @Resource - private ESDocumentService esDocumentService; - @Resource - private ElasticsearchClient elasticsearchClient; - - private static final String LABEL_TEMPLATE_ELEMENT_PROPERTY_INX = "label_template_element_property"; @Override - @Transactional(rollbackFor = Exception.class) public Long createLabelTemplate(LabelTemplateSaveReqVO createReqVO) { // 插入 LabelTemplateDO labelTemplate = BeanUtils.toBean(createReqVO, LabelTemplateDO.class); labelTemplateMapper.insert(labelTemplate); - - // 插入子表 - List createReqVOElements = createReqVO.getElements(); - if(CollectionUtil.isNotEmpty(createReqVOElements)) { - List labelElementPropertyDOS = new ArrayList<>(); - createReqVOElements.forEach(e -> { - e.setLabelTemplateId(labelTemplate.getId()); - LabelElementTemplateDO elementTemplateDO = Convert.convert(LabelElementTemplateDO.class, e); - labelElementTemplateMapper.insert(elementTemplateDO); - LabelElementPropertyDO propertyDO = e.getPropertyDO(); - propertyDO.setElementId(elementTemplateDO.getId()); - labelElementPropertyDOS.add(propertyDO); - }); - //插入索引 - try { - esDocumentService.bulkCreate(LABEL_TEMPLATE_ELEMENT_PROPERTY_INX, labelElementPropertyDOS); - } catch (Exception e) { - log.error(e.getMessage()); - throw exception(INTERNAL_SERVER_ERROR); - } - } // 返回 return labelTemplate.getId(); } @Override - @Transactional(rollbackFor = Exception.class) public void updateLabelTemplate(LabelTemplateSaveReqVO updateReqVO) { // 校验存在 validateLabelTemplateExists(updateReqVO.getId()); // 更新 LabelTemplateDO updateObj = BeanUtils.toBean(updateReqVO, LabelTemplateDO.class); labelTemplateMapper.updateById(updateObj); - - List labelElementTemplateDOS = labelElementTemplateMapper.selectList(new LambdaQueryWrapperX() - .select(LabelElementTemplateDO::getId) - .eq(LabelElementTemplateDO::getLabelTemplateId, updateReqVO.getId())); - //删除旧的元素 - DeleteByQueryRequest.Builder builder = null; - if(CollectionUtil.isNotEmpty(labelElementTemplateDOS)) { - List templateIds = labelElementTemplateDOS.stream() - .map(LabelElementTemplateDO::getId) - .toList(); - labelElementTemplateMapper.deleteBatchIds(templateIds); - List fieldValues = templateIds.stream().map(FieldValue::of).collect(Collectors.toList()); - builder = new DeleteByQueryRequest.Builder() - .index(LABEL_TEMPLATE_ELEMENT_PROPERTY_INX) - .query(TermsQuery.of(e -> e.field("elementId").terms(b -> b.value(fieldValues)))._toQuery()); - } - - - //新增新的元素 - List createReqVOElements = updateReqVO.getElements(); - List labelElementPropertyDOS = new ArrayList<>(); - createReqVOElements.forEach(e -> { - e.setLabelTemplateId(updateObj.getId()); - LabelElementTemplateDO elementTemplateDO = Convert.convert(LabelElementTemplateDO.class, e); - labelElementTemplateMapper.insert(elementTemplateDO); - LabelElementPropertyDO propertyDO = e.getPropertyDO(); - propertyDO.setElementId(elementTemplateDO.getId()); - labelElementPropertyDOS.add(propertyDO); - }); - //插入索引 - try { - if(CollectionUtil.isNotEmpty(labelElementPropertyDOS)) { - esDocumentService.bulkCreate(LABEL_TEMPLATE_ELEMENT_PROPERTY_INX, labelElementPropertyDOS); - } - if(!Objects.isNull(builder)) { - elasticsearchClient.deleteByQuery(builder.build()); - } - } catch (Exception e) { - log.error(e.getMessage()); - throw exception(INTERNAL_SERVER_ERROR); - } - - - /*updateLabelElementTemplateList(updateReqVO.getId(), Convert.convert(new TypeReference>() { - }, elements));*/ - /* labelElementTemplateMapper.updateBatch(Convert.convert(new TypeReference>() { - }, elements)); - List labelElementPropertyDOS = elements.stream().map(e -> e.getPropertyDO()).collect(Collectors.toList()); - try { - esDocumentService.bulkCreate(LABEL_TEMPLATE_ELEMENT_PROPERTY_INX, labelElementPropertyDOS); - } catch (Exception e) { - log.error(e.getMessage()); - throw exception(INTERNAL_SERVER_ERROR); - }*/ - } @Override - @Transactional(rollbackFor = Exception.class) public void deleteLabelTemplate(Long id) { // 校验存在 LabelTemplateDO labelTemplateDO = labelTemplateMapper.selectById(id); if (labelTemplateDO == null) { throw exception(LABEL_TEMPLATE_NOT_EXISTS); } - List labelElementTemplateDOS = labelElementTemplateMapper.selectListByLabelTemplateId(id); - List fieldValues = labelElementTemplateDOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList()); - // 删除索引 - DeleteByQueryRequest.Builder builder = new DeleteByQueryRequest.Builder() - .index(LABEL_TEMPLATE_ELEMENT_PROPERTY_INX) - .query(TermsQuery.of(e -> e.field("elementId").terms(b -> b.value(fieldValues)))._toQuery()); - try { - elasticsearchClient.deleteByQuery(builder.build()); - } catch (IOException e) { - log.error(e.getMessage()); - throw exception(INTERNAL_SERVER_ERROR); - } - // 删除标签模板表 labelTemplateMapper.deleteById(id); - // 删除标签元素模板表 - labelElementTemplateMapper.delete(new LambdaQueryWrapperX().eq(LabelElementTemplateDO::getLabelTemplateId, id)); - } private void validateLabelTemplateExists(Long id) { @@ -190,31 +66,7 @@ public class LabelTemplateServiceImpl implements LabelTemplateService { @Override public LabelTemplateRespVO getLabelTemplate(Long id) { LabelTemplateDO labelTemplateDO = labelTemplateMapper.selectById(id); - List labelElementTemplateDOS = labelElementTemplateMapper.selectListByLabelTemplateId(labelTemplateDO.getId()); LabelTemplateRespVO labelTemplateRespVO = BeanUtils.toBean(labelTemplateDO, LabelTemplateRespVO.class); - List labelElementTemplateRespVOS = BeanUtils.toBean(labelElementTemplateDOS, LabelElementTemplateRespVO.class); - List fieldValues = labelElementTemplateDOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList()); - SearchResponse searchSetting = null; - try { - SearchResponse search = elasticsearchClient.search(builder -> builder.index(LABEL_TEMPLATE_ELEMENT_PROPERTY_INX) - .query(TermsQuery.of(e -> e.field("elementId") - .terms(b -> b.value(fieldValues)))._toQuery()) - .from(0) - .size(10000), - LabelElementPropertyDO.class); - List> hits = search.hits().hits(); - if (CollectionUtil.isNotEmpty(hits)) { - List propertyDOS = hits.stream().map(e -> e.source()).collect(Collectors.toList()); - for (LabelElementTemplateRespVO respVO : labelElementTemplateRespVOS) { - respVO.setPropertyDO(propertyDOS.stream().filter(e -> Objects.equals(e.getElementId(), respVO.getId())).findAny().orElse(null)); - } - } - } catch (IOException e) { - log.error(e.getMessage()); - throw new ServiceException(INTERNAL_SERVER_ERROR); - } - - labelTemplateRespVO.setLabelElementTemplates(labelElementTemplateRespVOS); return labelTemplateRespVO; } @@ -223,79 +75,29 @@ public class LabelTemplateServiceImpl implements LabelTemplateService { return labelTemplateMapper.selectPage(pageReqVO); } - // ==================== 子表(标签元素模板) ==================== - - @Override - public List getLabelElementTemplateListByLabelTemplateId(Long labelTemplateId) { - List labelElementTemplateDOS = labelElementTemplateMapper.selectListByLabelTemplateId(labelTemplateId); - List respVOS = BeanUtils.toBean(labelElementTemplateDOS, LabelElementTemplateRespVO.class); - List fieldValues = labelElementTemplateDOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList()); - try { - SearchResponse response = elasticsearchClient.search(b -> b.index(LABEL_TEMPLATE_ELEMENT_PROPERTY_INX) - .from(0) - .size(10000) - .query(TermsQuery.of(e -> e.field("elementId").terms(t -> t.value(fieldValues)))._toQuery()), - LabelElementPropertyDO.class); - List> hits = response.hits().hits(); - if(CollectionUtil.isNotEmpty(hits)) { - List propertyDOS = hits.stream().map(e -> e.source()).collect(Collectors.toList()); - for (LabelElementTemplateRespVO respVO : respVOS) { - respVO.setPropertyDO(propertyDOS.stream().filter(e -> Objects.equals(e.getElementId(), respVO.getId())).findAny().orElse(null)); - } - } - } catch (IOException e) { - log.error(e.getMessage()); - throw exception(INTERNAL_SERVER_ERROR); - } - return respVOS; - } @Override public Map> getGroupList() { List labelTemplateDOS = labelTemplateMapper.selectList(); List labelTemplateRespVOS = BeanUtils.toBean(labelTemplateDOS, LabelTemplateRespVO.class); - Set ids = labelTemplateRespVOS.stream().map(e -> e.getId()).collect(Collectors.toSet()); - List labelElementTemplateDOS = labelElementTemplateMapper.selectList(new LambdaQueryWrapperX().in(LabelElementTemplateDO::getLabelTemplateId, ids)); - List labelElementTemplateRespVOS = BeanUtils.toBean(labelElementTemplateDOS, LabelElementTemplateRespVO.class); - List fieldValues = labelElementTemplateRespVOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList()); - try { - SearchResponse search = elasticsearchClient.search(builder -> builder.index(LABEL_TEMPLATE_ELEMENT_PROPERTY_INX) - .query(TermsQuery.of(e -> e.field("elementId") - .terms(b -> b.value(fieldValues)))._toQuery()) - .from(0) - .size(10000), - LabelElementPropertyDO.class); - List> hits = search.hits().hits(); - if (CollectionUtil.isNotEmpty(hits)) { - List propertyDOS = hits.stream().map(e -> e.source()).collect(Collectors.toList()); - for (LabelElementTemplateRespVO respVO : labelElementTemplateRespVOS) { - respVO.setPropertyDO(propertyDOS.stream().filter(e -> Objects.equals(e.getElementId(), respVO.getId())).findAny().orElse(null)); - } + return labelTemplateRespVOS.stream().collect(Collectors.groupingBy(LabelTemplateRespVO::getType)); + } + + @Override + public LabelTemplateRespVO getDefaultLabelTemplate(String type) { + List labelTemplateDOS = labelTemplateMapper.selectList(new LambdaQueryWrapperX() + .eq(LabelTemplateDO::getIsDefault, Boolean.TRUE) + .eq(LabelTemplateDO::getType, type) + ); + if(CollectionUtil.isNotEmpty(labelTemplateDOS)) { + if (labelTemplateDOS.size() > 1) { + throw exception(DEFAULT_TEMPLATE_COUNT); } - - } catch (IOException e) { - log.error(e.getMessage()); - throw new ServiceException(INTERNAL_SERVER_ERROR); + LabelTemplateDO labelTemplateDO = labelTemplateDOS.get(0); + LabelTemplateRespVO labelTemplateRespVO = BeanUtils.toBean(labelTemplateDO, LabelTemplateRespVO.class); + return labelTemplateRespVO; } - for (LabelTemplateRespVO labelTemplateRespVO : labelTemplateRespVOS) { - labelTemplateRespVO.setLabelElementTemplates(labelElementTemplateRespVOS.stream().filter(e -> Objects.equals(e.getLabelTemplateId(), labelTemplateRespVO.getId())).toList()); - } - return labelTemplateRespVOS.stream().collect(Collectors.groupingBy(e -> e.getType())); - } - - private void createLabelElementTemplateList(Long labelTemplateId, List list) { - list.forEach(o -> o.setLabelTemplateId(labelTemplateId)); - labelElementTemplateMapper.insertBatch(list); - } - - private void updateLabelElementTemplateList(Long labelTemplateId, List list) { - deleteLabelElementTemplateByLabelTemplateId(labelTemplateId); - list.forEach(o -> o.setId(null).setUpdater(null).setUpdateTime(null)); // 解决更新情况下:1)id 冲突;2)updateTime 不更新 - createLabelElementTemplateList(labelTemplateId, list); - } - - private void deleteLabelElementTemplateByLabelTemplateId(Long labelTemplateId) { - labelElementTemplateMapper.deleteByLabelTemplateId(labelTemplateId); + throw exception(DEFAULT_LABEL_NOT_EXISTS); } } \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/lable/LabelService.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/lable/LabelService.java index 6ce8f32c2..10e47ff13 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/lable/LabelService.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/lable/LabelService.java @@ -1,12 +1,10 @@ package com.cf.imes.module.system.service.lable; import com.cf.imes.framework.common.pojo.PageResult; -import com.cf.imes.module.system.controller.admin.label.vo.LabelElementRespVO; import com.cf.imes.module.system.controller.admin.label.vo.LabelPageReqVO; import com.cf.imes.module.system.controller.admin.label.vo.LabelRespVO; import com.cf.imes.module.system.controller.admin.label.vo.LabelSaveReqVO; import com.cf.imes.module.system.dal.dataobject.lable.LabelDO; -import com.cf.imes.module.system.dal.dataobject.lable.LabelElementDO; import javax.validation.Valid; import java.util.List; @@ -57,15 +55,6 @@ public interface LabelService { */ PageResult getLabelPage(LabelPageReqVO pageReqVO); - // ==================== 子表(标签元素模板) ==================== - - /** - * 获得标签元素模板列表 - * - * @param LabelId 标签模板id - * @return 标签元素模板列表 - */ - List getLabelElementListByLabelId(Long LabelId); Map> getGroupList(); diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/lable/LabelServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/lable/LabelServiceImpl.java index b7cc29423..e1410df03 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/lable/LabelServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/lable/LabelServiceImpl.java @@ -1,41 +1,24 @@ package com.cf.imes.module.system.service.lable; import cn.hutool.core.collection.CollectionUtil; -import cn.hutool.core.convert.Convert; -import cn.hutool.core.lang.TypeReference; -import co.elastic.clients.elasticsearch.ElasticsearchClient; -import co.elastic.clients.elasticsearch._types.FieldValue; -import co.elastic.clients.elasticsearch._types.query_dsl.TermsQuery; -import co.elastic.clients.elasticsearch.core.DeleteByQueryRequest; -import co.elastic.clients.elasticsearch.core.SearchResponse; -import co.elastic.clients.elasticsearch.core.search.Hit; -import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.common.util.object.BeanUtils; -import com.cf.imes.framework.es.core.service.ESDocumentService; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.module.system.controller.admin.label.vo.*; -import com.cf.imes.module.system.controller.admin.labeltemplate.vo.LabelElementTemplateSaveReqVO; -import com.cf.imes.module.system.dal.dataobject.labelelementproperty.LabelElementPropertyDO; -import com.cf.imes.module.system.dal.dataobject.labeltemplate.LabelElementTemplateDO; import com.cf.imes.module.system.dal.dataobject.lable.LabelDO; -import com.cf.imes.module.system.dal.dataobject.lable.LabelElementDO; -import com.cf.imes.module.system.dal.dataobject.machine.CuttingSettingDO; -import com.cf.imes.module.system.dal.mysql.label.LabelElementMapper; +import com.cf.imes.module.system.dal.dataobject.machine.MachineDO; import com.cf.imes.module.system.dal.mysql.label.LabelMapper; +import com.cf.imes.module.system.dal.mysql.machine.MachineMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; - import javax.annotation.Resource; -import java.io.IOException; import java.util.*; import java.util.stream.Collectors; - -import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR; import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.cf.imes.module.system.enums.ErrorCodeConstants.LABEL_NOT_EXISTS; +import static com.cf.imes.module.system.enums.ErrorCodeConstants.MACHINE_USE_LABEL; /** * 标签模板 Service 实现类 @@ -48,43 +31,17 @@ import static com.cf.imes.module.system.enums.ErrorCodeConstants.LABEL_NOT_EXIST public class LabelServiceImpl implements LabelService { @Resource - private LabelMapper LabelMapper; - @Resource - private LabelElementMapper labelElementMapper; - @Resource - private ESDocumentService esDocumentService; - @Resource - private ElasticsearchClient elasticsearchClient; + private LabelMapper labelMapper; - private static final String LABEL_ELEMENT_PROPERTY_INX = "label_element_property"; + @Resource + private MachineMapper machineMapper; @Override @Transactional(rollbackFor = Exception.class) public Long createLabel(LabelSaveReqVO createReqVO) { // 插入 LabelDO Label = BeanUtils.toBean(createReqVO, LabelDO.class); - LabelMapper.insert(Label); - - // 插入子表 - List createReqVOElements = createReqVO.getElements(); - if(CollectionUtil.isNotEmpty(createReqVOElements)) { - List labelElementPropertyDOS = new ArrayList<>(); - createReqVOElements.forEach(e -> { - e.setLabelId(Label.getId()); - LabelElementDO elementDO = Convert.convert(LabelElementDO.class, e); - labelElementMapper.insert(elementDO); - LabelElementPropertyDO propertyDO = e.getPropertyDO(); - propertyDO.setElementId(elementDO.getId()); - labelElementPropertyDOS.add(propertyDO); - }); - //插入索引 - try { - esDocumentService.bulkCreate(LABEL_ELEMENT_PROPERTY_INX, labelElementPropertyDOS); - } catch (Exception e) { - log.error(e.getMessage()); - throw exception(INTERNAL_SERVER_ERROR); - } - } + labelMapper.insert(Label); // 返回 return Label.getId(); } @@ -96,211 +53,60 @@ public class LabelServiceImpl implements LabelService { validateLabelExists(updateReqVO.getId()); // 更新 LabelDO updateObj = BeanUtils.toBean(updateReqVO, LabelDO.class); - LabelMapper.updateById(updateObj); - - List labelElementDOS = labelElementMapper.selectList(new LambdaQueryWrapperX() - .select(LabelElementDO::getId) - .eq(LabelElementDO::getLabelId, updateReqVO.getId())); - //删除旧的元素 - DeleteByQueryRequest.Builder builder = null; - if(CollectionUtil.isNotEmpty(labelElementDOS)) { - List templateIds = labelElementDOS.stream() - .map(LabelElementDO::getId) - .toList(); - labelElementMapper.deleteBatchIds(templateIds); - List fieldValues = templateIds.stream().map(FieldValue::of).collect(Collectors.toList()); - builder = new DeleteByQueryRequest.Builder() - .index(LABEL_ELEMENT_PROPERTY_INX) - .query(TermsQuery.of(e -> e.field("elementId").terms(b -> b.value(fieldValues)))._toQuery()); - } - - - //新增新的元素 - List createReqVOElements = updateReqVO.getElements(); - List labelElementPropertyDOS = new ArrayList<>(); - createReqVOElements.forEach(e -> { - e.setLabelId(updateObj.getId()); - LabelElementDO labelElementDO = Convert.convert(LabelElementDO.class, e); - labelElementMapper.insert(labelElementDO); - LabelElementPropertyDO propertyDO = e.getPropertyDO(); - propertyDO.setElementId(labelElementDO.getId()); - labelElementPropertyDOS.add(propertyDO); - }); - //插入索引 - try { - if(CollectionUtil.isNotEmpty(labelElementPropertyDOS)) { - esDocumentService.bulkCreate(LABEL_ELEMENT_PROPERTY_INX, labelElementPropertyDOS); - } - if(!Objects.isNull(builder)) { - elasticsearchClient.deleteByQuery(builder.build()); - } - } catch (Exception e) { - log.error(e.getMessage()); - throw exception(INTERNAL_SERVER_ERROR); - } - - /* List elements = updateReqVO.getElements(); - *//*updateLabelElementList(updateReqVO.getId(), Convert.convert(new TypeReference>() { - }, elements));*//* - labelElementMapper.updateBatch(Convert.convert(new TypeReference>() { - }, elements)); - List labelElementPropertyDOS = elements.stream().map(e -> e.getPropertyDO()).collect(Collectors.toList()); - try { - esDocumentService.bulkCreate(LABEL_ELEMENT_PROPERTY_INX, labelElementPropertyDOS); - } catch (Exception e) { - log.error(e.getMessage()); - throw exception(INTERNAL_SERVER_ERROR); - }*/ - + labelMapper.updateById(updateObj); } @Override @Transactional(rollbackFor = Exception.class) public void deleteLabel(Long id) { // 校验存在 - LabelDO LabelDO = LabelMapper.selectById(id); + LabelDO LabelDO = labelMapper.selectById(id); if (LabelDO == null) { throw exception(LABEL_NOT_EXISTS); } - List labelElementDOS = labelElementMapper.selectListByLabelId(id); - List fieldValues = labelElementDOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList()); - // 删除索引 - DeleteByQueryRequest.Builder builder = new DeleteByQueryRequest.Builder() - .index(LABEL_ELEMENT_PROPERTY_INX) - .query(TermsQuery.of(e -> e.field("elementId").terms(b -> b.value(fieldValues)))._toQuery()); - try { - elasticsearchClient.deleteByQuery(builder.build()); - } catch (IOException e) { - log.error(e.getMessage()); - throw exception(INTERNAL_SERVER_ERROR); + List machineDOS = machineMapper.selectList(new LambdaQueryWrapperX() + .select(MachineDO::getId) + .eq(MachineDO::getLabelId, id) + ); + if(CollectionUtil.isNotEmpty(machineDOS)) { + throw exception(MACHINE_USE_LABEL); } // 删除标签模板表 - LabelMapper.deleteById(id); - // 删除标签元素模板表 - labelElementMapper.delete(new LambdaQueryWrapperX().eq(LabelElementDO::getLabelId, id)); + labelMapper.deleteById(id); } private void validateLabelExists(Long id) { - if (LabelMapper.selectById(id) == null) { + if (labelMapper.selectById(id) == null) { throw exception(LABEL_NOT_EXISTS); } } @Override public LabelRespVO getLabel(Long id) { - LabelDO LabelDO = LabelMapper.selectById(id); - List labelElementDOS = labelElementMapper.selectListByLabelId(LabelDO.getId()); + LabelDO LabelDO = labelMapper.selectById(id); LabelRespVO LabelRespVO = BeanUtils.toBean(LabelDO, LabelRespVO.class); - List labelElementRespVOS = BeanUtils.toBean(labelElementDOS, LabelElementRespVO.class); - List fieldValues = labelElementDOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList()); - SearchResponse searchSetting = null; - try { - SearchResponse search = elasticsearchClient.search(builder -> builder.index(LABEL_ELEMENT_PROPERTY_INX) - .query(TermsQuery.of(e -> e.field("elementId") - .terms(b -> b.value(fieldValues)))._toQuery()) - .from(0) - .size(10000), - LabelElementPropertyDO.class); - List> hits = search.hits().hits(); - if (CollectionUtil.isNotEmpty(hits)) { - List propertyDOS = hits.stream().map(e -> e.source()).collect(Collectors.toList()); - for (LabelElementRespVO respVO : labelElementRespVOS) { - respVO.setPropertyDO(propertyDOS.stream().filter(e -> Objects.equals(e.getElementId(), respVO.getId())).findAny().orElse(null)); - } - } - } catch (IOException e) { - log.error(e.getMessage()); - throw new ServiceException(INTERNAL_SERVER_ERROR); - } - - LabelRespVO.setLabelElements(labelElementRespVOS); return LabelRespVO; } @Override public PageResult getLabelPage(LabelPageReqVO pageReqVO) { - return LabelMapper.selectPage(pageReqVO); + return labelMapper.selectPage(pageReqVO); } - // ==================== 子表(标签元素模板) ==================== - @Override - public List getLabelElementListByLabelId(Long LabelId) { - List labelElementDOS = labelElementMapper.selectListByLabelId(LabelId); - List respVOS = BeanUtils.toBean(labelElementDOS, LabelElementRespVO.class); - List fieldValues = labelElementDOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList()); - try { - SearchResponse response = elasticsearchClient.search(b -> b.index(LABEL_ELEMENT_PROPERTY_INX) - .from(0) - .size(10000) - .query(TermsQuery.of(e -> e.field("elementId").terms(t -> t.value(fieldValues)))._toQuery()), - LabelElementPropertyDO.class); - List> hits = response.hits().hits(); - if(CollectionUtil.isNotEmpty(hits)) { - List propertyDOS = hits.stream().map(e -> e.source()).collect(Collectors.toList()); - for (LabelElementRespVO respVO : respVOS) { - respVO.setPropertyDO(propertyDOS.stream().filter(e -> Objects.equals(e.getElementId(), respVO.getId())).findAny().orElse(null)); - } - } - } catch (IOException e) { - log.error(e.getMessage()); - throw exception(INTERNAL_SERVER_ERROR); - } - return respVOS; - } @Override public Map> getGroupList() { - List LabelDOS = LabelMapper.selectList(); + List LabelDOS = labelMapper.selectList(); List LabelRespVOS = BeanUtils.toBean(LabelDOS, LabelRespVO.class); - Set ids = LabelRespVOS.stream().map(e -> e.getId()).collect(Collectors.toSet()); - List labelElementDOS = labelElementMapper.selectList(new LambdaQueryWrapperX().in(LabelElementDO::getLabelId, ids)); - List labelElementRespVOS = BeanUtils.toBean(labelElementDOS, LabelElementRespVO.class); - List fieldValues = labelElementRespVOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList()); - try { - SearchResponse search = elasticsearchClient.search(builder -> builder.index(LABEL_ELEMENT_PROPERTY_INX) - .query(TermsQuery.of(e -> e.field("elementId") - .terms(b -> b.value(fieldValues)))._toQuery()) - .from(0) - .size(10000), - LabelElementPropertyDO.class); - List> hits = search.hits().hits(); - if (CollectionUtil.isNotEmpty(hits)) { - List propertyDOS = hits.stream().map(e -> e.source()).collect(Collectors.toList()); - for (LabelElementRespVO respVO : labelElementRespVOS) { - respVO.setPropertyDO(propertyDOS.stream().filter(e -> Objects.equals(e.getElementId(), respVO.getId())).findAny().orElse(null)); - } - } - - } catch (IOException e) { - log.error(e.getMessage()); - throw new ServiceException(INTERNAL_SERVER_ERROR); - } - for (LabelRespVO LabelRespVO : LabelRespVOS) { - LabelRespVO.setLabelElements(labelElementRespVOS.stream().filter(e -> Objects.equals(e.getLabelId(), LabelRespVO.getId())).toList()); - } - return LabelRespVOS.stream().collect(Collectors.groupingBy(e -> e.getType())); + return LabelRespVOS.stream().collect(Collectors.groupingBy(LabelRespVO::getType)); } @Override public List list(String type) { - return LabelMapper.selectList(new LambdaQueryWrapperX().eqIfPresent(LabelDO::getType, type)); + return labelMapper.selectList(new LambdaQueryWrapperX().eqIfPresent(LabelDO::getType, type)); } - private void createLabelElementList(Long LabelId, List list) { - list.forEach(o -> o.setLabelId(LabelId)); - labelElementMapper.insertBatch(list); - } - - private void updateLabelElementList(Long LabelId, List list) { - deleteLabelElementByLabelId(LabelId); - list.forEach(o -> o.setId(null).setUpdater(null).setUpdateTime(null)); // 解决更新情况下:1)id 冲突;2)updateTime 不更新 - createLabelElementList(LabelId, list); - } - - private void deleteLabelElementByLabelId(Long LabelId) { - labelElementMapper.deleteByLabelId(LabelId); - } } \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/machine/MachineServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/machine/MachineServiceImpl.java index fedb1a053..3d24fe765 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/machine/MachineServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/machine/MachineServiceImpl.java @@ -12,7 +12,9 @@ import co.elastic.clients.elasticsearch.core.SearchResponse; import co.elastic.clients.elasticsearch.core.search.Hit; import com.cf.imes.framework.es.core.dal.ESDocument; import com.cf.imes.framework.es.core.service.ESDocumentService; +import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.module.system.controller.admin.machine.vo.*; +import com.cf.imes.module.system.convert.machine.MachineConvert; import com.cf.imes.module.system.dal.dataobject.machine.DrillSettingDO; import com.cf.imes.module.system.dal.dataobject.machine.MachineDO; import com.cf.imes.module.system.dal.dataobject.machine.CuttingSettingDO; @@ -59,16 +61,8 @@ public class MachineServiceImpl implements MachineService { @Transactional(rollbackFor = Exception.class) public Long createCutting(CuttingSaveReqVO createReqVO) { // 插入 - MachineDO machineDO = Convert.convert(MachineDO.class, createReqVO); + MachineDO machineDO = MachineConvert.convert(createReqVO); machineMapper.insert(machineDO); - CuttingSettingDO machineSettingDO = createReqVO.getMachineSettingDO(); - machineSettingDO.setMachineId(machineDO.getId()); - try { - esDocumentService.createByFluentDSL(CUTTING_MACHINE_SETTING, machineSettingDO.getId(), machineSettingDO); - } catch (Exception e) { - log.error(e.getMessage()); - throw exception(INTERNAL_SERVER_ERROR); - } // 返回 return machineDO.getId(); } @@ -77,15 +71,9 @@ public class MachineServiceImpl implements MachineService { public void updateCutting(CuttingSaveReqVO updateReqVO){ // 校验存在 validateExists(updateReqVO.getId()); - updateReqVO.getMachineSettingDO().setMachineId(updateReqVO.getId()); - try { - esDocumentService.createByFluentDSL(CUTTING_MACHINE_SETTING, updateReqVO.getMachineSettingDO().getId(), updateReqVO.getMachineSettingDO()); - } catch (Exception e) { - log.error(e.getMessage()); - throw exception(INTERNAL_SERVER_ERROR); - } // 更新 - MachineDO updateObj = BeanUtils.toBean(updateReqVO, MachineDO.class); + MachineDO updateObj = MachineConvert.convert(updateReqVO); + //MachineDO updateObj = BeanUtils.toBean(updateReqVO, MachineDO.class); machineMapper.updateById(updateObj); } @@ -96,16 +84,6 @@ public class MachineServiceImpl implements MachineService { if (machineMapper.selectById(id) == null) { throw exception(MACHINE_NOT_EXISTS); } - // 删除 - DeleteByQueryRequest.Builder builder = new DeleteByQueryRequest.Builder() - .index(CUTTING_MACHINE_SETTING) - .query(b->b.term(t->t.field("machineId").value(machineDO.getId()))); - try { - elasticsearchClient.deleteByQuery(builder.build()); - } catch (IOException e) { - log.error(e.getMessage()); - throw exception(INTERNAL_SERVER_ERROR); - } machineMapper.deleteById(id); } @@ -115,16 +93,6 @@ public class MachineServiceImpl implements MachineService { if(CollectionUtil.isEmpty(machineDOS)){ throw exception(MACHINE_NOT_EXISTS); } - List fieldValues = machineDOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList()); - DeleteByQueryRequest.Builder builder = new DeleteByQueryRequest.Builder() - .index(CUTTING_MACHINE_SETTING) - .query(TermsQuery.of(e-> e.field("machineId").terms(b->b.value(fieldValues)))._toQuery()); - try { - elasticsearchClient.deleteByQuery(builder.build()); - } catch (IOException e) { - log.error(e.getMessage()); - throw exception(INTERNAL_SERVER_ERROR); - } machineMapper.deleteBatchIds(ids); } @@ -134,9 +102,7 @@ public class MachineServiceImpl implements MachineService { if(Objects.isNull(machineDO)) { throw exception(MACHINE_NOT_EXISTS); } - CuttingRespVO respVO = Convert.convert(CuttingRespVO.class, machineDO); - Object o1 = buildResp(machineDO.getId(), CUTTING_MACHINE_SETTING, CuttingSettingDO.class); - respVO.setMachineSettingDO((CuttingSettingDO) o1); + CuttingRespVO respVO = MachineConvert.convert(machineDO); return respVO; } @@ -231,7 +197,9 @@ public class MachineServiceImpl implements MachineService { @Override public Map> getMachineTree() { - List machineDOS = machineMapper.selectList(); + List machineDOS = machineMapper.selectList(new LambdaQueryWrapperX() + .select(MachineDO::getName, MachineDO::getMachineType, MachineDO::getId, MachineDO::getLabelId, MachineDO::getCreateTime) + ); List machineVOS = BeanUtils.toBean(machineDOS, MachineVO.class); Map> map = machineVOS.stream().collect(Collectors.groupingBy(MachineVO::getMachineType)); return map; diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/machine/MachineTemplateService.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/machine/MachineTemplateService.java index e3276d6c2..7a7f71c22 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/machine/MachineTemplateService.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/machine/MachineTemplateService.java @@ -39,9 +39,17 @@ public interface MachineTemplateService { Boolean batchDeleteCuttingTemplate(List ids); - CuttingTemplateRespVO getDefaultCutting(); + CuttingRespVO getDefaultCutting(Integer machineType); DrillTemplateRespVO getDefaultDrill(); Map> getMachineTemplateTree(); + + PageResult authTemplatePage(AuthTemplatePage page); + + Boolean auth(MachineOrgAuthReq vo); + + PageResult organTemplatePage(OrganTemplatePage page); + + OrganTemplateResp organTemplateByOrganId(Long organId); } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/machine/MachineTemplateServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/machine/MachineTemplateServiceImpl.java index 667efd6db..8528e42f6 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/machine/MachineTemplateServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/machine/MachineTemplateServiceImpl.java @@ -10,6 +10,9 @@ import co.elastic.clients.elasticsearch.core.DeleteByQueryRequest; import co.elastic.clients.elasticsearch.core.SearchRequest; import co.elastic.clients.elasticsearch.core.SearchResponse; import co.elastic.clients.elasticsearch.core.search.Hit; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO; import com.cf.imes.framework.common.exception.ServiceException; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.es.core.dal.ESDocument; @@ -18,26 +21,33 @@ import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.framework.security.core.LoginUser; import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils; import com.cf.imes.module.system.controller.admin.machine.vo.*; +import com.cf.imes.module.system.convert.machine.MachineConvert; +import com.cf.imes.module.system.convert.machine.MachineTemplateConvert; import com.cf.imes.module.system.dal.dataobject.machine.CuttingSettingDO; +import com.cf.imes.module.system.dal.dataobject.machine.MachineDO; import com.cf.imes.module.system.dal.dataobject.machine.UserMachineDO; import com.cf.imes.module.system.dal.dataobject.machinetemplate.CuttingTemplateMachineDO; import com.cf.imes.module.system.dal.dataobject.machinetemplate.DrillTemplateMachineDO; import com.cf.imes.module.system.dal.dataobject.machinetemplate.MachineTemplateDO; +import com.cf.imes.module.system.dal.dataobject.machinetemplate.OrganMachineDO; +import com.cf.imes.module.system.dal.dataobject.user.AdminUserDO; import com.cf.imes.module.system.dal.mysql.machine.UserMachineMapper; import com.cf.imes.module.system.dal.mysql.machinetemplate.MachineTemplateMapper; +import com.cf.imes.module.system.dal.mysql.machinetemplate.OrganMachineMapper; +import com.github.yulichang.wrapper.MPJLambdaWrapper; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.io.IOException; +import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR; import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception; -import static com.cf.imes.module.system.enums.ErrorCodeConstants.DEFAULT_TEMPLATE_COUNT; -import static com.cf.imes.module.system.enums.ErrorCodeConstants.MACHINE_TEMPLATE_NOT_EXISTS; +import static com.cf.imes.module.system.enums.ErrorCodeConstants.*; /** * @author there @@ -63,6 +73,9 @@ public class MachineTemplateServiceImpl implements MachineTemplateService { @Resource private MachineTemplateMapper machineTemplateMapper; + @Resource + private OrganMachineMapper organMachineMapper; + @Override @Transactional(rollbackFor = Exception.class) public Long createDrillTemplate(DrillTemplateSaveReqVO reqVO) { @@ -98,7 +111,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService { @Override public DrillTemplateRespVO getDirllTemplateById(Long id) { MachineTemplateDO templateDO = machineTemplateMapper.selectById(id); - if(Objects.isNull(templateDO)) { + if (Objects.isNull(templateDO)) { throw exception(MACHINE_TEMPLATE_NOT_EXISTS); } DrillTemplateRespVO respVO = Convert.convert(DrillTemplateRespVO.class, templateDO); @@ -110,13 +123,13 @@ public class MachineTemplateServiceImpl implements MachineTemplateService { @Override public Boolean deleteDrillTemplate(Long id) { MachineTemplateDO templateDO = machineTemplateMapper.selectById(id); - if(Objects.isNull(templateDO)) { + if (Objects.isNull(templateDO)) { throw exception(MACHINE_TEMPLATE_NOT_EXISTS); } // 删除 DeleteByQueryRequest.Builder builder = new DeleteByQueryRequest.Builder() .index(DRILL_MACHINE_INX) - .query(b->b.term(t->t.field("templateId").value(templateDO.getId()))); + .query(b -> b.term(t -> t.field("templateId").value(templateDO.getId()))); try { elasticsearchClient.deleteByQuery(builder.build()); } catch (IOException e) { @@ -130,14 +143,14 @@ public class MachineTemplateServiceImpl implements MachineTemplateService { @Override public Boolean batchDeleteDrillTemplate(List ids) { List machineTemplateDOS = machineTemplateMapper.selectBatchIds(ids); - if(CollectionUtil.isEmpty(machineTemplateDOS)) { + if (CollectionUtil.isEmpty(machineTemplateDOS)) { throw exception(MACHINE_TEMPLATE_NOT_EXISTS); } List fieldValues = machineTemplateDOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList()); DeleteByQueryRequest.Builder builder = new DeleteByQueryRequest.Builder() .index(DRILL_MACHINE_INX) - .query(TermsQuery.of(e-> e.field("templateId").terms(b->b.value(fieldValues)))._toQuery()); + .query(TermsQuery.of(e -> e.field("templateId").terms(b -> b.value(fieldValues)))._toQuery()); try { elasticsearchClient.deleteByQuery(builder.build()); } catch (IOException e) { @@ -151,84 +164,52 @@ public class MachineTemplateServiceImpl implements MachineTemplateService { @Override @Transactional(rollbackFor = Exception.class) public Long createCuttingTemplate(CuttingTemplateSaveReqVO reqVO) { - MachineTemplateDO templateDO = Convert.convert(MachineTemplateDO.class, reqVO); + MachineTemplateDO templateDO = MachineTemplateConvert.convert(reqVO); machineTemplateMapper.insert(templateDO); - CuttingTemplateMachineDO setting = reqVO.getSetting(); - setting.setTemplateId(templateDO.getId()); - try { - esDocumentService.createByFluentDSL(CUTTING_MACHINE_INX, setting.getId(), setting); - } catch (Exception e) { - log.error(e.getMessage()); - throw new ServiceException(INTERNAL_SERVER_ERROR); - } return templateDO.getId(); } @Override public Boolean updateCuttingTemplate(CuttingTemplateSaveReqVO reqVO) { - MachineTemplateDO templateDO = Convert.convert(MachineTemplateDO.class, reqVO); + MachineTemplateDO templateDO = MachineTemplateConvert.convert(reqVO); machineTemplateMapper.updateById(templateDO); - CuttingTemplateMachineDO setting = reqVO.getSetting(); - Map map = BeanUtil.beanToMap(setting); - try { - esDocumentService.updateById(CUTTING_MACHINE_INX, setting.getId(), CuttingTemplateMachineDO.class, map); - } catch (IOException e) { - log.error(e.getMessage()); - throw new ServiceException(INTERNAL_SERVER_ERROR); - } return Boolean.TRUE; } @Override public CuttingTemplateRespVO getCuttingTemplateById(String id) { MachineTemplateDO templateDO = machineTemplateMapper.selectById(id); - if(Objects.isNull(templateDO)) { + if (Objects.isNull(templateDO)) { throw exception(MACHINE_TEMPLATE_NOT_EXISTS); } - CuttingTemplateRespVO respVO = Convert.convert(CuttingTemplateRespVO.class, templateDO); - Object o = buildResp(templateDO.getId(), CUTTING_MACHINE_INX, CuttingTemplateMachineDO.class); - respVO.setCuttingTemplateMachineDO((CuttingTemplateMachineDO) o); + CuttingTemplateRespVO respVO = MachineTemplateConvert.convert1(templateDO); return respVO; } @Override public Boolean batchDeleteCuttingTemplate(List ids) { List machineTemplateDOS = machineTemplateMapper.selectBatchIds(ids); - if(CollectionUtil.isEmpty(machineTemplateDOS)) { + if (CollectionUtil.isEmpty(machineTemplateDOS)) { throw exception(MACHINE_TEMPLATE_NOT_EXISTS); } - - List fieldValues = machineTemplateDOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList()); - DeleteByQueryRequest.Builder builder = new DeleteByQueryRequest.Builder() - .index(CUTTING_MACHINE_INX) - .query(TermsQuery.of(e-> e.field("templateId").terms(b->b.value(fieldValues)))._toQuery()); - try { - elasticsearchClient.deleteByQuery(builder.build()); - } catch (IOException e) { - log.error(e.getMessage()); - throw new ServiceException(INTERNAL_SERVER_ERROR); - } machineTemplateMapper.deleteBatchIds(ids); return Boolean.TRUE; } @Override - public CuttingTemplateRespVO getDefaultCutting() { + public CuttingRespVO getDefaultCutting(Integer machineType) { List machineTemplateDOS = machineTemplateMapper.selectList(new LambdaQueryWrapperX() .eq(MachineTemplateDO::getIsDefault, Boolean.TRUE) - .eq(MachineTemplateDO::getMachineType, 1) + .eq(MachineTemplateDO::getMachineType, machineType) ); - if(CollectionUtil.isNotEmpty(machineTemplateDOS)) { - if(machineTemplateDOS.size() > 1) { - throw exception(DEFAULT_TEMPLATE_COUNT); - } - MachineTemplateDO templateDO = machineTemplateDOS.get(0); - CuttingTemplateRespVO respVO = Convert.convert(CuttingTemplateRespVO.class, templateDO); - Object o = buildResp(templateDO.getId(), CUTTING_MACHINE_INX, CuttingTemplateMachineDO.class); - respVO.setCuttingTemplateMachineDO((CuttingTemplateMachineDO) o); - return respVO; - } - throw exception(DEFAULT_TEMPLATE_COUNT); + if (CollectionUtil.isNotEmpty(machineTemplateDOS)) { + if (machineTemplateDOS.size() > 1) { + throw exception(DEFAULT_TEMPLATE_COUNT); + } + MachineTemplateDO templateDO = machineTemplateDOS.get(0); + return MachineTemplateConvert.convert(templateDO); + } + throw exception(DEFAULT_TEMPLATE_NOT_EXISTS); } @Override @@ -237,8 +218,8 @@ public class MachineTemplateServiceImpl implements MachineTemplateService { .eq(MachineTemplateDO::getIsDefault, Boolean.TRUE) .eq(MachineTemplateDO::getMachineType, 2) ); - if(CollectionUtil.isNotEmpty(machineTemplateDOS)) { - if(machineTemplateDOS.size() > 1) { + if (CollectionUtil.isNotEmpty(machineTemplateDOS)) { + if (machineTemplateDOS.size() > 1) { throw exception(DEFAULT_TEMPLATE_COUNT); } MachineTemplateDO templateDO = machineTemplateDOS.get(0); @@ -257,35 +238,45 @@ public class MachineTemplateServiceImpl implements MachineTemplateService { return map; } + @Override + public PageResult authTemplatePage(AuthTemplatePage page) { + Page respPage = new Page<>(page.getPageNo(), page.getPageSize()); + Page pageRes = machineTemplateMapper.selectAuthTemplatePage(respPage, page); + return new PageResult<>(pageRes.getRecords(), pageRes.getTotal()); + } + + @Override + public PageResult organTemplatePage(OrganTemplatePage page) { + Page respPage = new Page<>(page.getPageNo(), page.getPageSize()); + Page pageRes = machineTemplateMapper.selectOrganTemplatePage(respPage, page); + return new PageResult<>(pageRes.getRecords(), pageRes.getTotal()); + } + + @Override + public OrganTemplateResp organTemplateByOrganId(Long organId) { + return machineTemplateMapper.selectOrganTemplate(organId); + } + + @Override public Boolean deleteCuttingTemplate(Long id) { MachineTemplateDO templateDO = machineTemplateMapper.selectById(id); - if(Objects.isNull(templateDO)) { + if (Objects.isNull(templateDO)) { throw exception(MACHINE_TEMPLATE_NOT_EXISTS); } - // 删除 - DeleteByQueryRequest.Builder builder = new DeleteByQueryRequest.Builder() - .index(CUTTING_MACHINE_INX) - .query(b->b.term(t->t.field("templateId").value(templateDO.getId()))); - try { - elasticsearchClient.deleteByQuery(builder.build()); - } catch (IOException e) { - log.error(e.getMessage()); - throw new ServiceException(INTERNAL_SERVER_ERROR); - } machineTemplateMapper.deleteById(id); return Boolean.TRUE; } - private Object buildResp(Long machineTemplateId, String index, Class clazz) { + private Object buildResp(Long machineTemplateId, String index, Class clazz) { SearchRequest.Builder builder = new SearchRequest.Builder(); builder.index(index); - builder.query(q-> q.term(TermQuery.of(e->e.field("templateId").value( machineTemplateId)))); + builder.query(q -> q.term(TermQuery.of(e -> e.field("templateId").value(machineTemplateId)))); SearchResponse searchSetting = null; try { SearchResponse search = elasticsearchClient.search(builder.build(), clazz); List> hits = search.hits().hits(); - if(CollectionUtil.isNotEmpty(hits)) { + if (CollectionUtil.isNotEmpty(hits)) { Hit hit = hits.get(0); return hit.source(); } @@ -301,17 +292,49 @@ public class MachineTemplateServiceImpl implements MachineTemplateService { @Transactional(rollbackFor = Exception.class) public Boolean auth(MachineAuthVO vo) { userMachineMapper.delete(new LambdaQueryWrapperX().eq(UserMachineDO::getUserId, vo.getUserId())); - ArrayList userMachineDOS = new ArrayList<>(); - for (Long machinesId : vo.getMachinesIds()) { - userMachineDOS.add(UserMachineDO.builder() - .userId(vo.getUserId()) - .machineId(machinesId) - .build()); + if (CollectionUtil.isNotEmpty(vo.getMachinesIds())) { + ArrayList userMachineDOS = new ArrayList<>(); + for (Long machinesId : vo.getMachinesIds()) { + userMachineDOS.add(UserMachineDO.builder() + .userId(vo.getUserId()) + .machineId(machinesId) + .build()); + } + userMachineMapper.insertBatch(userMachineDOS); } - userMachineMapper.insertBatch(userMachineDOS); return Boolean.TRUE; } + @Override + @Transactional(rollbackFor = Exception.class) + public Boolean auth(MachineOrgAuthReq vo) { + organMachineMapper.delete(new LambdaQueryWrapperX().eq(OrganMachineDO::getOrganId, vo.getOrganId())); + + List machineAuthList = vo.getMachineAuthList(); + + if(CollectionUtil.isNotEmpty(machineAuthList)) { + List organMachineDOS = new ArrayList<>(); + LocalDateTime now = LocalDateTime.now(); + for (MachineAuth machineAuth : machineAuthList) { + organMachineDOS.add( + OrganMachineDO.builder() + .createTime(now) + .organId(vo.getOrganId()) + .machineId(machineAuth.getMachineId()) + .showDualWorkstation(machineAuth.getShowDualWorkstation()) + .showAutoNotePrinter(machineAuth.getShowAutoNotePrinter()) + .showPriorFacing(machineAuth.getShowPriorFacing()) + .build() + ); + + } + organMachineMapper.insertBatch(organMachineDOS); + } + + return Boolean.TRUE; + } + + /* @Override public PageResult pageCutting(PageParam pageParam) { LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); @@ -346,16 +369,16 @@ public class MachineTemplateServiceImpl implements MachineTemplateService { }*/ @Override - public PageResult page(MachinePageReqVO pageParam) { - LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + public PageResult page(MachinePageReqVO pageParam) { + /* LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); List machineIds = userMachineMapper.selectList(new LambdaQueryWrapperX().eq(UserMachineDO::getUserId, loginUser.getId())) .stream() .map(e -> e.getMachineId()) .collect(Collectors.toList()); if(CollectionUtil.isEmpty(machineIds)) { return new PageResult<>(); - } - return machineTemplateMapper.selectPage(pageParam, machineIds); + }*/ + return machineTemplateMapper.selectPage(pageParam, new ArrayList<>()); } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/organ/OrganService.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/organ/OrganService.java index bfd3080e9..5d4190d55 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/organ/OrganService.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/organ/OrganService.java @@ -4,6 +4,8 @@ import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.organ.core.context.OrganContextHolder; import com.cf.imes.module.system.controller.admin.organ.vo.organ.OrganPageReqVO; import com.cf.imes.module.system.controller.admin.organ.vo.organ.OrganSaveReqVO; +import com.cf.imes.module.system.controller.admin.organ.vo.organ.OrganSimpleRespVO; +import com.cf.imes.module.system.controller.admin.user.vo.user.UserSimpleRespVO; import com.cf.imes.module.system.dal.dataobject.organ.OrganizationDO; import com.cf.imes.module.system.service.organ.handler.OrganInfoHandler; import com.cf.imes.module.system.service.organ.handler.OrganMenuHandler; @@ -127,4 +129,5 @@ public interface OrganService { */ void validOrgan(Long id); + List getSimpleOrganList(String name); } diff --git a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/organ/OrganServiceImpl.java b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/organ/OrganServiceImpl.java index b81752091..292889911 100644 --- a/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/organ/OrganServiceImpl.java +++ b/cf-module-system/cf-module-system-biz/src/main/java/com/cf/imes/module/system/service/organ/OrganServiceImpl.java @@ -10,13 +10,16 @@ import com.cf.imes.framework.common.util.collection.CollectionUtils; import com.cf.imes.framework.common.util.date.DateUtils; import com.cf.imes.framework.common.util.object.BeanUtils; import com.cf.imes.framework.common.util.pinyin.PinYinUtils; +import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; import com.cf.imes.framework.organ.config.OrganProperties; import com.cf.imes.framework.organ.core.context.OrganContextHolder; import com.cf.imes.framework.organ.core.util.OrganUtils; +import com.cf.imes.module.system.controller.admin.organ.vo.organ.OrganSimpleRespVO; import com.cf.imes.module.system.controller.admin.permission.vo.role.RoleSaveReqVO; import com.cf.imes.module.system.controller.admin.organ.vo.organ.OrganPageReqVO; import com.cf.imes.module.system.controller.admin.organ.vo.organ.OrganSaveReqVO; import com.cf.imes.module.system.controller.admin.user.vo.user.UserSaveReqVO; +import com.cf.imes.module.system.controller.admin.user.vo.user.UserSimpleRespVO; import com.cf.imes.module.system.convert.organ.OrganConvert; import com.cf.imes.module.system.dal.dataobject.permission.MenuDO; import com.cf.imes.module.system.dal.dataobject.permission.RoleDO; @@ -96,6 +99,14 @@ public class OrganServiceImpl implements OrganService { } } + @Override + public List getSimpleOrganList(String name) { + List organizationDOS = organMapper.selectList(new LambdaQueryWrapperX() + .likeIfPresent(OrganizationDO::getName, name) + .select(OrganizationDO::getId, OrganizationDO::getName)); + return BeanUtils.toBean(organizationDOS, OrganSimpleRespVO.class); + } + @Override @DSTransactional // 多数据源,使用 @DSTransactional 保证本地事务,以及数据源的切换 public Long createOrgan(OrganSaveReqVO createReqVO) { diff --git a/cf-module-system/cf-module-system-biz/src/main/resources/mapper/process/DataSourceMapper.xml b/cf-module-system/cf-module-system-biz/src/main/resources/mapper/process/DataSourceMapper.xml new file mode 100644 index 000000000..cb81e1ca9 --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/resources/mapper/process/DataSourceMapper.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cf-module-system/cf-module-system-biz/src/main/resources/mapper/process/MachineTemplateMapper.xml b/cf-module-system/cf-module-system-biz/src/main/resources/mapper/process/MachineTemplateMapper.xml new file mode 100644 index 000000000..40ef4e568 --- /dev/null +++ b/cf-module-system/cf-module-system-biz/src/main/resources/mapper/process/MachineTemplateMapper.xml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file