|
|
@@ -1,6 +1,7 @@
|
|
|
package com.cyksj.web.controller.manage;
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.cyksj.dto.Result;
|
|
|
@@ -9,7 +10,11 @@ import com.cyksj.mapper.GroupsRelationMapper;
|
|
|
import com.cyksj.mapper.UserMapper;
|
|
|
import com.cyksj.model.entity.GroupsRelation;
|
|
|
import com.cyksj.model.entity.User;
|
|
|
+import com.cyksj.model.entity.UserTicketClearedRecord;
|
|
|
import com.cyksj.model.manage.views.UserView;
|
|
|
+import com.cyksj.model.views.RenewalView;
|
|
|
+import com.cyksj.service.relation.GroupRelationClearService;
|
|
|
+import com.cyksj.service.relation.GroupRelationFrontService;
|
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
|
import com.ejlchina.searcher.SearchResult;
|
|
|
import com.ejlchina.searcher.util.MapBuilder;
|
|
|
@@ -19,6 +24,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.List;
|
|
|
import java.util.Optional;
|
|
|
|
|
|
/**
|
|
|
@@ -39,6 +45,13 @@ public class CmsUserController{
|
|
|
|
|
|
private final UserMapper userMapper;
|
|
|
|
|
|
+ private final GroupRelationClearService groupRelationClearService;
|
|
|
+
|
|
|
+ private final GroupsRelationMapper groupsRelationMapper;
|
|
|
+
|
|
|
+ private final GroupRelationFrontService groupRelationFrontService;
|
|
|
+
|
|
|
+
|
|
|
@GetMapping("/get")
|
|
|
@SaCheckPermission("user:view")
|
|
|
public Result<SearchResult<UserView>> get(String otherPhone) {
|
|
|
@@ -70,6 +83,13 @@ public class CmsUserController{
|
|
|
User user = userMapper.selectById(id);
|
|
|
Optional.ofNullable(user).ifPresent(u->{
|
|
|
u.setIsBlack(!u.getIsBlack());
|
|
|
+ if (u.getIsBlack()) {
|
|
|
+ List<RenewalView> groupsRelations = groupRelationFrontService.getMyTicket(u.getId(), null);
|
|
|
+ groupsRelations.forEach(ticket -> {
|
|
|
+ GroupsRelation relation = groupsRelationMapper.selectById(ticket.getRelationId());
|
|
|
+ groupRelationClearService.clearTicket(relation, UserTicketClearedRecord.Source.black);
|
|
|
+ });
|
|
|
+ }
|
|
|
userMapper.updateById(u);
|
|
|
});
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|