Browse Source

Merge branch 'dev_group_act_notice' into dev_temp

master
sunyuchao 4 years ago
parent
commit
f61b573e32
  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
  7. 2
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java
  8. 22
      epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.16__group_act.sql
  9. 2
      epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.17__alter_notice.sql

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 expirationTime;
/**
* 删除标记 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;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
/**
@ -31,6 +35,13 @@ public class AddNoticeFormDTO {
@NotBlank(message = "通知内容不能为空",groups = {AddNoticeFormDTO.AddUserShow.class})
@Length(max = 1000, message = "通知内容不能超过1000个字符",groups = {AddNoticeFormDTO.AddUserShow.class})
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集合
*/
private List<NoticeFileDTO> docList;
/**
* 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;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
/**
@ -31,6 +35,13 @@ public class EditNoticeFormDTO {
@NotBlank(message = "通知内容不能为空",groups = {EditNoticeFormDTO.EditUserShow.class})
@Length(max = 1000, message = "通知内容不能超过1000个字符",groups = {EditNoticeFormDTO.EditUserShow.class})
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;
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.utils.Result;
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.web.bind.annotation.*;
import java.util.Date;
/**
* 小组通知表
@ -59,6 +62,9 @@ public class NoticeController {
@PostMapping(value = "add")
public Result add(@LoginUser TokenDto tokenDto, @RequestBody AddNoticeFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, AddNoticeFormDTO.Add.class, AddNoticeFormDTO.AddUserShow.class);
if(formDTO.getExpirationTime().before(new Date())){
throw new RenException("通知过期时间不能早于当前时间");
}
formDTO.setUserId(tokenDto.getUserId());
noticeService.add(formDTO);
return new Result();
@ -73,6 +79,9 @@ public class NoticeController {
@PostMapping(value = "edit")
public Result edit(@LoginUser TokenDto tokenDto, @RequestBody EditNoticeFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, EditNoticeFormDTO.Edit.class, EditNoticeFormDTO.EditUserShow.class);
if(formDTO.getExpirationTime().before(new Date())){
throw new RenException("通知过期时间不能早于当前时间");
}
formDTO.setUserId(tokenDto.getUserId());
noticeService.edit(formDTO);
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 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.setIsChange("no");
entity.setChangeTime(new Date());
entity.setExpirationTime(formDTO.getExpirationTime());
insert(entity);
//5.保存附件数据
@ -310,6 +311,7 @@ public class NoticeServiceImpl extends BaseServiceImpl<NoticeDao, NoticeEntity>
entity.setContent(formDTO.getContent());
entity.setIsChange("yes");
entity.setChangeTime(new Date());
entity.setExpirationTime(formDTO.getExpirationTime());
baseDao.updateById(entity);
//5.通知附件表数据先删后增

2
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/utils/ModuleConstant.java

@ -372,7 +372,7 @@ public interface ModuleConstant extends Constant {
/**
* 活动扫码签到对应的跳转到 活动详情页面
*/
String GROUP_ACT_DETAIL_PAGE = "pages/group/activity/detail";
String GROUP_ACT_DETAIL_PAGE = "subpages/group/pages/group/activity/detail";
String TOPIC_CONTENT_AND_VOICE_IS_NULL = "请输入话题内容或语音";

22
epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.16__group_act.sql

@ -17,6 +17,28 @@ CREATE TABLE `group_message` (
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='组内消息(话题、通知、活动)记录表';
INSERT INTO group_message SELECT
md5(uuid()),
rg.customer_id,
rg.grid_id,
rt.group_id,
'topic',
rt.id,
rt.created_by,
rt.`status`,
rt.created_time,
'0',
'0',
rt.created_by,
NOW(),
rt.UPDATED_BY,
NOW()
FROM
resi_topic rt
INNER JOIN resi_group rg ON rt.group_id = rg.id
WHERE
rt.del_flag = '0'
AND rg.del_flag = '0'
/*
Navicat Premium Data Transfer

2
epmet-module/resi-group/resi-group-server/src/main/resources/db/migration/V0.0.17__alter_notice.sql

@ -0,0 +1,2 @@
ALTER TABLE `notice`
ADD COLUMN `EXPIRATION_TIME` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '通知过期时间(此时间需大于变更时间)' AFTER `CHANGE_TIME`;
Loading…
Cancel
Save