mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
生产单新增逻辑
This commit is contained in:
+23
@@ -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<String> getSqlById(@RequestParam(value = "id") Long id);
|
||||
}
|
||||
+3
@@ -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, "系统数据源不存在");
|
||||
|
||||
+29
@@ -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<String> getSqlById(Long id) {
|
||||
DataSourceDO dataSourceDO = dataSourceMapper.selectById(id);
|
||||
if(Objects.isNull(dataSourceDO)) {
|
||||
throw exception(new ErrorCode(2133,"数据源不存在"));
|
||||
}
|
||||
return CommonResult.success(dataSourceDO.getSqlStr()) ;
|
||||
}
|
||||
}
|
||||
+7
-6
@@ -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<Long> createDataSource(@Valid @RequestBody DataSourceSaveReqVO createReqVO) {
|
||||
@@ -78,15 +78,16 @@ public class DataSourceController {
|
||||
public CommonResult<PageResult<DataSourceRespVO>> getDataSourcePage(@Valid DataSourcePageReqVO pageReqVO) {
|
||||
PageResult<DataSourceDO> 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<DataSourceRespVO>> list( @RequestParam(value = "type", required = false) Integer type) {
|
||||
List<DataSourceDO> list = dataSourceService.list(type);
|
||||
return success(BeanUtils.toBean(list, DataSourceRespVO.class));
|
||||
public CommonResult<List<DataSourceRespVO>> list( ) {
|
||||
return success(dataSourceService.list());
|
||||
|
||||
/*List<DataSourceDO> list =
|
||||
return success(BeanUtils.toBean(list, DataSourceRespVO.class));*/
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
|
||||
+1
-1
@@ -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;
|
||||
|
||||
+5
-1
@@ -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<DataSourceFiledDO> filedList;
|
||||
|
||||
}
|
||||
+7
-13
@@ -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<Long> 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<Boolean> 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<LabelRespVO> 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<PageResult<LabelRespVO>> getLabelPage(@Valid LabelPageReqVO pageReqVO) {
|
||||
PageResult<LabelDO> 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<List<LabelRespVO>> getLabel(@RequestParam("type") String type) {
|
||||
@OperateLog(enable = false)
|
||||
public CommonResult<List<LabelRespVO>> 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<Map<String, List<LabelRespVO>>> 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<List<LabelElementRespVO>> getLabelElementListByLabelId(@RequestParam("labelId") Long labelId) {
|
||||
return success(labelService.getLabelElementListByLabelId(labelId));
|
||||
}
|
||||
|
||||
}
|
||||
+10
-1
@@ -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;
|
||||
}
|
||||
|
||||
+4
-1
@@ -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;
|
||||
}
|
||||
|
||||
+5
-2
@@ -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<LabelElementRespVO> labelElements;
|
||||
/*@Schema(description = "标签元素模板列表")
|
||||
private List<LabelElementRespVO> labelElements;*/
|
||||
|
||||
@Schema(description = "配置")
|
||||
private String template;
|
||||
|
||||
}
|
||||
+6
-2
@@ -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<LabelElementSaveReqVO> elements;
|
||||
/*@Schema(description = "标签元素模板列表")
|
||||
private List<LabelElementSaveReqVO> elements;*/
|
||||
|
||||
@Schema(description = "配置")
|
||||
private String template;
|
||||
|
||||
}
|
||||
+14
-15
@@ -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<Long> 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<Boolean> 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<LabelTemplateRespVO> 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<PageResult<LabelTemplateRespVO>> getLabelTemplatePage(@Valid LabelTemplatePageReqVO pageReqVO) {
|
||||
PageResult<LabelTemplateDO> 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<Map<String, List<LabelTemplateRespVO>>> 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<LabelTemplateRespVO> 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<List<LabelElementTemplateRespVO>> getLabelElementTemplateListByLabelTemplateId(@RequestParam("labelTemplateId") Long labelTemplateId) {
|
||||
return success(labelTemplateService.getLabelElementTemplateListByLabelTemplateId(labelTemplateId));
|
||||
}
|
||||
|
||||
}
|
||||
+14
-1
@@ -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<String,Object> propertyDO;*/
|
||||
@Schema(description = "标签元素属性")
|
||||
private LabelElementPropertyDO propertyDO;
|
||||
private JSONObject propertyDO;
|
||||
}
|
||||
|
||||
+9
-1
@@ -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<String, Object> propertyDO;*/
|
||||
@Schema(description = "标签元素属性")
|
||||
private LabelElementPropertyDO propertyDO;
|
||||
private JSONObject propertyDO;
|
||||
}
|
||||
|
||||
+5
-6
@@ -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<LabelElementTemplateRespVO> labelElementTemplates;
|
||||
/*@Schema(description = "标签元素模板列表")
|
||||
private List<LabelElementTemplateRespVO> labelElementTemplates;*/
|
||||
@Schema(description = "配置")
|
||||
private String template;
|
||||
|
||||
}
|
||||
+4
-4
@@ -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<LabelElementTemplateSaveReqVO> elements;
|
||||
/*@Schema(description = "标签元素模板列表")
|
||||
private List<LabelElementTemplateSaveReqVO> elements;*/
|
||||
@Schema(description = "配置")
|
||||
private String template;
|
||||
|
||||
}
|
||||
+69
@@ -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<Boolean> auth(@RequestBody MachineOrgAuthReq vo) {
|
||||
return success(machineTemplateService.auth(vo));
|
||||
}
|
||||
|
||||
@GetMapping("organ-template-page")
|
||||
@Operation(summary = "组织模板授权分页列表")
|
||||
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
||||
public CommonResult<PageResult<OrganTemplateResp>> 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<OrganTemplateResp> organTemplateByOrganId(@RequestParam Long organId ) {
|
||||
return success(machineTemplateService.organTemplateByOrganId(organId));
|
||||
}
|
||||
|
||||
@GetMapping("page-template-machine-auth")
|
||||
@Operation(summary = "授权机台模板分页")
|
||||
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
||||
public CommonResult<PageResult<TemplateAutoResp>> pageTemplateAuth(MachinePageReqVO pageParam) {
|
||||
PageResult<MachineTemplateDO> page = machineTemplateService.page(pageParam);
|
||||
List<TemplateAutoResp> 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<TemplateAutoResp>(list, page.getTotal()));
|
||||
}
|
||||
}
|
||||
+14
-51
@@ -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<Long> 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<Boolean> 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<Boolean> 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<Boolean> batchDeleteCutting(@RequestParam("ids") List<Long> 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<CuttingRespVO> 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<CuttingTemplateRespVO> getDefaultCutting() {
|
||||
return success(machineTemplateService.getDefaultCutting());
|
||||
public CommonResult<CuttingRespVO> getDefaultCutting(@RequestParam Integer machineType) {
|
||||
return success(machineTemplateService.getDefaultCutting(machineType));
|
||||
}
|
||||
|
||||
@GetMapping("getDefaultDrill")
|
||||
/* @GetMapping("getDefaultDrill")
|
||||
@Operation(summary = "获得默认钻孔机台模板")
|
||||
@PreAuthorize("@ss.hasPermission('machine::query')")
|
||||
public CommonResult<DrillTemplateRespVO> 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<Long> createDrill(@Valid @RequestBody DrillSaveReqVO createReqVO) {
|
||||
return success(machineService.createDrill(createReqVO));
|
||||
}
|
||||
|
||||
@PostMapping("/update-drill")
|
||||
@Operation(summary = "更新钻孔机台")
|
||||
@PreAuthorize("@ss.hasPermission('machine::update')")
|
||||
public CommonResult<Boolean> 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<Boolean> 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<Boolean> batchDeleteDrill(@RequestParam("ids") List<Long> 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<DrillRespVO> getDrill(@RequestParam("id") Long id) {
|
||||
DrillRespVO respVO = machineService.getDrill(id);
|
||||
return success(respVO);
|
||||
}
|
||||
|
||||
@GetMapping("getMachineTree")
|
||||
@Operation(summary = "获得机台树")
|
||||
|
||||
+12
-45
@@ -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<Long> createDrillTemplate(@RequestBody DrillTemplateSaveReqVO reqVO) {
|
||||
return success(machineTemplateService.createDrillTemplate(reqVO));
|
||||
}
|
||||
|
||||
@PostMapping("drill-machine")
|
||||
@Operation(summary = "修改钻孔机台模板配置")
|
||||
@PreAuthorize("@ss.hasPermission('machine-template::update')")
|
||||
public CommonResult<Boolean> updateDrillTemplate(@RequestBody DrillTemplateSaveReqVO reqVO) {
|
||||
return success(machineTemplateService.updateDrillTemplate(reqVO));
|
||||
}
|
||||
|
||||
@GetMapping("drill-machine")
|
||||
@Operation(summary = "获取钻孔机台模板配置")
|
||||
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
||||
public CommonResult<DrillTemplateRespVO> getDrillTemplateById(@RequestParam("id") Long id) {
|
||||
return success(machineTemplateService.getDirllTemplateById(id));
|
||||
}
|
||||
|
||||
@DeleteMapping("drill-machine")
|
||||
@Operation(summary = "删除钻孔机台模板配置")
|
||||
@PreAuthorize("@ss.hasPermission('machine-template::delete')")
|
||||
public CommonResult<Boolean> deleteDrillTemplate(@RequestParam("id") Long id) {
|
||||
return success(machineTemplateService.deleteDrillTemplate(id));
|
||||
}
|
||||
|
||||
@DeleteMapping("batch-delete-drill")
|
||||
@Operation(summary = "批量删除钻孔机台模板配置")
|
||||
@PreAuthorize("@ss.hasPermission('machine-template::delete')")
|
||||
public CommonResult<Boolean> batchDeleteDrillTemplate(@RequestParam("ids") List<Long> ids) {
|
||||
return success(machineTemplateService.batchDeleteDrillTemplate(ids));
|
||||
}
|
||||
|
||||
@PutMapping("cutting-machine")
|
||||
@Operation(summary = "新增开料机台模板配置")
|
||||
@Operation(summary = "新增机台模板配置")
|
||||
@PreAuthorize("@ss.hasPermission('machine-template::create')")
|
||||
@OperateLog(logArgs = false)
|
||||
public CommonResult<Long> 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<Boolean> updateCuttingTemplate(@RequestBody CuttingTemplateSaveReqVO reqVO) {
|
||||
return success(machineTemplateService.updateCuttingTemplate(reqVO));
|
||||
}
|
||||
|
||||
@GetMapping("cutting-machine")
|
||||
@Operation(summary = "获取开料机台模板配置")
|
||||
@Operation(summary = "获取机台模板配置")
|
||||
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
||||
public CommonResult<CuttingTemplateRespVO> 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<Boolean> 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<Boolean> batchDeleteCutting(@RequestParam("id") List<Long> ids) {
|
||||
return success(machineTemplateService.batchDeleteCuttingTemplate(ids));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("auth-template")
|
||||
@Operation(summary = "用户模板授权")
|
||||
@PreAuthorize("@ss.hasPermission('machine-template::query')")
|
||||
public CommonResult<Boolean> auth(@RequestBody MachineAuthVO vo) {
|
||||
return success(machineTemplateService.auth(vo));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
+19
@@ -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;
|
||||
}
|
||||
+37
@@ -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<AutoTemplateVO> authTemplateList;
|
||||
}
|
||||
+17
@@ -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;
|
||||
}
|
||||
+19
@@ -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;
|
||||
}
|
||||
+8
-1
@@ -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;
|
||||
|
||||
|
||||
}
|
||||
+7
-2
@@ -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
|
||||
|
||||
+5
-1
@@ -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;
|
||||
}
|
||||
|
||||
+6
-1
@@ -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;
|
||||
}
|
||||
|
||||
+19
@@ -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;
|
||||
}
|
||||
-1
@@ -14,6 +14,5 @@ public class MachineAuthVO {
|
||||
@NotNull(message = "用户id不能空")
|
||||
private Long userId;
|
||||
|
||||
@NotEmpty(message = "机台配置id不能空")
|
||||
private List<Long> machinesIds;
|
||||
}
|
||||
|
||||
+21
@@ -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<MachineAuth> machineAuthList;
|
||||
|
||||
|
||||
}
|
||||
+17
@@ -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;
|
||||
|
||||
}
|
||||
+33
@@ -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<OrganTemplateVO> authTemplateList;
|
||||
}
|
||||
+28
@@ -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;
|
||||
|
||||
}
|
||||
+40
@@ -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;
|
||||
}
|
||||
+11
@@ -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<List<OrganSimpleRespVO>> getSimpleOrganList(@RequestParam(required = false, value = "name") String name) {
|
||||
return success(organService.getSimpleOrganList(name));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+36
@@ -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();
|
||||
|
||||
}
|
||||
}
|
||||
+43
@@ -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();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -34,7 +34,7 @@ public class DataSourceDO extends BaseDO {
|
||||
/**
|
||||
* sql
|
||||
*/
|
||||
private String sql;
|
||||
private String sqlStr;
|
||||
/**
|
||||
* 数据源类型
|
||||
*/
|
||||
|
||||
+21
@@ -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;
|
||||
}
|
||||
-47
@@ -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;
|
||||
|
||||
}
|
||||
+8
@@ -47,5 +47,13 @@ public class LabelTemplateDO extends BaseDO {
|
||||
* 高度
|
||||
*/
|
||||
private Integer height;
|
||||
/**
|
||||
* 是否默认
|
||||
*/
|
||||
private Boolean isDefault;
|
||||
/**
|
||||
* 配置
|
||||
*/
|
||||
private String template;
|
||||
|
||||
}
|
||||
+4
@@ -47,5 +47,9 @@ public class LabelDO extends OrganBaseDO {
|
||||
* 高度
|
||||
*/
|
||||
private Integer height;
|
||||
/**
|
||||
* 配置
|
||||
*/
|
||||
private String template;
|
||||
|
||||
}
|
||||
-47
@@ -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;
|
||||
|
||||
}
|
||||
+11
-11
@@ -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<String> exportOrderPathName;
|
||||
@Schema(description = "大板NC正(A)面文件名")
|
||||
private String largePlateNcPositiveFileName;
|
||||
private List<String> largePlateNcPositiveFileName;
|
||||
@Schema(description = "大板NC反(B)面文件名")
|
||||
private String largePlateNcNegativeFileName;
|
||||
private List<String> largePlateNcNegativeFileName;
|
||||
@Schema(description = "小板NC正(A)面文件名")
|
||||
private String smallPlateNcPositiveFileName;
|
||||
private List<String> smallPlateNcPositiveFileName;
|
||||
@Schema(description = "小板NC反(B)面文件名")
|
||||
private String smallPlateNcNegativeFileName;
|
||||
private List<String> smallPlateNcNegativeFileName;
|
||||
@Schema(description = "大板DXF(排版图)文件名")
|
||||
private String largePlateDxfLayoutFileName;
|
||||
private List<String> largePlateDxfLayoutFileName;
|
||||
@Schema(description = "小板DXF(孔槽加工图)文件名")
|
||||
private String smallPlateDxfProcessingFileName;
|
||||
private List<String> 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 = "集合加工")
|
||||
|
||||
+5
-1
@@ -35,10 +35,14 @@ public class MachineDO extends OrganBaseDO {
|
||||
/**
|
||||
* 1机台设备 2CNC设备
|
||||
*/
|
||||
private Long machineType;
|
||||
private Integer machineType;
|
||||
/**
|
||||
* 标签id
|
||||
*/
|
||||
private Long labelId;
|
||||
/**
|
||||
* 配置
|
||||
*/
|
||||
private String setting;
|
||||
|
||||
}
|
||||
-1
@@ -20,5 +20,4 @@ public class UserMachineDO {
|
||||
private Long id;
|
||||
private Long userId;
|
||||
private Long machineId;
|
||||
private Long organId;
|
||||
}
|
||||
|
||||
+11
-11
@@ -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<String> exportOrderPathName;
|
||||
@Schema(description = "大板NC正(A)面文件名")
|
||||
private String largePlateNcPositiveFileName;
|
||||
private List<String> largePlateNcPositiveFileName;
|
||||
@Schema(description = "大板NC反(B)面文件名")
|
||||
private String largePlateNcNegativeFileName;
|
||||
private List<String> largePlateNcNegativeFileName;
|
||||
@Schema(description = "小板NC正(A)面文件名")
|
||||
private String smallPlateNcPositiveFileName;
|
||||
private List<String> smallPlateNcPositiveFileName;
|
||||
@Schema(description = "小板NC反(B)面文件名")
|
||||
private String smallPlateNcNegativeFileName;
|
||||
private List<String> smallPlateNcNegativeFileName;
|
||||
@Schema(description = "大板DXF(排版图)文件名")
|
||||
private String largePlateDxfLayoutFileName;
|
||||
private List<String> largePlateDxfLayoutFileName;
|
||||
@Schema(description = "小板DXF(孔槽加工图)文件名")
|
||||
private String smallPlateDxfProcessingFileName;
|
||||
private List<String> 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 = "集合加工")
|
||||
|
||||
+4
@@ -32,6 +32,10 @@ public class MachineTemplateDO extends BaseDO {
|
||||
* 是否默认模板
|
||||
*/
|
||||
private Boolean isDefault;
|
||||
/**
|
||||
* 机台模板配置
|
||||
*/
|
||||
private String setting;
|
||||
|
||||
/**
|
||||
* 标签id
|
||||
|
||||
+39
@@ -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;
|
||||
}
|
||||
+2
-1
@@ -20,10 +20,11 @@ public interface DataSourceMapper extends BaseMapperX<DataSourceDO> {
|
||||
default PageResult<DataSourceDO> selectPage(DataSourcePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<DataSourceDO>()
|
||||
.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<DataSourceRespVO> selectListVO();
|
||||
}
|
||||
-25
@@ -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<LabelElementDO> {
|
||||
|
||||
default List<LabelElementDO> selectListByLabelId(Long labelTemplateId) {
|
||||
return selectList(LabelElementDO::getLabelId, labelTemplateId);
|
||||
}
|
||||
|
||||
default int deleteByLabelId(Long labelTemplateId) {
|
||||
return delete(LabelElementDO::getLabelId, labelTemplateId);
|
||||
}
|
||||
|
||||
}
|
||||
-28
@@ -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<LabelElementTemplateDO> {
|
||||
|
||||
default List<LabelElementTemplateDO> selectListByLabelTemplateId(Long labelTemplateId) {
|
||||
return selectList(LabelElementTemplateDO::getLabelTemplateId, labelTemplateId);
|
||||
}
|
||||
|
||||
default int deleteByLabelTemplateId(Long labelTemplateId) {
|
||||
return delete(LabelElementTemplateDO::getLabelTemplateId, labelTemplateId);
|
||||
}
|
||||
|
||||
}
|
||||
+18
-2
@@ -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<MachineTemplateDO> {
|
||||
default PageResult<MachineTemplateDO> selectPage(MachinePageReqVO reqVO, Collection<Long> ids) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MachineTemplateDO>()
|
||||
.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<AuthTemplateResp> selectAuthTemplatePage(@Param("page") IPage<AuthTemplateResp> authTemplateRespPage, @Param("vo") AuthTemplatePage page);
|
||||
|
||||
List<AutoTemplateVO> selectAuthTemplateList(Map<String, Object> map);
|
||||
|
||||
//Page<OrganTemplateResp> selectOrganTemplatePage(@Param("page") Page<OrganTemplateResp> respPage, @Param("vo") OrganTemplatePage page);
|
||||
|
||||
List<OrganTemplateVO> selectOrganTemplateList(Map<String, Object> map);
|
||||
|
||||
Page<OrganTemplateResp> selectOrganTemplatePage(@Param("page") Page<OrganTemplateResp> respPage, @Param("vo") OrganTemplatePage page);
|
||||
|
||||
OrganTemplateResp selectOrganTemplate(Long organId);
|
||||
}
|
||||
|
||||
+10
@@ -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<OrganMachineDO> {
|
||||
|
||||
}
|
||||
+2
@@ -54,4 +54,6 @@ public interface DataSourceService {
|
||||
PageResult<DataSourceDO> getDataSourcePage(DataSourcePageReqVO pageReqVO);
|
||||
|
||||
List<DataSourceDO> list(Integer type);
|
||||
|
||||
List<DataSourceRespVO> list();
|
||||
}
|
||||
+5
@@ -75,4 +75,9 @@ public class DataSourceServiceImpl implements DataSourceService {
|
||||
return dataSourceMapper.selectList(new LambdaQueryWrapperX<DataSourceDO>().eqIfPresent(DataSourceDO::getType, type));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataSourceRespVO> list() {
|
||||
return dataSourceMapper.selectListVO();
|
||||
}
|
||||
|
||||
}
|
||||
+7
-9
@@ -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<LabelElementTemplateRespVO> getLabelElementTemplateListByLabelTemplateId(Long labelTemplateId);
|
||||
|
||||
Map<String, List<LabelTemplateRespVO>> getGroupList();
|
||||
|
||||
/**
|
||||
* 获得默认标签模板
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
LabelTemplateRespVO getDefaultLabelTemplate(String type);
|
||||
}
|
||||
+16
-214
@@ -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<LabelElementTemplateSaveReqVO> createReqVOElements = createReqVO.getElements();
|
||||
if(CollectionUtil.isNotEmpty(createReqVOElements)) {
|
||||
List<LabelElementPropertyDO> 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<LabelElementTemplateDO> labelElementTemplateDOS = labelElementTemplateMapper.selectList(new LambdaQueryWrapperX<LabelElementTemplateDO>()
|
||||
.select(LabelElementTemplateDO::getId)
|
||||
.eq(LabelElementTemplateDO::getLabelTemplateId, updateReqVO.getId()));
|
||||
//删除旧的元素
|
||||
DeleteByQueryRequest.Builder builder = null;
|
||||
if(CollectionUtil.isNotEmpty(labelElementTemplateDOS)) {
|
||||
List<Long> templateIds = labelElementTemplateDOS.stream()
|
||||
.map(LabelElementTemplateDO::getId)
|
||||
.toList();
|
||||
labelElementTemplateMapper.deleteBatchIds(templateIds);
|
||||
List<FieldValue> 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<LabelElementTemplateSaveReqVO> createReqVOElements = updateReqVO.getElements();
|
||||
List<LabelElementPropertyDO> 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<List<LabelElementTemplateDO>>() {
|
||||
}, elements));*/
|
||||
/* labelElementTemplateMapper.updateBatch(Convert.convert(new TypeReference<List<LabelElementTemplateDO>>() {
|
||||
}, elements));
|
||||
List<LabelElementPropertyDO> 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<LabelElementTemplateDO> labelElementTemplateDOS = labelElementTemplateMapper.selectListByLabelTemplateId(id);
|
||||
List<FieldValue> 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<LabelElementTemplateDO>().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<LabelElementTemplateDO> labelElementTemplateDOS = labelElementTemplateMapper.selectListByLabelTemplateId(labelTemplateDO.getId());
|
||||
LabelTemplateRespVO labelTemplateRespVO = BeanUtils.toBean(labelTemplateDO, LabelTemplateRespVO.class);
|
||||
List<LabelElementTemplateRespVO> labelElementTemplateRespVOS = BeanUtils.toBean(labelElementTemplateDOS, LabelElementTemplateRespVO.class);
|
||||
List<FieldValue> fieldValues = labelElementTemplateDOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList());
|
||||
SearchResponse<CuttingSettingDO> searchSetting = null;
|
||||
try {
|
||||
SearchResponse<LabelElementPropertyDO> 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<Hit<LabelElementPropertyDO>> hits = search.hits().hits();
|
||||
if (CollectionUtil.isNotEmpty(hits)) {
|
||||
List<LabelElementPropertyDO> 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<LabelElementTemplateRespVO> getLabelElementTemplateListByLabelTemplateId(Long labelTemplateId) {
|
||||
List<LabelElementTemplateDO> labelElementTemplateDOS = labelElementTemplateMapper.selectListByLabelTemplateId(labelTemplateId);
|
||||
List<LabelElementTemplateRespVO> respVOS = BeanUtils.toBean(labelElementTemplateDOS, LabelElementTemplateRespVO.class);
|
||||
List<FieldValue> fieldValues = labelElementTemplateDOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList());
|
||||
try {
|
||||
SearchResponse<LabelElementPropertyDO> 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<Hit<LabelElementPropertyDO>> hits = response.hits().hits();
|
||||
if(CollectionUtil.isNotEmpty(hits)) {
|
||||
List<LabelElementPropertyDO> 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<String, List<LabelTemplateRespVO>> getGroupList() {
|
||||
List<LabelTemplateDO> labelTemplateDOS = labelTemplateMapper.selectList();
|
||||
List<LabelTemplateRespVO> labelTemplateRespVOS = BeanUtils.toBean(labelTemplateDOS, LabelTemplateRespVO.class);
|
||||
Set<Long> ids = labelTemplateRespVOS.stream().map(e -> e.getId()).collect(Collectors.toSet());
|
||||
List<LabelElementTemplateDO> labelElementTemplateDOS = labelElementTemplateMapper.selectList(new LambdaQueryWrapperX<LabelElementTemplateDO>().in(LabelElementTemplateDO::getLabelTemplateId, ids));
|
||||
List<LabelElementTemplateRespVO> labelElementTemplateRespVOS = BeanUtils.toBean(labelElementTemplateDOS, LabelElementTemplateRespVO.class);
|
||||
List<FieldValue> fieldValues = labelElementTemplateRespVOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList());
|
||||
try {
|
||||
SearchResponse<LabelElementPropertyDO> 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<Hit<LabelElementPropertyDO>> hits = search.hits().hits();
|
||||
if (CollectionUtil.isNotEmpty(hits)) {
|
||||
List<LabelElementPropertyDO> 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<LabelTemplateDO> labelTemplateDOS = labelTemplateMapper.selectList(new LambdaQueryWrapperX<LabelTemplateDO>()
|
||||
.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<LabelElementTemplateDO> list) {
|
||||
list.forEach(o -> o.setLabelTemplateId(labelTemplateId));
|
||||
labelElementTemplateMapper.insertBatch(list);
|
||||
}
|
||||
|
||||
private void updateLabelElementTemplateList(Long labelTemplateId, List<LabelElementTemplateDO> 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);
|
||||
}
|
||||
|
||||
}
|
||||
-11
@@ -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<LabelDO> getLabelPage(LabelPageReqVO pageReqVO);
|
||||
|
||||
// ==================== 子表(标签元素模板) ====================
|
||||
|
||||
/**
|
||||
* 获得标签元素模板列表
|
||||
*
|
||||
* @param LabelId 标签模板id
|
||||
* @return 标签元素模板列表
|
||||
*/
|
||||
List<LabelElementRespVO> getLabelElementListByLabelId(Long LabelId);
|
||||
|
||||
Map<String, List<LabelRespVO>> getGroupList();
|
||||
|
||||
|
||||
+22
-216
@@ -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<LabelElementSaveReqVO> createReqVOElements = createReqVO.getElements();
|
||||
if(CollectionUtil.isNotEmpty(createReqVOElements)) {
|
||||
List<LabelElementPropertyDO> 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<LabelElementDO> labelElementDOS = labelElementMapper.selectList(new LambdaQueryWrapperX<LabelElementDO>()
|
||||
.select(LabelElementDO::getId)
|
||||
.eq(LabelElementDO::getLabelId, updateReqVO.getId()));
|
||||
//删除旧的元素
|
||||
DeleteByQueryRequest.Builder builder = null;
|
||||
if(CollectionUtil.isNotEmpty(labelElementDOS)) {
|
||||
List<Long> templateIds = labelElementDOS.stream()
|
||||
.map(LabelElementDO::getId)
|
||||
.toList();
|
||||
labelElementMapper.deleteBatchIds(templateIds);
|
||||
List<FieldValue> 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<LabelElementSaveReqVO> createReqVOElements = updateReqVO.getElements();
|
||||
List<LabelElementPropertyDO> 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<LabelElementSaveReqVO> elements = updateReqVO.getElements();
|
||||
*//*updateLabelElementList(updateReqVO.getId(), Convert.convert(new TypeReference<List<LabelElementDO>>() {
|
||||
}, elements));*//*
|
||||
labelElementMapper.updateBatch(Convert.convert(new TypeReference<List<LabelElementDO>>() {
|
||||
}, elements));
|
||||
List<LabelElementPropertyDO> 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<LabelElementDO> labelElementDOS = labelElementMapper.selectListByLabelId(id);
|
||||
List<FieldValue> 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<MachineDO> machineDOS = machineMapper.selectList(new LambdaQueryWrapperX<MachineDO>()
|
||||
.select(MachineDO::getId)
|
||||
.eq(MachineDO::getLabelId, id)
|
||||
);
|
||||
if(CollectionUtil.isNotEmpty(machineDOS)) {
|
||||
throw exception(MACHINE_USE_LABEL);
|
||||
}
|
||||
// 删除标签模板表
|
||||
LabelMapper.deleteById(id);
|
||||
// 删除标签元素模板表
|
||||
labelElementMapper.delete(new LambdaQueryWrapperX<LabelElementDO>().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<LabelElementDO> labelElementDOS = labelElementMapper.selectListByLabelId(LabelDO.getId());
|
||||
LabelDO LabelDO = labelMapper.selectById(id);
|
||||
LabelRespVO LabelRespVO = BeanUtils.toBean(LabelDO, LabelRespVO.class);
|
||||
List<LabelElementRespVO> labelElementRespVOS = BeanUtils.toBean(labelElementDOS, LabelElementRespVO.class);
|
||||
List<FieldValue> fieldValues = labelElementDOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList());
|
||||
SearchResponse<CuttingSettingDO> searchSetting = null;
|
||||
try {
|
||||
SearchResponse<LabelElementPropertyDO> 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<Hit<LabelElementPropertyDO>> hits = search.hits().hits();
|
||||
if (CollectionUtil.isNotEmpty(hits)) {
|
||||
List<LabelElementPropertyDO> 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<LabelDO> getLabelPage(LabelPageReqVO pageReqVO) {
|
||||
return LabelMapper.selectPage(pageReqVO);
|
||||
return labelMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
// ==================== 子表(标签元素模板) ====================
|
||||
|
||||
@Override
|
||||
public List<LabelElementRespVO> getLabelElementListByLabelId(Long LabelId) {
|
||||
List<LabelElementDO> labelElementDOS = labelElementMapper.selectListByLabelId(LabelId);
|
||||
List<LabelElementRespVO> respVOS = BeanUtils.toBean(labelElementDOS, LabelElementRespVO.class);
|
||||
List<FieldValue> fieldValues = labelElementDOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList());
|
||||
try {
|
||||
SearchResponse<LabelElementPropertyDO> 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<Hit<LabelElementPropertyDO>> hits = response.hits().hits();
|
||||
if(CollectionUtil.isNotEmpty(hits)) {
|
||||
List<LabelElementPropertyDO> 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<String, List<LabelRespVO>> getGroupList() {
|
||||
List<LabelDO> LabelDOS = LabelMapper.selectList();
|
||||
List<LabelDO> LabelDOS = labelMapper.selectList();
|
||||
List<LabelRespVO> LabelRespVOS = BeanUtils.toBean(LabelDOS, LabelRespVO.class);
|
||||
Set<Long> ids = LabelRespVOS.stream().map(e -> e.getId()).collect(Collectors.toSet());
|
||||
List<LabelElementDO> labelElementDOS = labelElementMapper.selectList(new LambdaQueryWrapperX<LabelElementDO>().in(LabelElementDO::getLabelId, ids));
|
||||
List<LabelElementRespVO> labelElementRespVOS = BeanUtils.toBean(labelElementDOS, LabelElementRespVO.class);
|
||||
List<FieldValue> fieldValues = labelElementRespVOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList());
|
||||
try {
|
||||
SearchResponse<LabelElementPropertyDO> 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<Hit<LabelElementPropertyDO>> hits = search.hits().hits();
|
||||
if (CollectionUtil.isNotEmpty(hits)) {
|
||||
List<LabelElementPropertyDO> 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<LabelDO> list(String type) {
|
||||
return LabelMapper.selectList(new LambdaQueryWrapperX<LabelDO>().eqIfPresent(LabelDO::getType, type));
|
||||
return labelMapper.selectList(new LambdaQueryWrapperX<LabelDO>().eqIfPresent(LabelDO::getType, type));
|
||||
}
|
||||
|
||||
private void createLabelElementList(Long LabelId, List<LabelElementDO> list) {
|
||||
list.forEach(o -> o.setLabelId(LabelId));
|
||||
labelElementMapper.insertBatch(list);
|
||||
}
|
||||
|
||||
private void updateLabelElementList(Long LabelId, List<LabelElementDO> 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);
|
||||
}
|
||||
|
||||
}
|
||||
+9
-41
@@ -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<FieldValue> 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<Integer, List<MachineVO>> getMachineTree() {
|
||||
List<MachineDO> machineDOS = machineMapper.selectList();
|
||||
List<MachineDO> machineDOS = machineMapper.selectList(new LambdaQueryWrapperX<MachineDO>()
|
||||
.select(MachineDO::getName, MachineDO::getMachineType, MachineDO::getId, MachineDO::getLabelId, MachineDO::getCreateTime)
|
||||
);
|
||||
List<MachineVO> machineVOS = BeanUtils.toBean(machineDOS, MachineVO.class);
|
||||
Map<Integer, List<MachineVO>> map = machineVOS.stream().collect(Collectors.groupingBy(MachineVO::getMachineType));
|
||||
return map;
|
||||
|
||||
+9
-1
@@ -39,9 +39,17 @@ public interface MachineTemplateService {
|
||||
|
||||
Boolean batchDeleteCuttingTemplate(List<Long> ids);
|
||||
|
||||
CuttingTemplateRespVO getDefaultCutting();
|
||||
CuttingRespVO getDefaultCutting(Integer machineType);
|
||||
|
||||
DrillTemplateRespVO getDefaultDrill();
|
||||
|
||||
Map<Integer, List<MachineTemplateDO>> getMachineTemplateTree();
|
||||
|
||||
PageResult<AuthTemplateResp> authTemplatePage(AuthTemplatePage page);
|
||||
|
||||
Boolean auth(MachineOrgAuthReq vo);
|
||||
|
||||
PageResult<OrganTemplateResp> organTemplatePage(OrganTemplatePage page);
|
||||
|
||||
OrganTemplateResp organTemplateByOrganId(Long organId);
|
||||
}
|
||||
|
||||
+104
-81
@@ -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<Long> ids) {
|
||||
List<MachineTemplateDO> machineTemplateDOS = machineTemplateMapper.selectBatchIds(ids);
|
||||
if(CollectionUtil.isEmpty(machineTemplateDOS)) {
|
||||
if (CollectionUtil.isEmpty(machineTemplateDOS)) {
|
||||
throw exception(MACHINE_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
|
||||
List<FieldValue> 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<String, Object> 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<Long> ids) {
|
||||
List<MachineTemplateDO> machineTemplateDOS = machineTemplateMapper.selectBatchIds(ids);
|
||||
if(CollectionUtil.isEmpty(machineTemplateDOS)) {
|
||||
if (CollectionUtil.isEmpty(machineTemplateDOS)) {
|
||||
throw exception(MACHINE_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
|
||||
List<FieldValue> 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<MachineTemplateDO> machineTemplateDOS = machineTemplateMapper.selectList(new LambdaQueryWrapperX<MachineTemplateDO>()
|
||||
.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<AuthTemplateResp> authTemplatePage(AuthTemplatePage page) {
|
||||
Page<AuthTemplateResp> respPage = new Page<>(page.getPageNo(), page.getPageSize());
|
||||
Page<AuthTemplateResp> pageRes = machineTemplateMapper.selectAuthTemplatePage(respPage, page);
|
||||
return new PageResult<>(pageRes.getRecords(), pageRes.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<OrganTemplateResp> organTemplatePage(OrganTemplatePage page) {
|
||||
Page<OrganTemplateResp> respPage = new Page<>(page.getPageNo(), page.getPageSize());
|
||||
Page<OrganTemplateResp> 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 <? extends ESDocument> clazz) {
|
||||
private Object buildResp(Long machineTemplateId, String index, Class<? extends ESDocument> 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<CuttingSettingDO> searchSetting = null;
|
||||
try {
|
||||
SearchResponse<?> search = elasticsearchClient.search(builder.build(), clazz);
|
||||
List<? extends Hit<?>> 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<UserMachineDO>().eq(UserMachineDO::getUserId, vo.getUserId()));
|
||||
ArrayList<UserMachineDO> userMachineDOS = new ArrayList<>();
|
||||
for (Long machinesId : vo.getMachinesIds()) {
|
||||
userMachineDOS.add(UserMachineDO.builder()
|
||||
.userId(vo.getUserId())
|
||||
.machineId(machinesId)
|
||||
.build());
|
||||
if (CollectionUtil.isNotEmpty(vo.getMachinesIds())) {
|
||||
ArrayList<UserMachineDO> 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<OrganMachineDO>().eq(OrganMachineDO::getOrganId, vo.getOrganId()));
|
||||
|
||||
List<MachineAuth> machineAuthList = vo.getMachineAuthList();
|
||||
|
||||
if(CollectionUtil.isNotEmpty(machineAuthList)) {
|
||||
List<OrganMachineDO> 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<CuttingMachineDO> pageCutting(PageParam pageParam) {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
@@ -346,16 +369,16 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public PageResult<MachineTemplateDO> page(MachinePageReqVO pageParam) {
|
||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
public PageResult<MachineTemplateDO> page(MachinePageReqVO pageParam) {
|
||||
/* LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||
List<Long> machineIds = userMachineMapper.selectList(new LambdaQueryWrapperX<UserMachineDO>().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<>());
|
||||
}
|
||||
|
||||
|
||||
|
||||
+3
@@ -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<OrganSimpleRespVO> getSimpleOrganList(String name);
|
||||
}
|
||||
|
||||
+11
@@ -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<OrganSimpleRespVO> getSimpleOrganList(String name) {
|
||||
List<OrganizationDO> organizationDOS = organMapper.selectList(new LambdaQueryWrapperX<OrganizationDO>()
|
||||
.likeIfPresent(OrganizationDO::getName, name)
|
||||
.select(OrganizationDO::getId, OrganizationDO::getName));
|
||||
return BeanUtils.toBean(organizationDOS, OrganSimpleRespVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@DSTransactional // 多数据源,使用 @DSTransactional 保证本地事务,以及数据源的切换
|
||||
public Long createOrgan(OrganSaveReqVO createReqVO) {
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.cf.imes.module.system.dal.mysql.datasource.DataSourceMapper">
|
||||
<resultMap id="map" type="com.cf.imes.module.system.controller.admin.datasource.vo.DataSourceRespVO">
|
||||
<result property="id" column="id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="sql" column="sql"/>
|
||||
<collection property="filedList" javaType="java.util.List" ofType="com.cf.imes.module.system.dal.dataobject.datasource.DataSourceFiledDO">
|
||||
<result property="name" column="field_name"/>
|
||||
<result property="sourceId" column="field_source_id"/>
|
||||
<result property="id" column="field_id"/>
|
||||
<result property="key" column="field_key"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectListVO" resultMap="map">
|
||||
select a.*, b.id field_id, b.name field_name, b.source_id field_source_id, b.key field_key
|
||||
from system_data_source a
|
||||
left join system_data_source_field b on a.id = b.source_id
|
||||
</select>
|
||||
</mapper>
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.cf.imes.module.system.dal.mysql.machinetemplate.MachineTemplateMapper">
|
||||
|
||||
<resultMap id="map" type="com.cf.imes.module.system.controller.admin.machine.vo.AuthTemplateResp">
|
||||
<result property="nickname" column="nickname"/>
|
||||
<result property="organId" column="organ_id"/>
|
||||
<result property="userId" column="userId"/>
|
||||
<result property="organName" column="organName"/>
|
||||
<result property="updateTime" column="updateTime"/>
|
||||
<collection property="authTemplateList" javaType="java.util.List" ofType="com.cf.imes.module.system.controller.admin.machine.vo.AutoTemplateVO"
|
||||
select="selectAuthTemplateList" column="{userId=userId, templateName = templateName}" >
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="orgMap" type="com.cf.imes.module.system.controller.admin.machine.vo.OrganTemplateResp">
|
||||
<result property="organId" column="organId"/>
|
||||
<result property="organName" column="organName"/>
|
||||
<result property="updateTime" column="updateTime"/>
|
||||
<collection property="authTemplateList" javaType="java.util.List" ofType="com.cf.imes.module.system.controller.admin.machine.vo.OrganTemplateVO"
|
||||
select="selectOrganTemplateList" column="{organId=organId}" >
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="xxMap" type="com.cf.imes.module.system.controller.admin.machine.vo.OrganTemplateResp">
|
||||
<result property="organId" column="organId"/>
|
||||
<result property="organName" column="organName"/>
|
||||
<result property="updateTime" column="updateTime"/>
|
||||
<collection property="authTemplateList" javaType="java.util.List" ofType="com.cf.imes.module.system.controller.admin.machine.vo.OrganTemplateVO"
|
||||
select="selectOrganTemplateList" column="{organId=organId, templateName = templateName}" notNullColumn="templateId" >
|
||||
</collection>
|
||||
<!--<collection property="authTemplateList" javaType="java.util.List" ofType="com.cf.imes.module.system.controller.admin.machine.vo.OrganTemplateVO">
|
||||
<result property="templateName" column="templateName"/>
|
||||
<result property="templateId" column="templateId"/>
|
||||
</collection>-->
|
||||
</resultMap>
|
||||
|
||||
<select id="selectAuthTemplatePage" resultMap="map" parameterType="com.cf.imes.module.system.controller.admin.machine.vo.AuthTemplatePage">
|
||||
select a.id AS userId, a.nickname, a.organ_id, max(b.create_time) as updateTime, f.name as organName,
|
||||
case when ('${vo.templateName}' != '') then '${vo.templateName}' else '' end as templateName
|
||||
from system_users a, user_machine b, system_organization f
|
||||
<where>
|
||||
a.id = b.user_id
|
||||
and a.organ_id = f.id
|
||||
and a.deleted = 0
|
||||
<if test="vo.organId != null">
|
||||
and a.organ_id = #{vo.organId}
|
||||
</if>
|
||||
<if test="vo.nickname != null and vo.nickname != '' ">
|
||||
and a.nickname like concat('%',#{vo.nickname},'%')
|
||||
</if>
|
||||
</where>
|
||||
group by a.id
|
||||
</select>
|
||||
|
||||
<select id="selectAuthTemplateList"
|
||||
resultType="com.cf.imes.module.system.controller.admin.machine.vo.AutoTemplateVO" parameterType="java.util.Map">
|
||||
select b.user_id, c.name AS templateName, c.id AS templateId
|
||||
from user_machine b
|
||||
inner join system_machine_template c on b.machine_id = c.id and c.deleted = 0
|
||||
<where>
|
||||
b.user_id = #{userId}
|
||||
<if test="templateName != null and templateName != ''">
|
||||
and c.name like concat('%',#{templateName},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--<select id="selectOrganTemplatePage" resultMap="orgMap">
|
||||
select a.id as organId, a.name as organName, max(b.create_time) as updateTime,
|
||||
case when ('${vo.templateName}' != '') then '${vo.templateName}' else '' end as templateName
|
||||
from system_organization a, system_organ_machine b
|
||||
<where>
|
||||
a.id = b.organ_id
|
||||
<if test="vo.organId != null">
|
||||
and a.id = #{vo.organId}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY organId
|
||||
order by updateTime desc
|
||||
|
||||
</select>-->
|
||||
|
||||
<select id="selectOrganTemplateList"
|
||||
resultType="com.cf.imes.module.system.controller.admin.machine.vo.OrganTemplateVO">
|
||||
select b.organ_id organId, b.show_prior_facing, b.show_dual_workstation, b.show_auto_note_printer,
|
||||
c.name AS templateName, c.id AS templateId, c.machine_type
|
||||
from system_organ_machine b
|
||||
inner join system_machine_template c on b.machine_id = c.id and c.deleted = 0
|
||||
<where>
|
||||
b.organ_id = #{organId}
|
||||
<if test="templateName != null and templateName != ''">
|
||||
and c.name like concat('%',#{templateName},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectOrganTemplatePage" resultMap="xxMap">
|
||||
select * from (
|
||||
select a.id as organId, a.name as organName, max(b.create_time) as updateTime,
|
||||
case when ('${vo.templateName}' != '') then '${vo.templateName}' else '' end as templateName
|
||||
from system_organization a, system_organ_machine b
|
||||
<where>
|
||||
a.id = b.organ_id
|
||||
<if test="vo.organId !=null">
|
||||
and a.id = #{vo.organId}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY organId
|
||||
) t1
|
||||
LEFT JOIN (
|
||||
select b.organ_id t2_organId
|
||||
from system_organ_machine b inner join system_machine_template c on b.machine_id = c.id and c.deleted = 0
|
||||
<where>
|
||||
<if test="vo.templateName !=null and vo.templateName !='' " >
|
||||
c.name like concat('%',#{vo.templateName},'%')
|
||||
</if>
|
||||
</where>
|
||||
) t2 on t1.organId = t2.t2_organId
|
||||
where t2.t2_organId is not null
|
||||
GROUP BY organId
|
||||
order by updateTime desc
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectOrganTemplate" resultMap="orgMap">
|
||||
select a.id as organId, a.name as organName, max(b.create_time) as updateTime
|
||||
from system_organization a, system_organ_machine b
|
||||
<where>
|
||||
a.id = b.organ_id
|
||||
and a.id = #{vo.organId}
|
||||
</where>
|
||||
GROUP BY organId
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user