diff --git a/src/main/java/com/xkrs/controller/SysUserController.java b/src/main/java/com/xkrs/controller/SysUserController.java index 2d66658..6e01635 100644 --- a/src/main/java/com/xkrs/controller/SysUserController.java +++ b/src/main/java/com/xkrs/controller/SysUserController.java @@ -394,25 +394,6 @@ public class SysUserController { return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "true", locale); } - /** - * 更改账号过期时间 - */ - @PostMapping("/updateExpireDate") - public String updateExpireDate(@RequestBody Map map, @RequestHeader(value = "Authorization") String token) { - Long userId = (Long) map.get("userId"); - Integer timeNum = (Integer) map.get("timeNum"); - String keepType = (String) map.get("keepType"); - if ("1".equals(keepType)) { - return sysUserService.updateExpireDateDay(userId, timeNum); - } else if ("2".equals(keepType)) { - return sysUserService.updateExpireDateMonth(userId, timeNum); - } else if ("3".equals(keepType)) { - return sysUserService.updateExpireDateYear(userId, timeNum); - } else { - return sysUserService.updatePermanent(userId); - } - } - /** * 修改账号到期时间 */ diff --git a/src/main/java/com/xkrs/straw/service/SysUserService.java b/src/main/java/com/xkrs/straw/service/SysUserService.java index b8264e3..d0ce6b4 100644 --- a/src/main/java/com/xkrs/straw/service/SysUserService.java +++ b/src/main/java/com/xkrs/straw/service/SysUserService.java @@ -109,41 +109,6 @@ public interface SysUserService { */ SysUserEntity getUserByUserName(String userName); - /** - * 按天数修改账号到期时间 - * - * @param userId - * @param dayNum - * @return - */ - String updateExpireDateDay(Long userId, Integer dayNum); - - /** - * 按月份修改账号到期时间 - * - * @param userId - * @param dayNum - * @return - */ - String updateExpireDateMonth(Long userId, Integer dayNum); - - /** - * 按年份修改账号到期时间 - * - * @param userId - * @param dayNum - * @return - */ - String updateExpireDateYear(Long userId, Integer dayNum); - - /** - * 设置账号时间永久有效 - * - * @param userId - * @return - */ - String updatePermanent(Long userId); - /** * 修改账号到期时间 * diff --git a/src/main/java/com/xkrs/straw/service/impl/SysUserServiceImpl.java b/src/main/java/com/xkrs/straw/service/impl/SysUserServiceImpl.java index a6c445f..bb2de36 100644 --- a/src/main/java/com/xkrs/straw/service/impl/SysUserServiceImpl.java +++ b/src/main/java/com/xkrs/straw/service/impl/SysUserServiceImpl.java @@ -14,7 +14,6 @@ import com.xkrs.straw.model.entity.RelUserRoleEntity; import com.xkrs.straw.model.entity.SysRoleEntity; import com.xkrs.straw.model.entity.SysUserEntity; import com.xkrs.straw.service.SysUserService; -import com.xkrs.utils.DateTimeUtil; import org.apache.http.util.TextUtils; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.data.domain.Sort; @@ -324,100 +323,6 @@ public class SysUserServiceImpl implements SysUserService { return sysUserEntityList.get(0); } - /** - * 按天数修改账号到期时间 - * - * @param userId - * @param dayNum - * @return - */ - @Transactional(rollbackFor = Exception.class) - @Override - public String updateExpireDateDay(Long userId, Integer dayNum) { - long l = dayNum.longValue(); - LocalDateTime now = LocalDateTime.now(); - SysUserEntity sysUserEntity = sysUserDao.selectByUserId(userId); - if (DateTimeUtil.dateTimeToString(now).compareTo(sysUserEntity.getOverTime()) > 0) { - LocalDateTime localDateTime = now.plusDays(l); - String time = dateTimeToString(localDateTime); - sysUserDao.updateOverTime(userId, time); - return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale); - } else { - LocalDateTime localDateTime = DateTimeUtil.stringToDateTime(sysUserEntity.getOverTime()); - LocalDateTime localDateTime1 = localDateTime.plusDays(l); - String time = dateTimeToString(localDateTime1); - sysUserDao.updateOverTime(userId, time); - return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale); - } - } - - /** - * 按月份修改账号过期时间 - * - * @param userId - * @param dayNum - * @return - */ - @Transactional(rollbackFor = Exception.class) - @Override - public String updateExpireDateMonth(Long userId, Integer dayNum) { - long l = dayNum.longValue(); - LocalDateTime now = LocalDateTime.now(); - SysUserEntity sysUserEntity = sysUserDao.selectByUserId(userId); - if (DateTimeUtil.dateTimeToString(now).compareTo(sysUserEntity.getOverTime()) > 0) { - LocalDateTime localDateTime = now.plusMonths(l); - String time = dateTimeToString(localDateTime); - sysUserDao.updateOverTime(userId, time); - return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale); - } else { - LocalDateTime localDateTime = DateTimeUtil.stringToDateTime(sysUserEntity.getOverTime()); - LocalDateTime localDateTime1 = localDateTime.plusMonths(l); - String time = dateTimeToString(localDateTime1); - sysUserDao.updateOverTime(userId, time); - return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale); - } - } - - /** - * 按年份修改账号到期时间 - * - * @param userId - * @param dayNum - * @return - */ - @Transactional(rollbackFor = Exception.class) - @Override - public String updateExpireDateYear(Long userId, Integer dayNum) { - long l = dayNum.longValue(); - LocalDateTime now = LocalDateTime.now(); - SysUserEntity sysUserEntity = sysUserDao.selectByUserId(userId); - if (DateTimeUtil.dateTimeToString(now).compareTo(sysUserEntity.getOverTime()) > 0) { - LocalDateTime localDateTime = now.plusYears(l); - String time = dateTimeToString(localDateTime); - sysUserDao.updateOverTime(userId, time); - return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale); - } else { - LocalDateTime localDateTime = DateTimeUtil.stringToDateTime(sysUserEntity.getOverTime()); - LocalDateTime localDateTime1 = localDateTime.plusYears(l); - String time = dateTimeToString(localDateTime1); - sysUserDao.updateOverTime(userId, time); - return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale); - } - } - - /** - * 设置账号永久有效 - * - * @param userId - * @return - */ - @Transactional(rollbackFor = Exception.class) - @Override - public String updatePermanent(Long userId) { - sysUserDao.updateDayNum(userId); - return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale); - } - /** * 修改账号到期时间 *