Browse Source

Merge remote-tracking branch 'origin/master'

tags/24080901
CMM 1 year ago
parent
commit
df0972fdfd
12 changed files with 168 additions and 46 deletions
  1. +22
    -21
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java
  2. +10
    -14
      pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java
  3. +37
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/converter/ApplicationConverter.java
  4. +42
    -5
      pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/manage/DeclaredProjectManage.java
  5. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java
  6. +4
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java
  7. +3
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java
  8. +4
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/provincial/enumeration/ProjectProvincialAuditStatusEnum.java
  9. +13
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CheckProvincialReviewResultTask.java
  10. +13
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/AbstractMsgExtraDTO.java
  11. +15
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MeetingReviewMsgExtraDTO.java
  12. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Notify.java

+ 22
- 21
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/ExpertInviteManage.java View File

@@ -3,9 +3,9 @@ package com.ningdatech.pmapi.meeting.manage;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.util.CollUtils;
import com.ningdatech.pmapi.common.util.BizUtils;
import com.ningdatech.pmapi.common.util.StrUtils;
import com.ningdatech.pmapi.expert.constant.ExpertAccountStatusEnum;
import com.ningdatech.pmapi.expert.entity.ExpertAvoidCompany;
import com.ningdatech.pmapi.expert.entity.ExpertUserFullInfo;
@@ -172,8 +172,9 @@ public class ExpertInviteManage {
}

