diff --git a/src/main/java/com/xkrs/controller/SysUserController.java b/src/main/java/com/xkrs/controller/SysUserController.java index 8b9ae2c..f711c79 100644 --- a/src/main/java/com/xkrs/controller/SysUserController.java +++ b/src/main/java/com/xkrs/controller/SysUserController.java @@ -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); + } + } diff --git a/src/main/java/com/xkrs/service/SysUserService.java b/src/main/java/com/xkrs/service/SysUserService.java index 2380a3a..d8d0886 100644 --- a/src/main/java/com/xkrs/service/SysUserService.java +++ b/src/main/java/com/xkrs/service/SysUserService.java @@ -135,4 +135,12 @@ public interface SysUserService { * @return */ String updatePermanent(Integer userId); + + /** + * 修改账号到期时间 + * @param userId + * @param overTime + * @return + */ + String updateOverTime(Integer userId,String overTime); } diff --git a/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java b/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java index 29ec83b..b85ef74 100644 --- a/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/SysUserServiceImpl.java @@ -342,6 +342,7 @@ public class SysUserServiceImpl implements SysUserService { * @param userId * @return */ + @Transactional(rollbackFor=Exception.class) @Override public String updatePermanent(Integer userId) { Locale locale = LocaleContextHolder.getLocale(); @@ -349,4 +350,18 @@ public class SysUserServiceImpl implements SysUserService { 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); + } + } diff --git a/src/main/java/com/xkrs/utils/DateTimeUtil.java b/src/main/java/com/xkrs/utils/DateTimeUtil.java index 78990c8..0e311e5 100644 --- a/src/main/java/com/xkrs/utils/DateTimeUtil.java +++ b/src/main/java/com/xkrs/utils/DateTimeUtil.java @@ -210,11 +210,11 @@ public class DateTimeUtil { } 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); - LocalDateTime localDateTime = LocalDateTime.ofEpochSecond(1627616812, 0, ZoneOffset.ofHours(8)); - String s = timeMillisToString(1627616812); - System.out.println(s); } } diff --git a/src/main/java/com/xkrs/utils/PhotoUtil.java b/src/main/java/com/xkrs/utils/PhotoUtil.java index 021805a..10ff940 100644 --- a/src/main/java/com/xkrs/utils/PhotoUtil.java +++ b/src/main/java/com/xkrs/utils/PhotoUtil.java @@ -65,7 +65,7 @@ public class PhotoUtil { */ public static List uploadImage(MultipartFile[] files, String fireCode) throws IOException { //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 oldName = ""; List fireTaskPhotos = new ArrayList<>(); @@ -79,12 +79,12 @@ public class PhotoUtil { //uuid生成新的文件名 newName = UUID.randomUUID().toString() + suffix; //将图片保存到本地/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/"); if (!file1.exists()) { 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 uploadPaths = "/firePointImage/" + newName; //实现上传 diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 4aab479..67f3fd5 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,9 +1,9 @@ -server.port = 6700 +server.port = 6801 ## 数据源配置 -spring.datasource.url = jdbc:postgresql://192.168.2.9:5432/fire_point -spring.datasource.userName = fire_point -spring.datasource.password = fire_point123 +spring.datasource.url = jdbc:postgresql://118.24.27.47:5432/fire_point +spring.datasource.userName = fire_manage +spring.datasource.password = fire456 spring.datasource.driverClassName = org.postgresql.Driver server.tomcat.uri-encoding=UTF-8