提交 bcf00ac4 authored 作者: zjm's avatar zjm

修改了job的状态模块

上级 e59e6093
流水线 #125 已失败 于阶段
...@@ -43,31 +43,25 @@ public class ScController { ...@@ -43,31 +43,25 @@ public class ScController {
public ResponseEntity<JobResponse> add(@RequestBody ScRo scRo public ResponseEntity<JobResponse> add(@RequestBody ScRo scRo
) { ) {
String saveId = scoreCoefficientService.add(scRo.toDb()); String saveId = scoreCoefficientService.add(scRo.toDb());
businessTreeManagement.saveAction(scRo.getUserId(),scRo.getWorkId(),Action.APPRAISAL_WORD,new Date()," 自我评价"); businessTreeManagement.saveAction(scRo.getUserId(),scRo.getWorkId(),Action.APPRAISAL_WORD,new Date(),"自我评价");
return ok(new JobResponse(saveId)); return ok(new JobResponse(saveId));
} }
@PostMapping("/select") @PostMapping("/select")
@ApiOperation(value = "新增考评信息.", notes = "新增不可在数据中附带id.成功时返回新增数据保存的id.") @ApiOperation(value = "查看考评信息.", notes = "查看考评信息")
public ResponseEntity<ScoreCoefficient> add1(@RequestParam String workId public ResponseEntity<ScoreCoefficient> add1(@RequestParam String workId
) { ) {
return ok(scoreCoefficientService.findById(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,
@RequestParam String userId) { @RequestParam String userId,
ScoreCoefficient scoreCoefficient1= scoreCoefficientService.findById(scoreCoefficient.getId()); @RequestParam String msg) {
String saveId = scoreCoefficientService.modify(scoreCoefficient); String saveId = scoreCoefficientService.modify(scoreCoefficient);
if (scoreCoefficient1.getScore2()==null || "".equals(scoreCoefficient1.getScore2())){ businessTreeManagement.saveAction(userId,scoreCoefficient.getWordId(),Action.APPRAISAL_WORD,new Date(),msg);
businessTreeManagement.saveAction(userId,scoreCoefficient.getWordId(),Action.APPRAISAL_WORD,new Date()," 发布者评价");
}else {
businessTreeManagement.saveAction(userId, scoreCoefficient.getWordId(), Action.APPRAISAL_WORD, new Date(), " 修改发布者评价");
}
return ok(new JobResponse(saveId)); return ok(new JobResponse(saveId));
} }
......
...@@ -50,7 +50,6 @@ public class WorkController { ...@@ -50,7 +50,6 @@ public class WorkController {
@GetMapping(value = "/{workId}") @GetMapping(value = "/{workId}")
@ApiOperation(value = "根据id查询工作.", notes = "在路径中指定要查询的工作id.") @ApiOperation(value = "根据id查询工作.", notes = "在路径中指定要查询的工作id.")
public ResponseEntity<WorkVo> findById(@PathVariable String workId) { public ResponseEntity<WorkVo> findById(@PathVariable String workId) {
...@@ -199,4 +198,11 @@ public class WorkController { ...@@ -199,4 +198,11 @@ public class WorkController {
return ok(workService.selectUserIdsWork(userId)); return ok(workService.selectUserIdsWork(userId));
} }
@GetMapping(value = "/select/work/workId/{workId}")
@ApiModelProperty(value = "根据任务id查询这个任务所在任务组里面",notes = "查看任务的所有相关任务")
public ResponseEntity<WorkMpping> selectWorkMappingWorkId(@PathVariable("workId") String workId){
return ok(workService.selectWorkMapperWorkId(workId));
}
} }
...@@ -32,20 +32,26 @@ public class ScoreCoefficient { ...@@ -32,20 +32,26 @@ public class ScoreCoefficient {
private String score1; private String score1;
/** /**
* 自评评语 * 组长评分
*/ */
@ApiModelProperty(value = "自评评语", example = "comments1") @ApiModelProperty(value = "组长评分", example = "groupLeaderScore2")
private String comments1; private String groupLeaderScore2;
/** /**
* 发布者评价 * 总监评分
*/ */
@ApiModelProperty(value = "发布者评价", example = "score2") @ApiModelProperty(value = "总监评分", example = "directorScore2")
private String score2; private String directorScore2;
/** /**
* 发布者评语 * 副总经理评分
*/ */
@ApiModelProperty(value = "发布者评语", example = "comments2") @ApiModelProperty(value = "副总经理评分", example = "viceScore2")
private String comments2; private String viceScore3;
/**
* 总经理评分
*/
@ApiModelProperty(value = "正总经理评分", example = "justScore4")
private String justScore4;
/** /**
* 最终工作量 * 最终工作量
*/ */
......
...@@ -103,9 +103,15 @@ public class Work { ...@@ -103,9 +103,15 @@ public class Work {
* 执行者id * 执行者id
*/ */
@NotNull @NotNull
@ApiModelProperty(value = "组长id.", example = "id") @ApiModelProperty(value = "组长id.", example = "executor")
private String executor; private String executor;
/**
* 审核者id
*/
@ApiModelProperty(value = "审核者.", example = "audit")
private String audit;
/** /**
* 组员id集合 * 组员id集合
*/ */
...@@ -166,5 +172,22 @@ public class Work { ...@@ -166,5 +172,22 @@ public class Work {
@NotNull @NotNull
private int workloadCount=1; private int workloadCount=1;
/**
* 总监
*/
@ApiModelProperty(value = "总监id集合",example = "[1,2,3]")
private List<String> majordomos;
/**
* 总经理id集合
*/
@ApiModelProperty(value = "总经理id集合",example = "[1,2,3]")
private List<String> generalManagers;
/**
* 副经理id集合
*/
@ApiModelProperty(value = "副经理id集合",example = "[1,2,3]")
private List<String> assistantManagers;
} }
...@@ -31,30 +31,35 @@ public class ScRo { ...@@ -31,30 +31,35 @@ public class ScRo {
private String score1; private String score1;
/** /**
* 自评评语 * 组长评分
*/ */
@ApiModelProperty(value = "自评评语", example = "comments1") @ApiModelProperty(value = "组长评分", example = "groupLeaderScore2")
private String comments1; private String groupLeaderScore2;
/** /**
* 发布者评价 * 总监评分
*/ */
@ApiModelProperty(value = "发布者评价", example = "score2") @ApiModelProperty(value = "总监评分", example = "directorScore2")
private String score2; private String directorScore2;
/** /**
* 发布者评语 * 副总经理评分
*/ */
@ApiModelProperty(value = "发布者评语", example = "comments2") @ApiModelProperty(value = "副总经理评分", example = "viceScore2")
private String comments2; private String viceScore3;
/**
* 总经理评分
*/
@ApiModelProperty(value = "正总经理评分", example = "justScore4")
private String justScore4;
/** /**
* 最终工作量 * 最终工作量
*/ */
@ApiModelProperty(value = "最终工作量", example = "endWorkLoad") @ApiModelProperty(value = "最终工作量", example = "endWorkLoad")
private Double endWorkLoad; private Double endWorkLoad;
@ApiModelProperty(value = "用户id", example = "userId") @ApiModelProperty(value = "用户id", example = "userId")
private String userId; private String userId;
public ScoreCoefficient toDb(){ public ScoreCoefficient toDb(){
return new ScoreCoefficient(id,workId,score1,comments1,score2,comments2,endWorkLoad); return new ScoreCoefficient(id,workId,score1,groupLeaderScore2,directorScore2,viceScore3,justScore4,endWorkLoad);
} }
} }
...@@ -147,9 +147,29 @@ public class WorkVo { ...@@ -147,9 +147,29 @@ public class WorkVo {
private int workloadCount=1; private int workloadCount=1;
/**
* 审核者id
*/
@ApiModelProperty(value = "审核者.", example = "audit")
private User audit;
/**
* 总监
*/
@ApiModelProperty(value = "总监id集合",example = "[1,2,3]")
private List<User> majordomos;
/**
* 总经理id集合
*/
@ApiModelProperty(value = "总经理id集合",example = "[1,2,3]")
private List<User> generalManagers;
/** /**
* 主任务对象 * 副经理id集合
*/ */
@ApiModelProperty(value = "主任务对象") @ApiModelProperty(value = "副经理id集合",example = "[1,2,3]")
private Work workVos; private List<User> assistantManagers;
} }
...@@ -10,6 +10,6 @@ import java.util.List; ...@@ -10,6 +10,6 @@ import java.util.List;
public interface ScoreCoefficientRepository extends MongoRepository<ScoreCoefficient, String> { public interface ScoreCoefficientRepository extends MongoRepository<ScoreCoefficient, String> {
List<ScoreCoefficient> findByWordId(String workId); List<ScoreCoefficient> findByWordId(String workId);
List<ScoreCoefficient> findByScore2IsNot(); // List<ScoreCoefficient> findByScore2IsNot();
} }
...@@ -148,6 +148,11 @@ public interface WorkService { ...@@ -148,6 +148,11 @@ public interface WorkService {
List<WorkMpping> selectUserIdsWork(String userId); List<WorkMpping> selectUserIdsWork(String userId);
/**
* 根据任务id查看其所有相关的任务
* @param workId 任务id
* @return 返回所有任务
*/
WorkMpping selectWorkMapperWorkId(String workId);
} }
...@@ -34,6 +34,7 @@ public class ConversionServiceImpl implements ConversionService { ...@@ -34,6 +34,7 @@ public class ConversionServiceImpl implements ConversionService {
User pUser=iUserService.findUserById(work.getPublisher()); User pUser=iUserService.findUserById(work.getPublisher());
User eUser=iUserService.findUserById(work.getExecutor()); User eUser=iUserService.findUserById(work.getExecutor());
User aUser=iUserService.findUserById(work.getAudit());
List<User> users=new ArrayList<>(); List<User> users=new ArrayList<>();
List<String> uid=work.getCrewList(); List<String> uid=work.getCrewList();
List<Attachment> attachments=new ArrayList<>(); List<Attachment> attachments=new ArrayList<>();
...@@ -77,7 +78,10 @@ public class ConversionServiceImpl implements ConversionService { ...@@ -77,7 +78,10 @@ public class ConversionServiceImpl implements ConversionService {
work.getWorkCoefficient(), work.getWorkCoefficient(),
work.getPWorkload(), work.getPWorkload(),
work.getWorkloadCount(), work.getWorkloadCount(),
null aUser,
selectUserIdAll(work.getMajordomos()),
selectUserIdAll(work.getGeneralManagers()),
selectUserIdAll(work.getAssistantManagers())
); );
}else { }else {
return new WorkVo( return new WorkVo(
...@@ -101,8 +105,15 @@ public class ConversionServiceImpl implements ConversionService { ...@@ -101,8 +105,15 @@ public class ConversionServiceImpl implements ConversionService {
work.getWorkCoefficient(), work.getWorkCoefficient(),
work.getPWorkload(), work.getPWorkload(),
work.getWorkloadCount(), work.getWorkloadCount(),
priviceService.findByWorkIdWorkVo(work.getSuperiorId())); aUser,
selectUserIdAll(work.getMajordomos()),
selectUserIdAll(work.getGeneralManagers()),
selectUserIdAll(work.getAssistantManagers()));
} }
} }
private List<User> selectUserIdAll(List<String> list){
return iUserService.findUserByIds(list);
}
} }
...@@ -73,7 +73,7 @@ public class ScoreCoefficientServiceImpl implements ScoreCoefficientService { ...@@ -73,7 +73,7 @@ public class ScoreCoefficientServiceImpl implements ScoreCoefficientService {
@Override @Override
public List<ScoreCoefficient> selectSorct2IsNull() { public List<ScoreCoefficient> selectSorct2IsNull() {
// scoreCoefficientRepository.findByScore2IsNot()
return scoreCoefficientRepository.findByScore2IsNot(); return null;
} }
} }
...@@ -16,6 +16,7 @@ import com.zjty.tynotes.job.common.constant.WorkStatus; ...@@ -16,6 +16,7 @@ import com.zjty.tynotes.job.common.constant.WorkStatus;
import com.zjty.tynotes.job.common.exception.BadRequestException; import com.zjty.tynotes.job.common.exception.BadRequestException;
import com.zjty.tynotes.job.common.exception.NotFoundException; import com.zjty.tynotes.job.common.exception.NotFoundException;
import com.zjty.tynotes.pas.entity.vo.HolidayRequest; import com.zjty.tynotes.pas.entity.vo.HolidayRequest;
import com.zjty.tynotes.pas.entity.vo.JobLeads;
import com.zjty.tynotes.pas.service.ConfigService; import com.zjty.tynotes.pas.service.ConfigService;
import com.zjty.tynotes.pas.service.IUserService; import com.zjty.tynotes.pas.service.IUserService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -71,8 +72,16 @@ public class WorkServiceImpl implements WorkService { ...@@ -71,8 +72,16 @@ public class WorkServiceImpl implements WorkService {
//新增数据不可附带id. //新增数据不可附带id.
Boolean idMustNull = isNull(work.getId()); Boolean idMustNull = isNull(work.getId());
if (idMustNull) { if (idMustNull) {
// if (work.getSuperiorId()==null ||work.getSuperiorId().equals("")){
// }else {
// work.setAudit(selectGroupId(work.getSuperiorId()));
// }
work.setCreateTime(new Date()); work.setCreateTime(new Date());
work.setUpdateTime(new Date()); work.setUpdateTime(new Date());
JobLeads jobLeads=iUserService.findJobLeads(work.getExecutor());
work.setMajordomos(jobLeads.getMajordomos());
work.setAssistantManagers(jobLeads.getAssistantManagers());
work.setGeneralManagers(jobLeads.getGeneralManagers());
String saveId = workRepository.save(work).getId(); String saveId = workRepository.save(work).getId();
log.info(String.format("[job] 新增了id为 %s 的数据.", saveId)); log.info(String.format("[job] 新增了id为 %s 的数据.", saveId));
return saveId; return saveId;
...@@ -83,6 +92,14 @@ public class WorkServiceImpl implements WorkService { ...@@ -83,6 +92,14 @@ public class WorkServiceImpl implements WorkService {
} }
} }
private String selectGroupId(String id){
Work work=workRepository.findById(id).get();
String workId=work.getSuperiorId();
if (workId==null || "".equals(workId)){
return work.getExecutor();
}
return selectGroupId(workId);
}
@Override @Override
public String modify(Work work) { public String modify(Work work) {
//更新数据必须指定id且指定id的数据存在. //更新数据必须指定id且指定id的数据存在.
...@@ -194,7 +211,7 @@ public class WorkServiceImpl implements WorkService { ...@@ -194,7 +211,7 @@ public class WorkServiceImpl implements WorkService {
ScoreCoefficient scoreCoefficient= scoreCoefficientService.findById(workId); ScoreCoefficient scoreCoefficient= scoreCoefficientService.findById(workId);
int workLoad= findBySuperoirIdCount(workId); int workLoad= findBySuperoirIdCount(workId);
DecimalFormat df=new DecimalFormat("#.##"); DecimalFormat df=new DecimalFormat("#.##");
double coefficient= (Double.parseDouble(scoreCoefficient.getScore1())+Double.parseDouble(scoreCoefficient.getScore2()))/2.0/100.0; double coefficient= Double.parseDouble(scoreCoefficient.getJustScore4());
double getWorkLoad=workLoad*coefficient; double getWorkLoad=workLoad*coefficient;
scoreCoefficient.setEndWorkLoad(Double.valueOf(df.format(getWorkLoad))); scoreCoefficient.setEndWorkLoad(Double.valueOf(df.format(getWorkLoad)));
scoreCoefficientService.modify(scoreCoefficient); scoreCoefficientService.modify(scoreCoefficient);
...@@ -331,6 +348,35 @@ return 0.0f; ...@@ -331,6 +348,35 @@ return 0.0f;
return workMppings; return workMppings;
} }
@Override
public WorkMpping selectWorkMapperWorkId(String workId) {
Work work= workRepository.findById(sumWorkId(workId)).get();
return new WorkMpping(work.getId(),work.getTitle(),work.getStatus(),iUserService.findUserById(work.getPublisher()).getUsername(),iUserService.findUserById(work.getExecutor()).getUsername(),selectWorkMapper(work.getId()));
}
private List<WorkMpping> selectWorkMapper(String workId){
List<WorkMpping> workMppings=new ArrayList<>();
List<Work> works= workRepository.findBySuperiorId(workId);
if (works.size()==0){
return workMppings;
}
for (Work work:works){
if (work.getSuperiorId()!=null || work.getSuperiorId().equals("")){
workMppings.add(new WorkMpping(work.getId(),work.getTitle(),work.getStatus(),iUserService.findUserById(work.getPublisher()).getUsername(),iUserService.findUserById(work.getExecutor()).getUsername(),selectWorkMapper(work.getId())));
}
}
return workMppings;
}
private String sumWorkId(String workId){
Work work= workRepository.findById(workId).get();
if (work.getSuperiorId()==null ||work.getSuperiorId().equals("")){
return workId;
}
return sumWorkId(work.getSuperiorId());
}
private List<WorkMpping> workMppingList(Work work,List<Work> workList){ private List<WorkMpping> workMppingList(Work work,List<Work> workList){
List<WorkMpping> workMppings=new ArrayList<>(); List<WorkMpping> workMppings=new ArrayList<>();
......
...@@ -42,7 +42,7 @@ public interface TestService { ...@@ -42,7 +42,7 @@ public interface TestService {
/** /**
* *
*/ */
void appraisal(String executorId, String latestNews, Work work); void appraisal(String executorId, String latestNews, Work work,int count);
/** /**
* 修改任务状态 * 修改任务状态
* @param executorId 操作人id * @param executorId 操作人id
......
...@@ -180,11 +180,31 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement { ...@@ -180,11 +180,31 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement {
break; break;
case 9: case 9:
String actionMsg = name +msg; String actionMsg = name +" "+msg;
actionHistory.setActionMsg(actionMsg); actionHistory.setActionMsg(actionMsg);
actionHistoryRepository.save(actionHistory); actionHistoryRepository.save(actionHistory);
testService.appraisal(noteResource.getId(),actionMsg,work); int count=1;
switch (msg){
case "自我评价":
break;
case "组长评价":
count=2;
break;
case "总监评价":
count=3;
break;
case "副总经理评价":
count=4;
break;
case "总经理评价":
count=5;
break;
case "修改评价":
count=6;
break;
}
testService.appraisal(noteResource.getId(),actionMsg,work,count);
log.info("[TREE] {}对任务评价了", name); log.info("[TREE] {}对任务评价了", name);
break; break;
......
package com.zjty.tynotes.job.task; //package com.zjty.tynotes.job.task;
//
import com.zjty.tynotes.job.basic.entity.database.Work; //import com.zjty.tynotes.job.basic.entity.database.Work;
import com.zjty.tynotes.job.basic.service.ScoreCoefficientService; //import com.zjty.tynotes.job.basic.service.ScoreCoefficientService;
import com.zjty.tynotes.job.basic.service.WorkService; //import com.zjty.tynotes.job.basic.service.WorkService;
import com.zjty.tynotes.job.common.Action; //import com.zjty.tynotes.job.common.Action;
import com.zjty.tynotes.job.common.constant.WorkStatus; //import com.zjty.tynotes.job.common.constant.WorkStatus;
import com.zjty.tynotes.job.status.service.BusinessTreeManagement; //import com.zjty.tynotes.job.status.service.BusinessTreeManagement;
import lombok.extern.slf4j.Slf4j; //import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; //import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; //import org.springframework.stereotype.Service;
//
import java.time.LocalDateTime; //import java.time.LocalDateTime;
import java.time.ZoneOffset; //import java.time.ZoneOffset;
import java.util.Date; //import java.util.Date;
//
@Slf4j //@Slf4j
@Service //@Service
public class Task { //public class Task {
@Autowired // @Autowired
ScoreCoefficientService scoreCoefficientService; // ScoreCoefficientService scoreCoefficientService;
@Autowired // @Autowired
WorkService workService; // WorkService workService;
@Autowired // @Autowired
BusinessTreeManagement businessTreeManagement; // BusinessTreeManagement businessTreeManagement;
//
@Scheduled(cron ="0 0 0 * * ?") // @Scheduled(cron ="0 0 0 * * ?")
public void task() { // public void task() {
//
long time=LocalDateTime.now().minusDays(7) // long time=LocalDateTime.now().minusDays(7)
.withHour(0) // .withHour(0)
.withMinute(0) // .withMinute(0)
.withSecond(0) // .withSecond(0)
.withNano(0) // .withNano(0)
.atOffset(ZoneOffset.ofHours(8)) // .atOffset(ZoneOffset.ofHours(8))
.toEpochSecond(); // .toEpochSecond();
//
//
scoreCoefficientService.selectSorct2IsNull() // scoreCoefficientService.selectSorct2IsNull()
.forEach( // .forEach(
sc->{ // sc->{
Work work= workService.findById(sc.getWordId()); // Work work= workService.findById(sc.getWordId());
if (work.getAuditTime().getTime()<time){ // if (work.getAuditTime().getTime()<time){
sc.setScore2(sc.getScore1()); //// sc.setScore2(sc.getScore1());
scoreCoefficientService.modify(sc); // scoreCoefficientService.modify(sc);
businessTreeManagement.saveAction(work.getPublisher(),sc.getWordId(),Action.APPRAISAL_WORD,new Date(),""); // businessTreeManagement.saveAction(work.getPublisher(),sc.getWordId(),Action.APPRAISAL_WORD,new Date(),"");
workService.alterTaskStatus(sc.getWordId(),WorkStatus.FINISHED,work.getPublisher()); // workService.alterTaskStatus(sc.getWordId(),WorkStatus.FINISHED,work.getPublisher());
businessTreeManagement.saveAction(work.getPublisher(), sc.getWordId(), Action.FINISHED_WORK, new Date(), ""); // businessTreeManagement.saveAction(work.getPublisher(), sc.getWordId(), Action.FINISHED_WORK, new Date(), "");
} // }
//
} // }
); // );
} // }
} //}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论