Browse Source

居民端-热心居民申请提交-添加给对应网格长发送消息的逻辑

dev_shibei_match
sunyuchao 5 years ago
parent
commit
a5bad0ebc6
  1. 12
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/UserMessageController.java
  2. 8
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/UserMessageService.java
  3. 5
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/UserMessageServiceImpl.java
  4. 47
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyAndStaffsResultDTO.java
  5. 13
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerGridConstant.java
  6. 17
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
  7. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java
  8. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
  9. 33
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  10. 35
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml
  11. 6
      epmet-module/resi-partymember/resi-partymember-server/pom.xml
  12. 10
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/constant/ResiWarmheartedConstant.java
  13. 12
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/EpmetMessageFeignClient.java
  14. 10
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java
  15. 13
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/GovOrgFeignClient.java
  16. 8
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/fallback/EpmetMessageFeignClientFallback.java
  17. 7
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java
  18. 7
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/fallback/GovOrgFeignClientFallBack.java
  19. 2
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/constant/ResiWarmUserMessageConstant.java
  20. 6
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/constant/ResiWarmheartedVisitConstant.java
  21. 66
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java

12
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/UserMessageController.java

@ -28,6 +28,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.UserMessageDTO;
import com.epmet.dto.form.MymessageFormDTO;
import com.epmet.dto.form.UserMessageFormDTO;
import com.epmet.entity.UserMessageEntity;
import com.epmet.excel.UserMessageExcel;
import com.epmet.service.UserMessageService;
import org.springframework.beans.factory.annotation.Autowired;
@ -132,4 +133,15 @@ public class UserMessageController {
public Result<List<UserMessageDTO>> getMyMessageList(@RequestBody MymessageFormDTO params){
return userMessageService.getMyMessageList(params);
}
/**
* @param msgList
* @return com.epmet.commons.tools.utils.Result
* @Author sun
* @Description 批量插入未读消息
**/
@PostMapping("saveusermessagelist")
public Result saveUserMessageList(@RequestBody List<UserMessageEntity> msgList) {
return userMessageService.saveUserMessageList(msgList);
}
}

8
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/UserMessageService.java

@ -127,4 +127,12 @@ public interface UserMessageService extends BaseService<UserMessageEntity> {
* @return
*/
Result<List<UserMessageDTO>> getMyMessageList(MymessageFormDTO param);
/**
* @param msgList
* @return com.epmet.commons.tools.utils.Result
* @Author sun
* @Description 批量插入未读消息
**/
Result saveUserMessageList(List<UserMessageEntity> msgList);
}

5
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/UserMessageServiceImpl.java

@ -165,4 +165,9 @@ public class UserMessageServiceImpl extends BaseServiceImpl<UserMessageDao, User
return new Result<List<UserMessageDTO>>().ok(ConvertUtils.sourceToTarget(myMessageList, UserMessageDTO.class));
}
@Override
public Result saveUserMessageList(List<UserMessageEntity> msgList) {
insertBatch(msgList);
return new Result();
}
}

47
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyAndStaffsResultDTO.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 根据网格ID查询网格信息查询网格下所有工作人员列表-接口返参
*
* @author sun
*/
@Data
public class AgencyAndStaffsResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 网格基本信息
*/
private CustomerGridDTO customerGridDTO;
/**
* 网格下工作人员列表
*/
private List<CustomerStaffGridDTO> staffList;
}

13
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/CustomerGridConstant.java

@ -0,0 +1,13 @@
package com.epmet.constant;
/**
* @author sun
* @dscription
*/
public interface CustomerGridConstant {
/**
* 根据网格Id未查询到网格信息
*/
String SELECT_EXCEPTION = "根据网格Id未查询到网格信息";
}

17
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java

