Browse Source

项目立项

master
sunyuchao 5 years ago
parent
commit
11574ab7b7
  1. 10
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java
  2. 5
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java
  3. 12
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectCategoryDictController.java
  4. 6
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectCategoryDictDao.java
  5. 7
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java
  6. 8
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProjectCategoryDictService.java
  7. 27
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java
  8. 17
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml
  9. 15
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml
  10. 2
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectDTO.java
  11. 8
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java
  12. 12
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java
  13. 2
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectEntity.java
  14. 7
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectTraceService.java
  15. 350
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java

10
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java

@ -222,7 +222,7 @@ public interface GovIssueOpenFeignClient {
* @author sun
**/
@PostMapping(value = "/gov/issue/issueprojectcategorydict/getprojectandcategoryinfo")
Result<ProjectIssueCategoryResultDTO> getProjectAndCategoryInfo(ProjectSaveCategoryFormDTO formDTO);
Result<ProjectIssueCategoryResultDTO> getProjectAndCategoryInfo(@RequestBody ProjectSaveCategoryFormDTO formDTO);
/**
* @Description 更新标签热度 数据库/缓存
@ -293,4 +293,12 @@ public interface GovIssueOpenFeignClient {
@PostMapping(value = "/gov/issue/manage/votingissuedetail")
Result<GovIssueDetailResultDTO> votingissuedetail(@RequestBody IssueDetailFormDTO issueDetail);
/**
* @param formDTO
* @Description 根据分类标签Id集合查询对应数据信息
* @Author sun
**/
@PostMapping(value = "/gov/issue/issueprojectcategorydict/getcategorytaglist")
Result<CategoryTagResultDTO> getCategoryTagList(@RequestBody CategoryTagListFormDTO formDTO);
}

5
epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java

@ -251,4 +251,9 @@ public class GovIssueOpenFeignClientFallBack implements GovIssueOpenFeignClient
public Result<GovIssueDetailResultDTO> votingissuedetail(IssueDetailFormDTO issueDetail) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "votingissuedetail", issueDetail);
}
@Override
public Result<CategoryTagResultDTO> getCategoryTagList(CategoryTagListFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "getCategoryTagList", formDTO);
}
}

12
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectCategoryDictController.java

@ -32,6 +32,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IssueProjectCategoryDictDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.CategoryTagResultDTO;
import com.epmet.dto.result.CustomerCategoryListResultDTO;
import com.epmet.dto.result.CustomerCategoryResultDTO;
import com.epmet.dto.result.ProjectIssueCategoryResultDTO;
@ -256,5 +257,16 @@ public class IssueProjectCategoryDictController {
}
return new Result<List<CustomerCategoryResultDTO>>().ok(issueProjectCategoryDictService.customerCategoryList(map.get(FieldConstant.CUSTOMER_ID_HUMP)));
}
/**
* @param formDTO
* @Description 根据分类标签Id集合查询对应数据信息
* @Author sun
**/
@PostMapping("getcategorytaglist")
public Result<CategoryTagResultDTO> getCategoryTagList(@RequestBody CategoryTagListFormDTO formDTO) {
return new Result<CategoryTagResultDTO>().ok(issueProjectCategoryDictService.getCategoryTagList(formDTO));
}
}

6
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectCategoryDictDao.java

@ -167,4 +167,10 @@ public interface IssueProjectCategoryDictDao extends BaseDao<IssueProjectCategor
* @Date 09:53 2021-03-30
**/
int updateIssueProjectCategoryDict(IssueProjectCategoryDictEntity entity);
/**
* @Description 批量查询客户分类信息
* @Author sun
**/
List<IssueProjectCategoryDictDTO> getCategoryList(@Param("customerId") String customerId, @Param("categoryIdList") List<String> categoryIdList);
}

7
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java