if (CollUtil.isNotEmpty(avoidCompanyExpertIds)) {
for (Long avoidCompanyExpertId : avoidCompanyExpertIds) {
expertIdsIn.remove(avoidCompanyExpertId);
expertIdsIn.removeIf(avoidCompanyExpertIds::contains);
if (expertIdsIn.isEmpty()) {
return null;
}
}
return expertIdsIn;
@@ -249,8 +250,8 @@ public class ExpertInviteManage {
public ExpertChooseDTO expertInviteByRandomRule(AvoidRuleDTO avoidRule,
RandomInviteRuleDTO randomRule,
List<Long> appointExpertIds,
LocalDateTime start,
LocalDateTime end) {
LocalDateTime sTime,
LocalDateTime eTime) {
ExpertChooseDTO result = new ExpertChooseDTO(new ArrayList<>(), 0);
List<Long> expertIdsIn = mergeExpertIdsByCondition(randomRule, avoidRule);
if (expertIdsIn == null) {
@@ -287,17 +288,17 @@ public class ExpertInviteManage {
}
}
// 过滤掉已参加会议的专家
List<Long> expertIdsLockByMeeting = expertInviteHelper.listInvitedExpertByTime(start, end);
List<Long> expertIdsLockByMeeting = expertInviteHelper.listInvitedExpertByTime(sTime, eTime);
expertIdsIn.removeIf(expertIdsLockByMeeting::contains);
if (expertIdsIn.isEmpty()) {
return result;
}
query.in(ExpertUserFullInfo::getUserId, expertIdsIn);
} else if (avoidExpert || CollUtil.isNotEmpty(appointExpertIds)) {
Set<Long> tempExperts = expertInviteHelper.getAvoidExpert(appointExpertIds, avoidRule, start, end);
Set<Long> tempExperts = expertInviteHelper.getAvoidExpert(appointExpertIds, avoidRule, sTime, eTime);
query.notIn(ExpertUserFullInfo::getUserId, tempExperts);
} else {
Set<Long> notInUserIds = expertInviteHelper.listExpertLeaveOrInvited(start, end);
Set<Long> notInUserIds = expertInviteHelper.listExpertLeaveOrInvited(sTime, eTime);
if (!notInUserIds.isEmpty()) {
query.notIn(ExpertUserFullInfo::getUserId, notInUserIds);
}
@@ -307,11 +308,8 @@ public class ExpertInviteManage {
return result;
}
Map<String, List<ExpertUserFullInfo>> userGroupByUnit = CollUtils.group(userInfoList, ExpertUserFullInfo::getCompanyUniqCode);
result.setTotal(userInfoList.size());
// count为空表示数量校验
if (randomRule.getCount() == null || result.getTotal() >= randomRule.getCount()) {
result.setExperts(inviteGroupByCompany(userGroupByUnit, randomRule.getCount()));
}
result.setTotal(userGroupByUnit.size());
result.setExperts(inviteGroupByCompany(userGroupByUnit, randomRule.getCount()));
return result;
}

@@ -382,7 +380,7 @@ public class ExpertInviteManage {
List<String> tmpUniqCompanyCodes = CollUtils.fieldList(agreeOrNoticingUserInfos, ExpertUserFullInfo::getCompanyUniqCode);
notInCompanyUniqCodeList.addAll(tmpUniqCompanyCodes);
}
if (invitedRefused) {
if (!invitedRefused) {
// 拒绝参加的不可以被再次抽中
List<MeetingExpert> refusedExperts = expertGroupByStatus.get(REFUSED);
if (refusedExperts.size() > 0) {
@@ -526,25 +524,28 @@ public class ExpertInviteManage {
* 专家抽取(会议创建时抽取)
*
* @param randomRules 随机抽取规则
* @param avoidRuled 回避信息
* @param avoidRule 回避信息
* @param meeting 会议信息
* @author WendyYang
**/
public void expertInviteByMeetingCreate(Meeting meeting,
List<RandomInviteRuleDTO> randomRules,
AvoidRuleDTO avoidRuled) {
AvoidRuleDTO avoidRule) {
List<MeetingExpert> expertInserts = new ArrayList<>();
// 处理随机抽取规则
if (CollectionUtils.isNotEmpty(randomRules)) {
List<ExpertInviteRule> randoms = new ArrayList<>();
List<ExpertChooseDTO> expertsByRandom = new ArrayList<>();
List<Long> chooseExpertIds = new ArrayList<>();
LocalDateTime startTime = meeting.getStartTime();
LocalDateTime endTime = meeting.getEndTime();
LocalDateTime sTime = meeting.getStartTime();
LocalDateTime eTime = meeting.getEndTime();
randomRules.forEach(rule -> {
ExpertChooseDTO tempExperts = expertInviteByRandomRule(avoidRuled, rule, chooseExpertIds, startTime, endTime);
expertsByRandom.add(tempExperts);
chooseExpertIds.addAll(CollUtils.fieldList(tempExperts.getExperts(), ExpertUserFullInfo::getUserId));
ExpertChooseDTO tmpExperts = expertInviteByRandomRule(avoidRule, rule, chooseExpertIds, sTime, eTime);
if (tmpExperts.getTotal() < rule.getCount()) {
throw BizException.wrap("可抽取专家数量不足");
}
expertsByRandom.add(tmpExperts);
chooseExpertIds.addAll(CollUtils.fieldList(tmpExperts.getExperts(), ExpertUserFullInfo::getUserId));
randoms.add(getExpertInviteRule(rule, meeting.getId()));
});
inviteRuleService.saveBatch(randoms);


+ 10
- 14
pmapi/src/main/java/com/ningdatech/pmapi/meeting/manage/MeetingManage.java View File

@@ -233,21 +233,12 @@ public class MeetingManage {
AvoidRuleDTO avoidInfo = req.getAvoidRule();
Assert.notNull(avoidInfo, "回避信息不能为空");
// 随机抽取的话则需进行抽取数量校验
ExpertCountOnChangeVO countOnChange = expertCountOnChange(req);
if (!countOnChange.getStatus()) {
throw BizException.wrap(countOnChange.getMessage());
}
for (int i = 0; i < randomRules.size(); i++) {
Integer checkCount = countOnChange.getCountList().get(i);
Integer inviteCount = randomRules.get(i).getCount();
Assert.isTrue(checkCount >= inviteCount, "可供抽取的专家数量不足");
}
expertInviteManage.expertInviteByMeetingCreate(meeting, randomRules, avoidInfo);
expertInviteTask.addInviteTaskByMeetingCreate(meeting.getId(), 5);
LambdaUpdateWrapper<Meeting> update = Wrappers.lambdaUpdate(Meeting.class);
update.set(Meeting::getInviteStatus, false);
update.eq(Meeting::getId, meeting.getId());
meetingService.update(update);
LambdaUpdateWrapper<Meeting> mUpdate = Wrappers.lambdaUpdate(Meeting.class)
.set(Meeting::getInviteStatus, false)
.eq(Meeting::getId, meeting.getId());
meetingService.update(mUpdate);
// 回避规则
ExpertInviteAvoidRule avoidRule = new ExpertInviteAvoidRule();
avoidRule.setMeetingId(meeting.getId());
@@ -301,9 +292,14 @@ public class MeetingManage {
return resultCount;
}
List<Long> expertIdsChoose = new ArrayList<>();
for (RandomInviteRuleDTO randomRule : req.getRandomRules()) {
for (int i = 0; i < req.getRandomRules().size(); i++) {
RandomInviteRuleDTO randomRule = req.getRandomRules().get(i);
ExpertChooseDTO chooseExpert = expertInviteManage.expertInviteByRandomRule(req.getAvoidRule(),
randomRule, expertIdsChoose, meeting.getStartTime(), meeting.getEndTime());
if (i < req.getRandomRules().size() - 1 && chooseExpert.getTotal() > 0) {
List<Long> tempUserIds = CollUtils.fieldList(chooseExpert.getExperts(), ExpertUserFullInfo::getUserId);
expertIdsChoose.addAll(tempUserIds);
}
resultCount.addCountList(chooseExpert.getTotal());
}
return resultCount;


+ 37
- 4
pmapi/src/main/java/com/ningdatech/pmapi/projectdeclared/converter/ApplicationConverter.java View File

@@ -6,8 +6,11 @@ import com.ningdatech.pmapi.projectlib.model.entity.ProjectApplication;
import com.ningdatech.pmapi.provincial.model.dto.ProvincialApplicationDTO;
import com.ningdatech.pmapi.provincial.model.dto.ProvincialProjectDTO;
import org.assertj.core.util.Lists;

import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
@@ -23,13 +26,15 @@ public class ApplicationConverter {
.regionCode(projectInfo.getAreaCode())
.regionName(projectInfo.getArea())
.projectName(projectInfo.getProjectName())
.projectId(String.valueOf(projectInfo.getId()))
.projectId(projectInfo.getProjectCode())
.projectType(projectInfo.getProjectType())
.totalMoney(projectInfo.getDeclareAmount())
.yearBudget(projectInfo.getAnnualPlanAmount())
.budgetFrom(projectInfo.getDeclareHaveAmount() + "," +
projectInfo.getDeclareGovOwnFinanceAmount() + ","
+ projectInfo.getDeclareGovSuperiorFinanceAmount())
.budgetFrom(checkAddBudget(projectInfo.getDeclareHaveAmount()
,projectInfo.getDeclareGovOwnFinanceAmount(),
projectInfo.getDeclareGovSuperiorFinanceAmount(),
projectInfo.getDeclareBankLendingAmount(),
projectInfo.getDeclareOtherAmount()))
.year(String.valueOf(projectInfo.getProjectYear()))
.financialCode(projectInfo.getFinancialCode())
.developCode(projectInfo.getDevelopCode())
@@ -52,10 +57,35 @@ public class ApplicationConverter {
.otherFile(projectInfo.getPreliminaryPlanFile())
.projectRemark(projectInfo.getProjectRemarks())
.includeApplication(projectInfo.getIncludeApplication())
.projectApplyFile(projectInfo.getProjectApplicationForm())
.researchReport(projectInfo.getPreliminaryPlanFile())
.applicationInfo(convertApplications(applications))
.build();
}

private static String checkAddBudget(BigDecimal declareHaveAmount, BigDecimal declareGovOwnFinanceAmount,
BigDecimal declareGovSuperiorFinanceAmount,BigDecimal declareBankLendingAmount,
BigDecimal otherAmount) {
StringBuffer sb = new StringBuffer();

if(Objects.nonNull(declareHaveAmount) && declareHaveAmount.compareTo(BigDecimal.ZERO) > 0){
sb.append("自有资金,");
}
if(Objects.nonNull(declareGovOwnFinanceAmount) && declareGovOwnFinanceAmount.compareTo(BigDecimal.ZERO) > 0){
sb.append("政府投资-本级财政资金,");
}
if(Objects.nonNull(declareGovSuperiorFinanceAmount) && declareGovSuperiorFinanceAmount.compareTo(BigDecimal.ZERO) > 0){
sb.append("政府投资-上级财政资金,");
}
if(Objects.nonNull(declareGovSuperiorFinanceAmount) && declareGovSuperiorFinanceAmount.compareTo(BigDecimal.ZERO) > 0){
sb.append("银行贷款,");
}
if(Objects.nonNull(otherAmount) && otherAmount.compareTo(BigDecimal.ZERO) > 0){
sb.append("其他资金");
}
return sb.toString();
}

//放入项目 app
private static List<ProvincialApplicationDTO> convertApplications(List<ProjectApplication> applications) {
if(CollUtil.isEmpty(applications)){
@@ -98,6 +128,9 @@ public class ApplicationConverter {
.isProduceCommonComponent(projectApplication.getProduceCommonComponent())
.produceCommonComponent(projectApplication.getProduceCommonComponents())
.publishSide(projectApplication.getPublishSide())
.isS2(projectApplication.getIsAccountAppName())
.accountAppName(projectApplication.getAccountAppName())
.applicationEstimateFile(projectApplication.getApplicationEstimateFile())
.build();
}



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

@@ -9,6 +9,7 @@ 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.CollUtils;
import com.ningdatech.basic.util.NdDateUtils;
import com.ningdatech.pmapi.common.constant.CommonConst;
import com.ningdatech.pmapi.common.constant.RegionConst;
@@ -378,17 +379,53 @@ public class DeclaredProjectManage {
public PageVo<ProjectLibListItemVO> projectLibList(ProjectListReq req) {
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!");
//放入用户的单位 因为数据权限 只能看自己单位
req.setBuildOrgCode(user.getOrganizationCode());
return projectlibManager.projectLibList(req);
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req);
//当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位
preQuery(query,user);
Page<Project> page = projectService.page(req.page(), query);
long total;
if ((total = page.getTotal()) == 0) {
return PageVo.empty();
}
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> {
ProjectLibListItemVO item = new ProjectLibListItemVO();
item.setId(w.getId());
item.setProjectName(w.getProjectName());
item.setCreateOn(w.getCreateOn());
item.setDeclaredAmount(w.getDeclareAmount());
item.setStage(w.getStage());
item.setStatus(w.getStatus());
item.setProjectType(w.getProjectType());
item.setProjectYear(w.getProjectYear());
item.setBuildOrg(w.getBuildOrgName());
item.setBizDomain(w.getBizDomain());
item.setProcessStatus(w.getProcessStatus());
item.setInstCode(w.getInstCode());
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg());
return item;
});
return PageVo.of(records, total);
}

//当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位 并且他是单位管理员
private void preQuery(LambdaQueryWrapper<Project> query,UserFullInfoDTO user) {
//如果当前登录是单位管理员
if(user.getIsOrgAdmin()){
query.and(s1 -> s1.eq(Project::getStatus,ProjectStatusEnum.PREQUALIFICATION_FAILED.getCode())
.eq(Project::getSuperOrgCode,user.getOrganizationCode())
.or(q2 -> q2.eq(Project::getBuildOrgCode,user.getOrganizationCode())));
}else{
//否则 只能看到 非预审 并且
query.and(q2 -> q2.eq(Project::getBuildOrgCode,user.getOrganizationCode()));
}
}

public void exportList(HttpServletResponse response, ProjectListReq param) {
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId());
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!");
//放入用户的单位
param.setBuildOrgCode(user.getOrganizationCode());
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(param);
//当非预审申报的时候 是自己单位 当是预审申报的时候 要主管单位
preQuery(query,user);
List<Project> records = projectService.list(query);

AtomicInteger serialNumber = new AtomicInteger(0);


+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/dto/ProjectDTO.java View File

@@ -285,6 +285,9 @@ public class ProjectDTO implements Serializable {
@ApiModelProperty("上级条线单位审核意见")
private String higherLineSuperOrgReviewComments;

@ApiModelProperty("项目申报书")
private String projectApplicationForm;

private Map<String,Object> dynamicForm;

}

+ 4
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/entity/Project.java View File

@@ -317,4 +317,8 @@ public class Project implements Serializable {

@ApiModelProperty("21位项目编号")
private String projectCode;

@ApiModelProperty("项目申报书")
private String projectApplicationForm;

}

+ 3
- 0
pmapi/src/main/java/com/ningdatech/pmapi/projectlib/model/vo/ProjectDetailVO.java View File

@@ -316,6 +316,9 @@ public class ProjectDetailVO {
@ApiModelProperty("21位项目编号")
private String projectCode;

@ApiModelProperty("项目申报书")
private String projectApplicationForm;

private LocalDateTime createOn;
private LocalDateTime updateOn;



+ 4
- 1
pmapi/src/main/java/com/ningdatech/pmapi/provincial/enumeration/ProjectProvincialAuditStatusEnum.java View File

@@ -18,9 +18,12 @@ public enum ProjectProvincialAuditStatusEnum {
/**
* 省级联审的状态
*/
NOT_AUDIT(0,"未审核"),
AUDITING(1,"审核中"),
SUCCESS(2,"审核通过"),
FAIL(3,"审核不通过");
FAIL(3,"审核不通过"),
WITHDRAW(4,"被撤回"),
BACK(5,"退回地市");

private Integer code;
private String desc;


+ 13
- 1
pmapi/src/main/java/com/ningdatech/pmapi/scheduler/task/CheckProvincialReviewResultTask.java View File

@@ -67,7 +67,9 @@ public class CheckProvincialReviewResultTask {
ProvincialProjectRes projectRes = JSON.parseObject(JSON.toJSONString(apiResponse.getData()),
ProvincialProjectRes.class);

if(ProjectProvincialAuditStatusEnum.AUDITING.getCode().equals(projectRes.getProjectStatus())){
if(ProjectProvincialAuditStatusEnum.NOT_AUDIT.getCode().equals(projectRes.getProjectStatus())){
log.info("此项目 【{}】 还未审核",projectRes.getProjectId());
} else if(ProjectProvincialAuditStatusEnum.AUDITING.getCode().equals(projectRes.getProjectStatus())){
log.info("此项目 【{}】 还在审核中",projectRes.getProjectId());
}else if(ProjectProvincialAuditStatusEnum.SUCCESS.getCode().equals(projectRes.getProjectStatus())){
log.info("此项目 【{}】 审核通过",projectRes.getProjectId());
@@ -79,6 +81,16 @@ public class CheckProvincialReviewResultTask {
stateMachineUtils.reject(project);
project.setUpdateOn(LocalDateTime.now());
projectService.updateById(project);
}else if(ProjectProvincialAuditStatusEnum.WITHDRAW.getCode().equals(projectRes.getProjectStatus())){
log.info("此项目 【{}】 审核被撤回",projectRes.getProjectId());
stateMachineUtils.reject(project);
project.setUpdateOn(LocalDateTime.now());
projectService.updateById(project);
}else if(ProjectProvincialAuditStatusEnum.BACK.getCode().equals(projectRes.getProjectStatus())){
log.info("此项目 【{}】 审核被退回",projectRes.getProjectId());
stateMachineUtils.reject(project);
project.setUpdateOn(LocalDateTime.now());
projectService.updateById(project);
}else{
log.info("此项目 【{}】 审核结果错误",projectRes.getProjectId());
}


+ 13
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/AbstractMsgExtraDTO.java View File

@@ -0,0 +1,13 @@
package com.ningdatech.pmapi.sys.model.dto;

/**
* <p>
* AbstractExtraDTO
* </p>
*
* @author WendyYang
* @since 2023/4/12
**/
public abstract class AbstractMsgExtraDTO {

}

+ 15
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/dto/MeetingReviewMsgExtraDTO.java View File

@@ -0,0 +1,15 @@
package com.ningdatech.pmapi.sys.model.dto;

/**
* <p>
* MeetingReviewMsgExtraDTO
* </p>
*
* @author WendyYang
* @since 2023/4/12
**/
public class MeetingReviewMsgExtraDTO extends AbstractMsgExtraDTO {

private Long meetingId;

}

+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/entity/Notify.java View File

@@ -51,4 +51,6 @@ public class Notify implements Serializable {
@ApiModelProperty("创建时间")
private LocalDateTime createTime;

private String extraInfo;

}

Loading…
Cancel
Save