提交 5cf3774c authored 作者: gongwenjie's avatar gongwenjie

接口注释,人员部分代码

上级 f388f23d
...@@ -3,7 +3,6 @@ package com.zjty.tynotes.pas.config; ...@@ -3,7 +3,6 @@ package com.zjty.tynotes.pas.config;
import com.zjty.tynotes.pas.config.handler.MyAccessHandler; import com.zjty.tynotes.pas.config.handler.MyAccessHandler;
import com.zjty.tynotes.pas.config.handler.MyFailHandler; import com.zjty.tynotes.pas.config.handler.MyFailHandler;
import com.zjty.tynotes.pas.config.handler.MyLogoutHandler; import com.zjty.tynotes.pas.config.handler.MyLogoutHandler;
import com.zjty.tynotes.pas.config.handler.MySuccessHandler;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -46,8 +45,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -46,8 +45,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired @Autowired
private MyLogoutHandler myLogoutHandler; private MyLogoutHandler myLogoutHandler;
@Autowired
private MySuccessHandler successHandler;
@Autowired @Autowired
private MyFailHandler failHandler; private MyFailHandler failHandler;
...@@ -97,7 +94,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -97,7 +94,6 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Bean @Bean
public MyFilter myFilter() throws Exception { public MyFilter myFilter() throws Exception {
MyFilter filter = new MyFilter(); MyFilter filter = new MyFilter();
filter.setAuthenticationSuccessHandler(successHandler);
filter.setAuthenticationFailureHandler(failHandler); filter.setAuthenticationFailureHandler(failHandler);
filter.setFilterProcessesUrl("/userLogin"); filter.setFilterProcessesUrl("/userLogin");
filter.setAuthenticationManager(this.authenticationManager()); filter.setAuthenticationManager(this.authenticationManager());
......
...@@ -44,9 +44,6 @@ ...@@ -44,9 +44,6 @@
// @Autowired // @Autowired
// IRoleService iRoleService; // IRoleService iRoleService;
// //
// @Autowired
// IMenuSerivce iMenuSerivce;
//
// private BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder(); // private BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();
// //
// @Autowired // @Autowired
......
...@@ -91,9 +91,6 @@ public class User implements UserDetails, Serializable { ...@@ -91,9 +91,6 @@ public class User implements UserDetails, Serializable {
@Transient @Transient
private List<Role> roles; private List<Role> roles;
@Transient
private List<Work> works;
@Transient @Transient
private String status;//工作状态(0代表空闲 1代表忙碌) private String status;//工作状态(0代表空闲 1代表忙碌)
......
...@@ -13,6 +13,11 @@ ...@@ -13,6 +13,11 @@
<dependencies> <dependencies>
<dependency>
<groupId>com.zjty.tynotes</groupId>
<artifactId>notes-job</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.zjty.tynotes</groupId> <groupId>com.zjty.tynotes</groupId>
<artifactId>notes-misc</artifactId> <artifactId>notes-misc</artifactId>
......
package com.zjty.tynotes.weekly.subject.entity.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.zjty.tynotes.pas.entity.Role;
import com.zjty.tynotes.pas.entity.User;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* @Author gwj
* @create 2020/3/3 10:03
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserVo {
@Id
@ApiModelProperty(value = "id",example = "1")
private String id;
@NotEmpty(message = "身份证号码不可为空")
@ApiModelProperty(value = "身份证",example = "48489498131566546")
private String idCard;
@NotEmpty(message = "地址不可为空")
@ApiModelProperty(value = "地址",example = "xx路xx楼xx号")
private String address;
@NotEmpty(message = "联系方式不可为空")
@ApiModelProperty(value = "联系方式",example = "113665465465")
private String phone1;
@NotEmpty(message = "联系方式不可为空")
@ApiModelProperty(value = "联系方式",example = "113665465465")
private String phone2;
@NotEmpty(message = "部门1不可为空")
@ApiModelProperty(value = "部门1",example = "研发部")
private String department1;
@NotEmpty(message = "部门2不可为空")
@ApiModelProperty(value = "部门2",example = "技术中心")
private String department2;
@NotEmpty(message = "部门3不可为空")
@ApiModelProperty(value = "部门3",example = "工作簿项目组")
private String department3;
@NotNull(message = "岗位不可为空")
@ApiModelProperty(value = "岗位",example = "1")
private String jobs;
@NotNull(message = "入职时间不可为空")
@ApiModelProperty(value = "入职时间",example = "2019-01-45 12:12:12")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Integer entryTime;
@NotEmpty(message = "邮箱不可为空")
@ApiModelProperty(value = "邮箱",example = "123456789@qq.com")
private String email;
@NotEmpty(message = "用户名不可为空")
@ApiModelProperty(value = "用户名",example = "username")
private String username;
@NotEmpty(message = "密码不可为空")
@ApiModelProperty(value = "密码",example = "password")
private String password;
@NotEmpty(message = "部门id")
@ApiModelProperty(value = "部门id",example = "1")
private String departmentId;
private List<Role> roles;
private String status;//工作状态(0代表空闲 1代表忙碌)
private Integer workCount;
// @NotNull(message = "角色Id不可为空")
// @ApiModelProperty(value = "角色id",example = "1")
// private Integer roleId;
public UserVo(User user) {
this.id = user.getId();
this.idCard = user.getIdCard();
this.address = user.getAddress();
this.phone1 = user.getPhone1();
this.phone2 = user.getPhone2();
this.department1 = user.getDepartment1();
this.department2 = user.getDepartment2();
this.department3 = user.getDepartment3();
this.jobs = user.getJobs();
this.entryTime = user.getEntryTime();
this.email = user.getEmail();
this.username = user.getUsername();
this.password = user.getPassword();
this.departmentId = user.getDepartmentId();
this.roles = new ArrayList<>();
this.status = null;
this.workCount = null;
}
}
...@@ -4,6 +4,7 @@ import com.zjty.tynotes.pas.entity.Department; ...@@ -4,6 +4,7 @@ import com.zjty.tynotes.pas.entity.Department;
import com.zjty.tynotes.pas.entity.User; import com.zjty.tynotes.pas.entity.User;
import com.zjty.tynotes.pas.entity.vo.PageRequest; import com.zjty.tynotes.pas.entity.vo.PageRequest;
import com.zjty.tynotes.pas.entity.vo.PageResponse; import com.zjty.tynotes.pas.entity.vo.PageResponse;
import com.zjty.tynotes.weekly.subject.entity.vo.UserVo;
import java.util.List; import java.util.List;
...@@ -24,7 +25,7 @@ public interface UserManageService { ...@@ -24,7 +25,7 @@ public interface UserManageService {
* @param pageRequest * @param pageRequest
* @return * @return
*/ */
PageResponse<User> findUserList(PageRequest pageRequest); PageResponse<UserVo> findUserList(PageRequest pageRequest);
/** /**
* 根据用户id查询可管理的部门列表 * 根据用户id查询可管理的部门列表
...@@ -33,11 +34,11 @@ public interface UserManageService { ...@@ -33,11 +34,11 @@ public interface UserManageService {
*/ */
List<Department> findDepartmentList(String id); List<Department> findDepartmentList(String id);
/** // /**
* 根据任务状态查询人员任务列表 // * 根据任务状态查询人员任务列表
* @param id // * @param id
* @param status // * @param status
* @return // * @return
*/ // */
List<Work> findUserWork(String id, String status); // List<Work> findUserWork(String id, String status);
} }
package com.zjty.tynotes.weekly.subject.service.impl; package com.zjty.tynotes.weekly.subject.service.impl;
import com.zjty.tynotes.job.basic.entity.database.Work;
import com.zjty.tynotes.job.basic.repository.WorkRepository;
import com.zjty.tynotes.job.status.entity.Personnel;
import com.zjty.tynotes.job.status.service.InternalService;
import com.zjty.tynotes.pas.dao.*; import com.zjty.tynotes.pas.dao.*;
import com.zjty.tynotes.pas.entity.*; import com.zjty.tynotes.pas.entity.*;
import com.zjty.tynotes.pas.entity.vo.PageRequest; import com.zjty.tynotes.pas.entity.vo.PageRequest;
import com.zjty.tynotes.pas.entity.vo.PageResponse; import com.zjty.tynotes.pas.entity.vo.PageResponse;
import com.zjty.tynotes.weekly.subject.entity.vo.UserVo;
import com.zjty.tynotes.weekly.subject.service.UserManageService; import com.zjty.tynotes.weekly.subject.service.UserManageService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import java.util.Optional;
/** /**
* @Author gwj * @Author gwj
...@@ -31,6 +34,8 @@ public class UserManageServiceImpl implements UserManageService { ...@@ -31,6 +34,8 @@ public class UserManageServiceImpl implements UserManageService {
private AuthorityDao authorityDao; private AuthorityDao authorityDao;
@Autowired @Autowired
private DepartmentDao departmentDao; private DepartmentDao departmentDao;
@Autowired
private InternalService internalService;
@Override @Override
public User findUserById(String id) { public User findUserById(String id) {
...@@ -50,34 +55,18 @@ public class UserManageServiceImpl implements UserManageService { ...@@ -50,34 +55,18 @@ public class UserManageServiceImpl implements UserManageService {
} }
/** /**
* 查询人员列表 待完成 * 查询人员列表
* @param pageRequest * @param pageRequest
* @return * @return
*/ */
@Override @Override
public PageResponse<User> findUserList(PageRequest pageRequest) { public PageResponse<UserVo> findUserList(PageRequest pageRequest) {
List<User> users = new ArrayList<>(); List<User> users = new ArrayList<>();
PageResponse<User> pageResponse = new PageResponse<>(); PageResponse<UserVo> pageResponse = new PageResponse<>();
pageResponse.setCurrentPage(pageRequest.getCurrentPage()); pageResponse.setCurrentPage(pageRequest.getCurrentPage());
pageResponse.setPageSize(pageRequest.getPageSize()); pageResponse.setPageSize(pageRequest.getPageSize());
if(pageRequest.getDeId()!=null){ if(pageRequest.getDeId()!=null){
if(pageRequest.getSort()!=null && ("1").equals(pageRequest.getSort())){
users = pasUserDao.findAllByDepartmentId(pageRequest.getId()); users = pasUserDao.findAllByDepartmentId(pageRequest.getId());
if(pageRequest.getSort()!=null){
for (User user : users) {
//根据用户id查询任务数量
}
}
}else{
}
pageResponse.setTotalCount(users.size());
pageResponse.setRows(users);
pageResponse.build(users);
return pageResponse;
}else{ }else{
List<Department> departmentList = findDepartmentList(pageRequest.getId()); List<Department> departmentList = findDepartmentList(pageRequest.getId());
List<String> departmentIds = new ArrayList<>(); List<String> departmentIds = new ArrayList<>();
...@@ -86,6 +75,43 @@ public class UserManageServiceImpl implements UserManageService { ...@@ -86,6 +75,43 @@ public class UserManageServiceImpl implements UserManageService {
} }
users = pasUserDao.findAllByDepartmentIdIn(departmentIds); users = pasUserDao.findAllByDepartmentIdIn(departmentIds);
} }
List<String> userIds = new ArrayList<>();
for (User user : users) {
userIds.add(user.getId());
}
List<Personnel> personnels = internalService.personnels(userIds);
List<UserVo> userVos = new ArrayList<>();
for (User user : users) {
for (Personnel personnel : personnels) {
if(user.getId().equals(personnel.getId())){
UserVo userVo = new UserVo(user);
userVo.setWorkCount(personnel.getCount());
userVos.add(userVo);
}
}
}
if(pageRequest.getSort()!=null && pageRequest.getSort()==1) {
Collections.sort(userVos, new Comparator<UserVo>() {
@Override
public int compare(UserVo o1, UserVo o2) {
return o1.getWorkCount()-o2.getWorkCount();
}
});
}else{
Collections.sort(userVos, new Comparator<UserVo>() {
@Override
public int compare(UserVo o1, UserVo o2) {
return o2.getWorkCount()-o1.getWorkCount();
}
});
}
int startNum=(pageResponse.getCurrentPage()-1)*10+1;
int endNum = startNum+pageResponse.getPageSize();
List<UserVo> userVos1 = userVos.subList(startNum - 1, endNum - 1);
pageResponse.setRows(userVos1);
pageResponse.setTotalPage((userVos.size()/pageResponse.getPageSize())+1);
pageResponse.setTotalCount(userVos.size());
return pageResponse; return pageResponse;
} }
...@@ -136,18 +162,6 @@ public class UserManageServiceImpl implements UserManageService { ...@@ -136,18 +162,6 @@ public class UserManageServiceImpl implements UserManageService {
} }
/**
* 待完成,需要任务提供接口
* @param id
* @param status
* @return
*/
@Override
public List<Work> findUserWork(String id, String status) {
List<Work> works = workDao.find(id,status);
return works;
}
private List<Department> findDepartmentList(List<Department> des, List<Department> deps){ private List<Department> findDepartmentList(List<Department> des, List<Department> deps){
for (Department department : deps) { for (Department department : deps) {
if(!des.contains(department)){ if(!des.contains(department)){
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论