提交 54bf77fb authored 作者: zjm's avatar zjm

1

上级 d554338d
流水线 #50 已取消 于阶段
......@@ -47,6 +47,15 @@ public class ScController {
return ok(new JobResponse(saveId));
}
@PostMapping("/select")
@ApiOperation(value = "新增考评信息.", notes = "新增不可在数据中附带id.成功时返回新增数据保存的id.")
public ResponseEntity<ScoreCoefficient> add1(@RequestParam String workId
) {
return ok(scoreCoefficientService.findById(workId));
}
@PutMapping("/upDate")
@ApiOperation(value = "考评信息修改.", notes = "修改必须在数据中附带id.")
public ResponseEntity<JobResponse> modify(@RequestBody ScoreCoefficient scoreCoefficient,
......
......@@ -3,8 +3,11 @@ package com.zjty.tynotes.job.basic.repository;
import com.zjty.tynotes.job.basic.entity.database.ScoreCoefficient;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface ScoreCoefficientRepository extends MongoRepository<ScoreCoefficient, String> {
ScoreCoefficient findByWordId(String workId);
List<ScoreCoefficient> findByWordId(String workId);
}
......@@ -33,7 +33,7 @@ public interface ScoreCoefficientService {
/**
* 查找指定id的Work
* 查找指定id的考评信息
*
* @param id 指定id
* @return ScoreCoefficient 对象
......
......@@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Optional;
import static java.util.Objects.isNull;
......@@ -59,7 +60,14 @@ public class ScoreCoefficientServiceImpl implements ScoreCoefficientService {
@Override
public ScoreCoefficient findById(String id) {
Optional<ScoreCoefficient> scoreOptional = scoreCoefficientRepository.findById(id);
return scoreOptional.orElseThrow(() -> new BadRequestException(String.format("[job] 考评id为 %s 的数据不存在.", id)));
List<ScoreCoefficient> scoreCoefficients= scoreCoefficientRepository.findByWordId(id);
if (scoreCoefficients.size()==0){
String msg = "[job] 没有考评信息";
log.error(msg);
throw new BadRequestException(msg);
}else {
return scoreCoefficients.get(0);
}
}
}
......@@ -180,7 +180,7 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement {
break;
case 9:
ScoreCoefficient scoreCoefficient= scoreCoefficientRepository.findByWordId(noteResource.getTaskId());
ScoreCoefficient scoreCoefficient= scoreCoefficientRepository.findByWordId(noteResource.getTaskId()).get(0);
String actionMsg="";
if (scoreCoefficient.getScore1()!=null){
actionMsg=name+"对任务进行了自我评价";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论