|
|
@@ -82,10 +82,13 @@ public class AdPlanConfController {
|
|
|
private final OssFileMapper ossFileMapper;
|
|
|
|
|
|
@GetMapping("/gdtSuspendByConfId")
|
|
|
- public Result<Void> gdtSuspendByConfId(@NotNull Long confId) {
|
|
|
+ public Result<Void> gdtSuspendByConfId(@NotNull Long confId, @AuthUser SysUser sysUser) {
|
|
|
AdPlanConf adPlanConf = adPlanConfService.getById(confId);
|
|
|
if (adPlanConf == null) {
|
|
|
return Result.fail("广告计划配置不存在");
|
|
|
+ }
|
|
|
+ if (!adPlanConf.getJobNumber().equals(sysUser.getJobNumber())) {
|
|
|
+ return Result.fail("当前用户无权限暂停该配置");
|
|
|
}
|
|
|
String lockKey = "ad_plan_conf_suspend_all_lock_" + confId;
|
|
|
Boolean isLocked = redisTemplate.opsForValue().setIfAbsent(lockKey, "1", 1, TimeUnit.MINUTES);
|
|
|
@@ -101,7 +104,8 @@ public class AdPlanConfController {
|
|
|
}
|
|
|
|
|
|
@PostMapping("/gdtSuspendByPlanIds/{confId}")
|
|
|
- public Result<Void> gdtSuspendByPlanIds(@PathVariable Long confId, @RequestBody List<Long> planIds) {
|
|
|
+ public Result<Void> gdtSuspendByPlanIds(@PathVariable Long confId,
|
|
|
+ @RequestBody List<Long> planIds, @AuthUser SysUser sysUser) {
|
|
|
if (planIds == null) {
|
|
|
return Result.success("请选择要暂停广告");
|
|
|
}
|
|
|
@@ -109,6 +113,9 @@ public class AdPlanConfController {
|
|
|
if (adPlanConf == null) {
|
|
|
return Result.fail("广告计划配置不存在");
|
|
|
}
|
|
|
+ if (!adPlanConf.getJobNumber().equals(sysUser.getJobNumber())) {
|
|
|
+ return Result.fail("当前用户无权限暂停该配置");
|
|
|
+ }
|
|
|
String lockKey = "ad_plan_conf_suspend_selected_lock_" + confId;
|
|
|
Boolean isLocked = redisTemplate.opsForValue().setIfAbsent(lockKey, "1", 1, TimeUnit.MINUTES);
|
|
|
if (!isLocked) {
|
|
|
@@ -123,11 +130,14 @@ public class AdPlanConfController {
|
|
|
}
|
|
|
|
|
|
@GetMapping("/gdtDeleteByConfId")
|
|
|
- public Result<Void> gdtDeleteByConfId(@NotNull Long confId) {
|
|
|
+ public Result<Void> gdtDeleteByConfId(@NotNull Long confId, @AuthUser SysUser sysUser) {
|
|
|
AdPlanConf adPlanConf = adPlanConfService.getById(confId);
|
|
|
if (adPlanConf == null) {
|
|
|
return Result.fail("广告计划配置不存在");
|
|
|
}
|
|
|
+ if (!adPlanConf.getJobNumber().equals(sysUser.getJobNumber())) {
|
|
|
+ return Result.fail("当前用户无权限删除该配置");
|
|
|
+ }
|
|
|
String lockKey = "ad_plan_conf_delete_all_lock_" + confId;
|
|
|
Boolean isLocked = redisTemplate.opsForValue().setIfAbsent(lockKey, "1", 1, TimeUnit.MINUTES);
|
|
|
if (!isLocked) {
|
|
|
@@ -478,6 +488,9 @@ public class AdPlanConfController {
|
|
|
confId = adPlanConfService.createAdPlanConf(adPlanConf);
|
|
|
request.setId(confId);
|
|
|
} else {
|
|
|
+ if (!request.getJobNumber().equals(sysUser.getJobNumber())) {
|
|
|
+ return Result.fail("当前用户无权限修改该配置");
|
|
|
+ }
|
|
|
BeanUtils.copyProperties(request, adPlanConf);
|
|
|
adPlanConfService.updateAdPlanConf(adPlanConf);
|
|
|
}
|
|
|
@@ -499,6 +512,14 @@ public class AdPlanConfController {
|
|
|
|
|
|
@GetMapping("/reGeneratePlan/{id}")
|
|
|
public Result<Void> reGeneratePlan(@PathVariable Long id, @AuthUser SysUser sysUser) {
|
|
|
+ AdPlanConf adPlanConf = adPlanConfService.lambdaQuery()
|
|
|
+ .eq(AdPlanConf::getId, id)
|
|
|
+ .eq(AdPlanConf::getJobNumber, sysUser.getJobNumber())
|
|
|
+ .one();
|
|
|
+ if (adPlanConf == null) {
|
|
|
+ return Result.fail("当前用户无权限执行该配置");
|
|
|
+ }
|
|
|
+
|
|
|
SysUser user = sysUserService.getById(sysUser.getId());
|
|
|
LocalDateTime userTokenExpiresAt = user.getUserTokenExpiresAt();
|
|
|
if (userTokenExpiresAt == null || userTokenExpiresAt.isBefore(LocalDateTime.now())) {
|