diff --git a/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/controller/CoalWashingDailyAnalysisController.java b/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/controller/CoalWashingDailyAnalysisController.java index e90510dd..7b606b71 100644 --- a/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/controller/CoalWashingDailyAnalysisController.java +++ b/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/controller/CoalWashingDailyAnalysisController.java @@ -51,6 +51,21 @@ public class CoalWashingDailyAnalysisController extends BaseController { return this.service.update(dto); } + + @PostMapping("/updateKfItems") + @SysLog(action = "编辑") + public CoalWashingDailyAnalysisDto updateKfItems(@RequestBody UpdateCoalWashingDailyAnalysisDto dto) { + return this.service.updateKfItems(dto); + } + + + + @PostMapping("/updateMain") + @SysLog(action = "编辑") + public CoalWashingDailyAnalysisDto updateMain(@RequestBody UpdateCoalWashingDailyAnalysisDto dto) { + return this.service.updateKfItems(dto); + } + @PostMapping("/delete") @SysLog(action = "删除") public Object delete(@RequestBody IdRequest dto) { diff --git a/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/service/CoalWashingDailyAnalysisService.java b/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/service/CoalWashingDailyAnalysisService.java index 8f744557..81f734dd 100644 --- a/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/service/CoalWashingDailyAnalysisService.java +++ b/src/main/java/cn/lihongjie/coal/coalWashingDailyAnalysis/service/CoalWashingDailyAnalysisService.java @@ -8,6 +8,7 @@ import cn.lihongjie.coal.coalWashingDailyAnalysis.dto.CoalWashingDailyAnalysisDt import cn.lihongjie.coal.coalWashingDailyAnalysis.dto.CreateCoalWashingDailyAnalysisDto; import cn.lihongjie.coal.coalWashingDailyAnalysis.dto.UpdateCoalWashingDailyAnalysisDto; import cn.lihongjie.coal.coalWashingDailyAnalysis.entity.CoalWashingDailyAnalysisEntity; +import cn.lihongjie.coal.coalWashingDailyAnalysis.entity.CoalWashingDailyAnalysisKFItemVo; import cn.lihongjie.coal.coalWashingDailyAnalysis.mapper.CoalWashingDailyAnalysisMapper; import cn.lihongjie.coal.coalWashingDailyAnalysis.mapper.RoundMapper; import cn.lihongjie.coal.coalWashingDailyAnalysis.repository.CoalWashingDailyAnalysisRepository; @@ -124,6 +125,71 @@ public class CoalWashingDailyAnalysisService return getById(entity.getId()); } + + + public CoalWashingDailyAnalysisDto updateKfItems(UpdateCoalWashingDailyAnalysisDto request) { + + CoalWashingDailyAnalysisEntity entity = this.repository.get(request.getId()); + + if (this.repository.containArchived(request.getId())) { + throw new BizException("部分数据已归档,无法编辑或删除"); + } + + + + entity.setKfItems(request.getKfItems()); + + entity.setOrganizationId(Ctx.currentUser().getOrganizationId()); + + validate(entity); + if (entity.getProduct() != null) { + + entity.setName(productService.get(entity.getProduct().getId()).getName()); + } + this.repository.save(entity); + + return getById(entity.getId()); + } + + + + public CoalWashingDailyAnalysisDto updateMain(UpdateCoalWashingDailyAnalysisDto request) { + + CoalWashingDailyAnalysisEntity entity = this.repository.get(request.getId()); + List kfItems = entity.getKfItems(); + + if (this.repository.containArchived(request.getId())) { + throw new BizException("部分数据已归档,无法编辑或删除"); + } + this.mapper.updateEntity(entity, request); + + + entity.setKfItems(kfItems); + + entity.setOrganizationId(Ctx.currentUser().getOrganizationId()); + + validate(entity); + if (entity.getProduct() != null) { + + entity.setName(productService.get(entity.getProduct().getId()).getName()); + } + this.repository.save(entity); + + return getById(entity.getId()); + } + + + + + + + + + + + + + public void delete(IdRequest request) { if (this.repository.containArchived(request)) {