1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

Merge branch 'main' into production

This commit is contained in:
程序员小墨 2023-04-26 01:02:23 +08:00
commit a94f36f9d3
7 changed files with 454 additions and 99 deletions

60
20230425-epp.md Normal file
View File

@ -0,0 +1,60 @@
# 基于微服务的社区疫情防控系统
Epidemic prevention platform
> 项目首页:
>
> https://epp.only4.work/
>
> 代码仓库地址:
>
> https://git.only4.work/coder-xiaomo/epp
本项目采用 monorepo 单仓库模式进行维护,项目完整代码均在此仓库中。
## 管理员后台
> 管理员后台地址:
>
> https://epp.only4.work/manage/index.html
社区管理员 测试账号admin<span style="user-select: none;"> </span>admin
系统管理员 测试账号root<span style="user-select: none;"> </span>root
## 门禁端
>网页版地址:
>
>https://epp.only4.work/guard/index.html
可以直接用 **微信扫一扫功能****小程序端“扫门禁码”功能** 扫描门禁码,**扫描**及**确认进门**操作门禁端会弹出成功提示
\* 跨端桌面应用界面和功能均与网页版一致
## 小程序
> 小程序已审核上线,可以搜索 **devprogram** 或者扫描下方小程序码
\* 由于生活物资、进出码无法审核通过,所以**提审时隐藏了部分功能入口**。
如果登录之后**下方只有体温上报功能**,可以**点击右上角三个点→重新进入小程序**即可展示全部功能。
![](https://epp.only4.work/assets/image/miniprogram.jpg)
<br>
-----
<div style="text-align: center;">
张博凯
</div>

252
JMeter测试-HTTP请求.jmx Normal file
View File

@ -0,0 +1,252 @@
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.4.3">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="测试计划" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="用户定义的变量" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="线程组" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="循环控制器" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<intProp name="LoopController.loops">-1</intProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">10</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
</ThreadGroup>
<hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP请求" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="用户定义的变量" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain">epp.only4.work</stringProp>
<stringProp name="HTTPSampler.port">80</stringProp>
<stringProp name="HTTPSampler.protocol">https</stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">/user/manage/getUserList</stringProp>
<stringProp name="HTTPSampler.method">GET</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
</HTTPSamplerProxy>
<hashTree>
<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="响应断言" enabled="true">
<collectionProp name="Asserion.test_strings"/>
<stringProp name="Assertion.custom_message"></stringProp>
<stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
<boolProp name="Assertion.assume_success">false</boolProp>
<intProp name="Assertion.test_type">16</intProp>
</ResponseAssertion>
<hashTree/>
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="察看结果树" enabled="true">
<boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp>
<name>saveConfig</name>
<value class="SampleSaveConfiguration">
<time>true</time>
<latency>true</latency>
<timestamp>true</timestamp>
<success>true</success>
<label>true</label>
<code>true</code>
<message>true</message>
<threadName>true</threadName>
<dataType>true</dataType>
<encoding>false</encoding>
<assertions>true</assertions>
<subresults>true</subresults>
<responseData>false</responseData>
<samplerData>false</samplerData>
<xml>false</xml>
<fieldNames>true</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
<sentBytes>true</sentBytes>
<url>true</url>
<threadCounts>true</threadCounts>
<idleTime>true</idleTime>
<connectTime>true</connectTime>
</value>
</objProp>
<stringProp name="filename"></stringProp>
</ResultCollector>
<hashTree/>
<ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="聚合报告" enabled="true">
<boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp>
<name>saveConfig</name>
<value class="SampleSaveConfiguration">
<time>true</time>
<latency>true</latency>
<timestamp>true</timestamp>
<success>true</success>
<label>true</label>
<code>true</code>
<message>true</message>
<threadName>true</threadName>
<dataType>true</dataType>
<encoding>false</encoding>
<assertions>true</assertions>
<subresults>true</subresults>
<responseData>false</responseData>
<samplerData>false</samplerData>
<xml>false</xml>
<fieldNames>true</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
<sentBytes>true</sentBytes>
<url>true</url>
<threadCounts>true</threadCounts>
<idleTime>true</idleTime>
<connectTime>true</connectTime>
</value>
</objProp>
<stringProp name="filename"></stringProp>
</ResultCollector>
<hashTree/>
</hashTree>
</hashTree>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="线程组" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="循环控制器" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<intProp name="LoopController.loops">-1</intProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">800</stringProp>
<stringProp name="ThreadGroup.ramp_time">1</stringProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
</ThreadGroup>
<hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="HTTP请求" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="用户定义的变量" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="HTTPSampler.domain">localhost</stringProp>
<stringProp name="HTTPSampler.port">80</stringProp>
<stringProp name="HTTPSampler.protocol">http</stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">/access/code/getCodeInfo?id=1</stringProp>
<stringProp name="HTTPSampler.method">POST</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">true</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp>
<stringProp name="HTTPSampler.implementation">HttpClient4</stringProp>
<stringProp name="HTTPSampler.connect_timeout">300000</stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
</HTTPSamplerProxy>
<hashTree>
<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="响应断言" enabled="true">
<collectionProp name="Asserion.test_strings"/>
<stringProp name="Assertion.custom_message"></stringProp>
<stringProp name="Assertion.test_field">Assertion.response_data</stringProp>
<boolProp name="Assertion.assume_success">false</boolProp>
<intProp name="Assertion.test_type">16</intProp>
</ResponseAssertion>
<hashTree/>
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="察看结果树" enabled="true">
<boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp>
<name>saveConfig</name>
<value class="SampleSaveConfiguration">
<time>true</time>
<latency>true</latency>
<timestamp>true</timestamp>
<success>true</success>
<label>true</label>
<code>true</code>
<message>true</message>
<threadName>true</threadName>
<dataType>true</dataType>
<encoding>false</encoding>
<assertions>true</assertions>
<subresults>true</subresults>
<responseData>false</responseData>
<samplerData>false</samplerData>
<xml>false</xml>
<fieldNames>true</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
<sentBytes>true</sentBytes>
<url>true</url>
<threadCounts>true</threadCounts>
<idleTime>true</idleTime>
<connectTime>true</connectTime>
</value>
</objProp>
<stringProp name="filename"></stringProp>
</ResultCollector>
<hashTree/>
<ResultCollector guiclass="StatVisualizer" testclass="ResultCollector" testname="聚合报告" enabled="true">
<boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp>
<name>saveConfig</name>
<value class="SampleSaveConfiguration">
<time>true</time>
<latency>true</latency>
<timestamp>true</timestamp>
<success>true</success>
<label>true</label>
<code>true</code>
<message>true</message>
<threadName>true</threadName>
<dataType>true</dataType>
<encoding>false</encoding>
<assertions>true</assertions>
<subresults>true</subresults>
<responseData>false</responseData>
<samplerData>false</samplerData>
<xml>false</xml>
<fieldNames>true</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
<sentBytes>true</sentBytes>
<url>true</url>
<threadCounts>true</threadCounts>
<idleTime>true</idleTime>
<connectTime>true</connectTime>
</value>
</objProp>
<stringProp name="filename"></stringProp>
</ResultCollector>
<hashTree/>
</hashTree>
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>

View File

@ -383,7 +383,10 @@ const envVersion = "【⚠此处修改为当前小程序环境】" // 正式版
##### 打 jar 包
IDEA 中右侧 Maven 双击 Lifestyle 的 package打包完成后的 jar 包可在以下位置找到
> 打包需要一起打包,每个项目单独打包可能会提示找不到 microservice-common 相关依赖
IDEA 中右侧 Maven 双击 Lifestyle 的 package建议先 clean 一下,并点击选中 Maven 的跳过测试,再进行 package打包完成后的 jar 包可在以下位置找到
- backend/microservice-gateway/target/microservice-gateway-0.0.1-SNAPSHOT.jar
- backend/microservice-provider-user-8001/target/microservice-provider-user-8001-0.0.1-SNAPSHOT.jar
- backend/microservice-provider-access-8002/target/microservice-provider-access-8002-0.0.1-SNAPSHOT.jar

View File

@ -0,0 +1,19 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Dev-Gateway (epp.miniprogram.config=hide)" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot">
<envs>
<env name="--spring.profiles.active" value="develop" />
</envs>
<module name="microservice-gateway" />
<option name="SPRING_BOOT_MAIN_CLASS" value="com.cxyxiaomo.epp.gateway.Gateway" />
<option name="VM_PARAMETERS" value="-Xms64m -Xmx256m -Depp.miniprogram.config=hide" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="com.cxyxiaomo.epp.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@ -1,10 +1,13 @@
package com.cxyxiaomo.epp.gateway.controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Objects;
@RestController
public class Controller {
@ -14,17 +17,29 @@ public class Controller {
return "[ERROR] 500 Internal Server Error";
}
@Value("${epp.miniprogram.config}")
private String miniprogramConfig;
/**
* 为了通过微信的小程序审核所特别处理的
*
* @return
*/
@RequestMapping("/getConfig")
public HashMap<String, Object> WxMiniProgramAuditSpecialHandle() {
public HashMap<String, Object> WxMiniProgramAuditSpecialHandle(@RequestParam(value = "v", required = false) String version) {
boolean showCode = true;
boolean showShop = true;
boolean showReport = true;
// 第一版提审已通过在线上 version == null
if (version.equals("2")) {
// 第一版提审按照配置文件中的配置来
if (Objects.equals(miniprogramConfig, "hide")) {
showCode = false;
showShop = false;
}
}
// 底部 tabbar
LinkedList<String> tabbarItem = new LinkedList<>();
tabbarItem.push("pages/index/index");

View File

@ -97,3 +97,9 @@ spring:
args:
status: 302
url: https://www.baidu.com/?wd=
epp:
miniprogram:
# 为了通过微信的小程序审核所特别处理的
# show / hide
config: show

View File

@ -1,97 +1,97 @@
var defaultTabbarItem = [
"pages/person/person",
"pages/residents/report",
"pages/index/index"
]
export function toggle(that) {
let pages = getCurrentPages()
let route = pages[pages.length - 1].route
console.log("[CustomTabBar] route", route)
if (!typeof that.getTabBar === 'function' || !that.getTabBar()) {
// wx.showModal({
// title: '版本太旧',
// content: '您的微信版本太旧,无法使用本小程序',
// showCancel: false,
// complete: (res) => {
// wx.exitMiniProgram()
// }
// })
return
}
// 找出要选择哪一项
let tabBar = that.getTabBar()
console.log("[CustomTabBar] tabBar", tabBar)
let data = tabBar.data
console.log("[CustomTabBar] data", data)
let showPagePathList = wx.getStorageSync('tabbarItem') || defaultTabbarItem
console.log("[CustomTabBar] showPagePathList", showPagePathList)
let list = tabBar.data.rawList.filter((page) => showPagePathList.includes(page.pagePath))
console.log("[CustomTabBar] tabBarList", list)
let selected = list ? list.indexOf(list.find(p => p.pagePath == route)) : -1
console.log("[CustomTabBar] selected", selected)
console.log("更新tabbar")
// 选中这一项
tabBar.setData({
selected: selected,
list: list
})
}
export function updateConfig(baseUrl) {
// 请求配置文件(用于审核时隐藏部分功能)
wx.request({
url: baseUrl + '/getConfig',
success(result) {
let data = result.data
if (data.tabbarItem) {
console.log("[CustomTabBar] tabbar数据拉取完毕")
wx.setStorageSync('tabbarItem', data.tabbarItem)
wx.setStorageSync('indexItem', data.indexItem)
const pages = getCurrentPages();
const indexPage = pages[0]
const currentPage = pages[pages.length - 1]
console.log("[CustomTabBar] indexPage", indexPage)
console.log("[CustomTabBar] currentPage", currentPage)
// // 更新tabbar
// toggle(currentPage)
// 刷新首页中包含了触发 toggle 的代码 此处不重复触发
// 刷新首页
indexPage && indexPage.onLoad()
// let tabBar = currentPage.getTabBar()
// tabBar.setData({
// list: tabBar.data.rawList.filter((page) => itemList.includes(page.pagePath))
// })
}
},
fail() {
wx.showModal({
title: '小程序启动失败',
content: '点击确认重试,若多次失败请检查网络连接',
complete: (res) => {
if (res.cancel) {
wx.exitMiniProgram()
}
if (res.confirm) {
wx.reLaunch({
url: 'pages/index/index',
})
}
}
})
}
})
}
var defaultTabbarItem = [
"pages/person/person",
"pages/residents/report",
"pages/index/index"
]
export function toggle(that) {
let pages = getCurrentPages()
let route = pages[pages.length - 1].route
console.log("[CustomTabBar] route", route)
if (!typeof that.getTabBar === 'function' || !that.getTabBar()) {
// wx.showModal({
// title: '版本太旧',
// content: '您的微信版本太旧,无法使用本小程序',
// showCancel: false,
// complete: (res) => {
// wx.exitMiniProgram()
// }
// })
return
}
// 找出要选择哪一项
let tabBar = that.getTabBar()
console.log("[CustomTabBar] tabBar", tabBar)
let data = tabBar.data
console.log("[CustomTabBar] data", data)
let showPagePathList = wx.getStorageSync('tabbarItem') || defaultTabbarItem
console.log("[CustomTabBar] showPagePathList", showPagePathList)
let list = tabBar.data.rawList.filter((page) => showPagePathList.includes(page.pagePath))
console.log("[CustomTabBar] tabBarList", list)
let selected = list ? list.indexOf(list.find(p => p.pagePath == route)) : -1
console.log("[CustomTabBar] selected", selected)
console.log("更新tabbar")
// 选中这一项
tabBar.setData({
selected: selected,
list: list
})
}
export function updateConfig(baseUrl) {
// 请求配置文件(用于审核时隐藏部分功能)
wx.request({
url: baseUrl + '/getConfig?v=2',
success(result) {
let data = result.data
if (data.tabbarItem) {
console.log("[CustomTabBar] tabbar数据拉取完毕")
wx.setStorageSync('tabbarItem', data.tabbarItem)
wx.setStorageSync('indexItem', data.indexItem)
const pages = getCurrentPages();
const indexPage = pages[0]
const currentPage = pages[pages.length - 1]
console.log("[CustomTabBar] indexPage", indexPage)
console.log("[CustomTabBar] currentPage", currentPage)
// // 更新tabbar
// toggle(currentPage)
// 刷新首页中包含了触发 toggle 的代码 此处不重复触发
// 刷新首页
indexPage && indexPage.onLoad()
// let tabBar = currentPage.getTabBar()
// tabBar.setData({
// list: tabBar.data.rawList.filter((page) => itemList.includes(page.pagePath))
// })
}
},
fail() {
wx.showModal({
title: '小程序启动失败',
content: '点击确认重试,若多次失败请检查网络连接',
complete: (res) => {
if (res.cancel) {
wx.exitMiniProgram()
}
if (res.confirm) {
wx.reLaunch({
url: 'pages/index/index',
})
}
}
})
}
})
}