@ -18,6 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.IssueProjectTagDictDTO;
import com.epmet.dto.form.IsDisableCategoryFormDTO;
import com.epmet.dto.form.IssueTagFormDTO;
import com.epmet.dto.result.IssueCategoryTagResultDTO;
@ -140,4 +141,10 @@ public interface IssueProjectTagDictDao extends BaseDao<IssueProjectTagDictEntit
* @author sun
*/
int updateCustomerTag(IsDisableCategoryFormDTO formDTO);
/**
* @Description 批量查询客户分类信息
* @Author sun
**/
List<IssueProjectTagDictDTO> getTagList(@Param("customerId") String customerId, @Param("tagIdList") List<String> categoryIdList);
}

8
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProjectCategoryDictService.java

@ -22,6 +22,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.IssueProjectCategoryDictDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.CategoryTagResultDTO;
import com.epmet.dto.result.CustomerCategoryListResultDTO;
import com.epmet.dto.result.CustomerCategoryResultDTO;
import com.epmet.dto.result.ProjectIssueCategoryResultDTO;
@ -208,4 +209,11 @@ public interface IssueProjectCategoryDictService extends BaseService<IssueProjec
* @Date 16:30 2021-03-23
**/
List<CustomerCategoryResultDTO> customerCategoryList(String customerId);
/**
* @param formDTO
* @Description 根据分类标签Id集合查询对应数据信息
* @Author sun
**/
CategoryTagResultDTO getCategoryTagList(CategoryTagListFormDTO formDTO);
}

27
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java

@ -31,10 +31,7 @@ import com.epmet.dao.IssueCategoryDao;
import com.epmet.dao.IssueProjectCategoryDictDao;
import com.epmet.dao.IssueProjectRelationDao;
import com.epmet.dao.IssueProjectTagDictDao;
import com.epmet.dto.IssueCategoryDTO;
import com.epmet.dto.IssueDTO;
import com.epmet.dto.IssueProjectCategoryDictDTO;
import com.epmet.dto.ProjectCategoryDTO;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.IssueProjectCategoryDictEntity;
@ -450,4 +447,26 @@ public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl<IssuePr
}
return parentCategoryDict;
}
/**
* @param formDTO
* @Description 根据分类标签Id集合查询对应数据信息
* @Author sun
**/
@Override
public CategoryTagResultDTO getCategoryTagList(CategoryTagListFormDTO formDTO) {
CategoryTagResultDTO resultDTO = new CategoryTagResultDTO();
//1.批量查询客户分类信息
if (!org.springframework.util.CollectionUtils.isEmpty(formDTO.getCategoryIdList())) {
List<IssueProjectCategoryDictDTO> categoryList = baseDao.getCategoryList(formDTO.getCustomerId(), formDTO.getCategoryIdList());
resultDTO.setCategoryList(categoryList);
}
//2.批量查询客户标签信息
if (!org.springframework.util.CollectionUtils.isEmpty(formDTO.getCategoryIdList())) {
List<IssueProjectTagDictDTO> tagList = issueProjectTagDictDao.getTagList(formDTO.getCustomerId(), formDTO.getTagIdList());
resultDTO.setTagList(tagList);
}
return resultDTO;
}
}

17
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml

@ -213,6 +213,23 @@
ORDER BY SORT, CATEGORY_CODE ASC
</select>
<select id="getCategoryList" resultType="com.epmet.dto.IssueProjectCategoryDictDTO">
SELECT
*
FROM
issue_project_category_dict
WHERE
del_flag = '0'
AND customer_id = #{customerId}
<if test="categoryIdList != null and categoryIdList.size() > 0">
<foreach collection="categoryIdList" item="id" open="AND( " separator=" OR " index="index" close=")">
id = #{id}
</foreach>
</if>
ORDER BY
sort ASC
</select>
<update id="updateIssueProjectCategoryDict">
UPDATE issue_project_category_dict
SET

15
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml

