|
|
|
@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
import java.io.Serializable;
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 智能提醒(j_smart_reminders)表控制层
|
|
|
|
@ -195,14 +196,42 @@ public class JSmartRemindersController extends BaseController {
|
|
|
|
|
* @param dq 实体对象
|
|
|
|
|
* @return 修改结果
|
|
|
|
|
*/
|
|
|
|
|
@PreAuthorize("@ss.hasAnyRoles('admin,other-gov')")
|
|
|
|
|
@PreAuthorize("@ss.hasAnyRoles('admin,other-gov,gov')")
|
|
|
|
|
@ApiOperation(value = "修改定期提醒数据")
|
|
|
|
|
@PostMapping("/updateDq")
|
|
|
|
|
public AjaxResult updateDq(@RequestBody @Valid JSmartRemindersDq dq) throws SchedulerException, TaskException {
|
|
|
|
|
if (dq.getAlertType() == 1 || dq.getAlertType() == 4) {
|
|
|
|
|
return success(jSmartRemindersService.updateDq(dq));
|
|
|
|
|
} else {
|
|
|
|
|
throw new ServiceException("请选择正确类型!");
|
|
|
|
|
// 看当前用户是否是admin
|
|
|
|
|
boolean admin = false;
|
|
|
|
|
//查看是other-gov还是gov
|
|
|
|
|
boolean b = false;
|
|
|
|
|
boolean c = false;
|
|
|
|
|
Long userId = null;
|
|
|
|
|
try {
|
|
|
|
|
admin = SecurityUtils.isAdmin(SecurityUtils.getUserId());
|
|
|
|
|
b = SecurityUtils.hasRole("other-gov");
|
|
|
|
|
c = SecurityUtils.hasRole("gov");
|
|
|
|
|
userId=SecurityUtils.getUserId();
|
|
|
|
|
} catch (Exception ignored) {
|
|
|
|
|
}
|
|
|
|
|
if (admin || b) {
|
|
|
|
|
if (dq.getAlertType() == 1 || dq.getAlertType() == 4) {
|
|
|
|
|
return success(jSmartRemindersService.updateDq(dq));
|
|
|
|
|
} else {
|
|
|
|
|
throw new ServiceException("请选择正确类型!");
|
|
|
|
|
}
|
|
|
|
|
}else if(c){
|
|
|
|
|
JSmartReminders bys = jSmartRemindersService.getById(dq.getId());
|
|
|
|
|
if(!Objects.equals(bys.getCreateId(), userId)){
|
|
|
|
|
throw new ServiceException("您暂无权限修改他人的定时提醒!");
|
|
|
|
|
}else {
|
|
|
|
|
if (dq.getAlertType() == 1 || dq.getAlertType() == 4) {
|
|
|
|
|
return success(jSmartRemindersService.updateDq(dq));
|
|
|
|
|
} else {
|
|
|
|
|
throw new ServiceException("请选择正确类型!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
throw new ServiceException("修改失败,请联系管理员!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|