mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 21:52:07 +08:00
机台、机台模板修改配置的存储方式
This commit is contained in:
+6
-46
@@ -86,18 +86,19 @@ public class MachineController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("getDefaultCutting")
|
@GetMapping("getDefaultCutting")
|
||||||
@Operation(summary = "获得默认开料机台模板")
|
@Operation(summary = "获得默认机台模板")
|
||||||
|
@Parameter(name = "type", description = "机台类型", required = true, example = "1")
|
||||||
@PreAuthorize("@ss.hasPermission('machine::query')")
|
@PreAuthorize("@ss.hasPermission('machine::query')")
|
||||||
public CommonResult<CuttingTemplateRespVO> getDefaultCutting() {
|
public CommonResult<CuttingRespVO> getDefaultCutting(@RequestParam Integer machineType) {
|
||||||
return success(machineTemplateService.getDefaultCutting());
|
return success(machineTemplateService.getDefaultCutting(machineType));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("getDefaultDrill")
|
/* @GetMapping("getDefaultDrill")
|
||||||
@Operation(summary = "获得默认钻孔机台模板")
|
@Operation(summary = "获得默认钻孔机台模板")
|
||||||
@PreAuthorize("@ss.hasPermission('machine::query')")
|
@PreAuthorize("@ss.hasPermission('machine::query')")
|
||||||
public CommonResult<DrillTemplateRespVO> getDefaultDrill() {
|
public CommonResult<DrillTemplateRespVO> getDefaultDrill() {
|
||||||
return success(machineTemplateService.getDefaultDrill());
|
return success(machineTemplateService.getDefaultDrill());
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/*@GetMapping("/export-excel")
|
/*@GetMapping("/export-excel")
|
||||||
@Operation(summary = "导出机台 Excel")
|
@Operation(summary = "导出机台 Excel")
|
||||||
@@ -112,47 +113,6 @@ public class MachineController {
|
|||||||
BeanUtils.toBean(list, MachineRespVO.class));
|
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")
|
@GetMapping("getMachineTree")
|
||||||
@Operation(summary = "获得机台树")
|
@Operation(summary = "获得机台树")
|
||||||
|
|||||||
-34
@@ -48,40 +48,6 @@ public class MachineTemplateController {
|
|||||||
return success(machineTemplateService.page(pageParam));
|
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")
|
@PutMapping("cutting-machine")
|
||||||
@Operation(summary = "新增开料机台模板配置")
|
@Operation(summary = "新增开料机台模板配置")
|
||||||
|
|||||||
+8
-1
@@ -1,5 +1,6 @@
|
|||||||
package com.cf.imes.module.system.controller.admin.machine.vo;
|
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 com.cf.imes.module.system.dal.dataobject.machine.CuttingSettingDO;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
@@ -10,6 +11,9 @@ import com.alibaba.excel.annotation.*;
|
|||||||
@Schema(description = "管理后台 - 机台 Response VO")
|
@Schema(description = "管理后台 - 机台 Response VO")
|
||||||
@Data
|
@Data
|
||||||
@ExcelIgnoreUnannotated
|
@ExcelIgnoreUnannotated
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
public class CuttingRespVO {
|
public class CuttingRespVO {
|
||||||
|
|
||||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "14092")
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "14092")
|
||||||
@@ -31,8 +35,11 @@ public class CuttingRespVO {
|
|||||||
@ExcelProperty("创建时间")
|
@ExcelProperty("创建时间")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/* @Schema(description = "机台配置")
|
||||||
|
private CuttingSettingDO machineSettingDO;*/
|
||||||
|
|
||||||
@Schema(description = "机台配置")
|
@Schema(description = "机台配置")
|
||||||
private CuttingSettingDO machineSettingDO;
|
private JSONObject machineSettingDO;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+7
-2
@@ -1,5 +1,6 @@
|
|||||||
package com.cf.imes.module.system.controller.admin.machine.vo;
|
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.framework.es.core.valid.UpdateGroup;
|
||||||
import com.cf.imes.module.system.dal.dataobject.machine.CuttingSettingDO;
|
import com.cf.imes.module.system.dal.dataobject.machine.CuttingSettingDO;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@@ -32,9 +33,13 @@ public class CuttingSaveReqVO {
|
|||||||
@NotNull(message = "标签id不能空")
|
@NotNull(message = "标签id不能空")
|
||||||
private Long labelId;
|
private Long labelId;
|
||||||
|
|
||||||
@Schema(description = "机台配置")
|
/* @Schema(description = "机台配置")
|
||||||
@Valid
|
@Valid
|
||||||
private CuttingSettingDO machineSettingDO;
|
private CuttingSettingDO machineSettingDO;*/
|
||||||
|
|
||||||
|
@Schema(description = "机台配置")
|
||||||
|
private JSONObject machineSettingDO;
|
||||||
|
|
||||||
|
|
||||||
/* @Schema(description = "样式配置")
|
/* @Schema(description = "样式配置")
|
||||||
@Valid
|
@Valid
|
||||||
|
|||||||
+5
-1
@@ -1,6 +1,7 @@
|
|||||||
package com.cf.imes.module.system.controller.admin.machine.vo;
|
package com.cf.imes.module.system.controller.admin.machine.vo;
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
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.CuttingTemplateMachineDO;
|
||||||
import com.cf.imes.module.system.dal.dataobject.machinetemplate.DrillTemplateMachineDO;
|
import com.cf.imes.module.system.dal.dataobject.machinetemplate.DrillTemplateMachineDO;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@@ -35,6 +36,9 @@ public class CuttingTemplateRespVO {
|
|||||||
@ExcelProperty("创建时间")
|
@ExcelProperty("创建时间")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/*@Schema(description = "开料机台模板配置")
|
||||||
|
private CuttingTemplateMachineDO cuttingTemplateMachineDO;*/
|
||||||
|
|
||||||
@Schema(description = "开料机台模板配置")
|
@Schema(description = "开料机台模板配置")
|
||||||
private CuttingTemplateMachineDO cuttingTemplateMachineDO;
|
private JSONObject cuttingTemplateMachineDO;
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-1
@@ -1,5 +1,6 @@
|
|||||||
package com.cf.imes.module.system.controller.admin.machine.vo;
|
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.framework.es.core.valid.UpdateGroup;
|
||||||
import com.cf.imes.module.system.dal.dataobject.machinetemplate.CuttingTemplateMachineDO;
|
import com.cf.imes.module.system.dal.dataobject.machinetemplate.CuttingTemplateMachineDO;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@@ -29,7 +30,11 @@ public class CuttingTemplateSaveReqVO {
|
|||||||
@NotNull(message = "标签id不能空")
|
@NotNull(message = "标签id不能空")
|
||||||
private Long labelId;*/
|
private Long labelId;*/
|
||||||
|
|
||||||
|
/* @Schema(description = "管理理后台 - 开料机台模板新增/修改 Request VO")
|
||||||
|
@NotNull(message = "开料机台配置不能空")
|
||||||
|
private CuttingTemplateMachineDO setting;*/
|
||||||
|
|
||||||
@Schema(description = "管理理后台 - 开料机台模板新增/修改 Request VO")
|
@Schema(description = "管理理后台 - 开料机台模板新增/修改 Request VO")
|
||||||
@NotNull(message = "开料机台配置不能空")
|
@NotNull(message = "开料机台配置不能空")
|
||||||
private CuttingTemplateMachineDO setting;
|
private JSONObject setting;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-3
@@ -29,9 +29,9 @@ public class LabelTemplateConvertImpl implements LabelTemplateConvert {
|
|||||||
@Override
|
@Override
|
||||||
public List<LabelElementTemplateRespVO> convert1 (List<LabelElementTemplateDO> labelElementTemplateDOS) {
|
public List<LabelElementTemplateRespVO> convert1 (List<LabelElementTemplateDO> labelElementTemplateDOS) {
|
||||||
return labelElementTemplateDOS.stream().map(e -> {
|
return labelElementTemplateDOS.stream().map(e -> {
|
||||||
Gson gson = new Gson();
|
/*Gson gson = new Gson();
|
||||||
Type type = new TypeToken<Map<String, Object>>() {
|
Type type = new TypeToken<Map<String, Object>>() {
|
||||||
}.getType();
|
}.getType();*/
|
||||||
return LabelElementTemplateRespVO.builder()
|
return LabelElementTemplateRespVO.builder()
|
||||||
.labelTemplateId(e.getLabelTemplateId())
|
.labelTemplateId(e.getLabelTemplateId())
|
||||||
.id(e.getId())
|
.id(e.getId())
|
||||||
@@ -39,7 +39,6 @@ public class LabelTemplateConvertImpl implements LabelTemplateConvert {
|
|||||||
.name(e.getName())
|
.name(e.getName())
|
||||||
.propertyDO(JSON.parseObject(e.getConfig()))
|
.propertyDO(JSON.parseObject(e.getConfig()))
|
||||||
// .propertyDO(StrUtil.isBlank(e.getPropertyDO()) ? new HashMap<String, Object>(): gson.fromJson(e.getPropertyDO(), type))
|
// .propertyDO(StrUtil.isBlank(e.getPropertyDO()) ? new HashMap<String, Object>(): gson.fromJson(e.getPropertyDO(), type))
|
||||||
//{extra=, x=100, y=100, width=100, height=100, value=, html=, isRepeat=false, borderWidth=1, fontSize=1, divHeight=1, colNum=1, enableSourceExpress=false, sourceExpress=, visible=true, isScrapBlock=false, visibleExpression=, isVertical=false, dataText=, dataExpression=, displayType=1, barcodeType=, fontWeight=1, fontFamily=, textAlign=, textBaseline=, qrcodeErrorRate=, showSideHole=false}
|
|
||||||
.sourceId(e.getSourceId())
|
.sourceId(e.getSourceId())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|||||||
+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();
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
-1
@@ -35,10 +35,14 @@ public class MachineDO extends OrganBaseDO {
|
|||||||
/**
|
/**
|
||||||
* 1机台设备 2CNC设备
|
* 1机台设备 2CNC设备
|
||||||
*/
|
*/
|
||||||
private Long machineType;
|
private Integer machineType;
|
||||||
/**
|
/**
|
||||||
* 标签id
|
* 标签id
|
||||||
*/
|
*/
|
||||||
private Long labelId;
|
private Long labelId;
|
||||||
|
/**
|
||||||
|
* 配置
|
||||||
|
*/
|
||||||
|
private String setting;
|
||||||
|
|
||||||
}
|
}
|
||||||
+4
@@ -32,6 +32,10 @@ public class MachineTemplateDO extends BaseDO {
|
|||||||
* 是否默认模板
|
* 是否默认模板
|
||||||
*/
|
*/
|
||||||
private Boolean isDefault;
|
private Boolean isDefault;
|
||||||
|
/**
|
||||||
|
* 机台模板配置
|
||||||
|
*/
|
||||||
|
private String setting;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标签id
|
* 标签id
|
||||||
|
|||||||
+2
-1
@@ -238,7 +238,8 @@ public class LabelTemplateServiceImpl implements LabelTemplateService {
|
|||||||
@Override
|
@Override
|
||||||
public List<LabelElementTemplateRespVO> getLabelElementTemplateListByLabelTemplateId(Long labelTemplateId) {
|
public List<LabelElementTemplateRespVO> getLabelElementTemplateListByLabelTemplateId(Long labelTemplateId) {
|
||||||
List<LabelElementTemplateDO> labelElementTemplateDOS = labelElementTemplateMapper.selectListByLabelTemplateId(labelTemplateId);
|
List<LabelElementTemplateDO> labelElementTemplateDOS = labelElementTemplateMapper.selectListByLabelTemplateId(labelTemplateId);
|
||||||
List<LabelElementTemplateRespVO> respVOS = BeanUtils.toBean(labelElementTemplateDOS, LabelElementTemplateRespVO.class);
|
List<LabelElementTemplateRespVO> respVOS = labelTemplateConvert.convert1(labelElementTemplateDOS);
|
||||||
|
//List<LabelElementTemplateRespVO> respVOS = BeanUtils.toBean(labelElementTemplateDOS, LabelElementTemplateRespVO.class);
|
||||||
/* List<FieldValue> fieldValues = labelElementTemplateDOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList());
|
/* List<FieldValue> fieldValues = labelElementTemplateDOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList());
|
||||||
try {
|
try {
|
||||||
SearchResponse<LabelElementPropertyDO> response = elasticsearchClient.search(b -> b.index(LABEL_TEMPLATE_ELEMENT_PROPERTY_INX)
|
SearchResponse<LabelElementPropertyDO> response = elasticsearchClient.search(b -> b.index(LABEL_TEMPLATE_ELEMENT_PROPERTY_INX)
|
||||||
|
|||||||
+21
-14
@@ -12,7 +12,9 @@ import co.elastic.clients.elasticsearch.core.SearchResponse;
|
|||||||
import co.elastic.clients.elasticsearch.core.search.Hit;
|
import co.elastic.clients.elasticsearch.core.search.Hit;
|
||||||
import com.cf.imes.framework.es.core.dal.ESDocument;
|
import com.cf.imes.framework.es.core.dal.ESDocument;
|
||||||
import com.cf.imes.framework.es.core.service.ESDocumentService;
|
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.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.DrillSettingDO;
|
||||||
import com.cf.imes.module.system.dal.dataobject.machine.MachineDO;
|
import com.cf.imes.module.system.dal.dataobject.machine.MachineDO;
|
||||||
import com.cf.imes.module.system.dal.dataobject.machine.CuttingSettingDO;
|
import com.cf.imes.module.system.dal.dataobject.machine.CuttingSettingDO;
|
||||||
@@ -59,16 +61,17 @@ public class MachineServiceImpl implements MachineService {
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Long createCutting(CuttingSaveReqVO createReqVO) {
|
public Long createCutting(CuttingSaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
MachineDO machineDO = Convert.convert(MachineDO.class, createReqVO);
|
MachineDO machineDO = MachineConvert.convert(createReqVO);
|
||||||
|
//MachineDO machineDO = Convert.convert(MachineDO.class, createReqVO);
|
||||||
machineMapper.insert(machineDO);
|
machineMapper.insert(machineDO);
|
||||||
CuttingSettingDO machineSettingDO = createReqVO.getMachineSettingDO();
|
/* CuttingSettingDO machineSettingDO = createReqVO.getMachineSettingDO();
|
||||||
machineSettingDO.setMachineId(machineDO.getId());
|
machineSettingDO.setMachineId(machineDO.getId());
|
||||||
try {
|
try {
|
||||||
esDocumentService.createByFluentDSL(CUTTING_MACHINE_SETTING, machineSettingDO.getId(), machineSettingDO);
|
esDocumentService.createByFluentDSL(CUTTING_MACHINE_SETTING, machineSettingDO.getId(), machineSettingDO);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
throw exception(INTERNAL_SERVER_ERROR);
|
throw exception(INTERNAL_SERVER_ERROR);
|
||||||
}
|
}*/
|
||||||
// 返回
|
// 返回
|
||||||
return machineDO.getId();
|
return machineDO.getId();
|
||||||
}
|
}
|
||||||
@@ -77,15 +80,16 @@ public class MachineServiceImpl implements MachineService {
|
|||||||
public void updateCutting(CuttingSaveReqVO updateReqVO){
|
public void updateCutting(CuttingSaveReqVO updateReqVO){
|
||||||
// 校验存在
|
// 校验存在
|
||||||
validateExists(updateReqVO.getId());
|
validateExists(updateReqVO.getId());
|
||||||
updateReqVO.getMachineSettingDO().setMachineId(updateReqVO.getId());
|
/* updateReqVO.getMachineSettingDO().setMachineId(updateReqVO.getId());
|
||||||
try {
|
try {
|
||||||
esDocumentService.createByFluentDSL(CUTTING_MACHINE_SETTING, updateReqVO.getMachineSettingDO().getId(), updateReqVO.getMachineSettingDO());
|
esDocumentService.createByFluentDSL(CUTTING_MACHINE_SETTING, updateReqVO.getMachineSettingDO().getId(), updateReqVO.getMachineSettingDO());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
throw exception(INTERNAL_SERVER_ERROR);
|
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);
|
machineMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -96,7 +100,7 @@ public class MachineServiceImpl implements MachineService {
|
|||||||
if (machineMapper.selectById(id) == null) {
|
if (machineMapper.selectById(id) == null) {
|
||||||
throw exception(MACHINE_NOT_EXISTS);
|
throw exception(MACHINE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
// 删除
|
/* // 删除
|
||||||
DeleteByQueryRequest.Builder builder = new DeleteByQueryRequest.Builder()
|
DeleteByQueryRequest.Builder builder = new DeleteByQueryRequest.Builder()
|
||||||
.index(CUTTING_MACHINE_SETTING)
|
.index(CUTTING_MACHINE_SETTING)
|
||||||
.query(b->b.term(t->t.field("machineId").value(machineDO.getId())));
|
.query(b->b.term(t->t.field("machineId").value(machineDO.getId())));
|
||||||
@@ -105,7 +109,7 @@ public class MachineServiceImpl implements MachineService {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
throw exception(INTERNAL_SERVER_ERROR);
|
throw exception(INTERNAL_SERVER_ERROR);
|
||||||
}
|
}*/
|
||||||
machineMapper.deleteById(id);
|
machineMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,7 +119,7 @@ public class MachineServiceImpl implements MachineService {
|
|||||||
if(CollectionUtil.isEmpty(machineDOS)){
|
if(CollectionUtil.isEmpty(machineDOS)){
|
||||||
throw exception(MACHINE_NOT_EXISTS);
|
throw exception(MACHINE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
List<FieldValue> fieldValues = machineDOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList());
|
/* List<FieldValue> fieldValues = machineDOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList());
|
||||||
DeleteByQueryRequest.Builder builder = new DeleteByQueryRequest.Builder()
|
DeleteByQueryRequest.Builder builder = new DeleteByQueryRequest.Builder()
|
||||||
.index(CUTTING_MACHINE_SETTING)
|
.index(CUTTING_MACHINE_SETTING)
|
||||||
.query(TermsQuery.of(e-> e.field("machineId").terms(b->b.value(fieldValues)))._toQuery());
|
.query(TermsQuery.of(e-> e.field("machineId").terms(b->b.value(fieldValues)))._toQuery());
|
||||||
@@ -124,7 +128,7 @@ public class MachineServiceImpl implements MachineService {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
throw exception(INTERNAL_SERVER_ERROR);
|
throw exception(INTERNAL_SERVER_ERROR);
|
||||||
}
|
}*/
|
||||||
machineMapper.deleteBatchIds(ids);
|
machineMapper.deleteBatchIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,9 +138,10 @@ public class MachineServiceImpl implements MachineService {
|
|||||||
if(Objects.isNull(machineDO)) {
|
if(Objects.isNull(machineDO)) {
|
||||||
throw exception(MACHINE_NOT_EXISTS);
|
throw exception(MACHINE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
CuttingRespVO respVO = Convert.convert(CuttingRespVO.class, machineDO);
|
CuttingRespVO respVO = MachineConvert.convert(machineDO);
|
||||||
Object o1 = buildResp(machineDO.getId(), CUTTING_MACHINE_SETTING, CuttingSettingDO.class);
|
//CuttingRespVO respVO = Convert.convert(CuttingRespVO.class, machineDO);
|
||||||
respVO.setMachineSettingDO((CuttingSettingDO) o1);
|
/*Object o1 = buildResp(machineDO.getId(), CUTTING_MACHINE_SETTING, CuttingSettingDO.class);
|
||||||
|
respVO.setMachineSettingDO((CuttingSettingDO) o1);*/
|
||||||
return respVO;
|
return respVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,7 +236,9 @@ public class MachineServiceImpl implements MachineService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<Integer, List<MachineVO>> getMachineTree() {
|
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);
|
List<MachineVO> machineVOS = BeanUtils.toBean(machineDOS, MachineVO.class);
|
||||||
Map<Integer, List<MachineVO>> map = machineVOS.stream().collect(Collectors.groupingBy(MachineVO::getMachineType));
|
Map<Integer, List<MachineVO>> map = machineVOS.stream().collect(Collectors.groupingBy(MachineVO::getMachineType));
|
||||||
return map;
|
return map;
|
||||||
|
|||||||
+1
-1
@@ -39,7 +39,7 @@ public interface MachineTemplateService {
|
|||||||
|
|
||||||
Boolean batchDeleteCuttingTemplate(List<Long> ids);
|
Boolean batchDeleteCuttingTemplate(List<Long> ids);
|
||||||
|
|
||||||
CuttingTemplateRespVO getDefaultCutting();
|
CuttingRespVO getDefaultCutting(Integer machineType);
|
||||||
|
|
||||||
DrillTemplateRespVO getDefaultDrill();
|
DrillTemplateRespVO getDefaultDrill();
|
||||||
|
|
||||||
|
|||||||
+24
-18
@@ -21,7 +21,10 @@ import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|||||||
import com.cf.imes.framework.security.core.LoginUser;
|
import com.cf.imes.framework.security.core.LoginUser;
|
||||||
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
|
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.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.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.machine.UserMachineDO;
|
||||||
import com.cf.imes.module.system.dal.dataobject.machinetemplate.CuttingTemplateMachineDO;
|
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.DrillTemplateMachineDO;
|
||||||
@@ -162,31 +165,33 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Long createCuttingTemplate(CuttingTemplateSaveReqVO reqVO) {
|
public Long createCuttingTemplate(CuttingTemplateSaveReqVO reqVO) {
|
||||||
MachineTemplateDO templateDO = Convert.convert(MachineTemplateDO.class, reqVO);
|
MachineTemplateDO templateDO = MachineTemplateConvert.convert(reqVO);
|
||||||
|
//MachineTemplateDO templateDO = Convert.convert(MachineTemplateDO.class, reqVO);
|
||||||
machineTemplateMapper.insert(templateDO);
|
machineTemplateMapper.insert(templateDO);
|
||||||
CuttingTemplateMachineDO setting = reqVO.getSetting();
|
/*CuttingTemplateMachineDO setting = reqVO.getSetting();
|
||||||
setting.setTemplateId(templateDO.getId());
|
setting.setTemplateId(templateDO.getId());
|
||||||
try {
|
try {
|
||||||
esDocumentService.createByFluentDSL(CUTTING_MACHINE_INX, setting.getId(), setting);
|
esDocumentService.createByFluentDSL(CUTTING_MACHINE_INX, setting.getId(), setting);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
throw new ServiceException(INTERNAL_SERVER_ERROR);
|
throw new ServiceException(INTERNAL_SERVER_ERROR);
|
||||||
}
|
}*/
|
||||||
return templateDO.getId();
|
return templateDO.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateCuttingTemplate(CuttingTemplateSaveReqVO reqVO) {
|
public Boolean updateCuttingTemplate(CuttingTemplateSaveReqVO reqVO) {
|
||||||
MachineTemplateDO templateDO = Convert.convert(MachineTemplateDO.class, reqVO);
|
MachineTemplateDO templateDO = MachineTemplateConvert.convert(reqVO);
|
||||||
|
//MachineTemplateDO templateDO = Convert.convert(MachineTemplateDO.class, reqVO);
|
||||||
machineTemplateMapper.updateById(templateDO);
|
machineTemplateMapper.updateById(templateDO);
|
||||||
CuttingTemplateMachineDO setting = reqVO.getSetting();
|
/*CuttingTemplateMachineDO setting = reqVO.getSetting();
|
||||||
Map<String, Object> map = BeanUtil.beanToMap(setting);
|
Map<String, Object> map = BeanUtil.beanToMap(setting);
|
||||||
try {
|
try {
|
||||||
esDocumentService.updateById(CUTTING_MACHINE_INX, setting.getId(), CuttingTemplateMachineDO.class, map);
|
esDocumentService.updateById(CUTTING_MACHINE_INX, setting.getId(), CuttingTemplateMachineDO.class, map);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
throw new ServiceException(INTERNAL_SERVER_ERROR);
|
throw new ServiceException(INTERNAL_SERVER_ERROR);
|
||||||
}
|
}*/
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,9 +201,10 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
if (Objects.isNull(templateDO)) {
|
if (Objects.isNull(templateDO)) {
|
||||||
throw exception(MACHINE_TEMPLATE_NOT_EXISTS);
|
throw exception(MACHINE_TEMPLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
CuttingTemplateRespVO respVO = Convert.convert(CuttingTemplateRespVO.class, templateDO);
|
CuttingTemplateRespVO respVO = MachineTemplateConvert.convert1(templateDO);
|
||||||
|
/*CuttingTemplateRespVO respVO = Convert.convert(CuttingTemplateRespVO.class, templateDO);
|
||||||
Object o = buildResp(templateDO.getId(), CUTTING_MACHINE_INX, CuttingTemplateMachineDO.class);
|
Object o = buildResp(templateDO.getId(), CUTTING_MACHINE_INX, CuttingTemplateMachineDO.class);
|
||||||
respVO.setCuttingTemplateMachineDO((CuttingTemplateMachineDO) o);
|
respVO.setCuttingTemplateMachineDO((CuttingTemplateMachineDO) o);*/
|
||||||
return respVO;
|
return respVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +215,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
throw exception(MACHINE_TEMPLATE_NOT_EXISTS);
|
throw exception(MACHINE_TEMPLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<FieldValue> fieldValues = machineTemplateDOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList());
|
/* List<FieldValue> fieldValues = machineTemplateDOS.stream().map(e -> FieldValue.of(e.getId())).collect(Collectors.toList());
|
||||||
DeleteByQueryRequest.Builder builder = new DeleteByQueryRequest.Builder()
|
DeleteByQueryRequest.Builder builder = new DeleteByQueryRequest.Builder()
|
||||||
.index(CUTTING_MACHINE_INX)
|
.index(CUTTING_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());
|
||||||
@@ -218,26 +224,26 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
throw new ServiceException(INTERNAL_SERVER_ERROR);
|
throw new ServiceException(INTERNAL_SERVER_ERROR);
|
||||||
}
|
}*/
|
||||||
machineTemplateMapper.deleteBatchIds(ids);
|
machineTemplateMapper.deleteBatchIds(ids);
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CuttingTemplateRespVO getDefaultCutting() {
|
public CuttingRespVO getDefaultCutting(Integer machineType) {
|
||||||
List<MachineTemplateDO> machineTemplateDOS = machineTemplateMapper.selectList(new LambdaQueryWrapperX<MachineTemplateDO>()
|
List<MachineTemplateDO> machineTemplateDOS = machineTemplateMapper.selectList(new LambdaQueryWrapperX<MachineTemplateDO>()
|
||||||
.eq(MachineTemplateDO::getIsDefault, Boolean.TRUE)
|
.eq(MachineTemplateDO::getIsDefault, Boolean.TRUE)
|
||||||
.eq(MachineTemplateDO::getMachineType, 1)
|
.eq(MachineTemplateDO::getMachineType, machineType)
|
||||||
);
|
);
|
||||||
if (CollectionUtil.isNotEmpty(machineTemplateDOS)) {
|
if (CollectionUtil.isNotEmpty(machineTemplateDOS)) {
|
||||||
if (machineTemplateDOS.size() > 1) {
|
if (machineTemplateDOS.size() > 1) {
|
||||||
throw exception(DEFAULT_TEMPLATE_COUNT);
|
throw exception(DEFAULT_TEMPLATE_COUNT);
|
||||||
}
|
}
|
||||||
MachineTemplateDO templateDO = machineTemplateDOS.get(0);
|
MachineTemplateDO templateDO = machineTemplateDOS.get(0);
|
||||||
CuttingTemplateRespVO respVO = Convert.convert(CuttingTemplateRespVO.class, templateDO);
|
return MachineTemplateConvert.convert(templateDO);
|
||||||
Object o = buildResp(templateDO.getId(), CUTTING_MACHINE_INX, CuttingTemplateMachineDO.class);
|
//CuttingTemplateRespVO respVO = Convert.convert(CuttingTemplateRespVO.class, templateDO);
|
||||||
respVO.setCuttingTemplateMachineDO((CuttingTemplateMachineDO) o);
|
/* Object o = buildResp(templateDO.getId(), CUTTING_MACHINE_INX, CuttingTemplateMachineDO.class);
|
||||||
return respVO;
|
respVO.setCuttingTemplateMachineDO((CuttingTemplateMachineDO) o);*/
|
||||||
}
|
}
|
||||||
throw exception(DEFAULT_TEMPLATE_COUNT);
|
throw exception(DEFAULT_TEMPLATE_COUNT);
|
||||||
}
|
}
|
||||||
@@ -295,7 +301,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
throw exception(MACHINE_TEMPLATE_NOT_EXISTS);
|
throw exception(MACHINE_TEMPLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
// 删除
|
// 删除
|
||||||
DeleteByQueryRequest.Builder builder = new DeleteByQueryRequest.Builder()
|
/* DeleteByQueryRequest.Builder builder = new DeleteByQueryRequest.Builder()
|
||||||
.index(CUTTING_MACHINE_INX)
|
.index(CUTTING_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 {
|
try {
|
||||||
@@ -303,7 +309,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
throw new ServiceException(INTERNAL_SERVER_ERROR);
|
throw new ServiceException(INTERNAL_SERVER_ERROR);
|
||||||
}
|
}*/
|
||||||
machineTemplateMapper.deleteById(id);
|
machineTemplateMapper.deleteById(id);
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user