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

修改接口参数

上级 2c9e9d62
流水线 #81 已失败 于阶段
...@@ -2,6 +2,7 @@ package com.zjty.tynotes.job.basic.controller; ...@@ -2,6 +2,7 @@ package com.zjty.tynotes.job.basic.controller;
import com.zjty.tynotes.job.basic.entity.database.Work; import com.zjty.tynotes.job.basic.entity.database.Work;
import com.zjty.tynotes.job.basic.entity.request.UpdateCrew; import com.zjty.tynotes.job.basic.entity.request.UpdateCrew;
import com.zjty.tynotes.job.basic.entity.request.UpdateWorkload;
import com.zjty.tynotes.job.basic.entity.request.WorkRo; import com.zjty.tynotes.job.basic.entity.request.WorkRo;
import com.zjty.tynotes.job.basic.entity.response.JobResponse; import com.zjty.tynotes.job.basic.entity.response.JobResponse;
import com.zjty.tynotes.job.basic.entity.response.WorkIsNotCommit; import com.zjty.tynotes.job.basic.entity.response.WorkIsNotCommit;
...@@ -118,22 +119,11 @@ public class WorkController { ...@@ -118,22 +119,11 @@ public class WorkController {
@PutMapping(value = "/upDate/Workload") @PutMapping(value = "/upDate/Workload")
@ApiOperation(value = "修改任务的工作量、考评系数.") @ApiOperation(value = "修改任务的工作量、考评系数.")
@ApiImplicitParams({ public ResponseEntity<JobResponse> updateWorkload(@RequestBody UpdateWorkload updateWorkload) {
@ApiImplicitParam(name="workId",value="任务id",dataType="String", paramType = "query",required = true),
@ApiImplicitParam(name="workload",value="工作量",dataType="int", paramType = "query",required = true),
@ApiImplicitParam(name="userId",value="人员id",dataType="String", paramType = "query",required = true),
@ApiImplicitParam(name="workCoefficient",value="考评系数",dataType="int", paramType = "query",required = true),
@ApiImplicitParam(name="msg",value="消息",dataType="String", paramType = "query",required = true)
})
public ResponseEntity<JobResponse> updateWorkload(@RequestParam String workId,
@RequestParam String userId,
@RequestParam int workCoefficient,
@RequestParam int workload,
@RequestParam String msg) {
businessTreeManagement.saveAction(userId,workId,Action.UPDATE_WORKLOAD,new Date(),msg); businessTreeManagement.saveAction(updateWorkload.getUserId(),updateWorkload.getWorkId(),Action.UPDATE_WORKLOAD,new Date(),updateWorkload.getMsg());
workService.updateWorkload(workId,workload,workCoefficient); workService.updateWorkload(updateWorkload.getWorkId(),updateWorkload.getWorkload(),updateWorkload.getWorkCoefficient());
return ok(new JobResponse(workId)); return ok(new JobResponse(updateWorkload.getWorkId()));
} }
......
package com.zjty.tynotes.job.basic.entity.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.web.bind.annotation.RequestParam;
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "修改任务考评以及工作量", description = "修改任务考评以及工作量数据对象")
public class UpdateWorkload {
@ApiModelProperty(value = "任务id", example = "workId")
private String workId;
@ApiModelProperty(value = "修改人的id", example = "userId")
private String userId;
@ApiModelProperty(value = "考评系数", example = "workCoefficient")
private float workCoefficient;
@ApiModelProperty(value = "工作量", example = "workload")
private int workload;
@ApiModelProperty(value = "描述", example = "msg")
private String msg;
}
...@@ -111,7 +111,7 @@ public interface WorkService { ...@@ -111,7 +111,7 @@ public interface WorkService {
* @param workload 工作量 * @param workload 工作量
* @param workCoefficient 考评系数 只能修改0.1-0.2 * @param workCoefficient 考评系数 只能修改0.1-0.2
*/ */
void updateWorkload(String taskId, int workload, int workCoefficient); void updateWorkload(String taskId, int workload, float workCoefficient);
/** /**
......
...@@ -223,7 +223,7 @@ return null; ...@@ -223,7 +223,7 @@ return null;
} }
@Override @Override
public void updateWorkload(String taskId, int workload, int workCoefficient) { public void updateWorkload(String taskId, int workload, float workCoefficient) {
Work ob = workRepository.findById(taskId).get(); Work ob = workRepository.findById(taskId).get();
ob.setWorkload(workload); ob.setWorkload(workload);
ob.setWorkCoefficient(workCoefficient); ob.setWorkCoefficient(workCoefficient);
......
...@@ -42,103 +42,103 @@ public class Init implements CommandLineRunner { ...@@ -42,103 +42,103 @@ public class Init implements CommandLineRunner {
@Override @Override
public void run(String... args) throws Exception { public void run(String... args) throws Exception {
// List<Authority> authorities1 = new ArrayList<>(); List<Authority> authorities1 = new ArrayList<>();
// List<Authority> authorityList = authorityDao.findAll(); List<Authority> authorityList = authorityDao.findAll();
// List<String> authorityName = new ArrayList<>(); List<String> authorityName = new ArrayList<>();
// if(authorityList!=null){ if (authorityList != null) {
// for (Authority authority : authorityList) { for (Authority authority : authorityList) {
// authorityName.add(authority.getName()); authorityName.add(authority.getName());
// } }
// } }
// if(!authorityName.contains("查看任务")){ if (!authorityName.contains("查看任务")) {
// authorities1.add(new Authority(null,"查看任务","能够查看员工的任务")); authorities1.add(new Authority(null, "查看任务", "能够查看员工的任务"));
// } }
// if(!authorityName.contains("发布任务")){ if (!authorityName.contains("发布任务")) {
// authorities1.add(new Authority(null,"发布任务","能够发布任务给其他用户")); authorities1.add(new Authority(null, "发布任务", "能够发布任务给其他用户"));
// } }
// if(!authorityName.contains("分解任务")){ if (!authorityName.contains("分解任务")) {
// authorities1.add(new Authority(null,"分解任务","对任务具有分解的功能")); authorities1.add(new Authority(null, "分解任务", "对任务具有分解的功能"));
// } }
// if(!authorityName.contains("删除任务")){ if (!authorityName.contains("删除任务")) {
// authorities1.add(new Authority(null,"删除任务","能够对任务进行删除")); authorities1.add(new Authority(null, "删除任务", "能够对任务进行删除"));
// } }
// if(!authorityName.contains("修改任务")){ if (!authorityName.contains("修改任务")) {
// authorities1.add(new Authority(null,"修改任务","能够对任务进行修改")); authorities1.add(new Authority(null, "修改任务", "能够对任务进行修改"));
// } }
// if(!authorityName.contains("查看人员")){ if (!authorityName.contains("查看人员")) {
// authorities1.add(new Authority(null,"查看人员","能够查看人员")); authorities1.add(new Authority(null, "查看人员", "能够查看人员"));
// } }
// if(authorities1!=null){ if (authorities1 != null) {
// authorityDao.saveAll(authorities1); authorityDao.saveAll(authorities1);
// } }
//
// //
//// iRoleService.deleteAll(); //// iRoleService.deleteAll();
// User user = pasUserDao.findByUsername("root"); 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"); 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");
}
;
// User user1 = new User(); // User user1 = new User();
// user1.createUser(); // user1.createUser();
...@@ -200,4 +200,5 @@ public class Init implements CommandLineRunner { ...@@ -200,4 +200,5 @@ public class Init implements CommandLineRunner {
// //
// iJobService.addJob(job); // iJobService.addJob(job);
// } // }
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论