From 8971a386b670d223095cfc0053780384e13f7884 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Fri, 12 Jul 2024 11:37:07 +0800 Subject: [PATCH 1/5] =?UTF-8?q?modify:=201.=20=E9=A6=96=E9=A1=B5=E6=A0=87?= =?UTF-8?q?=E6=AE=B5=E6=95=B0=E9=87=8F=E7=BB=9F=E8=AE=A1=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pm/api/workbench/manage/WorkbenchManage.java | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java index 2e1dd2f..f570d08 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/workbench/manage/WorkbenchManage.java @@ -60,6 +60,7 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.util.*; +import java.util.function.ToLongBiFunction; import java.util.function.ToLongFunction; import java.util.stream.Collectors; @@ -227,12 +228,12 @@ public class WorkbenchManage { Map projBizMap = purchaseEventMap.getOrDefault(event.name(), Collections.emptyMap()); return projBizMap.values().stream().mapToLong(l -> l).sum(); }; - ToLongFunction countProject = event -> { + ToLongBiFunction countProject = (event, node) -> { Map projBizMap = purchaseEventMap.getOrDefault(event.name(), Collections.emptyMap()); - if (event.name().equals(ProcessNode.PROJECT_ADAPTION.name()) - || event.name().equals(ProcessNode.SYSTEM_SELF_TEST.name()) - || event.name().equals(ProcessNode.SYSTEM_TEST_VALID.name()) - || event.name().equals(ProcessNode.XCFHX_REVIEW.name())) { + if (node.equals(ProcessNode.PROJECT_ADAPTION) + || node.equals(ProcessNode.SYSTEM_SELF_TEST) + || node.equals(ProcessNode.SYSTEM_TEST_VALID) + || node.equals(ProcessNode.XCFHX_REVIEW)) { return projBizMap.size(); } else { return projectPurchaseCountMap.entrySet().stream().filter(w -> { @@ -284,7 +285,7 @@ public class WorkbenchManage { projectCount = projectPurchaseCountMap.size(); if (bidCount > 0) { Wrapper pQuery = Wrappers.lambdaQuery(PurchaseStatusChange.class) - .select(PurchaseStatusChange::getEvent) + .select(PurchaseStatusChange::getEvent,PurchaseStatusChange::getProjectId) .in(PurchaseStatusChange::getProjectId, allVersionProjectIds) .in(PurchaseStatusChange::getEvent, AdaptStateChangeEvent.ADAPT_INFO_PASSED, SelfTestStateChangeEvent.SELF_TEST_PASSED, @@ -302,29 +303,29 @@ public class WorkbenchManage { break; case PROJECT_ADAPTION: bidCount = countPurchase.applyAsLong(AdaptStateChangeEvent.ADAPT_INFO_PASSED); - projectCount = countProject.applyAsLong(AdaptStateChangeEvent.ADAPT_INFO_PASSED); + projectCount = countProject.applyAsLong(AdaptStateChangeEvent.ADAPT_INFO_PASSED, node); break; case SYSTEM_SELF_TEST: bidCount = countPurchase.applyAsLong(SelfTestStateChangeEvent.SELF_TEST_PASSED); - projectCount = countProject.applyAsLong(SelfTestStateChangeEvent.SELF_TEST_PASSED); + projectCount = countProject.applyAsLong(SelfTestStateChangeEvent.SELF_TEST_PASSED, node); break; case SYSTEM_TEST_VALID: bidCount = countPurchase.applyAsLong(TestValidStateChangeEvent.TEST_VALID_INFO_PASSED); - projectCount = countProject.applyAsLong(TestValidStateChangeEvent.TEST_VALID_INFO_PASSED); + projectCount = countProject.applyAsLong(TestValidStateChangeEvent.TEST_VALID_INFO_PASSED, node); break; case FIRST_INSPECTED: case PILOT_RUNNING: // 初验试运行数量同步 bidCount = countPurchase.applyAsLong(TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES); - projectCount = countProject.applyAsLong(TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES); + projectCount = countProject.applyAsLong(TenderStateChangeEvent.SUBMIT_FIRST_INSPECTED_FILES, node); break; case XCFHX_REVIEW: bidCount = countPurchase.applyAsLong(XcfhxStateChangeEvent.XCFHX_APPLY_PASSED); - projectCount = countProject.applyAsLong(XcfhxStateChangeEvent.XCFHX_APPLY_PASSED); + projectCount = countProject.applyAsLong(XcfhxStateChangeEvent.XCFHX_APPLY_PASSED, node); break; case FINAL_INSPECTED: bidCount = countPurchase.applyAsLong(TenderStateChangeEvent.FINALLY_INSPECTED_PASSED); - projectCount = countProject.applyAsLong(TenderStateChangeEvent.FINALLY_INSPECTED_PASSED); + projectCount = countProject.applyAsLong(TenderStateChangeEvent.FINALLY_INSPECTED_PASSED, node); break; default: break; From 0f5fc2a7a678765b9d0276a5a0c7b7554512e397 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Mon, 15 Jul 2024 10:18:26 +0800 Subject: [PATCH 2/5] =?UTF-8?q?modify:=201.=20=E7=9F=AD=E4=BF=A1=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=A2=9E=E5=8A=A0=E8=81=94=E7=B3=BB=E4=BA=BA=E8=81=94?= =?UTF-8?q?=E7=B3=BB=E6=96=B9=E5=BC=8F=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/hz/pm/api/meeting/helper/MeetingNotifyHelper.java | 4 +++- .../main/java/com/hz/pm/api/sms/constant/VoiceSmsTemplateConst.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingNotifyHelper.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingNotifyHelper.java index 4b56920..86eaa13 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingNotifyHelper.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/helper/MeetingNotifyHelper.java @@ -193,7 +193,9 @@ public class MeetingNotifyHelper { private void smsExperts(Meeting meeting, List experts) { String content = String.format(VoiceSmsTemplateConst.EXPERT_INVITE_SMS, meeting.getHoldOrg(), meeting.getName(), officialTime(meeting.getStartTime()), - meeting.getMeetingAddress()); + meeting.getMeetingAddress(), + meeting.getConnecter(), + meeting.getContact()); Set phones = CollUtils.fieldSet(experts, MeetingExpert::getMobile); String submitKey; if (environmentUtil.isDevEnv() && Boolean.TRUE.equals(inviteSkipSendSms)) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/sms/constant/VoiceSmsTemplateConst.java b/hz-pm-api/src/main/java/com/hz/pm/api/sms/constant/VoiceSmsTemplateConst.java index 5c53060..90f6be8 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/sms/constant/VoiceSmsTemplateConst.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/sms/constant/VoiceSmsTemplateConst.java @@ -28,6 +28,6 @@ public class VoiceSmsTemplateConst { */ public static final String EXPERT_INVITE_CALL = "尊敬的专家您好,%s现邀请您作为专家参加%s会议,会议时间:%s,会议地点:%s。 确认参加请按 1,拒绝参加请按 2,重听请按星号键。请您选择"; - public static final String EXPERT_INVITE_SMS = "【杭州数字信创】尊敬的专家您好,%s现邀请您作为专家参加%s会议,会议时间:%s,会议地点:%s。 确认参加请回复 1,拒绝参加请回复 2。请您选择"; + public static final String EXPERT_INVITE_SMS = "【杭州数字信创】尊敬的专家您好,%s现邀请您作为专家参加%s会议,会议时间:%s,会议地点:%s。 确认参加请回复 1,拒绝参加请回复 2。如有疑问请联系:%s(%s)。"; } From 2a6514b06343c590e506c910b9d431656eded624 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 16 Jul 2024 14:55:33 +0800 Subject: [PATCH 3/5] =?UTF-8?q?modify:=201.=20=E9=89=B4=E6=9D=83=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E6=8D=95=E8=8E=B7=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/user/security/config/WebSecurityConfig.java | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/config/WebSecurityConfig.java b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/config/WebSecurityConfig.java index 802e023..ed33c0e 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/user/security/config/WebSecurityConfig.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/user/security/config/WebSecurityConfig.java @@ -1,17 +1,23 @@ package com.hz.pm.api.user.security.config; +import com.hz.pm.api.common.model.constant.BizConst; import com.hz.pm.api.common.model.constant.CommonConst; import com.hz.pm.api.user.security.auth.code.AuthCodeLoginSecurityConfig; import com.hz.pm.api.user.security.auth.credential.CredentialAuthSecurityConfig; import com.hz.pm.api.user.security.handler.DefaultExpiredSessionStrategy; import com.hz.pm.api.user.security.handler.DefaultLogoutSuccessHandler; import com.hz.pm.api.user.security.auth.mh.MhAuthSecurityConfig; +import com.ningdatech.basic.util.NdJsonUtil; +import com.ningdatech.basic.util.StrPool; import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpStatus; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.security.web.csrf.CookieCsrfTokenRepository; +import java.io.PrintWriter; import java.util.Map; import java.util.Set; @@ -38,7 +44,9 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { protected void configure(HttpSecurity http) throws Exception { assemblerPreAuthUrls(http); http.formLogin() - .loginPage(authProperties.getAuthRequireUrl()) + .and() + .exceptionHandling() + .authenticationEntryPoint(authenticationEntryPoint()) .and().apply(credentialAuthSecurityConfig) .and().apply(authCodeLoginSecurityConfig) .and().apply(mhAuthSecurityConfig) @@ -68,6 +76,17 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { .ignoringAntMatchers(authProperties.getIgnoreCsrfUrlsArray()); } + private AuthenticationEntryPoint authenticationEntryPoint() { + return (request, response, authException) -> { + response.setContentType(StrPool.CONTENT_TYPE); + response.setStatus(HttpStatus.UNAUTHORIZED.value()); + PrintWriter writer = response.getWriter(); + writer.write(NdJsonUtil.getInstance().writeValueAsString(BizConst.UNAUTHENTICATED)); + writer.flush(); + writer.close(); + }; + } + private void assemblerPreAuthUrls(HttpSecurity http) throws Exception { Map roleArrayMap = authProperties.getRoleArrayMap(); Set roleSet = roleArrayMap.keySet(); From fd92d4abcba85e6d2f7a128dcab1d633475caaee Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 16 Jul 2024 17:13:21 +0800 Subject: [PATCH 4/5] =?UTF-8?q?modify:=201.=20=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E4=BF=AE=E6=94=B9=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hz/pm/api/external/FilePreviewClient.java | 23 ++++++++++++++++------ .../external/controller/FilePreviewController.java | 5 +++-- .../hz/pm/api/meeting/entity/config/WebProps.java | 9 +++++++++ hz-pm-api/src/main/resources/application-dev.yml | 2 +- hz-pm-api/src/main/resources/application-prod.yml | 6 ++++-- 5 files changed, 34 insertions(+), 11 deletions(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/FilePreviewClient.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/FilePreviewClient.java index 4cca3dd..f886a65 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/external/FilePreviewClient.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/FilePreviewClient.java @@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** @@ -26,8 +27,11 @@ public class FilePreviewClient { private static final Logger log = LoggerFactory.getLogger(FilePreviewClient.class); - @Value("${mh.file-preview.host}") - private String mhFilePreviewUrl; + @Value("${mh.file-preview.public-host:}") + private String mhFilePreviewPublicUrl; + + @Value("${mh.file-preview.private-host:}") + private String mhFilePreviewPrivateUrl; private final FileService fileService; @@ -37,10 +41,17 @@ public class FilePreviewClient { private static final String PREVIEW_PATH_FMT = "%s/public/risen/core/resrc/view/pdf_view.html.do?strMap.remote_url=%s&strMap.ext=%s"; - public String getFilePreviewUrl(Long fileId) { - String fileDownUrl = WebProps.apiUrl + FILE_DOWN_NO_AUTH_URL + fileId; - File file = fileService.getById(fileId); - return String.format(PREVIEW_PATH_FMT, mhFilePreviewUrl, fileDownUrl, file.getSuffix()); + public String getFilePreviewUrl(Long fileId, HttpServletRequest request) { + String serverName = request.getServerName(); + if (serverName.contains("weixin")) { + String fileDownUrl = WebProps.zzdApiUrl + FILE_DOWN_NO_AUTH_URL + fileId; + File file = fileService.getById(fileId); + return String.format(PREVIEW_PATH_FMT, mhFilePreviewPublicUrl, fileDownUrl, file.getSuffix()); + } else { + String fileDownUrl = WebProps.apiUrl + FILE_DOWN_NO_AUTH_URL + fileId; + File file = fileService.getById(fileId); + return String.format(PREVIEW_PATH_FMT, mhFilePreviewPrivateUrl, fileDownUrl, file.getSuffix()); + } } public void downloadFile(Long fileId, HttpServletResponse response) { diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/controller/FilePreviewController.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/controller/FilePreviewController.java index fa20386..a3d9883 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/external/controller/FilePreviewController.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/controller/FilePreviewController.java @@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** @@ -29,8 +30,8 @@ public class FilePreviewController { @ApiOperation("获取文件的预览地址") @GetMapping("/getFilePreviewUrl/{fileId}") - public String getFilePreviewUrl(@PathVariable Long fileId) { - return filePreviewClient.getFilePreviewUrl(fileId); + public String getFilePreviewUrl(@PathVariable Long fileId, HttpServletRequest request) { + return filePreviewClient.getFilePreviewUrl(fileId, request); } @ApiOperation("文件下载(不鉴权)") diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/config/WebProps.java b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/config/WebProps.java index 22275d1..b8f3553 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/config/WebProps.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/meeting/entity/config/WebProps.java @@ -20,6 +20,10 @@ public class WebProps { public static String apiUrl; + public static String zzdApiUrl; + + + @Value("${web.login.url:}") private void setLoginUrl(String url) { loginUrl = url; @@ -30,4 +34,9 @@ public class WebProps { apiUrl = url; } + @Value("${web.zzd-api.url:}") + private void setZzdApiUrl(String url) { + zzdApiUrl = url; + } + } diff --git a/hz-pm-api/src/main/resources/application-dev.yml b/hz-pm-api/src/main/resources/application-dev.yml index 05403fe..13e3f26 100644 --- a/hz-pm-api/src/main/resources/application-dev.yml +++ b/hz-pm-api/src/main/resources/application-dev.yml @@ -189,7 +189,7 @@ mh: detail-url: https://weixin.hzszxc.hzswb.cn:8443/test/mh-gateway/oss/ossfile/getFileInfoList upload-url: https://weixin.hzszxc.hzswb.cn:8443/test/mh-gateway/oss/oss/uploadFileSkipLogin file-preview: - host: http://ztzz2.hzswb.cn/yl + public-host: http://ztzz2.hzswb.cn/yl auth-code: secret-key: nqkmzqojg5j4eiypr3rb8s7nb4noa8b2 diff --git a/hz-pm-api/src/main/resources/application-prod.yml b/hz-pm-api/src/main/resources/application-prod.yml index 6e400f2..aa17e27 100644 --- a/hz-pm-api/src/main/resources/application-prod.yml +++ b/hz-pm-api/src/main/resources/application-prod.yml @@ -182,6 +182,8 @@ web: url: https://hzszxc.hzswb.cn:8443/project api: url: https://hzszxc.hzswb.cn:8443/hzpm + zzd-api: + url: https://weixin.hzszxc.hzswb.cn:8143/hzpm mh: sso: @@ -199,8 +201,8 @@ mh: purchase-notice: open: true file-preview: - # host: http://ztzz2.hzswb.cn/yl - host: http://172.18.43.208/yl + public-host: http://ztzz2.hzswb.cn/yl + private-host: http://172.18.43.208/yl sms-send: host: http://10.54.38.13:8081/mh-gateway/auth-single From 710e2fdf782c43d7bf1c9c86a910d1f7f0953c45 Mon Sep 17 00:00:00 2001 From: WendyYang Date: Tue, 16 Jul 2024 18:03:52 +0800 Subject: [PATCH 5/5] =?UTF-8?q?modify:=201.=20=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E9=A2=84=E8=A7=88=E4=BF=AE=E6=94=B9=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/hz/pm/api/external/FilePreviewClient.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hz-pm-api/src/main/java/com/hz/pm/api/external/FilePreviewClient.java b/hz-pm-api/src/main/java/com/hz/pm/api/external/FilePreviewClient.java index f886a65..d20b7d5 100644 --- a/hz-pm-api/src/main/java/com/hz/pm/api/external/FilePreviewClient.java +++ b/hz-pm-api/src/main/java/com/hz/pm/api/external/FilePreviewClient.java @@ -1,5 +1,6 @@ package com.hz.pm.api.external; +import cn.hutool.http.useragent.UserAgentUtil; import com.hz.pm.api.meeting.entity.config.WebProps; import com.ningdatech.basic.exception.BizException; import com.ningdatech.file.entity.File; @@ -43,7 +44,9 @@ public class FilePreviewClient { public String getFilePreviewUrl(Long fileId, HttpServletRequest request) { String serverName = request.getServerName(); - if (serverName.contains("weixin")) { + log.info("serverName:{}", serverName); + if (serverName.contains("weixin") || serverName.contains("10.54.38.13")) { + // 浙政钉访问需要转换为互联网可访问的地址 String fileDownUrl = WebProps.zzdApiUrl + FILE_DOWN_NO_AUTH_URL + fileId; File file = fileService.getById(fileId); return String.format(PREVIEW_PATH_FMT, mhFilePreviewPublicUrl, fileDownUrl, file.getSuffix());