提交 6920d067 authored 作者: gongwenjie's avatar gongwenjie

合并分支 'gwj' 到 'master'

Gwj 查看合并请求 !14
流水线 #20 已取消 于阶段
...@@ -53,15 +53,12 @@ public class User implements UserDetails, Serializable { ...@@ -53,15 +53,12 @@ public class User implements UserDetails, Serializable {
@ApiModelProperty(value = "联系方式",example = "113665465465") @ApiModelProperty(value = "联系方式",example = "113665465465")
private String phone2; private String phone2;
@NotEmpty(message = "部门1不可为空")
@ApiModelProperty(value = "部门1",example = "研发部") @ApiModelProperty(value = "部门1",example = "研发部")
private String department1; private String department1;
@NotEmpty(message = "部门2不可为空")
@ApiModelProperty(value = "部门2",example = "技术中心") @ApiModelProperty(value = "部门2",example = "技术中心")
private String department2; private String department2;
@NotEmpty(message = "部门3不可为空")
@ApiModelProperty(value = "部门3",example = "工作簿项目组") @ApiModelProperty(value = "部门3",example = "工作簿项目组")
private String department3; private String department3;
...@@ -72,7 +69,7 @@ public class User implements UserDetails, Serializable { ...@@ -72,7 +69,7 @@ public class User implements UserDetails, Serializable {
@NotNull(message = "入职时间不可为空") @NotNull(message = "入职时间不可为空")
@ApiModelProperty(value = "入职时间",example = "2019-01-45 12:12:12") @ApiModelProperty(value = "入职时间",example = "2019-01-45 12:12:12")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Integer entryTime; private String entryTime;
@NotEmpty(message = "邮箱不可为空") @NotEmpty(message = "邮箱不可为空")
@ApiModelProperty(value = "邮箱",example = "123456789@qq.com") @ApiModelProperty(value = "邮箱",example = "123456789@qq.com")
...@@ -81,7 +78,6 @@ public class User implements UserDetails, Serializable { ...@@ -81,7 +78,6 @@ public class User implements UserDetails, Serializable {
@NotEmpty(message = "用户名不可为空") @NotEmpty(message = "用户名不可为空")
@ApiModelProperty(value = "用户名",example = "username") @ApiModelProperty(value = "用户名",example = "username")
private String username; private String username;
@NotEmpty(message = "密码不可为空")
@ApiModelProperty(value = "密码",example = "password") @ApiModelProperty(value = "密码",example = "password")
private String password; private String password;
......
...@@ -68,7 +68,7 @@ public class ConfigServiceImpl implements ConfigService { ...@@ -68,7 +68,7 @@ public class ConfigServiceImpl implements ConfigService {
@Override @Override
public List<Day> findHolidaysByMonth(String date) { public List<Day> findHolidaysByMonth(String date) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
try { try {
Date date1 = sdf.parse(date); Date date1 = sdf.parse(date);
int year = date1.getYear()+1900; int year = date1.getYear()+1900;
...@@ -101,7 +101,7 @@ public class ConfigServiceImpl implements ConfigService { ...@@ -101,7 +101,7 @@ public class ConfigServiceImpl implements ConfigService {
return dayDao.saveAll(days1); return dayDao.saveAll(days1);
} }
calendar.set(Calendar.MONTH,month-1); calendar.set(Calendar.MONTH,month-1);
calendar.set(Calendar.DAY_OF_MONTH,1); calendar.set(Calendar.DAY_OF_MONTH,0);
firstDate = calendar.getTime(); firstDate = calendar.getTime();
calendar.set(Calendar.MONTH,month); calendar.set(Calendar.MONTH,month);
calendar.set(Calendar.DAY_OF_MONTH,1); calendar.set(Calendar.DAY_OF_MONTH,1);
......
...@@ -16,6 +16,7 @@ import org.springframework.data.mongodb.core.query.Criteria; ...@@ -16,6 +16,7 @@ import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query; import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update; import org.springframework.data.mongodb.core.query.Update;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -36,6 +37,8 @@ public class UserServiceImpl implements IUserService { ...@@ -36,6 +37,8 @@ public class UserServiceImpl implements IUserService {
private static final Logger logger = LoggerFactory.getLogger(UserServiceImpl.class); private static final Logger logger = LoggerFactory.getLogger(UserServiceImpl.class);
@Autowired @Autowired
MongoTemplate mongoTemplate; MongoTemplate mongoTemplate;
@Autowired
private BCryptPasswordEncoder bCryptPasswordEncoder;
@Autowired @Autowired
RedisTemplate<String,Object> defaultRedisTpl; RedisTemplate<String,Object> defaultRedisTpl;
...@@ -128,7 +131,19 @@ public class UserServiceImpl implements IUserService { ...@@ -128,7 +131,19 @@ public class UserServiceImpl implements IUserService {
@Override @Override
public User findUserById(String id) { public User findUserById(String id) {
Optional<User> byId = pasUserDao.findById(id); Optional<User> byId = pasUserDao.findById(id);
return byId.orElseGet(User::new); List<String> roleIds = new ArrayList<>();
User user = null;
if(byId.isPresent()){
user = byId.get();
List<UserRole> userRoles = userRoleDao.findAllByUserId(user.getId());
for (UserRole userRole : userRoles) {
roleIds.add(userRole.getRoleId());
}
List<Role> roles = roleDao.findAllByIdIn(roleIds);
user.setRoles(roles);
}
return user;
} }
@Override @Override
...@@ -173,6 +188,8 @@ public class UserServiceImpl implements IUserService { ...@@ -173,6 +188,8 @@ public class UserServiceImpl implements IUserService {
@Override @Override
public User addUser(User user) { public User addUser(User user) {
String encode = bCryptPasswordEncoder.encode("qwer1234");
user.setPassword(encode);
List<Role> roles = user.getRoles(); List<Role> roles = user.getRoles();
List<UserRole> userRoles = new ArrayList<>(); List<UserRole> userRoles = new ArrayList<>();
List<User> users = pasUserDao.findAll(); List<User> users = pasUserDao.findAll();
......
...@@ -47,15 +47,12 @@ public class UserVo { ...@@ -47,15 +47,12 @@ public class UserVo {
@ApiModelProperty(value = "联系方式",example = "113665465465") @ApiModelProperty(value = "联系方式",example = "113665465465")
private String phone2; private String phone2;
@NotEmpty(message = "部门1不可为空")
@ApiModelProperty(value = "部门1",example = "研发部") @ApiModelProperty(value = "部门1",example = "研发部")
private String department1; private String department1;
@NotEmpty(message = "部门2不可为空")
@ApiModelProperty(value = "部门2",example = "技术中心") @ApiModelProperty(value = "部门2",example = "技术中心")
private String department2; private String department2;
@NotEmpty(message = "部门3不可为空")
@ApiModelProperty(value = "部门3",example = "工作簿项目组") @ApiModelProperty(value = "部门3",example = "工作簿项目组")
private String department3; private String department3;
...@@ -66,7 +63,7 @@ public class UserVo { ...@@ -66,7 +63,7 @@ public class UserVo {
@NotNull(message = "入职时间不可为空") @NotNull(message = "入职时间不可为空")
@ApiModelProperty(value = "入职时间",example = "2019-01-45 12:12:12") @ApiModelProperty(value = "入职时间",example = "2019-01-45 12:12:12")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Integer entryTime; private String entryTime;
@NotEmpty(message = "邮箱不可为空") @NotEmpty(message = "邮箱不可为空")
@ApiModelProperty(value = "邮箱",example = "123456789@qq.com") @ApiModelProperty(value = "邮箱",example = "123456789@qq.com")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论