@ -27,12 +27,9 @@ import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.SelectGridNameByGridIdFormDTO;
import com.epmet.dto.result.SelectGridNameByGridIdResultDTO;
import com.epmet.dto.result.*;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.result.CustomerGridByUserIdResultDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.dto.result.GridInfoResultDTO;
import com.epmet.excel.CustomerGridExcel;
import com.epmet.service.CustomerGridService;
import org.springframework.beans.factory.annotation.Autowired;
@ -162,4 +159,16 @@ public class CustomerGridController {
public Result<List<CustomerGridByUserIdResultDTO>> getMyGrids(@PathVariable("userId") String userId) {
return customerGridService.getMyGrids(userId);
}
/**
* @param gridId
* @return
* @Author sun
* @Description 根据网格id查询所属组织信息根据网格Id查询网格下所有工作人员列表
**/
@PostMapping("getagencyandstaffsbygridid/{gridId}")
public Result<AgencyAndStaffsResultDTO> getAgencyAndStaffsBygridId(@PathVariable("gridId") String gridId) {
return customerGridService.getAgencyAndStaffsBygridId(gridId);
}
}

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffGridDao.java

@ -65,4 +65,12 @@ public interface CustomerStaffGridDao extends BaseDao<CustomerStaffGridEntity> {
* @Date 2020.04.26 14:57
**/
void insertBatch(List<CustomerStaffGridDTO> list);
/**
* @param gridId
* @return
* @Description 根据网格Id查询网格下工作人员列表
* @Author sun
*/
List<CustomerStaffGridDTO> selectByGridId(@Param("gridId")String gridId);
}

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java

@ -212,4 +212,11 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
**/
Result addGridStaffs(CommonGridStaffListFromDTO staffListFormDTO);
/**
* @param gridId
* @return
* @Author sun
* @Description 根据网格id查询所属组织信息根据网格Id查询网格下所有工作人员列表
**/
Result<AgencyAndStaffsResultDTO> getAgencyAndStaffsBygridId(String gridId);
}

33
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

@ -23,25 +23,20 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.CustomerGridConstant;
import com.epmet.dao.CustomerGridDao;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.form.SelectGridNameByGridIdFormDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.dto.result.SelectGridNameByGridIdResultDTO;
import com.epmet.dto.result.GridInfoResultDTO;
import com.epmet.dao.CustomerStaffGridDao;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.CustomerGridEntity;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.resi.partymember.dto.warmhearted.form.ResiWarmheartedFormDTO;
import com.epmet.service.CustomerAgencyService;
import com.epmet.service.CustomerGridService;
import com.epmet.service.CustomerStaffGridService;
@ -473,4 +468,26 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
return new Result<SelectGridNameByGridIdResultDTO>().ok(baseDao.selectGridNameByGridId(formDTO));
}
/**
* @param gridId
* @return
* @Author sun
* @Description 根据网格id查询所属组织信息根据网格Id查询网格下所有工作人员列表
**/
@Override
public Result<AgencyAndStaffsResultDTO> getAgencyAndStaffsBygridId(String gridId) {
Result<AgencyAndStaffsResultDTO> result = new Result<>();
AgencyAndStaffsResultDTO agencyAndStaffsResultDTO = new AgencyAndStaffsResultDTO();
//1:查询网格基本信息
CustomerGridEntity gridEntity = baseDao.selectById(gridId);
if (null == gridEntity) {
throw new RenException(CustomerGridConstant.SELECT_EXCEPTION);
}
CustomerGridDTO CustomerGridDTO = ConvertUtils.sourceToTarget(gridEntity, CustomerGridDTO.class);
agencyAndStaffsResultDTO.setCustomerGridDTO(CustomerGridDTO);
//2:查询网格下工作人员列表
List<CustomerStaffGridDTO> staffList = customerStaffGridDao.selectByGridId(gridId);
agencyAndStaffsResultDTO.setStaffList(staffList);
return result.ok(agencyAndStaffsResultDTO);
}
}

35
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffGridDao.xml

