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:
+39
@@ -0,0 +1,39 @@
|
||||
package com.cf.imes.module.system.api.machine;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.module.system.api.machine.dto.CuttingRespDTO;
|
||||
import com.cf.imes.module.system.enums.ApiConstants;
|
||||
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.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(name = ApiConstants.NAME) // TODO 晨丰:fallbackFactory =
|
||||
@Tag(name = "RPC 服务 - 机台")
|
||||
public interface MachineApi {
|
||||
|
||||
String PREFIX = ApiConstants.PREFIX + "/machine";
|
||||
|
||||
@GetMapping(PREFIX + "/get-cutting")
|
||||
@Operation(summary = "获得开料机台信息")
|
||||
@Parameter(name = "id", description = "机台id", example = "1024", required = true)
|
||||
CommonResult<CuttingRespDTO> getCutting(@RequestParam("id") Long id);
|
||||
|
||||
|
||||
@GetMapping(PREFIX + "/get-drill")
|
||||
@Operation(summary = "获得钻孔机台信息")
|
||||
@Parameter(name = "id", description = "机台id", example = "1024", required = true)
|
||||
CommonResult<CuttingRespDTO> getDrill(@RequestParam("id") Long id);
|
||||
|
||||
|
||||
@GetMapping(PREFIX + "/list")
|
||||
@Operation(summary = "获得机台基本信息列表")
|
||||
@Parameter(name = "ids", description = "机台id", example = "1024", required = true)
|
||||
CommonResult<List<CuttingRespDTO>> list(@RequestParam("ids") Collection<Long> ids);
|
||||
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.cf.imes.module.system.api.machine.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 机台 Response VO")
|
||||
@Data
|
||||
public class CuttingRespDTO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "14092")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "1机台设备 2CNC设备", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
private Integer machineType;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
package com.cf.imes.module.system.api.machine;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||
import com.cf.imes.module.system.api.machine.dto.CuttingRespDTO;
|
||||
import com.cf.imes.module.system.controller.admin.machine.vo.CuttingRespVO;
|
||||
import com.cf.imes.module.system.service.machine.MachineService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static com.cf.imes.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||
@Validated
|
||||
public class MachineApiImpl implements MachineApi {
|
||||
|
||||
@Resource
|
||||
private MachineService machineService;
|
||||
|
||||
@Override
|
||||
public CommonResult<CuttingRespDTO> getCutting(Long id) {
|
||||
return success(BeanUtils.toBean(machineService.getCutting(id), CuttingRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<CuttingRespDTO> getDrill(Long id) {
|
||||
return success(BeanUtils.toBean(machineService.getDrill(id), CuttingRespDTO.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<CuttingRespDTO>> list(Collection<Long> ids) {
|
||||
return success(BeanUtils.toBean(machineService.list(ids), CuttingRespDTO.class));
|
||||
}
|
||||
}
|
||||
+2
@@ -68,4 +68,6 @@ public interface MachineService {
|
||||
void batchDeleteDrill(List<Long> ids);
|
||||
|
||||
DrillRespVO getDrill(Long id);
|
||||
|
||||
List<MachineDO> list(Collection<Long> ids);
|
||||
}
|
||||
+5
@@ -222,6 +222,11 @@ public class MachineServiceImpl implements MachineService {
|
||||
return respVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MachineDO> list(Collection<Long> ids) {
|
||||
return machineMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
private void validateExists(Long id) {
|
||||
if (machineMapper.selectById(id) == null) {
|
||||
throw exception(MACHINE_NOT_EXISTS);
|
||||
|
||||
Reference in New Issue
Block a user