From 0b71ba8f79ca8ce7f0419b7a8351b48cc2b989fb Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 4 May 2023 16:32:17 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E6=9C=AA=E5=AE=8C=E5=BE=85=E7=BB=AD.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/OrganizationMessageDTO.java | 100 ++++++++++++++++++ .../OrganizationMessagePublishRangeDTO.java | 89 ++++++++++++++++ .../form/OrganizationMessagePageFormDTO.java | 30 ++++++ .../result/OrganizationMessageResultDTO.java | 65 ++++++++++++ .../OrganizationMessageController.java | 49 +++++++++ .../com/epmet/dao/OrganizationMessageDao.java | 16 +++ .../OrganizationMessagePublishRangeDao.java | 16 +++ .../entity/OrganizationMessageEntity.java | 69 ++++++++++++ ...OrganizationMessagePublishRangeEntity.java | 56 ++++++++++ .../service/OrganizationMessageService.java | 27 +++++ .../impl/OrganizationMessageServiceImpl.java | 42 ++++++++ .../mapper/OrganizationMessageDao.xml | 26 +++++ .../OrganizationMessagePublishRangeDao.xml | 24 +++++ 13 files changed, 609 insertions(+) create mode 100644 epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/OrganizationMessageDTO.java create mode 100644 epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/OrganizationMessagePublishRangeDTO.java create mode 100644 epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/OrganizationMessagePageFormDTO.java create mode 100644 epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/OrganizationMessageResultDTO.java create mode 100644 epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/OrganizationMessageController.java create mode 100644 epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/OrganizationMessageDao.java create mode 100644 epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/OrganizationMessagePublishRangeDao.java create mode 100644 epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/OrganizationMessageEntity.java create mode 100644 epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/OrganizationMessagePublishRangeEntity.java create mode 100644 epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/OrganizationMessageService.java create mode 100644 epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/OrganizationMessageServiceImpl.java create mode 100644 epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/OrganizationMessageDao.xml create mode 100644 epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/OrganizationMessagePublishRangeDao.xml diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/OrganizationMessageDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/OrganizationMessageDTO.java new file mode 100644 index 0000000000..547bcb6f8b --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/OrganizationMessageDTO.java @@ -0,0 +1,100 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 组织发布消息(烟台) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-05-04 + */ +@Data +public class OrganizationMessageDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 发布渠道:0:专属app + */ + private String publishDitch; + + /** + * 消息内容;最多输入500 + */ + private String content; + + /** + * 发布人staffId + */ + private String publishStaffId; + + /** + * 发布人姓名 + */ + private String publishStaffName; + + /** + * 发布人所属组织id + */ + private String publishOrgId; + + /** + * org_id_path + */ + private String publishOrgIdPath; + + /** + * 发布人所属组织名称 + */ + private String publishOrgName; + + /** + * 发布时间 + */ + private Date publishTime; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/OrganizationMessagePublishRangeDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/OrganizationMessagePublishRangeDTO.java new file mode 100644 index 0000000000..4350a479c9 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/OrganizationMessagePublishRangeDTO.java @@ -0,0 +1,89 @@ +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 消息发布范围(烟台) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-05-04 + */ +@Data +public class OrganizationMessagePublishRangeDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 消息id:organization_message.id + */ + private String messageId; + + /** + * 组织或者网格id + */ + private String orgId; + + /** + * 组织:agency;网格:grid + */ + private String orgType; + + /** + * org_id的父级 + */ + private String pid; + + /** + * org_id的全路径,包含org_id + */ + private String orgIdPath; + + /** + * 组织名称或者网格名称;如果是网格名称,存储的是XXX社区-XX网格 + */ + private String orgName; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/OrganizationMessagePageFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/OrganizationMessagePageFormDTO.java new file mode 100644 index 0000000000..1e5b23d884 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/OrganizationMessagePageFormDTO.java @@ -0,0 +1,30 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import lombok.Data; + +/** + * @Description 烟台消息管理,列表查询入参 + * @Author yzm + * @Date 2023/5/4 16:05 + */ +@Data +public class OrganizationMessagePageFormDTO extends PageFormDTO { + /** + * 发布渠道:0:专属app + */ + private String publishDitch; + /** + * 发布范围,组织id或者网格id + */ + private String orgId; + /** + * yyyy-MM-dd + */ + private String startDate; + /** + * yyyy-MM-dd + */ + private String endDate; +} + diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/OrganizationMessageResultDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/OrganizationMessageResultDTO.java new file mode 100644 index 0000000000..0d68bafe6d --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/result/OrganizationMessageResultDTO.java @@ -0,0 +1,65 @@ +package com.epmet.dto.result; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +/** + * @Description 烟台消息管理,列表查询 + * @Author yzm + * @Date 2023/5/4 16:06 + */ +@Data +public class OrganizationMessageResultDTO { + /** + * 消息id + */ + private String messageId; + + /** + * 发布渠道:0:专属app + */ + private String publishDitch; + + /** + * 消息内容;最多输入500 + */ + private String content; + /** + * 发布范围 + */ + private String publishRangeName; + + /** + * 发布时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date publishTime; + + /** + * 发布人staffId + */ + private String publishStaffId; + + /** + * 发布人姓名 + */ + private String publishStaffName; + + /** + * 发布人所属组织id + */ + private String publishOrgId; + + /** + * org_id_path + */ + private String publishOrgIdPath; + + /** + * 发布人所属组织名称 + */ + private String publishOrgName; +} + diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/OrganizationMessageController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/OrganizationMessageController.java new file mode 100644 index 0000000000..d36e1c74af --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/OrganizationMessageController.java @@ -0,0 +1,49 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.OrganizationMessagePageFormDTO; +import com.epmet.dto.result.OrganizationMessageResultDTO; +import com.epmet.service.OrganizationMessageService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +/** + * 组织发布消息(烟台) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-05-04 + */ +@RestController +@RequestMapping("organization/message") +public class OrganizationMessageController { + + @Autowired + private OrganizationMessageService organizationMessageService; + + /** + * 列表查询 + * + * @param formDTO + * @return + */ + @PostMapping("list") + public Result> pageList(@RequestBody OrganizationMessagePageFormDTO formDTO) { + return new Result>().ok(organizationMessageService.pageList(formDTO.getPageNo(), formDTO.getPageSize(), + formDTO.getPublishDitch(), + formDTO.getOrgId(), + formDTO.getStartDate(), + formDTO.getEndDate())); + } + + + + + + + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/OrganizationMessageDao.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/OrganizationMessageDao.java new file mode 100644 index 0000000000..3cec0ac2fc --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/OrganizationMessageDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.OrganizationMessageEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 组织发布消息(烟台) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-05-04 + */ +@Mapper +public interface OrganizationMessageDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/OrganizationMessagePublishRangeDao.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/OrganizationMessagePublishRangeDao.java new file mode 100644 index 0000000000..94a9a65100 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/OrganizationMessagePublishRangeDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.OrganizationMessagePublishRangeEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 消息发布范围(烟台) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-05-04 + */ +@Mapper +public interface OrganizationMessagePublishRangeDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/OrganizationMessageEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/OrganizationMessageEntity.java new file mode 100644 index 0000000000..383720be2a --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/OrganizationMessageEntity.java @@ -0,0 +1,69 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 组织发布消息(烟台) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-05-04 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("organization_message") +public class OrganizationMessageEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 发布渠道:0:专属app + */ + private String publishDitch; + + /** + * 消息内容;最多输入500 + */ + private String content; + + /** + * 发布人staffId + */ + private String publishStaffId; + + /** + * 发布人姓名 + */ + private String publishStaffName; + + /** + * 发布人所属组织id + */ + private String publishOrgId; + + /** + * org_id_path + */ + private String publishOrgIdPath; + + /** + * 发布人所属组织名称 + */ + private String publishOrgName; + + /** + * 发布时间 + */ + private Date publishTime; + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/OrganizationMessagePublishRangeEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/OrganizationMessagePublishRangeEntity.java new file mode 100644 index 0000000000..5080cfe16f --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/OrganizationMessagePublishRangeEntity.java @@ -0,0 +1,56 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 消息发布范围(烟台) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-05-04 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("organization_message_publish_range") +public class OrganizationMessagePublishRangeEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 消息id:organization_message.id + */ + private String messageId; + + /** + * 组织或者网格id + */ + private String orgId; + + /** + * 组织:agency;网格:grid + */ + private String orgType; + + /** + * org_id的父级 + */ + private String pid; + + /** + * org_id的全路径,包含org_id + */ + private String orgIdPath; + + /** + * 组织名称或者网格名称;如果是网格名称,存储的是XXX社区-XX网格 + */ + private String orgName; + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/OrganizationMessageService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/OrganizationMessageService.java new file mode 100644 index 0000000000..794f2725b9 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/OrganizationMessageService.java @@ -0,0 +1,27 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.result.OrganizationMessageResultDTO; +import com.epmet.entity.OrganizationMessageEntity; + +/** + * 组织发布消息(烟台) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-05-04 + */ +public interface OrganizationMessageService extends BaseService { + + /** + * 分页列表 + * @param pageNo + * @param pageSize + * @param publishDitch 发布渠道;0:专属app + * @param orgId 发布范围,组织id或者网格id + * @param startDate yyyy-MM-dd + * @param endDate yyyy-MM-dd + * @return + */ + PageData pageList(Integer pageNo, Integer pageSize, String publishDitch, String orgId, String startDate, String endDate); +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/OrganizationMessageServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/OrganizationMessageServiceImpl.java new file mode 100644 index 0000000000..0ddb025c07 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/OrganizationMessageServiceImpl.java @@ -0,0 +1,42 @@ +package com.epmet.service.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.utils.EpmetRequestHolder; +import com.epmet.dao.OrganizationMessageDao; +import com.epmet.dto.result.OrganizationMessageResultDTO; +import com.epmet.entity.OrganizationMessageEntity; +import com.epmet.service.OrganizationMessageService; +import com.github.pagehelper.PageHelper; +import org.springframework.stereotype.Service; + +/** + * 组织发布消息(烟台) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-05-04 + */ +@Service +public class OrganizationMessageServiceImpl extends BaseServiceImpl implements OrganizationMessageService { + /** + * 分页列表 + * + * @param pageNo + * @param pageSize + * @param publishDitch 发布渠道;0:专属app + * @param orgId 发布范围,组织id或者网格id + * @param startDate yyyy-MM-dd + * @param endDate yyyy-MM-dd + * @return + */ + @Override + public PageData pageList(Integer pageNo, Integer pageSize, String publishDitch, String orgId, String startDate, String endDate) { + CustomerStaffInfoCacheResult staffInfoCacheResult= CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(),EpmetRequestHolder.getLoginUserId()); + PageHelper.startPage(pageNo,pageSize); + //todo + // List list=baseDao.pageList(staffOrgIdPath,publishDitch,orgId,startDate,endDate); + return null; + } +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/OrganizationMessageDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/OrganizationMessageDao.xml new file mode 100644 index 0000000000..49ee7aa52e --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/OrganizationMessageDao.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/OrganizationMessagePublishRangeDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/OrganizationMessagePublishRangeDao.xml new file mode 100644 index 0000000000..18e02ac73f --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/OrganizationMessagePublishRangeDao.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 09fc9988fb77217ab24fb94dfec882fd19792a3d Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 4 May 2023 18:32:22 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E4=BA=86=E5=86=85?= =?UTF-8?q?=E5=AE=B9=EF=BC=8C=E8=BF=98=E6=B2=A1=E5=8F=91=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/OrganizationMessageDTO.java | 100 ------------------ .../epmet/dto/OrganizationMessageFormDTO.java | 52 +++++++++ .../OrganizationMessagePublishRangeDTO.java | 36 +------ .../OrganizationMessageController.java | 40 +++++-- .../com/epmet/dao/OrganizationMessageDao.java | 22 +++- .../service/OrganizationMessageService.java | 15 +++ .../impl/OrganizationMessageServiceImpl.java | 88 ++++++++++++++- .../mapper/OrganizationMessageDao.xml | 37 ++++++- 8 files changed, 245 insertions(+), 145 deletions(-) delete mode 100644 epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/OrganizationMessageDTO.java create mode 100644 epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/OrganizationMessageFormDTO.java diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/OrganizationMessageDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/OrganizationMessageDTO.java deleted file mode 100644 index 547bcb6f8b..0000000000 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/OrganizationMessageDTO.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.epmet.dto; - -import lombok.Data; - -import java.io.Serializable; -import java.util.Date; - - -/** - * 组织发布消息(烟台) - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2023-05-04 - */ -@Data -public class OrganizationMessageDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - */ - private String id; - - /** - * 客户Id - */ - private String customerId; - - /** - * 发布渠道:0:专属app - */ - private String publishDitch; - - /** - * 消息内容;最多输入500 - */ - private String content; - - /** - * 发布人staffId - */ - private String publishStaffId; - - /** - * 发布人姓名 - */ - private String publishStaffName; - - /** - * 发布人所属组织id - */ - private String publishOrgId; - - /** - * org_id_path - */ - private String publishOrgIdPath; - - /** - * 发布人所属组织名称 - */ - private String publishOrgName; - - /** - * 发布时间 - */ - private Date publishTime; - - /** - * 删除标识:0.未删除 1.已删除 - */ - private Integer delFlag; - - /** - * 乐观锁 - */ - private Integer revision; - - /** - * 创建人 - */ - private String createdBy; - - /** - * 创建时间 - */ - private Date createdTime; - - /** - * 更新人 - */ - private String updatedBy; - - /** - * 更新时间 - */ - private Date updatedTime; - -} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/OrganizationMessageFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/OrganizationMessageFormDTO.java new file mode 100644 index 0000000000..cc42aa46ba --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/OrganizationMessageFormDTO.java @@ -0,0 +1,52 @@ +package com.epmet.dto; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + + +/** + * 组织发布消息(烟台) + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2023-05-04 + */ +@Data +public class OrganizationMessageFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + public interface AddShowGroup extends CustomerClientShowGroup { + } + /** + * 发布渠道:0:专属app + */ + @NotBlank(message = "发布渠道不能为空", groups = {AddShowGroup.class}) + private String publishDitch; + + /** + * 消息内容;最多输入500 + */ + @NotBlank(message = "内容不能为空", groups = {AddShowGroup.class}) + @Length(max = 500, message = "内容输入500字", groups = {AddShowGroup.class}) + private String content; + + @Valid + @NotEmpty(message = "发布范围不能为空", groups = {AddShowGroup.class}) + private List rangeList; + + /** + * 客户Id + */ + private String customerId; + /** + * 发布人staffId + */ + private String publishStaffId; +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/OrganizationMessagePublishRangeDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/OrganizationMessagePublishRangeDTO.java index 4350a479c9..2b51910c48 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/OrganizationMessagePublishRangeDTO.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/OrganizationMessagePublishRangeDTO.java @@ -1,9 +1,10 @@ package com.epmet.dto; -import java.io.Serializable; -import java.util.Date; import lombok.Data; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + /** * 消息发布范围(烟台) @@ -34,11 +35,13 @@ public class OrganizationMessagePublishRangeDTO implements Serializable { /** * 组织或者网格id */ + @NotBlank(message = "orgId不能为空",groups = {OrganizationMessageFormDTO.AddShowGroup.class}) private String orgId; /** * 组织:agency;网格:grid */ + @NotBlank(message = "orgType不能为空",groups = {OrganizationMessageFormDTO.AddShowGroup.class}) private String orgType; /** @@ -56,34 +59,5 @@ public class OrganizationMessagePublishRangeDTO implements Serializable { */ private String orgName; - /** - * 删除标识:0.未删除 1.已删除 - */ - private Integer delFlag; - - /** - * 乐观锁 - */ - private Integer revision; - - /** - * 创建人 - */ - private String createdBy; - - /** - * 创建时间 - */ - private Date createdTime; - - /** - * 更新人 - */ - private String updatedBy; - - /** - * 更新时间 - */ - private Date updatedTime; } \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/OrganizationMessageController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/OrganizationMessageController.java index d36e1c74af..ea14265f47 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/OrganizationMessageController.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/OrganizationMessageController.java @@ -1,15 +1,17 @@ package com.epmet.controller; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.OrganizationMessageFormDTO; import com.epmet.dto.form.OrganizationMessagePageFormDTO; import com.epmet.dto.result.OrganizationMessageResultDTO; import com.epmet.service.OrganizationMessageService; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** @@ -40,10 +42,32 @@ public class OrganizationMessageController { formDTO.getEndDate())); } + /** + * 查询消息详情 + * + * @param messageId + * @return + */ + @PostMapping("detail/{messageId}") + public Result getDetail(@PathVariable("messageId") String messageId) { + if (StringUtils.isBlank(messageId)) { + return new Result<>(); + } + return new Result().ok(organizationMessageService.getDetail(messageId)); + } - - - - + /** + * 发布消息 + * + * @param formDTO + * @return 返回消息id + */ + @PostMapping("publish") + public Result publish(@LoginUser TokenDto tokenDto, @RequestBody OrganizationMessageFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setPublishStaffId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO, OrganizationMessageFormDTO.AddShowGroup.class); + return new Result().ok(organizationMessageService.publish(formDTO)); + } } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/OrganizationMessageDao.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/OrganizationMessageDao.java index 3cec0ac2fc..f13e230f0c 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/OrganizationMessageDao.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/OrganizationMessageDao.java @@ -1,8 +1,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.OrganizationMessageResultDTO; import com.epmet.entity.OrganizationMessageEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 组织发布消息(烟台) @@ -12,5 +16,21 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface OrganizationMessageDao extends BaseDao { - + + /** + * + * @param staffOrgIdPath 工作人员所属组织的orgIdPath + * @param publishDitch 发布渠道;0:专属app + * @param orgId 发布范围,组织id或者网格id + * @param startDate yyyy-MM-dd + * @param endDate yyyy-MM-dd + * @return + */ + List pageList(@Param("customerId")String customerId, + @Param("staffOrgIdPath") String staffOrgIdPath, + @Param("publishDitch")String publishDitch, + @Param("orgId")String orgId, + @Param("startDate")String startDate, + @Param("endDate")String endDate, + @Param("messageId")String messageId); } \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/OrganizationMessageService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/OrganizationMessageService.java index 794f2725b9..18299bb1c5 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/OrganizationMessageService.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/OrganizationMessageService.java @@ -2,6 +2,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.OrganizationMessageFormDTO; import com.epmet.dto.result.OrganizationMessageResultDTO; import com.epmet.entity.OrganizationMessageEntity; @@ -24,4 +25,18 @@ public interface OrganizationMessageService extends BaseService pageList(Integer pageNo, Integer pageSize, String publishDitch, String orgId, String startDate, String endDate); + + /** + * 查询详情 + * @param messageId + * @return + */ + OrganizationMessageResultDTO getDetail(String messageId); + + /** + * 发布消息 + * @param formDTO + * @return 返回消息id + */ + String publish(OrganizationMessageFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/OrganizationMessageServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/OrganizationMessageServiceImpl.java index 0ddb025c07..cfc8daef6a 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/OrganizationMessageServiceImpl.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/OrganizationMessageServiceImpl.java @@ -1,16 +1,34 @@ package com.epmet.service.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.enums.OrgTypeEnum; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.EpmetRequestHolder; +import com.epmet.commons.tools.utils.PidUtils; import com.epmet.dao.OrganizationMessageDao; +import com.epmet.dao.OrganizationMessagePublishRangeDao; +import com.epmet.dto.OrganizationMessageFormDTO; +import com.epmet.dto.OrganizationMessagePublishRangeDTO; import com.epmet.dto.result.OrganizationMessageResultDTO; import com.epmet.entity.OrganizationMessageEntity; +import com.epmet.entity.OrganizationMessagePublishRangeEntity; import com.epmet.service.OrganizationMessageService; import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; +import java.util.List; /** * 组织发布消息(烟台) @@ -20,6 +38,9 @@ import org.springframework.stereotype.Service; */ @Service public class OrganizationMessageServiceImpl extends BaseServiceImpl implements OrganizationMessageService { + @Autowired + private OrganizationMessagePublishRangeDao organizationMessagePublishRangeDao; + /** * 分页列表 * @@ -33,10 +54,69 @@ public class OrganizationMessageServiceImpl extends BaseServiceImpl pageList(Integer pageNo, Integer pageSize, String publishDitch, String orgId, String startDate, String endDate) { - CustomerStaffInfoCacheResult staffInfoCacheResult= CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(),EpmetRequestHolder.getLoginUserId()); - PageHelper.startPage(pageNo,pageSize); - //todo - // List list=baseDao.pageList(staffOrgIdPath,publishDitch,orgId,startDate,endDate); + CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(EpmetRequestHolder.getLoginUserCustomerId(), EpmetRequestHolder.getLoginUserId()); + String staffOrgIdPath = PidUtils.convertPid2OrgIdPath(staffInfoCacheResult.getAgencyId(), staffInfoCacheResult.getAgencyPIds()); + PageHelper.startPage(pageNo, pageSize); + List list = baseDao.pageList(EpmetRequestHolder.getLoginUserCustomerId(),staffOrgIdPath, publishDitch, orgId, startDate, endDate,null); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } + + /** + * 查询详情 + * + * @param messageId + * @return + */ + @Override + public OrganizationMessageResultDTO getDetail(String messageId) { + List list = baseDao.pageList(EpmetRequestHolder.getLoginUserCustomerId(),null, null, null, null, null,messageId); + if(CollectionUtils.isNotEmpty(list)){ + return list.get(NumConstant.ZERO); + } return null; } + + /** + * 发布消息 + * + * @param formDTO + * @return 返回消息id + */ + @Transactional(rollbackFor = Exception.class) + @Override + public String publish(OrganizationMessageFormDTO formDTO) { + OrganizationMessageEntity messageEntity = ConvertUtils.sourceToTarget(formDTO, OrganizationMessageEntity.class); + CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getPublishStaffId()); + messageEntity.setPublishStaffName(staffInfoCacheResult.getRealName()); + messageEntity.setPublishOrgId(staffInfoCacheResult.getAgencyId()); + messageEntity.setPublishOrgIdPath(PidUtils.convertPid2OrgIdPath(staffInfoCacheResult.getAgencyId(), staffInfoCacheResult.getAgencyPIds())); + messageEntity.setPublishOrgName(staffInfoCacheResult.getAgencyName()); + messageEntity.setPublishTime(new Date()); + baseDao.insert(messageEntity); + for (OrganizationMessagePublishRangeDTO dto : formDTO.getRangeList()) { + OrganizationMessagePublishRangeEntity rangeEntity = new OrganizationMessagePublishRangeEntity(); + rangeEntity.setCustomerId(messageEntity.getCustomerId()); + rangeEntity.setMessageId(messageEntity.getId()); + rangeEntity.setOrgId(dto.getOrgId()); + rangeEntity.setOrgType(dto.getOrgType()); + if (OrgTypeEnum.GRID.getCode().equals(dto.getOrgType())) { + GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(dto.getOrgId()); + rangeEntity.setPid(gridInfoCache.getPid()); + rangeEntity.setOrgIdPath(PidUtils.convertPid2OrgIdPath(dto.getOrgId(), gridInfoCache.getPids())); + rangeEntity.setOrgName(gridInfoCache.getGridNamePath()); + } else if (OrgTypeEnum.AGENCY.getCode().equals(dto.getOrgType())) { + AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(dto.getOrgId()); + rangeEntity.setPid(agencyInfoCache.getPid()); + rangeEntity.setOrgIdPath(PidUtils.convertPid2OrgIdPath(dto.getOrgId(), agencyInfoCache.getPids())); + rangeEntity.setOrgName(agencyInfoCache.getOrganizationName()); + } + organizationMessagePublishRangeDao.insert(rangeEntity); + } + String messageId = messageEntity.getId(); + // todo 发送消息 发布范围下有哪些网格,网格下所有的注册居民,每人发送一条消息 + return messageId; + } + + } \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/OrganizationMessageDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/OrganizationMessageDao.xml index 49ee7aa52e..742421c739 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/OrganizationMessageDao.xml +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/OrganizationMessageDao.xml @@ -22,5 +22,40 @@ - + \ No newline at end of file