@ -3,19 +3,18 @@
<mapper namespace="com.epmet.dao.CustomerStaffGridDao">
<resultMap type="com.epmet.entity.CustomerStaffGridEntity" id="customerStaffGridMap">
<result property="id" column="ID"/>
<result property="userId" column="USER_ID"/>
<result property="gridId" column="GRID_ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<sql id="sql">
csg.id AS "id",
csg.user_id AS "userId",
csg.grid_id AS "gridId",
csg.customer_id AS "customerId",
csg.del_flag AS "delflag",
csg.revision AS "revision",
csg.created_by AS "createdby",
csg.created_time AS "createdtime",
csg.updated_by AS "updatedby",
csg.updated_time AS "updatedtime"
</sql>
<!-- 查询指定客户下一个用户所在的网格,按照网格名称升序排序,取第一个 -->
<select id="selectStaffGridOrderByGridName" parameterType="com.epmet.dto.form.LatestGridFormDTO" resultType="com.epmet.dto.CustomerGridDTO">
@ -56,6 +55,16 @@
</select>
<select id="selectByGridId" resultType="com.epmet.dto.CustomerStaffGridDTO">
SELECT
<include refid="sql"></include>
FROM
customer_staff_grid csg
WHERE
csg.del_flag = '0'
AND csg.grid_id = #{gridId}
</select>
<!-- 批量插入网格工作人员 -->
<insert id="insertBatch" parameterType="java.util.List">
insert into customer_staff_grid

6
epmet-module/resi-partymember/resi-partymember-server/pom.xml

@ -93,6 +93,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-message-server</artifactId>
<version>0.3.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

10
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/constant/ResiWarmheartedConstant.java

@ -0,0 +1,10 @@
package com.epmet.constant;
/**
* @author sun
* @dscription
*/
public interface ResiWarmheartedConstant {
String SELECT_EXCEPTION = "根据网格Id查询数据失败";
}

12
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/EpmetMessageFeignClient.java

@ -3,6 +3,7 @@ package com.epmet.modules.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.UserMessageFormDTO;
import com.epmet.entity.UserMessageEntity;
import com.epmet.modules.feign.fallback.EpmetMessageFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
@ -10,6 +11,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.List;
/**
* @author kamui
*/
@ -33,4 +36,13 @@ public interface EpmetMessageFeignClient {
@PostMapping(value = "message/usermessage/saveusermessage", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result saveUserMessage(UserMessageFormDTO formDto);
/**
* @param msgList
* @return com.epmet.commons.tools.utils.Result
* @Author sun
* @Description 热心居民申请给网格长们发送消息
**/
@PostMapping(value = "message/usermessage/saveusermessagelist", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
Result saveUserMessageList(List<UserMessageEntity> msgList);
}

10
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java

@ -4,9 +4,11 @@ import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserResiInfoDTO;
import com.epmet.dto.UserRoleDTO;
import com.epmet.dto.form.StaffRoleFormDTO;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.dto.form.UserResiInfoListFormDTO;
import com.epmet.dto.result.CertifiedResultDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.modules.feign.fallback.EpmetUserFeignClientFallBack;
import com.epmet.resi.partymember.dto.partymember.UserHeadPhotoDTO;
@ -69,4 +71,12 @@ public interface EpmetUserFeignClient {
@PostMapping("/epmetuser/userwechat/selectuserheadphotobyuserid")
Result<List<CertifiedResultDTO>> selectUserHeadPhotoByUserId(List<CertifiedResultDTO> certifiedResultDTOS);
/**
* 根据机构Id查询机构下是网格长角色的用户
* @param staffRoleFormDTO
* @return
* @Author sun
*/
@PostMapping("/epmetuser/staffrole/staffsinrole")
Result<List<GovStaffRoleResultDTO>> getStaffsInRole(@RequestBody StaffRoleFormDTO staffRoleFormDTO);
}

13
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/GovOrgFeignClient.java

@ -4,6 +4,7 @@ import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.result.AgencyAndStaffsResultDTO;
import com.epmet.dto.result.SelectGridNameByGridIdResultDTO;
import com.epmet.dto.result.GridInfoResultDTO;
import com.epmet.modules.feign.fallback.GovOrgFeignClientFallBack;
@ -50,8 +51,12 @@ public interface GovOrgFeignClient {
@PostMapping("/gov/org/customergrid/selectGridNameByGridId")
Result<SelectGridNameByGridIdResultDTO> selectGridNameByGridId(@RequestBody CertifiedFormDTO formDTO);
/**
* @param gridId
* @return
* @Author sun
* @Description 根据网格id查询所属组织信息根据网格Id查询网格下所有工作人员列表
**/
@PostMapping("/gov/org/customergrid/getagencyandstaffsbygridid/{gridId}")
Result<AgencyAndStaffsResultDTO> getAgencyAndStaffsBygridId(@PathVariable("gridId") String gridId);
}

8
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/fallback/EpmetMessageFeignClientFallback.java

@ -4,9 +4,12 @@ import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.UserMessageFormDTO;
import com.epmet.entity.UserMessageEntity;
import com.epmet.modules.feign.EpmetMessageFeignClient;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 消息服务降级
* @author zhaoqifeng
@ -24,4 +27,9 @@ public class EpmetMessageFeignClientFallback implements EpmetMessageFeignClient
return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "saveUserMessage", formDto);
}
@Override
public Result saveUserMessageList(List<UserMessageEntity> msgList) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "saveUserMessageList", msgList);
}
}

