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

1

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