fix:78578
This commit is contained in:
+21
-10
@@ -34,6 +34,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
|
import org.apache.shiro.authz.annotation.Logical;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -252,7 +253,7 @@ public class LawsStandardSharingController extends JeroController<LawsStandardSh
|
|||||||
@ApiOperation(value = "标准分享-动态消息分享", notes = "标准分享-动态消息分享")
|
@ApiOperation(value = "标准分享-动态消息分享", notes = "标准分享-动态消息分享")
|
||||||
@PostMapping(value = "/dynamicMessages/add")
|
@PostMapping(value = "/dynamicMessages/add")
|
||||||
@ApiOperationSupport(order = 6)
|
@ApiOperationSupport(order = 6)
|
||||||
@RequiresPermissions("dynamicMessage:share")
|
@RequiresPermissions(value = { "dynamicMessage:share", "dynamicMessage:search" }, logical = Logical.AND)
|
||||||
public Result<T> dynamicMessages(@RequestBody LawsStandardSharing lawsStandardSharing) {
|
public Result<T> dynamicMessages(@RequestBody LawsStandardSharing lawsStandardSharing) {
|
||||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
SysUser user = sysUserService.getById(sysUser.getId());
|
SysUser user = sysUserService.getById(sysUser.getId());
|
||||||
@@ -262,6 +263,8 @@ public class LawsStandardSharingController extends JeroController<LawsStandardSh
|
|||||||
if (0 == lawsNewsFeed.getReleaseStatus()) {
|
if (0 == lawsNewsFeed.getReleaseStatus()) {
|
||||||
throw new JeroBootException("未发布的消息不能进行分享");
|
throw new JeroBootException("未发布的消息不能进行分享");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
List<LawsStandardSharing> sharings = new ArrayList<>();
|
List<LawsStandardSharing> sharings = new ArrayList<>();
|
||||||
List<String> recipientIdList = Arrays.asList(recipientId.split(","));
|
List<String> recipientIdList = Arrays.asList(recipientId.split(","));
|
||||||
for (int i = 0; i < recipientIdList.size(); i++) {
|
for (int i = 0; i < recipientIdList.size(); i++) {
|
||||||
@@ -294,15 +297,6 @@ public class LawsStandardSharingController extends JeroController<LawsStandardSh
|
|||||||
@RequiresPermissions(value = "personalCenter:sentShare:batchDel")
|
@RequiresPermissions(value = "personalCenter:sentShare:batchDel")
|
||||||
@ApiOperationSupport(order = 7)
|
@ApiOperationSupport(order = 7)
|
||||||
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
public Result<T> deleteBatch(@RequestBody Map<String, String> map) {
|
||||||
return judge(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO 放到service里
|
|
||||||
@NotNull
|
|
||||||
private Result<T> judge(@RequestBody Map<String, String> map) {
|
|
||||||
if (!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))) {
|
|
||||||
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
|
|
||||||
}
|
|
||||||
List<String> listIds = Arrays.asList(map.get("ids").split(","));
|
List<String> listIds = Arrays.asList(map.get("ids").split(","));
|
||||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
LambdaQueryWrapper<LawsStandardSharing> queryLawsStandardSharing = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<LawsStandardSharing> queryLawsStandardSharing = new LambdaQueryWrapper<>();
|
||||||
@@ -312,7 +306,15 @@ public class LawsStandardSharingController extends JeroController<LawsStandardSh
|
|||||||
if(l > 0){
|
if(l > 0){
|
||||||
throw new JeroBootException(ResultCommon.HORIZONTAL_TRANSGRESSION);
|
throw new JeroBootException(ResultCommon.HORIZONTAL_TRANSGRESSION);
|
||||||
}
|
}
|
||||||
|
return judge(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO 放到service里
|
||||||
|
@NotNull
|
||||||
|
private Result<T> judge(@RequestBody Map<String, String> map) {
|
||||||
|
if (!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))) {
|
||||||
|
throw new JeroBootException(ResultCommon.PLEASE_SELECT_DATA);
|
||||||
|
}
|
||||||
this.lawsStandardSharingService.deleteByIds(Arrays.asList(map.get("ids").split(",")));
|
this.lawsStandardSharingService.deleteByIds(Arrays.asList(map.get("ids").split(",")));
|
||||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||||
}
|
}
|
||||||
@@ -326,6 +328,15 @@ public class LawsStandardSharingController extends JeroController<LawsStandardSh
|
|||||||
@RequiresPermissions(value = "personalCenter:receivedShare:batchDel")
|
@RequiresPermissions(value = "personalCenter:receivedShare:batchDel")
|
||||||
@ApiOperationSupport(order = 8)
|
@ApiOperationSupport(order = 8)
|
||||||
public Result<T> batchDel(@RequestBody Map<String, String> map) {
|
public Result<T> batchDel(@RequestBody Map<String, String> map) {
|
||||||
|
List<String> listIds = Arrays.asList(map.get("ids").split(","));
|
||||||
|
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
|
LambdaQueryWrapper<LawsStandardSharing> queryLawsStandardSharing = new LambdaQueryWrapper<>();
|
||||||
|
queryLawsStandardSharing.in(LawsStandardSharing::getId,listIds);
|
||||||
|
queryLawsStandardSharing.ne(LawsStandardSharing::getRecipientId,sysUser.getId());
|
||||||
|
long l = lawsStandardSharingService.count(queryLawsStandardSharing);
|
||||||
|
if(l > 0){
|
||||||
|
throw new JeroBootException(ResultCommon.HORIZONTAL_TRANSGRESSION);
|
||||||
|
}
|
||||||
return judge(map);
|
return judge(map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user