7
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java

@ -5,9 +5,11 @@ import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.UserResiInfoDTO;
import com.epmet.dto.UserRoleDTO;
import com.epmet.dto.form.StaffRoleFormDTO;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.dto.form.UserResiInfoListFormDTO;
import com.epmet.dto.result.CertifiedResultDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.modules.feign.EpmetUserFeignClient;
import org.springframework.stereotype.Component;
@ -45,4 +47,9 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient {
public Result<List<CertifiedResultDTO>> selectUserHeadPhotoByUserId(List<CertifiedResultDTO> certifiedResultDTOS) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "selectUserHeadPhotoByUserId", certifiedResultDTOS);
}
@Override
public Result<List<GovStaffRoleResultDTO>> getStaffsInRole(StaffRoleFormDTO staffRoleFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffsInRole", staffRoleFormDTO);
}
}

7
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/feign/fallback/GovOrgFeignClientFallBack.java

@ -5,6 +5,7 @@ import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.result.AgencyAndStaffsResultDTO;
import com.epmet.dto.result.SelectGridNameByGridIdResultDTO;
import com.epmet.dto.result.GridInfoResultDTO;
import com.epmet.modules.feign.GovOrgFeignClient;
@ -38,4 +39,10 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient {
public Result<SelectGridNameByGridIdResultDTO> selectGridNameByGridId(CertifiedFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectGridNameByGridId",formDTO);
}
@Override
public Result<AgencyAndStaffsResultDTO> getAgencyAndStaffsBygridId(String gridId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyAndStaffsBygridId",gridId);
}
}

2
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/constant/ResiWarmUserMessageConstant.java

@ -9,7 +9,7 @@ public interface ResiWarmUserMessageConstant {
/**
* 消息标题
*/
String GROUP_TITLE = "您有一条小组消息";
String GROUP_TITLE = "您有一条热心居民申请消息";
/**
* 热心居民提交申请时给网格长发送消息XX街道-XX先生/女士申请成为热心居民请审核

6
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/constant/ResiWarmheartedVisitConstant.java

@ -77,4 +77,10 @@ public interface ResiWarmheartedVisitConstant {
String SELECT_EXCEPTION = "根据申请Id未查询到热心居民申请详情信息";
String AUDIT_EXCEPTION = "该申请数据已审核,不能再次审核";
/**
* 网格长角色
*/
String GRID_MANAGER = "grid_manager";
String SAVE_MSG_EXCEPTION = "发送消息给网格长操作失败";
}

66
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java

