Browse Source

modify:

1. 专家评审数据统计;
tags/24110601
WendyYang 4 weeks ago
parent
commit
c37cca140f
5 changed files with 115 additions and 70 deletions
  1. +1
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/open/controller/OpenApiMeetingController.java
  2. +21
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/open/controller/OpenApiProjectLibController.java
  3. +24
    -68
      hz-pm-api/src/main/java/com/hz/pm/api/open/manage/OpenApiMeetingExpertManage.java
  4. +66
    -0
      hz-pm-api/src/main/java/com/hz/pm/api/open/util/OpenApiCheckSignUtil.java
  5. +3
    -1
      hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectReviewManage.java

hz-pm-api/src/main/java/com/hz/pm/api/open/controller/OpenApiMeetingExpertInfoController.java → hz-pm-api/src/main/java/com/hz/pm/api/open/controller/OpenApiMeetingController.java View File

@@ -32,7 +32,7 @@ import java.util.List;
@RestController
@RequestMapping("/open/api/meeting-expert-info")
@RequiredArgsConstructor
public class OpenApiMeetingExpertInfoController {
public class OpenApiMeetingController {

private final OpenApiMeetingExpertManage openMeetingExpertManage;


+ 21
- 0
hz-pm-api/src/main/java/com/hz/pm/api/open/controller/OpenApiProjectLibController.java View File

@@ -0,0 +1,21 @@
package com.hz.pm.api.open.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* <p>
* OpenApiProjectLibController
* </p>
*
* @author WendyYang
* @since 10:43 2024/11/6
*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/open/api/projectLib")
public class OpenApiProjectLibController {


}

+ 24
- 68
hz-pm-api/src/main/java/com/hz/pm/api/open/manage/OpenApiMeetingExpertManage.java View File

@@ -1,54 +1,49 @@
package com.hz.pm.api.open.manage;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
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.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.expert.entity.ExpertUserFullInfo;
import com.hz.pm.api.expert.model.dto.DictionaryVO;
import com.hz.pm.api.expert.service.IExpertUserFullInfoService;
import com.hz.pm.api.meeting.entity.domain.Meeting;
import com.hz.pm.api.meeting.entity.domain.MeetingExpert;
import com.hz.pm.api.meeting.entity.domain.MeetingExpertJudge;
import com.hz.pm.api.meeting.entity.enumeration.ExpertAttendStatusEnum;
import com.hz.pm.api.meeting.entity.enumeration.MeetingStatusEnum;
import com.hz.pm.api.meeting.service.IMeetingExpertJudgeService;
import com.hz.pm.api.meta.model.dto.DictionaryDTO;
import com.hz.pm.api.open.model.po.PageExpertJudgePO;
import com.hz.pm.api.open.model.po.ReqMeetingExpertSignPO;
import com.hz.pm.api.open.model.vo.ExpertJudgeToMhVO;
import com.hz.pm.api.user.model.entity.UserInfo;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
import com.ningdatech.basic.model.PageVo;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.hz.pm.api.common.helper.UserInfoHelper;
import com.hz.pm.api.meeting.entity.domain.Meeting;
import com.hz.pm.api.meeting.entity.domain.MeetingExpert;
import com.hz.pm.api.meeting.service.IMeetingExpertService;
import com.hz.pm.api.meeting.service.IMeetingService;
import com.hz.pm.api.meta.constant.ExpertDictTypeEnum;
import com.hz.pm.api.meta.helper.DictionaryCache;
import com.hz.pm.api.meta.model.dto.DictionaryDTO;
import com.hz.pm.api.meta.model.entity.ExpertDictionary;
import com.hz.pm.api.meta.service.IExpertDictionaryService;
import com.hz.pm.api.open.model.po.PageExpertJudgePO;
import com.hz.pm.api.open.model.po.ReqMeetingExpertInfoPO;
import com.hz.pm.api.open.model.po.ReqMeetingExpertSignPO;
import com.hz.pm.api.open.model.vo.ExpertInfoVO;
import com.hz.pm.api.open.model.vo.ExpertJudgeToMhVO;
import com.hz.pm.api.open.model.vo.MeetingExpertToMhDTO;
import com.hz.pm.api.open.util.OpenApiCheckSignUtil;
import com.hz.pm.api.user.model.entity.UserInfo;
import com.hz.pm.api.user.security.model.UserFullInfoDTO;
import com.hz.pm.api.user.service.IUserInfoService;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.model.PageVo;
import com.ningdatech.basic.util.CollUtils;

import cn.hutool.core.collection.CollUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;

/**
* @author CMM
@@ -59,9 +54,8 @@ import lombok.extern.slf4j.Slf4j;
@RequiredArgsConstructor
public class OpenApiMeetingExpertManage {

@Value("${hz-pm.interfaceKey}")
private String meetingExpertInfoKey;

private final OpenApiCheckSignUtil openApiCheckSignUtil;
private final IMeetingService meetingService;
private final IMeetingExpertService meetingExpertService;
private final UserInfoHelper userInfoHelper;
@@ -74,7 +68,7 @@ public class OpenApiMeetingExpertManage {
public List<MeetingExpertToMhDTO> infoList(ReqMeetingExpertInfoPO po) {
String key = po.getKey();
// 校验传入的签名
checkSign(key);
openApiCheckSignUtil.checkSign(key);
// 获取已经抽取(指定)完成 确认参加会议并且未签到的专家信息
List<Meeting> meetingList = meetingService.list(Wrappers.lambdaQuery(Meeting.class)
.eq(Meeting::getConfirmedRoster, Boolean.TRUE)
@@ -175,49 +169,11 @@ public class OpenApiMeetingExpertManage {
return result;
}

private void checkSign(String key) {
if (StrUtil.isBlank(key)) {
throw new BizException("签名错误");
}
StringBuilder sb = new StringBuilder();
sb.append("key=").append(meetingExpertInfoKey);
// 使用SHA-256进行加密
String sign = null;
try {
MessageDigest md = MessageDigest.getInstance("SHA-256");
byte[] bytes = md.digest(sb.toString().getBytes());
sign = bytesToHexString(bytes);
} catch (NoSuchAlgorithmException e) {
log.error("签名校验错误:", e);
}
if (sign != null && sign.length() >= 8 && StrUtil.endWith(sign, key)) {
return;
}
throw new BizException("签名错误");
}

/**
* 将字节数组转换为十六进制字符串
*
* @param bytes 字节数组
* @return 十六进制字符串
*/
private static String bytesToHexString(byte[] bytes) {
StringBuilder sb = new StringBuilder();
for (byte b : bytes) {
String hex = Integer.toHexString(b & 0xFF);
if (hex.length() == 1) {
sb.append("0");
}
sb.append(hex);
}
return sb.toString();
}

public String sign(ReqMeetingExpertSignPO po) {
String key = po.getKey();
// 校验传入的签名
checkSign(key);
openApiCheckSignUtil.checkSign(key);
Long meetingId = po.getMeetingId();
Long userId = po.getUserId();
LocalDateTime signTime = po.getSignTime();
@@ -236,7 +192,7 @@ public class OpenApiMeetingExpertManage {
}

public PageVo<ExpertJudgeToMhVO> pageExpertJudges(PageExpertJudgePO po) {
checkSign(po.getKey());
openApiCheckSignUtil.checkSign(po.getKey());
LambdaQueryWrapper<MeetingExpertJudge> query = Wrappers.lambdaQuery(MeetingExpertJudge.class)
.eq(po.getMeetingId() != null, MeetingExpertJudge::getMeetingId, po.getMeetingId())
.orderByDesc(MeetingExpertJudge::getCreateOn);


+ 66
- 0
hz-pm-api/src/main/java/com/hz/pm/api/open/util/OpenApiCheckSignUtil.java View File

@@ -0,0 +1,66 @@
package com.hz.pm.api.open.util;

import cn.hutool.core.util.StrUtil;
import com.ningdatech.basic.exception.BizException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
* <p>
* OpenApiCheckSignUtil
* </p>
*
* @author WendyYang
* @since 10:45 2024/11/6
*/
@Slf4j
@Component
public class OpenApiCheckSignUtil {

@Value("${hz-pm.interfaceKey}")
private String interfaceKey;

/**
* 将字节数组转换为十六进制字符串
*
* @param bytes 字节数组
* @return 十六进制字符串
*/
private static String bytesToHexString(byte[] bytes) {
StringBuilder sb = new StringBuilder();
for (byte b : bytes) {
String hex = Integer.toHexString(b & 0xFF);
if (hex.length() == 1) {
sb.append("0");
}
sb.append(hex);
}
return sb.toString();
}

public void checkSign(String targetSign) {
if (StrUtil.isBlank(targetSign)) {
throw new BizException("签名错误");
}
StringBuilder sb = new StringBuilder();
sb.append("key=").append(interfaceKey);
// 使用SHA-256进行加密
String sign = null;
try {
MessageDigest md = MessageDigest.getInstance("SHA-256");
byte[] bytes = md.digest(sb.toString().getBytes());
sign = bytesToHexString(bytes);
} catch (NoSuchAlgorithmException e) {
log.error("签名校验错误:", e);
}
if (sign != null && sign.length() >= 8 && StrUtil.endWith(sign, targetSign)) {
return;
}
throw new BizException("签名错误");
}

}

+ 3
- 1
hz-pm-api/src/main/java/com/hz/pm/api/projectdeclared/manage/ProjectReviewManage.java View File

@@ -249,7 +249,9 @@ public class ProjectReviewManage {
});
return ReviewProgressStatisticsVO.builder()
.totalCount(projects.size())
.withoutConstructionPlanSealFileCount(CollUtil.count(projects, w -> StrUtil.isBlank(w.getConstructionPlanSealFile())))
.withoutConstructionPlanSealFileCount(CollUtil.count(projects,
w -> ProjectStatus.WITHOUT_EXPERT_REVIEW.eq(w.getStatus())
&& StrUtil.isBlank(w.getConstructionPlanSealFile())))
.todoCount(countMap.getOrDefault(ProjectStatus.WITHOUT_EXPERT_REVIEW, 0L))
.auditCount(countMap.getOrDefault(ProjectStatus.ON_EXPERT_REVIEW, 0L))
.passedCount(countMap.getOrDefault(ProjectStatus.EXPERT_REVIEW_PASSED, 0L))


Loading…
Cancel
Save