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:
+2
@@ -183,10 +183,12 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode MACHINE_NOT_EXISTS = new ErrorCode(1_002_029_000, "机台不存在");
|
ErrorCode MACHINE_NOT_EXISTS = new ErrorCode(1_002_029_000, "机台不存在");
|
||||||
ErrorCode MACHINE_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_029_001, "机台模板不存在");
|
ErrorCode MACHINE_TEMPLATE_NOT_EXISTS = new ErrorCode(1_002_029_001, "机台模板不存在");
|
||||||
ErrorCode DEFAULT_TEMPLATE_COUNT = new ErrorCode(1_002_029_002, "默认模板数量异常");
|
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 ==========
|
// ========== 标签模板 1-002-300-000 ==========
|
||||||
ErrorCode LABEL_TEMPLATE_NOT_EXISTS = new ErrorCode(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 LABEL_NOT_EXISTS = new ErrorCode(1_002_300_001, "标签不存在");
|
||||||
|
ErrorCode DEFAULT_LABEL_NOT_EXISTS = new ErrorCode(1_002_300_002, "该类型标签默认模板不存在");
|
||||||
|
|
||||||
// ========== 系统数据源 1_002_301_000 ==========
|
// ========== 系统数据源 1_002_301_000 ==========
|
||||||
ErrorCode DATA_SOURCE_NOT_EXISTS = new ErrorCode(1_002_301_000, "系统数据源不存在");
|
ErrorCode DATA_SOURCE_NOT_EXISTS = new ErrorCode(1_002_301_000, "系统数据源不存在");
|
||||||
|
|||||||
+8
@@ -85,6 +85,14 @@ public class LabelTemplateController {
|
|||||||
return success(labelTemplateService.getGroupList());
|
return success(labelTemplateService.getGroupList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getDefault")
|
||||||
|
@Operation(summary = "获得默认标签模板")
|
||||||
|
@Parameter(name = "type", description = "标签类型", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:label-template:query')")
|
||||||
|
public CommonResult<LabelTemplateRespVO> getDefaultLabelTemplate(@RequestParam("type") String type) {
|
||||||
|
return success(labelTemplateService.getDefaultLabelTemplate(type));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@Operation(summary = "导出标签模板 Excel")
|
@Operation(summary = "导出标签模板 Excel")
|
||||||
@PreAuthorize("@ss.hasPermission('system:label-template:export')")
|
@PreAuthorize("@ss.hasPermission('system:label-template:export')")
|
||||||
|
|||||||
+1
-1
@@ -87,7 +87,7 @@ public class MachineController {
|
|||||||
|
|
||||||
@GetMapping("getDefaultCutting")
|
@GetMapping("getDefaultCutting")
|
||||||
@Operation(summary = "获得默认机台模板")
|
@Operation(summary = "获得默认机台模板")
|
||||||
@Parameter(name = "type", description = "机台类型", required = true, example = "1")
|
@Parameter(name = "machineType", description = "机台类型", required = true, example = "1")
|
||||||
@PreAuthorize("@ss.hasPermission('machine::query')")
|
@PreAuthorize("@ss.hasPermission('machine::query')")
|
||||||
public CommonResult<CuttingRespVO> getDefaultCutting(@RequestParam Integer machineType) {
|
public CommonResult<CuttingRespVO> getDefaultCutting(@RequestParam Integer machineType) {
|
||||||
return success(machineTemplateService.getDefaultCutting(machineType));
|
return success(machineTemplateService.getDefaultCutting(machineType));
|
||||||
|
|||||||
+4
@@ -47,5 +47,9 @@ public class LabelTemplateDO extends BaseDO {
|
|||||||
* 高度
|
* 高度
|
||||||
*/
|
*/
|
||||||
private Integer height;
|
private Integer height;
|
||||||
|
/**
|
||||||
|
* 是否默认
|
||||||
|
*/
|
||||||
|
private Boolean isDefault;
|
||||||
|
|
||||||
}
|
}
|
||||||
+7
@@ -65,4 +65,11 @@ public interface LabelTemplateService {
|
|||||||
List<LabelElementTemplateRespVO> getLabelElementTemplateListByLabelTemplateId(Long labelTemplateId);
|
List<LabelElementTemplateRespVO> getLabelElementTemplateListByLabelTemplateId(Long labelTemplateId);
|
||||||
|
|
||||||
Map<String, List<LabelTemplateRespVO>> getGroupList();
|
Map<String, List<LabelTemplateRespVO>> getGroupList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得默认标签模板
|
||||||
|
* @param type
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
LabelTemplateRespVO getDefaultLabelTemplate(String type);
|
||||||
}
|
}
|
||||||
+20
@@ -296,6 +296,26 @@ public class LabelTemplateServiceImpl implements LabelTemplateService {
|
|||||||
return labelTemplateRespVOS.stream().collect(Collectors.groupingBy(e -> e.getType()));
|
return labelTemplateRespVOS.stream().collect(Collectors.groupingBy(e -> e.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);
|
||||||
|
}
|
||||||
|
LabelTemplateDO labelTemplateDO = labelTemplateDOS.get(0);
|
||||||
|
List<LabelElementTemplateDO> labelElementTemplateDOS = labelElementTemplateMapper.selectListByLabelTemplateId(labelTemplateDO.getId());
|
||||||
|
LabelTemplateRespVO labelTemplateRespVO = BeanUtils.toBean(labelTemplateDO, LabelTemplateRespVO.class);
|
||||||
|
List<LabelElementTemplateRespVO> labelElementTemplateRespVOS = labelTemplateConvert.convert1(labelElementTemplateDOS);
|
||||||
|
labelTemplateRespVO.setLabelElementTemplates(labelElementTemplateRespVOS);
|
||||||
|
return labelTemplateRespVO;
|
||||||
|
}
|
||||||
|
throw exception(DEFAULT_LABEL_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
private void createLabelElementTemplateList(Long labelTemplateId, List<LabelElementTemplateDO> list) {
|
private void createLabelElementTemplateList(Long labelTemplateId, List<LabelElementTemplateDO> list) {
|
||||||
list.forEach(o -> o.setLabelTemplateId(labelTemplateId));
|
list.forEach(o -> o.setLabelTemplateId(labelTemplateId));
|
||||||
labelElementTemplateMapper.insertBatch(list);
|
labelElementTemplateMapper.insertBatch(list);
|
||||||
|
|||||||
+2
-3
@@ -47,8 +47,7 @@ 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.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR;
|
||||||
import static com.cf.imes.framework.common.exception.util.ServiceExceptionUtil.exception;
|
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.*;
|
||||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.MACHINE_TEMPLATE_NOT_EXISTS;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author there
|
* @author there
|
||||||
@@ -245,7 +244,7 @@ public class MachineTemplateServiceImpl implements MachineTemplateService {
|
|||||||
/* 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);*/
|
||||||
}
|
}
|
||||||
throw exception(DEFAULT_TEMPLATE_COUNT);
|
throw exception(DEFAULT_TEMPLATE_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user