diff --git a/epmet-module/gov-issue/gov-issue-client/pom.xml b/epmet-module/gov-issue/gov-issue-client/pom.xml index 6b630e83b6..3cc3330134 100644 --- a/epmet-module/gov-issue/gov-issue-client/pom.xml +++ b/epmet-module/gov-issue/gov-issue-client/pom.xml @@ -17,5 +17,11 @@ epmet-commons-tools 2.0.0 + + com.epmet + resi-group-client + 2.0.0 + compile + \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ShiftProjectFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ShiftProjectFormDTO.java index 3ef4e65555..a405cc7fcc 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ShiftProjectFormDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ShiftProjectFormDTO.java @@ -1,6 +1,7 @@ package com.epmet.dto.form; import com.epmet.dto.IssueDTO; +import com.epmet.resi.group.dto.topic.ResiTopicDTO; import lombok.Data; import org.hibernate.validator.constraints.Length; @@ -38,6 +39,10 @@ public class ShiftProjectFormDTO implements Serializable { * token中工作人员Id */ private String staffId; + /** + * 话题对象信息 + */ + private ResiTopicDTO topicDTO ; } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java index 26dcf4e53c..3d3fde4b30 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java @@ -10,6 +10,10 @@ public interface UserMessageConstant { * 消息标题 */ String ISSUE_TITLE = "您有一条议题消息"; + /** + * 项目跟踪-消息标题 + */ + String PROJECT_TITLE = "您有一条项目消息"; /** * 议题关闭时,选择已解决 @@ -26,5 +30,9 @@ public interface UserMessageConstant { */ String ISSUE_SHIFT_PROJECT_MSG = "您好,您发表的话题\"%s\"的问题,已由%s部门处理,请查看。"; + /** + * 议题转项目消息模板 + */ + String PROJECT_RESLOVED_MSG = "您好。您收到一条【%s】的新信息,请您尽快处理。"; } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index 7eac6655c3..ee5eb6bc52 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -402,7 +402,7 @@ public class IssueServiceImpl extends BaseServiceImpl imp } /** - * @Description 关闭议题、议题转项目时给话题创建人和议题发起人发送消息 + * @Description 关闭议题时给话题创建人和议题发起人发送消息 * @author sun */ private Result saveUserMessageList(ResiTopicDTO topicDTO, String messageContent, IssueEntity entity) { @@ -480,20 +480,28 @@ public class IssueServiceImpl extends BaseServiceImpl imp } formDTO.setIssueDTO(ConvertUtils.sourceToTarget(entity, IssueDTO.class)); - //2:调用gov-project服务,新增项目各业务表初始数据 + //2:调用resi-group查询话题创建人数据(目前议题来源只有来自话题),为了到项目服务初始数据以及发送消息使用 + Result resultTopicDTO = resiGroupFeignClient.getTopicById(entity.getSourceId()); + if (!resultTopicDTO.success() || null == resultTopicDTO.getData()) { + throw new RenException(IssueConstant.SELECT_TOPIC_EXCEPTION); + } + ResiTopicDTO topicDTO = resultTopicDTO.getData(); + formDTO.setTopicDTO(topicDTO); + + //3:调用gov-project服务,新增项目各业务表初始数据 Result resultDTO = govProjectFeignClient.issueShiftProject(formDTO); if (!resultDTO.success() || null == resultDTO.getData()) { throw new RenException(IssueConstant.GOV_PRJECT_EXCEPTION); } IssueProjectResultDTO issueProjectResultDTO = resultDTO.getData(); - //3:更新议题相关业务表数据 - //3.1:更新议题表数据 + //4:更新议题相关业务表数据 + //4.1:更新议题表数据 entity.setIssueStatus(IssueConstant.ISSUE_SHIFT_PROJECT); entity.setShiftedTime(issueProjectResultDTO.getShiftedTime()); baseDao.updateById(entity); - //3.2:议题处理进展表新增数据 + //4.2:议题处理进展表新增数据 IssueProcessEntity processEntity = new IssueProcessEntity(); processEntity.setIssueId(entity.getId()); processEntity.setIssueStatus(IssueConstant.ISSUE_SHIFT_PROJECT); @@ -502,30 +510,63 @@ public class IssueServiceImpl extends BaseServiceImpl imp processEntity.setOrgName(issueProjectResultDTO.getOrgName()); issueProcessDao.insert(processEntity); - //3.3:议题项目关系表新增数据 + //4.3:议题项目关系表新增数据 IssueProjectRelationEntity relationEntity = new IssueProjectRelationEntity(); relationEntity.setIssueId(entity.getId()); relationEntity.setProjectId(issueProjectResultDTO.getProjectId()); issueProjectRelationDao.insert(relationEntity); - //4:调用epmet-message服务,给居民端话题创建人和议题发起人发送消息 - //4.1:调用resi-group查询话题创建人数据(目前议题来源只有来自话题) - Result resultTopicDTO = resiGroupFeignClient.getTopicById(entity.getSourceId()); - if (!resultTopicDTO.success() || null == resultTopicDTO.getData()) { - throw new RenException(IssueConstant.SELECT_TOPIC_EXCEPTION); - } - ResiTopicDTO topicDTO = resultTopicDTO.getData(); - //4.2:创建消息模板 - String messageContent = String.format(UserMessageConstant.ISSUE_SHIFT_PROJECT_MSG, topicDTO.getTopicContent(), issueProjectResultDTO.getOrgName()); - //4.3:调用服务,发送消息 - if (!saveUserMessageList(topicDTO, messageContent, entity).success()) { + //5:调用epmet-message服务,给居民端话题创建人、议题发起人以及政府端工作人员发送消息 + if (!shiftProjectMessage(issueProjectResultDTO, formDTO, entity).success()) { throw new RenException(IssueConstant.SAVE_MSG_EXCEPTION); } - //5:缓存中网格下表决中的议题总数减1 + //6:缓存中网格下表决中的议题总数减1 govIssueRedis.subtractWorkGrassrootsIssueRedDotValue(entity.getGridId()); } + /** + * @Description 议题转项目时给话题创建人、议题发起人、勾选的工作人员分别推送消息 + * @author sun + */ + private Result shiftProjectMessage(IssueProjectResultDTO issueProjectResultDTO, ShiftProjectFormDTO formDTO, IssueEntity entity) { + + List msgList = new ArrayList<>(); + //1:创建话题发起人、议题发表人消息对象 + UserMessageFormDTO msgDTO = new UserMessageFormDTO(); + msgDTO.setCustomerId(entity.getCustomerId()); + msgDTO.setGridId(entity.getGridId()); + msgDTO.setApp(AppClientConstant.APP_RESI); + msgDTO.setTitle(UserMessageConstant.ISSUE_TITLE); + String topicIssueMessage = String.format(UserMessageConstant.ISSUE_SHIFT_PROJECT_MSG, formDTO.getTopicDTO().getTopicContent(), issueProjectResultDTO.getOrgName()); + msgDTO.setMessageContent(topicIssueMessage); + msgDTO.setReadFlag(ReadFlagConstant.UN_READ); + UserMessageFormDTO msgIssue = ConvertUtils.sourceToTarget(msgDTO,UserMessageFormDTO.class); + msgDTO.setUserId(formDTO.getTopicDTO().getCreatedBy()); + msgList.add(msgDTO); + msgIssue.setUserId(entity.getCreatedBy()); + msgList.add(msgIssue); + //2:创建项目工作人员消息对象 + String projectStaffMessage = String.format(UserMessageConstant.PROJECT_RESLOVED_MSG, entity.getIssueTitle()); + //所选人员如果即在部门下又在网格下则只发一条消息 + Map map = new HashMap<>(); + formDTO.getStaffList().forEach(staff->{ + if(!map.containsKey(staff.getStaffId())){ + UserMessageFormDTO msg = new UserMessageFormDTO(); + msg.setCustomerId(entity.getCustomerId()); + msg.setGridId("*"); + msg.setApp(AppClientConstant.APP_GOV); + msg.setTitle(UserMessageConstant.PROJECT_TITLE); + msg.setMessageContent(projectStaffMessage); + msg.setReadFlag(ReadFlagConstant.UN_READ); + msg.setUserId(staff.getStaffId()); + msgList.add(msg); + map.put(staff.getStaffId(),staff.getStaffId()); + } + }); + return messageFeignClient.saveUserMessageList(msgList); + } + /** * @Description * @param issueListForm diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectRelatedPersonnelDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectRelatedPersonnelDTO.java new file mode 100644 index 0000000000..d01a0bc70d --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectRelatedPersonnelDTO.java @@ -0,0 +1,91 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 2020-05-20 + */ +@Data +public class ProjectRelatedPersonnelDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 唯一标识 + */ + private String id; + + /** + * 项目ID + */ + private String projectId; + + /** + * 所属端 居民端用户resi、政府端工作人员gov、运营端工作人员oper + */ + private String app; + + /** + * 网格ID app=resi时,此列为gridId,其他情况暂定 * + */ + private String gridId; + + /** + * 用户ID + */ + private String userId; + + /** + * 删除标识 + */ + private String 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/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/TickStaffFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/TickStaffFormDTO.java index c481b89492..bac2f60c7e 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/TickStaffFormDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/TickStaffFormDTO.java @@ -29,7 +29,7 @@ public class TickStaffFormDTO implements Serializable { */ private String gridId; - @NotBlank(message = "内部备注不能为空") + @NotBlank(message = "工作人员Id不能为空") private String staffId; } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java index ecd82ff5d3..67ececc8f7 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java @@ -93,4 +93,12 @@ public interface ProjectConstant { * 调用gov-org服务查询数据失败 */ String UNHANDLED_EXCEPTION = "已转过其他部门,不能再次操作"; + /** + * 调用user-message服务失败 + */ + String SAVE_MSG_EXCEPTION = "发送消息失败"; + /** + * 查询项目表数据失败 + */ + String SELECT_PROJECT_EXCEPTION = "获取项目数据失败"; } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectRelatedPersonnelController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectRelatedPersonnelController.java new file mode 100644 index 0000000000..b23ff79827 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectRelatedPersonnelController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.ProjectRelatedPersonnelDTO; +import com.epmet.excel.ProjectRelatedPersonnelExcel; +import com.epmet.service.ProjectRelatedPersonnelService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 项目相关人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-05-20 + */ +@RestController +@RequestMapping("projectrelatedpersonnel") +public class ProjectRelatedPersonnelController { + + @Autowired + private ProjectRelatedPersonnelService projectRelatedPersonnelService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = projectRelatedPersonnelService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + ProjectRelatedPersonnelDTO data = projectRelatedPersonnelService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody ProjectRelatedPersonnelDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + projectRelatedPersonnelService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody ProjectRelatedPersonnelDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + projectRelatedPersonnelService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + projectRelatedPersonnelService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = projectRelatedPersonnelService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, ProjectRelatedPersonnelExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectRelatedPersonnelDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectRelatedPersonnelDao.java new file mode 100644 index 0000000000..cb570632e8 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectRelatedPersonnelDao.java @@ -0,0 +1,44 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.ProjectRelatedPersonnelDTO; +import com.epmet.entity.ProjectRelatedPersonnelEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 项目相关人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-05-20 + */ +@Mapper +public interface ProjectRelatedPersonnelDao extends BaseDao { + /** + * 查找项目关联人员 + * @author zhaoqifeng + * @date 2020/5/20 13:45 + * @param projectId + * @return java.util.List + */ + List selectPersonnelListByProjectId(@Param("projectId") String projectId); +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectRelatedPersonnelEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectRelatedPersonnelEntity.java new file mode 100644 index 0000000000..b2ed014ced --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectRelatedPersonnelEntity.java @@ -0,0 +1,61 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 2020-05-20 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("project_related_personnel") +public class ProjectRelatedPersonnelEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 项目ID + */ + private String projectId; + + /** + * 所属端 居民端用户resi、政府端工作人员gov、运营端工作人员oper + */ + private String app; + + /** + * 网格ID app=resi时,此列为gridId,其他情况暂定 * + */ + private String gridId; + + /** + * 用户ID + */ + private String userId; + +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/excel/ProjectRelatedPersonnelExcel.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/excel/ProjectRelatedPersonnelExcel.java new file mode 100644 index 0000000000..8cfb220d77 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/excel/ProjectRelatedPersonnelExcel.java @@ -0,0 +1,68 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 项目相关人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-05-20 + */ +@Data +public class ProjectRelatedPersonnelExcel { + + @Excel(name = "主键 唯一标识") + private String id; + + @Excel(name = "项目ID") + private String projectId; + + @Excel(name = "所属端 居民端用户resi、政府端工作人员gov、运营端工作人员oper") + private String app; + + @Excel(name = "网格ID app=resi时,此列为gridId,其他情况暂定 *") + private String gridId; + + @Excel(name = "用户ID") + private String userId; + + @Excel(name = "删除标识") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/redis/ProjectRelatedPersonnelRedis.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/redis/ProjectRelatedPersonnelRedis.java new file mode 100644 index 0000000000..f3d113f01b --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/redis/ProjectRelatedPersonnelRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 项目相关人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-05-20 + */ +@Component +public class ProjectRelatedPersonnelRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectRelatedPersonnelService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectRelatedPersonnelService.java new file mode 100644 index 0000000000..1017db8e66 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectRelatedPersonnelService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.ProjectRelatedPersonnelDTO; +import com.epmet.entity.ProjectRelatedPersonnelEntity; + +import java.util.List; +import java.util.Map; + +/** + * 项目相关人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-05-20 + */ +public interface ProjectRelatedPersonnelService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-05-20 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-05-20 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return ProjectRelatedPersonnelDTO + * @author generator + * @date 2020-05-20 + */ + ProjectRelatedPersonnelDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-05-20 + */ + void save(ProjectRelatedPersonnelDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-05-20 + */ + void update(ProjectRelatedPersonnelDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-05-20 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java index 9afab22488..8a9392db14 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java @@ -20,6 +20,7 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; @@ -27,6 +28,8 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.ProjectConstant; +import com.epmet.constant.ReadFlagConstant; +import com.epmet.constant.UserMessageConstant; import com.epmet.dao.ProjectProcessDao; import com.epmet.dao.ProjectStaffDao; import com.epmet.dto.CustomerAgencyDTO; @@ -38,6 +41,7 @@ import com.epmet.entity.ProjectProcessEntity; import com.epmet.entity.ProjectStaffEntity; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.GovOrgFeignClient; +import com.epmet.feign.MessageFeignClient; import com.epmet.redis.ProjectProcessRedis; import com.epmet.service.ProjectProcessService; import com.epmet.service.ProjectService; @@ -74,6 +78,8 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl page(Map params) { @@ -245,6 +251,42 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl msgList = new ArrayList<>(); + ProjectEntity projectEntity = projectService.selectById(formDTO.getProjectId()); + if (null == projectEntity) { + throw new RenException(ProjectConstant.SELECT_PROJECT_EXCEPTION); + } + //3:创建项目工作人员消息对象 + //所选人员如果即在部门下又在网格下则只发一条消息 + Map map = new HashMap<>(); + String projectStaffMessage = String.format(UserMessageConstant.PROJECT_RESOLVED_MSG, projectEntity.getTitle()); + formDTO.getStaffList().forEach(staff->{ + if(!map.containsKey(staff.getStaffId())){ + UserMessageFormDTO msg = new UserMessageFormDTO(); + msg.setCustomerId(projectEntity.getCustomerId()); + msg.setGridId("*"); + msg.setApp(AppClientConstant.APP_GOV); + msg.setTitle(UserMessageConstant.PROJECT_TITLE); + msg.setMessageContent(projectStaffMessage); + msg.setReadFlag(ReadFlagConstant.UN_READ); + msg.setUserId(staff.getStaffId()); + msgList.add(msg); + map.put(staff.getStaffId(),staff.getStaffId()); + } + }); + return messageFeignClient.saveUserMessageList(msgList); } /** diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectRelatedPersonnelServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectRelatedPersonnelServiceImpl.java new file mode 100644 index 0000000000..eada922662 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectRelatedPersonnelServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.ProjectRelatedPersonnelDao; +import com.epmet.dto.ProjectRelatedPersonnelDTO; +import com.epmet.entity.ProjectRelatedPersonnelEntity; +import com.epmet.redis.ProjectRelatedPersonnelRedis; +import com.epmet.service.ProjectRelatedPersonnelService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 项目相关人员表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-05-20 + */ +@Service +public class ProjectRelatedPersonnelServiceImpl extends BaseServiceImpl implements ProjectRelatedPersonnelService { + + @Autowired + private ProjectRelatedPersonnelRedis projectRelatedPersonnelRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, ProjectRelatedPersonnelDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ProjectRelatedPersonnelDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public ProjectRelatedPersonnelDTO get(String id) { + ProjectRelatedPersonnelEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ProjectRelatedPersonnelDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ProjectRelatedPersonnelDTO dto) { + ProjectRelatedPersonnelEntity entity = ConvertUtils.sourceToTarget(dto, ProjectRelatedPersonnelEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ProjectRelatedPersonnelDTO dto) { + ProjectRelatedPersonnelEntity entity = ConvertUtils.sourceToTarget(dto, ProjectRelatedPersonnelEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index a903e21050..459bf5de8e 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -20,6 +20,7 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; @@ -35,15 +36,13 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.ProjectEntity; import com.epmet.entity.ProjectProcessEntity; +import com.epmet.entity.ProjectRelatedPersonnelEntity; import com.epmet.entity.ProjectStaffEntity; import com.epmet.feign.CommonFeignClient; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.GovOrgFeignClient; import com.epmet.redis.ProjectRedis; -import com.epmet.service.CustomerProjectParameterService; -import com.epmet.service.ProjectProcessService; -import com.epmet.service.ProjectService; -import com.epmet.service.ProjectStaffService; +import com.epmet.service.*; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -76,6 +75,8 @@ public class ProjectServiceImpl extends BaseServiceImpl list = new ArrayList<>(); + ProjectRelatedPersonnelEntity entity1 = new ProjectRelatedPersonnelEntity(); + entity1.setProjectId(projectEntity.getId()); + entity1.setApp(AppClientConstant.APP_RESI); + entity1.setGridId(issueDTO.getGridId()); + entity1.setUserId(formDTO.getTopicDTO().getCreatedBy()); + ProjectRelatedPersonnelEntity entity2 = ConvertUtils.sourceToTarget(entity1,ProjectRelatedPersonnelEntity.class); + entity2.setUserId(issueDTO.getCreatedBy()); + list.add(entity1); + list.add(entity2); + projectRelatedPersonnelService.insertBatch(list); + + //6:返回接口参数 issueProjectResultDTO.setProjectId(projectEntity.getId()); issueProjectResultDTO.setOrgName(processEntity.getDepartmentName()); issueProjectResultDTO.setShiftedTime(projectEntity.getCreatedTime()); diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectRelatedPersonnelDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectRelatedPersonnelDao.xml new file mode 100644 index 0000000000..9b8a16d319 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectRelatedPersonnelDao.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file