|
|
@ -1,26 +1,44 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.epmet.commons.tools.constant.AppClientConstant; |
|
|
|
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.scan.param.TextScanParamDTO; |
|
|
|
import com.epmet.commons.tools.scan.param.TextTaskDTO; |
|
|
|
import com.epmet.commons.tools.scan.result.SyncScanResult; |
|
|
|
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.commons.tools.utils.ScanContentUtils; |
|
|
|
import com.epmet.constant.ProjectConstant; |
|
|
|
import com.epmet.constant.ReadFlagConstant; |
|
|
|
import com.epmet.constant.SmsTemplateConstant; |
|
|
|
import com.epmet.constant.UserMessageConstant; |
|
|
|
import com.epmet.dao.ProjectOrgRelationDao; |
|
|
|
import com.epmet.dao.ProjectProcessAttachmentDao; |
|
|
|
import com.epmet.dao.ProjectProcessDao; |
|
|
|
import com.epmet.dto.CustomerStaffDTO; |
|
|
|
import com.epmet.dto.IssueProjectCategoryDictDTO; |
|
|
|
import com.epmet.dto.IssueProjectTagDictDTO; |
|
|
|
import com.epmet.dto.ProjectStaffDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.ProjectStaffEntity; |
|
|
|
import com.epmet.feign.GovOrgFeignClient; |
|
|
|
import com.epmet.entity.*; |
|
|
|
import com.epmet.feign.*; |
|
|
|
import com.epmet.service.*; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.logging.log4j.LogManager; |
|
|
|
import org.apache.logging.log4j.Logger; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -30,7 +48,8 @@ import java.util.stream.Collectors; |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
@Slf4j |
|
|
|
public class ProjectTraceServiceImpl implements ProjectTraceService { |
|
|
|
public class ProjectTraceServiceImpl<ProjectTagService> implements ProjectTraceService { |
|
|
|
private Logger logger = LogManager.getLogger(ProjectTraceServiceImpl.class); |
|
|
|
@Autowired |
|
|
|
private ProjectService projectService; |
|
|
|
@Autowired |
|
|
@ -45,6 +64,26 @@ public class ProjectTraceServiceImpl implements ProjectTraceService { |
|
|
|
private ProjectProcessAttachmentDao attachmentDao; |
|
|
|
@Autowired |
|
|
|
private ProjectSubProcessService projectSubProcessService; |
|
|
|
@Autowired |
|
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|
|
|
@Value("${openapi.scan.server.url}") |
|
|
|
private String scanApiUrl; |
|
|
|
@Value("${openapi.scan.method.textSyncScan}") |
|
|
|
private String textSyncScanMethod; |
|
|
|
@Autowired |
|
|
|
private ProjectOrgRelationDao relationDao; |
|
|
|
@Autowired |
|
|
|
private ProjectCategoryService projectCategoryService; |
|
|
|
@Autowired |
|
|
|
private ProjectTagsService projectTagsService; |
|
|
|
@Autowired |
|
|
|
private GovIssueOpenFeignClient govIssueOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private EpmetUserFeignClient epmetUserFeignClient; |
|
|
|
@Autowired |
|
|
|
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<PendProjectListResultDTO> getPendProjectList(TokenDto tokenDto, ProjectListFromDTO fromDTO) { |
|
|
@ -213,4 +252,340 @@ public class ProjectTraceServiceImpl implements ProjectTraceService { |
|
|
|
projectService.sendTo(formDTO); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param tokenDTO |
|
|
|
* @Author sun |
|
|
|
* @Description 项目立项组织树查询--查询当前工作人员所属组织,上两级组织,所有下级组织 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public ProcessorListResultDTO approvalAgencyList(TokenDto tokenDTO) { |
|
|
|
//1.获取token用户所属组织信息
|
|
|
|
LoginUserDetailsFormDTO dto = new LoginUserDetailsFormDTO(); |
|
|
|
dto.setApp(tokenDTO.getApp()); |
|
|
|
dto.setClient(tokenDTO.getClient()); |
|
|
|
dto.setUserId(tokenDTO.getUserId()); |
|
|
|
Result<LoginUserDetailsResultDTO> resultDto = epmetUserOpenFeignClient.getLoginUserDetails(dto); |
|
|
|
if (!resultDto.success() || StringUtils.isEmpty(resultDto.getData().getAgencyId())) { |
|
|
|
throw new RenException(String.format("调用user服务查询用户数据失败,userId->", tokenDTO.getUserId())); |
|
|
|
} |
|
|
|
|
|
|
|
//2.根据组织Id查询当前组织上两级组织、本级组织、所有下级组织信息
|
|
|
|
Result<ProcessorListResultDTO> result = govOrgOpenFeignClient.getProcessorList(resultDto.getData().getAgencyId()); |
|
|
|
if (!resultDto.success()) { |
|
|
|
throw new RenException(String.format("调用org服务查询用户数据失败,userId->", tokenDTO.getUserId())); |
|
|
|
} |
|
|
|
return result.getData(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @Author sun |
|
|
|
* @Description 项目立项 |
|
|
|
* 内容安全校验、项目|节点|人员|附件|分类|标签|统计业务数据新增、站内信|微信|短信消息推送 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void projectApproval(ProjectApprovalFormDTO formDTO) { |
|
|
|
List<TickStaffFormDTO> staffList = formDTO.getStaffList(); |
|
|
|
//1.文字内容安全校验
|
|
|
|
List<String> list = new ArrayList<>(); |
|
|
|
list.add(formDTO.getTitle());list.add(formDTO.getBackGround());list.add(formDTO.getPublicReply()); |
|
|
|
safetyCheck(list); |
|
|
|
|
|
|
|
//2.数据准备,查询需要用到的数据
|
|
|
|
//2-1.获取token用户所属组织信息
|
|
|
|
LoginUserDetailsFormDTO dto = new LoginUserDetailsFormDTO(); |
|
|
|
dto.setApp(formDTO.getApp()); |
|
|
|
dto.setClient(formDTO.getClient()); |
|
|
|
dto.setUserId(formDTO.getUserId()); |
|
|
|
Result<LoginUserDetailsResultDTO> resultDto = epmetUserOpenFeignClient.getLoginUserDetails(dto); |
|
|
|
if (!resultDto.success() || StringUtils.isEmpty(resultDto.getData().getAgencyId())) { |
|
|
|
throw new RenException(String.format("项目立项调用user服务查询用户数据失败,userId->", formDTO.getUserId())); |
|
|
|
} |
|
|
|
LoginUserDetailsResultDTO loginUser = resultDto.getData(); |
|
|
|
|
|
|
|
//2-2.调用gov-org服务,获取所有勾选人员以及议题数据对应的组织信息、部门信息、网格信息用于对处理部门和ORG_ID_PATH字段的赋值使用
|
|
|
|
List<String> agencyIdList = staffList.stream().map(TickStaffFormDTO::getAgencyId).collect(Collectors.toList()); |
|
|
|
agencyIdList.add(loginUser.getAgencyId()); |
|
|
|
agencyIdList = new ArrayList<String>(new LinkedHashSet<>(agencyIdList));agencyIdList.removeAll(Collections.singleton("")); |
|
|
|
List<String> deptIdList = staffList.stream().map(TickStaffFormDTO::getDepartmentId).collect(Collectors.toList()); |
|
|
|
deptIdList = new ArrayList<String>(new LinkedHashSet<>(deptIdList));deptIdList.removeAll(Collections.singleton("")); |
|
|
|
List<String> gridIdList = staffList.stream().map(TickStaffFormDTO::getGridId).collect(Collectors.toList()); |
|
|
|
gridIdList = new ArrayList<String>(new LinkedHashSet<>(gridIdList));gridIdList.removeAll(Collections.singleton("")); |
|
|
|
AgencyDeptGridFormDTO agencyDeptGridFormDTO = new AgencyDeptGridFormDTO(); |
|
|
|
agencyDeptGridFormDTO.setAgencyIdList(agencyIdList); |
|
|
|
agencyDeptGridFormDTO.setDeptIdList(deptIdList); |
|
|
|
agencyDeptGridFormDTO.setGridIdList(gridIdList); |
|
|
|
Result<AgencyDeptGridResultDTO> resultDTO = govOrgFeignClient.getAgencyDeptGridList(agencyDeptGridFormDTO); |
|
|
|
if (!resultDTO.success() || null == resultDTO.getData()) { |
|
|
|
throw new RenException(ProjectConstant.SELECT_GOV_ORG_EXCEPTION); |
|
|
|
} |
|
|
|
AgencyDeptGridResultDTO agencyDeptGrid = resultDTO.getData(); |
|
|
|
|
|
|
|
//2-3.调用issue服务,查询分类、标签数据信息
|
|
|
|
CategoryTagListFormDTO categoryTag = new CategoryTagListFormDTO(); |
|
|
|
List<String> categoryIdList = formDTO.getCategoryList().stream().map(CategoryOrTagFormDTO::getId).collect(Collectors.toList()); |
|
|
|
List<String> tagIdList = formDTO.getTagList().stream().map(CategoryOrTagFormDTO::getId).collect(Collectors.toList()); |
|
|
|
categoryTag.setCustomerId(formDTO.getCustomerId()); |
|
|
|
categoryTag.setCategoryIdList(categoryIdList); |
|
|
|
categoryTag.setTagIdList(tagIdList); |
|
|
|
Result<CategoryTagResultDTO> resultDTOResult = govIssueOpenFeignClient.getCategoryTagList(categoryTag); |
|
|
|
if(!resultDTOResult.success()){ |
|
|
|
throw new RenException("项目立项,调用issue服务查询分类、标签基础信息失败"); |
|
|
|
} |
|
|
|
List<IssueProjectCategoryDictDTO> categoryList = resultDTOResult.getData().getCategoryList(); |
|
|
|
List<IssueProjectTagDictDTO> tagList = resultDTOResult.getData().getTagList(); |
|
|
|
|
|
|
|
//2-4.批量查询被勾选工作人员基础信息
|
|
|
|
List<String> staffIdList = staffList.stream().map(TickStaffFormDTO::getStaffId).collect(Collectors.toList()); |
|
|
|
staffIdList.add(formDTO.getUserId()); |
|
|
|
staffIdList = new ArrayList<String>(new LinkedHashSet<>(staffIdList)); |
|
|
|
Result<CustomerStaffListResultDTO> resultStaff = epmetUserOpenFeignClient.getCustomerStaffList(staffIdList); |
|
|
|
if (!resultStaff.success() || null == resultStaff.getData()) { |
|
|
|
throw new RenException("项目立项,调用user服务获取被勾选工作人员基本信息失败"); |
|
|
|
} |
|
|
|
List<StaffListResultDTO> staffInfoList = resultStaff.getData().getStaffList(); |
|
|
|
|
|
|
|
//3.封装保存业务数据
|
|
|
|
//3-1.项目主表新增数据
|
|
|
|
ProjectEntity projectEntity = new ProjectEntity(); |
|
|
|
projectEntity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
projectEntity.setAgencyId(loginUser.getAgencyId()); |
|
|
|
projectEntity.setOrigin(ProjectConstant.AGENCY); |
|
|
|
projectEntity.setOriginId(loginUser.getAgencyId()); |
|
|
|
projectEntity.setTitle(formDTO.getTitle()); |
|
|
|
projectEntity.setBackGround(formDTO.getBackGround()); |
|
|
|
projectEntity.setStatus(ProjectConstant.PENDING); |
|
|
|
projectEntity.setOrgIdPath(loginUser.getOrgIdPath()); |
|
|
|
projectService.insert(projectEntity); |
|
|
|
|
|
|
|
//3-2.项目进展表新增第一个节点数据
|
|
|
|
ProjectProcessEntity processEntity = new ProjectProcessEntity(); |
|
|
|
processEntity.setProjectId(projectEntity.getId()); |
|
|
|
processEntity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
processEntity.setStaffId(formDTO.getUserId()); |
|
|
|
processEntity.setOperation(ProjectConstant.OPERATION_CREATED); |
|
|
|
processEntity.setOperationName(ProjectConstant.OPERATION_PROJECT_APPROVAL); |
|
|
|
processEntity.setPublicReply(formDTO.getPublicReply()); |
|
|
|
processEntity.setInternalRemark(formDTO.getInternalRemark()); |
|
|
|
agencyDeptGrid.getAgencyList().forEach(agency -> { |
|
|
|
if (loginUser.getAgencyId().equals(agency.getId())) { |
|
|
|
processEntity.setDepartmentName(agency.getOrganizationName()); |
|
|
|
processEntity.setAgencyId(agency.getId()); |
|
|
|
if(org.apache.commons.lang3.StringUtils.isBlank(agency.getPids()) || org.apache.commons.lang3.StringUtils.equals(NumConstant.ZERO_STR,agency.getPids().trim()) || "".equals(agency.getPids().trim())){ |
|
|
|
processEntity.setOrgIdPath(agency.getId()); |
|
|
|
}else{ |
|
|
|
processEntity.setOrgIdPath(agency.getPids().concat(":").concat(agency.getId())); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
projectProcessService.insert(processEntity); |
|
|
|
|
|
|
|
//3-3.项目人员表批量新增数据
|
|
|
|
List<ProjectStaffEntity> entityList = new ArrayList<>(); |
|
|
|
staffList.forEach(ts -> { |
|
|
|
ProjectStaffEntity entity = ConvertUtils.sourceToTarget(ts, ProjectStaffEntity.class); |
|
|
|
entity.setOrgId(ts.getAgencyId()); |
|
|
|
entity.setProjectId(projectEntity.getId()); |
|
|
|
entity.setProcessId(processEntity.getId()); |
|
|
|
entity.setIsHandle(ProjectConstant.UNHANDLED); |
|
|
|
agencyDeptGrid.getAgencyList().forEach(agency -> { |
|
|
|
if (ts.getAgencyId().equals(agency.getId())) { |
|
|
|
entity.setCustomerId(agency.getCustomerId()); |
|
|
|
entity.setOrgIdPath(("".equals(agency.getPids()) ? "" : agency.getPids() + ":") + agency.getId()); |
|
|
|
entity.setDepartmentName(agency.getOrganizationName()); |
|
|
|
} |
|
|
|
}); |
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(ts.getDepartmentId())) { |
|
|
|
agencyDeptGrid.getDeptList().forEach(dept -> { |
|
|
|
if (ts.getDepartmentId().equals(dept.getId())) { |
|
|
|
entity.setDepartmentName(entity.getDepartmentName() + "-" + dept.getDepartmentName()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(ts.getGridId())) { |
|
|
|
agencyDeptGrid.getGridList().forEach(grid -> { |
|
|
|
if (ts.getGridId().equals(grid.getId())) { |
|
|
|
entity.setDepartmentName(entity.getDepartmentName() + "-" + grid.getGridName()); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
entityList.add(entity); |
|
|
|
}); |
|
|
|
projectStaffService.insertBatch(entityList); |
|
|
|
|
|
|
|
//3-4.项目附件表新增数据
|
|
|
|
if ((null != formDTO.getPublicFile() && formDTO.getPublicFile().size() > NumConstant.ZERO) |
|
|
|
|| (null != formDTO.getInternalFile() && formDTO.getInternalFile().size() > NumConstant.ZERO)) { |
|
|
|
projectService.saveFile(formDTO.getPublicFile(), formDTO.getInternalFile(), formDTO.getCustomerId(), projectEntity.getId(), processEntity.getId()); |
|
|
|
} |
|
|
|
|
|
|
|
//3-5.项目分类表新增数据
|
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(formDTO.getCategoryList())) { |
|
|
|
List<ProjectCategoryEntity> categoryEntityList = new ArrayList<>(); |
|
|
|
formDTO.getCategoryList().forEach(item -> { |
|
|
|
categoryList.forEach(ca->{ |
|
|
|
if(item.getId().equals(ca.getId())){ |
|
|
|
ProjectCategoryEntity entity = new ProjectCategoryEntity(); |
|
|
|
entity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
entity.setProjectId(projectEntity.getId()); |
|
|
|
entity.setCategoryId(item.getId()); |
|
|
|
entity.setCategoryPids(ca.getPids()); |
|
|
|
entity.setCategoryCode(ca.getCategoryCode()); |
|
|
|
categoryEntityList.add(entity); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
projectCategoryService.insertBatch(categoryEntityList); |
|
|
|
} |
|
|
|
|
|
|
|
//3-6.项目标签表新增数据
|
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(formDTO.getTagList())) { |
|
|
|
List<ProjectTagsEntity> tagEntityList = new ArrayList<>(); |
|
|
|
formDTO.getTagList().forEach(item -> { |
|
|
|
tagList.forEach(ta->{ |
|
|
|
if(item.getId().equals(ta.getId())){ |
|
|
|
ProjectTagsEntity entity = new ProjectTagsEntity(); |
|
|
|
entity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
entity.setProjectId(projectEntity.getId()); |
|
|
|
entity.setTagId(item.getId()); |
|
|
|
entity.setTagName(ta.getTagName()); |
|
|
|
tagEntityList.add(entity); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
projectTagsService.insertBatch(tagEntityList); |
|
|
|
} |
|
|
|
|
|
|
|
//3-7:初始化机关-项目时间关联数据
|
|
|
|
Date current = new Date(); |
|
|
|
List<String> projectStaffIds = entityList.stream().map(ProjectStaffEntity::getId).distinct().collect(Collectors.toList()); |
|
|
|
if(!org.apache.commons.collections4.CollectionUtils.isEmpty(projectStaffIds)){ |
|
|
|
List<ProjectOrgRelationEntity> container = new LinkedList<>(); |
|
|
|
projectStaffIds.forEach(o -> { |
|
|
|
ProjectOrgRelationEntity period = new ProjectOrgRelationEntity(); |
|
|
|
period.setProjectStaffId(o); |
|
|
|
period.setInformedDate(current); |
|
|
|
period.setSourceOperation(ProjectConstant.OPERATION_CREATED); |
|
|
|
period.setCreatedBy(formDTO.getUserId()); |
|
|
|
container.add(period); |
|
|
|
}); |
|
|
|
relationDao.insertBatch(container); |
|
|
|
} |
|
|
|
|
|
|
|
//4.推送站内信、微信、短信消息
|
|
|
|
//4-1.调用epmet-message服务,给工作端勾选的工作人员发送消息
|
|
|
|
if (!shiftProjectMessage(formDTO).success()) { |
|
|
|
throw new RenException("项目立项,推送站内信失败"); |
|
|
|
} |
|
|
|
|
|
|
|
//4-2.以及政府端调用epmet-message服务,给工作端工作人员推送微信订阅消息
|
|
|
|
if (!wxmpShiftProjectMessage(formDTO).success()) { |
|
|
|
logger.error("项目立项,推送微信订阅消息失败!"); |
|
|
|
} |
|
|
|
|
|
|
|
//4-3.吹哨短信消息
|
|
|
|
List<ProjectSendMsgFormDTO> smsList = new ArrayList<>(); |
|
|
|
staffList.forEach(staff -> { |
|
|
|
staffInfoList.forEach(st->{ |
|
|
|
if(staff.getStaffId().equals(st.getStaffId())){ |
|
|
|
ProjectSendMsgFormDTO sms = new ProjectSendMsgFormDTO(); |
|
|
|
sms.setCustomerId(st.getCustomerId()); |
|
|
|
sms.setMobile(st.getMobile()); |
|
|
|
sms.setAliyunTemplateCode(SmsTemplateConstant.PROJECT_TRANSFER); |
|
|
|
sms.setParameterKey("send_msg"); |
|
|
|
smsList.add(sms); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
Result result = epmetMessageOpenFeignClient.projectSendMsg(smsList); |
|
|
|
if (!result.success()) { |
|
|
|
logger.error("项目吹哨,发送手机短信失败" + JSON.toJSONString(result)); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param list |
|
|
|
* @Author sun |
|
|
|
* @Description 文字内容安全校验 |
|
|
|
**/ |
|
|
|
private void safetyCheck(List<String> list){ |
|
|
|
if(!CollectionUtils.isEmpty(list)){ |
|
|
|
list.forEach(l->{ |
|
|
|
if (com.alibaba.nacos.client.utils.StringUtils.isNotBlank(l)) { |
|
|
|
TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); |
|
|
|
TextTaskDTO taskDTO = new TextTaskDTO(); |
|
|
|
taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); |
|
|
|
taskDTO.setContent(l); |
|
|
|
textScanParamDTO.getTasks().add(taskDTO); |
|
|
|
Result<SyncScanResult> textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); |
|
|
|
if (!textSyncScanResult.success()) { |
|
|
|
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); |
|
|
|
} else { |
|
|
|
if (!textSyncScanResult.getData().isAllPass()) { |
|
|
|
throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 项目立项给勾选的工作人员推送站内信消息 |
|
|
|
* @author sun |
|
|
|
*/ |
|
|
|
private Result shiftProjectMessage(ProjectApprovalFormDTO formDTO) { |
|
|
|
List<UserMessageFormDTO> msgList = new ArrayList<>(); |
|
|
|
//1.创建项目工作人员消息对象
|
|
|
|
String projectStaffMessage = String.format(UserMessageConstant.PROJECT_RESOLVED_MSG, formDTO.getTitle()); |
|
|
|
//所选人员如果即在部门下又在网格下则只发一条消息
|
|
|
|
Map<String,String> map = new HashMap<>(); |
|
|
|
formDTO.getStaffList().forEach(staff->{ |
|
|
|
if(!map.containsKey(staff.getStaffId())){ |
|
|
|
UserMessageFormDTO msg = new UserMessageFormDTO(); |
|
|
|
msg.setCustomerId(formDTO.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 epmetMessageOpenFeignClient.saveUserMessageList(msgList); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 项目立项给勾选的工作人员推送微信订阅消息 |
|
|
|
* @author sun |
|
|
|
*/ |
|
|
|
private Result wxmpShiftProjectMessage(ProjectApprovalFormDTO formDTO) { |
|
|
|
List<WxSubscribeMessageFormDTO> msgList = new ArrayList<>(); |
|
|
|
//1.创建项目工作人员消息对象
|
|
|
|
String projectStaffMessage = String.format(UserMessageConstant.PROJECT_RESOLVED_MSG, formDTO.getTitle()); |
|
|
|
//所选人员如果即在部门下又在网格下则只发一条消息
|
|
|
|
Map<String,String> map = new HashMap<>(); |
|
|
|
formDTO.getStaffList().forEach(staff->{ |
|
|
|
if(!map.containsKey(staff.getStaffId())){ |
|
|
|
WxSubscribeMessageFormDTO msg = new WxSubscribeMessageFormDTO(); |
|
|
|
msg.setCustomerId(formDTO.getCustomerId()); |
|
|
|
msg.setClientType(AppClientConstant.APP_GOV); |
|
|
|
msg.setUserId(staff.getStaffId()); |
|
|
|
msg.setBehaviorType("项目消息"); |
|
|
|
msg.setMessageContent(projectStaffMessage); |
|
|
|
msg.setMessageTime(new Date()); |
|
|
|
msg.setGridId("*"); |
|
|
|
msgList.add(msg); |
|
|
|
map.put(staff.getStaffId(),staff.getStaffId()); |
|
|
|
} |
|
|
|
}); |
|
|
|
logger.info("项目立项,推送微信订阅消息"); |
|
|
|
return epmetMessageOpenFeignClient.sendWxSubscribeMessage(msgList); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|