替换旧代码

This commit is contained in:
liuchengqian 2023-02-14 17:48:47 +08:00
parent 59a9e524f5
commit 47c94551fa
3 changed files with 0 additions and 149 deletions

View File

@ -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);
}
}
/**
* 修改账号到期时间
*/

View File

@ -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);
/**
* 修改账号到期时间
*

View File

@ -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);
}
/**
* 修改账号到期时间
*