|
@ -18,6 +18,7 @@ |
|
|
package com.epmet.modules.notice.controller; |
|
|
package com.epmet.modules.notice.controller; |
|
|
|
|
|
|
|
|
import com.epmet.commons.tools.annotation.LoginUser; |
|
|
import com.epmet.commons.tools.annotation.LoginUser; |
|
|
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
@ -30,6 +31,8 @@ import com.epmet.resi.group.dto.notice.result.NoticeDetailResultDTO; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 小组通知表 |
|
|
* 小组通知表 |
|
@ -59,6 +62,9 @@ public class NoticeController { |
|
|
@PostMapping(value = "add") |
|
|
@PostMapping(value = "add") |
|
|
public Result add(@LoginUser TokenDto tokenDto, @RequestBody AddNoticeFormDTO formDTO){ |
|
|
public Result add(@LoginUser TokenDto tokenDto, @RequestBody AddNoticeFormDTO formDTO){ |
|
|
ValidatorUtils.validateEntity(formDTO, AddNoticeFormDTO.Add.class, AddNoticeFormDTO.AddUserShow.class); |
|
|
ValidatorUtils.validateEntity(formDTO, AddNoticeFormDTO.Add.class, AddNoticeFormDTO.AddUserShow.class); |
|
|
|
|
|
if(formDTO.getExpirationTime().before(new Date())){ |
|
|
|
|
|
throw new RenException("通知过期时间不能早于当前时间"); |
|
|
|
|
|
} |
|
|
formDTO.setUserId(tokenDto.getUserId()); |
|
|
formDTO.setUserId(tokenDto.getUserId()); |
|
|
noticeService.add(formDTO); |
|
|
noticeService.add(formDTO); |
|
|
return new Result(); |
|
|
return new Result(); |
|
@ -73,6 +79,9 @@ public class NoticeController { |
|
|
@PostMapping(value = "edit") |
|
|
@PostMapping(value = "edit") |
|
|
public Result edit(@LoginUser TokenDto tokenDto, @RequestBody EditNoticeFormDTO formDTO){ |
|
|
public Result edit(@LoginUser TokenDto tokenDto, @RequestBody EditNoticeFormDTO formDTO){ |
|
|
ValidatorUtils.validateEntity(formDTO, EditNoticeFormDTO.Edit.class, EditNoticeFormDTO.EditUserShow.class); |
|
|
ValidatorUtils.validateEntity(formDTO, EditNoticeFormDTO.Edit.class, EditNoticeFormDTO.EditUserShow.class); |
|
|
|
|
|
if(formDTO.getExpirationTime().before(new Date())){ |
|
|
|
|
|
throw new RenException("通知过期时间不能早于当前时间"); |
|
|
|
|
|
} |
|
|
formDTO.setUserId(tokenDto.getUserId()); |
|
|
formDTO.setUserId(tokenDto.getUserId()); |
|
|
noticeService.edit(formDTO); |
|
|
noticeService.edit(formDTO); |
|
|
return new Result(); |
|
|
return new Result(); |
|
|