Browse Source

Merge remote-tracking branch 'origin/master'

tags/24080901
CMM 1 year ago
parent
commit
384e9f0a43
8 changed files with 105 additions and 73 deletions
  1. +78
    -17
      pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java
  2. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteExpertListItemVO.java
  3. +16
    -34
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java
  4. +1
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java
  5. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml
  6. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java
  7. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java
  8. +2
    -20
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java

+ 78
- 17
pmapi/src/main/java/com/ningdatech/pmapi/ding/task/EmployeeBatchGetTask.java View File

@@ -1,12 +1,17 @@
package com.ningdatech.pmapi.ding.task;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.ningdatech.basic.model.GenericResult;
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo;
import com.ningdatech.pmapi.organization.model.entity.DingOrganization;
import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService;
import com.ningdatech.pmapi.organization.service.IDingOrganizationService;
import com.ningdatech.pmapi.user.constant.UserAvailableEnum;
import com.ningdatech.pmapi.user.entity.UserInfo;
import com.ningdatech.pmapi.user.service.IUserInfoService;
import com.ningdatech.zwdd.ZwddIntegrationProperties;
import com.ningdatech.zwdd.client.ZwddClient;
import com.ningdatech.zwdd.model.Page;
@@ -20,9 +25,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;

/**
@@ -49,6 +52,9 @@ public class EmployeeBatchGetTask {
@Autowired
private ZwddIntegrationProperties zwddIntegrationProperties;

@Autowired
private IUserInfoService iUserInfoService;

@Transactional(rollbackFor = Exception.class)
public void batchGetEmployeeTask() {

@@ -107,16 +113,18 @@ public class EmployeeBatchGetTask {
List<String> employeeCodes = segment.stream().map(OrganizationEmployeePosition::getEmployeeCode).distinct().collect(Collectors.toList());
GenericResult<List<EmployeeAccountIdDTO>> listGenericResult = zwddClient.listEmployeeAccountIds(employeeCodes);
List<EmployeeAccountIdDTO> employeeAccountIdDTOList = listGenericResult.getData();
Map<String, Long> employeeCodeAccountIdMap = employeeAccountIdDTOList.stream()
.collect(Collectors.toMap(EmployeeAccountIdDTO::getEmployeeCode, EmployeeAccountIdDTO::getAccountId));
if (CollUtil.isNotEmpty(employeeAccountIdDTOList)) {
Map<String, Long> employeeCodeAccountIdMap = employeeAccountIdDTOList.stream().filter(Objects::nonNull)
.collect(Collectors.toMap(EmployeeAccountIdDTO::getEmployeeCode, EmployeeAccountIdDTO::getAccountId));

List<DingEmployeeInfo> dingEmployeeInfos = buildDingEmployeeInfoRecordList(segment);
List<DingEmployeeInfo> dingEmployeeInfos = buildDingEmployeeInfoRecordList(segment);

dingEmployeeInfos = dingEmployeeInfos.stream().map(r -> {
r.setAccountId(employeeCodeAccountIdMap.get(r.getEmployeeCode()));
return r;
}).collect(Collectors.toList());
dingEmployeeInfoSaveRecordList.addAll(dingEmployeeInfos);
dingEmployeeInfos = dingEmployeeInfos.stream().map(r -> {
r.setAccountId(employeeCodeAccountIdMap.get(r.getEmployeeCode()));
return r;
}).collect(Collectors.toList());
dingEmployeeInfoSaveRecordList.addAll(dingEmployeeInfos);
}
}

private List<DingEmployeeInfo> buildDingEmployeeInfoRecordList(List<OrganizationEmployeePosition> allOrganizationEmployeePositionList) {
@@ -154,13 +162,66 @@ public class EmployeeBatchGetTask {
}

private void saveBatch(List<DingEmployeeInfo> dingEmployeeInfoSaveRecordList) {
if (dingEmployeeInfoSaveRecordList.size() <= GROUP_SIZE) {
iDingEmployeeInfoService.saveBatch(dingEmployeeInfoSaveRecordList);
} else {
List<List<DingEmployeeInfo>> split = Lists.partition(dingEmployeeInfoSaveRecordList, GROUP_SIZE);
for (List<DingEmployeeInfo> segment : split) {
iDingEmployeeInfoService.saveBatch(segment);
dingEmployeeInfoSaveRecordList = dingEmployeeInfoSaveRecordList.stream()
.filter(r -> "true".equals(r.getMainJob())
&& "A".equals(r.getEmpStatus())
&& StringUtils.isNotBlank(r.getOrganizationCode())
&& StringUtils.isNotBlank(r.getEmployeeCode())
).collect(Collectors.toList());

Set<String> uniqueKeySet = new HashSet<String>();

List<DingEmployeeInfo> saveList = new ArrayList<>();

for (DingEmployeeInfo dingEmployeeInfo : dingEmployeeInfoSaveRecordList) {
if (uniqueKeySet.add(dingEmployeeInfo.getEmployeeCode() + dingEmployeeInfo.getOrganizationCode())) {
saveList.add(dingEmployeeInfo);
}
}

for (DingEmployeeInfo dingEmployeeInfo : saveList) {
String employeeCode = dingEmployeeInfo.getEmployeeCode();

DingEmployeeInfo employeeInfo = iDingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class)
.eq(DingEmployeeInfo::getOrganizationCode, dingEmployeeInfo.getOrganizationCode())
.eq(DingEmployeeInfo::getEmployeeCode, employeeCode));
if (Objects.isNull(employeeInfo)) {
iDingEmployeeInfoService.save(dingEmployeeInfo);
} else {
dingEmployeeInfo.setId(employeeInfo.getId());
iDingEmployeeInfoService.saveOrUpdate(dingEmployeeInfo);
}
generateOrUpdateUserInfo(dingEmployeeInfo);
}
}

public void generateOrUpdateUserInfo(DingEmployeeInfo dingEmployeeInfo) {
String employeeCode = dingEmployeeInfo.getEmployeeCode();
UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)
.eq(UserInfo::getEmployeeCode, employeeCode));
if (Objects.isNull(userInfo)) {
userInfo = UserInfo.builder()
.accountId(dingEmployeeInfo.getAccountId())
.username(dingEmployeeInfo.getEmployeeName())
.realName(dingEmployeeInfo.getEmployeeName())
.employeeCode(dingEmployeeInfo.getEmployeeCode())
.available(UserAvailableEnum.DISABLE.name())
.createBy(-1L)
.updateBy(-1L)
.createOn(LocalDateTime.now())
.updateOn(LocalDateTime.now())
.build();
iUserInfoService.save(userInfo);
}
}

// if (saveList.size() <= GROUP_SIZE) {
// iDingEmployeeInfoService.saveBatch(saveList);
// } else {
// List<List<DingEmployeeInfo>> split = Lists.partition(saveList, GROUP_SIZE);
// for (List<DingEmployeeInfo> segment : split) {
// iDingEmployeeInfoService.saveBatch(segment);
// }
// }

}

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/entity/vo/InviteExpertListItemVO.java View File

@@ -29,6 +29,9 @@ public class InviteExpertListItemVO extends ExpertBasicInfoVO {
@ApiModelProperty("手机号")
private String mobile;

@ApiModelProperty("是否是专家组长")
private Boolean isHeadman;

@ApiModelProperty("专家会议ID")
private Long expertMeetingId;



+ 16
- 34
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java View File

@@ -67,7 +67,7 @@ public class ExpertInviteManage {
private final ExpertInviteHelper expertInviteHelper;
private final IExpertUserFullInfoService expertUserFullInfoService;
private final IMeetingService meetingService;
private final IExpertAvoidCompanyService iExpertAvoidCompanyService;
private final IExpertAvoidCompanyService expertAvoidCompanyService;
private final YxtCallOrSmsHelper yxtCallOrSmsHelper;

private static final Predicate<Collection<?>> COLL_EMPTY = (coll) -> coll != null && coll.isEmpty();
@@ -114,27 +114,17 @@ public class ExpertInviteManage {
/**
* 如果抽取回避单位和专家回避单位一致,同样需要回避该专家
*
* @param companyNames /
* @param unitCodeList /
* @return /
*/
private List<Long> avoidCompanyExpertIds(List<String> companyNames) {
if (CollUtil.isEmpty(companyNames)) {
private List<Long> avoidCompanyExpertIds(List<String> unitCodeList) {
if (CollUtil.isEmpty(unitCodeList)) {
return new ArrayList<>();
}
List<String> dealCompanyNames = new ArrayList<>();
for (String companyName : companyNames) {
if (companyName.contains(",")) {
String[] splitCompanyNames = companyName.split(",");
for (String splitCompanyName : splitCompanyNames) {
dealCompanyNames.add(splitCompanyName);
}
} else {
dealCompanyNames.add(companyName);
}
}
List<ExpertAvoidCompany> expertAvoidCompanyList = iExpertAvoidCompanyService.list(Wrappers.lambdaQuery(ExpertAvoidCompany.class)
.in(ExpertAvoidCompany::getCompanyName, dealCompanyNames));
return expertAvoidCompanyList.stream().map(ExpertAvoidCompany::getUserId).distinct().collect(Collectors.toList());
LambdaQueryWrapper<ExpertAvoidCompany> query = Wrappers.lambdaQuery(ExpertAvoidCompany.class)
.in(ExpertAvoidCompany::getCompanyUniqCode, unitCodeList);
List<ExpertAvoidCompany> expertAvoidCompanyList = expertAvoidCompanyService.list(query);
return CollUtils.fieldList(expertAvoidCompanyList, ExpertAvoidCompany::getUserId);
}

private List<Long> mergeExpertIdsByCondition(RandomInviteRuleDTO rule, AvoidRuleDTO avoidInfo) {
@@ -268,22 +258,14 @@ public class ExpertInviteManage {
boolean avoidCompany = CollUtil.isNotEmpty(avoidRule.getAvoidUnitIdList());
Set<String> tmpAvoidCompany = new HashSet<>();
if (avoidCompany) {
List<String> companyIds = avoidRule.getAvoidUnitIdList();
for (String companyId : companyIds) {
if (companyId.contains(",")) {
String[] splitCompanyIds = companyId.split(",");
Collections.addAll(tmpAvoidCompany, splitCompanyIds);
} else {
tmpAvoidCompany.add(companyId);
}
}
tmpAvoidCompany.addAll(avoidRule.getAvoidUnitIdList());
}
// 回避信息
LambdaQueryWrapper<ExpertUserFullInfo> query = buildBaseExpertQuery();
query.notIn(!tmpAvoidCompany.isEmpty(), ExpertUserFullInfo::getCompany, tmpAvoidCompany);
query.notIn(!tmpAvoidCompany.isEmpty(), ExpertUserFullInfo::getCompanyUniqCode, tmpAvoidCompany);
if (avoidCompany) {
query.notExists("select 1 from expert_avoid_company eac where eac.user_id = nd_expert_user_full_info.user_id" +
" and company_name in ({0})", CollUtils.joinByComma(avoidRule.getAvoidUnitIdList()));
" and company_uniq_code in ({0})", CollUtils.joinByComma(avoidRule.getAvoidUnitIdList()));
}
// 处理专家层级
addRegionLimit(query, randomRule);
@@ -322,7 +304,7 @@ public class ExpertInviteManage {
if (userInfoList.isEmpty()) {
return result;
}
Map<String, List<ExpertUserFullInfo>> userGroupByUnit = CollUtils.group(userInfoList, ExpertUserFullInfo::getCompany);
Map<String, List<ExpertUserFullInfo>> userGroupByUnit = CollUtils.group(userInfoList, ExpertUserFullInfo::getCompanyUniqCode);
result.setTotal(userInfoList.size());
// count为空表示数量校验
if (randomRule.getCount() == null || result.getTotal() >= randomRule.getCount()) {
@@ -357,9 +339,9 @@ public class ExpertInviteManage {
return result;
}
LambdaQueryWrapper<ExpertUserFullInfo> query = buildBaseExpertQuery();
query.notIn(ExpertUserFullInfo::getCompany, avoidRule.getAvoidUnitIdList());
query.notIn(ExpertUserFullInfo::getCompanyUniqCode, avoidRule.getAvoidUnitIdList());
query.notExists("select 1 from expert_avoid_company eac where eac.user_id = nd_expert_user_full_info.user_id" +
" and company_name in ({0})", CollUtils.joinByComma(avoidRule.getAvoidOrgIdList()));
" and company_uniq_code in ({0})", CollUtils.joinByComma(avoidRule.getAvoidOrgIdList()));

// 处理专家层级
if (StrUtils.isNotBlank(randomRule.getExpertRegionCode())) {
@@ -411,7 +393,7 @@ public class ExpertInviteManage {
List<Long> tempExpertIds = CollUtils.fieldList(removeExpertByCompany, MeetingExpert::getExpertId);
// 移除确认参加、通知中的、拒绝参加、已取消
userFullInfos.removeIf(w -> tempExpertIds.contains(w.getUserId()) || removeExpertIds.contains(w.getUserId()));
Map<String, List<ExpertUserFullInfo>> userGroupByUnit = CollUtils.group(userFullInfos, ExpertUserFullInfo::getCompany);
Map<String, List<ExpertUserFullInfo>> userGroupByUnit = CollUtils.group(userFullInfos, ExpertUserFullInfo::getCompanyUniqCode);
result.setTotal(userGroupByUnit.size());
result.setExperts(inviteGroupByCompany(userGroupByUnit, count));
return result;
@@ -439,7 +421,7 @@ public class ExpertInviteManage {
*
* @param expertGroupByUnit 需要抽取的人
* @param count 抽取数量
* @return java.util.List<com.ningdatech.emapi.expert.entity.domain.ExpertUserFullInfo>
* @return 抽取到的专家信息
* @author WendyYang
**/
private List<ExpertUserFullInfo> inviteGroupByCompany(Map<String, List<ExpertUserFullInfo>> expertGroupByUnit, Integer count) {


+ 1
- 0
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java View File

@@ -456,6 +456,7 @@ public class MeetingManage {
item.setMobile(me.getMobile());
item.setNoticeTime(me.getCreateOn());
item.setRuleId(me.getRuleId());
item.setIsHeadman(me.getIsHeadman());
if (NOTICING.eq(me.getStatus())) {
item.setNoticeStatus("通知中");
} else {


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/meeting/mapper/MeetingExpertMapper.xml View File

@@ -67,7 +67,7 @@

<select id="listExpertLastByMeetingIds" resultType="com.ningdatech.pmapi.meeting.entity.domain.MeetingExpert">
SELECT * FROM (SELECT ROW_NUMBER() OVER ( PARTITION BY expert_id, meeting_id ORDER BY update_on DESC ) rowNumber,
ID, expert_id, status, meeting_id, invite_type, mobile, expert_name, update_on, pre_id, rule_id FROM meeting_expert
ID, expert_id, status, meeting_id, invite_type, mobile, expert_name, update_on, rule_id FROM meeting_expert
where meeting_id <foreach collection="meetingIds" separator="," close=")" open=" in (" item="item">
#{item}</foreach>) em WHERE rowNumber = 1
</select>


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/ConstructionPlanManage.java View File

@@ -107,6 +107,9 @@ public class ConstructionPlanManage {

String regionCode = projectInfo.getAreaCode();

//放入文件
projectInfo.setConstructionPlanFile(projectDto.getConstructionPlanFile());

WflowModels model = processModelService.getOne(Wrappers.lambdaQuery(WflowModels.class)
.eq(WflowModels::getRegionCode, regionCode)
.eq(WflowModels::getProcessType, ProjectProcessStageEnum.CONSTRUCTION_PROJECT_APPROVAL_PROCESS.getCode())


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java View File

@@ -282,7 +282,7 @@ public class DeclaredProjectManage {
projectApplication.setProjectId(project.getId());
return projectApplication;
}).collect(Collectors.toList());
projectApplicationService.saveBatch(applications);
projectApplicationService.saveOrUpdateBatch(applications);
}
//保存项目和实例的关系
ProjectInst projectInst = new ProjectInst();


+ 2
- 20
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/PrequalificationDeclaredProjectManage.java View File

@@ -2,23 +2,16 @@ package com.ningdatech.pmapi.projectdeclared.manage;

import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ningdatech.basic.function.VUtils;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.pmapi.common.constant.CommonConst;
import com.ningdatech.pmapi.common.enumeration.ProjectProcessStageEnum;
import com.ningdatech.pmapi.common.helper.UserInfoHelper;
import com.ningdatech.pmapi.common.statemachine.util.StateMachineUtils;
import com.ningdatech.pmapi.common.util.ExcelDownUtil;
import com.ningdatech.pmapi.common.util.ExcelExportStyle;
import com.ningdatech.pmapi.projectdeclared.model.dto.DeclaredProjectExportDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.DefaultDeclaredDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.PretrialDeclaredExportDTO;
import com.ningdatech.pmapi.projectdeclared.model.dto.ProjectConditionDTO;
import com.ningdatech.pmapi.projectdeclared.model.req.PrequalificationDeclaredListReq;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectStatusEnum;
import com.ningdatech.pmapi.projectlib.enumeration.ProjectTypeEnum;
@@ -26,33 +19,22 @@ import com.ningdatech.pmapi.projectlib.helper.ProjectHelper;
import com.ningdatech.pmapi.projectlib.manage.ProjectLibManage;
import com.ningdatech.pmapi.projectlib.model.dto.ProjectDTO;
import com.ningdatech.pmapi.projectlib.model.entity.Project;
import com.ningdatech.pmapi.projectlib.model.entity.ProjectInst;
import com.ningdatech.pmapi.projectlib.model.req.ProjectListReq;
import com.ningdatech.pmapi.projectlib.model.vo.ProjectLibListItemVO;
import com.ningdatech.pmapi.projectlib.service.IProjectInstService;
import com.ningdatech.pmapi.projectlib.service.IProjectService;
import com.ningdatech.pmapi.staging.service.IProjectStagingService;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import com.wflow.bean.entity.WflowModels;
import com.wflow.exception.BusinessException;
import com.wflow.workflow.bean.dto.OrgInfoDTO;
import com.wflow.workflow.bean.vo.ProcessStartParamsVo;
import com.wflow.workflow.service.ProcessInstanceService;
import com.wflow.workflow.service.ProcessModelService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;

@@ -108,9 +90,9 @@ public class PrequalificationDeclaredProjectManage {
VUtils.isTrue(!ProjectStatusEnum.PENDING_PREQUALIFICATION.getCode().equals(projectInfo.getStatus()) ||
!ProjectStatusEnum.NOT_APPROVED.getCode().equals(projectInfo.getStage()))
.throwMessage("提交失败 该项目不是 待预审状态或者未立项阶段");
//TODO 再判断 该项目是否 真实走完 单位内部审批

//使用状态机 进入下一步 看看需不需要走省级审批
//使用状态机 进入下一步 看看需不需要走省级审批 放入文件
projectInfo.setHigherLineSuperOrgReviewComments(projectDto.getHigherLineSuperOrgReviewComments());
stateMachineUtils.pass(projectInfo);
String instanceId = null;
//如果是省级部门 需要联审的(申报金额大于1000万 并且是市级项目)


Loading…
Cancel
Save