web: 添加确认处置计划功能

dev_2.0.0
xueqingkun 1 year ago
parent 56417e2fbf
commit fe0af29b27

@ -32,9 +32,9 @@ public class TreatmentPlanController {
@ApiOperation("确认处置计划")
@PostMapping("/confirm")
public boolean confirmTreatmentPlan(String processId) {
public boolean confirmTreatmentPlan(@RequestParam("processId") String processId,@RequestParam("status") String status) {
return treatmentPlanService.confirmTreatmentPlan(processId);
return treatmentPlanService.confirmTreatmentPlan(processId,status);
}
@ApiOperation("修改处置计划记录")

@ -13,5 +13,5 @@ public interface TreatmentPlanService {
boolean deleteTreatmentPlanRecord(String id);
boolean confirmTreatmentPlan(String processId);
boolean confirmTreatmentPlan(String processId,String status);
}

@ -1,6 +1,7 @@
package com.supervision.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Assert;
import com.supervision.model.Process;
import com.supervision.model.TreatmentPlanRecord;
@ -11,6 +12,7 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List;
@Slf4j
@ -59,15 +61,17 @@ public class TreatmentPlanServiceImpl implements TreatmentPlanService {
}
@Override
public boolean confirmTreatmentPlan(String processId) {
public boolean confirmTreatmentPlan(String processId, String status) {
Assert.isTrue(CollectionUtil.newArrayList("0","1","2").contains(status),"状态值有误");
Process process = processService.getById(processId);
Assert.notNull(process,"流程数据不存在");
Assert.notNull(process.getStatus(),"状态值有误");
if (process.getStatus().equals(2)){
if (Integer.valueOf(status).compareTo(process.getStatus()) <= 0){
return true;
}
process.setStatus(2);
process.setStatus(Integer.valueOf(status));
return processService.updateById(process);
}

Loading…
Cancel
Save