@ -203,6 +203,21 @@
</if>
</select>
<select id="getTagList" resultType="com.epmet.dto.IssueProjectTagDictDTO">
SELECT
*
FROM
issue_project_tag_dict
WHERE
del_flag = '0'
AND customer_id = #{customerId}
<if test="null != tagIdList and tagIdList.size() > 0">
<foreach collection="tagIdList" item="tagId" open=" AND (" separator=" OR " close=" )">
ID = #{tagId}
</foreach>
</if>
</select>
<update id="updateCustomerTag">
UPDATE issue_project_tag_dict
SET is_disable = #{type},

2
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectDTO.java

@ -51,7 +51,7 @@ public class ProjectDTO implements Serializable {
private String agencyId;
/**
* 来源议题issue
* 来源议题issue 项目立项:agency
*/
private String origin;

8
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java

@ -10,6 +10,10 @@ public interface ProjectConstant {
* 项目来源-议题
*/
String ISSUE = "issue";
/**
* 项目来源-组织(项目立项)
*/
String AGENCY = "agency";
/**
* 状态-待处理
*/
@ -67,6 +71,10 @@ public interface ProjectConstant {
* 处理名-退回
*/
String OPERATION_RESPONSES_NAME = "处理/响应";
/**
* 处理名-项目立项
*/
String OPERATION_PROJECT_APPROVAL = "项目立项";
/**
* 是否处理-未处理

12
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java

@ -345,5 +345,17 @@ public class ProjectTraceController {
return new Result<ProcessorListResultDTO>().ok(projectTraceService.approvalAgencyList(tokenDTO));
}
/**
* @param tokenDTO formDTO
* @Author sun
* @Description 项目立项
**/
@PostMapping("projectapproval")
public Result projectApproval(@LoginUser TokenDto tokenDTO, @RequestBody ProjectApprovalFormDTO formDTO) {
formDTO.setCustomerId(tokenDTO.getCustomerId());
projectTraceService.projectApproval(tokenDTO, formDTO);
return new Result();
}
}

2
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectEntity.java

@ -49,7 +49,7 @@ public class ProjectEntity extends BaseEpmetEntity {
private String agencyId;
/**
* 来源议题issue
* 来源议题issue 项目立项:agency
*/
private String origin;

7
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectTraceService.java

@ -166,4 +166,11 @@ public interface ProjectTraceService {
* @Description 项目立项组织树查询--查询当前工作人员所属组织上两级组织所有下级组织
**/
ProcessorListResultDTO approvalAgencyList(TokenDto tokenDTO);
/**
* @param formDTO
* @Author sun
* @Description 项目立项
**/
void projectApproval(TokenDto tokenDTO, ProjectApprovalFormDTO formDTO);
}

350
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java

@ -1,29 +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.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
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;
/**
@ -33,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
@ -52,6 +68,22 @@ public class ProjectTraceServiceImpl implements ProjectTraceService {
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) {
@ -245,4 +277,306 @@ public class ProjectTraceServiceImpl implements ProjectTraceService {
return result.getData();
}
/**
* @param formDTO
* @Author sun
* @Description 项目立项
* 内容安全校验项目|节点|人员|附件|分类|标签|统计业务数据新增站内信|微信|短信消息推送
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void projectApproval(TokenDto tokenDTO, 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(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()));
}
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(tokenDTO.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();
//3.封装保存业务数据
//3-1.项目主表新增数据
ProjectEntity projectEntity = new ProjectEntity();
projectEntity.setCustomerId(tokenDTO.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(tokenDTO.getCustomerId());
processEntity.setStaffId(tokenDTO.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(), tokenDTO.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(tokenDTO.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(tokenDTO.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(tokenDTO.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 -> {
CustomerStaffDTO staffDTO = new CustomerStaffDTO();
staffDTO.setUserId(staff.getStaffId());
Result<CustomerStaffDTO> staffDTOResult = epmetUserFeignClient.getCustomerStaffInfoByUserId(staffDTO);
if (staffDTOResult.success() && null != staffDTOResult.getData()) {
ProjectSendMsgFormDTO sms = new ProjectSendMsgFormDTO();
sms.setCustomerId(staffDTOResult.getData().getCustomerId());
sms.setMobile(staffDTOResult.getData().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);
}
}

Loading…
Cancel
Save