1、添加了管理员查询所有用户信息的接口

2、添加了管理员启用和禁用用户账号的接口
3、添加了管理员修改用户密码的接口
This commit is contained in:
DESKTOP-G8BCEP0\HP 2021-08-06 16:32:57 +08:00
parent 6935329dfa
commit 2573b03aea
6 changed files with 48 additions and 11 deletions

View File

@ -285,4 +285,18 @@ public class SysUserController {
} }
} }
/**
* 修改账号到期时间
* @param map
* @param token
* @return
*/
@PostMapping("/updateOverTime")
@PreAuthorize("hasAnyAuthority('auth_administor')")
public String updateOverTime(@RequestBody Map map,@RequestHeader(value="Authorization") String token){
Integer userId = (Integer) map.get("userId");
String overTime = (String) map.get("overTime");
return sysUserService.updateOverTime(userId,overTime);
}
} }

View File

@ -135,4 +135,12 @@ public interface SysUserService {
* @return * @return
*/ */
String updatePermanent(Integer userId); String updatePermanent(Integer userId);
/**
* 修改账号到期时间
* @param userId
* @param overTime
* @return
*/
String updateOverTime(Integer userId,String overTime);
} }

View File

@ -342,6 +342,7 @@ public class SysUserServiceImpl implements SysUserService {
* @param userId * @param userId
* @return * @return
*/ */
@Transactional(rollbackFor=Exception.class)
@Override @Override
public String updatePermanent(Integer userId) { public String updatePermanent(Integer userId) {
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
@ -349,4 +350,18 @@ public class SysUserServiceImpl implements SysUserService {
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"修改成功",locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"修改成功",locale);
} }
/**
* 修改账号到期时间
* @param userId
* @param overTime
* @return
*/
@Transactional(rollbackFor=Exception.class)
@Override
public String updateOverTime(Integer userId, String overTime) {
Locale locale = LocaleContextHolder.getLocale();
sysUserDao.updateOverTime(userId,overTime);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"修改成功",locale);
}
} }

View File

@ -210,11 +210,11 @@ public class DateTimeUtil {
} }
public static void main(String[] args) { public static void main(String[] args) {
long l = dateToTimeMillis(LocalDateTime.now()); LocalDateTime overTime = DateTimeUtil.stringToDateTime("2021-08-15 00:00:00");
// 计算距离结束时间的天数作为token
Duration duration = Duration.between(LocalDateTime.now(), overTime);
long l = duration.toDays();
System.out.println(l); System.out.println(l);
LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(1627616812, 0, ZoneOffset.ofHours(8));
String s = timeMillisToString(1627616812);
System.out.println(s);
} }
} }

View File

@ -65,7 +65,7 @@ public class PhotoUtil {
*/ */
public static List<FireTaskPhoto> uploadImage(MultipartFile[] files, String fireCode) throws IOException { public static List<FireTaskPhoto> uploadImage(MultipartFile[] files, String fireCode) throws IOException {
//String uploadPath = "http://139.199.98.175:2099/forestTaskImage/"; //String uploadPath = "http://139.199.98.175:2099/forestTaskImage/";
String uploadPath = "http://192.168.2.139/"; String uploadPath = "http://118.24.27.47:2088/";
String newName = ""; String newName = "";
String oldName = ""; String oldName = "";
List<FireTaskPhoto> fireTaskPhotos = new ArrayList<>(); List<FireTaskPhoto> fireTaskPhotos = new ArrayList<>();
@ -79,12 +79,12 @@ public class PhotoUtil {
//uuid生成新的文件名 //uuid生成新的文件名
newName = UUID.randomUUID().toString() + suffix; newName = UUID.randomUUID().toString() + suffix;
//将图片保存到本地/usr/etc/images/Folder //将图片保存到本地/usr/etc/images/Folder
File file1 = new File("/home/sxy/image/firePointImage/"); File file1 = new File("/home/sxy/server/fire_point/firePointImage/");
//File file1 = new File("E:/file/work/image/"); //File file1 = new File("E:/file/work/image/");
if (!file1.exists()) { if (!file1.exists()) {
file1.mkdirs(); file1.mkdirs();
} }
String path = "/home/sxy/image/firePointImage/" + newName; String path = "/home/sxy/server/fire_point/firePointImage/" + newName;
//String path = "E:/file/work/image/" + newName; //String path = "E:/file/work/image/" + newName;
String uploadPaths = "/firePointImage/" + newName; String uploadPaths = "/firePointImage/" + newName;
//实现上传 //实现上传

View File

@ -1,9 +1,9 @@
server.port = 6700 server.port = 6801
## 数据源配置 ## 数据源配置
spring.datasource.url = jdbc:postgresql://192.168.2.9:5432/fire_point spring.datasource.url = jdbc:postgresql://118.24.27.47:5432/fire_point
spring.datasource.userName = fire_point spring.datasource.userName = fire_manage
spring.datasource.password = fire_point123 spring.datasource.password = fire456
spring.datasource.driverClassName = org.postgresql.Driver spring.datasource.driverClassName = org.postgresql.Driver
server.tomcat.uri-encoding=UTF-8 server.tomcat.uri-encoding=UTF-8