|
@@ -24,6 +24,7 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.time.Instant;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneId;
|
|
@@ -132,7 +133,7 @@ public class CommunityReportController {
|
|
|
@ApiOperation("管理员查看界面")
|
|
|
@GetMapping("/adminReport")
|
|
|
//@Anonymous
|
|
|
- public AjaxResult adminReport(String id,Long type,String name,String reason,String userId) {
|
|
|
+ public AjaxResult adminReport(Long id,Long type,String name,String reason,String userId) {
|
|
|
List<CommunityReportUserVo> communityReportUsers = null;
|
|
|
int total = 0 ;
|
|
|
try {
|
|
@@ -181,14 +182,30 @@ public class CommunityReportController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
String disposalType = communityReportPunishVo.getDisposalType().toString(); //封禁类型
|
|
|
Long disposalTime = communityReportPunishVo.getDisposalTime(); //封禁时间
|
|
|
String dispositionReason = communityReportPunishVo.getDispositionReason(); //封禁理由
|
|
|
|
|
|
- //计算封禁的时间
|
|
|
+
|
|
|
+ //判断当前用户有没有被封禁或者禁言
|
|
|
+ SysUser sysUser = sysUserMapper.selectUserById(communityReportPunishVo.getUserId());
|
|
|
+ String userState = sysUser.getUserState();
|
|
|
+ Date reportTime = sysUser.getReportTime();
|
|
|
Date date = DateUtils.parseDate(DateUtils.getTime());
|
|
|
+ if (reportTime != null && reportTime.after(date)) {
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-dd-MM HH:mm:ss"); // 修改日期格式
|
|
|
+ String formattedReportTime = sdf.format(reportTime); // 格式化日期
|
|
|
+ if ("1".equals(userState)){
|
|
|
+ return AjaxResult.success("该用户已经被封号! 截止日期为:" + formattedReportTime);
|
|
|
+ }else if ("2".equals(userState) && "2".equals(disposalType)){
|
|
|
+ return AjaxResult.success("该用户已经被禁言! 截止日期为:" + formattedReportTime);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ //计算封禁的时间
|
|
|
+
|
|
|
Date futureDate = null;
|
|
|
if (disposalTime != null && disposalTime >= 0) {
|
|
|
long millisecondsToAdd = TimeUnit.MINUTES.toMillis(disposalTime); //转换时间
|
|
@@ -211,11 +228,12 @@ public class CommunityReportController {
|
|
|
reportUser.setUpdateBy(SecurityUtils.getUserId());
|
|
|
reportUser.setUpdateTime(DateUtils.parseDate(DateUtils.getTime()));
|
|
|
|
|
|
- String replyId = communityReportPunishVo.getReplyId();
|
|
|
+ Long replyId = communityReportPunishVo.getReplyId();
|
|
|
switch (disposalType) {
|
|
|
case "0": //不处理
|
|
|
break;
|
|
|
case "1": //封号
|
|
|
+ //判断当前用户是否已经被封号
|
|
|
userService.updateUserProfile(user);
|
|
|
communityReportUserMapper.updateById(reportUser);
|
|
|
break;
|