@ -31,13 +31,15 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.PartyMemberConstant;
import com.epmet.constant.ReadFlagConstant;
import com.epmet.constant.ResiWarmheartedConstant;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.CustomerStaffGridDTO;
import com.epmet.dto.UserRoleDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.UserMessageFormDTO;
import com.epmet.dto.form.UserResiInfoFormDTO;
import com.epmet.dto.form.UserResiInfoListFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.AgencyAndStaffsResultDTO;
import com.epmet.dto.result.GovStaffRoleResultDTO;
import com.epmet.dto.result.UserResiInfoResultDTO;
import com.epmet.entity.UserMessageEntity;
import com.epmet.modules.feign.EpmetMessageFeignClient;
import com.epmet.modules.feign.EpmetUserFeignClient;
import com.epmet.modules.feign.GovOrgFeignClient;
@ -203,7 +205,10 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea
//2:将最后一次操作行为更新到热心居民申请行为记录表中
resiWarmheartedVisitService.updateResiWarmVisit(formDTO);
//3:添加消息信息,给网格长发消息
saveResiWarmUserMessage(formDTO);
result = saveResiWarmUserMessage(formDTO);
if(!result.success()){
throw new RenException(ResiWarmheartedVisitConstant.SAVE_MSG_EXCEPTION);
}
result.setCode(NumConstant.ZERO);
result.setMsg(ResiWarmheartedVisitConstant.RESI_WARM_SUBMIT);
}
@ -234,19 +239,44 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl<ResiWarmhea
* @return
* @Author sun
*/
private void saveResiWarmUserMessage(ResiWarmheartedSubmitFormDTO formDTO) {
UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO();
userMessageFormDTO.setCustomerId(formDTO.getCustomerId());
userMessageFormDTO.setGridId(formDTO.getGridId());
//网格长用户Id TODO
//userMessageFormDTO.setUserId();
userMessageFormDTO.setUserId(formDTO.getUserId());//先在token中取一个默认值
userMessageFormDTO.setApp(formDTO.getApp());
userMessageFormDTO.setTitle(ResiWarmUserMessageConstant.GROUP_TITLE);
userMessageFormDTO.setMessageContent(formDTO.getMessageText());
userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ);
//保存消息
epmetMessageFeignClient.saveUserMessage(userMessageFormDTO);
private Result saveResiWarmUserMessage(ResiWarmheartedSubmitFormDTO formDTO) {
Result result = new Result();
//1:调用gov-org服务,根据网格Id查询所属组织机构Id,根据网格Id查询网格下所有工作人员列表
Result<AgencyAndStaffsResultDTO> resultAgencyAndStaffs = govOrgFeignClient.getAgencyAndStaffsBygridId(formDTO.getGridId());
if(!resultAgencyAndStaffs.success()){
throw new RenException(ResiWarmheartedConstant.SELECT_EXCEPTION);
}
AgencyAndStaffsResultDTO agencyAndStaffsResultDTO = resultAgencyAndStaffs.getData();
//网格下工作人员列表
CustomerGridDTO customerGridDTO = agencyAndStaffsResultDTO.getCustomerGridDTO();
List<CustomerStaffGridDTO> staffList = agencyAndStaffsResultDTO.getStaffList();
//2:调用epmet-user服务,根据组织机构Id和网格长角色查询组织机构下所有的网格长StaffId
StaffRoleFormDTO staffRoleFormDTO = new StaffRoleFormDTO();
staffRoleFormDTO.setOrgId(customerGridDTO.getPid());
staffRoleFormDTO.setRoleKey(ResiWarmheartedVisitConstant.GRID_MANAGER);
Result<List<GovStaffRoleResultDTO>> resultList = epmetUserFeignClient.getStaffsInRole(staffRoleFormDTO);
List<GovStaffRoleResultDTO> roleList = resultList.getData();
//3:遍历找出当前网格的所有网格长并给网格长发消息
List<UserMessageEntity> msgList = new ArrayList<>();
staffList.forEach(staff->{
roleList.forEach(role->{
if(staff.getUserId().equals(role.getStaffId())){
UserMessageEntity msgEntity = new UserMessageEntity();
msgEntity.setCustomerId(formDTO.getCustomerId());
msgEntity.setGridId(formDTO.getGridId());
msgEntity.setUserId(staff.getUserId());
msgEntity.setApp(formDTO.getApp());
msgEntity.setTitle(ResiWarmUserMessageConstant.GROUP_TITLE);
msgEntity.setMessageContent(formDTO.getMessageText());
msgEntity.setReadFlag(ReadFlagConstant.UN_READ);
msgList.add(msgEntity);
}
});
});
if (msgList.size() > NumConstant.ZERO) {
result = epmetMessageFeignClient.saveUserMessageList(msgList);
}
return result;
}
@Override

Loading…
Cancel
Save