提交 05c20d1e authored 作者: gongwenjie's avatar gongwenjie

Merge branch 'master' of git.yfzx.zjtys.com.cn:zjm/notes2.0

......@@ -42,33 +42,32 @@ public class ScController {
@ApiOperation(value = "新增考评信息.", notes = "新增不可在数据中附带id.成功时返回新增数据保存的id.")
public ResponseEntity<JobResponse> add(@RequestBody ScRo scRo
) {
String saveId = scoreCoefficientService.add(scRo.toDb());
businessTreeManagement.saveAction(scRo.getUserId(),scRo.getWorkId(),Action.APPRAISAL_WORD,new Date()," 自我评价");
ScoreCoefficient scoreCoefficient= scRo.toDb();
scoreCoefficient.setTime(new Date());
String saveId = scoreCoefficientService.add(scoreCoefficient);
businessTreeManagement.saveAction(scRo.getUserId(),scRo.getWorkId(),Action.APPRAISAL_WORD,new Date(),"自我评价");
return ok(new JobResponse(saveId));
}
@PostMapping("/select")
@ApiOperation(value = "新增考评信息.", notes = "新增不可在数据中附带id.成功时返回新增数据保存的id.")
@ApiOperation(value = "查看考评信息.", notes = "查看考评信息")
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,
@RequestParam String userId) {
ScoreCoefficient scoreCoefficient1= scoreCoefficientService.findById(scoreCoefficient.getId());
String saveId = scoreCoefficientService.modify(scoreCoefficient);
if (scoreCoefficient1.getScore2()==null || "".equals(scoreCoefficient1.getScore2())){
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));
@RequestParam String userId,
@RequestParam String msg) {
if (!msg.equals("修改考评")){
scoreCoefficient.setTime(new Date());
}
String saveId = scoreCoefficientService.modify(scoreCoefficient);
businessTreeManagement.saveAction(userId,scoreCoefficient.getWordId(),Action.APPRAISAL_WORD,new Date(),msg);
return ok(new JobResponse(saveId));
}
......
......@@ -50,7 +50,6 @@ public class WorkController {
@GetMapping(value = "/{workId}")
@ApiOperation(value = "根据id查询工作.", notes = "在路径中指定要查询的工作id.")
public ResponseEntity<WorkVo> findById(@PathVariable String workId) {
......@@ -199,4 +198,11 @@ public class WorkController {
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));
}
}
......@@ -7,6 +7,8 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@AutoDocument
......@@ -32,23 +34,45 @@ public class ScoreCoefficient {
private String score1;
/**
* 自评评语
* 组长评分
*/
@ApiModelProperty(value = "组长评分", example = "groupLeaderScore2")
private String groupLeaderScore2;
/**
* 总监评分
*/
@ApiModelProperty(value = "自评评语", example = "comments1")
private String comments1;
@ApiModelProperty(value = "总监评分", example = "directorScore2")
private String directorScore2;
/**
* 发布者评价
* 副总经理评分
*/
@ApiModelProperty(value = "发布者评价", example = "score2")
private String score2;
@ApiModelProperty(value = "副总经理评分", example = "viceScore2")
private String viceScore3;
/**
* 发布者评语
* 总经理评分
*/
@ApiModelProperty(value = "发布者评语", example = "comments2")
private String comments2;
@ApiModelProperty(value = "正总经理评分", example = "justScore4")
private String justScore4;
/**
* 最终工作量
*/
@ApiModelProperty(value = "最终工作量", example = "endWorkLoad")
private Double endWorkLoad;
/**
* 考评的时间 每个阶段考评的时间 后一个阶段考评了 覆盖这个时间
*/
private Date time;
public ScoreCoefficient(String id, String wordId, String score1, String groupLeaderScore2, String directorScore2, String viceScore3, String justScore4, Double endWorkLoad) {
this.id = id;
this.wordId = wordId;
this.score1 = score1;
this.groupLeaderScore2 = groupLeaderScore2;
this.directorScore2 = directorScore2;
this.viceScore3 = viceScore3;
this.justScore4 = justScore4;
this.endWorkLoad = endWorkLoad;
}
}
......@@ -103,9 +103,15 @@ public class Work {
* 执行者id
*/
@NotNull
@ApiModelProperty(value = "组长id.", example = "id")
@ApiModelProperty(value = "组长id.", example = "executor")
private String executor;
/**
* 审核者id
*/
@ApiModelProperty(value = "审核者.", example = "audit")
private String audit;
/**
* 组员id集合
*/
......@@ -166,5 +172,22 @@ public class Work {
@NotNull
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 {
private String score1;
/**
* 自评评语
* 组长评分
*/
@ApiModelProperty(value = "自评评语", example = "comments1")
private String comments1;
@ApiModelProperty(value = "组长评分", example = "groupLeaderScore2")
private String groupLeaderScore2;
/**
* 发布者评价
* 总监评分
*/
@ApiModelProperty(value = "发布者评价", example = "score2")
private String score2;
@ApiModelProperty(value = "总监评分", example = "directorScore2")
private String directorScore2;
/**
* 发布者评语
* 副总经理评分
*/
@ApiModelProperty(value = "发布者评语", example = "comments2")
private String comments2;
@ApiModelProperty(value = "副总经理评分", example = "viceScore2")
private String viceScore3;
/**
* 总经理评分
*/
@ApiModelProperty(value = "正总经理评分", example = "justScore4")
private String justScore4;
/**
* 最终工作量
*/
@ApiModelProperty(value = "最终工作量", example = "endWorkLoad")
private Double endWorkLoad;
@ApiModelProperty(value = "用户id", example = "userId")
private String userId;
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 {
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 = "主任务对象")
private Work workVos;
@ApiModelProperty(value = "副经理id集合",example = "[1,2,3]")
private List<User> assistantManagers;
}
......@@ -10,6 +10,10 @@ import java.util.List;
public interface ScoreCoefficientRepository extends MongoRepository<ScoreCoefficient, String> {
List<ScoreCoefficient> findByWordId(String workId);
List<ScoreCoefficient> findByScore2IsNot();
List<ScoreCoefficient> findAllByGroupLeaderScore2IsNullOrDirectorScore2IsNull();
List<ScoreCoefficient> findAllByGroupLeaderScore2IsNotNullAndDirectorScore2IsNotNullAndViceScore3IsNull();
List<ScoreCoefficient> findAllByViceScore3IsNotNullAndJustScore4IsNull();
}
......@@ -58,7 +58,8 @@ public interface AttachmentService {
/**
* 查找指定id的Work
*
* @param workId 指定id
* @param
* workId 指定id
* @return Work对象
*/
Attachment findById(String attachmentId);
......
......@@ -148,6 +148,11 @@ public interface WorkService {
List<WorkMpping> selectUserIdsWork(String userId);
/**
* 根据任务id查看其所有相关的任务
* @param workId 任务id
* @return 返回所有任务
*/
WorkMpping selectWorkMapperWorkId(String workId);
}
......@@ -10,6 +10,7 @@ import com.zjty.tynotes.job.common.exception.BadRequestException;
import com.zjty.tynotes.job.common.exception.NotFoundException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import java.util.Date;
......
......@@ -34,6 +34,7 @@ public class ConversionServiceImpl implements ConversionService {
User pUser=iUserService.findUserById(work.getPublisher());
User eUser=iUserService.findUserById(work.getExecutor());
User aUser=iUserService.findUserById(work.getAudit());
List<User> users=new ArrayList<>();
List<String> uid=work.getCrewList();
List<Attachment> attachments=new ArrayList<>();
......@@ -77,7 +78,10 @@ public class ConversionServiceImpl implements ConversionService {
work.getWorkCoefficient(),
work.getPWorkload(),
work.getWorkloadCount(),
null
aUser,
selectUserIdAll(work.getMajordomos()),
selectUserIdAll(work.getGeneralManagers()),
selectUserIdAll(work.getAssistantManagers())
);
}else {
return new WorkVo(
......@@ -101,8 +105,15 @@ public class ConversionServiceImpl implements ConversionService {
work.getWorkCoefficient(),
work.getPWorkload(),
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 {
@Override
public List<ScoreCoefficient> selectSorct2IsNull() {
return scoreCoefficientRepository.findByScore2IsNot();
// scoreCoefficientRepository.findByScore2IsNot()
return null;
}
}
......@@ -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.NotFoundException;
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.IUserService;
import lombok.extern.slf4j.Slf4j;
......@@ -71,8 +72,16 @@ public class WorkServiceImpl implements WorkService {
//新增数据不可附带id.
Boolean idMustNull = isNull(work.getId());
if (idMustNull) {
// if (work.getSuperiorId()==null ||work.getSuperiorId().equals("")){
// }else {
// work.setAudit(selectGroupId(work.getSuperiorId()));
// }
work.setCreateTime(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();
log.info(String.format("[job] 新增了id为 %s 的数据.", saveId));
return saveId;
......@@ -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
public String modify(Work work) {
//更新数据必须指定id且指定id的数据存在.
......@@ -194,7 +211,7 @@ public class WorkServiceImpl implements WorkService {
ScoreCoefficient scoreCoefficient= scoreCoefficientService.findById(workId);
int workLoad= findBySuperoirIdCount(workId);
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;
scoreCoefficient.setEndWorkLoad(Double.valueOf(df.format(getWorkLoad)));
scoreCoefficientService.modify(scoreCoefficient);
......@@ -331,6 +348,35 @@ return 0.0f;
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){
List<WorkMpping> workMppings=new ArrayList<>();
......
......@@ -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
......
......@@ -180,11 +180,31 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement {
break;
case 9:
String actionMsg = name +msg;
String actionMsg = name +" "+msg;
actionHistory.setActionMsg(actionMsg);
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);
break;
......
package com.zjty.tynotes.job.task;
import com.zjty.tynotes.job.basic.entity.database.Work;
import com.zjty.tynotes.job.basic.repository.ScoreCoefficientRepository;
import com.zjty.tynotes.job.basic.service.ScoreCoefficientService;
import com.zjty.tynotes.job.basic.service.WorkService;
import com.zjty.tynotes.job.common.Action;
......@@ -19,7 +20,7 @@ import java.util.Date;
@Service
public class Task {
@Autowired
ScoreCoefficientService scoreCoefficientService;
ScoreCoefficientRepository scoreCoefficientRepository;
@Autowired
WorkService workService;
@Autowired
......@@ -28,7 +29,7 @@ public class Task {
@Scheduled(cron ="0 0 0 * * ?")
public void task() {
long time=LocalDateTime.now().minusDays(7)
long time=LocalDateTime.now().minusDays(1)
.withHour(0)
.withMinute(0)
.withSecond(0)
......@@ -37,19 +38,86 @@ public class Task {
.toEpochSecond();
scoreCoefficientService.selectSorct2IsNull()
long finalTime2 = time;
scoreCoefficientRepository.findAllByGroupLeaderScore2IsNullOrDirectorScore2IsNull()
.forEach(
sc->{
Work work= workService.findById(sc.getWordId());
if (work.getAuditTime().getTime()<time){
sc.setScore2(sc.getScore1());
scoreCoefficientService.modify(sc);
businessTreeManagement.saveAction(work.getPublisher(),sc.getWordId(),Action.APPRAISAL_WORD,new Date(),"");
workService.alterTaskStatus(sc.getWordId(),WorkStatus.FINISHED,work.getPublisher());
businessTreeManagement.saveAction(work.getPublisher(), sc.getWordId(), Action.FINISHED_WORK, new Date(), "");
Work work=workService.findById(sc.getWordId());
if (sc.getTime().getTime()< finalTime2){
if(sc.getDirectorScore2()==null&&sc.getGroupLeaderScore2() != null){
sc.setDirectorScore2(sc.getGroupLeaderScore2());
sc.setTime(new Date());
businessTreeManagement.saveAction(work.getMajordomos().get(0),sc.getWordId(),Action.APPRAISAL_WORD,new Date(),"总监评价");
}else if (sc.getGroupLeaderScore2()==null && sc.getDirectorScore2() !=null){
sc.setGroupLeaderScore2(sc.getDirectorScore2());
sc.setTime(new Date());
businessTreeManagement.saveAction(work.getAudit(),sc.getWordId(),Action.APPRAISAL_WORD,new Date(),"组长评价");
}else {
sc.setTime(new Date());
sc.setGroupLeaderScore2(sc.getScore1());
businessTreeManagement.saveAction(work.getAudit(),sc.getWordId(),Action.APPRAISAL_WORD,new Date(),"组长评价");
sc.setDirectorScore2(sc.getScore1());
businessTreeManagement.saveAction(work.getMajordomos().get(0),sc.getWordId(),Action.APPRAISAL_WORD,new Date(),"总监评价");
}
scoreCoefficientRepository.save(sc);
// workService.alterTaskStatus(sc.getWordId(),WorkStatus.FINISHED,work.getPublisher());
// businessTreeManagement.saveAction(work.getPublisher(), sc.getWordId(), Action.FINISHED_WORK, new Date(), "");
}
}
);
time=LocalDateTime.now().minusDays(2)
.withHour(0)
.withMinute(0)
.withSecond(0)
.withNano(0)
.atOffset(ZoneOffset.ofHours(8))
.toEpochSecond();
//副总经理
long finalTime1 = time;
scoreCoefficientRepository.findAllByGroupLeaderScore2IsNotNullAndDirectorScore2IsNotNullAndViceScore3IsNull()
.forEach(
sc->{
Work work=workService.findById(sc.getWordId());
if (sc.getTime().getTime()< finalTime1){
String score3= String.valueOf(Integer.valueOf(sc.getDirectorScore2())+Integer.valueOf(sc.getGroupLeaderScore2()));
sc.setViceScore3(score3);
sc.setTime(new Date());
businessTreeManagement.saveAction(work.getAssistantManagers().get(0),sc.getWordId(),Action.APPRAISAL_WORD,new Date(),"副总经理评价");
}
scoreCoefficientRepository.save(sc);
// workService.alterTaskStatus(sc.getWordId(),WorkStatus.FINISHED,work.getPublisher());
// businessTreeManagement.saveAction(work.getPublisher(), sc.getWordId(), Action.FINISHED_WORK, new Date(), "");
}
);
time=LocalDateTime.now().minusDays(2)
.withHour(0)
.withMinute(0)
.withSecond(0)
.withNano(0)
.atOffset(ZoneOffset.ofHours(8))
.toEpochSecond();
//总经理
long finalTime = time;
scoreCoefficientRepository.findAllByViceScore3IsNotNullAndJustScore4IsNull()
.forEach(
sc->{
Work work=workService.findById(sc.getWordId());
if (sc.getTime().getTime()< finalTime){
sc.setJustScore4(sc.getViceScore3());
sc.setTime(new Date());
businessTreeManagement.saveAction(work.getGeneralManagers().get(0),sc.getWordId(),Action.APPRAISAL_WORD,new Date(),"总经理评价");
}
scoreCoefficientRepository.save(sc);
workService.alterTaskStatus(sc.getWordId(),WorkStatus.FINISHED,work.getPublisher());
businessTreeManagement.saveAction(work.getGeneralManagers().get(0), sc.getWordId(), Action.FINISHED_WORK, new Date(), "");
}
);
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论