提交 2c9e9d62 authored 作者: zjm's avatar zjm

修改job

上级 f47088e5
流水线 #80 已取消 于阶段
......@@ -50,5 +50,5 @@ public class ScoreCoefficient {
* 最终工作量
*/
@ApiModelProperty(value = "最终工作量", example = "endWorkLoad")
private int endWorkLoad;
private Double endWorkLoad;
}
......@@ -136,7 +136,7 @@ public class Work {
* 考评系数
*/
@ApiModelProperty(value = "考评系数",example = "0.8")
private int workCoefficient=0;
private float workCoefficient=0;
/**
* 是否记录个人工作量
......
......@@ -49,7 +49,7 @@ public class ScRo {
* 最终工作量
*/
@ApiModelProperty(value = "最终工作量", example = "endWorkLoad")
private int endWorkLoad;
private Double endWorkLoad;
@ApiModelProperty(value = "用户id", example = "userId")
private String userId;
......
......@@ -117,7 +117,7 @@ public class WorkVo {
* 考评系数
*/
@ApiModelProperty(value = "考评系数",example = "0.8")
private int workCoefficient=0;
private float workCoefficient=0;
/**
* 是否记录个人工作量
......
......@@ -33,9 +33,9 @@ public interface ScoreCoefficientService {
/**
* 查找指定id的考评信息
* 查找指定workid的考评信息
*
* @param id 指定id
* @param id workid
* @return ScoreCoefficient 对象
*/
ScoreCoefficient findById(String id);
......
package com.zjty.tynotes.job.basic.service.impl;
import com.google.common.collect.Lists;
import com.zjty.tynotes.job.basic.entity.database.ScoreCoefficient;
import com.zjty.tynotes.job.basic.entity.database.Work;
import com.zjty.tynotes.job.basic.entity.response.WorkIsNotCommit;
import com.zjty.tynotes.job.basic.entity.response.WorkVo;
import com.zjty.tynotes.job.basic.repository.WorkRepository;
import com.zjty.tynotes.job.basic.service.ConversionService;
import com.zjty.tynotes.job.basic.service.ScoreCoefficientService;
import com.zjty.tynotes.job.basic.service.WorkService;
import com.zjty.tynotes.job.basic.utils.WorkingTime;
import com.zjty.tynotes.job.common.constant.WorkStatus;
......@@ -19,6 +21,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
......@@ -49,6 +52,10 @@ public class WorkServiceImpl implements WorkService {
@Autowired
ConversionService conversionService;
@Autowired
ScoreCoefficientService scoreCoefficientService;
@Autowired
public WorkServiceImpl(WorkRepository workRepository) {
this.workRepository = workRepository;
......@@ -132,20 +139,34 @@ public class WorkServiceImpl implements WorkService {
Float practical=score(ob.getStateTime(),ob.getEndTime());
if (expect<practical){
float time= practical-expect;
beyond(1,1.0f,time);
ob.setWorkCoefficient(beyond(1,1.0f,time));
//添加
}else if (expect.equals(practical)){
ob.setWorkCoefficient(1f);
//添加
}else {
float time= expect-practical;
advance(1,1.0f,time);
ob.setWorkCoefficient(advance(1,1.0f,time));
}
}
if (status.equals(WorkStatus.FINISHED)){
pWorkload(taskId);
}
workRepository.save(ob);
}
private void pWorkload(String workId){
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 getWorkLoad=workLoad*coefficient;
scoreCoefficient.setEndWorkLoad(Double.valueOf(df.format(getWorkLoad)));
scoreCoefficientService.modify(scoreCoefficient);
}
private float beyond(float count,float coefficient,Float time){
if (coefficient<0.5f){
return 0.5f;
......
......@@ -42,98 +42,98 @@ public class Init implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
List<Authority> authorities1 = new ArrayList<>();
List<Authority> authorityList = authorityDao.findAll();
List<String> authorityName = new ArrayList<>();
if(authorityList!=null){
for (Authority authority : authorityList) {
authorityName.add(authority.getName());
}
}
if(!authorityName.contains("查看任务")){
authorities1.add(new Authority(null,"查看任务","能够查看员工的任务"));
}
if(!authorityName.contains("发布任务")){
authorities1.add(new Authority(null,"发布任务","能够发布任务给其他用户"));
}
if(!authorityName.contains("分解任务")){
authorities1.add(new Authority(null,"分解任务","对任务具有分解的功能"));
}
if(!authorityName.contains("删除任务")){
authorities1.add(new Authority(null,"删除任务","能够对任务进行删除"));
}
if(!authorityName.contains("修改任务")){
authorities1.add(new Authority(null,"修改任务","能够对任务进行修改"));
}
if(!authorityName.contains("查看人员")){
authorities1.add(new Authority(null,"查看人员","能够查看人员"));
}
if(authorities1!=null){
authorityDao.saveAll(authorities1);
}
// iRoleService.deleteAll();
User user = pasUserDao.findByUsername("root");
System.out.println(user);
if(user!=null){
List<UserRole> userRoles = userRoleDao.findAllByUserId(user.getId());
List<String> roleIds = new ArrayList<>();
for (UserRole userRole : userRoles) {
roleIds.add(userRole.getRoleId());
}
List<Role> roleList = roleDao.findAllByIdIn(roleIds);
for (Role role : roleList) {
List<RoleAuthority> roleAuthorities = roleAuthorityDao.findAllByRoleId(role.getId());
List<String> authorityIds = new ArrayList<>();
for (RoleAuthority roleAuthority : roleAuthorities) {
authorityIds.add(roleAuthority.getAuthorityId());
}
List<Authority> authorities = authorityDao.findAllByIdIn(authorityIds);
role.setAuthorities(authorities);
}
user.setRoles(roleList);
root = user;
}else{
System.out.println("77777777777777777");
this.root = new User();
Role role = new Role(null,"管理员","管理系统的人员",null,null,null);
List<Authority> authorities = new ArrayList<>();
Authority authority2 = new Authority(null,"用户管理","无");
Authority authority1 = new Authority(null,"权限管理","无");
Authority authority3 = new Authority(null,"角色管理","无");
Authority authority4 = new Authority(null,"考勤管理","无");
Authority authority5 = new Authority(null,"部门管理","无");
authorities.add(authority2);
authorities.add(authority1);
authorities.add(authority3);
authorities.add(authority4);
authorities.add(authority5);
role.setAuthorities(authorities);
this.root.createUser();
this.root.setUsername("root");
String encode = bCryptPasswordEncoder.encode("root");
this.root.setPassword(encode);
List<Role> roles = new ArrayList<>();
roles.add(role);
this.root.setRoles(roles);
List<Authority> authorities2 = authorityDao.saveAll(authorities);
List<Role> roles1 = roleDao.saveAll(roles);
Role role1 = roles1.get(0);
String id = role1.getId();
List<RoleAuthority> roleAuthorities = new ArrayList<>();
for (Authority authority : authorities2) {
roleAuthorities.add(new RoleAuthority(null,id,authority.getId()));
}
roleAuthorityDao.saveAll(roleAuthorities);
User save = pasUserDao.save(this.root);
UserRole userRole = new UserRole(null,save.getId(),id);
userRoleDao.save(userRole);
// List<Authority> authorities1 = new ArrayList<>();
// List<Authority> authorityList = authorityDao.findAll();
// List<String> authorityName = new ArrayList<>();
// if(authorityList!=null){
// for (Authority authority : authorityList) {
// authorityName.add(authority.getName());
// }
// }
// if(!authorityName.contains("查看任务")){
// authorities1.add(new Authority(null,"查看任务","能够查看员工的任务"));
// }
// if(!authorityName.contains("发布任务")){
// authorities1.add(new Authority(null,"发布任务","能够发布任务给其他用户"));
// }
// if(!authorityName.contains("分解任务")){
// authorities1.add(new Authority(null,"分解任务","对任务具有分解的功能"));
// }
// if(!authorityName.contains("删除任务")){
// authorities1.add(new Authority(null,"删除任务","能够对任务进行删除"));
// }
// if(!authorityName.contains("修改任务")){
// authorities1.add(new Authority(null,"修改任务","能够对任务进行修改"));
// }
// if(!authorityName.contains("查看人员")){
// authorities1.add(new Authority(null,"查看人员","能够查看人员"));
// }
// if(authorities1!=null){
// authorityDao.saveAll(authorities1);
// }
//
//
//// iRoleService.deleteAll();
// User user = pasUserDao.findByUsername("root");
//
// System.out.println(user);
// if(user!=null){
// List<UserRole> userRoles = userRoleDao.findAllByUserId(user.getId());
// List<String> roleIds = new ArrayList<>();
// for (UserRole userRole : userRoles) {
// roleIds.add(userRole.getRoleId());
// }
// List<Role> roleList = roleDao.findAllByIdIn(roleIds);
// for (Role role : roleList) {
// List<RoleAuthority> roleAuthorities = roleAuthorityDao.findAllByRoleId(role.getId());
// List<String> authorityIds = new ArrayList<>();
// for (RoleAuthority roleAuthority : roleAuthorities) {
// authorityIds.add(roleAuthority.getAuthorityId());
// }
// List<Authority> authorities = authorityDao.findAllByIdIn(authorityIds);
// role.setAuthorities(authorities);
// }
// user.setRoles(roleList);
// root = user;
// }else{
// System.out.println("77777777777777777");
// this.root = new User();
// Role role = new Role(null,"管理员","管理系统的人员",null,null,null);
// List<Authority> authorities = new ArrayList<>();
// Authority authority2 = new Authority(null,"用户管理","无");
// Authority authority1 = new Authority(null,"权限管理","无");
// Authority authority3 = new Authority(null,"角色管理","无");
// Authority authority4 = new Authority(null,"考勤管理","无");
// Authority authority5 = new Authority(null,"部门管理","无");
//
// authorities.add(authority2);
// authorities.add(authority1);
// authorities.add(authority3);
// authorities.add(authority4);
// authorities.add(authority5);
// role.setAuthorities(authorities);
//
// this.root.createUser();
// this.root.setUsername("root");
//
// String encode = bCryptPasswordEncoder.encode("root");
// this.root.setPassword(encode);
// List<Role> roles = new ArrayList<>();
// roles.add(role);
// this.root.setRoles(roles);
// List<Authority> authorities2 = authorityDao.saveAll(authorities);
//
// List<Role> roles1 = roleDao.saveAll(roles);
// Role role1 = roles1.get(0);
// String id = role1.getId();
// List<RoleAuthority> roleAuthorities = new ArrayList<>();
// for (Authority authority : authorities2) {
// roleAuthorities.add(new RoleAuthority(null,id,authority.getId()));
// }
// roleAuthorityDao.saveAll(roleAuthorities);
// User save = pasUserDao.save(this.root);
// UserRole userRole = new UserRole(null,save.getId(),id);
// userRoleDao.save(userRole);
// this.root.setPassword("root");
}
......@@ -199,5 +199,5 @@ public class Init implements CommandLineRunner {
// job.setName("岗位1");
//
// iJobService.addJob(job);
}
// }
}
......@@ -27,9 +27,7 @@ public class UnionApplication {
public static void main(String[] args) {
SpringApplication.run(UnionApplication.class, args);
}
// 开始支持http
// 开始支持http
@Bean
public ServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
......@@ -37,14 +35,14 @@ public class UnionApplication {
return tomcat;
}
private Connector createHTTPConnector() {
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
//同时启用http(8080)、https(8443)两个端口
connector.setScheme("http");
connector.setSecure(false);
connector.setPort(8084);
connector.setRedirectPort(8289);
return connector;
}
private Connector createHTTPConnector() {
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
//同时启用http(8080)、https(8443)两个端口
connector.setScheme("http");
connector.setSecure(false);
connector.setPort(8084);
connector.setRedirectPort(8289);
return connector;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论