提交 8b1efe10 authored 作者: zjm's avatar zjm

添加了人员管理需要的service

上级 d9a4c59b
流水线 #128 已取消 于阶段
...@@ -8,7 +8,7 @@ import java.util.List; ...@@ -8,7 +8,7 @@ import java.util.List;
@Repository @Repository
public interface ScoreCoefficientRepository extends MongoRepository<ScoreCoefficient, String> { public interface ScoreCoefficientRepository extends MongoRepository<ScoreCoefficient, String> {
List<ScoreCoefficient> findByWordId(String workId); ScoreCoefficient findByWordId(String workId);
List<ScoreCoefficient> findAllByGroupLeaderScore2IsNullOrDirectorScore2IsNull(); List<ScoreCoefficient> findAllByGroupLeaderScore2IsNullOrDirectorScore2IsNull();
......
...@@ -32,4 +32,19 @@ public interface WorkRepository extends MongoRepository<Work, String> { ...@@ -32,4 +32,19 @@ public interface WorkRepository extends MongoRepository<Work, String> {
List<Work> findByAuditTimeBefore(Date auditTime); List<Work> findByAuditTimeBefore(Date auditTime);
/**
* 根据人员id以及时间范围查询开始时间在范围里的任务
* @param id 人员id
* @param sTime 开始时间
* @param eTime 结束时间
* @return 集合
*/
List<Work> findAllByExecutorAndStateTimeBetween(String id,Date sTime,Date eTime);
/**
* 根据人员id以及的任务
* @param id 人员id
* @return 集合
*/
List<Work> findAllByExecutor(String id);
} }
...@@ -60,14 +60,9 @@ public class ScoreCoefficientServiceImpl implements ScoreCoefficientService { ...@@ -60,14 +60,9 @@ public class ScoreCoefficientServiceImpl implements ScoreCoefficientService {
@Override @Override
public ScoreCoefficient findById(String id) { public ScoreCoefficient findById(String id) {
List<ScoreCoefficient> scoreCoefficients= scoreCoefficientRepository.findByWordId(id);
if (scoreCoefficients.size()==0){ return scoreCoefficientRepository.findByWordId(id);
String msg = "[job] 没有考评信息";
log.error(msg);
throw new BadRequestException(msg);
}else {
return scoreCoefficients.get(0);
}
} }
......
...@@ -25,12 +25,17 @@ public interface InternalService { ...@@ -25,12 +25,17 @@ public interface InternalService {
/** /**
* 根据时间区间查找人员任务信息 * 根据时间区间查找人员任务信息
* @param userId * @param userId 人员id
* @param startTime * @param startTime 开始时间
* @param endTime * @param endTime 结束时间
* @return * @return 人员的任务信息
*/ */
UserWorkData personnelWorkMsg(String userId,Date startTime,Date endTime); UserWorkData personnelWorkMsg(String userId,Date startTime,Date endTime);
/**
* 查找人员id任务信息
* @param userId 人员id
* @return 人员的任务信息
*/
UserWorkData personnelWorkMsgAll(String userId); UserWorkData personnelWorkMsgAll(String userId);
} }
package com.zjty.tynotes.job.status.service.impl; package com.zjty.tynotes.job.status.service.impl;
import com.zjty.tynotes.job.basic.entity.database.ScoreCoefficient;
import com.zjty.tynotes.job.basic.entity.database.Work;
import com.zjty.tynotes.job.basic.repository.ScoreCoefficientRepository;
import com.zjty.tynotes.job.basic.repository.WorkRepository;
import com.zjty.tynotes.job.common.Constants; import com.zjty.tynotes.job.common.Constants;
import com.zjty.tynotes.job.common.constant.WorkStatus; import com.zjty.tynotes.job.common.constant.WorkStatus;
import com.zjty.tynotes.job.common.exception.WorkAttribution; import com.zjty.tynotes.job.common.exception.WorkAttribution;
...@@ -11,6 +15,7 @@ import com.zjty.tynotes.job.status.service.InternalService; ...@@ -11,6 +15,7 @@ import com.zjty.tynotes.job.status.service.InternalService;
import com.zjty.tynotes.pas.service.IUserService; import com.zjty.tynotes.pas.service.IUserService;
import com.zjty.tynotes.search.subject.service.EsUtil; import com.zjty.tynotes.search.subject.service.EsUtil;
import com.zjty.tynotes.sms.service.MessageTemplateService; import com.zjty.tynotes.sms.service.MessageTemplateService;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -26,6 +31,11 @@ public class InternalServiceImpl implements InternalService { ...@@ -26,6 +31,11 @@ public class InternalServiceImpl implements InternalService {
@Autowired @Autowired
IUserService iUserService; IUserService iUserService;
@ApiModelProperty
WorkRepository workRepository;
@Autowired
ScoreCoefficientRepository scoreCoefficientRepository;
@Override @Override
public List<Personnel> personnels(List<String> list) { public List<Personnel> personnels(List<String> list) {
List<Personnel> personnels=new ArrayList<>(); List<Personnel> personnels=new ArrayList<>();
...@@ -67,11 +77,53 @@ public class InternalServiceImpl implements InternalService { ...@@ -67,11 +77,53 @@ public class InternalServiceImpl implements InternalService {
@Override @Override
public UserWorkData personnelWorkMsg(String userId, Date startTime, Date endTime) { public UserWorkData personnelWorkMsg(String userId, Date startTime, Date endTime) {
return null; UserWorkData userWorkData=new UserWorkData();
int countOngoing=0;
int countFinished=0;
Double countScore=0d;
List<Work> works= workRepository.findAllByExecutorAndStateTimeBetween(userId,startTime,endTime);
for (Work work:works){
if (work.getStatus().equals(WorkStatus.ONGOING)){
countOngoing++;
}
if (work.getStatus().equals(WorkStatus.FINISHED)){
countFinished++;
ScoreCoefficient scoreCoefficient= scoreCoefficientRepository.findByWordId(work.getId());
countScore=countScore+scoreCoefficient.getEndWorkLoad();
}
}
userWorkData.setAverageScore(countScore/countFinished);
userWorkData.setCompletedNum(countOngoing);
userWorkData.setUnCompletedNum(countOngoing);
userWorkData.setUserId(userId);
return userWorkData;
} }
@Override @Override
public UserWorkData personnelWorkMsgAll(String userId) { public UserWorkData personnelWorkMsgAll(String userId) {
return null; UserWorkData userWorkData=new UserWorkData();
int countOngoing=0;
int countFinished=0;
Double countScore=0d;
List<Work> works= workRepository.findAllByExecutor(userId);
for (Work work:works){
if (work.getStatus().equals(WorkStatus.ONGOING)){
countOngoing++;
}
if (work.getStatus().equals(WorkStatus.FINISHED)){
countFinished++;
ScoreCoefficient scoreCoefficient= scoreCoefficientRepository.findByWordId(work.getId());
countScore=countScore+scoreCoefficient.getEndWorkLoad();
}
}
userWorkData.setAverageScore(countScore/countFinished);
userWorkData.setCompletedNum(countOngoing);
userWorkData.setUnCompletedNum(countOngoing);
userWorkData.setUserId(userId);
return userWorkData;
} }
} }
...@@ -23,6 +23,7 @@ import java.util.List; ...@@ -23,6 +23,7 @@ import java.util.List;
@Service @Service
public class RepairServiceImpl implements RepairService { public class RepairServiceImpl implements RepairService {
@Autowired @Autowired
private RedisTemplate<String,Object> redisTemplate; private RedisTemplate<String,Object> redisTemplate;
...@@ -37,6 +38,7 @@ public class RepairServiceImpl implements RepairService { ...@@ -37,6 +38,7 @@ public class RepairServiceImpl implements RepairService {
@Autowired @Autowired
ScoreCoefficientService scoreCoefficientService; ScoreCoefficientService scoreCoefficientService;
@Autowired @Autowired
IUserService iUserService; IUserService iUserService;
@Override @Override
......
...@@ -81,7 +81,7 @@ public class Task { ...@@ -81,7 +81,7 @@ public class Task {
sc->{ sc->{
Work work=workService.findById(sc.getWordId()); Work work=workService.findById(sc.getWordId());
if (sc.getTime().getTime()< finalTime1){ if (sc.getTime().getTime()< finalTime1){
String score3= String.valueOf(Integer.valueOf(sc.getDirectorScore2())+Integer.valueOf(sc.getGroupLeaderScore2())); String score3= String.valueOf((Integer.valueOf(sc.getDirectorScore2())+Integer.valueOf(sc.getGroupLeaderScore2()))/2);
sc.setViceScore3(score3); sc.setViceScore3(score3);
sc.setTime(new Date()); sc.setTime(new Date());
businessTreeManagement.saveAction(work.getAssistantManagers().get(0),sc.getWordId(),Action.APPRAISAL_WORD,new Date(),"副总经理评价"); businessTreeManagement.saveAction(work.getAssistantManagers().get(0),sc.getWordId(),Action.APPRAISAL_WORD,new Date(),"副总经理评价");
......
...@@ -2,7 +2,7 @@ spring.application.name=workbook ...@@ -2,7 +2,7 @@ spring.application.name=workbook
## https端口号. ## https端口号.
server.port=8289 server.port=8289
## 证书的路径. # 证书的路径.
server.ssl.key-store=classpath:2586377_workbook.zjtys.com.cn.pfx server.ssl.key-store=classpath:2586377_workbook.zjtys.com.cn.pfx
# 证书密码,请修改为您自己证书的密码. # 证书密码,请修改为您自己证书的密码.
server.ssl.key-store-password=bMEPW9BG server.ssl.key-store-password=bMEPW9BG
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论