24 changed files with 564 additions and 341 deletions
-
106src/main/java/com/iflytop/gd/app/controller/CraftsController.java
-
74src/main/java/com/iflytop/gd/app/controller/OresController.java
-
2src/main/java/com/iflytop/gd/app/core/CraftsContext.java
-
8src/main/java/com/iflytop/gd/app/mapper/CraftsMapper.java
-
4src/main/java/com/iflytop/gd/app/mapper/OresMapper.java
-
11src/main/java/com/iflytop/gd/app/model/dto/PauseCraftsDto.java
-
11src/main/java/com/iflytop/gd/app/model/dto/ResumeCraftsDto.java
-
13src/main/java/com/iflytop/gd/app/model/dto/StartCraftsDTO.java
-
11src/main/java/com/iflytop/gd/app/model/dto/StopCraftsDto.java
-
2src/main/java/com/iflytop/gd/app/model/entity/Crafts.java
-
2src/main/java/com/iflytop/gd/app/model/entity/Ores.java
-
4src/main/java/com/iflytop/gd/app/model/vo/OresCraftsListVO.java
-
17src/main/java/com/iflytop/gd/app/service/CraftsService.java
-
145src/main/java/com/iflytop/gd/app/service/CraftsStepService.java
-
20src/main/java/com/iflytop/gd/app/service/OresService.java
-
2src/main/java/com/iflytop/gd/system/common/result/ResultCode.java
-
23src/main/resources/sql/init.sql
@ -0,0 +1,106 @@ |
|||
package com.iflytop.gd.app.controller; |
|||
|
|||
import com.iflytop.gd.app.model.dto.PauseCraftsDto; |
|||
import com.iflytop.gd.app.model.dto.ResumeCraftsDto; |
|||
import com.iflytop.gd.app.model.dto.StartCraftsDTO; |
|||
import com.iflytop.gd.app.model.dto.StopCraftsDto; |
|||
import com.iflytop.gd.app.service.CraftsStepService; |
|||
import com.iflytop.gd.system.common.result.Result; |
|||
import com.iflytop.gd.system.common.result.ResultCode; |
|||
import com.iflytop.gd.app.model.entity.Crafts; |
|||
import com.iflytop.gd.app.service.CraftsService; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
import io.swagger.v3.oas.annotations.Parameter; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Tag(name = "工艺管理") |
|||
@RestController |
|||
@RequestMapping("/api/crafts") |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
public class CraftsController { |
|||
private final CraftsService craftsService; |
|||
private final CraftsStepService craftsStepService; |
|||
|
|||
@Operation(summary = "根据矿石id获取工艺列表") |
|||
@GetMapping("/list/{oresId}") |
|||
public Result<List<Crafts>> getAllCrafts(@Parameter(description = "矿石ID") @PathVariable Long oresId) { |
|||
List<Crafts> craftList = craftsService.selectAllByOresId(oresId); |
|||
return Result.success(craftList); |
|||
} |
|||
|
|||
@Operation(summary = "添加新工艺") |
|||
@PostMapping("/") |
|||
public Result<String> addCrafts(@RequestBody Crafts crafts) { |
|||
Crafts existingCrafts = craftsService.findByName(crafts.getName()); |
|||
if (existingCrafts == null) { |
|||
boolean isSuccess = craftsService.addCrafts(crafts); |
|||
if (isSuccess) { |
|||
return Result.success(); |
|||
} |
|||
} else { |
|||
return Result.failed(ResultCode.DATA_ALREADY_EXISTS); |
|||
} |
|||
return Result.failed(); |
|||
} |
|||
|
|||
@Operation(summary = "更新工艺") |
|||
@PutMapping("/{id}") |
|||
public Result<String> updateCrafts(@PathVariable Long id, @RequestBody Crafts crafts) { |
|||
crafts.setId(id); |
|||
boolean isSuccess = craftsService.updateCrafts(crafts); |
|||
if (isSuccess) { |
|||
return Result.success(); |
|||
} |
|||
return Result.failed(); |
|||
} |
|||
|
|||
@Operation(summary = "删除工艺") |
|||
@DeleteMapping("/{ids}") |
|||
public Result<String> deleteCrafts(@Parameter(description = "工艺ID,多个以英文逗号(,)分割") @PathVariable String ids) { |
|||
boolean isSuccess = craftsService.deleteCrafts(ids); |
|||
if (isSuccess) { |
|||
return Result.success(); |
|||
} |
|||
return Result.failed(); |
|||
} |
|||
|
|||
@Operation(summary = "开始执行工艺") |
|||
@PostMapping("/start") |
|||
public Result<String> startCrafts(@RequestBody StartCraftsDTO startCraftsDTO) { |
|||
boolean isSuccess = craftsStepService.startCrafts(startCraftsDTO.getCraftId(), startCraftsDTO.getHeatId()); |
|||
if (isSuccess) { |
|||
return Result.success(); |
|||
} |
|||
return Result.failed(); |
|||
} |
|||
|
|||
@Operation(summary = "暂停执行工艺") |
|||
@PostMapping("/pause") |
|||
public Result<String> pauseCrafts(@RequestBody PauseCraftsDto pauseCraftsDto) { |
|||
craftsStepService.pauseCrafts(pauseCraftsDto.getHeatId()); |
|||
return Result.success(); |
|||
} |
|||
|
|||
@Operation(summary = "恢复执行工艺") |
|||
@PostMapping("/resume") |
|||
public Result<String> resumeCrafts(@RequestBody ResumeCraftsDto resumeCraftsDto) { |
|||
craftsStepService.resumeCrafts(resumeCraftsDto.getHeatId()); |
|||
return Result.success(); |
|||
} |
|||
|
|||
@Operation(summary = "停止执行工艺") |
|||
@PostMapping("/stop") |
|||
public Result<String> stopCrafts(@RequestBody StopCraftsDto stopCraftsDto) { |
|||
boolean isSuccess = craftsStepService.stopCrafts(stopCraftsDto.getHeatId()); |
|||
if (isSuccess) { |
|||
return Result.success(); |
|||
} |
|||
return Result.failed(); |
|||
} |
|||
} |
@ -0,0 +1,74 @@ |
|||
package com.iflytop.gd.app.controller; |
|||
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.iflytop.gd.app.model.entity.Ores; |
|||
import com.iflytop.gd.app.model.vo.OresCraftsListVO; |
|||
import com.iflytop.gd.system.common.base.BasePageQuery; |
|||
import com.iflytop.gd.system.common.result.PageResult; |
|||
import com.iflytop.gd.app.service.OresService; |
|||
import com.iflytop.gd.system.common.result.Result; |
|||
import com.iflytop.gd.system.common.result.ResultCode; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
import io.swagger.v3.oas.annotations.Parameter; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import lombok.RequiredArgsConstructor; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
@Tag(name = "矿石管理") |
|||
@RestController |
|||
@RequestMapping("/api/ores") |
|||
@RequiredArgsConstructor |
|||
@Slf4j |
|||
public class OresController { |
|||
private final OresService oresService; |
|||
|
|||
@Operation(summary = "矿石工艺列表") |
|||
@GetMapping("/list") |
|||
public PageResult<OresCraftsListVO> getAllOres(BasePageQuery pageQuery) { |
|||
IPage<OresCraftsListVO> result = oresService.getPage(pageQuery); |
|||
return PageResult.success(result); |
|||
} |
|||
|
|||
@Operation(summary = "添加新矿石") |
|||
@PostMapping("/") |
|||
public Result<String> addOres(@RequestBody Ores ores) { |
|||
Ores existingOres = oresService.findByName(ores.getName()); |
|||
if (existingOres == null) { |
|||
boolean isSuccess = oresService.addOres(ores); |
|||
if (isSuccess) { |
|||
return Result.success(); |
|||
} |
|||
} else { |
|||
return Result.failed(ResultCode.DATA_ALREADY_EXISTS); |
|||
} |
|||
return Result.failed(); |
|||
} |
|||
|
|||
@Operation(summary = "更新矿石") |
|||
@PutMapping("/{id}") |
|||
public Result<String> updateOres(@PathVariable Long id, @RequestBody Ores ores) { |
|||
Ores existingOres = oresService.findByName(ores.getName()); |
|||
if (existingOres == null) { |
|||
ores.setId(id); |
|||
boolean isSuccess = oresService.updateOres(ores); |
|||
if (isSuccess) { |
|||
return Result.success(); |
|||
} |
|||
} else { |
|||
return Result.failed(ResultCode.DATA_ALREADY_EXISTS); |
|||
} |
|||
return Result.failed(); |
|||
} |
|||
|
|||
@Operation(summary = "删除矿石") |
|||
@DeleteMapping("/{ids}") |
|||
public Result<String> deleteOres(@Parameter(description = "矿石ID,多个以英文逗号(,)分割") @PathVariable String ids) { |
|||
boolean isSuccess = oresService.deleteOres(ids); |
|||
if (isSuccess) { |
|||
return Result.success(); |
|||
} |
|||
return Result.failed(); |
|||
} |
|||
|
|||
} |
@ -1,7 +1,7 @@ |
|||
package com.iflytop.gd.system.mapper; |
|||
package com.iflytop.gd.app.mapper; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.iflytop.gd.system.model.entity.Ores; |
|||
import com.iflytop.gd.app.model.entity.Ores; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
/** |
@ -0,0 +1,11 @@ |
|||
package com.iflytop.gd.app.model.dto; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
|||
@Schema(description = "暂停执行工艺") |
|||
@Data |
|||
public class PauseCraftsDto { |
|||
@Schema(description = "加热区id") |
|||
private String heatId; |
|||
} |
@ -0,0 +1,11 @@ |
|||
package com.iflytop.gd.app.model.dto; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
|||
@Schema(description = "恢复执行工艺") |
|||
@Data |
|||
public class ResumeCraftsDto { |
|||
@Schema(description = "加热区id") |
|||
private String heatId; |
|||
} |
@ -0,0 +1,13 @@ |
|||
package com.iflytop.gd.app.model.dto; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
|||
@Schema(description = "开始工艺") |
|||
@Data |
|||
public class StartCraftsDTO { |
|||
@Schema(description = "工艺id") |
|||
private Long craftId; |
|||
@Schema(description = "加热区id") |
|||
private String heatId; |
|||
} |
@ -0,0 +1,11 @@ |
|||
package com.iflytop.gd.app.model.dto; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
|||
@Schema(description = "恢复执行工艺") |
|||
@Data |
|||
public class StopCraftsDto { |
|||
@Schema(description = "加热区id") |
|||
private String heatId; |
|||
} |
@ -1,4 +1,4 @@ |
|||
package com.iflytop.gd.system.model.entity; |
|||
package com.iflytop.gd.app.model.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.iflytop.gd.system.common.base.BaseEntity; |
@ -1,4 +1,4 @@ |
|||
package com.iflytop.gd.system.model.entity; |
|||
package com.iflytop.gd.app.model.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.iflytop.gd.system.common.base.BaseEntity; |
@ -1,7 +1,7 @@ |
|||
package com.iflytop.gd.system.model.vo; |
|||
package com.iflytop.gd.app.model.vo; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.iflytop.gd.system.model.entity.Crafts; |
|||
import com.iflytop.gd.app.model.entity.Crafts; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue