提交 b2174469 authored 作者: gongwenjie's avatar gongwenjie

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

...@@ -113,7 +113,7 @@ public class WorkController { ...@@ -113,7 +113,7 @@ public class WorkController {
@ApiOperation(value = "修改任务的组员.", notes = "修改任务的组员.") @ApiOperation(value = "修改任务的组员.", notes = "修改任务的组员.")
public ResponseEntity<JobResponse> update(@RequestBody UpdateCrew updateCrew) { public ResponseEntity<JobResponse> update(@RequestBody UpdateCrew updateCrew) {
workService.updateWorkCrew(updateCrew.getWorkId(),updateCrew.getUsers()); workService.updateWorkCrew(updateCrew.getWorkId(),updateCrew.getUsers(),updateCrew.getWorkload());
businessTreeManagement.saveAction(updateCrew.getUserid(),updateCrew.getWorkId(),Action.UPDATE_WORK_CREW,new Date(),updateCrew.getMsg()); businessTreeManagement.saveAction(updateCrew.getUserid(),updateCrew.getWorkId(),Action.UPDATE_WORK_CREW,new Date(),updateCrew.getMsg());
return ok(new JobResponse(updateCrew.getWorkId())); return ok(new JobResponse(updateCrew.getWorkId()));
} }
......
...@@ -135,7 +135,7 @@ public class Work { ...@@ -135,7 +135,7 @@ public class Work {
*/ */
@NotNull @NotNull
@ApiModelProperty(value = "工作量",example = "30") @ApiModelProperty(value = "工作量",example = "30")
private int workload; private Integer workload;
/** /**
* 工作状态 * 工作状态
......
...@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List; import java.util.List;
...@@ -23,6 +24,9 @@ public class UpdateCrew { ...@@ -23,6 +24,9 @@ public class UpdateCrew {
@ApiModelProperty(value = "组员id", example = "users") @ApiModelProperty(value = "组员id", example = "users")
private List<String> users; private List<String> users;
@ApiModelProperty(value = "任务工作量", example = "workId")
private Integer workload;
@ApiModelProperty(value = "说明", example = "msg") @ApiModelProperty(value = "说明", example = "msg")
private String msg; private String msg;
......
...@@ -10,4 +10,6 @@ import java.util.List; ...@@ -10,4 +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();
} }
...@@ -2,8 +2,10 @@ package com.zjty.tynotes.job.basic.repository; ...@@ -2,8 +2,10 @@ package com.zjty.tynotes.job.basic.repository;
import com.zjty.tynotes.job.basic.entity.database.Work; import com.zjty.tynotes.job.basic.entity.database.Work;
import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -27,4 +29,7 @@ public interface WorkRepository extends MongoRepository<Work, String> { ...@@ -27,4 +29,7 @@ public interface WorkRepository extends MongoRepository<Work, String> {
*/ */
List<Work> findAllByExecutorIn(List<String> ids); List<Work> findAllByExecutorIn(List<String> ids);
List<Work> findByAuditTimeBefore(Date auditTime);
} }
...@@ -2,6 +2,8 @@ package com.zjty.tynotes.job.basic.service; ...@@ -2,6 +2,8 @@ package com.zjty.tynotes.job.basic.service;
import com.zjty.tynotes.job.basic.entity.database.ScoreCoefficient; import com.zjty.tynotes.job.basic.entity.database.ScoreCoefficient;
import java.util.List;
public interface ScoreCoefficientService { public interface ScoreCoefficientService {
/** /**
...@@ -23,7 +25,7 @@ public interface ScoreCoefficientService { ...@@ -23,7 +25,7 @@ public interface ScoreCoefficientService {
String modify(ScoreCoefficient scoreCoefficient); String modify(ScoreCoefficient scoreCoefficient);
/** /**
* 指定id的Work是否存在 * 指定id的考评是否存在是否存在
* *
* @param Id 指定id * @param Id 指定id
* @return 是否存在 * @return 是否存在
...@@ -41,5 +43,9 @@ public interface ScoreCoefficientService { ...@@ -41,5 +43,9 @@ public interface ScoreCoefficientService {
ScoreCoefficient findById(String id); ScoreCoefficient findById(String id);
/**
* 查询所有发布者为考评的考评对象
*/
List<ScoreCoefficient> selectSorct2IsNull();
} }
...@@ -111,7 +111,8 @@ public interface WorkService { ...@@ -111,7 +111,8 @@ public interface WorkService {
* *
* @param crews 组员名单 * @param crews 组员名单
*/ */
void updateWorkCrew(String taskId, List<String> crews);
void updateWorkCrew(String taskId, List<String> crews, Integer workload);
/** /**
* 修改任务 组员 * 修改任务 组员
...@@ -132,11 +133,20 @@ public interface WorkService { ...@@ -132,11 +133,20 @@ public interface WorkService {
* 根据任务id 查看任务剩余工作量 * 根据任务id 查看任务剩余工作量
*/ */
int findBySuperoirIdCount(String SuperoirId); int findBySuperoirIdCount(String SuperoirId);
// /** // /**
// * 查看正在进行中的任务 // * 查看正在进行中的任务
// */ // */
// List<Work> selectTimeWork(); // List<Work> selectTimeWork();
/**
* 根据用户id查看其部门所有的任务
* @param userId 用户id
* @return 返回所有任务
*/
WorkVoMapping selectUserIdsWork(String userId); WorkVoMapping selectUserIdsWork(String userId);
} }
...@@ -70,4 +70,10 @@ public class ScoreCoefficientServiceImpl implements ScoreCoefficientService { ...@@ -70,4 +70,10 @@ public class ScoreCoefficientServiceImpl implements ScoreCoefficientService {
} }
} }
@Override
public List<ScoreCoefficient> selectSorct2IsNull() {
return scoreCoefficientRepository.findByScore2IsNot();
}
} }
...@@ -27,6 +27,9 @@ import org.springframework.stereotype.Service; ...@@ -27,6 +27,9 @@ import org.springframework.stereotype.Service;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.ParseException; import java.text.ParseException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -218,19 +221,19 @@ private float beyond(float count,float coefficient,Float time){ ...@@ -218,19 +221,19 @@ private float beyond(float count,float coefficient,Float time){
return beyond(count,coefficient,si); return beyond(count,coefficient,si);
} }
private float advance(float count,float coefficient,Float time){ private float advance(float count1,float coefficient1,Float time){
if (coefficient>1.2f){ if (coefficient1>1.2f){
return 1.2f; return 1.2f;
} }
float remainingTime=time-6; float remainingTime=time-6;
if (remainingTime<6){ if (remainingTime<6){
return coefficient+0.025f*count; return coefficient1+0.025f*count1;
}else { }else {
coefficient=coefficient +0.025f*count; coefficient1=coefficient1 +0.025f*count1;
} }
count++; count1++;
return beyond(count,coefficient,remainingTime); return advance(count1,coefficient1,remainingTime);
} }
private Float score(Date startTime,Date entTime){ private Float score(Date startTime,Date entTime){
...@@ -253,9 +256,10 @@ return 0.0f; ...@@ -253,9 +256,10 @@ return 0.0f;
} }
@Override @Override
public void updateWorkCrew(String taskId, List<String> crews) { public void updateWorkCrew(String taskId, List<String> crews,Integer workload) {
Work ob = workRepository.findById(taskId).get(); Work ob = workRepository.findById(taskId).get();
ob.setCrewList(crews); ob.setCrewList(crews);
ob.setWorkload(workload);
workRepository.save(ob); workRepository.save(ob);
} }
......
...@@ -7,8 +7,9 @@ package com.zjty.tynotes.job.common.exception; ...@@ -7,8 +7,9 @@ package com.zjty.tynotes.job.common.exception;
public interface WorkAttribution1 { public interface WorkAttribution1 {
/**
//我的相关任务 * 我的相关任务
*/
int ME_RELATED_WORK = 1; int ME_RELATED_WORK = 1;
/** /**
......
...@@ -94,12 +94,12 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement { ...@@ -94,12 +94,12 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement {
switch (noteResource.getAction()) { switch (noteResource.getAction()) {
case 1: case 1:
if (work.getSuperiorId()==null) { if (work.getSuperiorId()==null) {
actionHistory.setActionMsg(name + "新建了任务"); actionHistory.setActionMsg(name + " 新建任务");
actionHistoryRepository.save(actionHistory); actionHistoryRepository.save(actionHistory);
testService.saveTakePushWork(work.getPublisher(), actionHistory.getActionMsg(), work); testService.saveTakePushWork(work.getPublisher(), actionHistory.getActionMsg(), work);
log.info("[TREE] {}新建任务", name); log.info("[TREE] {}新建任务", name);
}else { }else {
actionHistory.setActionMsg(name + "新建了分解任务"); actionHistory.setActionMsg(name + " 分解任务");
actionHistoryRepository.save(actionHistory); actionHistoryRepository.save(actionHistory);
testService.saveTakePushWork(work.getPublisher(), actionHistory.getActionMsg(), work); testService.saveTakePushWork(work.getPublisher(), actionHistory.getActionMsg(), work);
log.info("[TREE] {}新建分解任务,执行人id是{}", name); log.info("[TREE] {}新建分解任务,执行人id是{}", name);
...@@ -108,7 +108,7 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement { ...@@ -108,7 +108,7 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement {
case 2: case 2:
actionHistory.setActionMsg(name + "提交了任务"); actionHistory.setActionMsg(name + " 提交任务");
actionHistoryRepository.save(actionHistory); actionHistoryRepository.save(actionHistory);
testService.updateWorkStatus(noteResource.getId(), testService.updateWorkStatus(noteResource.getId(),
actionHistory.getActionMsg(), actionHistory.getActionMsg(),
...@@ -119,18 +119,18 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement { ...@@ -119,18 +119,18 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement {
case 3: case 3:
actionHistory.setActionMsg(name + "撤回了任务"); actionHistory.setActionMsg(name + " 撤回任务");
actionHistoryRepository.save(actionHistory); actionHistoryRepository.save(actionHistory);
testService.updateWorkStatus(noteResource.getId(), testService.updateWorkStatus(noteResource.getId(),
actionHistory.getActionMsg(), actionHistory.getActionMsg(),
status, status,
work); work);
log.info("[TREE] {}退回了任务", name); log.info("[TREE] {}测绘了任务", name);
break; break;
case 4: case 4:
actionHistory.setActionMsg(name + "审核任务不通过"); actionHistory.setActionMsg(name + " 审核任务不通过");
actionHistoryRepository.save(actionHistory); actionHistoryRepository.save(actionHistory);
testService.updateWorkStatus(noteResource.getId(), testService.updateWorkStatus(noteResource.getId(),
actionHistory.getActionMsg(), actionHistory.getActionMsg(),
...@@ -141,7 +141,7 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement { ...@@ -141,7 +141,7 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement {
case 5: case 5:
actionHistory.setActionMsg(name + "审核任务通过"); actionHistory.setActionMsg(name + " 审核任务通过");
actionHistoryRepository.save(actionHistory); actionHistoryRepository.save(actionHistory);
testService.updateWorkStatus(noteResource.getId(), testService.updateWorkStatus(noteResource.getId(),
actionHistory.getActionMsg(), actionHistory.getActionMsg(),
...@@ -153,7 +153,7 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement { ...@@ -153,7 +153,7 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement {
case 6: case 6:
actionHistory.setActionMsg(name + "删除任务"); actionHistory.setActionMsg(name + " 删除任务");
actionHistoryRepository.save(actionHistory); actionHistoryRepository.save(actionHistory);
testService.updateWorkStatus(noteResource.getId(), testService.updateWorkStatus(noteResource.getId(),
actionHistory.getActionMsg(), actionHistory.getActionMsg(),
...@@ -163,7 +163,7 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement { ...@@ -163,7 +163,7 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement {
break; break;
case 7: case 7:
actionHistory.setActionMsg(name + "修改了任务的组员"); actionHistory.setActionMsg(name + " 修改任务");
actionHistoryRepository.save(actionHistory); actionHistoryRepository.save(actionHistory);
testService.upDateWork(noteResource.getId(), testService.upDateWork(noteResource.getId(),
actionHistory.getActionMsg(), actionHistory.getActionMsg(),
...@@ -171,7 +171,7 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement { ...@@ -171,7 +171,7 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement {
log.info("[TREE] {}修改了任务的组员", name); log.info("[TREE] {}修改了任务的组员", name);
break; break;
case 8: case 8:
actionHistory.setActionMsg(name + "修改了任务的工作量和考评系数"); actionHistory.setActionMsg(name + " 修改任务");
actionHistoryRepository.save(actionHistory); actionHistoryRepository.save(actionHistory);
testService.upDateWork(noteResource.getId(), testService.upDateWork(noteResource.getId(),
actionHistory.getActionMsg(), actionHistory.getActionMsg(),
...@@ -183,9 +183,9 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement { ...@@ -183,9 +183,9 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement {
ScoreCoefficient scoreCoefficient= scoreCoefficientRepository.findByWordId(work.getId()).get(0); ScoreCoefficient scoreCoefficient= scoreCoefficientRepository.findByWordId(work.getId()).get(0);
String actionMsg = null; String actionMsg = null;
if (scoreCoefficient.getScore1()!=null){ if (scoreCoefficient.getScore1()!=null){
actionMsg=name+"对任务进行了自我评价"; actionMsg=name+" 自我评价";
}else if (scoreCoefficient.getScore2()!=null){ }else if (scoreCoefficient.getScore2()!=null){
actionMsg=name+"对任务进行了发布者评价"; actionMsg=name+" 发布者评价";
} }
actionHistory.setActionMsg(actionMsg); actionHistory.setActionMsg(actionMsg);
actionHistoryRepository.save(actionHistory); actionHistoryRepository.save(actionHistory);
...@@ -195,19 +195,19 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement { ...@@ -195,19 +195,19 @@ public class BusinessTreeManagementImpl implements BusinessTreeManagement {
case 10: case 10:
//保存任务 //保存任务
actionHistory.setActionMsg(name + "保存了任务"); actionHistory.setActionMsg(name + " 保存任务");
actionHistoryRepository.save(actionHistory); actionHistoryRepository.save(actionHistory);
testService.saveWork(work.getPublisher(),actionHistory.getActionMsg(),work); testService.saveWork(work.getPublisher(),actionHistory.getActionMsg(),work);
log.info("[TREE] {}保存任务", name); log.info("[TREE] {}保存任务", name);
break; break;
case 11: case 11:
actionHistory.setActionMsg(name + "修改任务从未发布到进行中"); actionHistory.setActionMsg(name + " 发布任务");
actionHistoryRepository.save(actionHistory); actionHistoryRepository.save(actionHistory);
testService.unpublishedToOngoing(work.getPublisher(), actionHistory.getActionMsg(), work); testService.unpublishedToOngoing(work.getPublisher(), actionHistory.getActionMsg(), work);
log.info("[TREE] {}修改任务从未发布到进行中", name); log.info("[TREE] {}修改任务从未发布到进行中", name);
break; break;
case 12: case 12:
actionHistory.setActionMsg(name + "完结任务"); actionHistory.setActionMsg(name + " 完结任务");
actionHistoryRepository.save(actionHistory); actionHistoryRepository.save(actionHistory);
testService.updateWorkStatus(noteResource.getId(), testService.updateWorkStatus(noteResource.getId(),
actionHistory.getActionMsg(), actionHistory.getActionMsg(),
......
package com.zjty.tynotes.job.task;
import com.zjty.tynotes.job.basic.entity.database.Work;
import com.zjty.tynotes.job.basic.service.ScoreCoefficientService;
import com.zjty.tynotes.job.basic.service.WorkService;
import com.zjty.tynotes.job.common.Action;
import com.zjty.tynotes.job.common.constant.WorkStatus;
import com.zjty.tynotes.job.status.service.BusinessTreeManagement;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Date;
@Slf4j
@Service
public class Task {
@Autowired
ScoreCoefficientService scoreCoefficientService;
@Autowired
WorkService workService;
@Autowired
BusinessTreeManagement businessTreeManagement;
@Scheduled(cron ="0 0 0 * * ?")
public void task() {
long time=LocalDateTime.now().minusDays(7)
.withHour(0)
.withMinute(0)
.withSecond(0)
.withNano(0)
.atOffset(ZoneOffset.ofHours(8))
.toEpochSecond();
scoreCoefficientService.selectSorct2IsNull()
.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(), "");
}
}
);
}
}
...@@ -89,8 +89,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -89,8 +89,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.and() .and()
.addFilterAt(myFilter(), UsernamePasswordAuthenticationFilter.class) .addFilterAt(myFilter(), UsernamePasswordAuthenticationFilter.class)
.addFilterBefore(corsFilter(), ChannelProcessingFilter.class) .addFilterBefore(corsFilter(), ChannelProcessingFilter.class)
.csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()).disable().sessionManagement().maximumSessions(1).expiredUrl("/userLogout").sessionRegistry(sessionRegistry()) .csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse()).disable().sessionManagement().maximumSessions(1).expiredUrl("/userLogout").sessionRegistry(sessionRegistry());
;
} }
@Override @Override
......
...@@ -5,7 +5,9 @@ import org.springframework.boot.SpringApplication; ...@@ -5,7 +5,9 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory; import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.swagger2.annotations.EnableSwagger2; import springfox.documentation.swagger2.annotations.EnableSwagger2;
/** /**
...@@ -24,6 +26,8 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; ...@@ -24,6 +26,8 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
"com.zjty.tynotes.union", "com.zjty.tynotes.union",
"com.zjty.tynotes.attendance" "com.zjty.tynotes.attendance"
}) })
@EnableCaching
@EnableScheduling
public class UnionApplication { public class UnionApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(UnionApplication.class, args); SpringApplication.run(UnionApplication.class, args);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论