Browse Source

需求变更添加通知过期时间引起的代码变化

dev_shibei_match
sunyuchao 4 years ago
parent
commit
db35fa98b1
  1. 5
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/NoticeDTO.java
  2. 12
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/AddNoticeFormDTO.java
  3. 11
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/EditNoticeFormDTO.java
  4. 9
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeController.java
  5. 5
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeEntity.java
  6. 2
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java

5
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/NoticeDTO.java

@ -78,6 +78,11 @@ public class NoticeDTO implements Serializable {
*/ */
private Date changeTime; private Date changeTime;
/**
* 通知过期时间(此时间需大于变更时间)
*/
private Date expirationTime;
/** /**
* 删除标记 0未删除1已删除 * 删除标记 0未删除1已删除
*/ */

12
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/AddNoticeFormDTO.java

@ -1,10 +1,14 @@
package com.epmet.resi.group.dto.notice.form; package com.epmet.resi.group.dto.notice.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -31,6 +35,13 @@ public class AddNoticeFormDTO {
@NotBlank(message = "通知内容不能为空",groups = {AddNoticeFormDTO.AddUserShow.class}) @NotBlank(message = "通知内容不能为空",groups = {AddNoticeFormDTO.AddUserShow.class})
@Length(max = 1000, message = "通知内容不能超过1000个字符",groups = {AddNoticeFormDTO.AddUserShow.class}) @Length(max = 1000, message = "通知内容不能超过1000个字符",groups = {AddNoticeFormDTO.AddUserShow.class})
private String content; private String content;
/**
* 通知过期时间(此时间需大于变更时间)
*/
@NotNull(message = "过期时间不能为空",groups = AddNoticeFormDTO.AddUserShow.class)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date expirationTime;
/** /**
* 图片附件集合 * 图片附件集合
*/ */
@ -39,7 +50,6 @@ public class AddNoticeFormDTO {
* 文件附件url集合 * 文件附件url集合
*/ */
private List<NoticeFileDTO> docList; private List<NoticeFileDTO> docList;
/** /**
* token中用户Id * token中用户Id
*/ */

11
epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/notice/form/EditNoticeFormDTO.java

@ -1,10 +1,14 @@
package com.epmet.resi.group.dto.notice.form; package com.epmet.resi.group.dto.notice.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -31,6 +35,13 @@ public class EditNoticeFormDTO {
@NotBlank(message = "通知内容不能为空",groups = {EditNoticeFormDTO.EditUserShow.class}) @NotBlank(message = "通知内容不能为空",groups = {EditNoticeFormDTO.EditUserShow.class})
@Length(max = 1000, message = "通知内容不能超过1000个字符",groups = {EditNoticeFormDTO.EditUserShow.class}) @Length(max = 1000, message = "通知内容不能超过1000个字符",groups = {EditNoticeFormDTO.EditUserShow.class})
private String content; private String content;
/**
* 通知过期时间(此时间需大于变更时间)
*/
@NotNull(message = "过期时间不能为空",groups = AddNoticeFormDTO.AddUserShow.class)
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date expirationTime;
/** /**
* 图片附件集合 * 图片附件集合
*/ */

9
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/controller/NoticeController.java

@ -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();

5
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/entity/NoticeEntity.java

@ -78,4 +78,9 @@ public class NoticeEntity extends BaseEpmetEntity {
*/ */
private Date changeTime; private Date changeTime;
/**
* 通知过期时间(此时间需大于变更时间)
*/
private Date expirationTime;
} }

2
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/notice/service/impl/NoticeServiceImpl.java

@ -180,6 +180,7 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
entity.setContent(formDTO.getContent()); entity.setContent(formDTO.getContent());
entity.setIsChange("no"); entity.setIsChange("no");
entity.setChangeTime(new Date()); entity.setChangeTime(new Date());
entity.setExpirationTime(formDTO.getExpirationTime());
insert(entity); insert(entity);
//5.保存附件数据 //5.保存附件数据
@ -310,6 +311,7 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
entity.setContent(formDTO.getContent()); entity.setContent(formDTO.getContent());
entity.setIsChange("yes"); entity.setIsChange("yes");
entity.setChangeTime(new Date()); entity.setChangeTime(new Date());
entity.setExpirationTime(formDTO.getExpirationTime());
baseDao.updateById(entity); baseDao.updateById(entity);
//5.通知附件表数据先删后增 //5.通知附件表数据先删后增

Loading…
Cancel
Save