|
|
@@ -17,8 +17,6 @@ import com.template.model.weixin.AuthorAndGroup2;
|
|
|
import com.template.model.weixin.AuthorListGroup;
|
|
|
import com.template.model.weixin.userAuthor;
|
|
|
import com.template.services.*;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
@@ -40,7 +38,6 @@ import java.util.stream.Collectors;
|
|
|
@DESRespondSecret
|
|
|
public class SmartAuthorGroupController implements SmartAuthorGroupControllerAPI {
|
|
|
|
|
|
- private static Logger logger = LoggerFactory.getLogger(SmartAuthorGroupController.class);
|
|
|
@Autowired
|
|
|
private SmartAuthorGroupService smartAuthorGroupService;
|
|
|
@Autowired
|
|
|
@@ -229,7 +226,7 @@ public class SmartAuthorGroupController implements SmartAuthorGroupControllerAPI
|
|
|
if (smartAuthorityC.size() > 0) {
|
|
|
SmartAuthority smartAuthority = smartAuthorityC.get(0);
|
|
|
smartAuthority.setDeleted(1);
|
|
|
- logger.info(")))" + smartAuthority.getId());
|
|
|
+ System.out.println(")))" + smartAuthority.getId());
|
|
|
smartAuthorityService.updateSmartAuthority(smartAuthority);
|
|
|
}
|
|
|
}
|
|
|
@@ -463,7 +460,6 @@ public class SmartAuthorGroupController implements SmartAuthorGroupControllerAPI
|
|
|
if (sa.getUserId()==null){
|
|
|
sa.setUserId("");
|
|
|
}
|
|
|
- String[] oldUserId = sa.getUserId().split(",");
|
|
|
String[] newUserId = userId.split(",");
|
|
|
List<String> userList = Arrays.asList(newUserId);
|
|
|
Set<String> set = new HashSet<>(userList);
|
|
|
@@ -479,6 +475,11 @@ public class SmartAuthorGroupController implements SmartAuthorGroupControllerAPI
|
|
|
if (querySmart.size() > 0) {
|
|
|
return CommonResult.fail("该用户已分配其他权限组");
|
|
|
}
|
|
|
+ QueryWrapper<SmartAuthority> queryWrapperA2 = new QueryWrapper<>();
|
|
|
+ queryWrapperA2.eq("deleted", 0);
|
|
|
+ queryWrapperA2.eq("group_id", sa.getId());
|
|
|
+ List<SmartAuthority> oldUser = smartAuthorityService.getAuthorByKey(queryWrapperA2);
|
|
|
+ List<Integer> oldUserId = oldUser.stream().map(SmartAuthority::getUserId).collect(Collectors.toList());
|
|
|
QueryWrapper<SmartUser> queryWrapperB = new QueryWrapper<>();
|
|
|
List<String> users = Arrays.asList(newUserId);
|
|
|
queryWrapperB.in("id", users);
|
|
|
@@ -487,16 +488,19 @@ public class SmartAuthorGroupController implements SmartAuthorGroupControllerAPI
|
|
|
if (!userId.equals("") && (ulist.isEmpty() || ulist.size()!=newUserId.length)){
|
|
|
return CommonResult.fail("有用户已删除");
|
|
|
}
|
|
|
- for (int i = 0; i < oldUserId.length; i++) {
|
|
|
- if (!oldUserId[i].equals("") && !userList.contains(oldUserId[i])) {
|
|
|
- QueryWrapper<SmartAuthority> queryWrapper1 = new QueryWrapper<>();
|
|
|
- queryWrapper1.eq("deleted", 0);
|
|
|
- queryWrapper1.eq("user_id", Integer.parseInt(oldUserId[i]));
|
|
|
- List<SmartAuthority> smartAuthority1 = smartAuthorityService.getAuthorByKey(queryWrapper1);
|
|
|
- if (smartAuthority1.size() > 0) {
|
|
|
- SmartAuthority smartAuthority = smartAuthority1.get(0);
|
|
|
- smartAuthority.setDeleted(1);
|
|
|
- smartAuthorityService.updateSmartAuthority(smartAuthority);
|
|
|
+ if (!oldUserId.isEmpty()){
|
|
|
+ for (int i = 0; i < oldUserId.size(); i++) {
|
|
|
+ System.out.println("-----"+oldUserId.get(i));
|
|
|
+ if (!userList.contains(String.valueOf(oldUserId.get(i)))) {
|
|
|
+ QueryWrapper<SmartAuthority> queryWrapper1 = new QueryWrapper<>();
|
|
|
+ queryWrapper1.eq("deleted", 0);
|
|
|
+ queryWrapper1.eq("user_id", oldUserId.get(i));
|
|
|
+ List<SmartAuthority> smartAuthority1 = smartAuthorityService.getAuthorByKey(queryWrapper1);
|
|
|
+ if (smartAuthority1.size() > 0) {
|
|
|
+ SmartAuthority smartAuthority = smartAuthority1.get(0);
|
|
|
+ smartAuthority.setDeleted(1);
|
|
|
+ smartAuthorityService.updateSmartAuthority(smartAuthority);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -617,9 +621,9 @@ public class SmartAuthorGroupController implements SmartAuthorGroupControllerAPI
|
|
|
@PassToken
|
|
|
@Override
|
|
|
@DESRespondSecret(validated = false)
|
|
|
- public CommonResult queryUserAuthor(String userId,String userhead) {
|
|
|
+ public CommonResult queryUserAuthor(String userId,String userHead) {
|
|
|
if (userId==null || userId.equals("")){
|
|
|
- userId = AesUtils.decrypt(userhead);
|
|
|
+ userId = AesUtils.decrypt(userHead);
|
|
|
}
|
|
|
String[] userids = userId.split(",");
|
|
|
QueryWrapper<SmartAuthority> queryWrapper1 = new QueryWrapper<>();
|