init version for new gitea
This commit is contained in:
0
.idea/.gitignore
generated
vendored
Normal file
0
.idea/.gitignore
generated
vendored
Normal file
20
.idea/compiler.xml
generated
Normal file
20
.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<option name="BUILD_PROCESS_HEAP_SIZE" value="2048" />
|
||||||
|
<annotationProcessing>
|
||||||
|
<profile default="true" name="Default" enabled="true" />
|
||||||
|
<profile name="Maven default annotation processors profile" enabled="true">
|
||||||
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
<module name="hrsmobile" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
</component>
|
||||||
|
<component name="JavacSettings">
|
||||||
|
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||||
|
<module name="hrsmobile" options="-parameters" />
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
8
.idea/encodings.xml
generated
Normal file
8
.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="PROJECT" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/git_toolbox_blame.xml
generated
Normal file
6
.idea/git_toolbox_blame.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GitToolBoxBlameSettings">
|
||||||
|
<option name="version" value="2" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
15
.idea/git_toolbox_prj.xml
generated
Normal file
15
.idea/git_toolbox_prj.xml
generated
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="GitToolBoxProjectSettings">
|
||||||
|
<option name="commitMessageIssueKeyValidationOverride">
|
||||||
|
<BoolValueOverride>
|
||||||
|
<option name="enabled" value="true" />
|
||||||
|
</BoolValueOverride>
|
||||||
|
</option>
|
||||||
|
<option name="commitMessageValidationEnabledOverride">
|
||||||
|
<BoolValueOverride>
|
||||||
|
<option name="enabled" value="true" />
|
||||||
|
</BoolValueOverride>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
25
.idea/jarRepositories.xml
generated
Normal file
25
.idea/jarRepositories.xml
generated
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Maven Central repository" />
|
||||||
|
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="jboss.community" />
|
||||||
|
<option name="name" value="JBoss Community repository" />
|
||||||
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="https://maven.aliyun.com/repository/central" />
|
||||||
|
</remote-repository>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
40
.idea/misc.xml
generated
Normal file
40
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CodeInsightWorkspaceSettings">
|
||||||
|
<option name="optimizeImportsOnTheFly" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectInspectionProfilesVisibleTreeState">
|
||||||
|
<entry key="Project Default">
|
||||||
|
<profile-state>
|
||||||
|
<expanded-state>
|
||||||
|
<State>
|
||||||
|
<id>CSS</id>
|
||||||
|
</State>
|
||||||
|
<State>
|
||||||
|
<id>Java</id>
|
||||||
|
</State>
|
||||||
|
<State>
|
||||||
|
<id>Probable bugsCSS</id>
|
||||||
|
</State>
|
||||||
|
<State>
|
||||||
|
<id>Probable bugsJava</id>
|
||||||
|
</State>
|
||||||
|
</expanded-state>
|
||||||
|
<selected-state>
|
||||||
|
<State>
|
||||||
|
<id>User defined</id>
|
||||||
|
</State>
|
||||||
|
</selected-state>
|
||||||
|
</profile-state>
|
||||||
|
</entry>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
493
.idea/workspace.xml
generated
Normal file
493
.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,493 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AutoImportSettings">
|
||||||
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
|
</component>
|
||||||
|
<component name="ChangeListManager">
|
||||||
|
<list default="true" id="59d56e57-d222-4895-b637-e4e237285f62" name="Changes" comment="修改统计">
|
||||||
|
<change beforePath="$PROJECT_DIR$/pom.xml" beforeDir="false" afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/commons/exception/CustomException.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/commons/exception/CustomException.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/commons/webservice/OtherWSUtil.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/commons/webservice/OtherWSUtil.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/commons/webservice/WSUtil.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/commons/webservice/WSUtil.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/config/SwaggerConfig.java" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/config/VirtualPathConfig.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/config/VirtualPathConfig.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/controller/CountAuthoController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/controller/CountAuthoController.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/controller/HisController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/controller/HisController.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/controller/HisViewSearchController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/controller/HisViewSearchController.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/controller/PayController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/controller/PayController.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/controller/WXFKController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/controller/WXFKController.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/controller/WxybPayController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/controller/WxybPayController.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/AuthNoGet.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/AuthNoGet.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/CancelPreSettlementDTO.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/CancelPreSettlementDTO.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/PatientFeeQuery.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/PatientFeeQuery.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/PatientFeeSettledQuery.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/PatientFeeSettledQuery.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/PayQuery.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/PayQuery.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/PreSettlementQuery.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/PreSettlementQuery.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/Result.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/Result.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/SettlementDTO.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/SettlementDTO.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/WxAppletPayRequest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/WxAppletPayRequest.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/WxybAppletReuqest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/WxybAppletReuqest.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/WxybPay.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/dto/WxybPay.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/service/HisViewSearchService.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/service/HisViewSearchService.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/service/impl/HisViewSearchServiceImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/service/impl/HisViewSearchServiceImpl.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/vo/FeeInfoDetailVO.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/vo/FeeInfoDetailVO.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/vo/FeeInfoVO.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/vo/FeeInfoVO.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/vo/FeeSettledInfoVO.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/vo/FeeSettledInfoVO.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/vo/MZJSPreDetailVO.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/vo/MZJSPreDetailVO.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/java/com/saye/hrs/vo/MZJSPreVO.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/saye/hrs/vo/MZJSPreVO.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/main/resources/META-INF/MANIFEST.MF" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/META-INF/MANIFEST.MF" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/test/java/com/saye/hrs/TestDemo.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/com/saye/hrs/TestDemo.java" afterDir="false" />
|
||||||
|
</list>
|
||||||
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
|
</component>
|
||||||
|
<component name="CompilerWorkspaceConfiguration">
|
||||||
|
<option name="MAKE_PROJECT_ON_SAVE" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="FileTemplateManagerImpl">
|
||||||
|
<option name="RECENT_TEMPLATES">
|
||||||
|
<list>
|
||||||
|
<option value="Interface" />
|
||||||
|
<option value="Class" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="Git.Settings">
|
||||||
|
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||||
|
<map>
|
||||||
|
<entry key="$PROJECT_DIR$" value="dev" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
|
</component>
|
||||||
|
<component name="GitToolBoxStore">
|
||||||
|
<option name="projectConfigVersion" value="5" />
|
||||||
|
<option name="recentBranches">
|
||||||
|
<RecentBranches>
|
||||||
|
<option name="branchesForRepo">
|
||||||
|
<list>
|
||||||
|
<RecentBranchesForRepo>
|
||||||
|
<option name="branches">
|
||||||
|
<list>
|
||||||
|
<RecentBranch>
|
||||||
|
<option name="branchName" value="main" />
|
||||||
|
<option name="lastUsedInstant" value="1741932727" />
|
||||||
|
</RecentBranch>
|
||||||
|
<RecentBranch>
|
||||||
|
<option name="branchName" value="dev" />
|
||||||
|
<option name="lastUsedInstant" value="1732176505" />
|
||||||
|
</RecentBranch>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
<option name="repositoryRootUrl" value="file://$PROJECT_DIR$" />
|
||||||
|
</RecentBranchesForRepo>
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</RecentBranches>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="MarkdownSettingsMigration">
|
||||||
|
<option name="stateVersion" value="1" />
|
||||||
|
</component>
|
||||||
|
<component name="MavenImportPreferences">
|
||||||
|
<option name="generalSettings">
|
||||||
|
<MavenGeneralSettings>
|
||||||
|
<option name="localRepository" value="E:\apache\apache-maven-3.6.1\repository" />
|
||||||
|
<option name="useMavenConfig" value="true" />
|
||||||
|
<option name="userSettingsFile" value="E:\apache\apache-maven-3.6.1\conf\settings.xml" />
|
||||||
|
</MavenGeneralSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="MavenRunner">
|
||||||
|
<option name="skipTests" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectColorInfo">{
|
||||||
|
"associatedIndex": 8
|
||||||
|
}</component>
|
||||||
|
<component name="ProjectId" id="2hBooWU8Rnbmt5NzygvkF90lUr5" />
|
||||||
|
<component name="ProjectViewState">
|
||||||
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
|
<option name="showLibraryContents" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="PropertiesComponent">{
|
||||||
|
"keyToString": {
|
||||||
|
"Application.ApiController.executor": "Run",
|
||||||
|
"Application.HisInterfaceUtils.executor": "Run",
|
||||||
|
"Application.PayServiceImpl.executor": "Run",
|
||||||
|
"Application.WSUtil.executor": "Run",
|
||||||
|
"Maven.hrsmobile [clean,package].executor": "Run",
|
||||||
|
"RequestMappingsPanelOrder0": "0",
|
||||||
|
"RequestMappingsPanelOrder1": "1",
|
||||||
|
"RequestMappingsPanelWidth0": "75",
|
||||||
|
"RequestMappingsPanelWidth1": "75",
|
||||||
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
|
"Spring Boot.HrsApplication.executor": "Run",
|
||||||
|
"WebServerToolWindowFactoryState": "false",
|
||||||
|
"codeReviewSummary": "[]",
|
||||||
|
"git-widget-placeholder": "main",
|
||||||
|
"kotlin-language-version-configured": "true",
|
||||||
|
"last_opened_file_path": "E:/D-2025prj/zhang-tt/kelfy/datamanagerAdd",
|
||||||
|
"node.js.detected.package.eslint": "true",
|
||||||
|
"node.js.detected.package.tslint": "true",
|
||||||
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
|
"nodejs_package_manager_path": "npm",
|
||||||
|
"project.structure.last.edited": "模块",
|
||||||
|
"project.structure.proportion": "0.0",
|
||||||
|
"project.structure.side.proportion": "0.2",
|
||||||
|
"settings.editor.selected.configurable": "editor.preferences.fonts.default",
|
||||||
|
"spring.configuration.checksum": "8d1bbda0f41ff6ead632cd557737c937",
|
||||||
|
"vue.rearranger.settings.migration": "true"
|
||||||
|
}
|
||||||
|
}</component>
|
||||||
|
<component name="RecentsManager">
|
||||||
|
<key name="CopyFile.RECENT_KEYS">
|
||||||
|
<recent name="D:\work_space\kelfy\ProdVersion\hrsmobile\src\main\java\com\saye\hrs\service\impl" />
|
||||||
|
<recent name="D:\work_space\kelfy\ProdVersion\hrsmobile\src\main\java\com\saye\hrs\service" />
|
||||||
|
<recent name="D:\work_space\kelfy\ProdVersion\hrsmobile\src\main\java\com\saye\hrs\model" />
|
||||||
|
<recent name="D:\work_space\kelfy\ProdVersion\hrsmobile\src\main\java\com\saye\hrs\controller" />
|
||||||
|
</key>
|
||||||
|
<key name="CopyClassDialog.RECENTS_KEY">
|
||||||
|
<recent name="com.saye.hrs.service.impl" />
|
||||||
|
<recent name="com.saye.hrs.service" />
|
||||||
|
</key>
|
||||||
|
</component>
|
||||||
|
<component name="RunManager" selected="Spring Boot.HrsApplication">
|
||||||
|
<configuration name="ApiController" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="com.saye.hrs.controller.ApiController" />
|
||||||
|
<module name="hrsmobile" />
|
||||||
|
<extension name="coverage">
|
||||||
|
<pattern>
|
||||||
|
<option name="PATTERN" value="com.saye.hrs.controller.*" />
|
||||||
|
<option name="ENABLED" value="true" />
|
||||||
|
</pattern>
|
||||||
|
</extension>
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<configuration name="HisInterfaceUtils" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="com.saye.hrs.commons.webservice.HisInterfaceUtils" />
|
||||||
|
<module name="hrsmobile" />
|
||||||
|
<extension name="coverage">
|
||||||
|
<pattern>
|
||||||
|
<option name="PATTERN" value="com.saye.hrs.commons.webservice.*" />
|
||||||
|
<option name="ENABLED" value="true" />
|
||||||
|
</pattern>
|
||||||
|
</extension>
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<configuration name="PayServiceImpl" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="com.saye.hrs.service.impl.PayServiceImpl" />
|
||||||
|
<module name="hrsmobile" />
|
||||||
|
<extension name="coverage">
|
||||||
|
<pattern>
|
||||||
|
<option name="PATTERN" value="com.saye.hrs.service.impl.*" />
|
||||||
|
<option name="ENABLED" value="true" />
|
||||||
|
</pattern>
|
||||||
|
</extension>
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<configuration name="WSUtil" type="Application" factoryName="Application" temporary="true" nameIsGenerated="true">
|
||||||
|
<option name="MAIN_CLASS_NAME" value="com.saye.hrs.commons.webservice.WSUtil" />
|
||||||
|
<module name="hrsmobile" />
|
||||||
|
<extension name="coverage">
|
||||||
|
<pattern>
|
||||||
|
<option name="PATTERN" value="com.saye.hrs.commons.webservice.*" />
|
||||||
|
<option name="ENABLED" value="true" />
|
||||||
|
</pattern>
|
||||||
|
</extension>
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<configuration name="TestDemo.test" type="JUnit" factoryName="JUnit" temporary="true" nameIsGenerated="true">
|
||||||
|
<module name="hrsmobile" />
|
||||||
|
<extension name="coverage">
|
||||||
|
<pattern>
|
||||||
|
<option name="PATTERN" value="com.saye.hrs.*" />
|
||||||
|
<option name="ENABLED" value="true" />
|
||||||
|
</pattern>
|
||||||
|
</extension>
|
||||||
|
<option name="PACKAGE_NAME" value="com.saye.hrs" />
|
||||||
|
<option name="MAIN_CLASS_NAME" value="com.saye.hrs.TestDemo" />
|
||||||
|
<option name="METHOD_NAME" value="test" />
|
||||||
|
<option name="TEST_OBJECT" value="method" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<configuration name="HrsApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||||
|
<module name="hrsmobile" />
|
||||||
|
<option name="SPRING_BOOT_MAIN_CLASS" value="com.saye.hrs.HrsApplication" />
|
||||||
|
<method v="2">
|
||||||
|
<option name="Make" enabled="true" />
|
||||||
|
</method>
|
||||||
|
</configuration>
|
||||||
|
<recent_temporary>
|
||||||
|
<list>
|
||||||
|
<item itemvalue="应用程序.WSUtil" />
|
||||||
|
<item itemvalue="JUnit.TestDemo.test" />
|
||||||
|
</list>
|
||||||
|
</recent_temporary>
|
||||||
|
</component>
|
||||||
|
<component name="SharedIndexes">
|
||||||
|
<attachedChunks>
|
||||||
|
<set>
|
||||||
|
<option value="bundled-jdk-9f38398b9061-39b83d9b5494-intellij.indexing.shared.core-IU-241.15989.150" />
|
||||||
|
<option value="bundled-js-predefined-1d06a55b98c1-91d5c284f522-JavaScript-IU-241.15989.150" />
|
||||||
|
</set>
|
||||||
|
</attachedChunks>
|
||||||
|
</component>
|
||||||
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||||
|
<component name="TaskManager">
|
||||||
|
<task active="true" id="Default" summary="Default task">
|
||||||
|
<changelist id="59d56e57-d222-4895-b637-e4e237285f62" name="Changes" comment="" />
|
||||||
|
<created>1716180153444</created>
|
||||||
|
<option name="number" value="Default" />
|
||||||
|
<option name="presentableId" value="Default" />
|
||||||
|
<updated>1716180153444</updated>
|
||||||
|
<workItem from="1717077008339" duration="3375000" />
|
||||||
|
<workItem from="1717124543289" duration="42474000" />
|
||||||
|
<workItem from="1717667681153" duration="8624000" />
|
||||||
|
<workItem from="1718332449635" duration="1286000" />
|
||||||
|
<workItem from="1719288249187" duration="4123000" />
|
||||||
|
<workItem from="1720086447768" duration="4803000" />
|
||||||
|
<workItem from="1721197316968" duration="1115000" />
|
||||||
|
<workItem from="1723095242000" duration="67000" />
|
||||||
|
<workItem from="1723096903535" duration="657000" />
|
||||||
|
<workItem from="1724121668570" duration="1640000" />
|
||||||
|
<workItem from="1724228757628" duration="5061000" />
|
||||||
|
<workItem from="1725430224497" duration="2111000" />
|
||||||
|
<workItem from="1725933766288" duration="4787000" />
|
||||||
|
<workItem from="1725950322966" duration="32000" />
|
||||||
|
<workItem from="1726025818053" duration="8086000" />
|
||||||
|
<workItem from="1726123402081" duration="2598000" />
|
||||||
|
<workItem from="1726651168678" duration="8962000" />
|
||||||
|
<workItem from="1727255557333" duration="12495000" />
|
||||||
|
<workItem from="1728716248209" duration="640000" />
|
||||||
|
<workItem from="1728961915303" duration="77702000" />
|
||||||
|
<workItem from="1729590136903" duration="13445000" />
|
||||||
|
<workItem from="1729676697710" duration="13827000" />
|
||||||
|
<workItem from="1730076548765" duration="15244000" />
|
||||||
|
<workItem from="1730340534275" duration="5000" />
|
||||||
|
<workItem from="1730340556622" duration="3572000" />
|
||||||
|
<workItem from="1730352366449" duration="19465000" />
|
||||||
|
<workItem from="1730681083858" duration="2855000" />
|
||||||
|
<workItem from="1730700166200" duration="248000" />
|
||||||
|
<workItem from="1730705684243" duration="2715000" />
|
||||||
|
<workItem from="1730709779648" duration="14575000" />
|
||||||
|
<workItem from="1731314248402" duration="8574000" />
|
||||||
|
<workItem from="1731562714844" duration="4204000" />
|
||||||
|
<workItem from="1731993124889" duration="160785000" />
|
||||||
|
<workItem from="1733360488657" duration="44142000" />
|
||||||
|
<workItem from="1733965988448" duration="16997000" />
|
||||||
|
<workItem from="1734076883208" duration="1448000" />
|
||||||
|
<workItem from="1734311004776" duration="28209000" />
|
||||||
|
<workItem from="1734941551716" duration="10417000" />
|
||||||
|
<workItem from="1735094934096" duration="29000" />
|
||||||
|
<workItem from="1735095236819" duration="4206000" />
|
||||||
|
<workItem from="1738732696274" duration="16828000" />
|
||||||
|
<workItem from="1739415699227" duration="103000" />
|
||||||
|
<workItem from="1739415832156" duration="12723000" />
|
||||||
|
<workItem from="1739779953686" duration="25186000" />
|
||||||
|
<workItem from="1739952493154" duration="3854000" />
|
||||||
|
<workItem from="1740106648299" duration="3281000" />
|
||||||
|
<workItem from="1740125030929" duration="4083000" />
|
||||||
|
<workItem from="1740472341429" duration="61000" />
|
||||||
|
<workItem from="1741051975262" duration="689000" />
|
||||||
|
<workItem from="1741136458964" duration="8630000" />
|
||||||
|
<workItem from="1741653779407" duration="33000" />
|
||||||
|
<workItem from="1741827072478" duration="12646000" />
|
||||||
|
<workItem from="1741932634954" duration="162000" />
|
||||||
|
<workItem from="1742191386481" duration="6924000" />
|
||||||
|
<workItem from="1742266656591" duration="14966000" />
|
||||||
|
<workItem from="1742438264154" duration="5204000" />
|
||||||
|
<workItem from="1742538758525" duration="26000" />
|
||||||
|
<workItem from="1742870452374" duration="9721000" />
|
||||||
|
<workItem from="1744183535620" duration="5788000" />
|
||||||
|
<workItem from="1744247404499" duration="12683000" />
|
||||||
|
<workItem from="1745307252354" duration="3560000" />
|
||||||
|
<workItem from="1745367704315" duration="3632000" />
|
||||||
|
<workItem from="1745808517662" duration="3953000" />
|
||||||
|
<workItem from="1745813338731" duration="641000" />
|
||||||
|
<workItem from="1746687925932" duration="1052000" />
|
||||||
|
<workItem from="1746792128973" duration="156000" />
|
||||||
|
<workItem from="1748602495612" duration="1561000" />
|
||||||
|
<workItem from="1748607649254" duration="1632000" />
|
||||||
|
<workItem from="1748935499157" duration="31000" />
|
||||||
|
<workItem from="1750054520609" duration="4677000" />
|
||||||
|
<workItem from="1750152950606" duration="1355000" />
|
||||||
|
<workItem from="1750315378622" duration="7078000" />
|
||||||
|
<workItem from="1750389095932" duration="95000" />
|
||||||
|
<workItem from="1750655379615" duration="1389000" />
|
||||||
|
<workItem from="1750664844650" duration="25000" />
|
||||||
|
<workItem from="1750671423633" duration="155000" />
|
||||||
|
<workItem from="1750729064749" duration="1255000" />
|
||||||
|
<workItem from="1750756791798" duration="724000" />
|
||||||
|
<workItem from="1750838176095" duration="14000" />
|
||||||
|
<workItem from="1752555838393" duration="1688000" />
|
||||||
|
<workItem from="1752572747797" duration="460000" />
|
||||||
|
<workItem from="1753253172292" duration="20000" />
|
||||||
|
<workItem from="1753253251937" duration="207000" />
|
||||||
|
<workItem from="1753253568208" duration="1600000" />
|
||||||
|
<workItem from="1755480221650" duration="1724000" />
|
||||||
|
<workItem from="1755485528204" duration="5376000" />
|
||||||
|
<workItem from="1755570259149" duration="2062000" />
|
||||||
|
<workItem from="1755588219942" duration="1232000" />
|
||||||
|
<workItem from="1755655145714" duration="118000" />
|
||||||
|
<workItem from="1755671376662" duration="4254000" />
|
||||||
|
<workItem from="1755680006691" duration="4334000" />
|
||||||
|
<workItem from="1757479837300" duration="2682000" />
|
||||||
|
<workItem from="1757644454201" duration="660000" />
|
||||||
|
<workItem from="1758008913348" duration="113000" />
|
||||||
|
<workItem from="1758009039039" duration="297000" />
|
||||||
|
<workItem from="1760063155700" duration="1804000" />
|
||||||
|
<workItem from="1760159760338" duration="1479000" />
|
||||||
|
<workItem from="1760323900068" duration="5624000" />
|
||||||
|
<workItem from="1760411417123" duration="1746000" />
|
||||||
|
<workItem from="1760419379938" duration="5812000" />
|
||||||
|
<workItem from="1760508563445" duration="4380000" />
|
||||||
|
<workItem from="1760681632031" duration="29000" />
|
||||||
|
<workItem from="1760681674017" duration="3339000" />
|
||||||
|
<workItem from="1760691233947" duration="11162000" />
|
||||||
|
<workItem from="1761234315186" duration="2549000" />
|
||||||
|
<workItem from="1761534421673" duration="9000" />
|
||||||
|
<workItem from="1761536541982" duration="20000" />
|
||||||
|
<workItem from="1761721194610" duration="95000" />
|
||||||
|
<workItem from="1761794285198" duration="691000" />
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00001" summary="更新生产库代码">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1717078525098</created>
|
||||||
|
<option name="number" value="00001" />
|
||||||
|
<option name="presentableId" value="LOCAL-00001" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1717078525099</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00002" summary="修改请求地址">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1717125417455</created>
|
||||||
|
<option name="number" value="00002" />
|
||||||
|
<option name="presentableId" value="LOCAL-00002" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1717125417455</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00003" summary="调试挂号接口入参">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1717139210024</created>
|
||||||
|
<option name="number" value="00003" />
|
||||||
|
<option name="presentableId" value="LOCAL-00003" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1717139210024</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00004" summary="修复缴费成功通知">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1717395203827</created>
|
||||||
|
<option name="number" value="00004" />
|
||||||
|
<option name="presentableId" value="LOCAL-00004" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1717395203827</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00005" summary="修改缴费成功后推送消息的逻辑">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1717411676149</created>
|
||||||
|
<option name="number" value="00005" />
|
||||||
|
<option name="presentableId" value="LOCAL-00005" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1717411676149</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00006" summary="修改缴费成功后推送消息的逻辑">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1717412538865</created>
|
||||||
|
<option name="number" value="00006" />
|
||||||
|
<option name="presentableId" value="LOCAL-00006" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1717412538865</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00007" summary="修改缴费成功后推送消息的逻辑">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1717472765993</created>
|
||||||
|
<option name="number" value="00007" />
|
||||||
|
<option name="presentableId" value="LOCAL-00007" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1717472765993</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00008" summary="新增院内统计接口">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1729676742601</created>
|
||||||
|
<option name="number" value="00008" />
|
||||||
|
<option name="presentableId" value="LOCAL-00008" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1729676742602</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00009" summary="新增院内统计接口,修改his视图接口,预约接口">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1731654528104</created>
|
||||||
|
<option name="number" value="00009" />
|
||||||
|
<option name="presentableId" value="LOCAL-00009" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1731654528104</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00010" summary="新增院内统计接口,修改his视图接口,预约接口">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1732176385607</created>
|
||||||
|
<option name="number" value="00010" />
|
||||||
|
<option name="presentableId" value="LOCAL-00010" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1732176385607</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00011" summary="修改统计">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1741932689866</created>
|
||||||
|
<option name="number" value="00011" />
|
||||||
|
<option name="presentableId" value="LOCAL-00011" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1741932689866</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="12" />
|
||||||
|
<servers />
|
||||||
|
</component>
|
||||||
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
|
<option name="version" value="3" />
|
||||||
|
</component>
|
||||||
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
|
<option name="TAB_STATES">
|
||||||
|
<map>
|
||||||
|
<entry key="MAIN">
|
||||||
|
<value>
|
||||||
|
<State />
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="VcsManagerConfiguration">
|
||||||
|
<MESSAGE value="更新生产库代码" />
|
||||||
|
<MESSAGE value="修改请求地址" />
|
||||||
|
<MESSAGE value="调试挂号接口入参" />
|
||||||
|
<MESSAGE value="修复缴费成功通知" />
|
||||||
|
<MESSAGE value="修改缴费成功后推送消息的逻辑" />
|
||||||
|
<MESSAGE value="新增院内统计接口" />
|
||||||
|
<MESSAGE value="新增院内统计接口,修改his视图接口,预约接口" />
|
||||||
|
<MESSAGE value="修改统计" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="修改统计" />
|
||||||
|
</component>
|
||||||
|
<component name="XDebuggerManager">
|
||||||
|
<watches-manager>
|
||||||
|
<configuration name="SpringBootApplicationConfigurationType">
|
||||||
|
<watch expression="items" />
|
||||||
|
</configuration>
|
||||||
|
</watches-manager>
|
||||||
|
</component>
|
||||||
|
<component name="XSLT-Support.FileAssociations.UIState">
|
||||||
|
<expand />
|
||||||
|
<select />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
24
HELP.md
Normal file
24
HELP.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Getting Started
|
||||||
|
|
||||||
|
### Reference Documentation
|
||||||
|
|
||||||
|
For further reference, please consider the following sections:
|
||||||
|
|
||||||
|
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
|
||||||
|
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.5.4/maven-plugin/reference/html/)
|
||||||
|
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.5.4/maven-plugin/reference/html/#build-image)
|
||||||
|
* [Spring Web](https://docs.spring.io/spring-boot/docs/2.5.4/reference/htmlsingle/#boot-features-developing-web-applications)
|
||||||
|
* [MyBatis Framework](https://mybatis.org/spring-boot-starter/mybatis-spring-boot-autoconfigure/)
|
||||||
|
* [Thymeleaf](https://docs.spring.io/spring-boot/docs/2.5.4/reference/htmlsingle/#boot-features-spring-mvc-template-engines)
|
||||||
|
|
||||||
|
### Guides
|
||||||
|
|
||||||
|
The following guides illustrate how to use some features concretely:
|
||||||
|
|
||||||
|
* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
|
||||||
|
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
|
||||||
|
* [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/)
|
||||||
|
* [MyBatis Quick Start](https://github.com/mybatis/spring-boot-starter/wiki/Quick-Start)
|
||||||
|
* [Accessing data with MySQL](https://spring.io/guides/gs/accessing-data-mysql/)
|
||||||
|
* [Handling Form Submission](https://spring.io/guides/gs/handling-form-submission/)
|
||||||
|
|
||||||
92
README.md
Normal file
92
README.md
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
# hrsmobile-dev
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
|
||||||
|
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
|
||||||
|
|
||||||
|
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
|
||||||
|
|
||||||
|
## Add your files
|
||||||
|
|
||||||
|
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
|
||||||
|
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
|
||||||
|
|
||||||
|
```
|
||||||
|
cd existing_repo
|
||||||
|
git remote add origin http://192.168.10.240/kelfy/hrsmobile-dev.git
|
||||||
|
git branch -M main
|
||||||
|
git push -uf origin main
|
||||||
|
```
|
||||||
|
|
||||||
|
## Integrate with your tools
|
||||||
|
|
||||||
|
- [ ] [Set up project integrations](http://192.168.10.240/kelfy/hrsmobile-dev/-/settings/integrations)
|
||||||
|
|
||||||
|
## Collaborate with your team
|
||||||
|
|
||||||
|
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
|
||||||
|
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
|
||||||
|
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
|
||||||
|
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
|
||||||
|
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
|
||||||
|
|
||||||
|
## Test and Deploy
|
||||||
|
|
||||||
|
Use the built-in continuous integration in GitLab.
|
||||||
|
|
||||||
|
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
|
||||||
|
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
|
||||||
|
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
|
||||||
|
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
|
||||||
|
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
|
||||||
|
|
||||||
|
***
|
||||||
|
|
||||||
|
# Editing this README
|
||||||
|
|
||||||
|
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
|
||||||
|
|
||||||
|
## Suggestions for a good README
|
||||||
|
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
|
||||||
|
|
||||||
|
## Name
|
||||||
|
Choose a self-explaining name for your project.
|
||||||
|
|
||||||
|
## Description
|
||||||
|
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
|
||||||
|
|
||||||
|
## Badges
|
||||||
|
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
|
||||||
|
|
||||||
|
## Visuals
|
||||||
|
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
|
||||||
|
|
||||||
|
## Support
|
||||||
|
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
|
||||||
|
|
||||||
|
## Roadmap
|
||||||
|
If you have ideas for releases in the future, it is a good idea to list them in the README.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
State if you are open to contributions and what your requirements are for accepting them.
|
||||||
|
|
||||||
|
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
|
||||||
|
|
||||||
|
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
|
||||||
|
|
||||||
|
## Authors and acknowledgment
|
||||||
|
Show your appreciation to those who have contributed to the project.
|
||||||
|
|
||||||
|
## License
|
||||||
|
For open source projects, say how it is licensed.
|
||||||
|
|
||||||
|
## Project status
|
||||||
|
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
|
||||||
BIN
hrsmobile.zip
Normal file
BIN
hrsmobile.zip
Normal file
Binary file not shown.
310
mvnw
vendored
Normal file
310
mvnw
vendored
Normal file
@@ -0,0 +1,310 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
# or more contributor license agreements. See the NOTICE file
|
||||||
|
# distributed with this work for additional information
|
||||||
|
# regarding copyright ownership. The ASF licenses this file
|
||||||
|
# to you under the Apache License, Version 2.0 (the
|
||||||
|
# "License"); you may not use this file except in compliance
|
||||||
|
# with the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing,
|
||||||
|
# software distributed under the License is distributed on an
|
||||||
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
# KIND, either express or implied. See the License for the
|
||||||
|
# specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
# Maven Start Up Batch script
|
||||||
|
#
|
||||||
|
# Required ENV vars:
|
||||||
|
# ------------------
|
||||||
|
# JAVA_HOME - location of a JDK home dir
|
||||||
|
#
|
||||||
|
# Optional ENV vars
|
||||||
|
# -----------------
|
||||||
|
# M2_HOME - location of maven2's installed home dir
|
||||||
|
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||||
|
# e.g. to debug Maven itself, use
|
||||||
|
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||||
|
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
if [ -z "$MAVEN_SKIP_RC" ] ; then
|
||||||
|
|
||||||
|
if [ -f /etc/mavenrc ] ; then
|
||||||
|
. /etc/mavenrc
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$HOME/.mavenrc" ] ; then
|
||||||
|
. "$HOME/.mavenrc"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
# OS specific support. $var _must_ be set to either true or false.
|
||||||
|
cygwin=false;
|
||||||
|
darwin=false;
|
||||||
|
mingw=false
|
||||||
|
case "`uname`" in
|
||||||
|
CYGWIN*) cygwin=true ;;
|
||||||
|
MINGW*) mingw=true;;
|
||||||
|
Darwin*) darwin=true
|
||||||
|
# Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
|
||||||
|
# See https://developer.apple.com/library/mac/qa/qa1170/_index.html
|
||||||
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
|
if [ -x "/usr/libexec/java_home" ]; then
|
||||||
|
export JAVA_HOME="`/usr/libexec/java_home`"
|
||||||
|
else
|
||||||
|
export JAVA_HOME="/Library/Java/Home"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ] ; then
|
||||||
|
if [ -r /etc/gentoo-release ] ; then
|
||||||
|
JAVA_HOME=`java-config --jre-home`
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$M2_HOME" ] ; then
|
||||||
|
## resolve links - $0 may be a link to maven's home
|
||||||
|
PRG="$0"
|
||||||
|
|
||||||
|
# need this for relative symlinks
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG="`dirname "$PRG"`/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
saveddir=`pwd`
|
||||||
|
|
||||||
|
M2_HOME=`dirname "$PRG"`/..
|
||||||
|
|
||||||
|
# make it fully qualified
|
||||||
|
M2_HOME=`cd "$M2_HOME" && pwd`
|
||||||
|
|
||||||
|
cd "$saveddir"
|
||||||
|
# echo Using m2 at $M2_HOME
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||||
|
if $cygwin ; then
|
||||||
|
[ -n "$M2_HOME" ] &&
|
||||||
|
M2_HOME=`cygpath --unix "$M2_HOME"`
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||||
|
[ -n "$CLASSPATH" ] &&
|
||||||
|
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Mingw, ensure paths are in UNIX format before anything is touched
|
||||||
|
if $mingw ; then
|
||||||
|
[ -n "$M2_HOME" ] &&
|
||||||
|
M2_HOME="`(cd "$M2_HOME"; pwd)`"
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ]; then
|
||||||
|
javaExecutable="`which javac`"
|
||||||
|
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
|
||||||
|
# readlink(1) is not available as standard on Solaris 10.
|
||||||
|
readLink=`which readlink`
|
||||||
|
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
|
||||||
|
if $darwin ; then
|
||||||
|
javaHome="`dirname \"$javaExecutable\"`"
|
||||||
|
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
|
||||||
|
else
|
||||||
|
javaExecutable="`readlink -f \"$javaExecutable\"`"
|
||||||
|
fi
|
||||||
|
javaHome="`dirname \"$javaExecutable\"`"
|
||||||
|
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
|
||||||
|
JAVA_HOME="$javaHome"
|
||||||
|
export JAVA_HOME
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVACMD" ] ; then
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD="`which java`"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
echo "Error: JAVA_HOME is not defined correctly." >&2
|
||||||
|
echo " We cannot execute $JAVACMD" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$JAVA_HOME" ] ; then
|
||||||
|
echo "Warning: JAVA_HOME environment variable is not set."
|
||||||
|
fi
|
||||||
|
|
||||||
|
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
|
||||||
|
|
||||||
|
# traverses directory structure from process work directory to filesystem root
|
||||||
|
# first directory with .mvn subdirectory is considered project base directory
|
||||||
|
find_maven_basedir() {
|
||||||
|
|
||||||
|
if [ -z "$1" ]
|
||||||
|
then
|
||||||
|
echo "Path not specified to find_maven_basedir"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
basedir="$1"
|
||||||
|
wdir="$1"
|
||||||
|
while [ "$wdir" != '/' ] ; do
|
||||||
|
if [ -d "$wdir"/.mvn ] ; then
|
||||||
|
basedir=$wdir
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
# workaround for JBEAP-8937 (on Solaris 10/Sparc)
|
||||||
|
if [ -d "${wdir}" ]; then
|
||||||
|
wdir=`cd "$wdir/.."; pwd`
|
||||||
|
fi
|
||||||
|
# end of workaround
|
||||||
|
done
|
||||||
|
echo "${basedir}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# concatenates all lines of a file
|
||||||
|
concat_lines() {
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
echo "$(tr -s '\n' ' ' < "$1")"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
BASE_DIR=`find_maven_basedir "$(pwd)"`
|
||||||
|
if [ -z "$BASE_DIR" ]; then
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||||
|
# This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||||
|
##########################################################################################
|
||||||
|
if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Found .mvn/wrapper/maven-wrapper.jar"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
|
||||||
|
fi
|
||||||
|
if [ -n "$MVNW_REPOURL" ]; then
|
||||||
|
jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
||||||
|
else
|
||||||
|
jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
||||||
|
fi
|
||||||
|
while IFS="=" read key value; do
|
||||||
|
case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
|
||||||
|
esac
|
||||||
|
done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Downloading from: $jarUrl"
|
||||||
|
fi
|
||||||
|
wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
|
||||||
|
if $cygwin; then
|
||||||
|
wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v wget > /dev/null; then
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Found wget ... using wget"
|
||||||
|
fi
|
||||||
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||||
|
wget "$jarUrl" -O "$wrapperJarPath"
|
||||||
|
else
|
||||||
|
wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
|
||||||
|
fi
|
||||||
|
elif command -v curl > /dev/null; then
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Found curl ... using curl"
|
||||||
|
fi
|
||||||
|
if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
|
||||||
|
curl -o "$wrapperJarPath" "$jarUrl" -f
|
||||||
|
else
|
||||||
|
curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo "Falling back to using Java to download"
|
||||||
|
fi
|
||||||
|
javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
|
||||||
|
# For Cygwin, switch paths to Windows format before running javac
|
||||||
|
if $cygwin; then
|
||||||
|
javaClass=`cygpath --path --windows "$javaClass"`
|
||||||
|
fi
|
||||||
|
if [ -e "$javaClass" ]; then
|
||||||
|
if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo " - Compiling MavenWrapperDownloader.java ..."
|
||||||
|
fi
|
||||||
|
# Compiling the Java class
|
||||||
|
("$JAVA_HOME/bin/javac" "$javaClass")
|
||||||
|
fi
|
||||||
|
if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
|
||||||
|
# Running the downloader
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo " - Running MavenWrapperDownloader.java ..."
|
||||||
|
fi
|
||||||
|
("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
##########################################################################################
|
||||||
|
# End of extension
|
||||||
|
##########################################################################################
|
||||||
|
|
||||||
|
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
|
||||||
|
if [ "$MVNW_VERBOSE" = true ]; then
|
||||||
|
echo $MAVEN_PROJECTBASEDIR
|
||||||
|
fi
|
||||||
|
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin; then
|
||||||
|
[ -n "$M2_HOME" ] &&
|
||||||
|
M2_HOME=`cygpath --path --windows "$M2_HOME"`
|
||||||
|
[ -n "$JAVA_HOME" ] &&
|
||||||
|
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
|
||||||
|
[ -n "$CLASSPATH" ] &&
|
||||||
|
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
|
||||||
|
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
|
||||||
|
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Provide a "standardized" way to retrieve the CLI args that will
|
||||||
|
# work with both Windows and non-Windows executions.
|
||||||
|
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
|
||||||
|
export MAVEN_CMD_LINE_ARGS
|
||||||
|
|
||||||
|
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||||
|
|
||||||
|
exec "$JAVACMD" \
|
||||||
|
$MAVEN_OPTS \
|
||||||
|
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
|
||||||
|
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
|
||||||
|
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
|
||||||
182
mvnw.cmd
vendored
Normal file
182
mvnw.cmd
vendored
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
@REM Licensed to the Apache Software Foundation (ASF) under one
|
||||||
|
@REM or more contributor license agreements. See the NOTICE file
|
||||||
|
@REM distributed with this work for additional information
|
||||||
|
@REM regarding copyright ownership. The ASF licenses this file
|
||||||
|
@REM to you under the Apache License, Version 2.0 (the
|
||||||
|
@REM "License"); you may not use this file except in compliance
|
||||||
|
@REM with the License. You may obtain a copy of the License at
|
||||||
|
@REM
|
||||||
|
@REM https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
@REM
|
||||||
|
@REM Unless required by applicable law or agreed to in writing,
|
||||||
|
@REM software distributed under the License is distributed on an
|
||||||
|
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
@REM KIND, either express or implied. See the License for the
|
||||||
|
@REM specific language governing permissions and limitations
|
||||||
|
@REM under the License.
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
@REM Maven Start Up Batch script
|
||||||
|
@REM
|
||||||
|
@REM Required ENV vars:
|
||||||
|
@REM JAVA_HOME - location of a JDK home dir
|
||||||
|
@REM
|
||||||
|
@REM Optional ENV vars
|
||||||
|
@REM M2_HOME - location of maven2's installed home dir
|
||||||
|
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
|
||||||
|
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
|
||||||
|
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
|
||||||
|
@REM e.g. to debug Maven itself, use
|
||||||
|
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
|
||||||
|
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
|
||||||
|
@REM ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
|
||||||
|
@echo off
|
||||||
|
@REM set title of command window
|
||||||
|
title %0
|
||||||
|
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
|
||||||
|
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
|
||||||
|
|
||||||
|
@REM set %HOME% to equivalent of $HOME
|
||||||
|
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
|
||||||
|
|
||||||
|
@REM Execute a user defined script before this one
|
||||||
|
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
|
||||||
|
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
|
||||||
|
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
|
||||||
|
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
|
||||||
|
:skipRcPre
|
||||||
|
|
||||||
|
@setlocal
|
||||||
|
|
||||||
|
set ERROR_CODE=0
|
||||||
|
|
||||||
|
@REM To isolate internal variables from possible post scripts, we use another setlocal
|
||||||
|
@setlocal
|
||||||
|
|
||||||
|
@REM ==== START VALIDATION ====
|
||||||
|
if not "%JAVA_HOME%" == "" goto OkJHome
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Error: JAVA_HOME not found in your environment. >&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||||
|
echo location of your Java installation. >&2
|
||||||
|
echo.
|
||||||
|
goto error
|
||||||
|
|
||||||
|
:OkJHome
|
||||||
|
if exist "%JAVA_HOME%\bin\java.exe" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo Error: JAVA_HOME is set to an invalid directory. >&2
|
||||||
|
echo JAVA_HOME = "%JAVA_HOME%" >&2
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the >&2
|
||||||
|
echo location of your Java installation. >&2
|
||||||
|
echo.
|
||||||
|
goto error
|
||||||
|
|
||||||
|
@REM ==== END VALIDATION ====
|
||||||
|
|
||||||
|
:init
|
||||||
|
|
||||||
|
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
|
||||||
|
@REM Fallback to current working directory if not found.
|
||||||
|
|
||||||
|
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
|
||||||
|
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
|
||||||
|
|
||||||
|
set EXEC_DIR=%CD%
|
||||||
|
set WDIR=%EXEC_DIR%
|
||||||
|
:findBaseDir
|
||||||
|
IF EXIST "%WDIR%"\.mvn goto baseDirFound
|
||||||
|
cd ..
|
||||||
|
IF "%WDIR%"=="%CD%" goto baseDirNotFound
|
||||||
|
set WDIR=%CD%
|
||||||
|
goto findBaseDir
|
||||||
|
|
||||||
|
:baseDirFound
|
||||||
|
set MAVEN_PROJECTBASEDIR=%WDIR%
|
||||||
|
cd "%EXEC_DIR%"
|
||||||
|
goto endDetectBaseDir
|
||||||
|
|
||||||
|
:baseDirNotFound
|
||||||
|
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
|
||||||
|
cd "%EXEC_DIR%"
|
||||||
|
|
||||||
|
:endDetectBaseDir
|
||||||
|
|
||||||
|
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
|
||||||
|
|
||||||
|
@setlocal EnableExtensions EnableDelayedExpansion
|
||||||
|
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
|
||||||
|
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
|
||||||
|
|
||||||
|
:endReadAdditionalConfig
|
||||||
|
|
||||||
|
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
|
||||||
|
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
|
||||||
|
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
|
||||||
|
|
||||||
|
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
||||||
|
|
||||||
|
FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
|
||||||
|
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
|
||||||
|
)
|
||||||
|
|
||||||
|
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
|
||||||
|
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
|
||||||
|
if exist %WRAPPER_JAR% (
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Found %WRAPPER_JAR%
|
||||||
|
)
|
||||||
|
) else (
|
||||||
|
if not "%MVNW_REPOURL%" == "" (
|
||||||
|
SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
|
||||||
|
)
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Couldn't find %WRAPPER_JAR%, downloading it ...
|
||||||
|
echo Downloading from: %DOWNLOAD_URL%
|
||||||
|
)
|
||||||
|
|
||||||
|
powershell -Command "&{"^
|
||||||
|
"$webclient = new-object System.Net.WebClient;"^
|
||||||
|
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
|
||||||
|
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
|
||||||
|
"}"^
|
||||||
|
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
|
||||||
|
"}"
|
||||||
|
if "%MVNW_VERBOSE%" == "true" (
|
||||||
|
echo Finished downloading %WRAPPER_JAR%
|
||||||
|
)
|
||||||
|
)
|
||||||
|
@REM End of extension
|
||||||
|
|
||||||
|
@REM Provide a "standardized" way to retrieve the CLI args that will
|
||||||
|
@REM work with both Windows and non-Windows executions.
|
||||||
|
set MAVEN_CMD_LINE_ARGS=%*
|
||||||
|
|
||||||
|
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
|
||||||
|
if ERRORLEVEL 1 goto error
|
||||||
|
goto end
|
||||||
|
|
||||||
|
:error
|
||||||
|
set ERROR_CODE=1
|
||||||
|
|
||||||
|
:end
|
||||||
|
@endlocal & set ERROR_CODE=%ERROR_CODE%
|
||||||
|
|
||||||
|
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
|
||||||
|
@REM check for post script, once with legacy .bat ending and once with .cmd ending
|
||||||
|
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
|
||||||
|
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
|
||||||
|
:skipRcPost
|
||||||
|
|
||||||
|
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
|
||||||
|
if "%MAVEN_BATCH_PAUSE%" == "on" pause
|
||||||
|
|
||||||
|
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
|
||||||
|
|
||||||
|
exit /B %ERROR_CODE%
|
||||||
174
pom.xml
Normal file
174
pom.xml
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>2.5.4</version>
|
||||||
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
|
</parent>
|
||||||
|
<groupId>com.saye</groupId>
|
||||||
|
<artifactId>hrsmobile</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<packaging>war</packaging>
|
||||||
|
<name>hrsmobile</name>
|
||||||
|
<description>hrsmobile</description>
|
||||||
|
<properties>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>log4j-to-slf4j</artifactId>
|
||||||
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.aspectj</groupId>
|
||||||
|
<artifactId>aspectjweaver</artifactId>
|
||||||
|
<version>1.9.6</version> <!-- 使用最新的稳定版本 -->
|
||||||
|
</dependency>
|
||||||
|
<!--web模板引擎-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!--标签补全-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.sourceforge.nekohtml</groupId>
|
||||||
|
<artifactId>nekohtml</artifactId>
|
||||||
|
<version>1.9.21</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>fastjson</artifactId>
|
||||||
|
<version>1.2.73</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- excel -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi</artifactId>
|
||||||
|
<version>3.14</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.poi</groupId>
|
||||||
|
<artifactId>poi-ooxml</artifactId>
|
||||||
|
<version>3.14</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- 防xss -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jsoup</groupId>
|
||||||
|
<artifactId>jsoup</artifactId>
|
||||||
|
<version>1.13.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>dom4j</groupId>
|
||||||
|
<artifactId>dom4j</artifactId>
|
||||||
|
<version>1.6.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jaxen</groupId>
|
||||||
|
<artifactId>jaxen</artifactId>
|
||||||
|
<version>1.1.6</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>xml-apis</groupId>
|
||||||
|
<artifactId>xml-apis</artifactId>
|
||||||
|
<version>1.4.01</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!--定时任务-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-quartz</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.wxpay</groupId>
|
||||||
|
<artifactId>wxpay-sdk</artifactId>
|
||||||
|
<version>0.0.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--hutool-->
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
<version>5.8.20</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.guava</groupId>
|
||||||
|
<artifactId>guava</artifactId>
|
||||||
|
<version>32.1.2-jre</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<!-- <fork>true</fork> -->
|
||||||
|
<excludes>
|
||||||
|
<exclude>
|
||||||
|
<groupId>org.project-lombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</exclude>
|
||||||
|
</excludes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.mybatis.generator</groupId>
|
||||||
|
<artifactId>mybatis-generator-maven-plugin</artifactId>
|
||||||
|
<version>1.3.5</version>
|
||||||
|
<configuration>
|
||||||
|
<!--配置文件的位置-->
|
||||||
|
<configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
|
||||||
|
<overwrite>true</overwrite>
|
||||||
|
<verbose>true</verbose>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
17
src/main/java/com/saye/hrs/HrsApplication.java
Normal file
17
src/main/java/com/saye/hrs/HrsApplication.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package com.saye.hrs;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.annotation.EnableAspectJAutoProxy;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
@EnableAspectJAutoProxy(proxyTargetClass=true)
|
||||||
|
@SpringBootApplication
|
||||||
|
@EnableScheduling
|
||||||
|
public class HrsApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(HrsApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
13
src/main/java/com/saye/hrs/ServletInitializer.java
Normal file
13
src/main/java/com/saye/hrs/ServletInitializer.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package com.saye.hrs;
|
||||||
|
|
||||||
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
|
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||||
|
|
||||||
|
public class ServletInitializer extends SpringBootServletInitializer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||||
|
return application.sources(HrsApplication.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
23
src/main/java/com/saye/hrs/WebLog.java
Normal file
23
src/main/java/com/saye/hrs/WebLog.java
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package com.saye.hrs;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author T.W
|
||||||
|
* @site xxx
|
||||||
|
* @date 2021/9/8
|
||||||
|
* @time 下午9:19
|
||||||
|
* @discription
|
||||||
|
**/
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target({ElementType.METHOD})
|
||||||
|
@Documented
|
||||||
|
public @interface WebLog {
|
||||||
|
/**
|
||||||
|
* 日志描述信息
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String description() default "";
|
||||||
|
|
||||||
|
}
|
||||||
127
src/main/java/com/saye/hrs/WebLogAspect.java
Normal file
127
src/main/java/com/saye/hrs/WebLogAspect.java
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
package com.saye.hrs;
|
||||||
|
|
||||||
|
//import com.google.gson.Gson;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import org.aspectj.lang.JoinPoint;
|
||||||
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
|
import org.aspectj.lang.annotation.*;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author T.W
|
||||||
|
* @site xxx
|
||||||
|
* @date 2021/9/8
|
||||||
|
* @time 下午9:19
|
||||||
|
* @discription
|
||||||
|
**/
|
||||||
|
@Aspect
|
||||||
|
@Component
|
||||||
|
//@Profile({"dev", "test"})
|
||||||
|
public class WebLogAspect {
|
||||||
|
|
||||||
|
private final static Logger logger = LoggerFactory.getLogger(WebLogAspect.class);
|
||||||
|
/** 换行符 */
|
||||||
|
private static final String LINE_SEPARATOR = System.lineSeparator();
|
||||||
|
|
||||||
|
/** 以自定义 @WebLog 注解为切点 */
|
||||||
|
@Pointcut("@annotation(com.saye.hrs.WebLog)")
|
||||||
|
public void webLog() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在切点之前织入
|
||||||
|
* @param joinPoint
|
||||||
|
* @throws Throwable
|
||||||
|
*/
|
||||||
|
@Before("webLog()")
|
||||||
|
public void doBefore(JoinPoint joinPoint) throws Throwable {
|
||||||
|
// 开始打印请求日志
|
||||||
|
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||||
|
HttpServletRequest request = attributes.getRequest();
|
||||||
|
|
||||||
|
// 获取 @WebLog 注解的描述信息
|
||||||
|
String methodDescription = getAspectLogDescription(joinPoint);
|
||||||
|
|
||||||
|
// 打印请求相关参数
|
||||||
|
logger.info("========================================== Start ==========================================");
|
||||||
|
// 打印请求 url
|
||||||
|
logger.info("URL : {}", request.getRequestURL().toString());
|
||||||
|
// 打印描述信息
|
||||||
|
logger.info("Description : {}", methodDescription);
|
||||||
|
// 打印 Http method
|
||||||
|
logger.info("HTTP Method : {}", request.getMethod());
|
||||||
|
// 打印调用 controller 的全路径以及执行方法
|
||||||
|
logger.info("Class Method : {}.{}", joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName());
|
||||||
|
// 打印请求的 IP
|
||||||
|
logger.info("IP : {}", request.getRemoteAddr());
|
||||||
|
// 打印请求入参
|
||||||
|
if(methodDescription.equals("loginUserInfo") || methodDescription.equals("quitUserInfo")){
|
||||||
|
|
||||||
|
}else{
|
||||||
|
logger.info("Request Args : {}", JSON.toJSON(joinPoint.getArgs()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在切点之后织入
|
||||||
|
* @throws Throwable
|
||||||
|
*/
|
||||||
|
@After("webLog()")
|
||||||
|
public void doAfter() throws Throwable {
|
||||||
|
// 接口结束后换行,方便分割查看
|
||||||
|
logger.info("=========================================== End ===========================================" + LINE_SEPARATOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 环绕
|
||||||
|
* @param proceedingJoinPoint
|
||||||
|
* @return
|
||||||
|
* @throws Throwable
|
||||||
|
*/
|
||||||
|
@Around("webLog()")
|
||||||
|
public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
Object result = proceedingJoinPoint.proceed();
|
||||||
|
// 打印出参
|
||||||
|
logger.info("Response Args : {}", JSON.toJSON(result));
|
||||||
|
// 执行耗时
|
||||||
|
logger.info("Time-Consuming : {} ms", System.currentTimeMillis() - startTime);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取切面注解的描述
|
||||||
|
*
|
||||||
|
* @param joinPoint 切点
|
||||||
|
* @return 描述信息
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public String getAspectLogDescription(JoinPoint joinPoint)
|
||||||
|
throws Exception {
|
||||||
|
String targetName = joinPoint.getTarget().getClass().getName();
|
||||||
|
String methodName = joinPoint.getSignature().getName();
|
||||||
|
Object[] arguments = joinPoint.getArgs();
|
||||||
|
Class targetClass = Class.forName(targetName);
|
||||||
|
Method[] methods = targetClass.getMethods();
|
||||||
|
StringBuilder description = new StringBuilder("");
|
||||||
|
for (Method method : methods) {
|
||||||
|
if (method.getName().equals(methodName)) {
|
||||||
|
Class[] clazzs = method.getParameterTypes();
|
||||||
|
if (clazzs.length == arguments.length) {
|
||||||
|
description.append(method.getAnnotation(WebLog.class).description());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return description.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
101
src/main/java/com/saye/hrs/commons/HttpUtil.java
Normal file
101
src/main/java/com/saye/hrs/commons/HttpUtil.java
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
package com.saye.hrs.commons;
|
||||||
|
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: http操作工具类
|
||||||
|
* @author zmc
|
||||||
|
*/
|
||||||
|
public class HttpUtil {
|
||||||
|
|
||||||
|
public static HttpServletRequest getRequest(){
|
||||||
|
return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 获取接口的目标域名
|
||||||
|
* @param
|
||||||
|
* @return java.lang.String
|
||||||
|
* @author zmc
|
||||||
|
*/
|
||||||
|
public static String getServerName() {
|
||||||
|
return getServerName(getRequest());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 获取接口的目标域名
|
||||||
|
* @param request
|
||||||
|
* @return java.lang.String
|
||||||
|
* @author zmc
|
||||||
|
*/
|
||||||
|
public static String getServerName(HttpServletRequest request) {
|
||||||
|
//先从attribute取
|
||||||
|
if (request.getAttribute("targetServerNameForOverride") != null){
|
||||||
|
return request.getAttribute("targetServerNameForOverride").toString();
|
||||||
|
}
|
||||||
|
//再从param取
|
||||||
|
String targetServerName = request.getParameter("targetServerNameForOverride");
|
||||||
|
//param没有才用host的值
|
||||||
|
String serverName = StringUtil.isEmpty(targetServerName) ? request.getServerName() : targetServerName;
|
||||||
|
//写到attribute
|
||||||
|
request.setAttribute("targetServerNameForOverride", serverName);
|
||||||
|
return serverName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getScheme() {
|
||||||
|
String scheme = getRequest().getHeader("X-Forwarded-Scheme");
|
||||||
|
return scheme;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getServerPort() {
|
||||||
|
int port = getRequest().getServerPort();
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 获取请求链接的根地址url
|
||||||
|
* @param request
|
||||||
|
* @return java.lang.String
|
||||||
|
* @author zmc
|
||||||
|
*/
|
||||||
|
public static String getRequestRootUrl(HttpServletRequest request) {
|
||||||
|
String protocol = request.getScheme();
|
||||||
|
int port = request.getServerPort();
|
||||||
|
String portStr = "";
|
||||||
|
if("http".equals(protocol)) {
|
||||||
|
if (80 != port) {
|
||||||
|
portStr = ":" + port;
|
||||||
|
} else {
|
||||||
|
portStr = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if("https".equals(protocol)) {
|
||||||
|
if (443 != port) {
|
||||||
|
portStr = ":" + port;
|
||||||
|
} else {
|
||||||
|
portStr = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//http为443端口的,一般是https协议,nginx或Tomcat等配置不是很好导致取得的是http
|
||||||
|
if(443 == port && "http".equals(protocol)) {
|
||||||
|
protocol = "https";
|
||||||
|
}
|
||||||
|
|
||||||
|
//去掉https的443端口,预发、正式上有问题
|
||||||
|
if(443 == port && "https".equals(protocol)) {
|
||||||
|
portStr = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
String requestRootUrl = protocol + "://" + getServerName(request) + portStr;
|
||||||
|
return requestRootUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static String getRequestURL() {
|
||||||
|
return getRequest().getRequestURL().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
82
src/main/java/com/saye/hrs/commons/IPUtil.java
Normal file
82
src/main/java/com/saye/hrs/commons/IPUtil.java
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
package com.saye.hrs.commons;
|
||||||
|
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: IP
|
||||||
|
* @author zmc
|
||||||
|
*/
|
||||||
|
public class IPUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 获取ip
|
||||||
|
* @param
|
||||||
|
* @return java.lang.String
|
||||||
|
* @author zmc
|
||||||
|
*/
|
||||||
|
public static String getIp() {
|
||||||
|
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||||
|
HttpServletRequest request = requestAttributes.getRequest();
|
||||||
|
return getIp(request);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 获取ip
|
||||||
|
* @param request
|
||||||
|
* @return java.lang.String
|
||||||
|
* @author zmc
|
||||||
|
*/
|
||||||
|
public static String getIp(HttpServletRequest request) {
|
||||||
|
if (request == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String ip = request.getHeader("X-Forwarded-For");
|
||||||
|
if (!StringUtils.isEmpty(ip) && !"unknown".equalsIgnoreCase(ip.toLowerCase())) {
|
||||||
|
//多次反向代理后会有多个ip值,第一个ip才是真实ip
|
||||||
|
int index = ip.indexOf(",");
|
||||||
|
if (index != -1) {
|
||||||
|
return ip.substring(0, index);
|
||||||
|
} else {
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ip = request.getHeader("X-Real-IP");
|
||||||
|
if (!StringUtils.isEmpty(ip) && !"unknown".equalsIgnoreCase(ip.toLowerCase())) {
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
return request.getRemoteAddr();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 将IP地址的中间两段转星号隐藏处理
|
||||||
|
* @param ip
|
||||||
|
* @return java.lang.String
|
||||||
|
* @author zmc
|
||||||
|
*/
|
||||||
|
// public static String hideIP(String ip) {
|
||||||
|
// if(null == ip) {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// List<String> newIPList = new ArrayList<>();
|
||||||
|
// String[] ipArr = org.apache.commons.lang3.StringUtils.splitByWholeSeparatorPreserveAllTokens(ip, ".");
|
||||||
|
// int i = 0;
|
||||||
|
// int len = ipArr.length;
|
||||||
|
// for (String str : ipArr) {
|
||||||
|
// if(i > 0 && i < len - 1) {
|
||||||
|
// str = "*";
|
||||||
|
// }
|
||||||
|
// newIPList.add(str);
|
||||||
|
// i++;
|
||||||
|
// }
|
||||||
|
// String newIP = newIPList.stream().collect(Collectors.joining("."));
|
||||||
|
// return newIP;
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
136
src/main/java/com/saye/hrs/commons/JsonUtils.java
Normal file
136
src/main/java/com/saye/hrs/commons/JsonUtils.java
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
package com.saye.hrs.commons;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: Json工具类
|
||||||
|
* @author zmc
|
||||||
|
*/
|
||||||
|
public class JsonUtils {
|
||||||
|
/**
|
||||||
|
* Bean对象转JSON
|
||||||
|
*
|
||||||
|
* @param object
|
||||||
|
* @param dataFormatString
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String beanToJson(Object object, String dataFormatString) {
|
||||||
|
if (object != null) {
|
||||||
|
if (StringUtils.isEmpty(dataFormatString)) {
|
||||||
|
return JSONObject.toJSONString(object);
|
||||||
|
}
|
||||||
|
return JSON.toJSONStringWithDateFormat(object, dataFormatString);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将json字符串转换成对象
|
||||||
|
*
|
||||||
|
* @param json
|
||||||
|
* @param clazz
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static <T> T jsonToBean(String json, Class<T> clazz) {
|
||||||
|
if (StringUtils.isEmpty(json) || clazz == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return JSON.parseObject(json, clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bean对象转JSON
|
||||||
|
*
|
||||||
|
* @param object
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String beanToJson(Object object) {
|
||||||
|
if (object != null) {
|
||||||
|
return JSON.toJSONString(object, SerializerFeature.DisableCircularReferenceDetect);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String转JSON字符串
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* @param value
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String stringToJsonByFastjson(String key, String value) {
|
||||||
|
if (StringUtils.isEmpty(key) || StringUtils.isEmpty(value)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
|
map.put(key, value);
|
||||||
|
return beanToJson(map, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* json字符串转map
|
||||||
|
*
|
||||||
|
* @param json
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Map<String, Object> jsonToMap(String json) {
|
||||||
|
if (StringUtils.isEmpty(json)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return JSON.parseObject(json, Map.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, String> jsonToMapStr(String json) {
|
||||||
|
if (StringUtils.isEmpty(json)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return JSON.parseObject(json, Map.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* json字符串转list
|
||||||
|
*
|
||||||
|
* @param jsonStr
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static <T> List<T> stringToList(String jsonStr, Class<T> model) {
|
||||||
|
List<T> object = (List<T>) JSONArray.parseArray(jsonStr, model);
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
public static <T> List<String> stringToList2(String jsonStr, Class<String> model) {
|
||||||
|
List<String> object = (List<String>) JSONArray.parseArray(jsonStr, model);
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> List<T> jsonToList(String json, Class<T> clazz) {
|
||||||
|
if (StringUtils.isEmpty(json)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return JSONArray.parseArray(json, clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* json字符串转list
|
||||||
|
*
|
||||||
|
* @param jsonStr
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static <T> List<T> getStringToList(String jsonStr, Class<T> model) {
|
||||||
|
List<T> object = (List<T>) JSONArray.parseArray(jsonStr, model);
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
83
src/main/java/com/saye/hrs/commons/StringUtil.java
Normal file
83
src/main/java/com/saye/hrs/commons/StringUtil.java
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
package com.saye.hrs.commons;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: Lee CE
|
||||||
|
* @Description:常用的字符串相关的工具类
|
||||||
|
* @Date: 2018/7/12 15:19
|
||||||
|
* @Modified:
|
||||||
|
*/
|
||||||
|
public final class StringUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否是空字符串 null和"" 都返回 true
|
||||||
|
*
|
||||||
|
* @param str 判断的字符串
|
||||||
|
* @return 是否有效
|
||||||
|
*/
|
||||||
|
public static boolean isEmpty(String str) {
|
||||||
|
return str == null || str.equals("");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 把string array or list用给定的符号symbol连接成一个字符串
|
||||||
|
*
|
||||||
|
* @param list 需要处理的列表
|
||||||
|
* @param symbol 链接的符号
|
||||||
|
* @return 处理后的字符串
|
||||||
|
*/
|
||||||
|
public static String joinString(List list, String symbol) {
|
||||||
|
String result = "";
|
||||||
|
if (list != null) {
|
||||||
|
for (Object o : list) {
|
||||||
|
String temp = o.toString();
|
||||||
|
if (temp.trim().length() > 0)
|
||||||
|
result += (temp + symbol);
|
||||||
|
}
|
||||||
|
if (result.length() > 1) {
|
||||||
|
result = result.substring(0, result.length() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: null转空处理
|
||||||
|
* @param obj
|
||||||
|
* @return java.lang.String
|
||||||
|
* @author zmc
|
||||||
|
* @date 2019-06-10 10:47
|
||||||
|
*/
|
||||||
|
public static String changeNullToEmpty(Object obj) {
|
||||||
|
if(null == obj) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return obj.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 字符串去左右空格
|
||||||
|
* @param obj
|
||||||
|
* @return java.lang.String
|
||||||
|
* @author zmc
|
||||||
|
* @date 2019-09-10 17:17
|
||||||
|
*/
|
||||||
|
public static String trim(Object obj) {
|
||||||
|
String str = changeNullToEmpty(obj);
|
||||||
|
str = str.trim();
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
public static String checkKeyword(Map<String, Object> map, String keyword) {
|
||||||
|
if (!StringUtil.isEmpty(keyword)){
|
||||||
|
keyword = keyword.trim();
|
||||||
|
if (!keyword.equals("")){
|
||||||
|
map.put("keyword", keyword);
|
||||||
|
return keyword;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
329
src/main/java/com/saye/hrs/commons/date/DateDUtil.java
Normal file
329
src/main/java/com/saye/hrs/commons/date/DateDUtil.java
Normal file
@@ -0,0 +1,329 @@
|
|||||||
|
package com.saye.hrs.commons.date;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class DateDUtil {
|
||||||
|
|
||||||
|
|
||||||
|
public static String yyyy_MM_dd = "yyyy-MM-dd";
|
||||||
|
public static String yyyyMMdd = "yyyyMMdd";
|
||||||
|
public static String yyyyMM = "yyyyMM";
|
||||||
|
public static String yyyy_MM = "yyyy-MM";
|
||||||
|
public static String yyyy_MM_dd_HH_00 = "yyyy-MM-dd HH:00";
|
||||||
|
public static String yyyy_MM_dd_HH_mm = "yyyy-MM-dd HH:mm";
|
||||||
|
public static String yyyy_MM_dd_HH_mm_ss = "yyyy-MM-dd HH:mm:ss";
|
||||||
|
public static String yyyy_MM_dd_HH_mm_ss_SS = "yyyy-MM-dd HH:mm:ss.SS";
|
||||||
|
public static String yyyyMMddHHmm = "yyyyMMddHHmm";
|
||||||
|
public static String yyyyMMddHHmmss = "yyyyMMddHHmmss";
|
||||||
|
public static String yyyyMMddHHmmssSS = "yyyyMMddHHmmssSS";
|
||||||
|
public static String yyMMdd = "yyMMdd";
|
||||||
|
public static String yyyy_MM_dd_00_00 = "yyyy-MM-dd 00:00";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将字符串时间改成Date类型
|
||||||
|
* @param format
|
||||||
|
* @param dateStr
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Date strToDate(String format,String dateStr) {
|
||||||
|
|
||||||
|
Date date = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
|
||||||
|
date = simpleDateFormat.parse(dateStr);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将Date时间转成字符串
|
||||||
|
* @param format
|
||||||
|
* @param date
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String DateToStr(String format,Date date){
|
||||||
|
|
||||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(format);
|
||||||
|
|
||||||
|
return simpleDateFormat.format(date);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取2个字符日期的天数差
|
||||||
|
* @param p_startDate
|
||||||
|
* @param p_endDate
|
||||||
|
* @return 天数差
|
||||||
|
*/
|
||||||
|
public static long getDaysOfTowDiffDate( String p_startDate, String p_endDate ){
|
||||||
|
|
||||||
|
Date l_startDate = DateDUtil.strToDate(DateDUtil.yyyy_MM_dd, p_startDate);
|
||||||
|
Date l_endDate = DateDUtil.strToDate(DateDUtil.yyyy_MM_dd, p_endDate);
|
||||||
|
long l_startTime = l_startDate.getTime();
|
||||||
|
long l_endTime = l_endDate.getTime();
|
||||||
|
long betweenDays = (long) ( ( l_endTime - l_startTime ) / ( 1000 * 60 * 60 * 24 ) );
|
||||||
|
return betweenDays;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取2个字符日期的天数差
|
||||||
|
* @param l_startDate
|
||||||
|
* @param l_endDate
|
||||||
|
* @return 天数差
|
||||||
|
*/
|
||||||
|
public static long getDaysOfTowDiffDate( Date l_startDate, Date l_endDate ){
|
||||||
|
|
||||||
|
long l_startTime = l_startDate.getTime();
|
||||||
|
long l_endTime = l_endDate.getTime();
|
||||||
|
long betweenDays = (long) ( ( l_endTime - l_startTime ) / ( 1000 * 60 * 60 * 24 ) );
|
||||||
|
return betweenDays;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给出日期添加一段时间后的日期
|
||||||
|
* @param dateStr
|
||||||
|
* @param plus
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getPlusDays(String format,String dateStr,long plus){
|
||||||
|
|
||||||
|
Date date = DateDUtil.strToDate(format, dateStr);
|
||||||
|
|
||||||
|
long time = date.getTime()+ plus*24*60*60*1000;
|
||||||
|
|
||||||
|
|
||||||
|
return DateDUtil.DateToStr(format,new Date(time));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给出日期添加一段时间后的日期
|
||||||
|
* @param format
|
||||||
|
* @param date
|
||||||
|
* @param plus
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getPlusDays(String format,Date date,long plus){
|
||||||
|
|
||||||
|
|
||||||
|
long time = date.getTime()+ plus*24*60*60*1000;
|
||||||
|
|
||||||
|
|
||||||
|
return DateDUtil.DateToStr(format,new Date(time));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给出日期添加一段时间前的日期
|
||||||
|
* @param format
|
||||||
|
* @param date
|
||||||
|
* @param forth
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getForthDays(String format,Date date,long forth){
|
||||||
|
|
||||||
|
|
||||||
|
long time = date.getTime()- forth*24*60*60*1000;
|
||||||
|
|
||||||
|
|
||||||
|
return DateDUtil.DateToStr(format,new Date(time));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给出时间添加几个小时后的时间
|
||||||
|
* @param format
|
||||||
|
* @param dateStr
|
||||||
|
* @param plus
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getPlusHours(String format,String dateStr,long plus){
|
||||||
|
|
||||||
|
Date date = DateDUtil.strToDate(format, dateStr);
|
||||||
|
|
||||||
|
long time = date.getTime()+ plus*60*60*1000;
|
||||||
|
|
||||||
|
|
||||||
|
return DateDUtil.DateToStr(format,new Date(time));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 给出时间添加几个分钟后的时间
|
||||||
|
* @param format
|
||||||
|
* @param dateStr
|
||||||
|
* @param plus
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getPlusMinutes(String format,String dateStr,long plus){
|
||||||
|
|
||||||
|
Date date = DateDUtil.strToDate(format, dateStr);
|
||||||
|
|
||||||
|
long time = date.getTime()+ plus*60*1000;
|
||||||
|
|
||||||
|
|
||||||
|
return DateDUtil.DateToStr(format,new Date(time));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 得到当前时间,格式如:yyyy-MM-dd HH:mm:ss:SS
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getCurrentTime(){
|
||||||
|
|
||||||
|
String nowTime = DateDUtil.DateToStr(DateDUtil.yyyy_MM_dd_HH_mm_ss_SS, new Date());
|
||||||
|
return nowTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 得到当前时间,格式如:yyyy-MM-dd HH:mm:ss
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getTheCurrentTime(){
|
||||||
|
|
||||||
|
String nowTime = DateDUtil.DateToStr(DateDUtil.yyyy_MM_dd_HH_mm_ss, new Date());
|
||||||
|
return nowTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 得到当前日期,格式如:yyyyMMdd
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getCurrentDate(){
|
||||||
|
|
||||||
|
String nowDate = DateDUtil.DateToStr(DateDUtil.yyyyMMdd, new Date());
|
||||||
|
return nowDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 得到当前日期,格式如:yyyyMMdd
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getCurrentDate(String format){
|
||||||
|
|
||||||
|
String nowDate = DateDUtil.DateToStr(format, new Date());
|
||||||
|
return nowDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取2个字符日期的分钟数差
|
||||||
|
* @param p_startDate
|
||||||
|
* @param p_endDate
|
||||||
|
* @return 相差的分钟
|
||||||
|
*/
|
||||||
|
public static long getMinutesOfTowDiffDate(String p_startDate, String p_endDate ){
|
||||||
|
|
||||||
|
Date l_startDate = DateDUtil.strToDate(DateDUtil.yyyy_MM_dd_HH_mm_ss_SS, p_startDate);
|
||||||
|
Date l_endDate = DateDUtil.strToDate(DateDUtil.yyyy_MM_dd_HH_mm_ss_SS, p_endDate);
|
||||||
|
long l_startTime = l_startDate.getTime();
|
||||||
|
long l_endTime = l_endDate.getTime();
|
||||||
|
long betweenMinutes = (long) ( ( l_endTime - l_startTime ) / ( 1000 * 60) );
|
||||||
|
return betweenMinutes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取2个字符日期的分钟数差
|
||||||
|
* @param p_startDate
|
||||||
|
* @param p_endDate
|
||||||
|
* @return 相差的分钟
|
||||||
|
*/
|
||||||
|
public static long getMinutesOfTowDiffDateMin(String format,String p_startDate, String p_endDate ){
|
||||||
|
|
||||||
|
Date l_startDate = DateDUtil.strToDate(format, p_startDate);
|
||||||
|
Date l_endDate = DateDUtil.strToDate(format, p_endDate);
|
||||||
|
long l_startTime = l_startDate.getTime();
|
||||||
|
long l_endTime = l_endDate.getTime();
|
||||||
|
long betweenMinutes = (long) ( ( l_endTime - l_startTime ) / ( 1000 * 60) );
|
||||||
|
return betweenMinutes;
|
||||||
|
}
|
||||||
|
public static long getMonthIntervalOfTowDiffDate(String p_startMonth, String p_endMonth){
|
||||||
|
|
||||||
|
Date l_startDate = DateDUtil.strToDate(DateDUtil.yyyy_MM, p_startMonth);
|
||||||
|
Date l_endDate = DateDUtil.strToDate(DateDUtil.yyyy_MM, p_endMonth);
|
||||||
|
|
||||||
|
|
||||||
|
Calendar calender = Calendar.getInstance();
|
||||||
|
calender.setTime(l_startDate);
|
||||||
|
|
||||||
|
long l_startMonth = calender.get(Calendar.MONTH)+1;
|
||||||
|
long l_startYear = calender.get(Calendar.YEAR);
|
||||||
|
|
||||||
|
calender.setTime(l_endDate);
|
||||||
|
|
||||||
|
long l_endMonth =calender.get(Calendar.MONTH)+1;
|
||||||
|
long l_endYear = calender.get(Calendar.YEAR);
|
||||||
|
|
||||||
|
long betweenYear = l_endYear - l_startYear;
|
||||||
|
long betweenMonth = (long) ( l_endMonth - l_startMonth ) ;
|
||||||
|
|
||||||
|
return betweenYear * 12 + betweenMonth;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将字符串日期转为cron表达式
|
||||||
|
*/
|
||||||
|
public static String getCron(String execute_time) throws Exception{
|
||||||
|
|
||||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(yyyy_MM_dd_HH_mm_ss);
|
||||||
|
Date date = simpleDateFormat.parse(execute_time);
|
||||||
|
SimpleDateFormat dateFormat = new SimpleDateFormat("ss mm HH dd MM ? yyyy");
|
||||||
|
return dateFormat.format(date);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取当前年月日日期
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static String getCDate(){
|
||||||
|
Calendar now = Calendar.getInstance();
|
||||||
|
String year=now.get(Calendar.YEAR)+"";
|
||||||
|
String month=(now.get(Calendar.MONTH) + 1) + "";
|
||||||
|
String day=now.get(Calendar.DAY_OF_MONTH)+"";
|
||||||
|
if ((now.get(Calendar.MONTH) + 1) < 10) month = "0" + month;
|
||||||
|
if (now.get(Calendar.DAY_OF_MONTH) < 10) day= "0" + day;
|
||||||
|
String nowDate = year+"年"+month+"月"+day+"日";
|
||||||
|
return nowDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> findWeekDays(String week) {
|
||||||
|
List<String> list = new ArrayList<String>();
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
Calendar c = Calendar.getInstance();
|
||||||
|
// 今天是一周中的第几天
|
||||||
|
int dayOfWeek = c.get(Calendar.DAY_OF_WEEK);
|
||||||
|
|
||||||
|
if (c.getFirstDayOfWeek() == Calendar.SUNDAY) {
|
||||||
|
c.add(Calendar.DAY_OF_MONTH, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if("lastWeek".equals(week)){
|
||||||
|
dayOfWeek = -dayOfWeek-7;
|
||||||
|
}else if("thisWeek".equals(week)){
|
||||||
|
dayOfWeek = -dayOfWeek;
|
||||||
|
}else if("nextWeek".equals(week)){
|
||||||
|
dayOfWeek = -dayOfWeek+7;
|
||||||
|
}
|
||||||
|
// 计算一周开始的日期
|
||||||
|
c.add(Calendar.DAY_OF_MONTH, dayOfWeek);
|
||||||
|
|
||||||
|
for (int i = 1; i <= 7; i++) {
|
||||||
|
c.add(Calendar.DAY_OF_MONTH, 1);
|
||||||
|
list.add(sdf.format(c.getTime()));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
System.out.println("111");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
68
src/main/java/com/saye/hrs/commons/encrypt/EncryptUtil.java
Normal file
68
src/main/java/com/saye/hrs/commons/encrypt/EncryptUtil.java
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
package com.saye.hrs.commons.encrypt;
|
||||||
|
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
|
import javax.crypto.Cipher;
|
||||||
|
import javax.crypto.spec.IvParameterSpec;
|
||||||
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
|
||||||
|
public class EncryptUtil {
|
||||||
|
|
||||||
|
// AES ecb模式解密 key:秘钥 initVector:偏移量 encrypted:加密内容
|
||||||
|
public static String decrypt(String key,String initVector,String encrypted) {
|
||||||
|
try {
|
||||||
|
IvParameterSpec iv = new IvParameterSpec(initVector.getBytes("UTF-8"));
|
||||||
|
SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
|
||||||
|
|
||||||
|
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING");
|
||||||
|
cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv);
|
||||||
|
byte[] original = cipher.doFinal(Base64.decodeBase64(encrypted));
|
||||||
|
|
||||||
|
return new String(original);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
System.out.println(decrypt("a6xdabhysfescfbu","encryptionIntVec","oYzamqnnyJ8GG6646PDYBQ=="));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getSHA256Str(String str){
|
||||||
|
MessageDigest messageDigest;
|
||||||
|
String encodeStr = "";
|
||||||
|
try {
|
||||||
|
messageDigest = MessageDigest.getInstance("SHA-256");
|
||||||
|
messageDigest.update(str.getBytes("UTF-8"));
|
||||||
|
encodeStr = byte2Hex(messageDigest.digest());
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return encodeStr;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 将byte转为16进制
|
||||||
|
* @param bytes
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static String byte2Hex(byte[] bytes){
|
||||||
|
StringBuffer stringBuffer = new StringBuffer();
|
||||||
|
String temp = null;
|
||||||
|
for (int i=0;i<bytes.length;i++){
|
||||||
|
temp = Integer.toHexString(bytes[i] & 0xFF);
|
||||||
|
if (temp.length()==1){
|
||||||
|
//1得到一位的进行补0操作
|
||||||
|
stringBuffer.append("0");
|
||||||
|
}
|
||||||
|
stringBuffer.append(temp);
|
||||||
|
}
|
||||||
|
return stringBuffer.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
30
src/main/java/com/saye/hrs/commons/encrypt/RSAUtil.java
Normal file
30
src/main/java/com/saye/hrs/commons/encrypt/RSAUtil.java
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package com.saye.hrs.commons.encrypt;
|
||||||
|
|
||||||
|
import org.springframework.util.Base64Utils;
|
||||||
|
|
||||||
|
import javax.crypto.Cipher;
|
||||||
|
import java.security.KeyFactory;
|
||||||
|
import java.security.interfaces.RSAPublicKey;
|
||||||
|
import java.security.spec.X509EncodedKeySpec;
|
||||||
|
|
||||||
|
public class RSAUtil {
|
||||||
|
public static String encryptRSA(String password, String publicKey) {
|
||||||
|
// base64编码的公钥
|
||||||
|
try {
|
||||||
|
|
||||||
|
byte[] decoded = Base64Utils.decodeFromString(publicKey);
|
||||||
|
RSAPublicKey pubKey =
|
||||||
|
(RSAPublicKey)
|
||||||
|
KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));
|
||||||
|
// RSA加密
|
||||||
|
Cipher cipher = Cipher.getInstance("RSA");
|
||||||
|
cipher.init(Cipher.ENCRYPT_MODE, pubKey);
|
||||||
|
//**此处Base64编码,开发者可以使用自己的库**
|
||||||
|
String outStr = Base64Utils.encodeToString(cipher.doFinal(password.getBytes("UTF-8")));
|
||||||
|
return outStr;
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
package com.saye.hrs.commons.exception;
|
||||||
|
|
||||||
|
import com.saye.hrs.dto.Result;
|
||||||
|
import com.saye.hrs.enums.CodeMessageEnum;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.validation.BindException;
|
||||||
|
import org.springframework.validation.FieldError;
|
||||||
|
import org.springframework.validation.ObjectError;
|
||||||
|
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||||
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
|
import org.springframework.web.servlet.NoHandlerFoundException;
|
||||||
|
|
||||||
|
import javax.validation.ConstraintViolationException;
|
||||||
|
import java.security.SecureRandom;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: controller异常处理
|
||||||
|
* @author zmc
|
||||||
|
*/
|
||||||
|
@ControllerAdvice
|
||||||
|
@ResponseBody
|
||||||
|
public class ControllerExceptionHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理validate的校验异常
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(BindException.class)
|
||||||
|
public Result<?> handleBindException(BindException e) {
|
||||||
|
return wrapErrors(e.getAllErrors());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理RequestBody validate的校验异常
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||||
|
public Result<?> handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
|
||||||
|
return wrapErrors(e.getBindingResult().getAllErrors());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理参数列表字段validate的校验异常
|
||||||
|
*/
|
||||||
|
@ExceptionHandler(ConstraintViolationException.class)
|
||||||
|
public Result<?> handleConstraintViolationException(ConstraintViolationException e) {
|
||||||
|
return wrapErrors(e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回validate异常提示
|
||||||
|
* @param errors
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Result<?> wrapErrors(List<ObjectError> errors) {
|
||||||
|
if(CollectionUtils.isEmpty(errors)){
|
||||||
|
return new Result<>(CodeMessageEnum.VALIDATE_ERROR.getCode(), "请求参数错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
//validate的校验错误提示
|
||||||
|
List<String> tipList = new ArrayList<>(errors.size());
|
||||||
|
SecureRandom random = new SecureRandom();
|
||||||
|
errors.forEach(error->{
|
||||||
|
if(error instanceof FieldError) {
|
||||||
|
FieldError fieldError = (FieldError)error;
|
||||||
|
tipList.add(fieldError.getField() + error.getDefaultMessage());
|
||||||
|
} else {
|
||||||
|
tipList.add(error.getObjectName() + random.nextInt() + error.getDefaultMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
String message = tipList.stream().collect(Collectors.joining(";"));
|
||||||
|
return new Result<>(CodeMessageEnum.VALIDATE_ERROR.getCode(), message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回validate异常提示
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Result<?> wrapErrors(String message) {
|
||||||
|
if(message==null || "".equals(message)){
|
||||||
|
return new Result<>(CodeMessageEnum.VALIDATE_ERROR.getCode(), "请求参数错误");
|
||||||
|
}
|
||||||
|
//validate的校验错误提示
|
||||||
|
if (message.indexOf(".") == -1 || message.indexOf(":") == -1) {
|
||||||
|
return new Result<>(CodeMessageEnum.VALIDATE_ERROR.getCode(), "请求参数错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
String prefix = message.split("\\.")[0];
|
||||||
|
message = message.replace(prefix + ".", "");
|
||||||
|
|
||||||
|
List<String> tipList = new ArrayList<>();
|
||||||
|
// 判断是否存在多个字段
|
||||||
|
if (message.indexOf(",") == -1) {
|
||||||
|
String[] msgChildArr = message.split(":");
|
||||||
|
tipList.add(msgChildArr[0].trim() + msgChildArr[1].trim());
|
||||||
|
}else{
|
||||||
|
String[] msgArr = message.split(",");
|
||||||
|
for (String msg : msgArr) {
|
||||||
|
String[] msgChildArr = msg.split(":");
|
||||||
|
tipList.add(msgChildArr[0].trim() + msgChildArr[1].trim());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String tip = tipList.stream().collect(Collectors.joining(","));
|
||||||
|
return new Result<>(CodeMessageEnum.VALIDATE_ERROR.getCode(), tip);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(NoHandlerFoundException.class)
|
||||||
|
@ResponseStatus(HttpStatus.NOT_FOUND)//处理的异常类型
|
||||||
|
public Result notFountHandler(NoHandlerFoundException e){
|
||||||
|
Result result = new Result(CodeMessageEnum.NOT_EXISTS.getCode(), "请求地址不存在");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
package com.saye.hrs.commons.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 自定义运行时异常,抛出不符合业务需求的结果异常
|
||||||
|
* @author zmc
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
public class CustomException extends RuntimeException {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 错误编码
|
||||||
|
*/
|
||||||
|
private String errorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息是否为属性文件中的Key
|
||||||
|
*/
|
||||||
|
private boolean propertiesKey = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造一个基本异常.
|
||||||
|
*
|
||||||
|
* @param message 信息描述
|
||||||
|
*/
|
||||||
|
public CustomException(String message)
|
||||||
|
{
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造一个基本异常.
|
||||||
|
*
|
||||||
|
* @param errorCode 错误编码
|
||||||
|
* @param message 信息描述
|
||||||
|
*/
|
||||||
|
public CustomException(String errorCode, String message)
|
||||||
|
{
|
||||||
|
this(errorCode, message, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造一个基本异常.
|
||||||
|
*
|
||||||
|
* @param errorCode 错误编码
|
||||||
|
* @param message 信息描述
|
||||||
|
*/
|
||||||
|
public CustomException(String errorCode, String message, Throwable cause)
|
||||||
|
{
|
||||||
|
this(errorCode, message, cause, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造一个基本异常.
|
||||||
|
*
|
||||||
|
* @param errorCode 错误编码
|
||||||
|
* @param message 信息描述
|
||||||
|
* @param propertiesKey 消息是否为属性文件中的Key
|
||||||
|
*/
|
||||||
|
public CustomException(String errorCode, String message, boolean propertiesKey)
|
||||||
|
{
|
||||||
|
super(message);
|
||||||
|
this.setErrorCode(errorCode);
|
||||||
|
this.setPropertiesKey(propertiesKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造一个基本异常.
|
||||||
|
*
|
||||||
|
* @param errorCode 错误编码
|
||||||
|
* @param message 信息描述
|
||||||
|
*/
|
||||||
|
public CustomException(String errorCode, String message, Throwable cause, boolean propertiesKey)
|
||||||
|
{
|
||||||
|
super(message, cause);
|
||||||
|
this.setErrorCode(errorCode);
|
||||||
|
this.setPropertiesKey(propertiesKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造一个基本异常.
|
||||||
|
*
|
||||||
|
* @param message 信息描述
|
||||||
|
* @param cause 根异常类(可以存入任何异常)
|
||||||
|
*/
|
||||||
|
public CustomException(String message, Throwable cause)
|
||||||
|
{
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getErrorCode()
|
||||||
|
{
|
||||||
|
return errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setErrorCode(String errorCode)
|
||||||
|
{
|
||||||
|
this.errorCode = errorCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPropertiesKey()
|
||||||
|
{
|
||||||
|
return propertiesKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPropertiesKey(boolean propertiesKey)
|
||||||
|
{
|
||||||
|
this.propertiesKey = propertiesKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
29
src/main/java/com/saye/hrs/commons/getBean/GetBeanUtil.java
Normal file
29
src/main/java/com/saye/hrs/commons/getBean/GetBeanUtil.java
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
package com.saye.hrs.commons.getBean;
|
||||||
|
|
||||||
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationContextAware;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class GetBeanUtil implements ApplicationContextAware {
|
||||||
|
protected static ApplicationContext applicationContext ;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setApplicationContext(ApplicationContext arg0) throws BeansException {
|
||||||
|
if (applicationContext == null) {
|
||||||
|
applicationContext = arg0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public static Object getBean(String name) {
|
||||||
|
//name表示其他要注入的注解name名
|
||||||
|
return applicationContext.getBean(name);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 拿到ApplicationContext对象实例后就可以手动获取Bean的注入实例对象
|
||||||
|
*/
|
||||||
|
public static <T> T getBean(Class<T> clazz) {
|
||||||
|
return applicationContext.getBean(clazz);
|
||||||
|
}
|
||||||
|
}
|
||||||
145
src/main/java/com/saye/hrs/commons/idcard/Ic.java
Normal file
145
src/main/java/com/saye/hrs/commons/idcard/Ic.java
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
package com.saye.hrs.commons.idcard;
|
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.saye.hrs.dto.WxybPay;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 身份证升位规则:
|
||||||
|
第一代身份证十五位数升为第二代身份证十八位数的一般规则是:
|
||||||
|
第一步,在原十五位数身份证的第六位数后面插入19 ,这样身份证号码即为十七位数;
|
||||||
|
第二步,按照国家规定的统一公式计算出第十八位数,作为校验码放在第二代身份证的尾号。
|
||||||
|
验码计算方法:将身份证前十七位数分别乘以不同系数,
|
||||||
|
从第一至十七位的系数分别为7、9、10、5、8、4、2、1、6、3、7、9、10、5、8、4、2,
|
||||||
|
将这十七位数字和系数相乘的结果相加,用加出来的和除以11,看看余数是多少。
|
||||||
|
余数只可能有0、1、2、3、4、5、6、7、8、9、10这十一个数字,
|
||||||
|
其分别对应的最后一位身份证的号码为1、0、X、9、8、7、6、5、4、3、2,
|
||||||
|
这样就得出了第二代身份证第十八位数的校验码。
|
||||||
|
*/
|
||||||
|
public class Ic {
|
||||||
|
// 主要计算方法,identifyCard是传入的15位身份证号
|
||||||
|
public static String get18Ic(String identifyCard) {
|
||||||
|
|
||||||
|
String retId = "";
|
||||||
|
String id17 = "";
|
||||||
|
int sum = 0;
|
||||||
|
int y = 0;
|
||||||
|
// 定义数组加权因子
|
||||||
|
int[] wf = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 };
|
||||||
|
// 定义数组存放校验码
|
||||||
|
String[] cc = { "1", "0", "x", "9", "8", "7", "6", "5", "4", "3", "2" };
|
||||||
|
// 在原15位数身份证的第六位数后面插入19
|
||||||
|
id17 = identifyCard.substring(0, 6) + "19" + identifyCard.substring(6);
|
||||||
|
// 17位数字和系数相乘,结果相加
|
||||||
|
for (int i = 0; i < 17; i++) {
|
||||||
|
sum = sum + Integer.valueOf(id17.substring(i, i + 1)) * wf[i];
|
||||||
|
|
||||||
|
}
|
||||||
|
// 计算余数
|
||||||
|
y = sum % 11;
|
||||||
|
// 通过模获得对应的校验码cc[yy];
|
||||||
|
retId = id17 + cc[y];
|
||||||
|
return retId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取文件,参数fileName为传入的要读取文件的路径及文件名
|
||||||
|
public static void readFileByLines(String fileName) {
|
||||||
|
|
||||||
|
File file = new File(fileName);
|
||||||
|
BufferedReader reader = null;
|
||||||
|
try {
|
||||||
|
|
||||||
|
reader=new BufferedReader(new FileReader(file));
|
||||||
|
String tempString=null;
|
||||||
|
int line=1;
|
||||||
|
//一次读取一行
|
||||||
|
while((tempString=reader.readLine())!=null){
|
||||||
|
//新的身份证号码
|
||||||
|
String returnId=get18Ic(tempString);
|
||||||
|
//写入到文件中
|
||||||
|
WriterFile(returnId);
|
||||||
|
|
||||||
|
line++;
|
||||||
|
|
||||||
|
}
|
||||||
|
reader.close();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
if (reader != null) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
reader.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//存入文件的名称
|
||||||
|
static String file=null;
|
||||||
|
//参数returnID为返回的18位身份证号,是要写入文件的内容
|
||||||
|
public static void WriterFile(String returnID){
|
||||||
|
FileWriter fw = null ;
|
||||||
|
//如果文件不存在,创建文件
|
||||||
|
try {
|
||||||
|
File f=new File(file);
|
||||||
|
fw=new FileWriter(f,true);
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
PrintWriter pw=new PrintWriter(fw);
|
||||||
|
pw.println(returnID+"\n");
|
||||||
|
pw.flush();
|
||||||
|
try {
|
||||||
|
fw.flush();
|
||||||
|
pw.close();
|
||||||
|
fw.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//以日期作为输出文件的文件名
|
||||||
|
public static String FileName(){
|
||||||
|
SimpleDateFormat simpleDateFormat;
|
||||||
|
simpleDateFormat =new SimpleDateFormat("yyyyMMddHHmmss");
|
||||||
|
Date date=new Date();
|
||||||
|
String filenametxt=simpleDateFormat.format(date);
|
||||||
|
return filenametxt;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// String ic = get18Ic("130503670401001");
|
||||||
|
//
|
||||||
|
// System.out.println(ic);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
43
src/main/java/com/saye/hrs/commons/log/ExceptionDUtil.java
Normal file
43
src/main/java/com/saye/hrs/commons/log/ExceptionDUtil.java
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
package com.saye.hrs.commons.log;
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
|
||||||
|
public class ExceptionDUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回异常的详细信息
|
||||||
|
* @param e
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String getDetailExceptionMsg(Exception e){
|
||||||
|
|
||||||
|
StringBuffer exceptionMessage = new StringBuffer();
|
||||||
|
|
||||||
|
StackTraceElement[] stackTraceElementes = e.getStackTrace();
|
||||||
|
int length = stackTraceElementes.length;
|
||||||
|
StackTraceElement ste;
|
||||||
|
//只要最顶上的错误栈
|
||||||
|
for(int i=0;i<length;i++){
|
||||||
|
ste = stackTraceElementes[i];
|
||||||
|
exceptionMessage.append(ste.getClassName()+":"+ste.getLineNumber()+"行\r\n");
|
||||||
|
//break;
|
||||||
|
}
|
||||||
|
|
||||||
|
String result = e.toString()+"\r\n"+exceptionMessage.toString();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取异常信息
|
||||||
|
*
|
||||||
|
* @param e 异常信息
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static String stackTraceToString(Throwable e) {
|
||||||
|
StringWriter sw = new StringWriter();
|
||||||
|
e.printStackTrace(new PrintWriter(sw, true));
|
||||||
|
return sw.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
29
src/main/java/com/saye/hrs/commons/log/LogUtil.java
Normal file
29
src/main/java/com/saye/hrs/commons/log/LogUtil.java
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
package com.saye.hrs.commons.log;
|
||||||
|
|
||||||
|
import com.saye.hrs.commons.date.DateDUtil;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class LogUtil {
|
||||||
|
|
||||||
|
public static void debug(Class c,String msg) {
|
||||||
|
Logger logger=LoggerFactory.getLogger(c);
|
||||||
|
logger.debug(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void info(Class c,String msg) {
|
||||||
|
Logger logger=LoggerFactory.getLogger(c);
|
||||||
|
logger.info(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void error(Class c,String msg) {
|
||||||
|
Logger logger=LoggerFactory.getLogger(c);
|
||||||
|
logger.error(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.saye.hrs.commons.qitahoutai;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.saye.hrs.commons.getBean.GetBeanUtil;
|
||||||
|
import com.saye.hrs.commons.log.LogUtil;
|
||||||
|
import com.saye.hrs.commons.string.StringDUtil;
|
||||||
|
import com.saye.hrs.commons.wxpay.pojo.WxResult;
|
||||||
|
import com.saye.hrs.config.RestTemplateConfig;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpEntity;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @title houtaiService
|
||||||
|
* @description TODO 请填写注释
|
||||||
|
* @author thuang
|
||||||
|
* @create 2023/8/18 8:44
|
||||||
|
**/
|
||||||
|
@Component
|
||||||
|
public class HoutaiService {
|
||||||
|
|
||||||
|
public HashMap<Object, Object> PostInfoByParam(String url, Object data) {
|
||||||
|
HashMap<Object, Object> resultMap = new HashMap<>();
|
||||||
|
String errCode = "0";
|
||||||
|
String errMsg = "";
|
||||||
|
|
||||||
|
try {
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
HttpEntity<Object> entity = new HttpEntity<>(data, headers);
|
||||||
|
|
||||||
|
RestTemplateConfig restTemplateConfig = GetBeanUtil.getBean(RestTemplateConfig.class);
|
||||||
|
RestTemplate restTemplate = restTemplateConfig.getInstance();
|
||||||
|
ResponseEntity<String> resultStr = restTemplate.postForEntity(url, entity, String.class);
|
||||||
|
|
||||||
|
int statusCodeValue = resultStr.getStatusCodeValue();
|
||||||
|
if (statusCodeValue == 200) {
|
||||||
|
|
||||||
|
// 统一在写入his成功后推送消息,确保业务已经完成。
|
||||||
|
|
||||||
|
|
||||||
|
String body = resultStr.getBody();
|
||||||
|
HashMap hashMap = JSON.parseObject(body, HashMap.class);
|
||||||
|
|
||||||
|
errCode = StringDUtil.changeNullToEmpty(hashMap.get("errCode"));
|
||||||
|
errMsg = StringDUtil.changeNullToEmpty(hashMap.get("errMsg"));
|
||||||
|
Object data1 = hashMap.get("data");
|
||||||
|
if (data1 != null) {
|
||||||
|
resultMap.put("data", data1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
errMsg = "调用后台错误,状态码" + statusCodeValue;
|
||||||
|
LogUtil.error(this.getClass(), errMsg);
|
||||||
|
errCode = "999";
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
errCode = "999";
|
||||||
|
errMsg = "调用后台请求错误,原因" + e.getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
resultMap.put("errCode", errCode);
|
||||||
|
resultMap.put("errMsg", errMsg);
|
||||||
|
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
428
src/main/java/com/saye/hrs/commons/string/StringDUtil.java
Normal file
428
src/main/java/com/saye/hrs/commons/string/StringDUtil.java
Normal file
@@ -0,0 +1,428 @@
|
|||||||
|
package com.saye.hrs.commons.string;
|
||||||
|
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public class StringDUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 去掉给定字符串前和后的空格,返回干净的字符串
|
||||||
|
* @param str
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public static String removeSpaces(Object args) {
|
||||||
|
|
||||||
|
String argsStr = changeNullToEmpty(args);
|
||||||
|
if(args!=null){
|
||||||
|
args = argsStr.trim();
|
||||||
|
while (argsStr.startsWith(" ")) {
|
||||||
|
argsStr = argsStr.substring(1, argsStr.length()).trim();
|
||||||
|
}
|
||||||
|
while (argsStr.endsWith(" ")) {
|
||||||
|
argsStr = argsStr.substring(0, argsStr.length() - 1).trim();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
argsStr = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return argsStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转全角的函数
|
||||||
|
* @param str
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public static String toSBC(String input) {
|
||||||
|
//半角转全角:
|
||||||
|
char[] c = input.toCharArray();
|
||||||
|
for (int i = 0; i < c.length; i++) {
|
||||||
|
if (c[i] == 32) {
|
||||||
|
c[i] = (char) 12288;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (c[i] < 127) {
|
||||||
|
c[i] = (char) (c[i] + 65248);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new String(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转半角的函数
|
||||||
|
* @param str
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
public static String toDBC(String input) {
|
||||||
|
char[] c = input.toCharArray();
|
||||||
|
for (int i = 0; i < c.length; i++) {
|
||||||
|
if (c[i] == 12288) {
|
||||||
|
c[i] = (char) 32;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (c[i] > 65280 && c[i] < 65375){
|
||||||
|
c[i] = (char) (c[i] - 65248);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new String(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 为每添加一个元素前面增加指定的分隔 除第一个元素之外
|
||||||
|
* @param str
|
||||||
|
* @param appStr
|
||||||
|
* @param compart
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static StringBuffer appendElement(StringBuffer strB,String appStr,String compart){
|
||||||
|
|
||||||
|
//当出入参数为NULL时
|
||||||
|
if(strB == null){
|
||||||
|
return new StringBuffer(appStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
//当没有元素时直接添加追加元素 否则先添加分隔符
|
||||||
|
if(strB.length() == 0){
|
||||||
|
strB.append(appStr);
|
||||||
|
}else{
|
||||||
|
strB.append(compart);
|
||||||
|
strB.append(appStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return strB;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除元素
|
||||||
|
* @param str
|
||||||
|
* @param moveStr
|
||||||
|
* @param compart
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static StringBuffer moveElement(StringBuffer strB,String moveStr,String compart){
|
||||||
|
|
||||||
|
//当出入参数为NULL时
|
||||||
|
if(strB == null){
|
||||||
|
return strB;
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuffer newStrB = new StringBuffer();
|
||||||
|
|
||||||
|
String[] strArray = strB.toString().split(compart);
|
||||||
|
for(int i=0;i<strArray.length;i++){
|
||||||
|
|
||||||
|
if(moveStr.equals(strArray[i])){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i == 0){
|
||||||
|
newStrB.append(strArray[i]);
|
||||||
|
}else{
|
||||||
|
newStrB.append(compart);
|
||||||
|
newStrB.append(strArray[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return newStrB;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除第一个匹配的元素
|
||||||
|
* @param str
|
||||||
|
* @param moveStr
|
||||||
|
* @param compart
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static StringBuffer moveFirstElement(StringBuffer strB,String moveStr,String compart){
|
||||||
|
|
||||||
|
//当出入参数为NULL时
|
||||||
|
if(strB == null){
|
||||||
|
return strB;
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuffer newStrB = new StringBuffer();
|
||||||
|
|
||||||
|
String[] strArray = strB.toString().split(compart);
|
||||||
|
boolean tag = false;
|
||||||
|
for(int i=0;i<strArray.length;i++){
|
||||||
|
|
||||||
|
if(moveStr.equals(strArray[i]) == true && tag == false){
|
||||||
|
tag = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i == 0){
|
||||||
|
newStrB.append(strArray[i]);
|
||||||
|
}else{
|
||||||
|
newStrB.append(compart);
|
||||||
|
newStrB.append(strArray[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return newStrB;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从给定字符中 返回所含的中文字符 并按每组以以字符串数组的形式返回
|
||||||
|
* @param src
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String[] getChinese(String src){
|
||||||
|
|
||||||
|
List list = new ArrayList();
|
||||||
|
|
||||||
|
byte[] srcByte = src.getBytes();
|
||||||
|
int srcLength = srcByte.length;
|
||||||
|
|
||||||
|
|
||||||
|
int begin = -1;
|
||||||
|
int end = -1;
|
||||||
|
|
||||||
|
for(int i=0;i<srcLength;i++){
|
||||||
|
|
||||||
|
//设置中文的开始位
|
||||||
|
if(srcByte[i] < 0 && begin == -1){
|
||||||
|
begin = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置中文的结束位
|
||||||
|
if(srcByte[i] > 0 && begin != -1 && end == -1){
|
||||||
|
end = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//如果已经找到中文的开始 但直到最后也没找到中文的结束,则将字符的结束位当成中文的截止位
|
||||||
|
if(begin != -1 && i == srcLength - 1){
|
||||||
|
end = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//将中文提取出来
|
||||||
|
if(begin != -1 && end != -1){
|
||||||
|
|
||||||
|
|
||||||
|
int tempLength = end-begin+1;
|
||||||
|
if(tempLength % 2 != 0){
|
||||||
|
tempLength = tempLength - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
byte[] tempByte = new byte[tempLength];
|
||||||
|
System.arraycopy(srcByte, begin, tempByte, 0, tempLength);
|
||||||
|
|
||||||
|
list.add(new String(tempByte));
|
||||||
|
|
||||||
|
begin = -1;
|
||||||
|
end = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//将中文以数组输出
|
||||||
|
int size = list.size();
|
||||||
|
String[] chineseArray = new String[size];
|
||||||
|
for(int i=0;i<size;i++){
|
||||||
|
chineseArray[i] = list.get(i).toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
return chineseArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产生指定长度的随机码(由字母和数字组成)
|
||||||
|
* @param len
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String generateRandomCodeForLength(int len){
|
||||||
|
|
||||||
|
String s = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||||
|
StringBuffer sRand = new StringBuffer();
|
||||||
|
|
||||||
|
Random random=new Random();
|
||||||
|
|
||||||
|
for (int i = 0; i < len; i++) {
|
||||||
|
|
||||||
|
String ch = String.valueOf(s.charAt(random.nextInt(s.length())));
|
||||||
|
sRand.append(ch);
|
||||||
|
}
|
||||||
|
return sRand.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将字符串NULL转换为空:""
|
||||||
|
* @param args
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String changeNullToEmpty(Object args) {
|
||||||
|
|
||||||
|
String result = null == args ? "" : String.valueOf(args);
|
||||||
|
if("\"null\"".equals(result) || "null".equals(result)){
|
||||||
|
result = "";
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将字符串NULL转换为空:"",并且去字符串中的转义字符
|
||||||
|
* @param args
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String changeNullToEmptyReplaceEscape(Object args) {
|
||||||
|
|
||||||
|
String result = null == args ? "" : String.valueOf(args);
|
||||||
|
result = result.replaceAll("'", "");
|
||||||
|
result = result.replaceAll("{", "{");
|
||||||
|
result = result.replaceAll("}", "}");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证字符串是否为空:NULL或""
|
||||||
|
* @param str
|
||||||
|
* @return 返回值为true,说明是为空。
|
||||||
|
*/
|
||||||
|
public static Boolean isEmpty(Object args) {
|
||||||
|
|
||||||
|
String result = "";
|
||||||
|
String str = changeNullToEmpty(args);
|
||||||
|
|
||||||
|
if("".equals(removeSpaces(str)) || "\"null\"".equals(removeSpaces(str)) || "null".equals(removeSpaces(str))){
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证MAP中要验证的字段是否为空:NULL或""
|
||||||
|
* @param hm 要验证的MAP
|
||||||
|
* @param fieldString 传入方式(以,将字段进行分割),如:personid,sysid
|
||||||
|
* @return 返回值为空,则验证成功,说明都不为空;否则返回为空的该字段名。
|
||||||
|
*/
|
||||||
|
public static String isExistEmpty(Map<Object, Object> hm, String fieldString) {
|
||||||
|
|
||||||
|
String[] strArr = fieldString.split(",");
|
||||||
|
for (int i = 0; i < strArr.length; i++) {
|
||||||
|
|
||||||
|
String key = strArr[i];
|
||||||
|
Object obj = hm.get(key);
|
||||||
|
if(isEmpty(obj)){
|
||||||
|
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断字符串是否为正整数
|
||||||
|
* @param str
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean isPositiveInteger (String str){
|
||||||
|
Pattern pattern = Pattern.compile("^[0-9]*[1-9][0-9]*$");
|
||||||
|
return pattern.matcher(str).matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断字符串是否为正整数或正浮点数
|
||||||
|
* @param str
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean isPositiveIntegerOrPositiveFloat (String str){
|
||||||
|
Pattern pattern = Pattern.compile("^(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*))$");
|
||||||
|
return pattern.matcher(str).matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @description 截取字符串
|
||||||
|
* @author mczheng
|
||||||
|
* @created 2016-6-25 下午6:13:29
|
||||||
|
* @param str 要截取的字符串
|
||||||
|
* @param maxLength 字符长度,英文字符算0.5个长度,当截取剩下最后一位是0.5个长度而最后一个字符是中文时,则舍弃掉。
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String substring(String str, int maxLength) {
|
||||||
|
if (!hasLength(str))
|
||||||
|
return str;
|
||||||
|
|
||||||
|
int subSLength = maxLength * 2;
|
||||||
|
int tempSubLength = subSLength;//截取字符数
|
||||||
|
String subStr = "";
|
||||||
|
try {
|
||||||
|
int strLen = str.getBytes("GBK").length;
|
||||||
|
if (strLen <= subSLength) return str;
|
||||||
|
subStr = str.substring(0, str.length() < subSLength ? str.length() : subSLength); //截取的子串
|
||||||
|
int subStrByetsL = subStr.getBytes("GBK").length; //截取子串的字节长度
|
||||||
|
//说明截取的字符串中包含有汉字
|
||||||
|
while (subStrByetsL > tempSubLength) {
|
||||||
|
int subSLengthTemp = --subSLength;
|
||||||
|
subStr = str.substring(0, subSLengthTemp > str.length() ? str.length() : subSLengthTemp);
|
||||||
|
subStrByetsL = subStr.getBytes("GBK").length;
|
||||||
|
}
|
||||||
|
subStr += "...";
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return subStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean hasLength(String str) {
|
||||||
|
return (str != null) && (str.length() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
//
|
||||||
|
// StringBuffer str = new StringBuffer("a,c,d,c");
|
||||||
|
// str = StringDUtil.moveFirstElement(str, "c", ",");
|
||||||
|
// System.out.println(str.toString());
|
||||||
|
//
|
||||||
|
// System.out.println(isEmpty("\"null\""));
|
||||||
|
System.out.println(StringDUtil.substring("一二三四五六七八九十一二三四五六七八九十一二三四五六七八九十", 15));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 判断字符串是否有值且值不为空格
|
||||||
|
* @author thuang
|
||||||
|
* @created 2020年1月7日 下午1:09:49
|
||||||
|
* @param str
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean isNotBlank(String str) {
|
||||||
|
if (str != null && str.length() > 0 && str.trim().length() > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String randomInt(int length) {
|
||||||
|
if (length < 1) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Random randGen = new Random();
|
||||||
|
char[] numbersAndLetters = "0123456789abcdefghijklmnopqrstuvwxyz".toCharArray();
|
||||||
|
char[] randBuffer = new char[length];
|
||||||
|
for (int i = 0; i < randBuffer.length; i++) {
|
||||||
|
randBuffer[i] = numbersAndLetters[randGen.nextInt(36)];
|
||||||
|
}
|
||||||
|
return new String(randBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
24
src/main/java/com/saye/hrs/commons/uuid/UUIDGenerator.java
Normal file
24
src/main/java/com/saye/hrs/commons/uuid/UUIDGenerator.java
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package com.saye.hrs.commons.uuid;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class UUIDGenerator {
|
||||||
|
public UUIDGenerator() {
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获得一个UUID
|
||||||
|
* @return String UUID
|
||||||
|
*/
|
||||||
|
public static String getUUID(){
|
||||||
|
String s = UUID.randomUUID().toString();
|
||||||
|
//去掉“-”符号
|
||||||
|
return s.substring(0,8)+s.substring(9,13)+s.substring(14,18)+s.substring(19,23)+s.substring(24);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args){
|
||||||
|
|
||||||
|
String ss = UUIDGenerator.getUUID();
|
||||||
|
System.out.println(ss);
|
||||||
|
System.out.println(ss.length());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,278 @@
|
|||||||
|
package com.saye.hrs.commons.webservice;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import org.dom4j.Document;
|
||||||
|
import org.dom4j.DocumentException;
|
||||||
|
import org.dom4j.DocumentHelper;
|
||||||
|
import org.dom4j.Element;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import static com.saye.hrs.commons.webservice.WSUtil.addHisLog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mr.zs
|
||||||
|
* @date 2024/10/31
|
||||||
|
*/
|
||||||
|
public class HisInterfaceUtils {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(HisInterfaceUtils.class);
|
||||||
|
|
||||||
|
|
||||||
|
private static String czyh = "0421";
|
||||||
|
public static String prod_soapUrl = "http://12.0.2.1:10062/KWSService.asmx";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用webservice接口 his系统的
|
||||||
|
*
|
||||||
|
* @param url
|
||||||
|
* @param tranCode
|
||||||
|
* @param inputXml
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static HashMap<String, String> webserviceRequest(String url, String tranCode, String inputXml) {
|
||||||
|
logger.info("请求参数----------" + inputXml);
|
||||||
|
HashMap<String, String> resultMap = new HashMap<>();
|
||||||
|
String errCode = "0";
|
||||||
|
String errMsg = "";
|
||||||
|
try {
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
MediaType type = MediaType.parseMediaType("text/xml;charset=UTF-8");
|
||||||
|
// 请求类型ContentType text/xml;charset=UTF-8
|
||||||
|
headers.setContentType(type);
|
||||||
|
|
||||||
|
// 请求数据体
|
||||||
|
StringBuffer soapRequestData = new StringBuffer("");
|
||||||
|
soapRequestData.append("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:kws=\"http://www.winning.com.cn/KWS/\">");
|
||||||
|
soapRequestData.append("<soapenv:Header/>");
|
||||||
|
soapRequestData.append("<soapenv:Body>");
|
||||||
|
soapRequestData.append("<kws:WebBusiness>");
|
||||||
|
soapRequestData.append("<kws:TranCode>");
|
||||||
|
|
||||||
|
// 交易码
|
||||||
|
soapRequestData.append(tranCode);
|
||||||
|
|
||||||
|
soapRequestData.append("</kws:TranCode>");
|
||||||
|
soapRequestData.append("<kws:InXml>");
|
||||||
|
|
||||||
|
//<>符号要转码
|
||||||
|
inputXml = inputXml.replaceAll("<", "<");
|
||||||
|
inputXml = inputXml.replaceAll(">", ">");
|
||||||
|
|
||||||
|
soapRequestData.append(inputXml);
|
||||||
|
|
||||||
|
soapRequestData.append("</kws:InXml>");
|
||||||
|
soapRequestData.append("</kws:WebBusiness>");
|
||||||
|
soapRequestData.append("</soapenv:Body>");
|
||||||
|
soapRequestData.append("</soapenv:Envelope>");
|
||||||
|
|
||||||
|
String str = HttpUtil.createPost(url).body(soapRequestData + "").header("Content-Type", "text/xml;charset=UTF-8").execute().body();
|
||||||
|
|
||||||
|
logger.info("返回结果----------" + str);
|
||||||
|
Document document = DocumentHelper.parseText(str);
|
||||||
|
Element rootElt = document.getRootElement();
|
||||||
|
|
||||||
|
// 解析
|
||||||
|
Iterator body = rootElt.elementIterator("Body");
|
||||||
|
Element recordEless = (Element) body.next();
|
||||||
|
|
||||||
|
Iterator callHisResponse = recordEless.elementIterator("WebBusinessResponse");
|
||||||
|
Element hisResponse = (Element) callHisResponse.next();
|
||||||
|
|
||||||
|
Iterator callHisResult = hisResponse.elementIterator("OutXml");
|
||||||
|
Element hisResult = (Element) callHisResult.next();
|
||||||
|
|
||||||
|
String text = hisResult.getText();
|
||||||
|
|
||||||
|
resultMap.put("outXml", text);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.info("返回结果异常----------" + e.toString());
|
||||||
|
errCode = "999";
|
||||||
|
errMsg = e.getMessage();
|
||||||
|
}
|
||||||
|
resultMap.put("errCode", errCode);
|
||||||
|
resultMap.put("errMsg", errMsg);
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HashMap<Object, Object> getDoctors(String selectDate, String selectKsdm) throws DocumentException {
|
||||||
|
List<HashMap<Object, Object>> list = null;
|
||||||
|
|
||||||
|
String inputXml = "<request><partner>320582467223232</partner><sign></sign><timestamp>20170704000513</timestamp>" +
|
||||||
|
"<operid>01</operid><password></password><kfsdm></kfsdm>" +
|
||||||
|
"<params><ksrq>" + selectDate + "</ksrq>" + // 开始日期
|
||||||
|
"<jsrq>" + selectDate + "</jsrq>" + // 结束日期
|
||||||
|
"<lb>" + 2 + "</lb>" + // 类别
|
||||||
|
"<ksdm>" + selectKsdm + "</ksdm>" + // 科室代码
|
||||||
|
"</params></request>";
|
||||||
|
HashMap<String, String> map = webserviceRequest(prod_soapUrl, "301", inputXml);
|
||||||
|
addHisLog("查询指定科室下的有排班的医生", inputXml, map.get("outXml"));
|
||||||
|
String errCode = map.get("errCode");
|
||||||
|
String errMsg = map.get("errMsg");
|
||||||
|
if ("0".equals(errCode)) {
|
||||||
|
String outXml = map.get("outXml");
|
||||||
|
Document document = DocumentHelper.parseText(outXml);
|
||||||
|
Element rootElt = document.getRootElement();
|
||||||
|
|
||||||
|
// 将xml转换为java对象
|
||||||
|
Iterator iterator = rootElt.elementIterator();
|
||||||
|
|
||||||
|
Element codeElm = (Element) iterator.next();
|
||||||
|
Element msgElm = (Element) iterator.next();
|
||||||
|
|
||||||
|
errCode = codeElm.getText();
|
||||||
|
errMsg = msgElm.getText();
|
||||||
|
|
||||||
|
if ("0".equals(errCode)) {
|
||||||
|
list = new ArrayList<>();
|
||||||
|
Element Items = (Element) iterator.next();
|
||||||
|
|
||||||
|
Iterator itemIterator = Items.elementIterator();
|
||||||
|
|
||||||
|
while (itemIterator.hasNext()) {
|
||||||
|
HashMap<Object, Object> addMap = new HashMap<>();
|
||||||
|
Element item = (Element) itemIterator.next();
|
||||||
|
|
||||||
|
Element ysdmEl = item.element("ysdm");
|
||||||
|
String ysdm = ysdmEl == null ? "" : ysdmEl.getText();
|
||||||
|
|
||||||
|
// 医生代码。通过这个字段查询该医生的头像和简介,之后拼接信息返回
|
||||||
|
// http://12.0.2.1:8081/dataManager/doctorInfo/getDoctorInfoByDoctorCode
|
||||||
|
HashMap<String, Object> reqMap = new HashMap<>();
|
||||||
|
reqMap.put("doctorCode", ysdm);
|
||||||
|
String s = HttpUtil.get("http://12.0.2.1:8081/dataManager/doctorInfo/getDoctorInfoByDoctorCode?doctorCode=" + ysdm);
|
||||||
|
JSONObject entries = JSONUtil.parseObj(s);
|
||||||
|
if (Convert.toInt(entries.get("status")) > 0) {// 获取医生信息成功
|
||||||
|
Object data = entries.get("data");
|
||||||
|
JSONObject doctInfo = JSONUtil.parseObj(data);
|
||||||
|
addMap.put("imageUrl", "https://fy.btlsoln.com:8443/storage/" + doctInfo.get("image"));
|
||||||
|
addMap.put("introduction", doctInfo.get("doctorinfo"));
|
||||||
|
addMap.put("doctorzc", doctInfo.get("doctorzc").toString().replaceAll("#", " "));
|
||||||
|
}
|
||||||
|
Element ysmcEl = item.element("ysmc");
|
||||||
|
String ysmc = ysmcEl == null ? "" : ysmcEl.getText();
|
||||||
|
|
||||||
|
Element zcMcEl = item.element("zc_mc");
|
||||||
|
String zcMc = zcMcEl == null ? "" : zcMcEl.getText();
|
||||||
|
|
||||||
|
Element ksdmEl = item.element("ksdm");
|
||||||
|
String ksdm = ksdmEl == null ? "" : ksdmEl.getText();
|
||||||
|
|
||||||
|
Element ksmcEl = item.element("ksmc");
|
||||||
|
String ksmc = ksmcEl == null ? "" : ksmcEl.getText();
|
||||||
|
|
||||||
|
|
||||||
|
addMap.put("ksdm", ksdm);
|
||||||
|
addMap.put("ksmc", ksmc);
|
||||||
|
addMap.put("ysdm", ysdm);
|
||||||
|
addMap.put("ysmc", ysmc);
|
||||||
|
addMap.put("zcMc", zcMc);
|
||||||
|
list.add(addMap);
|
||||||
|
}
|
||||||
|
// if (CollUtil.isNotEmpty(list)){//遍历list查询每个医生的头像和简介
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HashMap<Object, Object> resultMap = new HashMap<Object, Object>();
|
||||||
|
resultMap.put("list", list);
|
||||||
|
resultMap.put("errCode", errCode);
|
||||||
|
resultMap.put("errMsg", errMsg);
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HashMap<Object, Object> getDoctorScheduling(String selectDate, String selectKmdm) throws DocumentException {
|
||||||
|
List<HashMap<Object, Object>> list = null;
|
||||||
|
|
||||||
|
String inputXml = "<request><partner>320582467223232</partner><sign></sign><timestamp>20170704000513</timestamp>" +
|
||||||
|
"<operid>01</operid><password></password><kfsdm></kfsdm>" +
|
||||||
|
"<params><ksrq>" + selectDate + "</ksrq>" + // 开始日期
|
||||||
|
"<jsrq>" + selectDate + "</jsrq>" + // 结束日期
|
||||||
|
"<lb>" + 2 + "</lb>" + // 类别
|
||||||
|
"<kmdm>" + selectKmdm + "</kmdm>" + // 选中的医生代码
|
||||||
|
"</params></request>";
|
||||||
|
HashMap<String, String> map = webserviceRequest(prod_soapUrl, "301", inputXml);
|
||||||
|
addHisLog("查询指定科室下的有排班的医生", inputXml, map.get("outXml"));
|
||||||
|
String errCode = map.get("errCode");
|
||||||
|
String errMsg = map.get("errMsg");
|
||||||
|
if ("0".equals(errCode)) {
|
||||||
|
String outXml = map.get("outXml");
|
||||||
|
Document document = DocumentHelper.parseText(outXml);
|
||||||
|
Element rootElt = document.getRootElement();
|
||||||
|
|
||||||
|
// 将xml转换为java对象
|
||||||
|
Iterator iterator = rootElt.elementIterator();
|
||||||
|
|
||||||
|
Element codeElm = (Element) iterator.next();
|
||||||
|
Element msgElm = (Element) iterator.next();
|
||||||
|
|
||||||
|
errCode = codeElm.getText();
|
||||||
|
errMsg = msgElm.getText();
|
||||||
|
|
||||||
|
if ("0".equals(errCode)) {
|
||||||
|
list = new ArrayList<>();
|
||||||
|
Element Items = (Element) iterator.next();
|
||||||
|
|
||||||
|
Iterator itemIterator = Items.elementIterator();
|
||||||
|
|
||||||
|
while (itemIterator.hasNext()) {
|
||||||
|
HashMap<Object, Object> addMap = new HashMap<>();
|
||||||
|
Element item = (Element) itemIterator.next();
|
||||||
|
|
||||||
|
Element kyysEl = item.element("kyys");
|
||||||
|
String kyys = kyysEl == null ? "" : kyysEl.getText();
|
||||||
|
|
||||||
|
Element yyzsEl = item.element("yyzs");
|
||||||
|
String yyzs = yyzsEl == null ? "" : yyzsEl.getText();
|
||||||
|
|
||||||
|
Element pbmxidEl = item.element("pbmxid");
|
||||||
|
String pbmxid = pbmxidEl == null ? "" : pbmxidEl.getText();
|
||||||
|
|
||||||
|
Element zxrqEl = item.element("zxrq");
|
||||||
|
String zxrq = zxrqEl == null ? "" : zxrqEl.getText();
|
||||||
|
|
||||||
|
Element kssjEl = item.element("kssj");
|
||||||
|
String kssj = kssjEl == null ? "" : kssjEl.getText();
|
||||||
|
|
||||||
|
Element jssjEl = item.element("jssj");
|
||||||
|
String jssj = jssjEl == null ? "" : jssjEl.getText();
|
||||||
|
|
||||||
|
|
||||||
|
Element weekdayEl = item.element("weekday");
|
||||||
|
String weekday = weekdayEl == null ? "" : weekdayEl.getText();
|
||||||
|
|
||||||
|
|
||||||
|
Element ghfEl = item.element("ghf");
|
||||||
|
String ghf = ghfEl == null ? "" : ghfEl.getText();
|
||||||
|
addMap.put("kyys", kyys);
|
||||||
|
addMap.put("yyzs", yyzs);
|
||||||
|
addMap.put("pbmxid", pbmxid);
|
||||||
|
addMap.put("zxrq", zxrq);
|
||||||
|
addMap.put("kssj", kssj);
|
||||||
|
addMap.put("jssj", jssj);
|
||||||
|
addMap.put("weekday", weekday);
|
||||||
|
addMap.put("ghf", ghf);
|
||||||
|
list.add(addMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
|
list.sort(Comparator.comparing(o -> o.get("kssj").toString()));
|
||||||
|
}
|
||||||
|
HashMap<Object, Object> resultMap = new HashMap<Object, Object>();
|
||||||
|
resultMap.put("list", list);
|
||||||
|
resultMap.put("errCode", errCode);
|
||||||
|
resultMap.put("errMsg", errMsg);
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
570
src/main/java/com/saye/hrs/commons/webservice/OtherWSUtil.java
Normal file
570
src/main/java/com/saye/hrs/commons/webservice/OtherWSUtil.java
Normal file
@@ -0,0 +1,570 @@
|
|||||||
|
package com.saye.hrs.commons.webservice;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||||
|
import com.saye.hrs.commons.string.StringDUtil;
|
||||||
|
import com.saye.hrs.dto.*;
|
||||||
|
import com.saye.hrs.model.StatusDefine;
|
||||||
|
import com.saye.hrs.vo.FeeInfoDetailVO;
|
||||||
|
import com.saye.hrs.vo.FeeInfoVO;
|
||||||
|
import com.saye.hrs.vo.MZJSPreDetailVO;
|
||||||
|
import com.saye.hrs.vo.MZJSPreVO;
|
||||||
|
import org.dom4j.Document;
|
||||||
|
import org.dom4j.DocumentHelper;
|
||||||
|
import org.dom4j.Element;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.http.*;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
public class OtherWSUtil {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(OtherWSUtil.class);
|
||||||
|
public static RestTemplate restTemplate = new RestTemplate();
|
||||||
|
static HttpHeaders headers;
|
||||||
|
static {
|
||||||
|
headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
||||||
|
}
|
||||||
|
|
||||||
|
// private static final String url="http://168.168.0.213:8081/WebService1.asmx";
|
||||||
|
private static final String url="http://218.84.202.146:8081/webService1.asmx";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调用webservice接口 其他接口
|
||||||
|
*/
|
||||||
|
public static Result<List<FeeInfoVO>> getPatientFeeInfo(PatientFeeQuery reqDTO) {
|
||||||
|
String patid = reqDTO.getPatid();
|
||||||
|
logger.info("请求参数----------patid:"+patid);
|
||||||
|
String errCode="0";
|
||||||
|
String errMsg="";
|
||||||
|
Result<List<FeeInfoVO>> resultObj=null;
|
||||||
|
try {
|
||||||
|
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
MediaType type = MediaType.parseMediaType("text/xml;charset=UTF-8");
|
||||||
|
// 请求类型ContentType text/xml;charset=UTF-8
|
||||||
|
headers.setContentType(type);
|
||||||
|
|
||||||
|
//请求数据体
|
||||||
|
String soapRequestData = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\">" +
|
||||||
|
"<soapenv:Header/>" +
|
||||||
|
"<soapenv:Body>" +
|
||||||
|
"<tem:GetFeeInfo>" +
|
||||||
|
"<tem:patid>" + patid + "</tem:patid>" +
|
||||||
|
"</tem:GetFeeInfo>" +
|
||||||
|
"</soapenv:Body>" +
|
||||||
|
"</soapenv:Envelope>";
|
||||||
|
|
||||||
|
// 请求
|
||||||
|
HttpEntity<String> request = new HttpEntity<String>(soapRequestData + "", headers);
|
||||||
|
|
||||||
|
// 返回结果
|
||||||
|
String str = restTemplate.postForObject(url, request, String.class);
|
||||||
|
logger.info("返回结果----------"+str);
|
||||||
|
Document document= DocumentHelper.parseText(str);
|
||||||
|
Element rootElt = document.getRootElement();
|
||||||
|
|
||||||
|
//解析
|
||||||
|
Iterator body = rootElt.elementIterator("Body");
|
||||||
|
Element recordEless = (Element) body.next();
|
||||||
|
|
||||||
|
Iterator callHisResponse = recordEless.elementIterator("GetFeeInfoResponse");
|
||||||
|
Element response = (Element) callHisResponse.next();
|
||||||
|
|
||||||
|
Iterator callHisResult = response.elementIterator("GetFeeInfoResult");
|
||||||
|
Element result = (Element)callHisResult.next();
|
||||||
|
|
||||||
|
String text = result.getText();
|
||||||
|
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(text);
|
||||||
|
|
||||||
|
Integer code = jsonObject.getInteger("Code");
|
||||||
|
|
||||||
|
if (code==0){
|
||||||
|
JSONArray item = jsonObject.getJSONArray("Item");
|
||||||
|
List<FeeInfoVO> javaList = item.toJavaList(FeeInfoVO.class);
|
||||||
|
|
||||||
|
//将javaList中的体检部分合并
|
||||||
|
List<FeeInfoVO> javaListNew = new ArrayList<>();
|
||||||
|
List<FeeInfoDetailVO> detailNew = new ArrayList<>();
|
||||||
|
FeeInfoVO xytj = new FeeInfoVO();
|
||||||
|
BigDecimal xytjValue = new BigDecimal("0.000000");
|
||||||
|
DecimalFormat df = new DecimalFormat("0.00");
|
||||||
|
|
||||||
|
String xytjCfxh = "";
|
||||||
|
String xytjOrderid = "";
|
||||||
|
for (int i = 0; i < javaList.size(); i++) {
|
||||||
|
if(javaList.get(i).getMemo().equals("体检开单写入")){
|
||||||
|
//体检的需要合并
|
||||||
|
// "patid": "1015880",
|
||||||
|
// "hzxm": null,
|
||||||
|
// "yfdm": "",
|
||||||
|
// "zhye": "",
|
||||||
|
// "cfje": "3.000000",
|
||||||
|
// "cfmxsl": "1",
|
||||||
|
// "cflx": "6",
|
||||||
|
// "yfmc": "",
|
||||||
|
// "cfxh": "7841668",
|
||||||
|
// "cardno": "352229201802274531",
|
||||||
|
// "out_ksmc": "",
|
||||||
|
// "ghxh": "0",
|
||||||
|
// "orderId": "JJ20240517155343228",
|
||||||
|
xytj.setPatid(javaList.get(i).getPatid());
|
||||||
|
xytj.setHzxm(javaList.get(i).getHzxm());
|
||||||
|
xytj.setYfdm(javaList.get(i).getYfdm());
|
||||||
|
xytj.setZhye(javaList.get(i).getZhye());
|
||||||
|
|
||||||
|
xytjValue = xytjValue.add(new BigDecimal(javaList.get(i).getCfje()));
|
||||||
|
xytjValue = xytjValue.setScale(2, RoundingMode.HALF_UP);
|
||||||
|
xytj.setCfje(df.format(xytjValue));
|
||||||
|
|
||||||
|
xytj.setCfmxsl(javaList.get(i).getCfmxsl());
|
||||||
|
xytj.setCflx(javaList.get(i).getCflx());
|
||||||
|
xytj.setYfmc(javaList.get(i).getYfmc());
|
||||||
|
|
||||||
|
xytjCfxh = xytjCfxh.concat(javaList.get(i).getCfxh());
|
||||||
|
if(javaList.size() != (i + 1)){
|
||||||
|
xytjCfxh = xytjCfxh.concat(",");
|
||||||
|
}
|
||||||
|
xytj.setCfxh(xytjCfxh);
|
||||||
|
xytj.setCardno(javaList.get(i).getCardno());
|
||||||
|
xytj.setOut_ksmc(javaList.get(i).getOut_ksmc());
|
||||||
|
xytj.setGhxh(javaList.get(i).getGhxh());
|
||||||
|
|
||||||
|
if(!(javaList.get(i).getLrrq().equals(""))){
|
||||||
|
//2024052711:18:12
|
||||||
|
//格式化日期
|
||||||
|
String lrrq = javaList.get(i).getLrrq().substring(0, 4) + "/" +
|
||||||
|
javaList.get(i).getLrrq().substring(4, 6) + "/" +
|
||||||
|
javaList.get(i).getLrrq().substring(6, 8) + " " +
|
||||||
|
javaList.get(i).getLrrq().substring(8, 16);
|
||||||
|
javaList.get(i).setLrrq(lrrq);
|
||||||
|
}
|
||||||
|
|
||||||
|
xytj.setLrrq(javaList.get(i).getLrrq());
|
||||||
|
|
||||||
|
// xytjOrderid = xytjOrderid.concat(javaList.get(i).getOrderId());
|
||||||
|
// if(javaList.size() != (i + 1)){
|
||||||
|
// xytjOrderid = xytjOrderid.concat(",");
|
||||||
|
// }
|
||||||
|
// xytj.setOrderId(xytjOrderid);
|
||||||
|
xytj.setOrderId(javaList.get(i).getOrderId());
|
||||||
|
|
||||||
|
FeeInfoDetailVO detailTmp = javaList.get(i).getDetail().get(0);
|
||||||
|
Double number = Double.parseDouble(javaList.get(i).getDetail().get(0).getXmje());
|
||||||
|
detailTmp.setXmje(df.format(number));
|
||||||
|
detailNew.add(detailTmp);
|
||||||
|
xytj.setMemo("体检开单写入");
|
||||||
|
}else{
|
||||||
|
FeeInfoVO newItem = new FeeInfoVO();
|
||||||
|
newItem = javaList.get(i);
|
||||||
|
if(!(newItem.getLrrq().equals(""))){
|
||||||
|
//2024052711:18:12
|
||||||
|
//格式化日期
|
||||||
|
String lrrq = newItem.getLrrq().substring(0, 4) + "/" +
|
||||||
|
newItem.getLrrq().substring(4, 6) + "/" +
|
||||||
|
newItem.getLrrq().substring(6, 8) + " " +
|
||||||
|
newItem.getLrrq().substring(8, 16);
|
||||||
|
newItem.setLrrq(lrrq);
|
||||||
|
}
|
||||||
|
javaListNew.add(newItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if(xytj.getPatid() != null){
|
||||||
|
xytj.setDetail(detailNew);
|
||||||
|
javaListNew.add(xytj);
|
||||||
|
}
|
||||||
|
|
||||||
|
resultObj = Result.returnSuccess(javaListNew);
|
||||||
|
// resultObj = Result.returnSuccess(javaList);
|
||||||
|
}else{
|
||||||
|
errCode= String.valueOf(code);
|
||||||
|
errMsg=jsonObject.getString("Message");
|
||||||
|
resultObj = Result.returnError(errCode,errMsg);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("返回结果异常----------"+e.toString());
|
||||||
|
errCode="999";
|
||||||
|
errMsg=e.getMessage();
|
||||||
|
resultObj=Result.returnError(errCode,errMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result<MZJSPreVO> PreSettlement(PreSettlementQuery reqDTO, String yyjzhye) {
|
||||||
|
String errCode="0";
|
||||||
|
String errMsg="";
|
||||||
|
|
||||||
|
String jsonString = JSON.toJSONString(reqDTO, SerializerFeature.DisableCircularReferenceDetect);
|
||||||
|
logger.info("请求参数----------"+jsonString);
|
||||||
|
|
||||||
|
Result<MZJSPreVO> resultObj=null;
|
||||||
|
try {
|
||||||
|
|
||||||
|
String patid = reqDTO.getPatid();
|
||||||
|
String cfxh = reqDTO.getCfxh();
|
||||||
|
String ghxh = reqDTO.getGhxh();
|
||||||
|
String zfjsbz = reqDTO.getZfjsbz();
|
||||||
|
|
||||||
|
String ybrc = reqDTO.getYbrc();
|
||||||
|
String inpayAuthNo = reqDTO.getInpayAuthNo();
|
||||||
|
String uldLatlnt = reqDTO.getUldLatlnt();
|
||||||
|
|
||||||
|
if (ybrc==null){
|
||||||
|
ybrc="";
|
||||||
|
}
|
||||||
|
if (inpayAuthNo==null){
|
||||||
|
inpayAuthNo="";
|
||||||
|
}
|
||||||
|
if (uldLatlnt==null || "".equals(uldLatlnt)){
|
||||||
|
uldLatlnt="0,0";
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
MediaType type = MediaType.parseMediaType("text/xml;charset=UTF-8");
|
||||||
|
// 请求类型ContentType text/xml;charset=UTF-8
|
||||||
|
headers.setContentType(type);
|
||||||
|
|
||||||
|
String soapRequestData="<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\">" +
|
||||||
|
" <soapenv:Header/>" +
|
||||||
|
" <soapenv:Body>" +
|
||||||
|
" <tem:MZJSPre>" +
|
||||||
|
" <tem:patid>"+patid+"</tem:patid>" +
|
||||||
|
" <tem:cfxh>"+cfxh+"</tem:cfxh>" +
|
||||||
|
" <tem:ghxh>"+ghxh+"</tem:ghxh>" +
|
||||||
|
" <tem:zfjsbz>"+zfjsbz+"</tem:zfjsbz>" +
|
||||||
|
" <tem:ybrc>"+ybrc+"</tem:ybrc>" +
|
||||||
|
" <tem:Blance>"+yyjzhye+"</tem:Blance>" +
|
||||||
|
" <tem:InpayAuthNo>"+inpayAuthNo+"</tem:InpayAuthNo>" +
|
||||||
|
" <tem:uldLatlnt>"+uldLatlnt+"</tem:uldLatlnt>" +
|
||||||
|
" </tem:MZJSPre>" +
|
||||||
|
" </soapenv:Body>" +
|
||||||
|
"</soapenv:Envelope>";
|
||||||
|
|
||||||
|
// 请求
|
||||||
|
HttpEntity<String> request = new HttpEntity<String>(soapRequestData + "", headers);
|
||||||
|
|
||||||
|
// 返回结果
|
||||||
|
String str = restTemplate.postForObject(url, request, String.class);
|
||||||
|
logger.info("返回结果----------"+str);
|
||||||
|
Document document= DocumentHelper.parseText(str);
|
||||||
|
Element rootElt = document.getRootElement();
|
||||||
|
|
||||||
|
//解析
|
||||||
|
Iterator body = rootElt.elementIterator("Body");
|
||||||
|
Element recordEless = (Element) body.next();
|
||||||
|
|
||||||
|
Iterator callHisResponse = recordEless.elementIterator("MZJSPreResponse");
|
||||||
|
Element response = (Element) callHisResponse.next();
|
||||||
|
|
||||||
|
Iterator callHisResult = response.elementIterator("MZJSPreResult");
|
||||||
|
Element result = (Element)callHisResult.next();
|
||||||
|
|
||||||
|
String text = result.getText();
|
||||||
|
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(text);
|
||||||
|
|
||||||
|
Integer code = jsonObject.getInteger("Code");
|
||||||
|
|
||||||
|
if (code==0){
|
||||||
|
JSONObject detail = jsonObject.getJSONObject("detail");
|
||||||
|
String payOrdId = jsonObject.getString("payOrdId");
|
||||||
|
String payToken = jsonObject.getString("payToken");
|
||||||
|
String gmt_out_create = jsonObject.getString("gmt_out_create");
|
||||||
|
String hosp_out_trade_no = jsonObject.getString("hosp_out_trade_no");
|
||||||
|
|
||||||
|
MZJSPreDetailVO javaObject = detail.toJavaObject(MZJSPreDetailVO.class);
|
||||||
|
|
||||||
|
MZJSPreVO mzjsPreVO=new MZJSPreVO();
|
||||||
|
mzjsPreVO.setDetail(javaObject);
|
||||||
|
mzjsPreVO.setPayOrdId(payOrdId);
|
||||||
|
mzjsPreVO.setPayToken(payToken);
|
||||||
|
mzjsPreVO.setGmt_out_create(gmt_out_create);
|
||||||
|
mzjsPreVO.setHosp_out_trade_no(hosp_out_trade_no);
|
||||||
|
|
||||||
|
//将预结算信息存储到服务器后台
|
||||||
|
String jsonString1 = JSON.toJSONString(mzjsPreVO);
|
||||||
|
String jsonString2 = JSON.toJSONString(javaObject);
|
||||||
|
HashMap hashMap = JSON.parseObject(jsonString1, HashMap.class);
|
||||||
|
hashMap.put("patid",patid);
|
||||||
|
hashMap.put("zfjsbz",zfjsbz);
|
||||||
|
hashMap.put("status","1"); //1 带表预结算
|
||||||
|
hashMap.put("detail",jsonString2); //1 带表预结算
|
||||||
|
hashMap.put("out_ksmc",reqDTO.getOut_ksmc());
|
||||||
|
|
||||||
|
String url2=StatusDefine.IP_PORT+"/api/addOrderInfo";
|
||||||
|
HttpHeaders headers2 = new HttpHeaders();
|
||||||
|
headers2.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
String body2 = JSON.toJSONString(hashMap);
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(body2, headers2);
|
||||||
|
ResponseEntity<HashMap> resp =restTemplate.exchange(url2, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
HashMap resultMap = resp.getBody();
|
||||||
|
|
||||||
|
//如果存储失败直接取消预结算 并返回错误
|
||||||
|
errCode = StringDUtil.changeNullToEmpty(resultMap.get("errCode"));
|
||||||
|
if (!"0".equals(errCode)){
|
||||||
|
CancelPreSettlementDTO cancelPreSettlementDTO=new CancelPreSettlementDTO();
|
||||||
|
cancelPreSettlementDTO.setPayOrdId(payOrdId);
|
||||||
|
cancelPreSettlementDTO.setJssjh(javaObject.getSjh());
|
||||||
|
cancelPreSettlementDTO.setPayToken(payToken);
|
||||||
|
cancelPreSettlementDTO.setZfjsbz(zfjsbz);
|
||||||
|
CancelPreSettlement(cancelPreSettlementDTO);
|
||||||
|
|
||||||
|
errMsg="保存订单信息失败,请联系管理员。";
|
||||||
|
resultObj=Result.returnError(errCode,errMsg);
|
||||||
|
}else{
|
||||||
|
resultObj=Result.returnSuccess(mzjsPreVO);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
errCode= String.valueOf(code);
|
||||||
|
errMsg=jsonObject.getString("Message");
|
||||||
|
resultObj=Result.returnError(errCode,errMsg);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error("返回结果异常----------"+e.toString());
|
||||||
|
errCode="999";
|
||||||
|
errMsg=e.getMessage();
|
||||||
|
resultObj=Result.returnError(errCode,errMsg);
|
||||||
|
}
|
||||||
|
return resultObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HashMap<Object, Object> Settlement(SettlementDTO reqDTO) {
|
||||||
|
HashMap<Object,Object> resultMap=new HashMap<>();
|
||||||
|
String errCode="0";
|
||||||
|
String errMsg="";
|
||||||
|
|
||||||
|
String jsonString = JSON.toJSONString(reqDTO, SerializerFeature.DisableCircularReferenceDetect);
|
||||||
|
logger.info("请求参数----------"+jsonString);
|
||||||
|
try {
|
||||||
|
String patid = reqDTO.getPatid();
|
||||||
|
String sjh = reqDTO.getSjh();
|
||||||
|
String zje = reqDTO.getZje();
|
||||||
|
String ysje = reqDTO.getYsje();
|
||||||
|
String paytype = reqDTO.getPaytype();
|
||||||
|
String paymoney = reqDTO.getPaymoney();
|
||||||
|
String paylsh = reqDTO.getPaylsh();
|
||||||
|
String zfjsbz = reqDTO.getZfjsbz();
|
||||||
|
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
MediaType type = MediaType.parseMediaType("text/xml;charset=UTF-8");
|
||||||
|
// 请求类型ContentType text/xml;charset=UTF-8
|
||||||
|
headers.setContentType(type);
|
||||||
|
|
||||||
|
String soapRequestData="<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\">" +
|
||||||
|
" <soapenv:Header/>" +
|
||||||
|
" <soapenv:Body>" +
|
||||||
|
" <tem:MZJS>" +
|
||||||
|
" <tem:patid>"+patid+"</tem:patid>" +
|
||||||
|
" <tem:sjh>"+sjh+"</tem:sjh>" +
|
||||||
|
" <tem:zje>"+zje+"</tem:zje>" +
|
||||||
|
" <tem:ysje>"+ysje+"</tem:ysje>" +
|
||||||
|
" <tem:paytype>"+paytype+"</tem:paytype>" +
|
||||||
|
" <tem:paymoney>"+paymoney+"</tem:paymoney>" +
|
||||||
|
" <tem:paylsh>"+paylsh+"</tem:paylsh>" +
|
||||||
|
" <tem:zfjsbz>"+zfjsbz+"</tem:zfjsbz>" +
|
||||||
|
" </tem:MZJS>" +
|
||||||
|
" </soapenv:Body>" +
|
||||||
|
"</soapenv:Envelope>";
|
||||||
|
|
||||||
|
// 请求
|
||||||
|
HttpEntity<String> request = new HttpEntity<String>(soapRequestData + "", headers);
|
||||||
|
|
||||||
|
// 返回结果
|
||||||
|
String str = restTemplate.postForObject(url, request, String.class);
|
||||||
|
logger.info("返回结果----------"+str);
|
||||||
|
Document document= DocumentHelper.parseText(str);
|
||||||
|
Element rootElt = document.getRootElement();
|
||||||
|
|
||||||
|
//解析
|
||||||
|
Iterator body = rootElt.elementIterator("Body");
|
||||||
|
Element recordEless = (Element) body.next();
|
||||||
|
|
||||||
|
Iterator callHisResponse = recordEless.elementIterator("MZJSResponse");
|
||||||
|
Element response = (Element) callHisResponse.next();
|
||||||
|
|
||||||
|
Iterator callHisResult = response.elementIterator("MZJSResult");
|
||||||
|
Element result = (Element)callHisResult.next();
|
||||||
|
|
||||||
|
String text = result.getText();
|
||||||
|
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(text);
|
||||||
|
|
||||||
|
Integer code = jsonObject.getInteger("Code");
|
||||||
|
|
||||||
|
if (code==0){
|
||||||
|
//成功应该就没了
|
||||||
|
|
||||||
|
|
||||||
|
}else{
|
||||||
|
errCode= String.valueOf(code);
|
||||||
|
errMsg=jsonObject.getString("Message");
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error("返回结果异常----------"+e.toString());
|
||||||
|
errCode="999";
|
||||||
|
errMsg=e.getMessage();
|
||||||
|
}
|
||||||
|
resultMap.put("errCode",errCode);
|
||||||
|
resultMap.put("errMsg",errMsg);
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static HashMap<Object, Object> CancelPreSettlement(CancelPreSettlementDTO reqDTO) {
|
||||||
|
HashMap<Object,Object> resultMap=new HashMap<>();
|
||||||
|
String errCode="0";
|
||||||
|
String errMsg="";
|
||||||
|
|
||||||
|
String jsonString = JSON.toJSONString(reqDTO, SerializerFeature.DisableCircularReferenceDetect);
|
||||||
|
logger.info("请求参数----------"+jsonString);
|
||||||
|
try {
|
||||||
|
|
||||||
|
String jssjh = reqDTO.getJssjh();
|
||||||
|
String zfjsbz = reqDTO.getZfjsbz();
|
||||||
|
String payToken = reqDTO.getPayToken();
|
||||||
|
String payOrdId = reqDTO.getPayOrdId();
|
||||||
|
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
MediaType type = MediaType.parseMediaType("text/xml;charset=UTF-8");
|
||||||
|
// 请求类型ContentType text/xml;charset=UTF-8
|
||||||
|
headers.setContentType(type);
|
||||||
|
|
||||||
|
String soapRequestData="<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:tem=\"http://tempuri.org/\">" +
|
||||||
|
" <soapenv:Header/>" +
|
||||||
|
" <soapenv:Body>" +
|
||||||
|
" <tem:MZJSCancel>" +
|
||||||
|
" <tem:jssjh>"+jssjh+"</tem:jssjh>" +
|
||||||
|
" <tem:zfjsbz>"+zfjsbz+"</tem:zfjsbz>" +
|
||||||
|
" <tem:payOrdId>"+payOrdId+"</tem:payOrdId>" +
|
||||||
|
" <tem:payToken>"+payToken+"</tem:payToken>" +
|
||||||
|
" </tem:MZJSCancel>" +
|
||||||
|
" </soapenv:Body>" +
|
||||||
|
"</soapenv:Envelope>";
|
||||||
|
|
||||||
|
// 请求
|
||||||
|
HttpEntity<String> request = new HttpEntity<String>(soapRequestData + "", headers);
|
||||||
|
|
||||||
|
// 返回结果
|
||||||
|
String str = restTemplate.postForObject(url, request, String.class);
|
||||||
|
logger.info("返回结果----------"+str);
|
||||||
|
Document document= DocumentHelper.parseText(str);
|
||||||
|
Element rootElt = document.getRootElement();
|
||||||
|
|
||||||
|
//解析
|
||||||
|
Iterator body = rootElt.elementIterator("Body");
|
||||||
|
Element recordEless = (Element) body.next();
|
||||||
|
|
||||||
|
Iterator callHisResponse = recordEless.elementIterator("MZJSCancelResponse");
|
||||||
|
Element response = (Element) callHisResponse.next();
|
||||||
|
|
||||||
|
Iterator callHisResult = response.elementIterator("MZJSCancelResult");
|
||||||
|
Element result = (Element)callHisResult.next();
|
||||||
|
|
||||||
|
String text = result.getText();
|
||||||
|
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(text);
|
||||||
|
|
||||||
|
Integer code = jsonObject.getInteger("Code");
|
||||||
|
|
||||||
|
if (code==0){
|
||||||
|
String sjh = jsonObject.getString("sjh");
|
||||||
|
resultMap.put("sjh",sjh);
|
||||||
|
}else{
|
||||||
|
errCode= String.valueOf(code);
|
||||||
|
errMsg=jsonObject.getString("Message");
|
||||||
|
}
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error("返回结果异常----------"+e.toString());
|
||||||
|
errCode="999";
|
||||||
|
errMsg=e.getMessage();
|
||||||
|
}
|
||||||
|
resultMap.put("errCode",errCode);
|
||||||
|
resultMap.put("errMsg",errMsg);
|
||||||
|
return resultMap;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result<List<HashMap<Object, Object>>> getUnPayInfo(PatientFeeQuery reqDTO) {
|
||||||
|
String errCode="0";
|
||||||
|
String errMsg="";
|
||||||
|
Result<List<HashMap<Object, Object>>> resultObj=null;
|
||||||
|
try {
|
||||||
|
//附加没有完成的订单
|
||||||
|
HashMap<Object,Object> hashMap=new HashMap<>();
|
||||||
|
hashMap.put("patid",reqDTO.getPatid());
|
||||||
|
|
||||||
|
String url2= StatusDefine.IP_PORT+"/api/findOrderInfo";
|
||||||
|
HttpHeaders headers2 = new HttpHeaders();
|
||||||
|
headers2.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
String body2 = JSON.toJSONString(hashMap);
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(body2, headers2);
|
||||||
|
ResponseEntity<HashMap> resp =restTemplate.exchange(url2, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
HashMap resultMap = resp.getBody();
|
||||||
|
String errCode1 = StringDUtil.changeNullToEmpty(resultMap.get("errCode"));
|
||||||
|
if("0".equals(errCode1)){
|
||||||
|
List<HashMap<Object, Object>> list = (List<HashMap<Object, Object>>) resultMap.get("list");
|
||||||
|
resultObj=Result.returnSuccess(list);
|
||||||
|
|
||||||
|
//取消这些订单
|
||||||
|
for (HashMap<Object, Object> map : list) {
|
||||||
|
String zfjsbz = StringDUtil.changeNullToEmpty(map.get("zfjsbz"));
|
||||||
|
String payToken = StringDUtil.changeNullToEmpty(map.get("payToken"));
|
||||||
|
String payOrdId = StringDUtil.changeNullToEmpty(map.get("payOrdId"));
|
||||||
|
String hosp_out_trade_no = StringDUtil.changeNullToEmpty(map.get("hosp_out_trade_no"));
|
||||||
|
|
||||||
|
String detail = StringDUtil.changeNullToEmpty(map.get("detail"));
|
||||||
|
|
||||||
|
HashMap hashMap1 = JSON.parseObject(detail, HashMap.class);
|
||||||
|
|
||||||
|
String sjh = StringDUtil.changeNullToEmpty(hashMap1.get("sjh"));
|
||||||
|
|
||||||
|
CancelPreSettlementDTO cancelPreSettlementDTO=new CancelPreSettlementDTO();
|
||||||
|
cancelPreSettlementDTO.setPayOrdId(payOrdId);
|
||||||
|
cancelPreSettlementDTO.setJssjh(sjh);
|
||||||
|
cancelPreSettlementDTO.setPayToken(payToken);
|
||||||
|
cancelPreSettlementDTO.setZfjsbz(zfjsbz);
|
||||||
|
CancelPreSettlement(cancelPreSettlementDTO);
|
||||||
|
|
||||||
|
//取消后通知后台,将状态改为4 已结束
|
||||||
|
HashMap<Object,Object> updateEnd=new HashMap<>();
|
||||||
|
updateEnd.put("hosp_out_trade_no",hosp_out_trade_no);
|
||||||
|
String url3= StatusDefine.IP_PORT+"/api/updateOrderInfoEnd";
|
||||||
|
HttpHeaders headers3 = new HttpHeaders();
|
||||||
|
headers3.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
String body3 = JSON.toJSONString(updateEnd);
|
||||||
|
HttpEntity<String> entity3 = new HttpEntity<String>(body3, headers3);
|
||||||
|
restTemplate.exchange(url3, HttpMethod.POST, entity3, HashMap.class);
|
||||||
|
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
errCode=errCode1;
|
||||||
|
errMsg=StringDUtil.changeNullToEmpty(resultMap.get("errMsg"));
|
||||||
|
resultObj=Result.returnError(errCode,errMsg);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error("返回结果异常----------"+e.toString());
|
||||||
|
errCode="999";
|
||||||
|
errMsg=e.getMessage();
|
||||||
|
resultObj=Result.returnError(errCode,errMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultObj;
|
||||||
|
}
|
||||||
|
}
|
||||||
4771
src/main/java/com/saye/hrs/commons/webservice/WSUtil.java
Normal file
4771
src/main/java/com/saye/hrs/commons/webservice/WSUtil.java
Normal file
File diff suppressed because it is too large
Load Diff
111
src/main/java/com/saye/hrs/commons/wx/ClientDemo.java
Normal file
111
src/main/java/com/saye/hrs/commons/wx/ClientDemo.java
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
package com.saye.hrs.commons.wx;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|
||||||
|
import javax.crypto.Mac;
|
||||||
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
import java.io.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.security.InvalidKeyException;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 签名生成
|
||||||
|
*/
|
||||||
|
public class ClientDemo {
|
||||||
|
//合作方id,密钥,
|
||||||
|
public final static String partnerId = "50004350";
|
||||||
|
private String partnerSecret;
|
||||||
|
private String wxApiUrl;
|
||||||
|
private final static char[] hexArray = "0123456789abcdef".toCharArray();
|
||||||
|
private static String cityCode="652800";//城市编码平台分配
|
||||||
|
private String channel;//渠道号(微信医保平台分配)
|
||||||
|
private String orgChnlCrtfCodg;//机构渠道认证编码 国家局反馈单
|
||||||
|
private String orgCodg;//定点医药机构编码 国家局反馈单
|
||||||
|
private String orgAppId;//定点医药机构应用ID 国家局反馈单
|
||||||
|
private static String bizType="04107";//线上核验业务类型编码 医保移动支付业务填04107;
|
||||||
|
|
||||||
|
public ClientDemo(String partnerSecret,String orgChnlCrtfCodg,String orgCodg,String orgAppId,String wxApiUrl,String channel){
|
||||||
|
this.partnerSecret=partnerSecret;
|
||||||
|
this.orgChnlCrtfCodg=orgChnlCrtfCodg;
|
||||||
|
this.orgCodg=orgCodg;
|
||||||
|
this.orgAppId=orgAppId;
|
||||||
|
this.channel=channel;
|
||||||
|
this.wxApiUrl=wxApiUrl+partnerId;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String bytesToHex(byte[] bytes) {
|
||||||
|
char[] hexChars = new char[bytes.length * 2];
|
||||||
|
for (int j = 0; j < bytes.length; j++) {
|
||||||
|
int v = bytes[j] & 0Xff;
|
||||||
|
hexChars[j * 2] = hexArray[v >>> 4];
|
||||||
|
hexChars[j * 2 + 1] = hexArray[v & 0x0F];
|
||||||
|
}
|
||||||
|
return new String(hexChars);
|
||||||
|
}
|
||||||
|
|
||||||
|
//授权链接拼接
|
||||||
|
public String getPath(){
|
||||||
|
StringBuilder path=new StringBuilder("auth/pages/bindcard/auth/index?");
|
||||||
|
path.append("openType=").append("getAuthCode");
|
||||||
|
path.append("&cityCode=").append(cityCode);
|
||||||
|
path.append("&channel=").append(channel);
|
||||||
|
path.append("&orgChnlCrtfCodg=").append(orgChnlCrtfCodg);
|
||||||
|
path.append("&orgCodg=").append(orgCodg);
|
||||||
|
path.append("&bizType=").append(bizType);
|
||||||
|
path.append("&orgAppId=").append(orgAppId);
|
||||||
|
|
||||||
|
return path.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
//返回生成的签名
|
||||||
|
private String createSignature(String partnerSecret, String partnerId, String timestamp)
|
||||||
|
throws UnsupportedEncodingException, NoSuchAlgorithmException, InvalidKeyException {
|
||||||
|
Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
|
||||||
|
SecretKeySpec secret_key = new SecretKeySpec(partnerSecret.getBytes("UTF-8"), "HmacSHA256");
|
||||||
|
sha256_HMAC.init(secret_key);
|
||||||
|
return bytesToHex(sha256_HMAC.doFinal((partnerId + timestamp).getBytes("UTF-8")));
|
||||||
|
}
|
||||||
|
|
||||||
|
//免密接口请求工具
|
||||||
|
public String postData(String businessName, String funcName, String partnerId, String data)
|
||||||
|
throws IOException, NoSuchAlgorithmException, InvalidKeyException {
|
||||||
|
HttpURLConnection conn = null;
|
||||||
|
URL url = new URL(wxApiUrl);
|
||||||
|
conn = (HttpURLConnection) url.openConnection();
|
||||||
|
conn.setDoOutput(true);
|
||||||
|
conn.setDoInput(true);
|
||||||
|
conn.setRequestMethod("POST");
|
||||||
|
conn.setUseCaches(false);
|
||||||
|
conn.setInstanceFollowRedirects(true);
|
||||||
|
conn.setRequestProperty("Content-Type", "application/json");
|
||||||
|
conn.setRequestProperty("Accept", "application/json");
|
||||||
|
conn.setConnectTimeout(30000);// 连接超时30秒
|
||||||
|
conn.setReadTimeout(30000); // 读取超时30秒
|
||||||
|
|
||||||
|
String timestamp = Long.toString(System.currentTimeMillis());
|
||||||
|
String signature = createSignature(partnerSecret, partnerId, timestamp);
|
||||||
|
String requestId = UUID.randomUUID().toString().replaceAll("-", "");
|
||||||
|
conn.setRequestProperty("god-portal-timestamp", timestamp);
|
||||||
|
conn.setRequestProperty("god-portal-signature", signature);
|
||||||
|
conn.setRequestProperty("god-portal-request-id", requestId);
|
||||||
|
conn.connect();
|
||||||
|
OutputStream os = conn.getOutputStream();
|
||||||
|
os.write(data.getBytes());
|
||||||
|
os.flush();
|
||||||
|
os.close();
|
||||||
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||||
|
InputStream inputStream = conn.getInputStream();
|
||||||
|
byte[] bytes = new byte[1024];
|
||||||
|
int readBytes;
|
||||||
|
while ((readBytes = inputStream.read(bytes)) != -1) {
|
||||||
|
byteArrayOutputStream.write(bytes, 0, readBytes);
|
||||||
|
}
|
||||||
|
bytes = byteArrayOutputStream.toByteArray();
|
||||||
|
inputStream.close();
|
||||||
|
conn.disconnect();
|
||||||
|
return new String(bytes, "utf-8");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
93
src/main/java/com/saye/hrs/commons/wxpay/MyConfig.java
Normal file
93
src/main/java/com/saye/hrs/commons/wxpay/MyConfig.java
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
package com.saye.hrs.commons.wxpay;
|
||||||
|
|
||||||
|
import com.github.wxpay.sdk.WXPayConfig;
|
||||||
|
import com.saye.hrs.commons.wxpay.pojo.WxPay;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
public class MyConfig implements WXPayConfig {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger("error");
|
||||||
|
|
||||||
|
public MyConfig(WxPay wxPay) {
|
||||||
|
this.wxPay = wxPay;
|
||||||
|
}
|
||||||
|
|
||||||
|
private WxPay wxPay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 App ID
|
||||||
|
*
|
||||||
|
* @return App ID
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getAppID() {
|
||||||
|
return wxPay.getAppid();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 Mch ID
|
||||||
|
*
|
||||||
|
* @return Mch ID
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getMchID() {
|
||||||
|
return wxPay.getMchid();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 API 密钥
|
||||||
|
*
|
||||||
|
* @return API密钥
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return wxPay.getWechartkey();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商户证书内容
|
||||||
|
*
|
||||||
|
* @return 商户证书内容
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public InputStream getCertStream() {
|
||||||
|
// 证书的路径
|
||||||
|
String path = wxPay.getPath();
|
||||||
|
log.info("微信证书文件路径:" + path);
|
||||||
|
// 指定读取证书格式为PKCS12
|
||||||
|
FileInputStream instream = null;
|
||||||
|
try {
|
||||||
|
// 读取存放的PKCS12证书文件
|
||||||
|
instream = new FileInputStream(new File(path));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return instream;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP(S) 连接超时时间,单位毫秒
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int getHttpConnectTimeoutMs() {
|
||||||
|
return 8 * 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HTTP(S) 读数据超时时间,单位毫秒
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int getHttpReadTimeoutMs() {
|
||||||
|
return 10 * 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
59
src/main/java/com/saye/hrs/commons/wxpay/WxPayConstants.java
Normal file
59
src/main/java/com/saye/hrs/commons/wxpay/WxPayConstants.java
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
package com.saye.hrs.commons.wxpay;
|
||||||
|
|
||||||
|
import sun.net.www.http.HttpClient;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 常量
|
||||||
|
*/
|
||||||
|
public class WxPayConstants {
|
||||||
|
|
||||||
|
public enum SignType {
|
||||||
|
MD5, HMACSHA256
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final String DOMAIN_API = "api.mch.weixin.qq.com";
|
||||||
|
public static final String DOMAIN_API2 = "api2.mch.weixin.qq.com";
|
||||||
|
public static final String DOMAIN_APIHK = "apihk.mch.weixin.qq.com";
|
||||||
|
public static final String DOMAIN_APIUS = "apius.mch.weixin.qq.com";
|
||||||
|
|
||||||
|
|
||||||
|
public static final String FAIL = "FAIL";
|
||||||
|
public static final String SUCCESS = "SUCCESS";
|
||||||
|
public static final String HMACSHA256 = "HMAC-SHA256";
|
||||||
|
public static final String MD5 = "MD5";
|
||||||
|
|
||||||
|
public static final String FIELD_SIGN = "sign";
|
||||||
|
public static final String FIELD_SIGN_TYPE = "sign_type";
|
||||||
|
|
||||||
|
public static final String WXPAYSDK_VERSION = "WXPaySDK/3.0.9";
|
||||||
|
public static final String USER_AGENT = WXPAYSDK_VERSION +
|
||||||
|
" (" + System.getProperty("os.arch") + " " + System.getProperty("os.name") + " " + System.getProperty("os.version") +
|
||||||
|
") Java/" + System.getProperty("java.version") + " HttpClient/" + HttpClient.class.getPackage().getImplementationVersion();
|
||||||
|
|
||||||
|
public static final String MICROPAY_URL_SUFFIX = "/pay/micropay";
|
||||||
|
public static final String UNIFIEDORDER_URL_SUFFIX = "/pay/unifiedorder";
|
||||||
|
public static final String ORDERQUERY_URL_SUFFIX = "/pay/orderquery";
|
||||||
|
public static final String REVERSE_URL_SUFFIX = "/secapi/pay/reverse";
|
||||||
|
public static final String CLOSEORDER_URL_SUFFIX = "/pay/closeorder";
|
||||||
|
public static final String REFUND_URL_SUFFIX = "/secapi/pay/refund";
|
||||||
|
public static final String REFUNDQUERY_URL_SUFFIX = "/pay/refundquery";
|
||||||
|
public static final String DOWNLOADBILL_URL_SUFFIX = "/pay/downloadbill";
|
||||||
|
public static final String REPORT_URL_SUFFIX = "/payitil/report";
|
||||||
|
public static final String SHORTURL_URL_SUFFIX = "/tools/shorturl";
|
||||||
|
public static final String AUTHCODETOOPENID_URL_SUFFIX = "/tools/authcodetoopenid";
|
||||||
|
|
||||||
|
// sandbox
|
||||||
|
public static final String SANDBOX_MICROPAY_URL_SUFFIX = "/sandboxnew/pay/micropay";
|
||||||
|
public static final String SANDBOX_UNIFIEDORDER_URL_SUFFIX = "/sandboxnew/pay/unifiedorder";
|
||||||
|
public static final String SANDBOX_ORDERQUERY_URL_SUFFIX = "/sandboxnew/pay/orderquery";
|
||||||
|
public static final String SANDBOX_REVERSE_URL_SUFFIX = "/sandboxnew/secapi/pay/reverse";
|
||||||
|
public static final String SANDBOX_CLOSEORDER_URL_SUFFIX = "/sandboxnew/pay/closeorder";
|
||||||
|
public static final String SANDBOX_REFUND_URL_SUFFIX = "/sandboxnew/secapi/pay/refund";
|
||||||
|
public static final String SANDBOX_REFUNDQUERY_URL_SUFFIX = "/sandboxnew/pay/refundquery";
|
||||||
|
public static final String SANDBOX_DOWNLOADBILL_URL_SUFFIX = "/sandboxnew/pay/downloadbill";
|
||||||
|
public static final String SANDBOX_REPORT_URL_SUFFIX = "/sandboxnew/payitil/report";
|
||||||
|
public static final String SANDBOX_SHORTURL_URL_SUFFIX = "/sandboxnew/tools/shorturl";
|
||||||
|
public static final String SANDBOX_AUTHCODETOOPENID_URL_SUFFIX = "/sandboxnew/tools/authcodetoopenid";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
384
src/main/java/com/saye/hrs/commons/wxpay/WxPayDUtil.java
Normal file
384
src/main/java/com/saye/hrs/commons/wxpay/WxPayDUtil.java
Normal file
@@ -0,0 +1,384 @@
|
|||||||
|
package com.saye.hrs.commons.wxpay;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.github.wxpay.sdk.WXPayUtil;
|
||||||
|
import com.github.wxpay.sdk.WXPayConstants.SignType;
|
||||||
|
import com.saye.hrs.commons.JsonUtils;
|
||||||
|
import com.saye.hrs.commons.exception.CustomException;
|
||||||
|
import com.saye.hrs.commons.wxpay.pojo.PassbackParams;
|
||||||
|
import com.saye.hrs.commons.wxpay.pojo.WxResult;
|
||||||
|
import com.saye.hrs.enums.CodeMessageEnum;
|
||||||
|
import com.saye.hrs.model.StatusDefine;
|
||||||
|
import com.saye.hrs.model.WxybResult;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.w3c.dom.Node;
|
||||||
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
|
import javax.crypto.Mac;
|
||||||
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
import javax.servlet.ServletOutputStream;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.transform.OutputKeys;
|
||||||
|
import javax.xml.transform.Transformer;
|
||||||
|
import javax.xml.transform.TransformerFactory;
|
||||||
|
import javax.xml.transform.dom.DOMSource;
|
||||||
|
import javax.xml.transform.stream.StreamResult;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.SecureRandom;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
|
||||||
|
public class WxPayDUtil {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger("error");
|
||||||
|
private static final String SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
|
||||||
|
private static final Random RANDOM = new SecureRandom();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* XML格式字符串转换为Map
|
||||||
|
*
|
||||||
|
* @param strXML XML字符串
|
||||||
|
* @return XML数据转换后的Map
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static Map<String, String> xmlToMap(String strXML) throws Exception {
|
||||||
|
try {
|
||||||
|
Map<String, String> data = new HashMap<>();
|
||||||
|
DocumentBuilder documentBuilder = WxPayXmlDUtil.newDocumentBuilder();
|
||||||
|
InputStream stream = new ByteArrayInputStream(strXML.getBytes("UTF-8"));
|
||||||
|
org.w3c.dom.Document doc = documentBuilder.parse(stream);
|
||||||
|
doc.getDocumentElement().normalize();
|
||||||
|
NodeList nodeList = doc.getDocumentElement().getChildNodes();
|
||||||
|
for (int idx = 0; idx < nodeList.getLength(); ++idx) {
|
||||||
|
Node node = nodeList.item(idx);
|
||||||
|
if (node.getNodeType() == Node.ELEMENT_NODE) {
|
||||||
|
org.w3c.dom.Element element = (org.w3c.dom.Element) node;
|
||||||
|
data.put(element.getNodeName(), element.getTextContent());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
stream.close();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("xml字符串转Map失败" + ex.getMessage());
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("Invalid XML, can not convert to map. Error message: {}. XML content: {}", ex.getMessage(), strXML);
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将Map转换为XML格式的字符串
|
||||||
|
*
|
||||||
|
* @param data Map类型数据
|
||||||
|
* @return XML格式的字符串
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static String mapToXml(Map<String, String> data) throws Exception {
|
||||||
|
org.w3c.dom.Document document = WxPayXmlDUtil.newDocument();
|
||||||
|
org.w3c.dom.Element root = document.createElement("xml");
|
||||||
|
document.appendChild(root);
|
||||||
|
for (String key : data.keySet()) {
|
||||||
|
String value = data.get(key);
|
||||||
|
if (value == null) {
|
||||||
|
value = "";
|
||||||
|
}
|
||||||
|
value = value.trim();
|
||||||
|
org.w3c.dom.Element filed = document.createElement(key);
|
||||||
|
filed.appendChild(document.createTextNode(value));
|
||||||
|
root.appendChild(filed);
|
||||||
|
}
|
||||||
|
TransformerFactory tf = TransformerFactory.newInstance();
|
||||||
|
Transformer transformer = tf.newTransformer();
|
||||||
|
DOMSource source = new DOMSource(document);
|
||||||
|
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
|
||||||
|
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||||
|
StringWriter writer = new StringWriter();
|
||||||
|
StreamResult result = new StreamResult(writer);
|
||||||
|
transformer.transform(source, result);
|
||||||
|
String output = writer.getBuffer().toString();
|
||||||
|
try {
|
||||||
|
writer.close();
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("map转XML失败" + ex.getMessage());
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成带有 sign 的 XML 格式字符串
|
||||||
|
*
|
||||||
|
* @param data Map类型数据
|
||||||
|
* @param key API密钥
|
||||||
|
* @return 含有sign字段的XML
|
||||||
|
*/
|
||||||
|
public static String generateSignedXml(final Map<String, String> data, String key) throws Exception {
|
||||||
|
return generateSignedXml(data, key, SignType.MD5);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成带有 sign 的 XML 格式字符串
|
||||||
|
*
|
||||||
|
* @param data Map类型数据
|
||||||
|
* @param key API密钥
|
||||||
|
* @param signType 签名类型
|
||||||
|
* @return 含有sign字段的XML
|
||||||
|
*/
|
||||||
|
public static String generateSignedXml(final Map<String, String> data, String key, SignType signType) throws Exception {
|
||||||
|
String sign = generateSignature(data, key, signType);
|
||||||
|
data.put(WxPayConstants.FIELD_SIGN, sign);
|
||||||
|
return mapToXml(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断签名是否正确
|
||||||
|
*
|
||||||
|
* @param xmlStr XML格式数据
|
||||||
|
* @param key API密钥
|
||||||
|
* @return 签名是否正确
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static boolean isSignatureValid(String xmlStr, String key) throws Exception {
|
||||||
|
Map<String, String> data = xmlToMap(xmlStr);
|
||||||
|
if (!data.containsKey(WxPayConstants.FIELD_SIGN)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String sign = data.get(WxPayConstants.FIELD_SIGN);
|
||||||
|
return generateSignature(data, key).equals(sign);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断签名是否正确,必须包含sign字段,否则返回false。使用MD5签名。
|
||||||
|
*
|
||||||
|
* @param data Map类型数据
|
||||||
|
* @param key API密钥
|
||||||
|
* @return 签名是否正确
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static boolean isSignatureValid(Map<String, String> data, String key) throws Exception {
|
||||||
|
return isSignatureValid(data, key, SignType.MD5);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断签名是否正确,必须包含sign字段,否则返回false。
|
||||||
|
*
|
||||||
|
* @param data Map类型数据
|
||||||
|
* @param key API密钥
|
||||||
|
* @param signType 签名方式
|
||||||
|
* @return 签名是否正确
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static boolean isSignatureValid(Map<String, String> data, String key, SignType signType) throws Exception {
|
||||||
|
if (!data.containsKey(WxPayConstants.FIELD_SIGN)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String sign = data.get(WxPayConstants.FIELD_SIGN);
|
||||||
|
return generateSignature(data, key, signType).equals(sign);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成签名
|
||||||
|
*
|
||||||
|
* @param data 待签名数据
|
||||||
|
* @param key API密钥
|
||||||
|
* @return 签名
|
||||||
|
*/
|
||||||
|
public static String generateSignature(final Map<String, String> data, String key) throws Exception {
|
||||||
|
return generateSignature(data, key, SignType.MD5);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成签名. 注意,若含有sign_type字段,必须和signType参数保持一致。
|
||||||
|
*
|
||||||
|
* @param data 待签名数据
|
||||||
|
* @param key API密钥
|
||||||
|
* @param signType 签名方式
|
||||||
|
* @return 签名
|
||||||
|
*/
|
||||||
|
public static String generateSignature(final Map<String, String> data, String key, SignType signType) throws Exception {
|
||||||
|
Set<String> keySet = data.keySet();
|
||||||
|
String[] keyArray = keySet.toArray(new String[keySet.size()]);
|
||||||
|
Arrays.sort(keyArray);
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
log.info("genSigData: " + JsonUtils.beanToJson(data));
|
||||||
|
for (String k : keyArray) {
|
||||||
|
if (k.equals(WxPayConstants.FIELD_SIGN)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (data.get(k).trim().length() > 0) {
|
||||||
|
sb.append(k).append("=").append(data.get(k).trim()).append("&");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sb.append("key=").append(key);
|
||||||
|
if (SignType.MD5.equals(signType)) {
|
||||||
|
return MD5(sb.toString()).toUpperCase();
|
||||||
|
} else if (SignType.HMACSHA256.equals(signType)) {
|
||||||
|
return HMACSHA256(sb.toString(), key);
|
||||||
|
} else {
|
||||||
|
throw new Exception(String.format("Invalid sign_type: %s", signType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取随机字符串 Nonce Str
|
||||||
|
*
|
||||||
|
* @return String 随机字符串
|
||||||
|
*/
|
||||||
|
public static String generateNonceStr() {
|
||||||
|
char[] nonceChars = new char[32];
|
||||||
|
for (int index = 0; index < nonceChars.length; ++index) {
|
||||||
|
nonceChars[index] = SYMBOLS.charAt(RANDOM.nextInt(SYMBOLS.length()));
|
||||||
|
}
|
||||||
|
return new String(nonceChars);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成 MD5
|
||||||
|
*
|
||||||
|
* @param data 待处理数据
|
||||||
|
* @return MD5结果
|
||||||
|
*/
|
||||||
|
public static String MD5(String data) throws Exception {
|
||||||
|
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||||
|
byte[] array = md.digest(data.getBytes("UTF-8"));
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (byte item : array) {
|
||||||
|
sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
|
||||||
|
}
|
||||||
|
return sb.toString().toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成 HMACSHA256
|
||||||
|
*
|
||||||
|
* @param data 待处理数据
|
||||||
|
* @param key 密钥
|
||||||
|
* @return 加密结果
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static String HMACSHA256(String data, String key) throws Exception {
|
||||||
|
Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
|
||||||
|
SecretKeySpec secret_key = new SecretKeySpec(key.getBytes("UTF-8"), "HmacSHA256");
|
||||||
|
sha256_HMAC.init(secret_key);
|
||||||
|
byte[] array = sha256_HMAC.doFinal(data.getBytes("UTF-8"));
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (byte item : array) {
|
||||||
|
sb.append(Integer.toHexString((item & 0xFF) | 0x100).substring(1, 3));
|
||||||
|
}
|
||||||
|
return sb.toString().toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Logger getLogger() {
|
||||||
|
Logger logger = LoggerFactory.getLogger("wxpay java sdk");
|
||||||
|
return logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前时间戳,单位秒
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static long getCurrentTimestamp() {
|
||||||
|
return System.currentTimeMillis() / 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前时间戳,单位毫秒
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static long getCurrentTimestampMs() {
|
||||||
|
return System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String s = WxPayDUtil.generateNonceStr();
|
||||||
|
System.out.println(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Map<String, String> fillRequestDataByMD5(Map<String, String> reqData, MyConfig config) throws Exception {
|
||||||
|
reqData.put("appid", config.getAppID());
|
||||||
|
reqData.put("mch_id", config.getMchID());
|
||||||
|
reqData.put("sign", WXPayUtil.generateSignature(reqData, config.getKey(), SignType.MD5));
|
||||||
|
return reqData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendSuccess(HttpServletResponse response) throws IOException {
|
||||||
|
ServletOutputStream out = response.getOutputStream();
|
||||||
|
out.println("SUCCESS");
|
||||||
|
out.flush();
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
//微信回调签名校验
|
||||||
|
public static WxResult wxPaySignatureValid(String xmlStr) {
|
||||||
|
boolean b;
|
||||||
|
try {
|
||||||
|
Map<String, String> map = WXPayUtil.xmlToMap(xmlStr);
|
||||||
|
if(map.isEmpty()) {
|
||||||
|
throw new CustomException(CodeMessageEnum.REQUEST_ERROR.getCode(), "微信异步回调结果失败,xml转map为空");
|
||||||
|
}
|
||||||
|
WxResult wxResult = JSON.parseObject(JSON.toJSONString(map), WxResult.class);
|
||||||
|
log.info("微信异步回调结果:" + JsonUtils.beanToJson(wxResult));
|
||||||
|
// PassbackParams passbackParams = JsonUtils.jsonToBean(URLDecoder.decode(wxResult.getAttach(), "utf-8"), PassbackParams.class);
|
||||||
|
|
||||||
|
//校验签名
|
||||||
|
b = WXPayUtil.isSignatureValid(map, StatusDefine.wxWechartkey);
|
||||||
|
if (!b) {
|
||||||
|
throw new CustomException(CodeMessageEnum.REQUEST_ERROR.getCode(), "微信支付回调验签失败");
|
||||||
|
}
|
||||||
|
log.info("微信支付回调签名验证成功......");
|
||||||
|
|
||||||
|
return wxResult;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("微信支付回调验签失败,原因:"+e.getMessage());
|
||||||
|
}
|
||||||
|
throw new CustomException(CodeMessageEnum.REQUEST_ERROR.getCode(), "微信验签失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WxybResult wxybPaySignatureValid(String xmlStr) {
|
||||||
|
boolean b;
|
||||||
|
try {
|
||||||
|
Map<String, String> map = WXPayUtil.xmlToMap(xmlStr);
|
||||||
|
if(map.isEmpty()) {
|
||||||
|
throw new CustomException(CodeMessageEnum.REQUEST_ERROR.getCode(), "微信医保异步回调结果失败,xml转map为空");
|
||||||
|
}
|
||||||
|
WxybResult wxResult = JSON.parseObject(JSON.toJSONString(map), WxybResult.class);
|
||||||
|
log.info("微信医保异步回调结果:" + JsonUtils.beanToJson(wxResult));
|
||||||
|
// PassbackParams passbackParams = JsonUtils.jsonToBean(URLDecoder.decode(wxResult.getAttach(), "utf-8"), PassbackParams.class);
|
||||||
|
|
||||||
|
//校验签名
|
||||||
|
b = WXPayUtil.isSignatureValid(map, StatusDefine.wxybkey);
|
||||||
|
if (!b) {
|
||||||
|
throw new CustomException(CodeMessageEnum.REQUEST_ERROR.getCode(), "微信医保支付回调验签失败");
|
||||||
|
}
|
||||||
|
log.info("微信医保支付回调签名验证成功......");
|
||||||
|
return wxResult;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
log.error("微信医保支付回调验签失败,原因:"+e.getMessage());
|
||||||
|
}
|
||||||
|
throw new CustomException(CodeMessageEnum.REQUEST_ERROR.getCode(), "微信医保验签失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
27
src/main/java/com/saye/hrs/commons/wxpay/WxPayXmlDUtil.java
Normal file
27
src/main/java/com/saye/hrs/commons/wxpay/WxPayXmlDUtil.java
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package com.saye.hrs.commons.wxpay;
|
||||||
|
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
|
||||||
|
import javax.xml.XMLConstants;
|
||||||
|
import javax.xml.parsers.DocumentBuilder;
|
||||||
|
import javax.xml.parsers.DocumentBuilderFactory;
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
|
public final class WxPayXmlDUtil {
|
||||||
|
public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException {
|
||||||
|
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
|
||||||
|
documentBuilderFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
|
||||||
|
documentBuilderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
|
||||||
|
documentBuilderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
|
||||||
|
documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
|
||||||
|
documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||||
|
documentBuilderFactory.setXIncludeAware(false);
|
||||||
|
documentBuilderFactory.setExpandEntityReferences(false);
|
||||||
|
|
||||||
|
return documentBuilderFactory.newDocumentBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Document newDocument() throws ParserConfigurationException {
|
||||||
|
return newDocumentBuilder().newDocument();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.saye.hrs.commons.wxpay.pojo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class PassbackParams {
|
||||||
|
|
||||||
|
// private String tradeNo;
|
||||||
|
// private String appId;
|
||||||
|
// private String openId;
|
||||||
|
|
||||||
|
private String sjh;
|
||||||
|
private String patid;
|
||||||
|
private String zje;
|
||||||
|
private String zfje;
|
||||||
|
private String ysje;
|
||||||
|
|
||||||
|
}
|
||||||
14
src/main/java/com/saye/hrs/commons/wxpay/pojo/WxPay.java
Normal file
14
src/main/java/com/saye/hrs/commons/wxpay/pojo/WxPay.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package com.saye.hrs.commons.wxpay.pojo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WxPay {
|
||||||
|
private String appid;
|
||||||
|
private String mchid;
|
||||||
|
private String wechartkey;
|
||||||
|
private String secret;
|
||||||
|
private String path;
|
||||||
|
private String domain;
|
||||||
|
|
||||||
|
}
|
||||||
38
src/main/java/com/saye/hrs/commons/wxpay/pojo/WxResult.java
Normal file
38
src/main/java/com/saye/hrs/commons/wxpay/pojo/WxResult.java
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
|
||||||
|
package com.saye.hrs.commons.wxpay.pojo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能描述:微信支付成功返回
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class WxResult {
|
||||||
|
|
||||||
|
private String return_code;
|
||||||
|
private String return_msg;
|
||||||
|
|
||||||
|
private String transaction_id;
|
||||||
|
private String nonce_str;
|
||||||
|
private String bank_type;
|
||||||
|
private String openid;
|
||||||
|
private String sign;
|
||||||
|
private String fee_type;
|
||||||
|
private String mch_id;
|
||||||
|
private int cash_fee;
|
||||||
|
private String out_trade_no;
|
||||||
|
private String appid;
|
||||||
|
private String total_fee;
|
||||||
|
private String trade_type;
|
||||||
|
private String result_code;
|
||||||
|
private String time_end;
|
||||||
|
private String is_subscribe;
|
||||||
|
private String attach;
|
||||||
|
|
||||||
|
private String err_code;
|
||||||
|
private String err_code_des;
|
||||||
|
|
||||||
|
//结算状态
|
||||||
|
private String mzjsStatus;
|
||||||
|
|
||||||
|
}
|
||||||
88
src/main/java/com/saye/hrs/config/LoginFilter.java
Normal file
88
src/main/java/com/saye/hrs/config/LoginFilter.java
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
package com.saye.hrs.config;
|
||||||
|
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.core.io.Resource;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.client.RestClientException;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import com.saye.hrs.controller.ApiController;
|
||||||
|
import com.saye.hrs.model.StatusDefine;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import javax.servlet.*;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class LoginFilter implements Filter {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(ApiController.class);
|
||||||
|
@Override
|
||||||
|
public void init(FilterConfig filterConfig) throws ServletException {
|
||||||
|
|
||||||
|
}
|
||||||
|
static List<String> list= null;
|
||||||
|
static {
|
||||||
|
list = new ArrayList<String>();
|
||||||
|
list.add("/getCode");
|
||||||
|
list.add("/toLogin");
|
||||||
|
list.add("/login");
|
||||||
|
list.add("/logout");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
|
||||||
|
|
||||||
|
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||||
|
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
||||||
|
String url = request.getRequestURI();
|
||||||
|
logger.info("请求地址:"+url);
|
||||||
|
if(url.indexOf("/showFile/")==0) {
|
||||||
|
RestTemplate rt = new RestTemplate();
|
||||||
|
ResponseEntity<Resource> entity = null;
|
||||||
|
try {
|
||||||
|
entity = rt.getForEntity(new URI(StatusDefine.IP_PORT+url), Resource.class);
|
||||||
|
} catch (RestClientException | URISyntaxException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
InputStream in = entity.getBody().getInputStream();
|
||||||
|
|
||||||
|
ServletOutputStream out = null;
|
||||||
|
try {
|
||||||
|
//获取图片存放路径
|
||||||
|
//response.setContentType("multipart/form-data");
|
||||||
|
out = response.getOutputStream();
|
||||||
|
//读取文件流
|
||||||
|
int len = 0;
|
||||||
|
byte[] buffer = new byte[1024 * 10];
|
||||||
|
while ((len = in.read(buffer)) != -1){
|
||||||
|
out.write(buffer,0,len);
|
||||||
|
}
|
||||||
|
out.flush();
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}finally {
|
||||||
|
out.close();
|
||||||
|
in.close();
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
filterChain.doFilter(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void destroy() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
41
src/main/java/com/saye/hrs/config/RestTemplateConfig.java
Normal file
41
src/main/java/com/saye/hrs/config/RestTemplateConfig.java
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
package com.saye.hrs.config;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||||
|
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @title restTemplate
|
||||||
|
* @description TODO 请填写注释
|
||||||
|
* @author thuang
|
||||||
|
* @create 2023/4/12 15:12
|
||||||
|
**/
|
||||||
|
@Configuration
|
||||||
|
public class RestTemplateConfig {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RestTemplate restTemplate;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public RestTemplate restTemplate(@Qualifier("simpleClientHttpRequestFactory") ClientHttpRequestFactory factory) {
|
||||||
|
return new RestTemplate(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ClientHttpRequestFactory simpleClientHttpRequestFactory() {
|
||||||
|
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
|
||||||
|
factory.setConnectTimeout(15000);
|
||||||
|
// 获取数据超时时间 毫秒
|
||||||
|
factory.setReadTimeout(5000);
|
||||||
|
return factory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RestTemplate getInstance(){
|
||||||
|
return restTemplate;
|
||||||
|
}
|
||||||
|
}
|
||||||
64
src/main/java/com/saye/hrs/config/VirtualPathConfig.java
Normal file
64
src/main/java/com/saye/hrs/config/VirtualPathConfig.java
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
package com.saye.hrs.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
|
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||||
|
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
|
||||||
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
|
||||||
|
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description: 配置虚拟路径
|
||||||
|
* @author dqzhang
|
||||||
|
* @created 2019年11月19日 下午3:26:06
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class VirtualPathConfig extends WebMvcConfigurationSupport{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
// registry.addResourceHandler("/images/**").addResourceLocations("file:d:/saye/");
|
||||||
|
registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
|
||||||
|
registry.addResourceHandler("/webjars/**").addResourceLocations(
|
||||||
|
"classpath:/META-INF/resources/webjars/");
|
||||||
|
super.addResourceHandlers(registry);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected void addCorsMappings(CorsRegistry registry) {
|
||||||
|
registry.addMapping("/**")
|
||||||
|
.allowedOrigins("*")
|
||||||
|
.allowedMethods("GET", "HEAD", "POST","PUT", "DELETE", "OPTIONS")
|
||||||
|
.allowedHeaders("*")
|
||||||
|
.exposedHeaders("access-control-allow-headers",
|
||||||
|
"access-control-allow-methods",
|
||||||
|
"access-control-allow-origin",
|
||||||
|
"access-control-max-age",
|
||||||
|
"X-Frame-Options")
|
||||||
|
.allowCredentials(false).maxAge(3600);
|
||||||
|
super.addCorsMappings(registry);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public HttpMessageConverter<String> responseBodyConverter() {
|
||||||
|
return new StringHttpMessageConverter(Charset.forName("UTF-8"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||||
|
converters.add(responseBodyConverter());
|
||||||
|
// 这里必须加上加载默认转换器,不然bug玩死人,并且该bug目前在网络上似乎没有解决方案
|
||||||
|
// 百度,谷歌,各大论坛等。你可以试试去掉。
|
||||||
|
addDefaultHttpMessageConverters(converters);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
|
||||||
|
configurer.favorPathExtension(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
889
src/main/java/com/saye/hrs/controller/ApiController.java
Normal file
889
src/main/java/com/saye/hrs/controller/ApiController.java
Normal file
@@ -0,0 +1,889 @@
|
|||||||
|
package com.saye.hrs.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.saye.hrs.commons.date.DateDUtil;
|
||||||
|
import com.saye.hrs.commons.encrypt.EncryptUtil;
|
||||||
|
import com.saye.hrs.commons.string.StringDUtil;
|
||||||
|
import com.saye.hrs.commons.webservice.WSUtil;
|
||||||
|
import com.saye.hrs.model.MessageVo;
|
||||||
|
import com.saye.hrs.model.StatusDefine;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.http.*;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.client.RestClientException;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author dqzhang
|
||||||
|
* @since 2021-09-15 09:43:02
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@Slf4j
|
||||||
|
public class ApiController {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(ApiController.class);
|
||||||
|
static RestTemplate restTemplate = new RestTemplate();
|
||||||
|
static HttpHeaders headers;
|
||||||
|
|
||||||
|
static {
|
||||||
|
headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
||||||
|
}
|
||||||
|
/* -----------------------------------------------------医院信息---------------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
* @description 查询医院滚动图片通知
|
||||||
|
* @author dqzhang
|
||||||
|
* @created 2021年11月9日 下午4:01:11
|
||||||
|
*/
|
||||||
|
@RequestMapping("/findHospitalNotice")
|
||||||
|
@ResponseBody
|
||||||
|
public String findHospitalNotice(String hos_notice_id) {
|
||||||
|
|
||||||
|
if ("null".equals(hos_notice_id) || null == hos_notice_id) {
|
||||||
|
hos_notice_id = "";
|
||||||
|
}
|
||||||
|
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||||
|
map.put("hos_notice_id", hos_notice_id);
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/findHospitalNotice";
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(JSON.toJSONString(map), headers);
|
||||||
|
ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
|
||||||
|
String data = resp.getBody();
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
* @description 查询医院介绍
|
||||||
|
* @author dqzhang
|
||||||
|
* @created 2021年11月9日 下午4:01:38
|
||||||
|
*/
|
||||||
|
@RequestMapping("/findHospitalAbout")
|
||||||
|
@ResponseBody
|
||||||
|
public Object findHospitalAbout() {
|
||||||
|
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/findHospitalAbout";
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>("{}", headers);
|
||||||
|
ResponseEntity<List> resp = restTemplate.exchange(url, HttpMethod.POST, entity, List.class);
|
||||||
|
List list = resp.getBody();
|
||||||
|
return list.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
* @description 查询医院导航
|
||||||
|
* @author dqzhang
|
||||||
|
* @created 2021年11月9日 下午4:01:38
|
||||||
|
*/
|
||||||
|
@RequestMapping("/findHospital")
|
||||||
|
@ResponseBody
|
||||||
|
public Object findHospital() {
|
||||||
|
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/findHospital";
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>("{}", headers);
|
||||||
|
ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
|
||||||
|
return resp.getBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
* @description 查询就医指南
|
||||||
|
* @author dqzhang
|
||||||
|
* @created 2021年11月9日 下午4:01:38
|
||||||
|
*/
|
||||||
|
@RequestMapping("/findMedicalGuide")
|
||||||
|
@ResponseBody
|
||||||
|
public Object findMedicalGuide() {
|
||||||
|
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/findMedicalGuide";
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>("{}", headers);
|
||||||
|
ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
|
||||||
|
return resp.getBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
* @description 查询就医指南明细
|
||||||
|
* @author dqzhang
|
||||||
|
* @created 2021年11月9日 下午4:01:38
|
||||||
|
*/
|
||||||
|
@RequestMapping("/findMedicalGuideById")
|
||||||
|
@ResponseBody
|
||||||
|
public Object findMedicalGuideById(String medical_guide_id) {
|
||||||
|
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||||
|
map.put("medical_guide_id", medical_guide_id);
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/findMedicalGuideById";
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(JSON.toJSONString(map), headers);
|
||||||
|
ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
|
||||||
|
return resp.getBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
* @description 查询健康百科
|
||||||
|
* @author dqzhang
|
||||||
|
* @created 2021年11月9日 下午4:01:38
|
||||||
|
*/
|
||||||
|
@RequestMapping("/findHospitalArticle")
|
||||||
|
@ResponseBody
|
||||||
|
public Object findHospitalArticle(String hos_article_id) {
|
||||||
|
|
||||||
|
if ("null".equals(hos_article_id) || null == hos_article_id) {
|
||||||
|
hos_article_id = "";
|
||||||
|
}
|
||||||
|
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||||
|
map.put("hos_article_id", hos_article_id);
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/findHospitalArticle";
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(JSON.toJSONString(map), headers);
|
||||||
|
ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
|
||||||
|
return resp.getBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
* @description 查询查询预约须知
|
||||||
|
* @author dqzhang
|
||||||
|
* @created 2021年11月9日 下午4:01:38
|
||||||
|
*/
|
||||||
|
@RequestMapping("/findOrderNotice")
|
||||||
|
@ResponseBody
|
||||||
|
public Object findOrderNotice() {
|
||||||
|
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/findOrderNotice";
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(headers);
|
||||||
|
ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
|
||||||
|
return resp.getBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
* @description 获取消息通知
|
||||||
|
* @author dqzhang
|
||||||
|
* @created 2021年11月20日 下午8:23:43
|
||||||
|
*/
|
||||||
|
@RequestMapping("/findMessageNotice")
|
||||||
|
@ResponseBody
|
||||||
|
public Object findMessageNotice(String openid) {
|
||||||
|
|
||||||
|
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||||
|
map.put("openid", openid);
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/findMessageNotice";
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(JSON.toJSONString(map), headers);
|
||||||
|
ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
|
||||||
|
return resp.getBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
* @description 获取全部消息,包括已读
|
||||||
|
* @author dqzhang
|
||||||
|
* @created 2021年11月20日 下午8:23:43
|
||||||
|
*/
|
||||||
|
@RequestMapping("/findAllMessageNotice")
|
||||||
|
@ResponseBody
|
||||||
|
public Object findAllMessageNotice(String openid) {
|
||||||
|
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||||
|
map.put("openid", openid);
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/findAllMessageNotice";
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(JSON.toJSONString(map), headers);
|
||||||
|
ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
|
||||||
|
return resp.getBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
* @description 设置消息全部已读
|
||||||
|
* @author dqzhang
|
||||||
|
* @created 2021年11月20日 下午8:23:43
|
||||||
|
*/
|
||||||
|
@RequestMapping("/setMessageNoticeAllRead")
|
||||||
|
@ResponseBody
|
||||||
|
public Object setMessageNoticeAllRead(String openid) {
|
||||||
|
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||||
|
map.put("openid", openid);
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/setMessageNoticeAllRead";
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(JSON.toJSONString(map), headers);
|
||||||
|
ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
|
||||||
|
return resp.getBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
* @description 设置消息已读
|
||||||
|
* @author dqzhang
|
||||||
|
* @created 2021年11月20日 下午8:23:43
|
||||||
|
*/
|
||||||
|
@RequestMapping("/setMessageNoticeRead")
|
||||||
|
@ResponseBody
|
||||||
|
public Object setMessageNoticeRead(String id) {
|
||||||
|
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||||
|
map.put("id", id);
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/setMessageNoticeRead";
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(JSON.toJSONString(map), headers);
|
||||||
|
ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
|
||||||
|
return resp.getBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 问题反馈
|
||||||
|
*/
|
||||||
|
@RequestMapping("/problemFeedback")
|
||||||
|
@ResponseBody
|
||||||
|
public Object problemFeedback(String type, String content, String phone, String email) throws Exception {
|
||||||
|
|
||||||
|
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||||
|
map.put("type", type);
|
||||||
|
map.put("content", content);
|
||||||
|
map.put("phone", phone);
|
||||||
|
map.put("email", email);
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/problemFeedback";
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(JSON.toJSONString(map), headers);
|
||||||
|
ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
|
||||||
|
return resp.getBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -----------------------------------------------------微信用户及患者信息------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param code
|
||||||
|
* @return
|
||||||
|
* @description 获取微信openid
|
||||||
|
* @author dqzhang
|
||||||
|
* @created 2021年11月24日 上午10:00:55
|
||||||
|
*/
|
||||||
|
@RequestMapping("/getOpenid")
|
||||||
|
@ResponseBody
|
||||||
|
public String getOpenid(String code) {
|
||||||
|
|
||||||
|
String url = "https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code";
|
||||||
|
url = url.replace("APPID", "wx83bc9715be856b14").replace("SECRET", "8b2d3e8cb0e590c9884d2c278519a200").replace("JSCODE", code); // 正式参数
|
||||||
|
// url = url.replace("APPID", "wx22bb4b22f690e0f7").replace("SECRET","8b5e5eddb00052e4dc7d79f736401d7a").replace("JSCODE",code);//作废
|
||||||
|
|
||||||
|
|
||||||
|
ResponseEntity<String> resp = restTemplate.getForEntity(url, String.class);
|
||||||
|
String body = resp.getBody();
|
||||||
|
JSONObject jo = JSON.parseObject(body);
|
||||||
|
String openid = jo.getString("openid");
|
||||||
|
// 记录最近登录时间
|
||||||
|
try {
|
||||||
|
String url1 = StatusDefine.IP_PORT + "/api/setWXLoginTime";
|
||||||
|
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||||
|
map.put("openid", openid);
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(JSON.toJSONString(map), headers);
|
||||||
|
ResponseEntity<String> resp2 = restTemplate.exchange(url1, HttpMethod.POST, entity, String.class);
|
||||||
|
} catch (RestClientException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return openid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param openid
|
||||||
|
* @return
|
||||||
|
* @description 根据openid获取患者信息
|
||||||
|
* @author dqzhang
|
||||||
|
* @created 2021年11月11日 下午1:46:21
|
||||||
|
*/
|
||||||
|
@RequestMapping("/getPatientByOpenid")
|
||||||
|
@ResponseBody
|
||||||
|
public String getPatientByOpenid(String openid) {
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/getPatientByOpenid";
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||||
|
map.put("openid", openid);
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(JSON.toJSONString(map), headers);
|
||||||
|
ResponseEntity<String> resp2 = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
|
||||||
|
return resp2.getBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据openid获取患者住院信息
|
||||||
|
*
|
||||||
|
* @param openid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/getZyPatientByOpenid")
|
||||||
|
@ResponseBody
|
||||||
|
public String getZyPatientByOpenid(String openid) {
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/getZyPatientByOpenid";
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||||
|
map.put("openid", openid);
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(JSON.toJSONString(map), headers);
|
||||||
|
ResponseEntity<String> resp2 = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
|
||||||
|
return resp2.getBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 微信用户和患者绑定
|
||||||
|
*/
|
||||||
|
@RequestMapping("/patientBindWXUser")
|
||||||
|
@ResponseBody
|
||||||
|
public Object patientBindWXUser(String cardno, String hzxm, String cardtype, String openid, String relate) throws Exception {
|
||||||
|
|
||||||
|
HashMap<Object, Object> map = WSUtil.getPatient(cardno, cardtype);
|
||||||
|
String errCode = StringDUtil.changeNullToEmpty(map.get("errCode"));
|
||||||
|
|
||||||
|
if ("0".equals(errCode)) {
|
||||||
|
HashMap<Object, Object> patientMap = (HashMap<Object, Object>) ((List) map.get("list")).get(0);
|
||||||
|
|
||||||
|
// 判断卡号是否是这个患者的
|
||||||
|
String name = StringDUtil.changeNullToEmpty(patientMap.get("hzxm"));
|
||||||
|
|
||||||
|
if (!name.equals(hzxm)) {
|
||||||
|
map = new HashMap<>();
|
||||||
|
map.put("errCode", "999");
|
||||||
|
map.put("errMsg", "卡号与姓名不匹配");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
patientMap.put("openid", openid);
|
||||||
|
patientMap.put("relate", relate);
|
||||||
|
patientMap.put("medical_card", cardno);
|
||||||
|
log.info("patientBindWXUser patientMap:" + patientMap);
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/patientBindWXUser";
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(JSON.toJSONString(patientMap), headers);
|
||||||
|
ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
|
||||||
|
return resp.getBody();
|
||||||
|
} else {
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 微信用户住院绑定
|
||||||
|
*/
|
||||||
|
@RequestMapping("/zyPatientBindWXUser")
|
||||||
|
@ResponseBody
|
||||||
|
public Object zyPatientBindWXUser(String cardno, String hzxm, String cardtype, String openid, String relate) throws Exception {
|
||||||
|
|
||||||
|
HashMap<Object, Object> map = WSUtil.getZYPatient(cardno, cardtype);
|
||||||
|
String errCode = StringDUtil.changeNullToEmpty(map.get("errCode"));
|
||||||
|
|
||||||
|
if ("0".equals(errCode)) {
|
||||||
|
HashMap<Object, Object> patientMap = (HashMap<Object, Object>) ((List) map.get("list")).get(0);
|
||||||
|
|
||||||
|
// 判断卡号是否是这个患者的
|
||||||
|
String name = StringDUtil.changeNullToEmpty(patientMap.get("hzxm"));
|
||||||
|
|
||||||
|
if (!name.equals(hzxm)) {
|
||||||
|
map = new HashMap<>();
|
||||||
|
map.put("errCode", "999");
|
||||||
|
map.put("errMsg", "卡号与姓名不匹配");
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
patientMap.put("openid", openid);
|
||||||
|
patientMap.put("relate", relate);
|
||||||
|
patientMap.put("zy_card", cardno);
|
||||||
|
patientMap.put("zy_card_type", cardtype);
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/zyPatientBindWXUser";
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(JSON.toJSONString(patientMap), headers);
|
||||||
|
ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
|
||||||
|
return resp.getBody();
|
||||||
|
} else {
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 微信用户和患者解除绑定
|
||||||
|
*/
|
||||||
|
@RequestMapping("/patientUnbindWXUser")
|
||||||
|
@ResponseBody
|
||||||
|
public Object patientUnbindWXUser(String medical_card, String openid) throws Exception {
|
||||||
|
|
||||||
|
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||||
|
map.put("medical_card", medical_card);
|
||||||
|
map.put("openid", openid);
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/patientUnbindWXUser";
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(JSON.toJSONString(map), headers);
|
||||||
|
ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
|
||||||
|
return resp.getBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 修改患者关系
|
||||||
|
*/
|
||||||
|
@RequestMapping("/updatePatient")
|
||||||
|
@ResponseBody
|
||||||
|
public Object updatePatient(String medical_card, String openid, String relate, String type) throws Exception {
|
||||||
|
|
||||||
|
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||||
|
map.put("medical_card", medical_card);
|
||||||
|
map.put("openid", openid);
|
||||||
|
map.put("relate", relate);
|
||||||
|
map.put("type", type);
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/updatePatientByOpenid";
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(JSON.toJSONString(map), headers);
|
||||||
|
ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
|
||||||
|
return resp.getBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 设为默认患者
|
||||||
|
*/
|
||||||
|
@RequestMapping("/setPatientTypeByOpenid")
|
||||||
|
@ResponseBody
|
||||||
|
public Object setPatientTypeByOpenid(String openid, String medical_card) throws Exception {
|
||||||
|
|
||||||
|
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||||
|
map.put("medical_card", medical_card);
|
||||||
|
map.put("openid", openid);
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/setPatientTypeByOpenid";
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(JSON.toJSONString(map), headers);
|
||||||
|
ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, entity, String.class);
|
||||||
|
return resp.getBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -----------------------------------------------------银联商务支付信息-------------------------------------------------- */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
* @description 获取银联商务支付信息
|
||||||
|
* @author dqzhang
|
||||||
|
* @created 2021年11月19日 下午5:31:26
|
||||||
|
*/
|
||||||
|
@RequestMapping("/getPayRequest")
|
||||||
|
@ResponseBody
|
||||||
|
public Object getPayRequest(String openid, String totalAmount, String patid, String cardno, String cardtype) throws Exception {
|
||||||
|
|
||||||
|
cardno = StringDUtil.removeSpaces(cardno);
|
||||||
|
if ("".equals(cardno)) {
|
||||||
|
HashMap<Object, Object> resultMap = new HashMap<Object, Object>();
|
||||||
|
resultMap.put("errCode", "noCardNo");
|
||||||
|
resultMap.put("errMsg", "卡号不能为空!");
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
// 先判断卡号是否已挂失
|
||||||
|
HashMap<Object, Object> map1 = WSUtil.getPatient(cardno, cardtype);
|
||||||
|
String errCode = StringDUtil.changeNullToEmpty(map1.get("errCode"));
|
||||||
|
if ("0".equals(errCode)) {
|
||||||
|
HashMap<Object, Object> patientMap = (HashMap<Object, Object>) ((List) map1.get("list")).get(0);
|
||||||
|
logger.debug("patientMap" + patientMap);
|
||||||
|
String ghbz = StringDUtil.changeNullToEmpty(patientMap.get("gsbz"));
|
||||||
|
if ("1".equals(ghbz)) {
|
||||||
|
HashMap<Object, Object> resultMap = new HashMap<Object, Object>();
|
||||||
|
resultMap.put("errCode", "LossReported");
|
||||||
|
resultMap.put("errMsg", "卡已挂失/停用,请至窗口处理!");
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
String pid = StringDUtil.changeNullToEmpty(patientMap.get("patid"));
|
||||||
|
if ("".equals(pid)) {
|
||||||
|
HashMap<Object, Object> resultMap = new HashMap<Object, Object>();
|
||||||
|
resultMap.put("errCode", "IDCardNotAllowed");
|
||||||
|
resultMap.put("errMsg", "身份证不能充值,请选择其它卡!");
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
HashMap<Object, Object> resultMap = new HashMap<Object, Object>();
|
||||||
|
resultMap.put("errCode", map1.get("errCode"));
|
||||||
|
resultMap.put("errMsg", map1.get("errMsg"));
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal bd = new BigDecimal(totalAmount).multiply(new BigDecimal(100));
|
||||||
|
totalAmount = bd.intValue() + "";
|
||||||
|
TreeMap<Object, Object> map = new TreeMap<Object, Object>();
|
||||||
|
// map.put("msgId", "12YK");
|
||||||
|
map.put("msgSrcId", "12YK");
|
||||||
|
map.put("msgSrc", "WWW.KRLSFYBJ.COM");
|
||||||
|
map.put("msgType", "wx.unifiedOrder");
|
||||||
|
map.put("requestTimestamp", DateDUtil.getTheCurrentTime());
|
||||||
|
String merOrderId = "12YK" + DateDUtil.DateToStr("yyyyMMddHHmmssSSS", new Date())/* + StringDUtil.randomInt(3)*/;
|
||||||
|
map.put("merOrderId", merOrderId);
|
||||||
|
map.put("mid", "898652880620011");
|
||||||
|
map.put("tid", "65954193");
|
||||||
|
map.put("totalAmount", totalAmount);
|
||||||
|
map.put("subOpenId", openid);
|
||||||
|
map.put("tradeType", "MINI");
|
||||||
|
map.put("signType", "SHA256");
|
||||||
|
String key = "KfG8PnwGSK8AXQFKtyfQnKi3x5kcZtDkWX2tctAMhcF5e6Ax";
|
||||||
|
StringBuilder str = new StringBuilder();
|
||||||
|
for (Entry<Object, Object> e : map.entrySet()) {
|
||||||
|
str.append(e.getKey());
|
||||||
|
str.append("=");
|
||||||
|
str.append(e.getValue());
|
||||||
|
str.append("&");
|
||||||
|
}
|
||||||
|
str.deleteCharAt(str.length() - 1);
|
||||||
|
str.append(key);
|
||||||
|
String sign = EncryptUtil.getSHA256Str(str.toString());
|
||||||
|
map.put("sign", sign.toUpperCase());
|
||||||
|
String url = "https://qr.chinaums.com/netpay-route-server/api/";
|
||||||
|
String requestData = JSON.toJSONString(map);
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(requestData, headers);
|
||||||
|
ResponseEntity<HashMap> resp = restTemplate.exchange(url, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
HashMap respBody = resp.getBody();
|
||||||
|
// 支付信息写入本地数据库
|
||||||
|
try {
|
||||||
|
String ec = StringDUtil.changeNullToEmpty(respBody.get("errCode"));
|
||||||
|
if ("SUCCESS".equals(ec)) {
|
||||||
|
url = StatusDefine.IP_PORT + "/api/addPayRequest";
|
||||||
|
HashMap<Object, Object> requestMap = new HashMap<Object, Object>();
|
||||||
|
requestMap.put("merOrderId", merOrderId);
|
||||||
|
requestMap.put("totalAmount", totalAmount);
|
||||||
|
requestMap.put("orderText", JSON.toJSONString(respBody));
|
||||||
|
requestMap.put("patid", patid);
|
||||||
|
requestMap.put("openid", openid);
|
||||||
|
requestMap.put("status", respBody.get("status"));
|
||||||
|
String requestBody = JSON.toJSONString(requestMap);
|
||||||
|
entity = new HttpEntity<String>(requestBody, headers);
|
||||||
|
ResponseEntity<HashMap> result = restTemplate.exchange(url, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
HashMap resultMap = result.getBody();
|
||||||
|
if (!"0".equals(resultMap.get("errCode"))) {
|
||||||
|
logger.error("写入下单信息失败" + resultMap.get("errMsg"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.error("下单信息异常" + JSON.toJSONString(respBody));
|
||||||
|
}
|
||||||
|
} catch (Exception e1) {
|
||||||
|
logger.error("写入下单信息失败" + e1.toString());
|
||||||
|
}
|
||||||
|
return resp.getBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
* @description 支付成功写入his接口
|
||||||
|
* @author dqzhang
|
||||||
|
* @created 2021年11月19日 下午5:31:26
|
||||||
|
*/
|
||||||
|
@RequestMapping("/addHisRecharge")
|
||||||
|
@ResponseBody
|
||||||
|
public Object addhisRecharge(String merOrderId) {
|
||||||
|
|
||||||
|
TreeMap<Object, Object> map = new TreeMap<Object, Object>();
|
||||||
|
map.put("msgSrcId", "12YK");
|
||||||
|
map.put("msgSrc", "WWW.KRLSFYBJ.COM");
|
||||||
|
map.put("msgType", "query");
|
||||||
|
map.put("requestTimestamp", DateDUtil.getTheCurrentTime());
|
||||||
|
map.put("merOrderId", merOrderId);
|
||||||
|
map.put("mid", "898652880620011");
|
||||||
|
map.put("tid", "65954193");
|
||||||
|
map.put("signType", "SHA256");
|
||||||
|
String key = "KfG8PnwGSK8AXQFKtyfQnKi3x5kcZtDkWX2tctAMhcF5e6Ax";
|
||||||
|
StringBuilder str = new StringBuilder();
|
||||||
|
for (Entry<Object, Object> e : map.entrySet()) {
|
||||||
|
str.append(e.getKey());
|
||||||
|
str.append("=");
|
||||||
|
str.append(e.getValue());
|
||||||
|
str.append("&");
|
||||||
|
}
|
||||||
|
str.deleteCharAt(str.length() - 1);
|
||||||
|
str.append(key);
|
||||||
|
String sign = EncryptUtil.getSHA256Str(str.toString());
|
||||||
|
map.put("sign", sign.toUpperCase());
|
||||||
|
String url = "https://qr.chinaums.com/netpay-route-server/api/";
|
||||||
|
String body = JSON.toJSONString(map);
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(body, headers);
|
||||||
|
ResponseEntity<HashMap> resp = restTemplate.exchange(url, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
HashMap result = resp.getBody();
|
||||||
|
String status = StringDUtil.changeNullToEmpty(result.get("status"));
|
||||||
|
String targetOrderId = StringDUtil.changeNullToEmpty(result.get("targetOrderId"));
|
||||||
|
// 支付结果信息写入数据库
|
||||||
|
HashMap<Object, Object> requestMap = new HashMap<Object, Object>();
|
||||||
|
url = StatusDefine.IP_PORT + "/api/addHisRecharge";
|
||||||
|
requestMap.put("status", status);
|
||||||
|
requestMap.put("merOrderId", merOrderId);
|
||||||
|
requestMap.put("targetOrderId", targetOrderId);
|
||||||
|
requestMap.put("resultText", JSON.toJSONString(result));
|
||||||
|
HttpEntity<String> entity1 = new HttpEntity<String>(JSON.toJSONString(requestMap), headers);
|
||||||
|
ResponseEntity<HashMap> resp1 = restTemplate.exchange(url, HttpMethod.POST, entity1, HashMap.class);
|
||||||
|
return resp.getBody();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return
|
||||||
|
* @description 支付成功写入住院his接口
|
||||||
|
* @author dqzhang
|
||||||
|
* @created 2021年11月19日 下午5:31:26
|
||||||
|
*/
|
||||||
|
@RequestMapping("/addZyHisRecharge")
|
||||||
|
@ResponseBody
|
||||||
|
public Object addZyHisRecharge(String merOrderId) {
|
||||||
|
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
* @description 退款
|
||||||
|
* @author dqzhang
|
||||||
|
* @created 2021年11月24日 上午10:04:10
|
||||||
|
*/
|
||||||
|
@RequestMapping("/refund")
|
||||||
|
@ResponseBody
|
||||||
|
public HashMap<Object, Object> refund(@RequestBody Map paramMap) throws Exception {
|
||||||
|
logger.info("退款请求参数" + paramMap);
|
||||||
|
String czyh = StringDUtil.changeNullToEmpty(paramMap.get("czyh"));
|
||||||
|
String hzid = StringDUtil.changeNullToEmpty(paramMap.get("hzid"));
|
||||||
|
String hzxm = StringDUtil.changeNullToEmpty(paramMap.get("hzxm"));
|
||||||
|
String tranType = StringDUtil.changeNullToEmpty(paramMap.get("tranType"));
|
||||||
|
String Amount = StringDUtil.changeNullToEmpty(paramMap.get("Amount"));
|
||||||
|
String payType = StringDUtil.changeNullToEmpty(paramMap.get("payType"));
|
||||||
|
String payCode = StringDUtil.changeNullToEmpty(paramMap.get("payCode"));
|
||||||
|
String originalOrderId = StringDUtil.changeNullToEmpty(paramMap.get("originalOrderId"));
|
||||||
|
String merchantOrderId = StringDUtil.changeNullToEmpty(paramMap.get("merchantOrderId"));
|
||||||
|
|
||||||
|
HashMap<Object, Object> responseMap = new HashMap<Object, Object>();
|
||||||
|
|
||||||
|
String url1 = StatusDefine.IP_PORT + "/api/getRefundTime";
|
||||||
|
String refundTime = restTemplate.getForObject(url1, String.class);
|
||||||
|
String[] rt = refundTime.split("-");
|
||||||
|
String nowTime = DateDUtil.DateToStr("HH:mm:ss", new Date());
|
||||||
|
if (nowTime.compareTo(rt[0]) < 0 || nowTime.compareTo(rt[1]) > 0) {
|
||||||
|
responseMap.put("respCode", "NOT_REFUND_TIME");
|
||||||
|
responseMap.put("errMsg", "退款时间为:" + refundTime);
|
||||||
|
return responseMap;
|
||||||
|
}
|
||||||
|
String errCode = "00";
|
||||||
|
String errMsg = "";
|
||||||
|
|
||||||
|
try {
|
||||||
|
TreeMap<Object, Object> map = new TreeMap<Object, Object>();
|
||||||
|
map.put("msgSrcId", "12YK");
|
||||||
|
map.put("msgSrc", "WWW.KRLSFYBJ.COM");
|
||||||
|
map.put("msgType", "refund");
|
||||||
|
map.put("requestTimestamp", DateDUtil.getTheCurrentTime());
|
||||||
|
map.put("merOrderId", originalOrderId);
|
||||||
|
map.put("mid", "898652880620011");
|
||||||
|
map.put("tid", "65954193");
|
||||||
|
map.put("refundAmount", Amount);
|
||||||
|
map.put("signType", "SHA256");
|
||||||
|
String key = "KfG8PnwGSK8AXQFKtyfQnKi3x5kcZtDkWX2tctAMhcF5e6Ax";
|
||||||
|
StringBuilder str = new StringBuilder();
|
||||||
|
for (Entry<Object, Object> e : map.entrySet()) {
|
||||||
|
str.append(e.getKey());
|
||||||
|
str.append("=");
|
||||||
|
str.append(e.getValue());
|
||||||
|
str.append("&");
|
||||||
|
}
|
||||||
|
str.deleteCharAt(str.length() - 1);
|
||||||
|
str.append(key);
|
||||||
|
String sign = EncryptUtil.getSHA256Str(str.toString());
|
||||||
|
map.put("sign", sign.toUpperCase());
|
||||||
|
String url = "https://qr.chinaums.com/netpay-route-server/api/";
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
String body = JSON.toJSONString(map);
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(body, headers);
|
||||||
|
ResponseEntity<HashMap> res = restTemplate.exchange(url, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
HashMap resultMap = res.getBody();
|
||||||
|
// 成功后写入退款信息
|
||||||
|
if ("SUCCESS".equals(resultMap.get("errCode"))) {
|
||||||
|
|
||||||
|
String refundOrderId = StringDUtil.changeNullToEmpty(resultMap.get("refundOrderId"));
|
||||||
|
responseMap.put("transactionAmount", Amount);
|
||||||
|
responseMap.put("refundRequestId", refundOrderId);
|
||||||
|
|
||||||
|
HashMap<Object, Object> refundMap = new HashMap<Object, Object>();
|
||||||
|
refundMap.put("refundOrderId", refundOrderId);
|
||||||
|
refundMap.put("czyh", czyh);
|
||||||
|
refundMap.put("hzid", hzid);
|
||||||
|
refundMap.put("hzxm", hzxm);
|
||||||
|
refundMap.put("tranType", tranType);
|
||||||
|
refundMap.put("Amount", Amount);
|
||||||
|
refundMap.put("payType", payType);
|
||||||
|
refundMap.put("payCode", payCode);
|
||||||
|
refundMap.put("originalOrderId", originalOrderId);
|
||||||
|
refundMap.put("merchantOrderId", merchantOrderId);
|
||||||
|
refundMap.put("refundRequestId", refundOrderId);
|
||||||
|
url = StatusDefine.IP_PORT + "/api/addRefund";
|
||||||
|
String requestBody = JSON.toJSONString(refundMap);
|
||||||
|
logger.info("退款请求参数" + requestBody);
|
||||||
|
entity = new HttpEntity<String>(requestBody, headers);
|
||||||
|
ResponseEntity<HashMap> result = restTemplate.exchange(url, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
} else {
|
||||||
|
errCode = (String) resultMap.get("errCode");
|
||||||
|
errMsg = (String) resultMap.get("errMsg");
|
||||||
|
}
|
||||||
|
logger.info("退款参数" + body + "结果:" + resultMap);
|
||||||
|
} catch (Exception e) {
|
||||||
|
errCode = "999";
|
||||||
|
errMsg = "退款接口异常:" + e.toString();
|
||||||
|
logger.error("退款接口异常!原因:" + errMsg);
|
||||||
|
}
|
||||||
|
responseMap.put("respCode", errCode);
|
||||||
|
responseMap.put("errMsg", errMsg);
|
||||||
|
return responseMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
* @description 查询退款记录
|
||||||
|
* @author dqzhang
|
||||||
|
* @created 2021年12月1日 下午4:50:10
|
||||||
|
*/
|
||||||
|
@RequestMapping("/queryRefund")
|
||||||
|
@ResponseBody
|
||||||
|
public HashMap<Object, Object> queryRefund(String refundRequestId) throws Exception {
|
||||||
|
|
||||||
|
String respCode = "00";
|
||||||
|
String errMsg = "";
|
||||||
|
String merOrderId = "";
|
||||||
|
String transactionAmount = "";// 交易金额
|
||||||
|
String refundInvoiceAmount = "";// 商户实际退款金额
|
||||||
|
try {
|
||||||
|
TreeMap<Object, Object> map = new TreeMap<Object, Object>();
|
||||||
|
map.put("msgSrcId", "12YK");
|
||||||
|
map.put("msgSrc", "WWW.KRLSFYBJ.COM");
|
||||||
|
map.put("msgType", "refundQuery");
|
||||||
|
map.put("requestTimestamp", DateDUtil.getTheCurrentTime());
|
||||||
|
map.put("merOrderId", refundRequestId);
|
||||||
|
map.put("mid", "898652880620011");
|
||||||
|
map.put("tid", "65954193");
|
||||||
|
map.put("signType", "SHA256");
|
||||||
|
String key = "KfG8PnwGSK8AXQFKtyfQnKi3x5kcZtDkWX2tctAMhcF5e6Ax";
|
||||||
|
StringBuilder str = new StringBuilder();
|
||||||
|
for (Entry<Object, Object> e : map.entrySet()) {
|
||||||
|
str.append(e.getKey());
|
||||||
|
str.append("=");
|
||||||
|
str.append(e.getValue());
|
||||||
|
str.append("&");
|
||||||
|
}
|
||||||
|
str.deleteCharAt(str.length() - 1);
|
||||||
|
str.append(key);
|
||||||
|
String sign = EncryptUtil.getSHA256Str(str.toString());
|
||||||
|
map.put("sign", sign.toUpperCase());
|
||||||
|
String url = "https://qr.chinaums.com/netpay-route-server/api/";
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
String body = JSON.toJSONString(map);
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(body, headers);
|
||||||
|
ResponseEntity<HashMap> result = restTemplate.exchange(url, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
HashMap resultMap = result.getBody();
|
||||||
|
if ("SUCCESS".equals(resultMap.get("errCode"))) {
|
||||||
|
transactionAmount = StringDUtil.changeNullToEmpty(resultMap.get("totalAmount"));
|
||||||
|
refundInvoiceAmount = StringDUtil.changeNullToEmpty(resultMap.get("sendBackAmount"));
|
||||||
|
merOrderId = (String) resultMap.get("merOrderId");
|
||||||
|
} else {
|
||||||
|
respCode = resultMap.get("errCode").toString();
|
||||||
|
errMsg = (String) resultMap.get("errMsg");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
respCode = "999";
|
||||||
|
errMsg = "退款查询接口异常:" + e.toString();
|
||||||
|
logger.error("退款查询失败!,原因:" + errMsg);
|
||||||
|
}
|
||||||
|
HashMap<Object, Object> map = new HashMap<Object, Object>();
|
||||||
|
map.put("respCode", respCode);
|
||||||
|
map.put("errMsg", errMsg);
|
||||||
|
map.put("originalOrderId", merOrderId);
|
||||||
|
map.put("merchantOrderId", merOrderId);
|
||||||
|
map.put("queryResCode", respCode);
|
||||||
|
map.put("queryResInfo", errMsg);
|
||||||
|
map.put("transactionAmount", transactionAmount);
|
||||||
|
map.put("refundInvoiceAmount", refundInvoiceAmount);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/generatePayMessage")
|
||||||
|
@ResponseBody
|
||||||
|
public HashMap<String, Object> generatePayMessage(String type, String operateTime, String openId, String amount) {
|
||||||
|
|
||||||
|
MessageVo messageVo = new MessageVo();
|
||||||
|
messageVo.setAmount(amount);
|
||||||
|
messageVo.setOpenId(openId);
|
||||||
|
messageVo.setOperateTime(operateTime);
|
||||||
|
messageVo.setType(type);
|
||||||
|
|
||||||
|
HashMap<String, Object> resultMap = new HashMap<>();
|
||||||
|
|
||||||
|
log.info("请求参数:" + JSONUtil.toJsonStr(messageVo));
|
||||||
|
HashMap<String, String> header = new HashMap<>();
|
||||||
|
header.put("Content-Type", "application/json;charset=UTF-8");
|
||||||
|
|
||||||
|
log.info("开始发送推送消息请求");
|
||||||
|
String responseBody = HttpRequest.post("http://localhost:18095/notify/messageNotify").body(JSONUtil.toJsonStr(messageVo)).addHeaders(header).execute().body();
|
||||||
|
resultMap.put("data", responseBody);
|
||||||
|
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
//
|
||||||
|
// TreeMap<Object, Object> map = new TreeMap<Object, Object>();
|
||||||
|
// map.put("msgSrcId", "12YK");
|
||||||
|
// map.put("msgSrc", "WWW.KRLSFYBJ.COM");
|
||||||
|
// map.put("msgType", "refund");
|
||||||
|
// map.put("requestTimestamp", DateDUtil.getTheCurrentTime());
|
||||||
|
// map.put("merOrderId", "originalOrderId");
|
||||||
|
// map.put("mid", "898652880620011");
|
||||||
|
// map.put("tid", "65954193");
|
||||||
|
// map.put("refundAmount", "Amount");
|
||||||
|
// map.put("signType", "SHA256");
|
||||||
|
// String key = "KfG8PnwGSK8AXQFKtyfQnKi3x5kcZtDkWX2tctAMhcF5e6Ax";
|
||||||
|
// StringBuilder str = new StringBuilder();
|
||||||
|
// for (Entry<Object, Object> e : map.entrySet()) {
|
||||||
|
// str.append(e.getKey());
|
||||||
|
// str.append("=");
|
||||||
|
// str.append(e.getValue());
|
||||||
|
// str.append("&");
|
||||||
|
// }
|
||||||
|
// str.deleteCharAt(str.length() - 1);
|
||||||
|
// str.append(key);
|
||||||
|
// System.out.println(str);
|
||||||
|
// String sign = EncryptUtil.getSHA256Str(str.toString());
|
||||||
|
// map.put("sign", sign.toUpperCase());
|
||||||
|
// System.out.println(map);
|
||||||
|
// //
|
||||||
|
// // String refundOrderId = "11";
|
||||||
|
// // HashMap<Object,Object> refundMap = new HashMap<Object,Object>();
|
||||||
|
// // refundMap.put("refundOrderId",refundOrderId);
|
||||||
|
// // refundMap.put("czyh",12);
|
||||||
|
// // refundMap.put("hzid","1");
|
||||||
|
// // refundMap.put("hzxm","张三");
|
||||||
|
// // refundMap.put("tranType","1");
|
||||||
|
// // refundMap.put("Amount",12);
|
||||||
|
// // refundMap.put("payType",1);
|
||||||
|
// // refundMap.put("payCode",1);
|
||||||
|
// // refundMap.put("originalOrderId","sadasd");
|
||||||
|
// // refundMap.put("merchantOrderId","sadasd");
|
||||||
|
// // refundMap.put("refundRequestId","sadasd");
|
||||||
|
// // String url = "http://192.168.0.67:8080"+"/api/addRefund";
|
||||||
|
// // String requestBody = JSON.toJSONString(refundMap);
|
||||||
|
// // logger.info("退款参数"+requestBody);
|
||||||
|
// // RestTemplate restTemplate = new RestTemplate();
|
||||||
|
// // HttpHeaders headers = new HttpHeaders();
|
||||||
|
// // headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
// // String body = JSON.toJSONString(refundMap);
|
||||||
|
// // HttpEntity<String> entity = new HttpEntity<String>(body, headers);
|
||||||
|
// // ResponseEntity<HashMap> result =restTemplate.exchange(url, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
// // System.out.println(result.getBody());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
46
src/main/java/com/saye/hrs/controller/BookingController.java
Normal file
46
src/main/java/com/saye/hrs/controller/BookingController.java
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
package com.saye.hrs.controller;
|
||||||
|
|
||||||
|
import com.saye.hrs.commons.webservice.HisInterfaceUtils;
|
||||||
|
import org.dom4j.DocumentException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mr.zs
|
||||||
|
* @date 2024/10/31
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/booking")
|
||||||
|
public class BookingController {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(Object.class);
|
||||||
|
|
||||||
|
@GetMapping("/getDoctorList")
|
||||||
|
public HashMap<Object, Object> getDoctorList(String selectDate, String selectKsdm) {
|
||||||
|
|
||||||
|
HashMap<Object, Object> resMap = null;
|
||||||
|
try {
|
||||||
|
resMap = HisInterfaceUtils.getDoctors(selectDate, selectKsdm);
|
||||||
|
} catch (DocumentException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return resMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getDoctorScheduling")
|
||||||
|
public HashMap<Object, Object> getDoctorScheduling(String selectDate, String selectKmdm) {
|
||||||
|
HashMap<Object, Object> resMap = null;
|
||||||
|
try {
|
||||||
|
resMap = HisInterfaceUtils.getDoctorScheduling(selectDate, selectKmdm);
|
||||||
|
} catch (DocumentException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return resMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package com.saye.hrs.controller;
|
||||||
|
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import cn.hutool.json.JSONArray;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.saye.hrs.model.StatusDefine;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Mr.zs
|
||||||
|
* @date 2025/2/8
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/countAutho")
|
||||||
|
public class CountAuthoController {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(CountAuthoController.class);
|
||||||
|
|
||||||
|
// 获取有权限的人员清单
|
||||||
|
@RequestMapping("/getAuther")
|
||||||
|
public Object getAutho() {
|
||||||
|
|
||||||
|
HashMap<String, String> headers = new HashMap<>();// 存放请求头,可以存放多个请求头
|
||||||
|
HashMap<String, Object> resMap = new HashMap<>();
|
||||||
|
headers.put("Content-Type", "application/json");
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/getAutho";
|
||||||
|
String body = HttpUtil.createGet(url).addHeaders(headers).execute().body();
|
||||||
|
logger.info("获取有权限人员清单111" + body);
|
||||||
|
JSONObject entries = JSONUtil.parseObj(body);
|
||||||
|
Object data = entries.get("data");
|
||||||
|
JSONArray objects = JSONUtil.parseArray(data);
|
||||||
|
List<String> list = JSONUtil.toList(objects, String.class);
|
||||||
|
resMap.put("data", list);
|
||||||
|
return resMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/getPerm")
|
||||||
|
public Object getPerm(String openid) {
|
||||||
|
|
||||||
|
HashMap<String, String> headers = new HashMap<>();// 存放请求头,可以存放多个请求头
|
||||||
|
HashMap<String, Object> resMap = new HashMap<>();
|
||||||
|
HashMap<String, Object> reqMap = new HashMap<>();
|
||||||
|
headers.put("Content-Type", "application/json");
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/getAuthoList";
|
||||||
|
reqMap.put("openid", openid);
|
||||||
|
String body = HttpUtil.createGet(url).addHeaders(headers).form(reqMap).execute().body();
|
||||||
|
logger.info("获取有权限人员清单111" + body);
|
||||||
|
JSONObject entries = JSONUtil.parseObj(body);
|
||||||
|
Object data = entries.get("data");
|
||||||
|
JSONArray objects = JSONUtil.parseArray(data);
|
||||||
|
List<String> list = JSONUtil.toList(objects, String.class);
|
||||||
|
resMap.put("data", list);
|
||||||
|
return resMap;
|
||||||
|
}
|
||||||
|
@RequestMapping("/getDeptPerm")
|
||||||
|
public Object getDeptPerm(String openid) {
|
||||||
|
|
||||||
|
HashMap<String, String> headers = new HashMap<>();// 存放请求头,可以存放多个请求头
|
||||||
|
HashMap<String, Object> resMap = new HashMap<>();
|
||||||
|
HashMap<String, Object> reqMap = new HashMap<>();
|
||||||
|
headers.put("Content-Type", "application/json");
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/getDeptAuthList";
|
||||||
|
reqMap.put("openid", openid);
|
||||||
|
String body = HttpUtil.createGet(url).addHeaders(headers).form(reqMap).execute().body();
|
||||||
|
logger.info("获取有权限人员清单111" + body);
|
||||||
|
JSONObject entries = JSONUtil.parseObj(body);
|
||||||
|
Object data = entries.get("data");
|
||||||
|
// JSONArray objects = JSONUtil.parseArray(data);
|
||||||
|
// List<String> list = JSONUtil.toList(objects, String.class);
|
||||||
|
resMap.put("data", data);
|
||||||
|
return resMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
702
src/main/java/com/saye/hrs/controller/HisController.java
Normal file
702
src/main/java/com/saye/hrs/controller/HisController.java
Normal file
@@ -0,0 +1,702 @@
|
|||||||
|
package com.saye.hrs.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.saye.hrs.WebLog;
|
||||||
|
import com.saye.hrs.commons.date.DateDUtil;
|
||||||
|
import com.saye.hrs.commons.string.StringDUtil;
|
||||||
|
import com.saye.hrs.commons.webservice.WSUtil;
|
||||||
|
import com.saye.hrs.model.MessageVo;
|
||||||
|
import com.saye.hrs.model.OrderNameVo;
|
||||||
|
import com.saye.hrs.model.StatusDefine;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.dom4j.DocumentException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.http.*;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.client.RestClientException;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@Slf4j
|
||||||
|
public class HisController {
|
||||||
|
public static RestTemplate restTemplate = new RestTemplate();
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(Object.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取患者信息
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/his/getPatient")
|
||||||
|
public HashMap<Object, Object> getPatient(String cardno, String cardtype, String hzxm) throws Exception {
|
||||||
|
HashMap<Object, Object> patient = WSUtil.getPatient(cardno, cardtype);
|
||||||
|
String errCode = StringDUtil.changeNullToEmpty(patient.get("errCode"));
|
||||||
|
|
||||||
|
if ("0".equals(errCode)) {
|
||||||
|
HashMap<Object, Object> patientMap = (HashMap<Object, Object>) ((List) patient.get("list")).get(0);
|
||||||
|
|
||||||
|
String name = StringDUtil.changeNullToEmpty(patientMap.get("hzxm"));
|
||||||
|
if (!name.equals(hzxm)) {
|
||||||
|
patient = new HashMap<>();
|
||||||
|
patient.put("errCode", "999");
|
||||||
|
patient.put("errMsg", "卡号与姓名不匹配");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return patient;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取住院患者信息
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/his/getZyPatient")
|
||||||
|
public HashMap<Object, Object> getZyPatient(String cardno, String cardtype, String hzxm) throws Exception {
|
||||||
|
HashMap<Object, Object> patient = WSUtil.getZYPatient(cardno, cardtype);
|
||||||
|
String errCode = StringDUtil.changeNullToEmpty(patient.get("errCode"));
|
||||||
|
|
||||||
|
if ("0".equals(errCode)) {
|
||||||
|
HashMap<Object, Object> patientMap = (HashMap<Object, Object>) ((List) patient.get("list")).get(0);
|
||||||
|
|
||||||
|
String name = StringDUtil.changeNullToEmpty(patientMap.get("hzxm"));
|
||||||
|
if (!name.equals(hzxm)) {
|
||||||
|
patient = new HashMap<>();
|
||||||
|
patient.put("errCode", "999");
|
||||||
|
patient.put("errMsg", "卡号与姓名不匹配");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return patient;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取科室信息
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/his/getOffice")
|
||||||
|
public HashMap<Object, Object> getOffice(String ksrq, String jsrq, String lb) throws DocumentException {
|
||||||
|
jsrq = DateDUtil.getPlusDays("yyyyMMdd", jsrq, 6);
|
||||||
|
return WSUtil.getOffice(ksrq, jsrq, lb);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取某些天科室排班信息
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/his/getOfficeSchedule")
|
||||||
|
public HashMap<Object, Object> getOfficeSchedule(String ksrq, String jsrq, String lb, String kmdm) throws DocumentException {
|
||||||
|
|
||||||
|
return WSUtil.getOfficeSchedule(ksrq, jsrq, lb, kmdm);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 预约登记
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/his/order")
|
||||||
|
public HashMap<Object, Object> order(String patid, String pbmxid, String yyhx, String sjdjl, String ksmc, String ksdm, String jssj, String zxrq, String cardNo, String patientName) throws DocumentException {
|
||||||
|
logger.info("zxrq----------" + zxrq);
|
||||||
|
logger.info("cardNo----------" + cardNo);
|
||||||
|
String hour = DateDUtil.getCurrentDate("HH:mm");
|
||||||
|
String date = DateDUtil.getCurrentDate("yyyyMMdd");
|
||||||
|
if (date.equals(zxrq) && jssj.compareTo(hour) < 0) {
|
||||||
|
HashMap<Object, Object> resultMap = new HashMap<Object, Object>();
|
||||||
|
resultMap.put("errCode", "999");
|
||||||
|
resultMap.put("errMsg", "不在可预约时间内!");
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("patientId", patid);
|
||||||
|
log.info("开始调用黑名单接口,获取黑名单");
|
||||||
|
String result = HttpUtil.get("http://12.0.2.1:8081/dataManager/order/getInBlackList", paramMap);
|
||||||
|
JSONObject resultJson = JSONUtil.parseObj(result);
|
||||||
|
log.info("黑名单的result is :" + result);
|
||||||
|
if (Convert.toInt(resultJson.get("status")) > 0) {// 响应成功
|
||||||
|
Object resData = resultJson.get("data");
|
||||||
|
Integer anInt = Convert.toInt(resData);
|
||||||
|
if (anInt > 0) {
|
||||||
|
HashMap<Object, Object> resultMap = new HashMap<Object, Object>();
|
||||||
|
resultMap.put("errCode", "999");
|
||||||
|
resultMap.put("errMsg", "预约功能已受限,请联系医院工作人员");
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HashMap<Object, Object> map = WSUtil.order(patid, pbmxid, yyhx, sjdjl);
|
||||||
|
if ("0".equals(map.get("errCode"))) {
|
||||||
|
// 预约成功记录写到本地
|
||||||
|
try {
|
||||||
|
HashMap<Object, Object> requestMap = (HashMap<Object, Object>) ((List) map.get("list")).get(0);
|
||||||
|
requestMap.put("ksmc", ksmc);
|
||||||
|
requestMap.put("ksdm", ksdm);
|
||||||
|
requestMap.put("patient_id", patid);
|
||||||
|
requestMap.put("create_time", DateDUtil.getTheCurrentTime());
|
||||||
|
requestMap.put("create_date", DateDUtil.getCurrentDate("yyyy-MM-dd"));
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/insertOrder";
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
String body = JSON.toJSONString(requestMap);
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(body, headers);
|
||||||
|
ResponseEntity<HashMap> resp = restTemplate.exchange(url, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
HashMap resultMap = resp.getBody();
|
||||||
|
if (!"0".equals(resultMap.get("errCode"))) {
|
||||||
|
logger.error("预约成功记录写入数据库失败" + resultMap.get("errMsg"));
|
||||||
|
} else {
|
||||||
|
HashMap<String, String> header = new HashMap<>();
|
||||||
|
header.put("Content-Type", "application/json;charset=UTF-8");
|
||||||
|
MessageVo messageVo = new MessageVo();
|
||||||
|
messageVo.setIdentity(cardNo);
|
||||||
|
messageVo.setType("yygh");
|
||||||
|
messageVo.setDepartmentName(ksmc);
|
||||||
|
messageVo.setPatientName(patientName);
|
||||||
|
messageVo.setOperateTime(requestMap.get("yyrq").toString());
|
||||||
|
log.info("开始调用接口,推送消息!");
|
||||||
|
log.info("messageVo is :" + messageVo);
|
||||||
|
String responseBody = HttpRequest.post("http://localhost:18095/notify/messageNotify").body(JSONUtil.toJsonStr(messageVo)).addHeaders(header).execute().body();
|
||||||
|
log.info("responseBody is :" + responseBody);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("预约成功记录写入数据库失败" + e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消预约
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/his/cancelOrder")
|
||||||
|
public HashMap<Object, Object> cancelOrder(String yylsh) throws DocumentException {
|
||||||
|
HashMap<Object, Object> map = WSUtil.cancelOrder(yylsh);
|
||||||
|
if ("0".equals(map.get("errCode"))) {
|
||||||
|
// 取消预约写到本地
|
||||||
|
try {
|
||||||
|
HashMap<Object, Object> requestMap = new HashMap<Object, Object>();
|
||||||
|
requestMap.put("yylsh", yylsh);
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/cancelOrder";
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
String body = JSON.toJSONString(requestMap);
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(body, headers);
|
||||||
|
ResponseEntity<HashMap> resp = restTemplate.exchange(url, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
HashMap resultMap = resp.getBody();
|
||||||
|
if (!"0".equals(resultMap.get("errCode"))) {
|
||||||
|
logger.error("取消预约功记录写入数据库失败" + resultMap.get("errMsg"));
|
||||||
|
} else {
|
||||||
|
HashMap<String, Object> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("xh", yylsh);
|
||||||
|
log.info("开始获取订单信息");
|
||||||
|
String result = HttpUtil.get("http://12.0.2.1:8081/dataManager/order/getOrderByXH", paramMap);
|
||||||
|
log.info("datamanager get data is :" + result);
|
||||||
|
JSONObject resultJson = JSONUtil.parseObj(result);
|
||||||
|
if (Convert.toInt(resultJson.get("status")) > 0) {// 响应成功
|
||||||
|
Object resData = resultJson.get("data");
|
||||||
|
JSONObject entries = JSONUtil.parseObj(resData);
|
||||||
|
OrderNameVo orderNameVo = JSONUtil.toBean(entries, OrderNameVo.class);
|
||||||
|
|
||||||
|
MessageVo messageVo = new MessageVo();
|
||||||
|
messageVo.setType("qxyy");
|
||||||
|
messageVo.setIdentity(orderNameVo.getCardNo());
|
||||||
|
messageVo.setDepartmentName(orderNameVo.getKsmc());
|
||||||
|
messageVo.setPatientName(orderNameVo.getTrueName());
|
||||||
|
messageVo.setOperateTime(orderNameVo.getYyrq());
|
||||||
|
HashMap<String, String> header = new HashMap<>();
|
||||||
|
header.put("Content-Type", "application/json;charset=UTF-8");
|
||||||
|
log.info("开始发送取消预约通知");
|
||||||
|
String responseBody = HttpRequest.post("http://localhost:18095/notify/messageNotify").body(JSONUtil.toJsonStr(messageVo)).addHeaders(header).execute().body();
|
||||||
|
log.info("responseBody is :" + responseBody);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (RestClientException e) {
|
||||||
|
logger.error("取消预约功记录写入数据库失败" + e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取某人预约登记信息
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/his/getOrder")
|
||||||
|
public HashMap<Object, Object> getOrder(String patid) throws Exception {
|
||||||
|
|
||||||
|
return WSUtil.getOrder(patid);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取某人检查报告
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/his/getInspectReport")
|
||||||
|
public HashMap<Object, Object> getInspectReport(String cardno, String ksrq, String jsrq, String repno, String lb, String brlx, String bglx) throws Exception {
|
||||||
|
|
||||||
|
Date date = new Date();
|
||||||
|
if (ksrq == null || "null".equals(ksrq) || "undefined".equals(ksrq) || "".equals(ksrq)) {
|
||||||
|
ksrq = DateDUtil.getForthDays("yyyyMMdd", date, 7);
|
||||||
|
}
|
||||||
|
if (jsrq == null || "null".equals(jsrq) || "undefined".equals(jsrq) || "".equals(jsrq)) {
|
||||||
|
jsrq = DateDUtil.DateToStr("yyyyMMdd", new Date());
|
||||||
|
}
|
||||||
|
return WSUtil.getInspectReport(cardno, ksrq, jsrq, repno, lb, brlx, bglx);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取某人充值记录
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@RequestMapping("/his/getRecharge")
|
||||||
|
public HashMap<Object, Object> getRecharge(String cardno, String cardtype, String kssj, String jssj) throws Exception {
|
||||||
|
|
||||||
|
Date date = new Date();
|
||||||
|
if (kssj == null || "null".equals(kssj) || "undefined".equals(kssj) || "".equals(kssj)) {
|
||||||
|
kssj = DateDUtil.getForthDays("yyyyMMdd", date, 7);
|
||||||
|
}
|
||||||
|
if (jssj == null || "null".equals(jssj) || "undefined".equals(jssj) || "".equals(jssj)) {
|
||||||
|
jssj = DateDUtil.DateToStr("yyyyMMdd", new Date());
|
||||||
|
}
|
||||||
|
return WSUtil.getRecharge(cardno, cardtype, kssj, jssj);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 获取某人缴费主信息
|
||||||
|
*/
|
||||||
|
@RequestMapping("/his/getPayList")
|
||||||
|
public HashMap<Object, Object> getPayList(String patid, String ksrq, String jsrq) throws Exception {
|
||||||
|
|
||||||
|
Date date = new Date();
|
||||||
|
if (ksrq == null || "null".equals(ksrq) || "undefined".equals(ksrq) || "".equals(ksrq)) {
|
||||||
|
ksrq = DateDUtil.getForthDays("yyyyMMdd", date, 7);
|
||||||
|
}
|
||||||
|
if (jsrq == null || "null".equals(jsrq) || "undefined".equals(jsrq) || "".equals(jsrq)) {
|
||||||
|
jsrq = DateDUtil.DateToStr("yyyyMMdd", new Date());
|
||||||
|
}
|
||||||
|
return WSUtil.getPayList(patid, ksrq, jsrq);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 获取缴费明细信息
|
||||||
|
*/
|
||||||
|
@RequestMapping("/his/getPayDetailList")
|
||||||
|
public HashMap<Object, Object> getPayDetailList(String cxlb, String sjh) throws Exception {
|
||||||
|
|
||||||
|
return WSUtil.getPayDetailList(cxlb, sjh);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 门诊充值
|
||||||
|
*/
|
||||||
|
@RequestMapping("/his/mzRecharge")
|
||||||
|
public HashMap<Object, Object> mzRecharge(String patid, String czje, String czlx, String cardno, String cardtype, String zzjjylsh, String czlsh, String tradeNo, String outerOrderNo, String innerOrderNo, String paytype) throws Exception {
|
||||||
|
|
||||||
|
return WSUtil.mzRecharge(patid, czje, czlx, cardno, cardtype, zzjjylsh, czlsh, tradeNo, outerOrderNo, innerOrderNo, paytype);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 住院充值
|
||||||
|
*/
|
||||||
|
@RequestMapping("/his/zyRecharge")
|
||||||
|
public HashMap<Object, Object> zyRecharge(String cardno, String cardtype, String patid, String czje, String czlx, String zzjjylsh, String czlsh, String tradeNo, String outerOrderNo, String innerOrderNo, String paytype) throws Exception {
|
||||||
|
// 获取住院患者信息
|
||||||
|
HashMap<Object, Object> map = WSUtil.getZYPatient(cardno, cardtype);
|
||||||
|
if ("0".equals(map.get("errCode"))) {
|
||||||
|
List<HashMap<Object, Object>> list = (List<HashMap<Object, Object>>) map.get("list");
|
||||||
|
if (list.isEmpty()) {
|
||||||
|
map.put("errCode", "999");
|
||||||
|
map.put("errMsg", "获取患者信息异常!");
|
||||||
|
} else {
|
||||||
|
HashMap<Object, Object> resultMap = list.get(0);
|
||||||
|
String syxh = (String) resultMap.get("syxh");
|
||||||
|
String jsxh = (String) resultMap.get("jsxh");
|
||||||
|
return WSUtil.zyRecharge(czlx, syxh, jsxh, czje, zzjjylsh, czlsh, tradeNo, outerOrderNo, innerOrderNo, paytype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/his/getOneInHosMoney")
|
||||||
|
public HashMap<Object, Object> getOneInHosMoney(String selectDate, String patient) {
|
||||||
|
try {
|
||||||
|
return WSUtil.getOneInHosMoney(selectDate, patient);
|
||||||
|
} catch (DocumentException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 建档(患者基本信息登记)
|
||||||
|
*/
|
||||||
|
@RequestMapping("/his/addUser")
|
||||||
|
public HashMap<Object, Object> addUser(String hzxm, String sfzh, String lxdh) throws Exception {
|
||||||
|
HashMap<Object, Object> resultMap = new HashMap<Object, Object>();
|
||||||
|
resultMap.put("errCode", "999");
|
||||||
|
resultMap.put("errMsg", "建档功能暂时关闭!");
|
||||||
|
return resultMap;
|
||||||
|
// return WSUtil.addUser(hzxm, sfzh, lxdh);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// @RequestMapping("/his/countData")
|
||||||
|
// public HashMap<Object, Object> countData(String lb, String startTime, String endTime) throws Exception {
|
||||||
|
// HashMap<Object, Object> resMap = new HashMap<>();
|
||||||
|
// if (StrUtil.isNotBlank(lb)) {// 先判断类别不能为空,否则后续无法继续。
|
||||||
|
// // 在判断lb值,根据lb调用接口
|
||||||
|
// switch (lb) {
|
||||||
|
// case "1": // 1:总收入统计
|
||||||
|
// resMap = WSUtil.getTotalIncome(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "2": // 2:门诊预算统计
|
||||||
|
// resMap = WSUtil.getOutCome(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "3": // 3:住院预算完成度
|
||||||
|
// resMap = WSUtil.getInpMedfee(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "4": // 4:药类占比
|
||||||
|
// resMap = WSUtil.getYZB(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "5": // 5:百元耗占比
|
||||||
|
// resMap = WSUtil.getBYHCZB(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "6": // 6:医务收入占比
|
||||||
|
// resMap = WSUtil.getYWSRZB(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "7": // 7:门诊人次统计
|
||||||
|
// resMap = WSUtil.getnumberPeopleOutp(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "8": // 8:急诊人次统计
|
||||||
|
// resMap = WSUtil.getInpatients(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "10": // 10: 周门诊变化请跨国分析
|
||||||
|
// resMap = WSUtil.getOutNumberPeopleOutp(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "11": // 11: 各科门诊人次分析
|
||||||
|
// resMap = WSUtil.getOutPeopleEachDept(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "12": // 12: 门诊次均费用
|
||||||
|
// resMap = WSUtil.getMedfeeAvg(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "13": // 13: 门诊均次均药费
|
||||||
|
// resMap = WSUtil.getOutMedfeeAvg(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "14": // 14: 门诊人次变化分析(12month)
|
||||||
|
// resMap = WSUtil.getEachMonthPeopleOutp(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "15": // 15: 出院人次
|
||||||
|
// resMap = WSUtil.getDischargePeople(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "16": // 16: 平均住院日
|
||||||
|
// resMap = WSUtil.getDaysAvg(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "17": // 17: 病床使用率
|
||||||
|
// resMap = WSUtil.getCwsyl(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "18": // 18: 当前在院
|
||||||
|
// resMap = WSUtil.getInHospital(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "19": // 19: 当前危重
|
||||||
|
// resMap = WSUtil.getBadpatients(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "20": // 20: 各科当前在院人数统计
|
||||||
|
// resMap = WSUtil.getNowInHos(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "21": // 21: 入院动态分析
|
||||||
|
// resMap = WSUtil.getInAndOutHos(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "22": // 22: 各科出入院统计
|
||||||
|
// resMap = WSUtil.getEachReptInAndOutHos(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "23": // 23: 出入院人数变化12month
|
||||||
|
// resMap = WSUtil.getMonthInAndOutHos(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// case "24": // 24: 门诊工作明细统计
|
||||||
|
// resMap = WSUtil.getWorkDetails(startTime, endTime, lb);
|
||||||
|
// return resMap;
|
||||||
|
// default:
|
||||||
|
// resMap.put("errCode", "999");
|
||||||
|
// resMap.put("errMsg", "参数错误!");
|
||||||
|
// return resMap;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// resMap.put("errCode", "999");
|
||||||
|
// resMap.put("errMsg", "参数错误!");
|
||||||
|
// return resMap;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @RequestMapping("/his/synPieCountData")
|
||||||
|
// public HashMap<Object, Object> synPieCountData(String startTime, String endTime) throws Exception {
|
||||||
|
// HashMap<Object, Object> resMap = new HashMap<>();
|
||||||
|
// HashMap<Object, Object> tempMap = new HashMap<>();
|
||||||
|
//
|
||||||
|
// if (StrUtil.isNotBlank(startTime) && StrUtil.isNotBlank(endTime)) {
|
||||||
|
// HashMap<Object, Object> yzbMap = new HashMap<>();
|
||||||
|
// HashMap<Object, Object> byhczbMap = new HashMap<>();
|
||||||
|
// HashMap<Object, Object> ywsrzbMap = new HashMap<>();
|
||||||
|
// yzbMap = WSUtil.getYZB(startTime, endTime, "4");
|
||||||
|
// byhczbMap = WSUtil.getBYHCZB(startTime, endTime, "5");
|
||||||
|
// ywsrzbMap = WSUtil.getYWSRZB(startTime, endTime, "6");
|
||||||
|
// if ("0".equals(yzbMap.get("errCode"))) {
|
||||||
|
// tempMap.put("yzb", yzbMap.get("data").toString());
|
||||||
|
// } else {
|
||||||
|
// resMap.put("errCode", "999");
|
||||||
|
// resMap.put("errMsg", yzbMap.get("errMsg"));
|
||||||
|
// }
|
||||||
|
// if ("0".equals(byhczbMap.get("errCode"))) {
|
||||||
|
// tempMap.put("byhczb", byhczbMap.get("data").toString());
|
||||||
|
// } else {
|
||||||
|
// resMap.put("errCode", "999");
|
||||||
|
// resMap.put("errMsg", byhczbMap.get("errMsg"));
|
||||||
|
// }
|
||||||
|
// if ("0".equals(ywsrzbMap.get("errCode"))) {
|
||||||
|
// tempMap.put("ywsrzb", ywsrzbMap.get("data").toString());
|
||||||
|
// } else {
|
||||||
|
// resMap.put("errCode", "999");
|
||||||
|
// resMap.put("errMsg", ywsrzbMap.get("errMsg"));
|
||||||
|
// }
|
||||||
|
// resMap.put("data", tempMap);
|
||||||
|
// resMap.put("errCode", "0");
|
||||||
|
// resMap.put("errMsg", "");
|
||||||
|
// } else {
|
||||||
|
// resMap.put("errCode", "999");
|
||||||
|
// resMap.put("errMsg", "时间参数为空!");
|
||||||
|
// }
|
||||||
|
// return resMap;
|
||||||
|
// }
|
||||||
|
@RequestMapping("/his/countData")
|
||||||
|
public HashMap<Object, Object> countData(String lb, String startTime, String endTime) {
|
||||||
|
HashMap<Object, Object> resMap = new HashMap<>();
|
||||||
|
if (StrUtil.isNotBlank(lb)) {// 先判断类别不能为空,否则后续无法继续。
|
||||||
|
// 在判断lb值,根据lb调用接口
|
||||||
|
switch (lb) {
|
||||||
|
case "1": // 1:今日和至今预算完成度
|
||||||
|
resMap = WSUtil.getCompleteness(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "2": // 2:12month 预算完成度
|
||||||
|
resMap = WSUtil.getIntegrativeData(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "3": // 3:至今预算完成额对比
|
||||||
|
resMap = WSUtil.getThreeYearsData(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "4": // 4:每月总预算完成度近三年对比
|
||||||
|
resMap = WSUtil.getMZRC(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "5": // 5:临床科室门诊人次
|
||||||
|
resMap = WSUtil.getMTData(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "6": // 6:至今临床科室门诊人次对比
|
||||||
|
resMap = WSUtil.getClinicData(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "7": // 7:至今医技科室工作量
|
||||||
|
resMap = WSUtil.getMTWorkCount(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "8": // 8:临床科室每月门诊总人次近三年对比
|
||||||
|
resMap = WSUtil.getClinicNumData(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "9": // 9: 医技科室每月总工作量近三年对比
|
||||||
|
resMap = WSUtil.getMTEachMonthWorkCount(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "10": // 10: 各科室门诊预算完成额
|
||||||
|
resMap = WSUtil.getEachDeptBudget(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "11": // 11: 近12月各科室门诊预算完成额对比
|
||||||
|
resMap = WSUtil.getTeMonthEachDeptBudgetData(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "12": // 12: 各科室每月门诊预算总完成额近三年对比
|
||||||
|
resMap = WSUtil.getTeEachMonthBudget(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "13": // 13: 儿童保健部门诊工作量明细
|
||||||
|
resMap = WSUtil.getChildrenHealthWorkDetails(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "14": // 14: 近12个月儿童保健部每月门诊工作量明对比
|
||||||
|
resMap = WSUtil.getTeMonthChildrenHealthWorkDetails(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "15": // 15: 近三年儿童保健部每月门诊工作量对比
|
||||||
|
resMap = WSUtil.getDaysAvg(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "16": // 16: 儿童门诊预算完成额
|
||||||
|
resMap = WSUtil.getCwsyl(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "17": // 17: 当前在院
|
||||||
|
resMap = WSUtil.getChildDeptBudegt(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "18": // 18: 当前在院
|
||||||
|
resMap = WSUtil.getInHospital(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "19": // 19: 近12个月临床工作量对比
|
||||||
|
resMap = WSUtil.getBadpatients(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "20": // 20: 近三年临床工作量对比 全院
|
||||||
|
resMap = WSUtil.getLast3All(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "21": // 21: 近三年临床工作量对比 妇产科
|
||||||
|
resMap = WSUtil.getLast3fck(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "22": // 22:近三年临床工作量对比 儿科
|
||||||
|
resMap = WSUtil.getLast3ek(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "23": // 23: 近3年妇科住院部工作量
|
||||||
|
resMap = WSUtil.getLB23Data(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "24": // 24: 近3年新生儿科住院部工作量
|
||||||
|
resMap = WSUtil.getLB24Data(startTime, endTime, lb);
|
||||||
|
// resMap = WSUtil.getWorkDetails(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
case "25": // 24: 近3年新生儿科住院部工作量
|
||||||
|
resMap = WSUtil.getLB25Data(startTime, endTime, lb);
|
||||||
|
// resMap = WSUtil.getWorkDetails(startTime, endTime, lb);
|
||||||
|
return resMap;
|
||||||
|
default:
|
||||||
|
resMap.put("errCode", "999");
|
||||||
|
resMap.put("errMsg", "参数错误!");
|
||||||
|
return resMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
resMap.put("errCode", "999");
|
||||||
|
resMap.put("errMsg", "参数错误!");
|
||||||
|
return resMap;
|
||||||
|
}
|
||||||
|
@RequestMapping("/his/getUniqueLb25Data")
|
||||||
|
@WebLog(description = "getUnPayInfo")
|
||||||
|
public HashMap<Object, Object> getUniqueLb25Data(String openid, String Dept, String startTime, String endTime, String lb) {
|
||||||
|
return WSUtil.getUniqueLb25Data(openid, Dept, startTime, endTime, lb);
|
||||||
|
}
|
||||||
|
@RequestMapping("/his/specialSingleCount")
|
||||||
|
public HashMap<Object, Object> getSpecialSingleCount(String Dept, String startTime, String endTime, String lb) {
|
||||||
|
return WSUtil.getSpecialSingleCount(Dept, startTime, endTime, lb);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/his/getLB21Options")
|
||||||
|
public HashMap<Object, Object> getLB21Options(String Dept, String startTime, String endTime, String lb) {
|
||||||
|
return WSUtil.getLB21Options(Dept, startTime, endTime, lb);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/his/getLB22Options")
|
||||||
|
public HashMap<Object, Object> getLB22Options(String Dept, String startTime, String endTime, String lb) {
|
||||||
|
return WSUtil.getLB22Options(Dept, startTime, endTime, lb);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/his/getLB24Options")
|
||||||
|
public HashMap<Object, Object> getLB24Options(String Dept, String startTime, String endTime, String lb) {
|
||||||
|
return WSUtil.getLB24Options(Dept, startTime, endTime, lb);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/his/getLB23Options")
|
||||||
|
public HashMap<Object, Object> getLB23Options(String Dept, String startTime, String endTime, String lb) {
|
||||||
|
return WSUtil.getLB23Options(Dept, startTime, endTime, lb);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/his/getLB20Options")
|
||||||
|
public HashMap<Object, Object> getLB20Options(String Dept, String startTime, String endTime, String lb) {
|
||||||
|
return WSUtil.getLB20Options(Dept, startTime, endTime, lb);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/his/getLB19Options")
|
||||||
|
public HashMap<Object, Object> getLB19Options(String Dept, String startTime, String endTime, String lb) {
|
||||||
|
return WSUtil.getLB19Options(Dept, startTime, endTime, lb);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/his/getSingleDeptCount")
|
||||||
|
public HashMap<Object, Object> getSingleDeptCount(String Dept, String startTime, String endTime, String lb) {
|
||||||
|
return WSUtil.getSingleDeptCount(Dept, startTime, endTime, lb);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/his/getChildSpecialSingleCount")
|
||||||
|
public HashMap<Object, Object> getChildSpecialSingleCount(String Dept, String startTime, String endTime, String lb) {
|
||||||
|
return WSUtil.getChildSpecialSingleCount(Dept, startTime, endTime, lb);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/his/getChildSingleBudget")
|
||||||
|
public HashMap<Object, Object> getChildSingleBudget(String Dept, String startTime, String endTime, String lb) {
|
||||||
|
return WSUtil.getChildSingleBudget(Dept, startTime, endTime, lb);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/his/getTMB")
|
||||||
|
public HashMap<Object, Object> getTMB(String Dept, String startTime, String endTime, String lb) {
|
||||||
|
return WSUtil.getTMB(Dept, startTime, endTime, lb);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/his/getCDB")
|
||||||
|
public HashMap<Object, Object> getCDB(String Dept, String startTime, String endTime, String lb) {
|
||||||
|
return WSUtil.getCDB(Dept, startTime, endTime, lb);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/his/getEMDB")
|
||||||
|
public HashMap<Object, Object> getEMDB(String Dept, String startTime, String endTime, String lb) {
|
||||||
|
return WSUtil.getEMDB(Dept, startTime, endTime, lb);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// @RequestMapping("/his/synPieCountData")
|
||||||
|
// public HashMap<Object, Object> synPieCountData(String startTime, String endTime) throws Exception {
|
||||||
|
// HashMap<Object, Object> resMap = new HashMap<>();
|
||||||
|
// HashMap<Object, Object> tempMap = new HashMap<>();
|
||||||
|
//
|
||||||
|
// if (StrUtil.isNotBlank(startTime) && StrUtil.isNotBlank(endTime)) {
|
||||||
|
// HashMap<Object, Object> yzbMap = new HashMap<>();
|
||||||
|
// HashMap<Object, Object> byhczbMap = new HashMap<>();
|
||||||
|
// HashMap<Object, Object> ywsrzbMap = new HashMap<>();
|
||||||
|
// yzbMap = WSUtil.getYZB(startTime, endTime, "4");
|
||||||
|
// byhczbMap = WSUtil.getBYHCZB(startTime, endTime, "5");
|
||||||
|
// ywsrzbMap = WSUtil.getYWSRZB(startTime, endTime, "6");
|
||||||
|
// if ("0".equals(yzbMap.get("errCode"))) {
|
||||||
|
// tempMap.put("yzb", yzbMap.get("data").toString());
|
||||||
|
// } else {
|
||||||
|
// resMap.put("errCode", "999");
|
||||||
|
// resMap.put("errMsg", yzbMap.get("errMsg"));
|
||||||
|
// }
|
||||||
|
// if ("0".equals(byhczbMap.get("errCode"))) {
|
||||||
|
// tempMap.put("byhczb", byhczbMap.get("data").toString());
|
||||||
|
// } else {
|
||||||
|
// resMap.put("errCode", "999");
|
||||||
|
// resMap.put("errMsg", byhczbMap.get("errMsg"));
|
||||||
|
// }
|
||||||
|
// if ("0".equals(ywsrzbMap.get("errCode"))) {
|
||||||
|
// tempMap.put("ywsrzb", ywsrzbMap.get("data").toString());
|
||||||
|
// } else {
|
||||||
|
// resMap.put("errCode", "999");
|
||||||
|
// resMap.put("errMsg", ywsrzbMap.get("errMsg"));
|
||||||
|
// }
|
||||||
|
// resMap.put("data", tempMap);
|
||||||
|
// resMap.put("errCode", "0");
|
||||||
|
// resMap.put("errMsg", "");
|
||||||
|
// } else {
|
||||||
|
// resMap.put("errCode", "999");
|
||||||
|
// resMap.put("errMsg", "时间参数为空!");
|
||||||
|
// }
|
||||||
|
// return resMap;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package com.saye.hrs.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.saye.hrs.dto.Result;
|
||||||
|
import com.saye.hrs.service.HisViewSearchService;
|
||||||
|
import com.saye.hrs.vo.DeptListVo;
|
||||||
|
import com.saye.hrs.vo.DeptVo;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: his视图接口
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-04-15 17:02
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/hisViewSearch")
|
||||||
|
public class HisViewSearchController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
HisViewSearchService hisViewSearchService;
|
||||||
|
|
||||||
|
@GetMapping("/getHistoricalVisits")
|
||||||
|
public Result getHistoricalVisits(String patientName, String idCard) {
|
||||||
|
String result = hisViewSearchService.getHistoricalVisits(patientName, idCard);
|
||||||
|
if (!StrUtil.isEmpty(result)) {
|
||||||
|
return Result.returnSuccess(result);
|
||||||
|
}
|
||||||
|
return Result.returnError("未获取到历史就诊信息!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/getHisDeptList")
|
||||||
|
public Result getHisDeptList() {
|
||||||
|
List<DeptListVo> resMap= hisViewSearchService.getHisDeptList();
|
||||||
|
return Result.returnSuccess(resMap);
|
||||||
|
}
|
||||||
|
@GetMapping("/getHisDept")
|
||||||
|
public Result getHisDept(String deptId) {
|
||||||
|
List<DeptVo> resMap= hisViewSearchService.getHisDept(deptId);
|
||||||
|
return Result.returnSuccess(resMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getHisDeptAdd")
|
||||||
|
public Result getHisDeptAdd() {
|
||||||
|
List<DeptVo> resMap= hisViewSearchService.getHisDeptAdd();
|
||||||
|
return Result.returnSuccess(resMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package com.saye.hrs.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.saye.hrs.dto.Result;
|
||||||
|
import com.saye.hrs.service.IntelligentGuidanceCategoryService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 导诊接口
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-04-15 12:06
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/IntelligentGuidance")
|
||||||
|
@Slf4j
|
||||||
|
public class IntelligentGuidanceController {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(Object.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
IntelligentGuidanceCategoryService intelligentGuidanceCategoryService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/getSymptom")
|
||||||
|
public Result getSymptom(String bodyAreaType) {
|
||||||
|
String result = intelligentGuidanceCategoryService.getSymptom(bodyAreaType);
|
||||||
|
if (!StrUtil.isEmpty(result)) {
|
||||||
|
return Result.returnSuccess(result);
|
||||||
|
}
|
||||||
|
return Result.returnError("未获取到症状!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/getQuestions")
|
||||||
|
public Result getQuestions(String childId) {
|
||||||
|
|
||||||
|
String result = intelligentGuidanceCategoryService.getQuestionsByChildId(childId);
|
||||||
|
if (!StrUtil.isEmpty(result)) {
|
||||||
|
return Result.returnSuccess(result);
|
||||||
|
}
|
||||||
|
return Result.returnError("未获取到问题!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getAllBodyArea")
|
||||||
|
public Result getAllBodyArea(String sex, String adultOrChild) {
|
||||||
|
|
||||||
|
HashMap<String, Object> reqMap = new HashMap<>();
|
||||||
|
log.info("sex is :{}" + sex);
|
||||||
|
reqMap.put("sex", sex);
|
||||||
|
reqMap.put("adultOrChild", adultOrChild);
|
||||||
|
String result = intelligentGuidanceCategoryService.getAllBodyArea(reqMap);
|
||||||
|
if (!StrUtil.isEmpty(result)) {
|
||||||
|
return Result.returnSuccess(result);
|
||||||
|
}
|
||||||
|
return Result.returnError("未获取到问题!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.saye.hrs.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.saye.hrs.dto.Result;
|
||||||
|
import com.saye.hrs.service.CallNumbersService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 排队叫号接口
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-04-15 16:56
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/callNumbers")
|
||||||
|
public class LineUpToCallNumbersController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CallNumbersService callNumbersService;
|
||||||
|
|
||||||
|
@GetMapping("/getCallNumberByIdentity")
|
||||||
|
public Result getCallNumberByIdentity(String identity,String sfzh) {
|
||||||
|
|
||||||
|
String result = callNumbersService.getCallNumberByIdentity(identity,sfzh);
|
||||||
|
if (!StrUtil.isEmpty(result)) {
|
||||||
|
return Result.returnSuccess(result);
|
||||||
|
}
|
||||||
|
return Result.returnError("未获取到排队叫号信息!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
123
src/main/java/com/saye/hrs/controller/PayController.java
Normal file
123
src/main/java/com/saye/hrs/controller/PayController.java
Normal file
@@ -0,0 +1,123 @@
|
|||||||
|
package com.saye.hrs.controller;
|
||||||
|
|
||||||
|
import com.github.wxpay.sdk.WXPayUtil;
|
||||||
|
import com.saye.hrs.commons.JsonUtils;
|
||||||
|
import com.saye.hrs.commons.exception.CustomException;
|
||||||
|
import com.saye.hrs.commons.log.LogUtil;
|
||||||
|
import com.saye.hrs.commons.wxpay.WxPayDUtil;
|
||||||
|
import com.saye.hrs.commons.wxpay.pojo.WxResult;
|
||||||
|
import com.saye.hrs.dto.PayQuery;
|
||||||
|
import com.saye.hrs.dto.Result;
|
||||||
|
import com.saye.hrs.dto.WxAppletPayRequest;
|
||||||
|
import com.saye.hrs.service.PayService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 支付
|
||||||
|
* @author zmc
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
public class PayController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PayService payService;
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(Object.class);
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping(value = "/api/wxpay/wxAppletPay")
|
||||||
|
public Result wxAppletPay(@Validated @RequestBody WxAppletPayRequest reqDTO){
|
||||||
|
Result result = null;
|
||||||
|
String paramTip = "";
|
||||||
|
try {
|
||||||
|
|
||||||
|
paramTip = String.format(" >>> requestObj:%s", JsonUtils.beanToJson(reqDTO));
|
||||||
|
|
||||||
|
//
|
||||||
|
Map map = this.payService.wxAppletPay(reqDTO);
|
||||||
|
if (map == null) {
|
||||||
|
result = Result.returnError("发起微信支付失败!");
|
||||||
|
} else {
|
||||||
|
result = Result.returnSuccess(map);
|
||||||
|
}
|
||||||
|
} catch (CustomException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result = Result.returnCustomError(e);
|
||||||
|
logger.error("发起微信支付失败CustomException,原因:" + e.getMessage()+"请求参数为:"+paramTip);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
result = Result.returnError("发起微信支付失败!");
|
||||||
|
logger.error("发起微信支付失败CustomException,原因:"+e.getMessage()+"请求参数为:"+paramTip);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/api/wxpay/notify")
|
||||||
|
public String wxPayNotify(@RequestBody String xmlStr, HttpServletResponse response, HttpServletRequest request){
|
||||||
|
String paramTip = "";
|
||||||
|
Map<String,String> resultMap=new HashMap<>();
|
||||||
|
String errCode="0";
|
||||||
|
String errMsg="";
|
||||||
|
try {
|
||||||
|
paramTip = String.format(" >>> xmlStr:%s", xmlStr);
|
||||||
|
//微信回调签名校验
|
||||||
|
WxResult wxResult = WxPayDUtil.wxPaySignatureValid(xmlStr);
|
||||||
|
logger.info("微信支付异步回调结果:" + JsonUtils.beanToJson(wxResult));
|
||||||
|
|
||||||
|
this.payService.wxPayNofify(wxResult);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error(">>>微信支付回调失败>>>" + paramTip+" 原因"+e.getMessage());
|
||||||
|
errCode="999";
|
||||||
|
errMsg=e.getMessage();
|
||||||
|
//回退操作
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("0".equals(errCode)){
|
||||||
|
resultMap.put("return_code","SUCCESS");
|
||||||
|
resultMap.put("return_msg","");
|
||||||
|
}else{
|
||||||
|
resultMap.put("return_code","FAIL");
|
||||||
|
resultMap.put("return_msg","");
|
||||||
|
}
|
||||||
|
|
||||||
|
String mapStr="";
|
||||||
|
try {
|
||||||
|
mapStr = WXPayUtil.mapToXml(resultMap);
|
||||||
|
return mapStr;
|
||||||
|
}catch (Exception e){
|
||||||
|
LogUtil.error(this.getClass(),"返回微信支付回调通知组数据失败");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/api/wxpay/findWxPayResult")
|
||||||
|
public Result findWxPayResult(@Validated @RequestBody PayQuery reqDTO){
|
||||||
|
Result result = null;
|
||||||
|
String paramTip = "";
|
||||||
|
try {
|
||||||
|
paramTip = String.format(" >>> requestObj:%s", JsonUtils.beanToJson(reqDTO));
|
||||||
|
|
||||||
|
Map map=payService.findWxPayResult(reqDTO);
|
||||||
|
result = Result.returnSuccess(map);
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error(">>>查询微信支付结果失败>>>" + paramTip+" 原因"+e.getMessage());
|
||||||
|
result = Result.returnError("查询微信支付结果失败!原因:"+e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
195
src/main/java/com/saye/hrs/controller/WXFKController.java
Normal file
195
src/main/java/com/saye/hrs/controller/WXFKController.java
Normal file
@@ -0,0 +1,195 @@
|
|||||||
|
package com.saye.hrs.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.saye.hrs.WebLog;
|
||||||
|
import com.saye.hrs.commons.date.DateDUtil;
|
||||||
|
import com.saye.hrs.commons.webservice.OtherWSUtil;
|
||||||
|
import com.saye.hrs.commons.webservice.WSUtil;
|
||||||
|
import com.saye.hrs.commons.wx.ClientDemo;
|
||||||
|
import com.saye.hrs.dto.*;
|
||||||
|
import com.saye.hrs.vo.FeeInfoVO;
|
||||||
|
import com.saye.hrs.vo.FeeSettledInfoVO;
|
||||||
|
import com.saye.hrs.vo.MZJSPreVO;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @title WXFKController
|
||||||
|
* @description TODO 微信付款
|
||||||
|
* @author thuang
|
||||||
|
* @create 2023/8/3 10:02
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
public class WXFKController {
|
||||||
|
@Autowired
|
||||||
|
private Environment environment;
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(Object.class);
|
||||||
|
|
||||||
|
@GetMapping("/FindPatientFeeSettled")
|
||||||
|
@WebLog(description = "FindPatientFeeSettled")
|
||||||
|
public Result<List<FeeSettledInfoVO>> FindPatientFeeSettled(@Validated PatientFeeSettledQuery reqDTO) throws Exception {
|
||||||
|
String ksrq = reqDTO.getKsrq();
|
||||||
|
|
||||||
|
if (ksrq==null || "".equals(ksrq)){
|
||||||
|
String currentDate = DateDUtil.getCurrentDate(DateDUtil.yyyyMMdd);
|
||||||
|
String substring = currentDate.substring(0, 4);
|
||||||
|
reqDTO.setKsrq(substring+"0101");
|
||||||
|
reqDTO.setJsrq(currentDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
Result<List<FeeSettledInfoVO>> patientFeeSettledInfo = WSUtil.FindPatientFeeSettled(reqDTO);
|
||||||
|
return patientFeeSettledInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/FindPatientFeeInfo")
|
||||||
|
@WebLog(description = "FindPatientFeeInfo")
|
||||||
|
public Result<List<FeeInfoVO>> FindPatientFeeInfo(@Validated PatientFeeQuery reqDTO) throws Exception {
|
||||||
|
Result<List<FeeInfoVO>> patientFeeInfo = OtherWSUtil.getPatientFeeInfo(reqDTO);
|
||||||
|
return patientFeeInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getUnPayInfo")
|
||||||
|
@WebLog(description = "getUnPayInfo")
|
||||||
|
public Result<List<HashMap<Object,Object>>> getUnPayInfo(@Validated PatientFeeQuery reqDTO) throws Exception{
|
||||||
|
return OtherWSUtil.getUnPayInfo(reqDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/PreSettlement")
|
||||||
|
@WebLog(description = "PreSettlement")
|
||||||
|
public Result<MZJSPreVO> PreSettlement(@Validated @RequestBody PreSettlementQuery reqDTO) throws Exception {
|
||||||
|
//20240425 增加获取账户的可用余额
|
||||||
|
String errCode="0";
|
||||||
|
String errMsg="";
|
||||||
|
Result<MZJSPreVO> resultObj=null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
//第一步通过patid 取到medical card the type
|
||||||
|
// RestTemplate restTemplatePatient = new RestTemplate();
|
||||||
|
// String url = StatusDefine.IP_PORT + "/api/findPatientById";
|
||||||
|
// HttpHeaders headersPatient = new HttpHeaders();
|
||||||
|
// headersPatient.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
//
|
||||||
|
// HashMap<Object,Object> map = new HashMap<Object,Object>();
|
||||||
|
// map.put("patientId", reqDTO.getPatid());
|
||||||
|
//
|
||||||
|
// HttpEntity<String> entityPatient = new HttpEntity<String>(JSON.toJSONString(map), headersPatient) ;
|
||||||
|
//
|
||||||
|
// ResponseEntity<String> resp2 =restTemplatePatient.exchange(url, HttpMethod.POST, entityPatient, String.class);
|
||||||
|
//
|
||||||
|
// JSONObject jsonObjectPatient = JSONObject.parseObject(resp2.getBody());
|
||||||
|
// String medicard = jsonObjectPatient.getString("MEDICAL_CARD");
|
||||||
|
// String cardtype = jsonObjectPatient.getString("CARD_TYPE");
|
||||||
|
// //第二步 查档获取账户余额
|
||||||
|
// HashMap<Object, Object> patient = WSUtil.getPatient(medicard, cardtype);
|
||||||
|
// String errCodePatient = StringDUtil.changeNullToEmpty(patient.get("errCode"));
|
||||||
|
// String yyjzhye = "";
|
||||||
|
// if ("0".equals(errCodePatient)) {
|
||||||
|
// HashMap<Object, Object> patientMap = (HashMap<Object, Object>) ((List) patient.get("list")).get(0);
|
||||||
|
// yyjzhye = patientMap.get("zhye").toString();
|
||||||
|
// }else{
|
||||||
|
// logger.error("findPatientById返回结果异常----------");
|
||||||
|
//
|
||||||
|
// errCode="999";
|
||||||
|
// errMsg="取个人信息出错";
|
||||||
|
// resultObj=Result.returnError(errCode,errMsg);
|
||||||
|
// return resultObj;
|
||||||
|
// }
|
||||||
|
|
||||||
|
//第二步 查档获取账户余额
|
||||||
|
// HashMap<Object, Object> patient = WSUtil.getPatientTest("371524199105153614", "4");
|
||||||
|
// String errCodePatient = StringDUtil.changeNullToEmpty(patient.get("errCode"));
|
||||||
|
// String yyjzhye = "";
|
||||||
|
// if ("0".equals(errCodePatient)) {
|
||||||
|
// HashMap<Object, Object> patientMap = (HashMap<Object, Object>) ((List) patient.get("list")).get(0);
|
||||||
|
// yyjzhye = patientMap.get("zhye").toString();
|
||||||
|
// }else{
|
||||||
|
// logger.error("findPatientById返回结果异常----------");
|
||||||
|
//
|
||||||
|
// errCode="999";
|
||||||
|
// errMsg="取个人信息出错";
|
||||||
|
// resultObj=Result.returnError(errCode,errMsg);
|
||||||
|
// return resultObj;
|
||||||
|
// }
|
||||||
|
String yyjzhye = "0";
|
||||||
|
Result<MZJSPreVO> mzjsPreVOResult = OtherWSUtil.PreSettlement(reqDTO, yyjzhye);
|
||||||
|
return mzjsPreVOResult;
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error("findPatientById返回结果异常----------"+e.toString());
|
||||||
|
|
||||||
|
errCode="999";
|
||||||
|
errMsg=e.getMessage();
|
||||||
|
resultObj=Result.returnError(errCode,errMsg);
|
||||||
|
return resultObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/Settlement")
|
||||||
|
@WebLog(description = "Settlement")
|
||||||
|
public HashMap<Object,Object> Settlement(@Validated @RequestBody SettlementDTO reqDTO) throws Exception {
|
||||||
|
HashMap<Object,Object> map = OtherWSUtil.Settlement(reqDTO);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/CancelPreSettlement")
|
||||||
|
@WebLog(description = "CancelPreSettlement")
|
||||||
|
public HashMap<Object,Object> CancelPreSettlement(@Validated @RequestBody CancelPreSettlementDTO reqDTO) throws Exception {
|
||||||
|
HashMap<Object,Object> map = OtherWSUtil.CancelPreSettlement(reqDTO);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getPath")
|
||||||
|
@WebLog(description = "getPath")
|
||||||
|
public HashMap<Object,Object> getPath() throws Exception {
|
||||||
|
|
||||||
|
HashMap<Object,Object> resultMap=new HashMap<>();
|
||||||
|
|
||||||
|
String partnerSecret = environment.getProperty("partnerSecret");
|
||||||
|
String orgChnlCrtfCodg = environment.getProperty("orgChnlCrtfCodg");
|
||||||
|
String orgCodg = environment.getProperty("orgCodg");
|
||||||
|
String orgAppId = environment.getProperty("orgAppId");
|
||||||
|
String wxApiUrl = environment.getProperty("wxApiUrl");
|
||||||
|
String channel = environment.getProperty("channel");
|
||||||
|
ClientDemo clientDemo = new ClientDemo(partnerSecret, orgChnlCrtfCodg, orgCodg, orgAppId,wxApiUrl,channel);
|
||||||
|
String path = clientDemo.getPath();
|
||||||
|
resultMap.put("path",path);
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getAuthNo")
|
||||||
|
@WebLog(description = "getAuthNo")
|
||||||
|
public JSONObject getAuthNo(@Validated @RequestBody AuthNoGet reqDTO) throws Exception {
|
||||||
|
|
||||||
|
//这里这样写主要怕这种敏感信息放前面这台电脑不行。所以,从文件取,这样到时候改也方便,即使不改,也没占多少资源。
|
||||||
|
String partnerSecret = environment.getProperty("partnerSecret");
|
||||||
|
String orgChnlCrtfCodg = environment.getProperty("orgChnlCrtfCodg");
|
||||||
|
String orgCodg = environment.getProperty("orgCodg");
|
||||||
|
String orgAppId = environment.getProperty("orgAppId");
|
||||||
|
String wxApiUrl = environment.getProperty("wxApiUrl");
|
||||||
|
String channel = environment.getProperty("channel");
|
||||||
|
ClientDemo clientDemo = new ClientDemo(partnerSecret, orgChnlCrtfCodg, orgCodg, orgAppId,wxApiUrl,channel);
|
||||||
|
|
||||||
|
String json = JSONObject.toJSONString(reqDTO);
|
||||||
|
|
||||||
|
//鉴于微信时不时可能改的抽风性格,这里返回不改
|
||||||
|
//{"code":0,"message":"success","user_name":"**","user_card_no":"**","pay_auth_no":"**","user_longitude_latitude":{"longitude":"120.134495","latitude":"30.276616"},"city_id":"000000"}
|
||||||
|
//user_name 用户姓名 user_card_no 医保卡号, pay_auth_no 授权码 ,longitude 经度 latitude 纬度 city_id 所在城市编码
|
||||||
|
String s = clientDemo.postData("test", "test2", ClientDemo.partnerId, json);
|
||||||
|
logger.info("授权查询接口返回:" + s);
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(s);
|
||||||
|
return jsonObject;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
127
src/main/java/com/saye/hrs/controller/WxybPayController.java
Normal file
127
src/main/java/com/saye/hrs/controller/WxybPayController.java
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
package com.saye.hrs.controller;
|
||||||
|
|
||||||
|
import com.github.wxpay.sdk.WXPayUtil;
|
||||||
|
import com.saye.hrs.commons.JsonUtils;
|
||||||
|
import com.saye.hrs.commons.exception.CustomException;
|
||||||
|
import com.saye.hrs.commons.log.LogUtil;
|
||||||
|
import com.saye.hrs.commons.wxpay.WxPayDUtil;
|
||||||
|
import com.saye.hrs.dto.PayQuery;
|
||||||
|
import com.saye.hrs.dto.Result;
|
||||||
|
import com.saye.hrs.dto.WxybAppletReuqest;
|
||||||
|
import com.saye.hrs.model.StatusDefine;
|
||||||
|
import com.saye.hrs.model.WxybResult;
|
||||||
|
import com.saye.hrs.service.PayService;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @title WxybPayController
|
||||||
|
* @description TODO 请填写注释
|
||||||
|
* @author thuang
|
||||||
|
* @create 2023/8/15 11:10
|
||||||
|
**/
|
||||||
|
@RestController
|
||||||
|
public class WxybPayController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PayService payService;
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(Object.class);
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping(value = "/api/wxybpay/ybAppletPay")
|
||||||
|
public Result ybAppletPay(@Validated @RequestBody WxybAppletReuqest reqDTO){
|
||||||
|
|
||||||
|
Result result = null;
|
||||||
|
String paramTip = "";
|
||||||
|
|
||||||
|
try {
|
||||||
|
paramTip = String.format(" >>> requestObj:%s", JsonUtils.beanToJson(reqDTO));
|
||||||
|
|
||||||
|
Map map = payService.ybAppletPay(reqDTO);
|
||||||
|
|
||||||
|
result = Result.returnSuccess(map);
|
||||||
|
} catch (CustomException e) {
|
||||||
|
result = Result.returnCustomError(e);
|
||||||
|
logger.error("发起微信医保支付失败CustomException,原因:" + e.getMessage()+"请求参数为:"+paramTip);
|
||||||
|
} catch (Exception e) {
|
||||||
|
result = Result.returnError("发起微信支付失败!");
|
||||||
|
logger.error("发起微信医保支付失败CustomException,原因:"+e.getMessage()+"请求参数为:"+paramTip);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/api/wxybpay/notify")
|
||||||
|
public String wxybPayNotify(@RequestBody String xmlStr, HttpServletResponse response, HttpServletRequest request) {
|
||||||
|
String paramTip = "";
|
||||||
|
Map<String,String> resultMap=new HashMap<>();
|
||||||
|
String errCode="0";
|
||||||
|
String errMsg="";
|
||||||
|
try {
|
||||||
|
paramTip = String.format(" >>> xmlStr:%s", xmlStr);
|
||||||
|
//微信回调签名校验
|
||||||
|
WxybResult wxybResult = WxPayDUtil.wxybPaySignatureValid(xmlStr);
|
||||||
|
logger.info("微信支付异步回调结果:" + JsonUtils.beanToJson(wxybResult));
|
||||||
|
|
||||||
|
this.payService.wxybPayNofify(wxybResult);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error(">>>微信支付回调失败>>>" + paramTip+" 原因"+e.getMessage());
|
||||||
|
errCode="999";
|
||||||
|
errMsg=e.getMessage();
|
||||||
|
//回退操作
|
||||||
|
}
|
||||||
|
|
||||||
|
if ("0".equals(errCode)){
|
||||||
|
resultMap.put("return_code","SUCCESS");
|
||||||
|
resultMap.put("return_msg","");
|
||||||
|
resultMap.put("result_code","SUCCESS");
|
||||||
|
}else{
|
||||||
|
resultMap.put("return_code","FAIL");
|
||||||
|
resultMap.put("return_msg","");
|
||||||
|
resultMap.put("result_code","FAIL");
|
||||||
|
}
|
||||||
|
String nonceStr = WxPayDUtil.generateNonceStr();
|
||||||
|
resultMap.put("nonce_str",nonceStr);
|
||||||
|
String mapStr="";
|
||||||
|
try {
|
||||||
|
resultMap.put("sign", WxPayDUtil.generateSignature(resultMap, StatusDefine.wxybkey));
|
||||||
|
mapStr = WXPayUtil.mapToXml(resultMap);
|
||||||
|
return mapStr;
|
||||||
|
}catch (Exception e){
|
||||||
|
LogUtil.error(this.getClass(),"返回微信医保回调通知组数据失败");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/api/wxybpay/findWxybPayResult")
|
||||||
|
public Result findWxybPayResult(@Validated @RequestBody PayQuery reqDTO){
|
||||||
|
Result result = null;
|
||||||
|
String paramTip = "";
|
||||||
|
try {
|
||||||
|
paramTip = String.format(" >>> requestObj:%s", JsonUtils.beanToJson(reqDTO));
|
||||||
|
|
||||||
|
Map map=payService.findWxybPayResult(reqDTO);
|
||||||
|
|
||||||
|
result = Result.returnSuccess(map);
|
||||||
|
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error(">>>查询微信医保支付结果失败>>>" + paramTip+" 原因"+e.getMessage());
|
||||||
|
result = Result.returnError("查询微信医保支付结果失败!原因:"+e.getMessage());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
21
src/main/java/com/saye/hrs/dto/AuthNoGet.java
Normal file
21
src/main/java/com/saye/hrs/dto/AuthNoGet.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package com.saye.hrs.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @title AutoNoGet
|
||||||
|
* @description TODO 请填写注释
|
||||||
|
* @author thuang
|
||||||
|
* @create 2023/8/9 11:28
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class AuthNoGet {
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String qrcode;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String openid;
|
||||||
|
}
|
||||||
22
src/main/java/com/saye/hrs/dto/CancelPreSettlementDTO.java
Normal file
22
src/main/java/com/saye/hrs/dto/CancelPreSettlementDTO.java
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package com.saye.hrs.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @title CancelPreSettlementDTO
|
||||||
|
* @description TODO 请填写注释
|
||||||
|
* @author thuang
|
||||||
|
* @create 2023/8/3 15:34
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class CancelPreSettlementDTO {
|
||||||
|
|
||||||
|
private String jssjh;
|
||||||
|
|
||||||
|
private String zfjsbz;
|
||||||
|
|
||||||
|
private String payOrdId;
|
||||||
|
|
||||||
|
private String payToken;
|
||||||
|
|
||||||
|
}
|
||||||
17
src/main/java/com/saye/hrs/dto/PatientFeeQuery.java
Normal file
17
src/main/java/com/saye/hrs/dto/PatientFeeQuery.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package com.saye.hrs.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @title PatientQuery
|
||||||
|
* @description TODO 请填写注释
|
||||||
|
* @author thuang
|
||||||
|
* @create 2023/8/3 10:05
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class PatientFeeQuery {
|
||||||
|
|
||||||
|
private String patid;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
20
src/main/java/com/saye/hrs/dto/PatientFeeSettledQuery.java
Normal file
20
src/main/java/com/saye/hrs/dto/PatientFeeSettledQuery.java
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package com.saye.hrs.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @title PatientQuery
|
||||||
|
* @description TODO 请填写注释
|
||||||
|
* @author thuang
|
||||||
|
* @create 2023/8/3 10:05
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class PatientFeeSettledQuery {
|
||||||
|
|
||||||
|
private String patid;
|
||||||
|
|
||||||
|
private String ksrq;
|
||||||
|
|
||||||
|
private String jsrq;
|
||||||
|
|
||||||
|
}
|
||||||
17
src/main/java/com/saye/hrs/dto/PayQuery.java
Normal file
17
src/main/java/com/saye/hrs/dto/PayQuery.java
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package com.saye.hrs.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @title PayQuery
|
||||||
|
* @description TODO 请填写注释
|
||||||
|
* @author thuang
|
||||||
|
* @create 2023/8/17 13:46
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class PayQuery {
|
||||||
|
|
||||||
|
private String out_trade_no;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
37
src/main/java/com/saye/hrs/dto/PreSettlementQuery.java
Normal file
37
src/main/java/com/saye/hrs/dto/PreSettlementQuery.java
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
package com.saye.hrs.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @title PreSettlementQuery
|
||||||
|
* @description TODO 请填写注释
|
||||||
|
* @author thuang
|
||||||
|
* @create 2023/8/3 14:37
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class PreSettlementQuery {
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String patid;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String cfxh;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String ghxh;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String zfjsbz;
|
||||||
|
|
||||||
|
private String ybrc;
|
||||||
|
|
||||||
|
private String inpayAuthNo;
|
||||||
|
|
||||||
|
private String uldLatlnt;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String out_ksmc;
|
||||||
|
|
||||||
|
}
|
||||||
53
src/main/java/com/saye/hrs/dto/Result.java
Normal file
53
src/main/java/com/saye/hrs/dto/Result.java
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
package com.saye.hrs.dto;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.saye.hrs.commons.exception.CustomException;
|
||||||
|
import com.saye.hrs.enums.CodeMessageEnum;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 结果
|
||||||
|
* @author zmc
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
public class Result<T> implements Serializable {
|
||||||
|
|
||||||
|
private String errCode;
|
||||||
|
private String errMsg;
|
||||||
|
|
||||||
|
private T data;
|
||||||
|
|
||||||
|
public Result() {
|
||||||
|
}
|
||||||
|
public Result(String errCode, String errMsg) {
|
||||||
|
this.errCode = errCode;
|
||||||
|
this.errMsg = errMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Result(String errCode, String errMsg, T data) {
|
||||||
|
this.errCode = errCode;
|
||||||
|
this.errMsg = errMsg;
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result returnError(String errMsg) {
|
||||||
|
return new Result(CodeMessageEnum.SERVICE_ERROR.getCode(), errMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result returnError(String errCode,String errMsg){
|
||||||
|
return new Result(errCode, errMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> Result<T> returnSuccess(T data) {
|
||||||
|
return new Result("0", "", data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Result returnCustomError(CustomException e) {
|
||||||
|
return new Result(e.getErrorCode(), e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
21
src/main/java/com/saye/hrs/dto/ResultDTO.java
Normal file
21
src/main/java/com/saye/hrs/dto/ResultDTO.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package com.saye.hrs.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 接口调用结果
|
||||||
|
* @author zmc
|
||||||
|
* @date 2020-09-28 11:38
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ResultDTO {
|
||||||
|
|
||||||
|
private String errCode;
|
||||||
|
private String errMsg;
|
||||||
|
//接口响应数据
|
||||||
|
private Object resData;
|
||||||
|
//
|
||||||
|
private Integer statusCode;
|
||||||
|
private String reasonPhrase;
|
||||||
|
|
||||||
|
}
|
||||||
24
src/main/java/com/saye/hrs/dto/SettlementDTO.java
Normal file
24
src/main/java/com/saye/hrs/dto/SettlementDTO.java
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package com.saye.hrs.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @title SettlementQuery
|
||||||
|
* @description TODO 请填写注释
|
||||||
|
* @author thuang
|
||||||
|
* @create 2023/8/3 15:11
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class SettlementDTO {
|
||||||
|
|
||||||
|
private String patid;
|
||||||
|
private String sjh;
|
||||||
|
private String zje;
|
||||||
|
private String ysje;
|
||||||
|
private String paytype;
|
||||||
|
private String paymoney;
|
||||||
|
private String paylsh;
|
||||||
|
private String zfjsbz;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
37
src/main/java/com/saye/hrs/dto/WxAppletPayRequest.java
Normal file
37
src/main/java/com/saye/hrs/dto/WxAppletPayRequest.java
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
package com.saye.hrs.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @title wxAppLetPayAdd
|
||||||
|
* @description TODO 请填写注释
|
||||||
|
* @author thuang
|
||||||
|
* @create 2023/8/14 13:14
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class WxAppletPayRequest {
|
||||||
|
|
||||||
|
private String orderTitle;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
private String total_fee;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String tradeNo;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String ysje;
|
||||||
|
@NotBlank
|
||||||
|
private String zfje;
|
||||||
|
@NotBlank
|
||||||
|
private String sjh;
|
||||||
|
@NotBlank
|
||||||
|
private String patid;
|
||||||
|
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
}
|
||||||
79
src/main/java/com/saye/hrs/dto/WxybAppletReuqest.java
Normal file
79
src/main/java/com/saye/hrs/dto/WxybAppletReuqest.java
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
package com.saye.hrs.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @title WxybAppletReuqest
|
||||||
|
* @description TODO 请填写注释
|
||||||
|
* @author thuang
|
||||||
|
* @create 2023/8/15 13:08
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class WxybAppletReuqest {
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String openid;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String hosp_out_trade_no;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String total_fee;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String cash_fee;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String ybzf;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String zhzf;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String yjjzf;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String return_url;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String city_id;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String pay_type;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String user_card_no;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String user_name;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String serial_no;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String gmt_out_create;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String request_content;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String ysje;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String patid;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String payOrdId;
|
||||||
|
|
||||||
|
@NotBlank
|
||||||
|
private String payToken;
|
||||||
|
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
//医保支付改为后台由 医保报销金额+医保账户支付
|
||||||
|
// @ApiModelProperty(hidden = true)
|
||||||
|
// private String insurance_fee;
|
||||||
|
}
|
||||||
44
src/main/java/com/saye/hrs/dto/WxybPay.java
Normal file
44
src/main/java/com/saye/hrs/dto/WxybPay.java
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
package com.saye.hrs.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @title WxybPay
|
||||||
|
* @description TODO 请填写注释
|
||||||
|
* @author thuang
|
||||||
|
* @create 2023/8/15 13:25
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class WxybPay {
|
||||||
|
|
||||||
|
private String order_type;
|
||||||
|
private String appid;
|
||||||
|
private String mch_id;
|
||||||
|
private String openid;
|
||||||
|
private String hosp_out_trade_no;
|
||||||
|
private String hospital_name;
|
||||||
|
private String nonce_str;
|
||||||
|
private String total_fee;
|
||||||
|
private String cash_fee;
|
||||||
|
private String cash_reduced_fee;
|
||||||
|
private String cash_reduced_wording;
|
||||||
|
private String allow_fee_change;
|
||||||
|
private String spbill_create_ip;
|
||||||
|
private String notify_url;
|
||||||
|
private String body;
|
||||||
|
private String return_url;
|
||||||
|
private String pay_type;
|
||||||
|
private String city_id;
|
||||||
|
private String insurance_fee;
|
||||||
|
private String user_card_type;
|
||||||
|
private String user_card_no;
|
||||||
|
private String user_name;
|
||||||
|
private String is_dept;
|
||||||
|
private String serial_no;
|
||||||
|
private String org_no;
|
||||||
|
private String gmt_out_create;
|
||||||
|
private String request_content;
|
||||||
|
private String attach;
|
||||||
|
private String channel_no;
|
||||||
|
private String sign;
|
||||||
|
}
|
||||||
39
src/main/java/com/saye/hrs/enums/CodeMessageEnum.java
Normal file
39
src/main/java/com/saye/hrs/enums/CodeMessageEnum.java
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
package com.saye.hrs.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 返回码
|
||||||
|
* @author zmc
|
||||||
|
*/
|
||||||
|
public enum CodeMessageEnum {
|
||||||
|
|
||||||
|
SUCCESS("0", "请求成功"),
|
||||||
|
REQUEST_ERROR("400", "请求失败"),
|
||||||
|
TOKEN_INVALID("401", "登录已失效"),
|
||||||
|
NOT_EXISTS("404", "记录不存在"),
|
||||||
|
NO_RIGHTS("403", "无权限"),
|
||||||
|
VALIDATE_ERROR("422", "验证错误"),
|
||||||
|
SERVICE_ERROR("500", "服务器错误"),
|
||||||
|
OAUTH("700", "未授权,请先跳至单点授权页面"),
|
||||||
|
|
||||||
|
INTERFACE_EXCEPTION("999", "调用接口发生异常"),
|
||||||
|
INTERFACE_STATUS_ERROR("8888", "接口响应状态异常"),
|
||||||
|
;
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMessage() {
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
CodeMessageEnum(String code, String message) {
|
||||||
|
this.code = code;
|
||||||
|
this.message = message;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
58
src/main/java/com/saye/hrs/enums/MedTradeStateEnum.java
Normal file
58
src/main/java/com/saye/hrs/enums/MedTradeStateEnum.java
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
package com.saye.hrs.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 返回码
|
||||||
|
* @author zmc
|
||||||
|
*/
|
||||||
|
public enum MedTradeStateEnum {
|
||||||
|
|
||||||
|
SUCCESS("支付成功", "SUCCESS"),
|
||||||
|
REFUND("转入退款", "REFUND"),
|
||||||
|
PAYING("支付中", "PAYING"),
|
||||||
|
SYS_REFUNDED("支付失败", "SYS_REFUNDED"),
|
||||||
|
SYS_REFUNDING("支付失败,异常处理中", "SYS_REFUNDING"),
|
||||||
|
NOTPAY("未支付", "NOTPAY"),
|
||||||
|
CLOSED("已关闭", "CLOSED"),
|
||||||
|
INITIAL("未绑卡", "INITIAL");
|
||||||
|
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
|
||||||
|
MedTradeStateEnum(String name, String value) {
|
||||||
|
this.name = name;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getValueByName(String name) {
|
||||||
|
String text = null;
|
||||||
|
for (MedTradeStateEnum tempEnum : MedTradeStateEnum.values()) {
|
||||||
|
if (name.equals(tempEnum.getName())) {
|
||||||
|
text = tempEnum.getValue();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getNameByValue(String value) {
|
||||||
|
String text = null;
|
||||||
|
for (MedTradeStateEnum tempEnum : MedTradeStateEnum.values()) {
|
||||||
|
if (value.equals(tempEnum.getValue())) {
|
||||||
|
text = tempEnum.getName();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
95
src/main/java/com/saye/hrs/model/MessageVo.java
Normal file
95
src/main/java/com/saye/hrs/model/MessageVo.java
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
package com.saye.hrs.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created with IntelliJ IDEA.
|
||||||
|
*
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @date: 2023/12/27
|
||||||
|
* @description:
|
||||||
|
* @modifiedBy:
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MessageVo {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息类型
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操纵时间
|
||||||
|
*/
|
||||||
|
private String operateTime;
|
||||||
|
/**
|
||||||
|
* 缴费类型
|
||||||
|
*/
|
||||||
|
private String payType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 病人姓名
|
||||||
|
*/
|
||||||
|
private String patientName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 身份信息
|
||||||
|
*/
|
||||||
|
private String identity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务金额
|
||||||
|
*/
|
||||||
|
private String amount;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 余额
|
||||||
|
*/
|
||||||
|
private String balance;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 科室代码(停诊医生所在的科室)
|
||||||
|
*/
|
||||||
|
private String departmentCode;
|
||||||
|
/**
|
||||||
|
* 科室名称(停诊医生所在的科室)
|
||||||
|
*/
|
||||||
|
private String departmentName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 医生姓名(停诊医生姓名)
|
||||||
|
*/
|
||||||
|
private String doctorName;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待缴费单据名称
|
||||||
|
*/
|
||||||
|
private String paymentReceipts;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 待缴费单据名称
|
||||||
|
*/
|
||||||
|
private String reportName;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目名称
|
||||||
|
*/
|
||||||
|
private String projectName;
|
||||||
|
|
||||||
|
private String openId;
|
||||||
|
|
||||||
|
|
||||||
|
private String templateId;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
18
src/main/java/com/saye/hrs/model/OrderNameVo.java
Normal file
18
src/main/java/com/saye/hrs/model/OrderNameVo.java
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package com.saye.hrs.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description:
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-04-18 17:29
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class OrderNameVo {
|
||||||
|
|
||||||
|
private String cardNo;
|
||||||
|
private String ksmc;
|
||||||
|
private String yyrq;
|
||||||
|
private String trueName;
|
||||||
|
|
||||||
|
}
|
||||||
22
src/main/java/com/saye/hrs/model/StatusDefine.java
Normal file
22
src/main/java/com/saye/hrs/model/StatusDefine.java
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package com.saye.hrs.model;
|
||||||
|
|
||||||
|
public class StatusDefine {
|
||||||
|
|
||||||
|
//后台地址
|
||||||
|
public static String IP_PORT;
|
||||||
|
|
||||||
|
public static String wxAppId = "";
|
||||||
|
public static String wxSecret = "";
|
||||||
|
public static String wxMchid = ""; //商户号
|
||||||
|
public static String wxWechartkey = ""; //支付密钥
|
||||||
|
|
||||||
|
// public static String wxybkey= "1GRUDB4KG2BF3F60C80A0000BD2934B4";
|
||||||
|
public static String wxybkey= "";
|
||||||
|
|
||||||
|
public static String wxCertPath = ""; //小程序证书文件路径
|
||||||
|
public static String wxTokenUrl; //wxtoken获取地址
|
||||||
|
|
||||||
|
public static String cityId="";
|
||||||
|
|
||||||
|
public static String channel="";
|
||||||
|
}
|
||||||
38
src/main/java/com/saye/hrs/model/WxybResult.java
Normal file
38
src/main/java/com/saye/hrs/model/WxybResult.java
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package com.saye.hrs.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @title WxybResult
|
||||||
|
* @description TODO 请填写注释
|
||||||
|
* @author thuang
|
||||||
|
* @create 2023/8/17 15:51
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
public class WxybResult {
|
||||||
|
|
||||||
|
private String return_code;
|
||||||
|
private String return_msg;
|
||||||
|
|
||||||
|
private String appid;
|
||||||
|
private String mch_id;
|
||||||
|
private String nonce_str;
|
||||||
|
private String med_trans_id;
|
||||||
|
private String hosp_out_trade_no;
|
||||||
|
private String result_code;
|
||||||
|
private String time_end;
|
||||||
|
private Integer pay_type;
|
||||||
|
private Integer total_fee;
|
||||||
|
private Integer cash_fee;
|
||||||
|
private Integer insurance_fee;
|
||||||
|
private String serial_no;
|
||||||
|
private String cash_order_id;
|
||||||
|
private String attach;
|
||||||
|
private String sign;
|
||||||
|
|
||||||
|
private String err_code;
|
||||||
|
private String err_code_des;
|
||||||
|
|
||||||
|
//结算状态
|
||||||
|
private String mzjsStatus;
|
||||||
|
}
|
||||||
16
src/main/java/com/saye/hrs/model/YbPassbackParams.java
Normal file
16
src/main/java/com/saye/hrs/model/YbPassbackParams.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
package com.saye.hrs.model;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class YbPassbackParams {
|
||||||
|
|
||||||
|
private String patid;
|
||||||
|
private String ysje;
|
||||||
|
|
||||||
|
private String payOrdId;
|
||||||
|
private String payToken;
|
||||||
|
|
||||||
|
}
|
||||||
127
src/main/java/com/saye/hrs/scheduler/CheckRecharge.java
Normal file
127
src/main/java/com/saye/hrs/scheduler/CheckRecharge.java
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
//package com.saye.hrs.scheduler;
|
||||||
|
//
|
||||||
|
//import java.util.Date;
|
||||||
|
//import java.util.HashMap;
|
||||||
|
//import java.util.List;
|
||||||
|
//import java.util.TreeMap;
|
||||||
|
//import java.util.Map.Entry;
|
||||||
|
//
|
||||||
|
//import javax.annotation.Resource;
|
||||||
|
//
|
||||||
|
//import org.slf4j.Logger;
|
||||||
|
//import org.slf4j.LoggerFactory;
|
||||||
|
//import org.springframework.context.annotation.Configuration;
|
||||||
|
//import org.springframework.http.HttpEntity;
|
||||||
|
//import org.springframework.http.HttpHeaders;
|
||||||
|
//import org.springframework.http.HttpMethod;
|
||||||
|
//import org.springframework.http.MediaType;
|
||||||
|
//import org.springframework.http.ResponseEntity;
|
||||||
|
//import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
//import org.springframework.web.client.RestTemplate;
|
||||||
|
//
|
||||||
|
//import com.alibaba.fastjson.JSON;
|
||||||
|
//import com.saye.hrs.commons.date.DateDUtil;
|
||||||
|
//import com.saye.hrs.commons.encrypt.EncryptUtil;
|
||||||
|
//import com.saye.hrs.commons.string.StringDUtil;
|
||||||
|
//import com.saye.hrs.commons.webservice.WSUtil;
|
||||||
|
//import com.saye.hrs.controller.ApiController;
|
||||||
|
//import com.saye.hrs.model.StatusDefine;
|
||||||
|
//
|
||||||
|
//@Configuration
|
||||||
|
//public class CheckRecharge {
|
||||||
|
//
|
||||||
|
// private static final Logger logger = LoggerFactory.getLogger(ApiController.class);
|
||||||
|
//
|
||||||
|
// @Scheduled(cron="0 */1 * * * ?")
|
||||||
|
// public void run() {
|
||||||
|
// logger.debug("定时检查充值信息开始!");
|
||||||
|
// try {
|
||||||
|
// RestTemplate restTemplate = new RestTemplate();
|
||||||
|
// HttpHeaders headers = new HttpHeaders();
|
||||||
|
// headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
||||||
|
// String url = StatusDefine.IP_PORT+"/api/findRechargeWait";
|
||||||
|
// HttpEntity<String> entity = new HttpEntity<String>("{}", headers);
|
||||||
|
// ResponseEntity<List> resp =restTemplate.exchange(url, HttpMethod.POST, entity, List.class);
|
||||||
|
// List list = resp.getBody();
|
||||||
|
// for(int i=0;i<list.size();i++) {
|
||||||
|
// HashMap orderMap = (HashMap) list.get(i);
|
||||||
|
// String merOrderId = StringDUtil.changeNullToEmpty(orderMap.get("MERORDERID"));
|
||||||
|
// TreeMap<Object,Object> map = new TreeMap<Object,Object>();
|
||||||
|
// map.put("msgSrcId", "12YK");
|
||||||
|
// map.put("msgSrc", "WWW.KRLSFYBJ.COM");
|
||||||
|
// map.put("msgType", "query");
|
||||||
|
// map.put("requestTimestamp", DateDUtil.getTheCurrentTime());
|
||||||
|
// map.put("merOrderId", merOrderId);
|
||||||
|
// map.put("mid", "898652880620011");
|
||||||
|
// map.put("tid", "65954193");
|
||||||
|
// map.put("signType", "SHA256");
|
||||||
|
// String key = "KfG8PnwGSK8AXQFKtyfQnKi3x5kcZtDkWX2tctAMhcF5e6Ax";
|
||||||
|
// StringBuilder str = new StringBuilder();
|
||||||
|
// for(Entry<Object, Object> e: map.entrySet()) {
|
||||||
|
// str.append(e.getKey());
|
||||||
|
// str.append("=");
|
||||||
|
// str.append(e.getValue());
|
||||||
|
// str.append("&");
|
||||||
|
// }
|
||||||
|
// str.deleteCharAt(str.length()-1);
|
||||||
|
// str.append(key);
|
||||||
|
// String sign = EncryptUtil.getSHA256Str(str.toString());
|
||||||
|
// map.put("sign", sign.toUpperCase());
|
||||||
|
// url = "https://qr.chinaums.com/netpay-route-server/api/";
|
||||||
|
// String body = JSON.toJSONString(map);
|
||||||
|
// entity = new HttpEntity<String>(body, headers);
|
||||||
|
// ResponseEntity<HashMap> resp1 =restTemplate.exchange(url, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
// HashMap result = resp1.getBody();
|
||||||
|
// String status = StringDUtil.changeNullToEmpty(result.get("status"));
|
||||||
|
// String targetOrderId = StringDUtil.changeNullToEmpty(result.get("targetOrderId"));
|
||||||
|
// //支付结果信息写入数据库
|
||||||
|
// HashMap<Object,Object> requestMap = new HashMap<Object,Object>();
|
||||||
|
// url = StatusDefine.IP_PORT+"/api/addHisRecharge";
|
||||||
|
// requestMap.put("status", status);
|
||||||
|
// requestMap.put("merOrderId", merOrderId);
|
||||||
|
// requestMap.put("targetOrderId", targetOrderId);
|
||||||
|
// requestMap.put("resultText", JSON.toJSONString(result));
|
||||||
|
// HttpEntity<String> entity1 = new HttpEntity<String>(JSON.toJSONString(requestMap), headers) ;
|
||||||
|
// ResponseEntity<HashMap> resp2 =restTemplate.exchange(url, HttpMethod.POST, entity1, HashMap.class);
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// logger.error("定时检查充值信息异常"+e.toString());
|
||||||
|
// }
|
||||||
|
// logger.debug("定时检查充值信息结束!");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
// RestTemplate restTemplate = new RestTemplate();
|
||||||
|
// HttpHeaders headers = new HttpHeaders();
|
||||||
|
// headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
||||||
|
// HttpEntity<String> entity = new HttpEntity<String>("{}", headers);
|
||||||
|
// String merOrderId = "12YK20231211121037254";
|
||||||
|
// TreeMap<Object,Object> map = new TreeMap<Object,Object>();
|
||||||
|
// map.put("msgSrcId", "12YK");
|
||||||
|
// map.put("msgSrc", "WWW.KRLSFYBJ.COM");
|
||||||
|
// map.put("msgType", "query");
|
||||||
|
// map.put("requestTimestamp", DateDUtil.getTheCurrentTime());
|
||||||
|
// map.put("merOrderId", merOrderId);
|
||||||
|
// map.put("mid", "898652880620011");
|
||||||
|
// map.put("tid", "65954193");
|
||||||
|
// map.put("signType", "SHA256");
|
||||||
|
// String key = "KfG8PnwGSK8AXQFKtyfQnKi3x5kcZtDkWX2tctAMhcF5e6Ax";
|
||||||
|
// StringBuilder str = new StringBuilder();
|
||||||
|
// for(Entry<Object, Object> e: map.entrySet()) {
|
||||||
|
// str.append(e.getKey());
|
||||||
|
// str.append("=");
|
||||||
|
// str.append(e.getValue());
|
||||||
|
// str.append("&");
|
||||||
|
// }
|
||||||
|
// str.deleteCharAt(str.length()-1);
|
||||||
|
// str.append(key);
|
||||||
|
// String sign = EncryptUtil.getSHA256Str(str.toString());
|
||||||
|
// map.put("sign", sign.toUpperCase());
|
||||||
|
// String url = "https://qr.chinaums.com/netpay-route-server/api/";
|
||||||
|
// String body = JSON.toJSONString(map);
|
||||||
|
// entity = new HttpEntity<String>(body, headers);
|
||||||
|
// ResponseEntity<HashMap> resp1 =restTemplate.exchange(url, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
// HashMap result = resp1.getBody();
|
||||||
|
// System.out.println(result);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
59
src/main/java/com/saye/hrs/scheduler/LoadStatusDefine.java
Normal file
59
src/main/java/com/saye/hrs/scheduler/LoadStatusDefine.java
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
package com.saye.hrs.scheduler;
|
||||||
|
|
||||||
|
import com.saye.hrs.commons.log.LogUtil;
|
||||||
|
import com.saye.hrs.model.StatusDefine;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.ApplicationArguments;
|
||||||
|
import org.springframework.boot.ApplicationRunner;
|
||||||
|
import org.springframework.core.annotation.Order;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 项目启动完成后加载默认参数
|
||||||
|
* @author thuang
|
||||||
|
* @date 2022/3/15 13:17
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Order(value = 1)
|
||||||
|
public class LoadStatusDefine implements ApplicationRunner {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Environment environment;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(ApplicationArguments args) throws Exception {
|
||||||
|
LogUtil.debug(this.getClass(),"/************************************开始加载系统默认参数*************************************************/");
|
||||||
|
|
||||||
|
String appid = environment.getProperty("appid");
|
||||||
|
String secret = environment.getProperty("secret");
|
||||||
|
String wxMchid = environment.getProperty("wxMchid");
|
||||||
|
String wxWechartkey = environment.getProperty("wxWechartkey");
|
||||||
|
String wxybkey = environment.getProperty("wxybkey");
|
||||||
|
String wxCertPath = environment.getProperty("wxCertPath");
|
||||||
|
String ip_port = environment.getProperty("IP_PORT");
|
||||||
|
String wxTokenUrl = environment.getProperty("wxTokenUrl");
|
||||||
|
String cityId = environment.getProperty("cityId");//这个不用了
|
||||||
|
String channel = environment.getProperty("channel");
|
||||||
|
|
||||||
|
StatusDefine.wxAppId=appid;
|
||||||
|
StatusDefine.wxSecret=secret;
|
||||||
|
StatusDefine.wxMchid=wxMchid;
|
||||||
|
StatusDefine.wxWechartkey=wxWechartkey;
|
||||||
|
StatusDefine.wxybkey=wxybkey;
|
||||||
|
StatusDefine.wxCertPath=wxCertPath;
|
||||||
|
StatusDefine.IP_PORT=ip_port;
|
||||||
|
StatusDefine.wxTokenUrl=wxTokenUrl;
|
||||||
|
StatusDefine.channel=channel;
|
||||||
|
|
||||||
|
LogUtil.debug(this.getClass(),"/************************************加载系统默认参数完成*************************************************/");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
182
src/main/java/com/saye/hrs/scheduler/ReSendMessage.java
Normal file
182
src/main/java/com/saye/hrs/scheduler/ReSendMessage.java
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
//package com.saye.hrs.scheduler;
|
||||||
|
//
|
||||||
|
//import com.alibaba.fastjson.JSONObject;
|
||||||
|
//import com.saye.hrs.commons.date.DateDUtil;
|
||||||
|
//import com.saye.hrs.commons.log.LogUtil;
|
||||||
|
//import com.saye.hrs.commons.qitahoutai.HoutaiService;
|
||||||
|
//import com.saye.hrs.commons.string.StringDUtil;
|
||||||
|
//import com.saye.hrs.commons.webservice.OtherWSUtil;
|
||||||
|
//import com.saye.hrs.commons.wxpay.pojo.PassbackParams;
|
||||||
|
//import com.saye.hrs.commons.wxpay.pojo.WxResult;
|
||||||
|
//import com.saye.hrs.dto.SettlementDTO;
|
||||||
|
//import com.saye.hrs.model.StatusDefine;
|
||||||
|
//import com.saye.hrs.model.WxybResult;
|
||||||
|
//import com.saye.hrs.model.YbPassbackParams;
|
||||||
|
//import org.springframework.context.annotation.Configuration;
|
||||||
|
//import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
//
|
||||||
|
//import javax.annotation.Resource;
|
||||||
|
//import java.math.BigDecimal;
|
||||||
|
//import java.math.RoundingMode;
|
||||||
|
//import java.net.URLDecoder;
|
||||||
|
//import java.util.Calendar;
|
||||||
|
//import java.util.Date;
|
||||||
|
//import java.util.HashMap;
|
||||||
|
//import java.util.List;
|
||||||
|
//
|
||||||
|
///***
|
||||||
|
// * @title ReSendMessage
|
||||||
|
// * @description TODO 已经废弃 本地不做任何处理
|
||||||
|
// * @author thuang
|
||||||
|
// * @create 2023/8/22 10:10
|
||||||
|
// **/
|
||||||
|
//@Configuration
|
||||||
|
//public class ReSendMessage {
|
||||||
|
//
|
||||||
|
// @Resource
|
||||||
|
// private HoutaiService houtaiService;
|
||||||
|
//
|
||||||
|
// @Scheduled(cron="0 0 0 * * ?")
|
||||||
|
// private void ReSendLastMessage(){
|
||||||
|
// //获取前一个星期没发送成功的记录,重新发送
|
||||||
|
// Calendar calendar = Calendar.getInstance();
|
||||||
|
// calendar.setTime(new Date());
|
||||||
|
// calendar.add(Calendar.DATE,-7);
|
||||||
|
// Date time = calendar.getTime();
|
||||||
|
// String startTime = DateDUtil.DateToStr(DateDUtil.yyyyMMdd, time);
|
||||||
|
//
|
||||||
|
// //查询数据库中的记录 先查询微信没发送的
|
||||||
|
// try {
|
||||||
|
// String findUrl= StatusDefine.IP_PORT+"/api/getWxNotSendInfo";
|
||||||
|
// HashMap<Object,Object> searchMap=new HashMap<>();
|
||||||
|
// searchMap.put("endTime", DateDUtil.yyyyMMdd);
|
||||||
|
// searchMap.put("startTime", startTime);
|
||||||
|
// HashMap<Object, Object> map = houtaiService.PostInfoByParam(findUrl, searchMap);
|
||||||
|
// String errCode = StringDUtil.changeNullToEmpty(map.get("errCode"));
|
||||||
|
//
|
||||||
|
// if ("0".equals(errCode)){
|
||||||
|
// List<WxResult> mapList = (List<WxResult>) map.get("List");
|
||||||
|
//
|
||||||
|
// //重新发送
|
||||||
|
// for (WxResult wxResult : mapList) {
|
||||||
|
// try {
|
||||||
|
// PassbackParams callBackParam = JSONObject.parseObject(URLDecoder.decode(wxResult.getAttach(), "UTF-8"), PassbackParams.class);
|
||||||
|
// if ("SUCCESS".equals(wxResult.getResult_code()) && "SUCCESS".equals(wxResult.getReturn_code())) {
|
||||||
|
//
|
||||||
|
// //查询后台错误 不知道有没有发过 先发了再说
|
||||||
|
// SettlementDTO reqDTO=new SettlementDTO();
|
||||||
|
// reqDTO.setPatid(callBackParam.getPatid());
|
||||||
|
// reqDTO.setSjh(callBackParam.getSjh());
|
||||||
|
// reqDTO.setZje(callBackParam.getZje());
|
||||||
|
// reqDTO.setYsje(callBackParam.getYsje());
|
||||||
|
// reqDTO.setPaymoney(callBackParam.getZfje());
|
||||||
|
// reqDTO.setPaytype("9");
|
||||||
|
// reqDTO.setPaylsh(wxResult.getTransaction_id());
|
||||||
|
// reqDTO.setZfjsbz("1");
|
||||||
|
// HashMap<Object, Object> settlementResultMap = OtherWSUtil.Settlement(reqDTO);
|
||||||
|
//
|
||||||
|
// String errCode1 = StringDUtil.changeNullToEmpty(settlementResultMap.get("errCode"));
|
||||||
|
//
|
||||||
|
// if ("0".equals(errCode1)){
|
||||||
|
// wxResult.setMzjsStatus("1");
|
||||||
|
// }else {
|
||||||
|
// wxResult.setMzjsStatus("0");
|
||||||
|
// LogUtil.error(this.getClass(),StringDUtil.changeNullToEmpty(settlementResultMap.get("errMsg")));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //成功存储信息
|
||||||
|
// String url = StatusDefine.IP_PORT+"/api/addWxPayInfo";
|
||||||
|
// houtaiService.PostInfoByParam(url,wxResult);
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }catch (Exception e){
|
||||||
|
// e.printStackTrace();
|
||||||
|
// LogUtil.error(this.getClass(),"晚上定时发送未写入his的记录失败,原因"+e.getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }catch (Exception e){
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //再查询医保没发送的
|
||||||
|
// try {
|
||||||
|
// String findUrl= StatusDefine.IP_PORT+"/api/getWxybNotSendInfo";
|
||||||
|
// HashMap<Object,Object> searchMap=new HashMap<>();
|
||||||
|
// searchMap.put("endTime", DateDUtil.yyyyMMdd);
|
||||||
|
// searchMap.put("startTime", startTime);
|
||||||
|
// HashMap<Object, Object> map = houtaiService.PostInfoByParam(findUrl, searchMap);
|
||||||
|
// String errCode = StringDUtil.changeNullToEmpty(map.get("errCode"));
|
||||||
|
//
|
||||||
|
// if ("0".equals(errCode)){
|
||||||
|
// List<WxybResult> mapList = (List<WxybResult>) map.get("List");
|
||||||
|
//
|
||||||
|
// for (WxybResult wxybResult : mapList) {
|
||||||
|
// try {
|
||||||
|
// YbPassbackParams callBackParam = JSONObject.parseObject(URLDecoder.decode(wxybResult.getAttach(), "UTF-8"), YbPassbackParams.class);
|
||||||
|
//
|
||||||
|
// if ("SUCCESS".equals(wxybResult.getResult_code()) && "SUCCESS".equals(wxybResult.getReturn_code())) {
|
||||||
|
// //查询后台错误 不知道有没有发过 先发了再说
|
||||||
|
// SettlementDTO reqDTO = new SettlementDTO();
|
||||||
|
// reqDTO.setPatid(callBackParam.getPatid());
|
||||||
|
// reqDTO.setSjh(wxybResult.getSerial_no());
|
||||||
|
// reqDTO.setYsje(callBackParam.getYsje());
|
||||||
|
//
|
||||||
|
// //从微信返回的金额为分,要改为元来传输给his
|
||||||
|
// Integer totalFee = wxybResult.getTotal_fee();
|
||||||
|
// Integer cashFee = wxybResult.getCash_fee();
|
||||||
|
// BigDecimal totalFeeBD = new BigDecimal(totalFee).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
|
||||||
|
// BigDecimal cashFeeBD = new BigDecimal(cashFee).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
|
||||||
|
//
|
||||||
|
// reqDTO.setZje(totalFeeBD.toString());
|
||||||
|
// reqDTO.setPaymoney(cashFeeBD.toString());
|
||||||
|
// reqDTO.setPaytype("9");
|
||||||
|
// reqDTO.setPaylsh(wxybResult.getCash_order_id());
|
||||||
|
// reqDTO.setZfjsbz("0");
|
||||||
|
// HashMap<Object, Object> settlementResultMap = OtherWSUtil.Settlement(reqDTO);
|
||||||
|
//
|
||||||
|
// String errCode1 = StringDUtil.changeNullToEmpty(settlementResultMap.get("errCode"));
|
||||||
|
//
|
||||||
|
// if ("0".equals(errCode1)) {
|
||||||
|
// wxybResult.setMzjsStatus("1");
|
||||||
|
// } else {
|
||||||
|
// wxybResult.setMzjsStatus("0");
|
||||||
|
// LogUtil.error(this.getClass(), StringDUtil.changeNullToEmpty(settlementResultMap.get("errMsg")));
|
||||||
|
// }
|
||||||
|
// //存储信息
|
||||||
|
// String url = StatusDefine.IP_PORT + "/api/addWxybPayInfo";
|
||||||
|
// houtaiService.PostInfoByParam(url, wxybResult);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }catch (Exception e){
|
||||||
|
// e.printStackTrace();
|
||||||
|
// LogUtil.error(this.getClass(),"晚上定时发送未写入his的医保记录失败,原因"+e.getMessage());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }catch (Exception e){
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
// SettlementDTO reqDTO=new SettlementDTO();
|
||||||
|
// reqDTO.setPatid("421322");
|
||||||
|
// reqDTO.setSjh("20230823yypt120036");
|
||||||
|
// reqDTO.setZje("2.36");
|
||||||
|
// reqDTO.setYsje("2.3600");
|
||||||
|
// reqDTO.setPaymoney("2.3600");
|
||||||
|
// reqDTO.setPaytype("9");
|
||||||
|
// reqDTO.setPaylsh("4200001956202308234945588695");
|
||||||
|
// reqDTO.setZfjsbz("1");
|
||||||
|
// HashMap<Object, Object> settlementResultMap = OtherWSUtil.Settlement(reqDTO);
|
||||||
|
//
|
||||||
|
// String errCode1 = StringDUtil.changeNullToEmpty(settlementResultMap.get("errCode"));
|
||||||
|
// String errMsg = StringDUtil.changeNullToEmpty(settlementResultMap.get("errMsg"));
|
||||||
|
// System.out.println(errCode1);
|
||||||
|
// System.out.println(errMsg);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
132
src/main/java/com/saye/hrs/scheduler/RetrieveAccessToken.java
Normal file
132
src/main/java/com/saye/hrs/scheduler/RetrieveAccessToken.java
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
package com.saye.hrs.scheduler;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.saye.hrs.commons.getBean.GetBeanUtil;
|
||||||
|
import com.saye.hrs.config.RestTemplateConfig;
|
||||||
|
import com.saye.hrs.model.StatusDefine;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.http.HttpEntity;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @title RetrieveAccessToken
|
||||||
|
* @description TODO 请填写注释
|
||||||
|
* @author thuang
|
||||||
|
* @create 2023/8/11 15:36
|
||||||
|
**/
|
||||||
|
//@Configuration
|
||||||
|
public class RetrieveAccessToken {
|
||||||
|
|
||||||
|
private static String access_token;
|
||||||
|
//获取到的token的失效时间
|
||||||
|
private static Integer token_expire;
|
||||||
|
private static long tokenTimeMillis;
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(Object.class);
|
||||||
|
|
||||||
|
// @Scheduled(cron="0 0 0/1 * * ?")
|
||||||
|
// private void retrieveToken(){
|
||||||
|
// manualToken();
|
||||||
|
// }
|
||||||
|
|
||||||
|
public static String getToken(){
|
||||||
|
if (access_token==null){
|
||||||
|
manualToken();
|
||||||
|
}
|
||||||
|
//使用的token的时候,如果当前时间-获取token的时间 < 60 * 5 ,则重新获取
|
||||||
|
long currentTimeMillis = System.currentTimeMillis();
|
||||||
|
logger.debug("expires_in:" + token_expire);
|
||||||
|
logger.debug("tokenTimeMillis:" + tokenTimeMillis);
|
||||||
|
logger.debug("currentTimeMillis:" + currentTimeMillis);
|
||||||
|
|
||||||
|
if(token_expire - (tokenTimeMillis - currentTimeMillis) < 300){
|
||||||
|
manualToken();
|
||||||
|
}
|
||||||
|
return access_token;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void manualToken(){
|
||||||
|
System.out.println("开始获取微信token");
|
||||||
|
String url=StatusDefine.wxTokenUrl;
|
||||||
|
|
||||||
|
HashMap<Object,Object> dataMap=new HashMap<>();
|
||||||
|
dataMap.put("grant_type","client_credential");
|
||||||
|
dataMap.put("appid",StatusDefine.wxAppId);
|
||||||
|
dataMap.put("secret",StatusDefine.wxSecret);
|
||||||
|
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
HttpEntity<Object> entity = new HttpEntity<>(dataMap, headers);
|
||||||
|
|
||||||
|
RestTemplateConfig restTemplateConfig = GetBeanUtil.getBean(RestTemplateConfig.class);
|
||||||
|
RestTemplate restTemplate = restTemplateConfig.getInstance();
|
||||||
|
|
||||||
|
ResponseEntity<String> forEntity = restTemplate.postForEntity(url,entity, String.class);
|
||||||
|
int statusCodeValue = forEntity.getStatusCodeValue();
|
||||||
|
|
||||||
|
if (statusCodeValue==200){
|
||||||
|
String body = forEntity.getBody();
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(body);
|
||||||
|
|
||||||
|
Integer errcode = jsonObject.getInteger("errcode");
|
||||||
|
|
||||||
|
if(errcode==null){
|
||||||
|
access_token = jsonObject.getString("access_token");
|
||||||
|
// Integer integer = jsonObject.getInteger("expires_in");
|
||||||
|
token_expire = jsonObject.getInteger("expires_in");
|
||||||
|
tokenTimeMillis = System.currentTimeMillis();
|
||||||
|
|
||||||
|
logger.debug("access_token:" + access_token);
|
||||||
|
logger.debug("expires_in:" + token_expire);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
String errmsg = jsonObject.getString("errmsg");
|
||||||
|
logger.error("获取access_token错误,errcode:"+errcode+"errMsg:"+errmsg);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
logger.error("获取access_token错误,statusCodeValue:"+statusCodeValue);
|
||||||
|
}
|
||||||
|
System.out.println("获取微信token结束");
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static void manualToken(){
|
||||||
|
// System.out.println("开始获取微信token");
|
||||||
|
// String url=StatusDefine.wxTokenUrl+"?grant_type=client_credential&appid="+StatusDefine.wxAppId+"&secret="+StatusDefine.wxSecret;
|
||||||
|
//
|
||||||
|
// RestTemplateConfig restTemplateConfig = GetBeanUtil.getBean(RestTemplateConfig.class);
|
||||||
|
// RestTemplate restTemplate = restTemplateConfig.getInstance();
|
||||||
|
//
|
||||||
|
// ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
|
||||||
|
// int statusCodeValue = forEntity.getStatusCodeValue();
|
||||||
|
//
|
||||||
|
// if (statusCodeValue==200){
|
||||||
|
// String body = forEntity.getBody();
|
||||||
|
// JSONObject jsonObject = JSONObject.parseObject(body);
|
||||||
|
//
|
||||||
|
// Integer errcode = jsonObject.getInteger("errcode");
|
||||||
|
//
|
||||||
|
// if(errcode==null){
|
||||||
|
// access_token = jsonObject.getString("access_token");
|
||||||
|
// token_expire = jsonObject.getInteger("expires_in");
|
||||||
|
// tokenTimeMillis = System.currentTimeMillis();
|
||||||
|
// }else{
|
||||||
|
// String errmsg = jsonObject.getString("errmsg");
|
||||||
|
// logger.error("获取access_token错误,errcode:"+errcode+"errMsg:"+errmsg);
|
||||||
|
// }
|
||||||
|
// }else{
|
||||||
|
// logger.error("获取access_token错误,statusCodeValue:"+statusCodeValue);
|
||||||
|
// }
|
||||||
|
// System.out.println("获取微信token结束");
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
198
src/main/java/com/saye/hrs/scheduler/Runner.java
Normal file
198
src/main/java/com/saye/hrs/scheduler/Runner.java
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
//package com.saye.hrs.scheduler;
|
||||||
|
//
|
||||||
|
//import com.alibaba.fastjson.JSON;
|
||||||
|
//import com.saye.hrs.commons.date.DateDUtil;
|
||||||
|
//import com.saye.hrs.commons.encrypt.EncryptUtil;
|
||||||
|
//import com.saye.hrs.commons.string.StringDUtil;
|
||||||
|
//import com.saye.hrs.controller.ApiController;
|
||||||
|
//import com.saye.hrs.model.StatusDefine;
|
||||||
|
//import org.slf4j.Logger;
|
||||||
|
//import org.slf4j.LoggerFactory;
|
||||||
|
//import org.springframework.boot.CommandLineRunner;
|
||||||
|
//import org.springframework.core.annotation.Order;
|
||||||
|
//import org.springframework.http.*;
|
||||||
|
//import org.springframework.stereotype.Component;
|
||||||
|
//import org.springframework.web.client.RestTemplate;
|
||||||
|
//
|
||||||
|
//import java.util.HashMap;
|
||||||
|
//import java.util.List;
|
||||||
|
//import java.util.Map.Entry;
|
||||||
|
//import java.util.TreeMap;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
///**
|
||||||
|
// * Description: 放弃这种写法,同checkRecharge一样,一定时间后会有问题
|
||||||
|
// * @author dqzhang
|
||||||
|
// * @created 2020年5月19日 下午2:56:20
|
||||||
|
// */
|
||||||
|
//@Component
|
||||||
|
//@Order(value=1)
|
||||||
|
//public class Runner implements CommandLineRunner{
|
||||||
|
// private static final Logger logger = LoggerFactory.getLogger(ApiController.class);
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void run(String... args) throws Exception{
|
||||||
|
// new Thread(new Runnable() {
|
||||||
|
// @Override
|
||||||
|
// public void run() {
|
||||||
|
// while(true) {
|
||||||
|
// long startTime = System.currentTimeMillis();
|
||||||
|
// logger.debug("定时检查充值信息开始!");
|
||||||
|
// try {
|
||||||
|
// RestTemplate restTemplate = new RestTemplate();
|
||||||
|
// HttpHeaders headers = new HttpHeaders();
|
||||||
|
// headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
||||||
|
// String url = StatusDefine.IP_PORT+"/api/findRechargeWait";
|
||||||
|
// HttpEntity<String> entity = new HttpEntity<String>("{}", headers);
|
||||||
|
// ResponseEntity<List> resp =restTemplate.exchange(url, HttpMethod.POST, entity, List.class);
|
||||||
|
// logger.debug("查询充值信息记录结束");
|
||||||
|
// List list = resp.getBody();
|
||||||
|
// for(int i=0;i<list.size();i++) {
|
||||||
|
// HashMap orderMap = (HashMap) list.get(i);
|
||||||
|
// String merOrderId = StringDUtil.changeNullToEmpty(orderMap.get("MERORDERID"));
|
||||||
|
// String totalAmount = StringDUtil.changeNullToEmpty(orderMap.get("TOTALAMOUNT"));
|
||||||
|
// TreeMap<Object,Object> map = new TreeMap<Object,Object>();
|
||||||
|
// map.put("msgSrcId", "12YK");
|
||||||
|
// map.put("msgSrc", "WWW.KRLSFYBJ.COM");
|
||||||
|
// map.put("msgType", "query");
|
||||||
|
// map.put("requestTimestamp", DateDUtil.getTheCurrentTime());
|
||||||
|
// map.put("merOrderId", merOrderId);
|
||||||
|
// map.put("mid", "898652880620011");
|
||||||
|
// map.put("tid", "65954193");
|
||||||
|
// map.put("signType", "SHA256");
|
||||||
|
// String key = "KfG8PnwGSK8AXQFKtyfQnKi3x5kcZtDkWX2tctAMhcF5e6Ax";
|
||||||
|
// StringBuilder str = new StringBuilder();
|
||||||
|
// for(Entry<Object, Object> e: map.entrySet()) {
|
||||||
|
// str.append(e.getKey());
|
||||||
|
// str.append("=");
|
||||||
|
// str.append(e.getValue());
|
||||||
|
// str.append("&");
|
||||||
|
// }
|
||||||
|
// str.deleteCharAt(str.length()-1);
|
||||||
|
// str.append(key);
|
||||||
|
// String sign = EncryptUtil.getSHA256Str(str.toString());
|
||||||
|
// map.put("sign", sign.toUpperCase());
|
||||||
|
// url = "https://qr.chinaums.com/netpay-route-server/api/";
|
||||||
|
// String body = JSON.toJSONString(map);
|
||||||
|
// entity = new HttpEntity<String>(body, headers);
|
||||||
|
// logger.debug(merOrderId+"查询充值结果开始");
|
||||||
|
// ResponseEntity<HashMap> resp1 =restTemplate.exchange(url, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
// logger.debug(merOrderId+"查询充值结果结束");
|
||||||
|
// HashMap result = resp1.getBody();
|
||||||
|
// String status = StringDUtil.changeNullToEmpty(result.get("status"));
|
||||||
|
// String targetOrderId = StringDUtil.changeNullToEmpty(result.get("targetOrderId"));
|
||||||
|
// //支付结果信息写入数据库
|
||||||
|
// HashMap<Object,Object> requestMap = new HashMap<Object,Object>();
|
||||||
|
// url = StatusDefine.IP_PORT+"/api/addHisRecharge";
|
||||||
|
// requestMap.put("status", status);
|
||||||
|
// requestMap.put("merOrderId", merOrderId);
|
||||||
|
// requestMap.put("targetOrderId", targetOrderId);
|
||||||
|
// requestMap.put("resultText", JSON.toJSONString(result));
|
||||||
|
// HttpEntity<String> entity1 = new HttpEntity<String>(JSON.toJSONString(requestMap), headers) ;
|
||||||
|
// logger.debug(merOrderId+"结果信息写入数据库开始");
|
||||||
|
// ResponseEntity<HashMap> resp2 =restTemplate.exchange(url, HttpMethod.POST, entity1, HashMap.class);
|
||||||
|
// logger.debug(merOrderId+"结果信息写入数据库结束");
|
||||||
|
// HashMap resultMap = resp2.getBody();
|
||||||
|
// //his充值失败 进行退款
|
||||||
|
// if("2".equals(resultMap.get("hisStatus"))) {
|
||||||
|
// logger.debug(merOrderId+"执行退款开始");
|
||||||
|
// refund(merOrderId,totalAmount,0);
|
||||||
|
// logger.debug(merOrderId+"执行退款结束");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// logger.error("定时检查充值信息异常"+e.toString());
|
||||||
|
// }
|
||||||
|
// logger.debug("定时检查充值信息结束!");
|
||||||
|
// long endTime = System.currentTimeMillis();
|
||||||
|
// try {
|
||||||
|
// long jg = endTime - startTime;
|
||||||
|
// if (jg<(30*1000)){
|
||||||
|
// Thread.sleep((30*1000)-jg);
|
||||||
|
// }
|
||||||
|
// } catch (InterruptedException e) {
|
||||||
|
// // TODO Auto-generated catch block
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }).start();
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void refund(String originalOrderId,String Amount,int index) {
|
||||||
|
//
|
||||||
|
// if(index>1) {
|
||||||
|
// //两次退款失败后 不再进行退款 写入消息提醒
|
||||||
|
// String url = StatusDefine.IP_PORT+"/api/addRefundMessageNotice";
|
||||||
|
// HashMap<Object,Object> map = new HashMap<Object,Object>();
|
||||||
|
// map.put("id", originalOrderId);
|
||||||
|
// String body = JSON.toJSONString(map);
|
||||||
|
// RestTemplate restTemplate = new RestTemplate();
|
||||||
|
// HttpHeaders headers = new HttpHeaders();
|
||||||
|
// headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
// HttpEntity<String> entity = new HttpEntity<String>(body, headers) ;
|
||||||
|
// ResponseEntity<HashMap> resp1 =restTemplate.exchange(url, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// String errCode = "";
|
||||||
|
// String errMsg = "";
|
||||||
|
// TreeMap<Object,Object> map = new TreeMap<Object,Object>();
|
||||||
|
// map.put("msgSrcId", "12YK");
|
||||||
|
// map.put("msgSrc", "WWW.KRLSFYBJ.COM");
|
||||||
|
// map.put("msgType", "refund");
|
||||||
|
// map.put("requestTimestamp", DateDUtil.getTheCurrentTime());
|
||||||
|
// map.put("merOrderId", originalOrderId);
|
||||||
|
// map.put("mid", "898652880620011");
|
||||||
|
// map.put("tid", "65954193");
|
||||||
|
// map.put("refundAmount", Amount);
|
||||||
|
// map.put("signType", "SHA256");
|
||||||
|
// String key = "KfG8PnwGSK8AXQFKtyfQnKi3x5kcZtDkWX2tctAMhcF5e6Ax";
|
||||||
|
// StringBuilder str = new StringBuilder();
|
||||||
|
// for(Entry<Object, Object> e: map.entrySet()) {
|
||||||
|
// str.append(e.getKey());
|
||||||
|
// str.append("=");
|
||||||
|
// str.append(e.getValue());
|
||||||
|
// str.append("&");
|
||||||
|
// }
|
||||||
|
// str.deleteCharAt(str.length()-1);
|
||||||
|
// str.append(key);
|
||||||
|
// String sign = EncryptUtil.getSHA256Str(str.toString());
|
||||||
|
// map.put("sign", sign.toUpperCase());
|
||||||
|
// String url = "https://qr.chinaums.com/netpay-route-server/api/";
|
||||||
|
// RestTemplate restTemplate = new RestTemplate();
|
||||||
|
// HttpHeaders headers = new HttpHeaders();
|
||||||
|
// headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
// String body = JSON.toJSONString(map);
|
||||||
|
// HttpEntity<String> entity = new HttpEntity<String>(body, headers);
|
||||||
|
// ResponseEntity<HashMap> res =restTemplate.exchange(url, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
// HashMap resultMap = res.getBody();
|
||||||
|
// //成功后写入退款信息
|
||||||
|
// if("0".equals(resultMap.get("errCode"))) {
|
||||||
|
//
|
||||||
|
// String refundOrderId = StringDUtil.changeNullToEmpty(resultMap.get("refundOrderId"));
|
||||||
|
//
|
||||||
|
// HashMap<Object,Object> refundMap = new HashMap<Object,Object>();
|
||||||
|
// refundMap.put("refundOrderId",refundOrderId);
|
||||||
|
// refundMap.put("czyh","");
|
||||||
|
// refundMap.put("hzid","");
|
||||||
|
// refundMap.put("hzxm","");
|
||||||
|
// refundMap.put("tranType","");
|
||||||
|
// refundMap.put("Amount",Amount);
|
||||||
|
// refundMap.put("payType","");
|
||||||
|
// refundMap.put("payCode","");
|
||||||
|
// refundMap.put("originalOrderId",originalOrderId);
|
||||||
|
// refundMap.put("merchantOrderId",originalOrderId);
|
||||||
|
// refundMap.put("refundRequestId",refundOrderId);
|
||||||
|
// url = StatusDefine.IP_PORT+"/api/addRefund";
|
||||||
|
// String requestBody = JSON.toJSONString(refundMap);
|
||||||
|
// logger.info("退款请求参数"+requestBody);
|
||||||
|
// entity = new HttpEntity<String>(requestBody, headers) ;
|
||||||
|
// ResponseEntity<HashMap> result =restTemplate.exchange(url, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
// }else {
|
||||||
|
// index++;
|
||||||
|
// refund(originalOrderId,Amount,index);
|
||||||
|
// }
|
||||||
|
// logger.info("退款参数"+body+"结果:"+resultMap);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.saye.hrs.scheduler.factory;
|
||||||
|
|
||||||
|
import org.quartz.spi.TriggerFiredBundle;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
|
||||||
|
import org.springframework.scheduling.quartz.AdaptableJobFactory;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class MyJobFactory extends AdaptableJobFactory {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AutowireCapableBeanFactory capableBeanFactory;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Object createJobInstance(TriggerFiredBundle bundle) throws Exception {
|
||||||
|
// 调用父类的方法
|
||||||
|
Object jobInstance = super.createJobInstance(bundle);
|
||||||
|
// 进行注入
|
||||||
|
capableBeanFactory.autowireBean(jobInstance);
|
||||||
|
return jobInstance;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package com.saye.hrs.scheduler.factory;
|
||||||
|
|
||||||
|
|
||||||
|
import com.saye.hrs.commons.getBean.GetBeanUtil;
|
||||||
|
import com.saye.hrs.commons.string.StringDUtil;
|
||||||
|
import org.quartz.*;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 调度工厂类
|
||||||
|
*/
|
||||||
|
@Service("MySchedulerFactory")
|
||||||
|
@Component
|
||||||
|
public class MySchedulerFactory {
|
||||||
|
private static Logger logger = LoggerFactory.getLogger(MySchedulerFactory.class);
|
||||||
|
|
||||||
|
public SchedulerFactoryBean getSchedulerFactoryBean(){
|
||||||
|
return GetBeanUtil.getBean(SchedulerFactoryBean.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void scheduleJobs() throws Exception {
|
||||||
|
Scheduler scheduler = getScheduler();
|
||||||
|
// 为了避免org.quartz.ObjectAlreadyExistsException,在执行前将scheduler进行清理
|
||||||
|
scheduler.clear();
|
||||||
|
|
||||||
|
//添加任务
|
||||||
|
addJob("1","定时检查充值信息",null,"0/30 * * * * ?","com.saye.hrs.scheduler.job.CheckRecharge");
|
||||||
|
|
||||||
|
addJob("2","获取微信token",null,"0 0 0/1 * * ?","com.saye.hrs.scheduler.job.WXManualToken");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取scheduler
|
||||||
|
* @return
|
||||||
|
* @author
|
||||||
|
* @date 2018年12月27日
|
||||||
|
*/
|
||||||
|
public Scheduler getScheduler() {
|
||||||
|
return getSchedulerFactoryBean().getScheduler();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加新的定时任务
|
||||||
|
* @param id
|
||||||
|
* @param name
|
||||||
|
* @param group
|
||||||
|
* @param cron
|
||||||
|
* @param classz
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public void addJob(String id,String name, String group,String cron, String classz) throws Exception{
|
||||||
|
|
||||||
|
Scheduler scheduler = getScheduler();
|
||||||
|
try {
|
||||||
|
if (StringDUtil.isNotBlank(classz)) {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
Class<? extends Job> clazz = (Class<? extends Job>) Class.forName(classz);
|
||||||
|
JobDetail jobDetail = JobBuilder.newJob(clazz).withIdentity(id, group)
|
||||||
|
.usingJobData("id", id).usingJobData("name", name).build();
|
||||||
|
CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(cron);
|
||||||
|
CronTrigger cronTrigger = TriggerBuilder.newTrigger().withIdentity(id, group)
|
||||||
|
.withSchedule(scheduleBuilder).build();
|
||||||
|
scheduler.scheduleJob(jobDetail, cronTrigger);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.info("添加定时任务失败:" + " 异常信息:" + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.saye.hrs.scheduler.factory;
|
||||||
|
|
||||||
|
import com.saye.hrs.commons.getBean.GetBeanUtil;
|
||||||
|
import org.quartz.SchedulerException;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationListener;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.event.ContextRefreshedEvent;
|
||||||
|
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时任务运行工厂类
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class StartSchedulerListener implements ApplicationListener<ContextRefreshedEvent> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public MySchedulerFactory mySchedulerFactory;
|
||||||
|
@Autowired
|
||||||
|
private MyJobFactory myJobFactory;
|
||||||
|
|
||||||
|
// springboot 启动监听
|
||||||
|
@Override
|
||||||
|
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||||
|
try {
|
||||||
|
mySchedulerFactory.scheduleJobs();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//注入SchedulerFactoryBean
|
||||||
|
@Bean
|
||||||
|
public SchedulerFactoryBean schedulerFactoryBean() {
|
||||||
|
SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean();
|
||||||
|
schedulerFactoryBean.setJobFactory(myJobFactory);
|
||||||
|
return schedulerFactoryBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
191
src/main/java/com/saye/hrs/scheduler/job/CheckRecharge.java
Normal file
191
src/main/java/com/saye/hrs/scheduler/job/CheckRecharge.java
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
package com.saye.hrs.scheduler.job;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.saye.hrs.commons.date.DateDUtil;
|
||||||
|
import com.saye.hrs.commons.encrypt.EncryptUtil;
|
||||||
|
import com.saye.hrs.commons.string.StringDUtil;
|
||||||
|
import com.saye.hrs.controller.ApiController;
|
||||||
|
import com.saye.hrs.model.StatusDefine;
|
||||||
|
import org.quartz.DisallowConcurrentExecution;
|
||||||
|
import org.quartz.Job;
|
||||||
|
import org.quartz.JobExecutionContext;
|
||||||
|
import org.quartz.JobExecutionException;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.http.*;
|
||||||
|
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @title CheckRecharge
|
||||||
|
* @description TODO 请填写注释
|
||||||
|
* @author thuang
|
||||||
|
* @create 2024/2/18 13:22
|
||||||
|
**/
|
||||||
|
@DisallowConcurrentExecution
|
||||||
|
public class CheckRecharge implements Job {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(ApiController.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||||
|
logger.debug("定时检查充值信息开始!");
|
||||||
|
try {
|
||||||
|
|
||||||
|
SimpleClientHttpRequestFactory httpRequestFactory = new SimpleClientHttpRequestFactory();
|
||||||
|
httpRequestFactory.setConnectTimeout(30 * 1000);
|
||||||
|
httpRequestFactory.setReadTimeout(60 * 1000);
|
||||||
|
RestTemplate restTemplate = new RestTemplate(httpRequestFactory);
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON_UTF8);
|
||||||
|
String url = StatusDefine.IP_PORT+"/api/findRechargeWait";
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>("{}", headers);
|
||||||
|
ResponseEntity<List> resp =restTemplate.exchange(url, HttpMethod.POST, entity, List.class);
|
||||||
|
logger.debug("查询充值信息记录结束");
|
||||||
|
List list = resp.getBody();
|
||||||
|
for(int i=0;i<list.size();i++) {
|
||||||
|
HashMap orderMap = (HashMap) list.get(i);
|
||||||
|
String merOrderId = StringDUtil.changeNullToEmpty(orderMap.get("MERORDERID"));
|
||||||
|
String totalAmount = StringDUtil.changeNullToEmpty(orderMap.get("TOTALAMOUNT"));
|
||||||
|
TreeMap<Object,Object> map = new TreeMap<Object,Object>();
|
||||||
|
map.put("msgSrcId", "12YK");
|
||||||
|
map.put("msgSrc", "WWW.KRLSFYBJ.COM");
|
||||||
|
map.put("msgType", "query");
|
||||||
|
map.put("requestTimestamp", DateDUtil.getTheCurrentTime());
|
||||||
|
map.put("merOrderId", merOrderId);
|
||||||
|
map.put("mid", "898652880620011");
|
||||||
|
map.put("tid", "65954193");
|
||||||
|
map.put("signType", "SHA256");
|
||||||
|
String key = "KfG8PnwGSK8AXQFKtyfQnKi3x5kcZtDkWX2tctAMhcF5e6Ax";
|
||||||
|
StringBuilder str = new StringBuilder();
|
||||||
|
for(Map.Entry<Object, Object> e: map.entrySet()) {
|
||||||
|
str.append(e.getKey());
|
||||||
|
str.append("=");
|
||||||
|
str.append(e.getValue());
|
||||||
|
str.append("&");
|
||||||
|
}
|
||||||
|
str.deleteCharAt(str.length()-1);
|
||||||
|
str.append(key);
|
||||||
|
String sign = EncryptUtil.getSHA256Str(str.toString());
|
||||||
|
map.put("sign", sign.toUpperCase());
|
||||||
|
url = "https://qr.chinaums.com/netpay-route-server/api/";
|
||||||
|
String body = JSON.toJSONString(map);
|
||||||
|
entity = new HttpEntity<String>(body, headers);
|
||||||
|
logger.debug(merOrderId+"查询充值结果开始");
|
||||||
|
ResponseEntity<HashMap> resp1 =restTemplate.exchange(url, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
logger.debug(merOrderId+"查询充值结果结束");
|
||||||
|
HashMap result = resp1.getBody();
|
||||||
|
String status = StringDUtil.changeNullToEmpty(result.get("status"));
|
||||||
|
String targetOrderId = StringDUtil.changeNullToEmpty(result.get("targetOrderId"));
|
||||||
|
//支付结果信息写入数据库
|
||||||
|
HashMap<Object,Object> requestMap = new HashMap<Object,Object>();
|
||||||
|
url = StatusDefine.IP_PORT+"/api/addHisRecharge";
|
||||||
|
requestMap.put("status", status);
|
||||||
|
requestMap.put("merOrderId", merOrderId);
|
||||||
|
requestMap.put("targetOrderId", targetOrderId);
|
||||||
|
requestMap.put("resultText", JSON.toJSONString(result));
|
||||||
|
HttpEntity<String> entity1 = new HttpEntity<String>(JSON.toJSONString(requestMap), headers) ;
|
||||||
|
logger.debug(merOrderId+"结果信息写入数据库开始");
|
||||||
|
ResponseEntity<HashMap> resp2 =restTemplate.exchange(url, HttpMethod.POST, entity1, HashMap.class);
|
||||||
|
logger.debug(merOrderId+"结果信息写入数据库结束");
|
||||||
|
HashMap resultMap = resp2.getBody();
|
||||||
|
//his充值失败 进行退款
|
||||||
|
if("2".equals(resultMap.get("hisStatus"))) {
|
||||||
|
logger.debug(merOrderId+"执行退款开始");
|
||||||
|
refund(merOrderId,totalAmount,0);
|
||||||
|
logger.debug(merOrderId+"执行退款结束");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("定时检查充值信息异常"+e.toString());
|
||||||
|
}
|
||||||
|
logger.debug("定时检查充值信息结束!");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void refund(String originalOrderId,String Amount,int index) {
|
||||||
|
|
||||||
|
if(index>1) {
|
||||||
|
//两次退款失败后 不再进行退款 写入消息提醒
|
||||||
|
String url = StatusDefine.IP_PORT+"/api/addRefundMessageNotice";
|
||||||
|
HashMap<Object,Object> map = new HashMap<Object,Object>();
|
||||||
|
map.put("id", originalOrderId);
|
||||||
|
String body = JSON.toJSONString(map);
|
||||||
|
SimpleClientHttpRequestFactory httpRequestFactory = new SimpleClientHttpRequestFactory();
|
||||||
|
httpRequestFactory.setConnectTimeout(60 * 1000);
|
||||||
|
httpRequestFactory.setReadTimeout(5 * 60 * 1000);
|
||||||
|
RestTemplate restTemplate = new RestTemplate(httpRequestFactory);
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(body, headers) ;
|
||||||
|
ResponseEntity<HashMap> resp1 =restTemplate.exchange(url, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String errCode = "";
|
||||||
|
String errMsg = "";
|
||||||
|
TreeMap<Object,Object> map = new TreeMap<Object,Object>();
|
||||||
|
map.put("msgSrcId", "12YK");
|
||||||
|
map.put("msgSrc", "WWW.KRLSFYBJ.COM");
|
||||||
|
map.put("msgType", "refund");
|
||||||
|
map.put("requestTimestamp", DateDUtil.getTheCurrentTime());
|
||||||
|
map.put("merOrderId", originalOrderId);
|
||||||
|
map.put("mid", "898652880620011");
|
||||||
|
map.put("tid", "65954193");
|
||||||
|
map.put("refundAmount", Amount);
|
||||||
|
map.put("signType", "SHA256");
|
||||||
|
String key = "KfG8PnwGSK8AXQFKtyfQnKi3x5kcZtDkWX2tctAMhcF5e6Ax";
|
||||||
|
StringBuilder str = new StringBuilder();
|
||||||
|
for(Map.Entry<Object, Object> e: map.entrySet()) {
|
||||||
|
str.append(e.getKey());
|
||||||
|
str.append("=");
|
||||||
|
str.append(e.getValue());
|
||||||
|
str.append("&");
|
||||||
|
}
|
||||||
|
str.deleteCharAt(str.length()-1);
|
||||||
|
str.append(key);
|
||||||
|
String sign = EncryptUtil.getSHA256Str(str.toString());
|
||||||
|
map.put("sign", sign.toUpperCase());
|
||||||
|
String url = "https://qr.chinaums.com/netpay-route-server/api/";
|
||||||
|
SimpleClientHttpRequestFactory httpRequestFactory = new SimpleClientHttpRequestFactory();
|
||||||
|
httpRequestFactory.setConnectTimeout(60 * 1000);
|
||||||
|
httpRequestFactory.setReadTimeout(5 * 60 * 1000);
|
||||||
|
RestTemplate restTemplate = new RestTemplate(httpRequestFactory);
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
String body = JSON.toJSONString(map);
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(body, headers);
|
||||||
|
ResponseEntity<HashMap> res =restTemplate.exchange(url, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
HashMap resultMap = res.getBody();
|
||||||
|
//成功后写入退款信息
|
||||||
|
if("0".equals(resultMap.get("errCode"))) {
|
||||||
|
|
||||||
|
String refundOrderId = StringDUtil.changeNullToEmpty(resultMap.get("refundOrderId"));
|
||||||
|
|
||||||
|
HashMap<Object,Object> refundMap = new HashMap<Object,Object>();
|
||||||
|
refundMap.put("refundOrderId",refundOrderId);
|
||||||
|
refundMap.put("czyh","");
|
||||||
|
refundMap.put("hzid","");
|
||||||
|
refundMap.put("hzxm","");
|
||||||
|
refundMap.put("tranType","");
|
||||||
|
refundMap.put("Amount",Amount);
|
||||||
|
refundMap.put("payType","");
|
||||||
|
refundMap.put("payCode","");
|
||||||
|
refundMap.put("originalOrderId",originalOrderId);
|
||||||
|
refundMap.put("merchantOrderId",originalOrderId);
|
||||||
|
refundMap.put("refundRequestId",refundOrderId);
|
||||||
|
url = StatusDefine.IP_PORT+"/api/addRefund";
|
||||||
|
String requestBody = JSON.toJSONString(refundMap);
|
||||||
|
logger.info("退款请求参数"+requestBody);
|
||||||
|
entity = new HttpEntity<String>(requestBody, headers) ;
|
||||||
|
ResponseEntity<HashMap> result =restTemplate.exchange(url, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
}else {
|
||||||
|
index++;
|
||||||
|
refund(originalOrderId,Amount,index);
|
||||||
|
}
|
||||||
|
logger.info("退款参数"+body+"结果:"+resultMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
21
src/main/java/com/saye/hrs/scheduler/job/WXManualToken.java
Normal file
21
src/main/java/com/saye/hrs/scheduler/job/WXManualToken.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package com.saye.hrs.scheduler.job;
|
||||||
|
|
||||||
|
import com.saye.hrs.scheduler.RetrieveAccessToken;
|
||||||
|
import org.quartz.Job;
|
||||||
|
import org.quartz.JobExecutionContext;
|
||||||
|
import org.quartz.JobExecutionException;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @title WXManualToken
|
||||||
|
* @description TODO 请填写注释
|
||||||
|
* @author thuang
|
||||||
|
* @create 2024/2/18 14:07
|
||||||
|
**/
|
||||||
|
public class WXManualToken implements Job {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||||
|
RetrieveAccessToken.manualToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
12
src/main/java/com/saye/hrs/service/CallNumbersService.java
Normal file
12
src/main/java/com/saye/hrs/service/CallNumbersService.java
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package com.saye.hrs.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 排队叫号业务接口
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-04-15 16:57
|
||||||
|
**/
|
||||||
|
public interface CallNumbersService {
|
||||||
|
|
||||||
|
|
||||||
|
String getCallNumberByIdentity(String identity,String sfzh);
|
||||||
|
}
|
||||||
25
src/main/java/com/saye/hrs/service/HisViewSearchService.java
Normal file
25
src/main/java/com/saye/hrs/service/HisViewSearchService.java
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package com.saye.hrs.service;
|
||||||
|
|
||||||
|
import com.saye.hrs.vo.DeptListVo;
|
||||||
|
import com.saye.hrs.vo.DeptVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: his视图业务接口
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-04-15 17:03
|
||||||
|
**/
|
||||||
|
public interface HisViewSearchService {
|
||||||
|
|
||||||
|
|
||||||
|
String getHistoricalVisits(String patientName, String idcard);
|
||||||
|
|
||||||
|
List<DeptListVo> getHisDeptList();
|
||||||
|
List<DeptVo> getHisDept(String deptId);
|
||||||
|
|
||||||
|
List<DeptVo> getHisDeptAdd();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.saye.hrs.service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 导诊业务接口
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-04-15 12:08
|
||||||
|
**/
|
||||||
|
public interface IntelligentGuidanceCategoryService {
|
||||||
|
|
||||||
|
|
||||||
|
String getSymptom(String bodyAreaType);
|
||||||
|
|
||||||
|
String getQuestionsByChildId(String childId);
|
||||||
|
|
||||||
|
String getAllBodyArea(HashMap<String,Object> reqMap);
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.saye.hrs.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 医嘱查询业务接口
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-04-15 18:01
|
||||||
|
**/
|
||||||
|
public interface MedicalAdviceEnquiryService {
|
||||||
|
|
||||||
|
}
|
||||||
31
src/main/java/com/saye/hrs/service/PayService.java
Normal file
31
src/main/java/com/saye/hrs/service/PayService.java
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
package com.saye.hrs.service;
|
||||||
|
|
||||||
|
import com.saye.hrs.commons.wxpay.pojo.WxResult;
|
||||||
|
import com.saye.hrs.dto.PayQuery;
|
||||||
|
import com.saye.hrs.dto.WxAppletPayRequest;
|
||||||
|
import com.saye.hrs.dto.WxybAppletReuqest;
|
||||||
|
import com.saye.hrs.model.WxybResult;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @title PayService
|
||||||
|
* @description TODO 请填写注释
|
||||||
|
* @author thuang
|
||||||
|
* @create 2023/8/14 8:46
|
||||||
|
**/
|
||||||
|
public interface PayService {
|
||||||
|
|
||||||
|
Map wxAppletPay(WxAppletPayRequest reqDTO) throws Exception;
|
||||||
|
|
||||||
|
void wxPayNofify(WxResult wxResult);
|
||||||
|
|
||||||
|
Map ybAppletPay(WxybAppletReuqest reqDTO);
|
||||||
|
|
||||||
|
Map findWxPayResult(PayQuery reqDTO) throws Exception;
|
||||||
|
|
||||||
|
void wxybPayNofify(WxybResult wxybResult);
|
||||||
|
|
||||||
|
Map findWxybPayResult(PayQuery reqDTO) throws Exception;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.saye.hrs.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 系统参数获取接口
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-04-16 16:23
|
||||||
|
**/
|
||||||
|
public interface ServiceParamService {
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.saye.hrs.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.saye.hrs.service.CallNumbersService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 排队叫号业务接口实现类
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-04-15 16:57
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class CallNumbersServiceImpl implements CallNumbersService {
|
||||||
|
|
||||||
|
private static final String DATA_GET_URL = "http://12.0.2.1:8081/dataManager";
|
||||||
|
// private static final String DATA_GET_URL = "http://218.84.202.146:58080/datamsg";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCallNumberByIdentity(String identity, String sfzh) {
|
||||||
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("identity", identity);
|
||||||
|
paramMap.put("sfzh", sfzh);
|
||||||
|
String result = HttpUtil.get(DATA_GET_URL + "/callNumbers/getCallNumberByIdentity", paramMap);
|
||||||
|
log.info("result is :" + result);
|
||||||
|
JSONObject resultJson = JSONUtil.parseObj(result);
|
||||||
|
if (Convert.toInt(resultJson.get("status")) > 0) {//响应成功
|
||||||
|
Object resData = resultJson.get("data");
|
||||||
|
return JSONUtil.toJsonStr(resData);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
package com.saye.hrs.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.saye.hrs.commons.JsonUtils;
|
||||||
|
import com.saye.hrs.service.HisViewSearchService;
|
||||||
|
import com.saye.hrs.vo.DeptListVo;
|
||||||
|
import com.saye.hrs.vo.DeptVo;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: his视图业务接口实现类
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-04-15 17:03
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class HisViewSearchServiceImpl implements HisViewSearchService {
|
||||||
|
private static final String DATA_GET_URL = "http://12.0.2.1:8081/dataManager";
|
||||||
|
// private static final String DATA_GET_URL = "http://218.84.202.146:58080/datamsg";
|
||||||
|
|
||||||
|
//addtional datamanger
|
||||||
|
private static final String DATA_GET_ADDURL = "http://12.0.2.1:8081/dataManagerAdd";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getHistoricalVisits(String patientName, String idcard) {
|
||||||
|
|
||||||
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("patient_name", patientName);
|
||||||
|
paramMap.put("idcard", idcard);
|
||||||
|
String result = HttpUtil.get(DATA_GET_URL + "/hisViewSearch/getHistoricalVisits", paramMap);
|
||||||
|
JSONObject resultJson = JSONUtil.parseObj(result);
|
||||||
|
if (Convert.toInt(resultJson.get("status")) > 0) {// 响应成功
|
||||||
|
Object resData = resultJson.get("data");
|
||||||
|
return JSONUtil.toJsonStr(resData);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeptListVo> getHisDeptList() {
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
List<DeptListVo> deptListVos= new ArrayList<>();
|
||||||
|
String result = HttpUtil.get(DATA_GET_URL + "/hisViewSearch/getHisDeptList");
|
||||||
|
JSONObject resultJson = JSONUtil.parseObj(result);
|
||||||
|
if (Convert.toInt(resultJson.get("status")) > 0) {// 响应成功
|
||||||
|
Object data = resultJson.get("data");
|
||||||
|
deptListVos = JsonUtils.jsonToList(data.toString(), DeptListVo.class);
|
||||||
|
}
|
||||||
|
return deptListVos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeptVo> getHisDept(String deptId) {
|
||||||
|
HashMap<String, Object> reqmap = new HashMap<>();
|
||||||
|
HashMap<String, Object> resMap = new HashMap<>();
|
||||||
|
List<DeptVo> deptVos= new ArrayList<>();
|
||||||
|
reqmap.put("deptId",deptId);
|
||||||
|
String result = HttpUtil.get(DATA_GET_URL + "/hisViewSearch/getHisDept", reqmap);
|
||||||
|
JSONObject resultJson = JSONUtil.parseObj(result);
|
||||||
|
if (Convert.toInt(resultJson.get("status")) > 0) {// 响应成功
|
||||||
|
Object data = resultJson.get("data");
|
||||||
|
deptVos = JsonUtils.jsonToList(data.toString(), DeptVo.class);
|
||||||
|
}
|
||||||
|
return deptVos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeptVo> getHisDeptAdd() {
|
||||||
|
HashMap<String, Object> reqmap = new HashMap<>();
|
||||||
|
HashMap<String, Object> resMap = new HashMap<>();
|
||||||
|
List<DeptVo> deptVos= new ArrayList<>();
|
||||||
|
String result = HttpUtil.get(DATA_GET_ADDURL + "/hisViewSearch/getHisDeptAdd");
|
||||||
|
JSONObject resultJson = JSONUtil.parseObj(result);
|
||||||
|
if (Convert.toInt(resultJson.get("status")) > 0) {// 响应成功
|
||||||
|
Object data = resultJson.get("data");
|
||||||
|
deptVos = JsonUtils.jsonToList(data.toString(), DeptVo.class);
|
||||||
|
}
|
||||||
|
return deptVos;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package com.saye.hrs.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
|
import cn.hutool.http.HttpUtil;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.saye.hrs.service.IntelligentGuidanceCategoryService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 导诊业务接口实现类
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-04-15 12:08
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class IntelligentGuidanceCategoryServiceImpl implements IntelligentGuidanceCategoryService {
|
||||||
|
|
||||||
|
private static final String DATA_GET_URL = "http://12.0.2.1:8081/dataManager";
|
||||||
|
// private static final String DATA_GET_URL = "http://218.84.202.146:58080/datamsg";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSymptom(String bodyAreaType) {
|
||||||
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("bodyAreaType", bodyAreaType);
|
||||||
|
String result = HttpUtil.get(DATA_GET_URL + "/IntelligentGuidance/getSymptom", paramMap);
|
||||||
|
JSONObject resultJson = JSONUtil.parseObj(result);
|
||||||
|
if (Convert.toInt(resultJson.get("status")) > 0) {// 响应成功
|
||||||
|
Object resData = resultJson.get("data");
|
||||||
|
return JSONUtil.toJsonStr(resData);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getQuestionsByChildId(String childId) {
|
||||||
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("childId", childId);
|
||||||
|
String result = HttpUtil.get(DATA_GET_URL + "/IntelligentGuidance/getQuestions", paramMap);
|
||||||
|
JSONObject resultJson = JSONUtil.parseObj(result);
|
||||||
|
if (Convert.toInt(resultJson.get("status")) > 0) {// 响应成功
|
||||||
|
Object resData = resultJson.get("data");
|
||||||
|
return JSONUtil.toJsonStr(resData);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getAllBodyArea(HashMap<String, Object> reqMap) {
|
||||||
|
log.info("reqMap:{}", reqMap);
|
||||||
|
String result = HttpUtil.get(DATA_GET_URL + "/IntelligentGuidance/getAllBodyArea", reqMap);
|
||||||
|
JSONObject resultJson = JSONUtil.parseObj(result);
|
||||||
|
if (Convert.toInt(resultJson.get("status")) > 0) {// 响应成功
|
||||||
|
Object resData = resultJson.get("data");
|
||||||
|
return JSONUtil.toJsonStr(resData);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.saye.hrs.service.impl;
|
||||||
|
|
||||||
|
import com.saye.hrs.service.MedicalAdviceEnquiryService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 医嘱查询业务接口实现类
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-04-15 18:01
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class MedicalAdviceEnquiryServiceImpl implements MedicalAdviceEnquiryService {
|
||||||
|
|
||||||
|
}
|
||||||
746
src/main/java/com/saye/hrs/service/impl/PayServiceImpl.java
Normal file
746
src/main/java/com/saye/hrs/service/impl/PayServiceImpl.java
Normal file
@@ -0,0 +1,746 @@
|
|||||||
|
package com.saye.hrs.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.github.wxpay.sdk.WXPay;
|
||||||
|
import com.github.wxpay.sdk.WXPayUtil;
|
||||||
|
import com.saye.hrs.commons.HttpUtil;
|
||||||
|
import com.saye.hrs.commons.IPUtil;
|
||||||
|
import com.saye.hrs.commons.JsonUtils;
|
||||||
|
import com.saye.hrs.commons.date.DateDUtil;
|
||||||
|
import com.saye.hrs.commons.exception.CustomException;
|
||||||
|
import com.saye.hrs.commons.idcard.Ic;
|
||||||
|
import com.saye.hrs.commons.log.LogUtil;
|
||||||
|
import com.saye.hrs.commons.qitahoutai.HoutaiService;
|
||||||
|
import com.saye.hrs.commons.string.StringDUtil;
|
||||||
|
import com.saye.hrs.commons.webservice.OtherWSUtil;
|
||||||
|
import com.saye.hrs.commons.wxpay.MyConfig;
|
||||||
|
import com.saye.hrs.commons.wxpay.WxPayDUtil;
|
||||||
|
import com.saye.hrs.commons.wxpay.pojo.PassbackParams;
|
||||||
|
import com.saye.hrs.commons.wxpay.pojo.WxPay;
|
||||||
|
import com.saye.hrs.commons.wxpay.pojo.WxResult;
|
||||||
|
import com.saye.hrs.dto.*;
|
||||||
|
import com.saye.hrs.enums.MedTradeStateEnum;
|
||||||
|
import com.saye.hrs.model.MessageVo;
|
||||||
|
import com.saye.hrs.model.StatusDefine;
|
||||||
|
import com.saye.hrs.model.WxybResult;
|
||||||
|
import com.saye.hrs.model.YbPassbackParams;
|
||||||
|
import com.saye.hrs.scheduler.RetrieveAccessToken;
|
||||||
|
import com.saye.hrs.service.PayService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
|
import org.springframework.http.*;
|
||||||
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
|
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.DigestUtils;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.locks.ReentrantLock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zmc
|
||||||
|
* @description: 支付
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class PayServiceImpl implements PayService {
|
||||||
|
|
||||||
|
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(Object.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RestTemplate restTemplate;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private HoutaiService houtaiService;
|
||||||
|
|
||||||
|
@Value("${hospital_name}")
|
||||||
|
private String hospital_name;
|
||||||
|
|
||||||
|
@Value("${notifyUrl}")
|
||||||
|
private String notifyUrl;
|
||||||
|
|
||||||
|
@Value("${ybNotifyUrl}")
|
||||||
|
private String ybNotifyUrl;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Environment environment;
|
||||||
|
|
||||||
|
private static Map<String, ReentrantLock> lockMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map wxAppletPay(WxAppletPayRequest reqDTO) throws Exception {
|
||||||
|
// 订单标题
|
||||||
|
String orderTitle = reqDTO.getOrderTitle();
|
||||||
|
if (orderTitle == null || "".equals(orderTitle)) {
|
||||||
|
orderTitle = "门诊付款";
|
||||||
|
}
|
||||||
|
// 添加上名称
|
||||||
|
orderTitle = hospital_name + "-" + orderTitle;
|
||||||
|
|
||||||
|
String openid = reqDTO.getOpenid();
|
||||||
|
String tradeNo = reqDTO.getTradeNo();
|
||||||
|
|
||||||
|
// String total_fee = reqDTO.getTotal_fee();
|
||||||
|
// 取应收金额,需要扣除预交金
|
||||||
|
String total_fee = reqDTO.getYsje();
|
||||||
|
|
||||||
|
WxPay wxPay = new WxPay();
|
||||||
|
wxPay.setAppid(StatusDefine.wxAppId);
|
||||||
|
wxPay.setSecret(StatusDefine.wxSecret);
|
||||||
|
wxPay.setMchid(StatusDefine.wxMchid);
|
||||||
|
wxPay.setWechartkey(StatusDefine.wxWechartkey);
|
||||||
|
wxPay.setPath(StatusDefine.wxCertPath); // 小程序证书文件路径
|
||||||
|
wxPay.setDomain("http://" + HttpUtil.getServerName()); // 接口域名
|
||||||
|
|
||||||
|
PassbackParams passbackParams = new PassbackParams();
|
||||||
|
// passbackParams.setTradeNo(tradeNo).setAppId(wxPay.getAppid()).setOpenId(openid);
|
||||||
|
passbackParams.setYsje(reqDTO.getYsje()).setZje(total_fee).setZfje(reqDTO.getZfje()).setSjh(reqDTO.getSjh()).setPatid(reqDTO.getPatid());
|
||||||
|
String attach = JsonUtils.beanToJson(passbackParams); // 可放回调接收的JSON参数
|
||||||
|
|
||||||
|
// 拼装参数
|
||||||
|
String nonceStr = WxPayDUtil.generateNonceStr();
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
map.put("appid", wxPay.getAppid());
|
||||||
|
map.put("mch_id", wxPay.getMchid());
|
||||||
|
map.put("nonce_str", nonceStr);
|
||||||
|
map.put("body", orderTitle);
|
||||||
|
map.put("openid", openid);
|
||||||
|
map.put("attach", attach);
|
||||||
|
map.put("out_trade_no", tradeNo);
|
||||||
|
|
||||||
|
// 将元转为分 微信接收分为单位的金额
|
||||||
|
int totalFeeInt = new BigDecimal(total_fee).multiply(BigDecimal.valueOf(100)).intValue();
|
||||||
|
String totalFeeStr = String.valueOf(totalFeeInt);
|
||||||
|
map.put("total_fee", totalFeeStr);
|
||||||
|
|
||||||
|
// 获取ip地址没有就用转发这个。
|
||||||
|
String spbill_create_ip = "";
|
||||||
|
String ip = reqDTO.getIp();
|
||||||
|
if (ip != null && !"".equals(ip)) {
|
||||||
|
spbill_create_ip = ip;
|
||||||
|
} else {
|
||||||
|
spbill_create_ip = IPUtil.getIp();
|
||||||
|
}
|
||||||
|
|
||||||
|
map.put("spbill_create_ip", spbill_create_ip); // 买家客户端IP
|
||||||
|
map.put("trade_type", "JSAPI");
|
||||||
|
map.put("notify_url", notifyUrl); // 支付结果回调地址
|
||||||
|
// 签名
|
||||||
|
map.put("sign", WxPayDUtil.generateSignature(map, wxPay.getWechartkey()));
|
||||||
|
logger.info("小程序统一下单参数" + JsonUtils.beanToJson(map) + ", " + JsonUtils.beanToJson(wxPay));
|
||||||
|
// 配置
|
||||||
|
WXPay pay = new WXPay(new MyConfig(wxPay));
|
||||||
|
Map tmap = pay.unifiedOrder(map);
|
||||||
|
logger.info("小程序统一下单结果" + JsonUtils.beanToJson(tmap));
|
||||||
|
String returnCode = tmap.get("return_code").toString();
|
||||||
|
String resultCode = tmap.get("result_code").toString();
|
||||||
|
// 发起支付成功
|
||||||
|
if ("SUCCESS".equals(returnCode) && "SUCCESS".equals(resultCode)) {
|
||||||
|
|
||||||
|
String prepayId = tmap.get("prepay_id").toString();
|
||||||
|
Map<String, String> resultMap = new HashMap<>();
|
||||||
|
resultMap.put("appId", wxPay.getAppid());
|
||||||
|
resultMap.put("timeStamp", String.valueOf(System.currentTimeMillis() / 1000));
|
||||||
|
resultMap.put("nonceStr", nonceStr);
|
||||||
|
resultMap.put("package", "prepay_id=" + prepayId);
|
||||||
|
resultMap.put("signType", "MD5");
|
||||||
|
String sign = WxPayDUtil.generateSignature(resultMap, wxPay.getWechartkey());
|
||||||
|
resultMap.put("paySign", sign);
|
||||||
|
|
||||||
|
// 保存参数
|
||||||
|
String jsonString1 = JSON.toJSONString(resultMap);
|
||||||
|
HashMap hashMap = JSON.parseObject(jsonString1, HashMap.class);
|
||||||
|
hashMap.put("patid", reqDTO.getPatid());
|
||||||
|
hashMap.put("hosp_out_trade_no", tradeNo);
|
||||||
|
|
||||||
|
String url2 = StatusDefine.IP_PORT + "/api/updateOrderInfoPay";
|
||||||
|
HttpHeaders headers2 = new HttpHeaders();
|
||||||
|
headers2.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
String body2 = JSON.toJSONString(hashMap);
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(body2, headers2);
|
||||||
|
ResponseEntity<HashMap> resp = restTemplate.exchange(url2, HttpMethod.POST, entity, HashMap.class);
|
||||||
|
HashMap respMap = resp.getBody();
|
||||||
|
|
||||||
|
// 如果保存 返回错误信息
|
||||||
|
String errCode = StringDUtil.changeNullToEmpty(respMap.get("errCode"));
|
||||||
|
if (!"0".equals(errCode)) {
|
||||||
|
throw new CustomException("统一下单信息保存失败");
|
||||||
|
} else {
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void wxPayNofify(WxResult wxResult) {
|
||||||
|
String id = wxResult.getTransaction_id();
|
||||||
|
ReentrantLock o = null;
|
||||||
|
do {
|
||||||
|
// 开始执行先unlock
|
||||||
|
if (o != null) {
|
||||||
|
o.unlock();
|
||||||
|
}
|
||||||
|
o = lockMap.computeIfAbsent(id, k -> new ReentrantLock());
|
||||||
|
// 加锁
|
||||||
|
o.lock();
|
||||||
|
// 新创建的被上一个线程remove掉了,或者新创建的对象和lockMap中已有的不是同一个对象,重试
|
||||||
|
} while (lockMap.get(id) == null || o != lockMap.get(id));
|
||||||
|
|
||||||
|
try {
|
||||||
|
PassbackParams callBackParam = JSONObject.parseObject(URLDecoder.decode(wxResult.getAttach(), "UTF-8"), PassbackParams.class);
|
||||||
|
|
||||||
|
if ("SUCCESS".equals(wxResult.getResult_code()) && "SUCCESS".equals(wxResult.getReturn_code())) {
|
||||||
|
|
||||||
|
// 更新订单状态为已完成 返回没用。。。已经异步了
|
||||||
|
HashMap<Object, Object> updateOrderInfoMap = new HashMap<>();
|
||||||
|
String updateUrl = StatusDefine.IP_PORT + "/api/updateOrderInfoComplete";
|
||||||
|
updateOrderInfoMap.put("hosp_out_trade_no", wxResult.getOut_trade_no());
|
||||||
|
HashMap<Object, Object> updateResultMap = houtaiService.PostInfoByParam(updateUrl, updateOrderInfoMap);
|
||||||
|
|
||||||
|
// 判断是否已经有这个消息了
|
||||||
|
String findUrl = StatusDefine.IP_PORT + "/api/findWxPayInfo";
|
||||||
|
HashMap<Object, Object> searchMap = new HashMap<>();
|
||||||
|
searchMap.put("transaction_id", wxResult.getTransaction_id());
|
||||||
|
HashMap<Object, Object> map = houtaiService.PostInfoByParam(findUrl, searchMap);
|
||||||
|
String errCode = StringDUtil.changeNullToEmpty(map.get("errCode"));
|
||||||
|
|
||||||
|
// 如果有 直接跳过 如果没有先发送信息进行结算 如果失败 将状态设置为0
|
||||||
|
boolean sendMsg = true;
|
||||||
|
if ("0".equals(errCode)) {
|
||||||
|
HashMap<Object, Object> map1 = (HashMap<Object, Object>) map.get("data");
|
||||||
|
if (map1 != null) {
|
||||||
|
String mzjsStatus = StringDUtil.changeNullToEmpty(map1.get("mzjsStatus"));
|
||||||
|
if ("1".equals(mzjsStatus)) {
|
||||||
|
LogUtil.info(this.getClass(), "回调后写入到his失败,本地数据库内发现已有记录");
|
||||||
|
sendMsg = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sendMsg) {
|
||||||
|
// 查询后台错误 不知道有没有发过 先发了再说
|
||||||
|
SettlementDTO reqDTO = new SettlementDTO();
|
||||||
|
reqDTO.setPatid(callBackParam.getPatid());
|
||||||
|
reqDTO.setSjh(callBackParam.getSjh());
|
||||||
|
|
||||||
|
// reqDTO.setZje(callBackParam.getZje());
|
||||||
|
reqDTO.setZje(callBackParam.getZfje());
|
||||||
|
|
||||||
|
reqDTO.setYsje(callBackParam.getYsje());
|
||||||
|
|
||||||
|
// reqDTO.setPaymoney(callBackParam.getZfje());
|
||||||
|
reqDTO.setPaymoney(callBackParam.getYsje());
|
||||||
|
|
||||||
|
reqDTO.setPaytype("9");
|
||||||
|
reqDTO.setPaylsh(wxResult.getTransaction_id());
|
||||||
|
reqDTO.setZfjsbz("1");
|
||||||
|
HashMap<Object, Object> settlementResultMap = OtherWSUtil.Settlement(reqDTO);
|
||||||
|
|
||||||
|
String errCode1 = StringDUtil.changeNullToEmpty(settlementResultMap.get("errCode"));
|
||||||
|
|
||||||
|
if ("0".equals(errCode1)) {
|
||||||
|
wxResult.setMzjsStatus("1");
|
||||||
|
} else {
|
||||||
|
wxResult.setMzjsStatus("0");
|
||||||
|
LogUtil.error(this.getClass(), StringDUtil.changeNullToEmpty(settlementResultMap.get("errMsg")));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 成功存储信息
|
||||||
|
String url = StatusDefine.IP_PORT + "/api/addWxPayInfo";
|
||||||
|
houtaiService.PostInfoByParam(url, wxResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// 没成功 ,输出日志
|
||||||
|
String jsonString = JSONObject.toJSONString(wxResult);
|
||||||
|
LogUtil.error(this.getClass(), "支付回调支付异常,内容:" + jsonString);
|
||||||
|
|
||||||
|
// 调用处方解锁
|
||||||
|
LogUtil.info(this.getClass(), "开始调用处方解锁接口(支付回调显示支付异常)");
|
||||||
|
//
|
||||||
|
CancelPreSettlementDTO reqDTO = new CancelPreSettlementDTO();
|
||||||
|
reqDTO.setJssjh(callBackParam.getSjh());
|
||||||
|
reqDTO.setZfjsbz("1");
|
||||||
|
OtherWSUtil.CancelPreSettlement(reqDTO);
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map findWxPayResult(PayQuery reqDTO) throws Exception {
|
||||||
|
WxPay wxPay = new WxPay();
|
||||||
|
wxPay.setAppid(StatusDefine.wxAppId);
|
||||||
|
wxPay.setSecret(StatusDefine.wxSecret);
|
||||||
|
wxPay.setMchid(StatusDefine.wxMchid);
|
||||||
|
wxPay.setWechartkey(StatusDefine.wxWechartkey);
|
||||||
|
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
map.put("appid", StatusDefine.wxAppId);
|
||||||
|
map.put("mch_id", StatusDefine.wxMchid);
|
||||||
|
map.put("out_trade_no", reqDTO.getOut_trade_no());
|
||||||
|
|
||||||
|
String nonceStr = WxPayDUtil.generateNonceStr();
|
||||||
|
map.put("nonce_str", nonceStr);
|
||||||
|
String sign = WxPayDUtil.generateSignature(map, wxPay.getWechartkey());
|
||||||
|
map.put("sign", sign);
|
||||||
|
|
||||||
|
WXPay pay = new WXPay(new MyConfig(wxPay));
|
||||||
|
Map<String, String> tmap = pay.orderQuery(map);
|
||||||
|
|
||||||
|
logger.info("查询账单结果" + JsonUtils.beanToJson(tmap));
|
||||||
|
|
||||||
|
String returnCode = tmap.get("return_code");
|
||||||
|
String resultCode = tmap.get("result_code");
|
||||||
|
if ("SUCCESS".equals(returnCode) && "SUCCESS".equals(resultCode)) {
|
||||||
|
|
||||||
|
String tradeStateDesc = tmap.get("trade_state_desc");
|
||||||
|
String tradeState = tmap.get("trade_state");
|
||||||
|
String timeEnd = tmap.get("time_end");
|
||||||
|
String outTradeNo = tmap.get("out_trade_no");
|
||||||
|
String totalFee = tmap.get("total_fee");
|
||||||
|
|
||||||
|
String timeEndStr = "";
|
||||||
|
if (timeEnd != null) {
|
||||||
|
Date date = DateDUtil.strToDate(DateDUtil.yyyyMMddHHmmss, timeEnd);
|
||||||
|
timeEndStr = DateDUtil.DateToStr(DateDUtil.yyyy_MM_dd_HH_mm_ss, date);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map resultMap = new HashMap();
|
||||||
|
|
||||||
|
// 单号
|
||||||
|
resultMap.put("outTradeNo", outTradeNo);
|
||||||
|
// 付款时间
|
||||||
|
resultMap.put("timeEnd", timeEndStr);
|
||||||
|
|
||||||
|
// 状态
|
||||||
|
resultMap.put("tradeState", tradeState);
|
||||||
|
resultMap.put("tradeStateDesc", tradeStateDesc);
|
||||||
|
|
||||||
|
// 写死医院和项目
|
||||||
|
resultMap.put("hospitalName", "库尔勒市妇幼保健院");
|
||||||
|
resultMap.put("body", "门诊缴费");
|
||||||
|
|
||||||
|
// 总金额
|
||||||
|
totalFee = new BigDecimal(totalFee).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP).toString();
|
||||||
|
resultMap.put("totalFee", totalFee);
|
||||||
|
|
||||||
|
|
||||||
|
// 更新订单状态为已完成
|
||||||
|
if ("SUCCESS".equals(tradeState)) {
|
||||||
|
HashMap<Object, Object> updateOrderInfoMap = new HashMap<>();
|
||||||
|
String updateUrl = StatusDefine.IP_PORT + "/api/updateOrderInfoComplete";
|
||||||
|
updateOrderInfoMap.put("hosp_out_trade_no", outTradeNo);
|
||||||
|
HashMap<Object, Object> updateResultMap = houtaiService.PostInfoByParam(updateUrl, updateOrderInfoMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
return resultMap;
|
||||||
|
} else {
|
||||||
|
String errCodeDes = tmap.get("err_code_des");
|
||||||
|
throw new RuntimeException(errCodeDes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map ybAppletPay(WxybAppletReuqest reqDTO) {
|
||||||
|
String errMsg = "";
|
||||||
|
try {
|
||||||
|
|
||||||
|
// 先将参数值复制过来
|
||||||
|
WxybPay wxybPay = JSON.parseObject(JSON.toJSONString(reqDTO), WxybPay.class);
|
||||||
|
|
||||||
|
// 对金额进行处理 传过来的是元 转为分
|
||||||
|
String totalFee = wxybPay.getTotal_fee();
|
||||||
|
String cashFee = wxybPay.getCash_fee();
|
||||||
|
|
||||||
|
String zhzf = reqDTO.getZhzf();
|
||||||
|
String ybzf = reqDTO.getYbzf();
|
||||||
|
|
||||||
|
String yjjzf = reqDTO.getYjjzf();
|
||||||
|
|
||||||
|
long totalFeeL = new BigDecimal(totalFee).multiply(new BigDecimal(100)).longValue();
|
||||||
|
wxybPay.setTotal_fee(String.valueOf(totalFeeL));
|
||||||
|
long cashFeeL = new BigDecimal(cashFee).multiply(new BigDecimal(100)).longValue();
|
||||||
|
wxybPay.setCash_fee(String.valueOf(cashFeeL));
|
||||||
|
long insuranceFeeL = new BigDecimal(ybzf).add(new BigDecimal(zhzf)).multiply(new BigDecimal(100)).longValue();
|
||||||
|
wxybPay.setInsurance_fee(String.valueOf(insuranceFeeL));
|
||||||
|
|
||||||
|
long reducefee = new BigDecimal(yjjzf).multiply(new BigDecimal(100)).longValue();
|
||||||
|
wxybPay.setCash_reduced_fee(String.valueOf(reducefee));
|
||||||
|
|
||||||
|
wxybPay.setCash_reduced_wording("1");
|
||||||
|
|
||||||
|
// 将数据补全
|
||||||
|
wxybPay.setOrder_type("DiagPay"); // 固定为诊间支付
|
||||||
|
wxybPay.setAppid(StatusDefine.wxAppId);
|
||||||
|
wxybPay.setMch_id(StatusDefine.wxMchid);
|
||||||
|
wxybPay.setHospital_name(hospital_name);
|
||||||
|
|
||||||
|
// 身份证验证 如果15位转18位 并且用md5加密
|
||||||
|
String userCardNo = wxybPay.getUser_card_no();
|
||||||
|
if (userCardNo.length() == 15) {
|
||||||
|
userCardNo = Ic.get18Ic(userCardNo);
|
||||||
|
}
|
||||||
|
userCardNo = DigestUtils.md5DigestAsHex(userCardNo.toUpperCase().getBytes());
|
||||||
|
wxybPay.setUser_card_no(userCardNo);
|
||||||
|
|
||||||
|
// 随机字符串
|
||||||
|
String nonceStr = WxPayDUtil.generateNonceStr();
|
||||||
|
wxybPay.setNonce_str(nonceStr);
|
||||||
|
|
||||||
|
// 是否允许预结算费用发生变化 0 不允许
|
||||||
|
wxybPay.setAllow_fee_change("0");
|
||||||
|
|
||||||
|
// 获取ip地址没有就用转发这个。
|
||||||
|
String spbill_create_ip = "";
|
||||||
|
String ip = reqDTO.getIp();
|
||||||
|
if (ip != null && !"".equals(ip)) {
|
||||||
|
spbill_create_ip = ip;
|
||||||
|
} else {
|
||||||
|
spbill_create_ip = IPUtil.getIp();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxybPay.setSpbill_create_ip(spbill_create_ip);
|
||||||
|
// 回调地址
|
||||||
|
wxybPay.setNotify_url(ybNotifyUrl);
|
||||||
|
|
||||||
|
wxybPay.setBody("门诊缴费");
|
||||||
|
wxybPay.setUser_card_type("1");
|
||||||
|
wxybPay.setIs_dept("4");
|
||||||
|
|
||||||
|
// 城市id 传固定的id 因为医保开通是地区
|
||||||
|
wxybPay.setCity_id(StatusDefine.cityId);
|
||||||
|
|
||||||
|
String orgCodg = environment.getProperty("orgCodg");
|
||||||
|
wxybPay.setOrg_no(orgCodg);// 医疗机构编码(医保局分配给机构)
|
||||||
|
|
||||||
|
YbPassbackParams passbackParams = new YbPassbackParams();
|
||||||
|
// 此处应收金额单位还是元未被改为分
|
||||||
|
passbackParams.setYsje(reqDTO.getYsje()).setPatid(reqDTO.getPatid()).setPayToken(reqDTO.getPayToken()).setPayOrdId(reqDTO.getPayOrdId());
|
||||||
|
String attach = JsonUtils.beanToJson(passbackParams);
|
||||||
|
wxybPay.setAttach(attach);
|
||||||
|
|
||||||
|
// 添加渠道号
|
||||||
|
wxybPay.setChannel_no(StatusDefine.channel);
|
||||||
|
|
||||||
|
HashMap<String, String> hashMap = JSON.parseObject(JSON.toJSONString(wxybPay), HashMap.class);
|
||||||
|
hashMap.remove("sign");
|
||||||
|
|
||||||
|
String sign = WxPayDUtil.generateSignature(hashMap, StatusDefine.wxybkey);
|
||||||
|
hashMap.put("sign", sign);
|
||||||
|
|
||||||
|
logger.info("小程序医保统一下单参数" + JsonUtils.beanToJson(hashMap));
|
||||||
|
|
||||||
|
// 调用统一下单接口
|
||||||
|
String tyxdUrl = "https://api.weixin.qq.com/payinsurance/unifiedorder?access_token=" + RetrieveAccessToken.getToken();
|
||||||
|
|
||||||
|
String xmlStr = WXPayUtil.mapToXml(hashMap);
|
||||||
|
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_ATOM_XML);
|
||||||
|
|
||||||
|
List<HttpMessageConverter<?>> httpMessageConverters = restTemplate.getMessageConverters();
|
||||||
|
httpMessageConverters.forEach(httpMessageConverter -> {
|
||||||
|
if (httpMessageConverter instanceof StringHttpMessageConverter) {
|
||||||
|
StringHttpMessageConverter messageConverter = (StringHttpMessageConverter) httpMessageConverter;
|
||||||
|
// 设置编码为UTF-8
|
||||||
|
messageConverter.setDefaultCharset(StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(xmlStr, headers);
|
||||||
|
ResponseEntity<String> resultXml = restTemplate.postForEntity(tyxdUrl, entity, String.class);
|
||||||
|
int statusCodeValue = resultXml.getStatusCodeValue();
|
||||||
|
if (statusCodeValue == 200) {
|
||||||
|
// 这里这个是微信支付的jar包里的类。里面地址有点不一样 这里就当转xml用的
|
||||||
|
WxPay wxPay = new WxPay();
|
||||||
|
wxPay.setAppid(StatusDefine.wxAppId);
|
||||||
|
wxPay.setSecret(StatusDefine.wxSecret);
|
||||||
|
wxPay.setMchid(StatusDefine.wxMchid);
|
||||||
|
wxPay.setWechartkey(StatusDefine.wxybkey);
|
||||||
|
|
||||||
|
WXPay wxPay2 = new WXPay(new MyConfig(wxPay));
|
||||||
|
Map<String, String> stringMap = wxPay2.processResponseXml(resultXml.getBody());
|
||||||
|
|
||||||
|
logger.info("小程序医保统一下单结果" + JsonUtils.beanToJson(stringMap));
|
||||||
|
String returnCode = stringMap.get("return_code");
|
||||||
|
String resultCode = stringMap.get("result_code");
|
||||||
|
|
||||||
|
if ("SUCCESS".equals(returnCode) && "SUCCESS".equals(resultCode)) {
|
||||||
|
|
||||||
|
String payAppid = stringMap.get("pay_appid");
|
||||||
|
String payUrl = stringMap.get("pay_url");
|
||||||
|
String medTransId = stringMap.get("med_trans_id");
|
||||||
|
|
||||||
|
Map<String, String> resultMap = new HashMap<>();
|
||||||
|
resultMap.put("pay_appid", payAppid);
|
||||||
|
resultMap.put("pay_url", payUrl);
|
||||||
|
resultMap.put("med_trans_id", medTransId);
|
||||||
|
|
||||||
|
// 保存参数
|
||||||
|
String jsonString1 = JSON.toJSONString(resultMap);
|
||||||
|
HashMap hashMap1 = JSON.parseObject(jsonString1, HashMap.class);
|
||||||
|
hashMap1.put("patid", reqDTO.getPatid());
|
||||||
|
hashMap1.put("hosp_out_trade_no", reqDTO.getHosp_out_trade_no());
|
||||||
|
|
||||||
|
String url2 = StatusDefine.IP_PORT + "/api/updateYBOrderInfoPay";
|
||||||
|
HttpHeaders headers2 = new HttpHeaders();
|
||||||
|
headers2.setContentType(MediaType.APPLICATION_JSON);
|
||||||
|
String body2 = JSON.toJSONString(hashMap1);
|
||||||
|
HttpEntity<String> entity2 = new HttpEntity<String>(body2, headers2);
|
||||||
|
ResponseEntity<HashMap> resp = restTemplate.exchange(url2, HttpMethod.POST, entity2, HashMap.class);
|
||||||
|
HashMap respMap = resp.getBody();
|
||||||
|
|
||||||
|
// 如果保存 返回错误信息
|
||||||
|
String errCode = StringDUtil.changeNullToEmpty(respMap.get("errCode"));
|
||||||
|
if (!"0".equals(errCode)) {
|
||||||
|
throw new CustomException("统一下单信息保存失败");
|
||||||
|
} else {
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
errMsg = "小程序医保统一下单结果失败:" + stringMap;
|
||||||
|
logger.error("小程序医保统一下单结果失败:" + stringMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
errMsg = "调用医保统一下单接口失败,网络错误编码:" + statusCodeValue;
|
||||||
|
logger.error("调用医保统一下单接口失败,网络错误编码:" + statusCodeValue);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
logger.error("发起微信医保支付失败,原因" + e.getMessage());
|
||||||
|
errMsg = "发起微信医保支付失败,原因" + e.getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new RuntimeException(errMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void wxybPayNofify(WxybResult wxybResult) {
|
||||||
|
String id = wxybResult.getSerial_no();
|
||||||
|
ReentrantLock o = null;
|
||||||
|
do {
|
||||||
|
// 开始执行先unlock
|
||||||
|
if (o != null) {
|
||||||
|
o.unlock();
|
||||||
|
}
|
||||||
|
o = lockMap.computeIfAbsent(id, k -> new ReentrantLock());
|
||||||
|
// 加锁
|
||||||
|
o.lock();
|
||||||
|
// 新创建的被上一个线程remove掉了,或者新创建的对象和lockMap中已有的不是同一个对象,重试
|
||||||
|
} while (lockMap.get(id) == null || o != lockMap.get(id));
|
||||||
|
try {
|
||||||
|
YbPassbackParams callBackParam = JSONObject.parseObject(URLDecoder.decode(wxybResult.getAttach(), "UTF-8"), YbPassbackParams.class);
|
||||||
|
|
||||||
|
if ("SUCCESS".equals(wxybResult.getResult_code()) && "SUCCESS".equals(wxybResult.getReturn_code())) {
|
||||||
|
|
||||||
|
// 更新订单状态为已完成
|
||||||
|
HashMap<Object, Object> updateOrderInfoMap = new HashMap<>();
|
||||||
|
String updateUrl = StatusDefine.IP_PORT + "/api/updateOrderInfoComplete";
|
||||||
|
updateOrderInfoMap.put("hosp_out_trade_no", wxybResult.getHosp_out_trade_no());
|
||||||
|
HashMap<Object, Object> updateResultMap = houtaiService.PostInfoByParam(updateUrl, updateOrderInfoMap);
|
||||||
|
|
||||||
|
// 说是成功就不用干任何事了。 不知道是不是 这里先注释掉
|
||||||
|
|
||||||
|
// //判断是否已经有这个消息了
|
||||||
|
// String findUrl=StatusDefine.IP_PORT+"/api/findWxybPayInfo";
|
||||||
|
// HashMap<Object,Object> searchMap=new HashMap<>();
|
||||||
|
// searchMap.put("cash_order_id",wxybResult.getCash_order_id());
|
||||||
|
// HashMap<Object, Object> map = houtaiService.PostInfoByParam(findUrl, searchMap);
|
||||||
|
// String errCode = StringDUtil.changeNullToEmpty(map.get("errCode"));
|
||||||
|
//
|
||||||
|
// //如果有 直接跳过 如果没有先发送信息进行结算 如果失败 将状态设置为0
|
||||||
|
// boolean sendMsg=true;
|
||||||
|
// if ("0".equals(errCode)) {
|
||||||
|
// HashMap<Object, Object> map1 = (HashMap<Object, Object>) map.get("data");
|
||||||
|
// if (map1 != null) {
|
||||||
|
// String mzjsStatus = StringDUtil.changeNullToEmpty(map1.get("mzjsStatus"));
|
||||||
|
// if ("1".equals(mzjsStatus)){
|
||||||
|
// LogUtil.info(this.getClass(), "回调后写入到his失败,本地数据库内发现已有记录");
|
||||||
|
// sendMsg=false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (sendMsg){
|
||||||
|
// //查询后台错误 不知道有没有发过 先发了再说
|
||||||
|
// SettlementDTO reqDTO = new SettlementDTO();
|
||||||
|
// reqDTO.setPatid(callBackParam.getPatid());
|
||||||
|
// reqDTO.setSjh(wxybResult.getSerial_no());
|
||||||
|
// reqDTO.setYsje(callBackParam.getYsje());
|
||||||
|
//
|
||||||
|
// //从微信返回的金额为分,要改为元来传输给his
|
||||||
|
// Integer totalFee = wxybResult.getTotal_fee();
|
||||||
|
// Integer cashFee = wxybResult.getCash_fee();
|
||||||
|
// BigDecimal totalFeeBD = new BigDecimal(totalFee).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
|
||||||
|
// BigDecimal cashFeeBD = new BigDecimal(cashFee).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
|
||||||
|
//
|
||||||
|
// reqDTO.setZje(totalFeeBD.toString());
|
||||||
|
// reqDTO.setPaymoney(cashFeeBD.toString());
|
||||||
|
// reqDTO.setPaytype("9");
|
||||||
|
// reqDTO.setPaylsh(wxybResult.getCash_order_id());
|
||||||
|
// reqDTO.setZfjsbz("0");
|
||||||
|
// HashMap<Object, Object> settlementResultMap = OtherWSUtil.Settlement(reqDTO);
|
||||||
|
//
|
||||||
|
// String errCode1 = StringDUtil.changeNullToEmpty(settlementResultMap.get("errCode"));
|
||||||
|
//
|
||||||
|
// if ("0".equals(errCode1)) {
|
||||||
|
// wxybResult.setMzjsStatus("1");
|
||||||
|
// } else {
|
||||||
|
// wxybResult.setMzjsStatus("0");
|
||||||
|
// LogUtil.error(this.getClass(), StringDUtil.changeNullToEmpty(settlementResultMap.get("errMsg")));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// //存储信息
|
||||||
|
// String url = StatusDefine.IP_PORT + "/api/addWxybPayInfo";
|
||||||
|
// houtaiService.PostInfoByParam(url, wxybResult);
|
||||||
|
// }
|
||||||
|
} else {
|
||||||
|
// 没成功 ,输出日志
|
||||||
|
String jsonString = JSONObject.toJSONString(wxybResult);
|
||||||
|
LogUtil.error(this.getClass(), "医保支付回调支付异常,内容:" + jsonString);
|
||||||
|
|
||||||
|
// 调用处方解锁
|
||||||
|
LogUtil.info(this.getClass(), "开始调用处方解锁接口(医保支付回调显示支付异常)");
|
||||||
|
//
|
||||||
|
CancelPreSettlementDTO reqDTO = new CancelPreSettlementDTO();
|
||||||
|
reqDTO.setJssjh(wxybResult.getSerial_no());
|
||||||
|
reqDTO.setZfjsbz("0");
|
||||||
|
reqDTO.setPayToken(callBackParam.getPayToken());
|
||||||
|
reqDTO.setPayOrdId(callBackParam.getPayOrdId());
|
||||||
|
OtherWSUtil.CancelPreSettlement(reqDTO);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} finally {
|
||||||
|
// 释放锁
|
||||||
|
lockMap.remove(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map findWxybPayResult(PayQuery reqDTO) throws Exception {
|
||||||
|
WxPay wxPay = new WxPay();
|
||||||
|
wxPay.setAppid(StatusDefine.wxAppId);
|
||||||
|
wxPay.setSecret(StatusDefine.wxSecret);
|
||||||
|
wxPay.setMchid(StatusDefine.wxMchid);
|
||||||
|
wxPay.setWechartkey(StatusDefine.wxybkey);
|
||||||
|
|
||||||
|
WXPay pay = new WXPay(new MyConfig(wxPay));
|
||||||
|
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
map.put("appid", StatusDefine.wxAppId);
|
||||||
|
map.put("mch_id", StatusDefine.wxMchid);
|
||||||
|
map.put("hosp_out_trade_no", reqDTO.getOut_trade_no());
|
||||||
|
|
||||||
|
String nonceStr = WxPayDUtil.generateNonceStr();
|
||||||
|
map.put("nonce_str", nonceStr);
|
||||||
|
String sign = WxPayDUtil.generateSignature(map, wxPay.getWechartkey());
|
||||||
|
map.put("sign", sign);
|
||||||
|
|
||||||
|
String url = "https://api.weixin.qq.com/payinsurance/queryorder?access_token=" + RetrieveAccessToken.getToken();
|
||||||
|
String xmlStr = WXPayUtil.mapToXml(map);
|
||||||
|
|
||||||
|
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.setContentType(MediaType.APPLICATION_ATOM_XML);
|
||||||
|
|
||||||
|
List<HttpMessageConverter<?>> httpMessageConverters = restTemplate.getMessageConverters();
|
||||||
|
httpMessageConverters.forEach(httpMessageConverter -> {
|
||||||
|
if (httpMessageConverter instanceof StringHttpMessageConverter) {
|
||||||
|
StringHttpMessageConverter messageConverter = (StringHttpMessageConverter) httpMessageConverter;
|
||||||
|
// 设置编码为UTF-8
|
||||||
|
messageConverter.setDefaultCharset(StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
HttpEntity<String> entity = new HttpEntity<String>(xmlStr, headers);
|
||||||
|
ResponseEntity<String> resultXml = restTemplate.postForEntity(url, entity, String.class);
|
||||||
|
int statusCodeValue = resultXml.getStatusCodeValue();
|
||||||
|
if (statusCodeValue == 200) {
|
||||||
|
|
||||||
|
Map<String, String> stringMap = pay.processResponseXml(resultXml.getBody());
|
||||||
|
|
||||||
|
logger.info("小程序医保订单查询结果" + JsonUtils.beanToJson(stringMap));
|
||||||
|
String returnCode = stringMap.get("return_code");
|
||||||
|
String resultCode = stringMap.get("result_code");
|
||||||
|
|
||||||
|
if ("SUCCESS".equals(returnCode) && "SUCCESS".equals(resultCode)) {
|
||||||
|
String medTradeState = stringMap.get("med_trade_state");
|
||||||
|
String cashTradeStatus = stringMap.get("cash_trade_status");
|
||||||
|
String insuranceTradeStatus = stringMap.get("insurance_trade_status");
|
||||||
|
|
||||||
|
String hospitalName = stringMap.get("hospital_name");
|
||||||
|
String body = stringMap.get("body");
|
||||||
|
String totalFee = stringMap.get("total_fee");
|
||||||
|
String gmtOutCreate = stringMap.get("gmt_out_create");
|
||||||
|
String hospOutTradeNo = stringMap.get("hosp_out_trade_no");
|
||||||
|
|
||||||
|
Date date = DateDUtil.strToDate(DateDUtil.yyyyMMddHHmmss, gmtOutCreate);
|
||||||
|
String gmtOutCreateStr = DateDUtil.DateToStr(DateDUtil.yyyy_MM_dd_HH_mm_ss, date);
|
||||||
|
|
||||||
|
Map resultMap = new HashMap();
|
||||||
|
resultMap.put("cashTradeStatus", cashTradeStatus);
|
||||||
|
resultMap.put("insuranceTradeStatus", insuranceTradeStatus);
|
||||||
|
|
||||||
|
// 机构名称
|
||||||
|
resultMap.put("hospitalName", hospitalName);
|
||||||
|
// 项目
|
||||||
|
resultMap.put("body", body);
|
||||||
|
// 总金额
|
||||||
|
totalFee = new BigDecimal(totalFee).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP).toString();
|
||||||
|
resultMap.put("totalFee", totalFee);
|
||||||
|
// 支付状态
|
||||||
|
resultMap.put("medTradeState", medTradeState);
|
||||||
|
resultMap.put("medTradeStateName", MedTradeStateEnum.getNameByValue(medTradeState));
|
||||||
|
// 订单号
|
||||||
|
resultMap.put("hospOutTradeNo", hospOutTradeNo);
|
||||||
|
// 创建时间
|
||||||
|
resultMap.put("gmtOutCreate", gmtOutCreateStr);
|
||||||
|
|
||||||
|
// 更新订单状态为已完成
|
||||||
|
if ("SUCCESS".equals(medTradeState)) {
|
||||||
|
HashMap<Object, Object> updateOrderInfoMap = new HashMap<>();
|
||||||
|
String updateUrl = StatusDefine.IP_PORT + "/api/updateOrderInfoComplete";
|
||||||
|
updateOrderInfoMap.put("hosp_out_trade_no", hospOutTradeNo);
|
||||||
|
HashMap<Object, Object> updateResultMap = houtaiService.PostInfoByParam(updateUrl, updateOrderInfoMap);
|
||||||
|
}
|
||||||
|
return resultMap;
|
||||||
|
} else {
|
||||||
|
String errCodeDes = stringMap.get("err_code_des");
|
||||||
|
throw new RuntimeException(errCodeDes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static void main(String[] args) {
|
||||||
|
// String s = "{\"bz\":\"\",\"patid\":\"421322\",\"sjh\":\"20240418yypt120005\",\"ybzf\":\"\",\"yhje\":\"0.0000\",\"ysje\":\"5.0000\",\"zfje\":\"5.0000\",\"zhye\":\"\",\"zhzf\":\"\",\"zje\":\"5.0000\"}";
|
||||||
|
// JSONObject jsonObject = JSONObject.parseObject(s);
|
||||||
|
// System.out.println(jsonObject);
|
||||||
|
// System.out.println(jsonObject.get("zje"));
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.saye.hrs.service.impl;
|
||||||
|
|
||||||
|
import com.saye.hrs.service.ServiceParamService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 系统参数获取接口
|
||||||
|
* @author: Mr.zs
|
||||||
|
* @create: 2024-04-16 16:23
|
||||||
|
**/
|
||||||
|
@Service
|
||||||
|
public class ServiceParamServiceImpl implements ServiceParamService {
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user