New file |
| | |
| | | # Default ignored files |
| | | /shelf/ |
| | | /workspace.xml |
| | | # Datasource local storage ignored files |
| | | /../../../:\springcloud_k8s_panzhihuazhihuishequ\.idea/dataSources/ |
| | | /dataSources.local.xml |
| | | # Editor-based HTTP Client requests |
| | | /httpRequests/ |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project version="4"> |
| | | <component name="CompilerConfiguration"> |
| | | <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="applets" /> |
| | | <module name="service_user" /> |
| | | <module name="service_community" /> |
| | | <module name="common" /> |
| | | <module name="auth" /> |
| | | <module name="service_partybuilding" /> |
| | | <module name="config_server" /> |
| | | <module name="eureka_server" /> |
| | | <module name="zuul" /> |
| | | <module name="applets_backstage" /> |
| | | <module name="community_backstage" /> |
| | | </profile> |
| | | </annotationProcessing> |
| | | <bytecodeTargetLevel> |
| | | <module name="service_dangjian" target="1.8" /> |
| | | <module name="zhihuishequ" target="1.8" /> |
| | | </bytecodeTargetLevel> |
| | | </component> |
| | | <component name="JavacSettings"> |
| | | <option name="ADDITIONAL_OPTIONS_OVERRIDE"> |
| | | <module name="applets" options="" /> |
| | | <module name="applets_backstage" options="" /> |
| | | <module name="auth" options="" /> |
| | | <module name="community_backstage" options="" /> |
| | | <module name="config_server" options="" /> |
| | | <module name="service_community" options="" /> |
| | | <module name="service_dangjian" options="" /> |
| | | <module name="service_user" options="" /> |
| | | <module name="zhihuishequ" options="-parameters" /> |
| | | <module name="zuul" options="" /> |
| | | </option> |
| | | </component> |
| | | </project> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project version="4"> |
| | | <component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8"> |
| | | <file url="file://$PROJECT_DIR$/applets/src/main/java" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/applets/src/main/resources" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/applets_backstage/src/main/java" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/applets_backstage/src/main/resources" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/auth/src/main/java" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/auth/src/main/resources" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/auth/src/main/resources/application.yml" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/common/src/main/java" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/community_backstage/src/main/java" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/community_backstage/src/main/resources" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/config_server/src/main/java" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/config_server/src/main/resources" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/eureka_server/src/main/java" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/eureka_server/src/main/resources" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/service_community/src/main/java" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/service_community/src/main/resources" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/service_partybuilding/src/main/java" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/service_partybuilding/src/main/resources" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/service_user/src/main/java" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/service_user/src/main/resources" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/zuul/src/main/java" charset="UTF-8" /> |
| | | <file url="file://$PROJECT_DIR$/zuul/src/main/resources" charset="UTF-8" /> |
| | | <file url="PROJECT" charset="UTF-8" /> |
| | | </component> |
| | | </project> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project version="4"> |
| | | <component name="RemoteRepositoriesConfiguration"> |
| | | <remote-repository> |
| | | <option name="id" value="central" /> |
| | | <option name="name" value="Central Repository" /> |
| | | <option name="url" value="https://repo.maven.apache.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="releases" /> |
| | | <option name="name" value="Nexus Repository" /> |
| | | <option name="url" value="http://47.104.148.185:8001/repository/maven-releases/" /> |
| | | </remote-repository> |
| | | <remote-repository> |
| | | <option name="id" value="spring-milestones" /> |
| | | <option name="name" value="Spring Milestones" /> |
| | | <option name="url" value="https://repo.spring.io/milestone" /> |
| | | </remote-repository> |
| | | <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="snapshots" /> |
| | | <option name="name" value="snapshots" /> |
| | | <option name="url" value="http://47.104.148.185:8001/repository/maven-snapshots/" /> |
| | | </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="spring-snapshots" /> |
| | | <option name="name" value="Spring Snapshots" /> |
| | | <option name="url" value="https://repo.spring.io/snapshot" /> |
| | | </remote-repository> |
| | | <remote-repository> |
| | | <option name="id" value="public" /> |
| | | <option name="name" value="public" /> |
| | | <option name="url" value="http://47.104.148.185:8001/repository/maven-public/" /> |
| | | </remote-repository> |
| | | </component> |
| | | </project> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project version="4"> |
| | | <component name="ExternalStorageConfigurationManager" enabled="true" /> |
| | | <component name="MavenProjectsManager"> |
| | | <option name="originalFiles"> |
| | | <list> |
| | | <option value="$PROJECT_DIR$/pom.xml" /> |
| | | <option value="$PROJECT_DIR$/zhihuishequ/eureka_server/pom.xml" /> |
| | | <option value="$PROJECT_DIR$/eureka_server/pom.xml" /> |
| | | <option value="$PROJECT_DIR$/config_server/pom.xml" /> |
| | | <option value="$PROJECT_DIR$/zuul/pom.xml" /> |
| | | <option value="$PROJECT_DIR$/auth/pom.xml" /> |
| | | <option value="$PROJECT_DIR$/service_dangjian/pom.xml" /> |
| | | <option value="$PROJECT_DIR$/applets/pom.xml" /> |
| | | <option value="$PROJECT_DIR$/community_backstage/pom.xml" /> |
| | | <option value="$PROJECT_DIR$/applets_backstage/pom.xml" /> |
| | | <option value="$PROJECT_DIR$/service_user/pom.xml" /> |
| | | <option value="$PROJECT_DIR$/service_community/pom.xml" /> |
| | | </list> |
| | | </option> |
| | | </component> |
| | | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> |
| | | <output url="file://$PROJECT_DIR$/out" /> |
| | | </component> |
| | | </project> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <project version="4"> |
| | | <component name="Palette2"> |
| | | <group name="Swing"> |
| | | <item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> |
| | | <default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" /> |
| | | </item> |
| | | <item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false"> |
| | | <default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" /> |
| | | </item> |
| | | <item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false"> |
| | | <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" /> |
| | | </item> |
| | | <item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true"> |
| | | <default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" /> |
| | | </item> |
| | | <item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false"> |
| | | <default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" /> |
| | | <initial-values> |
| | | <property name="text" value="Button" /> |
| | | </initial-values> |
| | | </item> |
| | | <item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false"> |
| | | <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> |
| | | <initial-values> |
| | | <property name="text" value="RadioButton" /> |
| | | </initial-values> |
| | | </item> |
| | | <item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false"> |
| | | <default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" /> |
| | | <initial-values> |
| | | <property name="text" value="CheckBox" /> |
| | | </initial-values> |
| | | </item> |
| | | <item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false"> |
| | | <default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" /> |
| | | <initial-values> |
| | | <property name="text" value="Label" /> |
| | | </initial-values> |
| | | </item> |
| | | <item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true"> |
| | | <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> |
| | | <preferred-size width="150" height="-1" /> |
| | | </default-constraints> |
| | | </item> |
| | | <item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true"> |
| | | <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> |
| | | <preferred-size width="150" height="-1" /> |
| | | </default-constraints> |
| | | </item> |
| | | <item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true"> |
| | | <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1"> |
| | | <preferred-size width="150" height="-1" /> |
| | | </default-constraints> |
| | | </item> |
| | | <item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true"> |
| | | <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> |
| | | <preferred-size width="150" height="50" /> |
| | | </default-constraints> |
| | | </item> |
| | | <item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> |
| | | <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> |
| | | <preferred-size width="150" height="50" /> |
| | | </default-constraints> |
| | | </item> |
| | | <item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true"> |
| | | <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> |
| | | <preferred-size width="150" height="50" /> |
| | | </default-constraints> |
| | | </item> |
| | | <item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true"> |
| | | <default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" /> |
| | | </item> |
| | | <item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false"> |
| | | <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> |
| | | <preferred-size width="150" height="50" /> |
| | | </default-constraints> |
| | | </item> |
| | | <item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false"> |
| | | <default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3"> |
| | | <preferred-size width="150" height="50" /> |
| | | </default-constraints> |
| | | </item> |
| | | <item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false"> |
| | | <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3"> |
| | | <preferred-size width="150" height="50" /> |
| | | </default-constraints> |
| | | </item> |
| | | <item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false"> |
| | | <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> |
| | | <preferred-size width="200" height="200" /> |
| | | </default-constraints> |
| | | </item> |
| | | <item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false"> |
| | | <default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3"> |
| | | <preferred-size width="200" height="200" /> |
| | | </default-constraints> |
| | | </item> |
| | | <item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true"> |
| | | <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> |
| | | </item> |
| | | <item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false"> |
| | | <default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" /> |
| | | </item> |
| | | <item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false"> |
| | | <default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" /> |
| | | </item> |
| | | <item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> |
| | | <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" /> |
| | | </item> |
| | | <item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false"> |
| | | <default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1"> |
| | | <preferred-size width="-1" height="20" /> |
| | | </default-constraints> |
| | | </item> |
| | | <item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false"> |
| | | <default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" /> |
| | | </item> |
| | | <item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false"> |
| | | <default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" /> |
| | | </item> |
| | | </group> |
| | | </component> |
| | | </project> |
New file |
| | |
| | | HELP.md |
| | | target/ |
| | | !.mvn/wrapper/maven-wrapper.jar |
| | | !**/src/main/**/target/ |
| | | !**/src/test/**/target/ |
| | | |
| | | ### STS ### |
| | | .apt_generated |
| | | .classpath |
| | | .factorypath |
| | | .project |
| | | .settings |
| | | .springBeans |
| | | .sts4-cache |
| | | |
| | | ### IntelliJ IDEA ### |
| | | .idea |
| | | *.iws |
| | | *.iml |
| | | *.ipr |
| | | |
| | | ### NetBeans ### |
| | | /nbproject/private/ |
| | | /nbbuild/ |
| | | /dist/ |
| | | /nbdist/ |
| | | /.nb-gradle/ |
| | | build/ |
| | | !**/src/main/**/build/ |
| | | !**/src/test/**/build/ |
| | | |
| | | ### VS Code ### |
| | | .vscode/ |
New file |
| | |
| | | /* |
| | | * Copyright 2007-present the original author or authors. |
| | | * |
| | | * Licensed 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. |
| | | */ |
| | | |
| | | import java.net.*; |
| | | import java.io.*; |
| | | import java.nio.channels.*; |
| | | import java.util.Properties; |
| | | |
| | | public class MavenWrapperDownloader { |
| | | |
| | | private static final String WRAPPER_VERSION = "0.5.6"; |
| | | /** |
| | | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. |
| | | */ |
| | | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" |
| | | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; |
| | | |
| | | /** |
| | | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to |
| | | * use instead of the default one. |
| | | */ |
| | | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = |
| | | ".mvn/wrapper/maven-wrapper.properties"; |
| | | |
| | | /** |
| | | * Path where the maven-wrapper.jar will be saved to. |
| | | */ |
| | | private static final String MAVEN_WRAPPER_JAR_PATH = |
| | | ".mvn/wrapper/maven-wrapper.jar"; |
| | | |
| | | /** |
| | | * Name of the property which should be used to override the default download url for the wrapper. |
| | | */ |
| | | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; |
| | | |
| | | public static void main(String args[]) { |
| | | System.out.println("- Downloader started"); |
| | | File baseDirectory = new File(args[0]); |
| | | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); |
| | | |
| | | // If the maven-wrapper.properties exists, read it and check if it contains a custom |
| | | // wrapperUrl parameter. |
| | | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); |
| | | String url = DEFAULT_DOWNLOAD_URL; |
| | | if (mavenWrapperPropertyFile.exists()) { |
| | | FileInputStream mavenWrapperPropertyFileInputStream = null; |
| | | try { |
| | | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); |
| | | Properties mavenWrapperProperties = new Properties(); |
| | | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); |
| | | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); |
| | | } catch (IOException e) { |
| | | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); |
| | | } finally { |
| | | try { |
| | | if (mavenWrapperPropertyFileInputStream != null) { |
| | | mavenWrapperPropertyFileInputStream.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | // Ignore ... |
| | | } |
| | | } |
| | | } |
| | | System.out.println("- Downloading from: " + url); |
| | | |
| | | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); |
| | | if (!outputFile.getParentFile().exists()) { |
| | | if (!outputFile.getParentFile().mkdirs()) { |
| | | System.out.println( |
| | | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); |
| | | } |
| | | } |
| | | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); |
| | | try { |
| | | downloadFileFromURL(url, outputFile); |
| | | System.out.println("Done"); |
| | | System.exit(0); |
| | | } catch (Throwable e) { |
| | | System.out.println("- Error downloading"); |
| | | e.printStackTrace(); |
| | | System.exit(1); |
| | | } |
| | | } |
| | | |
| | | private static void downloadFileFromURL(String urlString, File destination) throws Exception { |
| | | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { |
| | | String username = System.getenv("MVNW_USERNAME"); |
| | | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); |
| | | Authenticator.setDefault(new Authenticator() { |
| | | @Override |
| | | protected PasswordAuthentication getPasswordAuthentication() { |
| | | return new PasswordAuthentication(username, password); |
| | | } |
| | | }); |
| | | } |
| | | URL website = new URL(urlString); |
| | | ReadableByteChannel rbc; |
| | | rbc = Channels.newChannel(website.openStream()); |
| | | FileOutputStream fos = new FileOutputStream(destination); |
| | | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); |
| | | fos.close(); |
| | | rbc.close(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip |
| | | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar |
New file |
| | |
| | | #!/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 "$@" |
New file |
| | |
| | | @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% |
New file |
| | |
| | | <?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>com.panzhihua</groupId> |
| | | <artifactId>zhihuishequ</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <groupId>com.panzhihua</groupId> |
| | | <artifactId>applets</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <name>applets</name> |
| | | <description>小程序</description> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-config</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.panzhihua</groupId> |
| | | <artifactId>common</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.netflix.hystrix</groupId> |
| | | <artifactId>hystrix-javanica</artifactId> |
| | | </dependency> |
| | | <!-- 微信小程序--> |
| | | <dependency> |
| | | <groupId>com.github.binarywang</groupId> |
| | | <artifactId>weixin-java-miniapp</artifactId> |
| | | <version>3.9.9.B</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.github.xiaoymin</groupId> |
| | | <artifactId>swagger-bootstrap-ui</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.panzhihua</groupId> |
| | | <artifactId>common</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | <repositories> |
| | | <repository> |
| | | <id>spring-snapshots</id> |
| | | <name>Spring Snapshots</name> |
| | | <url>https://repo.spring.io/snapshot</url> |
| | | <snapshots> |
| | | <enabled>true</enabled> |
| | | </snapshots> |
| | | </repository> |
| | | <repository> |
| | | <id>spring-milestones</id> |
| | | <name>Spring Milestones</name> |
| | | <url>https://repo.spring.io/milestone</url> |
| | | </repository> |
| | | </repositories> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.panzhihua.applets; |
| | | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.cloud.client.SpringCloudApplication; |
| | | import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; |
| | | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; |
| | | import org.springframework.cloud.openfeign.EnableFeignClients; |
| | | import org.springframework.context.annotation.ComponentScan; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | @EnableSwagger2 |
| | | @SpringCloudApplication |
| | | @EnableCircuitBreaker |
| | | @EnableEurekaClient |
| | | @EnableFeignClients(basePackages = {"com.panzhihua.common.service"}) |
| | | @ComponentScan("com.panzhihua") |
| | | public class AppletsApplication { |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(AppletsApplication.class, args); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import com.panzhihua.common.constants.FtpConstants; |
| | | import com.panzhihua.common.constants.UserConstants; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.user.UserPhoneVO; |
| | | import com.panzhihua.common.utlis.SFTPUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.RandomUtils; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.data.redis.core.ValueOperations; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.InputStream; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 公共接口 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-10 15:41 |
| | | **/ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/common/") |
| | | @Api(tags = {"公共接口"}) |
| | | public class CommonApi { |
| | | @Resource |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | |
| | | @ApiOperation(value = "上传照片") |
| | | @PostMapping(value = "uploadimage",consumes = "multipart/*",headers = "content-type=multipart/form-date") |
| | | public R uploadImage(@RequestParam MultipartFile file, HttpServletRequest request) { |
| | | String name = file.getOriginalFilename(); |
| | | try { |
| | | SFTPUtil sftp = new SFTPUtil(); |
| | | sftp.login(); |
| | | InputStream is = file.getInputStream(); |
| | | sftp.uploadMore(FtpConstants.FTPFILEPATH_IDCARD, name, is); |
| | | sftp.logout(); |
| | | return R.ok(FtpConstants.HTTP_URL+"/idcard/" + name); |
| | | } catch (Exception e) { |
| | | log.error("上传照片失败【{}】", e.getMessage()); |
| | | return R.fail(); |
| | | } |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "发送验证码") |
| | | @PostMapping(value = "smscode") |
| | | public R smscode(@RequestBody UserPhoneVO userPhoneVO) { |
| | | String newPhone = userPhoneVO.getNewPhone(); |
| | | if (ObjectUtils.isEmpty(newPhone)) { |
| | | return R.fail("新手机号不能为空"); |
| | | } |
| | | //todo 发送验证码接第三方 |
| | | int nextInt = RandomUtils.nextInt(99999, 1000000); |
| | | ValueOperations<String, String> valueOperations = stringRedisTemplate.opsForValue(); |
| | | valueOperations.set(UserConstants.PHONE_PUT+newPhone,nextInt+"",3, TimeUnit.MINUTES); |
| | | return R.ok(nextInt); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | int nextInt = RandomUtils.nextInt(99999, 1000000); |
| | | System.out.println(nextInt); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.*; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区服务 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-10 10:04 |
| | | **/ |
| | | @RestController |
| | | @RequestMapping("/community/") |
| | | @Api(tags = {"社区服务"}) |
| | | public class CommunityApi extends BaseController { |
| | | @Resource |
| | | private CommunityService communityService; |
| | | |
| | | @ApiOperation(value = "分页获取社区动态",response = ComActDynVO.class) |
| | | @PostMapping("pagedynamic") |
| | | public R pageDynamic(@RequestBody ComActDynVO comActDynVO){ |
| | | Long communityId = this.getCommunityId(); |
| | | comActDynVO.setCommunityId(communityId); |
| | | comActDynVO.setIsTopping(null); |
| | | comActDynVO.setStatus(null); |
| | | return communityService.pageDynamic(comActDynVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "社区动态详情",response = ComActDynVO.class) |
| | | @GetMapping("detaildynamic") |
| | | @ApiImplicitParam(name ="id",value = "社区动态主键",required = true) |
| | | public R detailDynamic(@RequestParam("id") Long id){//todo 增加微信分享接口 |
| | | return communityService.detailDynamic(id); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询社区活动",response = ComActActivityVO.class) |
| | | @PostMapping("pageactivity") |
| | | public R pageActivity(@RequestBody ComActActivityVO comActActivityVO){ |
| | | Long communityId = this.getCommunityId(); |
| | | comActActivityVO.setCommunityId(communityId); |
| | | return communityService.pageActivity(comActActivityVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "社区活动/志愿者活动详情",response = ComActActivityVO.class) |
| | | @GetMapping("detailactivity") |
| | | @ApiImplicitParam(name ="id",value = "社区活动主键",required = true) |
| | | public R detailActivity(@RequestParam("id") Long id){ |
| | | Long userId = this.getUserId(); |
| | | return communityService.detailActivity(id,userId); |
| | | } |
| | | |
| | | @ApiOperation(value = "报名/取消报名社区活动") |
| | | @PutMapping("signactivity") |
| | | public R signActivity(@RequestBody SignactivityVO signactivityVO){ |
| | | Long userId = this.getUserId(); |
| | | signactivityVO.setUserId(userId); |
| | | return communityService.signActivity(signactivityVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "活动人员列表",response = ActivitySignVO.class) |
| | | @ApiImplicitParam(name ="id",value = "社区活动主键",required = true) |
| | | @PostMapping("listactivitysign") |
| | | public R listActivitySign(@RequestParam("id") Long id){ |
| | | ActivitySignVO activitySignVO=new ActivitySignVO(); |
| | | activitySignVO.setActivityId(id); |
| | | return communityService.listActivitySign(activitySignVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增社区动态浏览记录") |
| | | @PostMapping("dynamicuser") |
| | | public R addDynamicUser(@RequestBody ComActDynVO comActDynVO){ |
| | | Long id = comActDynVO.getId(); |
| | | if (ObjectUtils.isEmpty(id)||id==0) { |
| | | return R.fail("社区动态不存在"); |
| | | } |
| | | Long userId = this.getUserId(); |
| | | return communityService.addDynamicUser(id,userId); |
| | | } |
| | | |
| | | @ApiOperation(value = "志愿者申请") |
| | | @PostMapping("volunteer") |
| | | public R addVolunteer(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO){ |
| | | comMngVolunteerMngVO.setState(1); |
| | | return communityService.addVolunteer(comMngVolunteerMngVO); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComActEasyPhotoVO; |
| | | import com.panzhihua.common.model.vos.community.ComActMicroWishVO; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 首页 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-10 14:39 |
| | | **/ |
| | | @RestController |
| | | @RequestMapping("/index/") |
| | | @Api(tags = {"首页"}) |
| | | public class IndexApi extends BaseController { |
| | | @Resource |
| | | private CommunityService communityService; |
| | | |
| | | @ApiOperation("分页展示社区随手拍") |
| | | @PostMapping("pageeasyphoto") |
| | | public R pageEasyPhoto (){ |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | Long communityId = loginUserInfo.getCommunityId(); |
| | | Long userId = loginUserInfo.getUserId(); |
| | | ComActEasyPhotoVO comActEasyPhotoVO=new ComActEasyPhotoVO(); |
| | | comActEasyPhotoVO.setCommunityId(communityId); |
| | | comActEasyPhotoVO.setSponsorId(userId); |
| | | comActEasyPhotoVO.setStatus(4); |
| | | return communityService.pageEasyPhoto(comActEasyPhotoVO); |
| | | } |
| | | |
| | | @ApiOperation("上传随手拍") |
| | | @PostMapping("easyphoto") |
| | | public R addEasyPhoto (@RequestBody ComActEasyPhotoVO comActEasyPhotoVO){ |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | Long communityId = loginUserInfo.getCommunityId(); |
| | | Long userId = loginUserInfo.getUserId(); |
| | | comActEasyPhotoVO.setCommunityId(communityId); |
| | | comActEasyPhotoVO.setSponsorId(userId); |
| | | comActEasyPhotoVO.setStatus(1); |
| | | return communityService.addEasyPhoto(comActEasyPhotoVO); |
| | | } |
| | | |
| | | @ApiOperation("随手拍详情") |
| | | @GetMapping("detaileasyphoto") |
| | | @ApiImplicitParam(name = "id",value = "随手拍主键") |
| | | public R detailEasyPhoto (@RequestParam("id") Long id){ |
| | | Long userId = this.getUserId(); |
| | | return communityService.detailEasyPhoto(id,userId); |
| | | } |
| | | |
| | | @ApiOperation("点赞/取消点赞随手拍") |
| | | @PutMapping("easyphoto") |
| | | public R putEasyPhoto (@RequestBody ComActEasyPhotoVO comActEasyPhotoVO){ |
| | | Long id = comActEasyPhotoVO.getId(); |
| | | if (null==id||id==0) { |
| | | return R.fail("随手拍主键不能为空"); |
| | | } |
| | | Long userId = this.getUserId(); |
| | | comActEasyPhotoVO.setSponsorId(userId); |
| | | return communityService.putEasyPhoto(comActEasyPhotoVO); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("分页展示社区微心愿") |
| | | @PostMapping("pagemicrowish") |
| | | public R pageMicroWish (){ |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | Long communityId = loginUserInfo.getCommunityId(); |
| | | Long userId = loginUserInfo.getUserId(); |
| | | ComActMicroWishVO comActMicroWishVO=new ComActMicroWishVO(); |
| | | comActMicroWishVO.setCommunityId(communityId); |
| | | comActMicroWishVO.setIsApplets(1); |
| | | comActMicroWishVO.setResponsibleId(userId);//责任人暂时放登录用户id |
| | | return communityService.pageMicroWish(comActMicroWishVO); |
| | | } |
| | | |
| | | @ApiOperation("发布微心愿") |
| | | @PostMapping("microwish") |
| | | public R addMicroWish (@RequestBody ComActMicroWishVO comActMicroWishVO){ |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | Long communityId = loginUserInfo.getCommunityId(); |
| | | Long userId = loginUserInfo.getUserId(); |
| | | String phone = loginUserInfo.getPhone(); |
| | | if (ObjectUtils.isEmpty(phone)) { |
| | | return R.fail("只有认证后的用户才能发布微心愿"); |
| | | } |
| | | comActMicroWishVO.setSponsorPhone(phone); |
| | | comActMicroWishVO.setCommunityId(communityId); |
| | | comActMicroWishVO.setSponsorId(userId); |
| | | return communityService.addMicroWish(comActMicroWishVO); |
| | | } |
| | | |
| | | @ApiOperation("心愿详情") |
| | | @GetMapping("microwish") |
| | | @ApiImplicitParam(name = "id",value = "微心愿主键") |
| | | public R detailMicroWish (@RequestParam("id")Long id){ |
| | | Long userId = this.getUserId(); |
| | | return communityService.detailMicroWish(id,userId); |
| | | } |
| | | |
| | | @ApiOperation("点赞/取消点赞微心愿") |
| | | @PutMapping("microwish") |
| | | public R putMicroWish (@RequestBody ComActMicroWishVO comActMicroWishVO){ |
| | | Long id = comActMicroWishVO.getId(); |
| | | if (null==id||id==0) { |
| | | return R.fail("微心愿主键不能为空"); |
| | | } |
| | | Long userId = this.getUserId(); |
| | | comActMicroWishVO.setSponsorId(userId);//发起人字段暂时存放userId |
| | | return communityService.putMicroWish(comActMicroWishVO); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import cn.binarywang.wx.miniapp.api.WxMaService; |
| | | import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; |
| | | import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; |
| | | import cn.binarywang.wx.miniapp.bean.WxMaUserInfo; |
| | | import com.panzhihua.applets.config.WxMaConfiguration; |
| | | import com.panzhihua.applets.model.vos.LoginRequest; |
| | | import com.panzhihua.common.model.vos.LoginReturnVO; |
| | | import com.panzhihua.common.model.vos.community.ComActVO; |
| | | import com.panzhihua.common.service.auth.TokenService; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.exceptions.UnAuthenticationException; |
| | | import com.panzhihua.common.exceptions.WeiXinException; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import io.swagger.annotations.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 登录 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-19 16:35 |
| | | **/ |
| | | @Slf4j |
| | | @Api(tags = {"登录模块"}) |
| | | @RestController("/") |
| | | public class LoginApi extends BaseController { |
| | | @Resource |
| | | private UserService userService; |
| | | @Resource |
| | | private WxMaConfiguration wxMaConfiguration; |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private CommunityService communityService; |
| | | |
| | | @ApiOperation(value = "登录" ,response =LoginReturnVO.class ) |
| | | @PostMapping("login") |
| | | public R login(@RequestBody LoginRequest loginRequest) { |
| | | String code = loginRequest.getCode(); |
| | | if (ObjectUtils.isEmpty(code)) { |
| | | return R.fail("缺少登录参数"); |
| | | } |
| | | WxMaService maService = wxMaConfiguration.getMaService(); |
| | | WxMaJscode2SessionResult sessionInfo=null; |
| | | try { |
| | | sessionInfo = maService.getUserService().getSessionInfo(code); |
| | | } catch (Exception e) { |
| | | log.error("微信登录失败【{}】", e.getMessage()); |
| | | sessionInfo=new WxMaJscode2SessionResult(); |
| | | sessionInfo.setOpenid("88888888"); |
| | | sessionInfo.setSessionKey("9999999"); |
| | | sessionInfo.setUnionid("44444444"); |
| | | } |
| | | String openid = sessionInfo.getOpenid(); |
| | | String sessionKey = sessionInfo.getSessionKey(); |
| | | String unionid = sessionInfo.getUnionid(); |
| | | userService.addOrUpdate(openid,sessionKey,unionid); |
| | | return tokenService.loginApplets(openid); |
| | | } |
| | | |
| | | @ApiOperation(value = "维护用户基本信息(昵称、性别、头像)") |
| | | @PostMapping("updateUserWeiXinInfo") |
| | | public R updateUserWeiXinInfo(@RequestBody LoginRequest loginRequest){ |
| | | String encryptedData = loginRequest.getEncryptedData(); |
| | | String iv = loginRequest.getIv(); |
| | | boolean empty = ObjectUtils.isEmpty(iv); |
| | | boolean empty1 = ObjectUtils.isEmpty(encryptedData); |
| | | if (empty||empty1) { |
| | | return R.fail("微信用户参数不全"); |
| | | } |
| | | WxMaService maService = wxMaConfiguration.getMaService(); |
| | | Long userId = this.getUserId(); |
| | | boolean empty2 = ObjectUtils.isEmpty(userId); |
| | | if (empty2) { |
| | | throw new UnAuthenticationException(); |
| | | } |
| | | R<LoginUserInfoVO> r = userService.getUserInfoByUserId(userId + ""); |
| | | LoginUserInfoVO loginUserInfoVO =r.getData(); |
| | | WxMaUserInfo wxUserInfo = maService.getUserService().getUserInfo(loginUserInfoVO.getSessionKey(), |
| | | encryptedData, iv); |
| | | if (null == wxUserInfo) { |
| | | return R.fail("微信解析基本信息失败"); |
| | | } |
| | | String avatarUrl = wxUserInfo.getAvatarUrl(); |
| | | String gender = wxUserInfo.getGender(); |
| | | String nickName = wxUserInfo.getNickName(); |
| | | return userService.updateUserWeiXinInfo(userId,nickName,Integer.parseInt(gender),avatarUrl); |
| | | } |
| | | |
| | | @ApiOperation(value = "维护微信用户手机号") |
| | | @PostMapping("updateUserWeiXinPhone") |
| | | public R updateUserWeiXinPhone(@RequestBody LoginRequest loginRequest){ |
| | | String encryptedData = loginRequest.getEncryptedData(); |
| | | String iv = loginRequest.getIv(); |
| | | boolean empty = ObjectUtils.isEmpty(iv); |
| | | boolean empty1 = ObjectUtils.isEmpty(encryptedData); |
| | | if (empty||empty1) { |
| | | return R.fail("微信用户参数不全"); |
| | | } |
| | | WxMaService maService = wxMaConfiguration.getMaService(); |
| | | Long userId = this.getUserId(); |
| | | boolean empty2 = ObjectUtils.isEmpty(userId); |
| | | if (empty2) { |
| | | throw new UnAuthenticationException(); |
| | | } |
| | | R<LoginUserInfoVO> r = userService.getUserInfoByUserId(userId + ""); |
| | | LoginUserInfoVO loginUserInfoVO = r.getData(); |
| | | WxMaPhoneNumberInfo wxMaPhoneNumberInfo = maService.getUserService().getPhoneNoInfo(loginUserInfoVO.getSessionKey(), |
| | | encryptedData, iv); |
| | | if (ObjectUtils.isEmpty(wxMaPhoneNumberInfo) || ObjectUtils.isEmpty(wxMaPhoneNumberInfo.getPhoneNumber())) { |
| | | throw new WeiXinException("微信解析手机号失败"); |
| | | } |
| | | String purePhoneNumber = wxMaPhoneNumberInfo.getPurePhoneNumber(); |
| | | return userService.updateUserWeiXinPhone(userId,purePhoneNumber); |
| | | } |
| | | |
| | | @ApiOperation(value = "用户登出") |
| | | @PostMapping("logout") |
| | | public R updateUserWeiXinPhone(){ |
| | | String token = this.getToken(); |
| | | boolean empty2 = ObjectUtils.isEmpty(token); |
| | | if (empty2) { |
| | | return R.ok(); |
| | | } |
| | | return tokenService.logout(token); |
| | | } |
| | | |
| | | @ApiOperation(value = "刷新token",response = LoginReturnVO.class) |
| | | @GetMapping("refreshToken") |
| | | @ApiImplicitParam(name ="refreshToken",value = "登录返回的刷新token") |
| | | public R refreshToken(@RequestParam("refreshToken")String refreshToken){ |
| | | return tokenService.refreshToken(refreshToken); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询社区") |
| | | @GetMapping("listcommunity") |
| | | public R listCommunity(@RequestBody ComActVO comActVO){ |
| | | return communityService.listCommunity(comActVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "用户绑定社区、小区") |
| | | @PutMapping("putusercommunityarea") |
| | | public R putUserCommunityArea(@RequestBody LoginUserInfoVO loginUserInfoVO){ |
| | | Long userId = this.getUserId(); |
| | | Long communityId = loginUserInfoVO.getCommunityId(); |
| | | Long areaId = loginUserInfoVO.getAreaId(); |
| | | if (null==communityId||0==communityId) { |
| | | return R.fail("社区未选择"); |
| | | } |
| | | if (null==areaId||0==areaId) { |
| | | return R.fail("小区未选择"); |
| | | } |
| | | loginUserInfoVO.setUserId(userId); |
| | | return userService.putUserCommunityArea(loginUserInfoVO); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.partybuilding.*; |
| | | import com.panzhihua.common.service.partybuilding.PartyBuildingService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 党群服务 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-02 16:19 |
| | | **/ |
| | | @RestController |
| | | @RequestMapping("/partybuilding/") |
| | | @Api(tags = {"党群服务"}) |
| | | public class PartyBuildingApi extends BaseController { |
| | | @Resource |
| | | private PartyBuildingService partyBuildingService; |
| | | |
| | | @ApiOperation(value = "分页党建动态/政策文件",response =PartyCommitteeVO.class ) |
| | | @PostMapping("pagedynamic") |
| | | public R pageYnamic(@RequestBody PartyBuildingComPbDynVO partyBuildingComPbDynVO){ |
| | | Long communityId = this.getCommunityId(); |
| | | Integer type = partyBuildingComPbDynVO.getType(); |
| | | if (ObjectUtils.isEmpty(type)) { |
| | | return R.fail("类型不能为空"); |
| | | } |
| | | partyBuildingComPbDynVO.setCommunityId(communityId); |
| | | return partyBuildingService.pageYnamic(partyBuildingComPbDynVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询党员活动",response = PageActivityMembersVO.class) |
| | | @PostMapping("pageactivity") |
| | | public R pageActivity(@RequestBody PartyBuildingActivityVO partyBuildingActivityVO) { |
| | | return partyBuildingService.pageActivity(partyBuildingActivityVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "动态/政策文件详情",response =PartyBuildingComPbDynVO.class ) |
| | | @GetMapping("infodynamic") |
| | | public R infoYnamic(@RequestParam("id") Long id) { |
| | | return partyBuildingService.infoYnamic(id); |
| | | } |
| | | |
| | | @ApiOperation(value = "增加阅读记录") |
| | | @PostMapping("adddynuser") |
| | | public R addDynUser(@RequestBody PartyBuildingComPbDynVO partyBuildingComPbDynVO) { |
| | | Long id = partyBuildingComPbDynVO.getId(); |
| | | if (ObjectUtils.isEmpty(id)||0==id) { |
| | | return R.fail("主键id不能为空"); |
| | | } |
| | | Long userId = this.getUserId(); |
| | | ComPbDynUserVO comPbDynUserVO=new ComPbDynUserVO(); |
| | | comPbDynUserVO.setCreateAt(new Date()); |
| | | comPbDynUserVO.setDynId(id); |
| | | comPbDynUserVO.setUserId(userId); |
| | | return partyBuildingService.addDynUser(comPbDynUserVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页党委查询",response =PartyCommitteeVO.class ) |
| | | @PostMapping("pagepartycommittee") |
| | | public R pagePartyCommittee(@RequestBody PartyCommitteeVO partyCommitteeVO) { |
| | | Long communityId =this.getCommunityId(); |
| | | partyCommitteeVO.setCommunityId(communityId); |
| | | return partyBuildingService.pagePartyCommittee(partyCommitteeVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "活动详情",response = PartyBuildingActivityVO.class) |
| | | @GetMapping("activityinfo") |
| | | public R activityinfo(@RequestParam("id") Long id) { |
| | | return partyBuildingService.activityinfo(id); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import com.panzhihua.common.model.vos.community.ComActActivityVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngStructHouseVO; |
| | | import com.panzhihua.common.model.vos.user.ComMngFamilyInfoVO; |
| | | import com.panzhihua.common.model.vos.user.UserPhoneVO; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.exceptions.UnAuthenticationException; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 用户 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 12:03 |
| | | **/ |
| | | @RestController |
| | | @RequestMapping("/user/") |
| | | @Api(tags = {"我的模块"}) |
| | | public class UserApi extends BaseController { |
| | | @Resource |
| | | private UserService userService; |
| | | @Resource |
| | | private CommunityService communityService; |
| | | |
| | | @ApiOperation(value = "当前登录用户信息", response = LoginUserInfoVO.class) |
| | | @GetMapping("info") |
| | | public R getUserInfo() { |
| | | Long userId = this.getUserId(); |
| | | boolean empty = ObjectUtils.isEmpty(userId); |
| | | if (empty) { |
| | | throw new UnAuthenticationException(); |
| | | } |
| | | R<LoginUserInfoVO> r = userService.getUserInfoByUserId(userId + ""); |
| | | if (R.isOk(r)) { |
| | | Object data = r.getData(); |
| | | if (!ObjectUtils.isEmpty(data)) { |
| | | LoginUserInfoVO loginUserInfoVO = (LoginUserInfoVO) data; |
| | | R r1 = communityService.detailHouse(userId); |
| | | if (R.isOk(r1)) { |
| | | Object data1 = r1.getData(); |
| | | if (!ObjectUtils.isEmpty(data1)) { |
| | | loginUserInfoVO.setComMngStructHouseVOS((List<ComMngStructHouseVO>) data1); |
| | | r.setData(loginUserInfoVO); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return r; |
| | | } |
| | | |
| | | @ApiOperation(value = "用户实名认证") |
| | | @PutMapping("putuserauthentication") |
| | | public R putUserAuthentication(@RequestBody LoginUserInfoVO loginUserInfoVO) { |
| | | Long userId = this.getUserId(); |
| | | loginUserInfoVO.setUserId(userId); |
| | | return userService.putUserAuthentication(loginUserInfoVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "修改用户手机号") |
| | | @PutMapping("userphone") |
| | | public R putUserphone(@RequestBody UserPhoneVO userPhoneVO) { |
| | | Long userId = this.getUserId(); |
| | | userPhoneVO.setUserId(userId); |
| | | R r = userService.putUserphone(userPhoneVO); |
| | | if (R.isOk(r)) { |
| | | communityService.putVolunteerPhone(userPhoneVO); |
| | | } |
| | | return r; |
| | | } |
| | | |
| | | @ApiOperation(value = "修改用户手机号") |
| | | @PutMapping("user") |
| | | public R putUser(@RequestBody LoginUserInfoVO loginUserInfoVO) { |
| | | Long userId = this.getUserId(); |
| | | loginUserInfoVO.setUserId(userId); |
| | | return userService.putUser(loginUserInfoVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "房屋地址下拉列表") |
| | | @GetMapping("listhouse") |
| | | @ApiImplicitParam(name = "parentCode",value = "父级地址编码",required = false) |
| | | public R listHouses(String parentCode) { |
| | | Long areaId = this.getAreaId(); |
| | | if (ObjectUtils.isEmpty(parentCode)) { |
| | | parentCode=""; |
| | | } |
| | | return communityService.listHouses(parentCode,areaId); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增房屋") |
| | | @PostMapping("houses") |
| | | public R addHouses(@RequestBody ComMngStructHouseVO comMngStructHouseVO) { |
| | | String houseCode = comMngStructHouseVO.getHouseCode(); |
| | | if (ObjectUtils.isEmpty(houseCode)) { |
| | | return R.fail("房屋地址编码不能为空"); |
| | | } |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | comMngStructHouseVO.setUserId(loginUserInfo.getUserId()); |
| | | comMngStructHouseVO.setAreaId(loginUserInfo.getAreaId()); |
| | | return communityService.addHouses(comMngStructHouseVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "家庭成员列表") |
| | | @GetMapping("listfamily") |
| | | public R listFamily() { |
| | | Long userId = this.getUserId(); |
| | | return userService.listFamily(userId); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增家庭成员") |
| | | @GetMapping("addfamily") |
| | | public R addFamily(@RequestBody ComMngFamilyInfoVO comMngFamilyInfoVO) { |
| | | Long userId = this.getUserId(); |
| | | comMngFamilyInfoVO.setUserId(userId); |
| | | return userService.addFamily(comMngFamilyInfoVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑家庭成员") |
| | | @PutMapping("putfamily") |
| | | public R putFamily(@RequestBody ComMngFamilyInfoVO comMngFamilyInfoVO) { |
| | | Long id = comMngFamilyInfoVO.getId(); |
| | | if (null==id||0==id) { |
| | | return R.fail("成员主键不能为空"); |
| | | } |
| | | return userService.putFamily(comMngFamilyInfoVO); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.applets.config; |
| | | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import springfox.documentation.builders.ApiInfoBuilder; |
| | | import springfox.documentation.builders.PathSelectors; |
| | | import springfox.documentation.builders.RequestHandlerSelectors; |
| | | import springfox.documentation.service.ApiInfo; |
| | | import springfox.documentation.service.Contact; |
| | | import springfox.documentation.spi.DocumentationType; |
| | | import springfox.documentation.spring.web.plugins.Docket; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: swagger3 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-19 16:08 |
| | | **/ |
| | | @Configuration |
| | | public class SwaggerConfig { |
| | | @Bean |
| | | public Docket createRestApi() { |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | .apiInfo(apiInfo()) |
| | | .select() |
| | | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) |
| | | .apis(RequestHandlerSelectors.basePackage("com.panzhihua")) |
| | | .paths(PathSelectors.any()) |
| | | .build(); |
| | | } |
| | | |
| | | private ApiInfo apiInfo() { |
| | | return new ApiInfoBuilder() |
| | | .title("攀枝花小程序开发文档") |
| | | .description("。") |
| | | .contact(new Contact("huanghongfa", "", "")) |
| | | .version("1.0") |
| | | .build(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.applets.config; |
| | | |
| | | import cn.binarywang.wx.miniapp.api.WxMaService; |
| | | import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; |
| | | import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.boot.context.properties.EnableConfigurationProperties; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: wexin |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-23 15:07 |
| | | **/ |
| | | @Slf4j |
| | | @Component |
| | | public class WxMaConfiguration { |
| | | |
| | | @Resource |
| | | private WxMaProperties properties; |
| | | |
| | | public WxMaService getMaService() { |
| | | WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); |
| | | config.setAppid(properties.getAppid()); |
| | | config.setSecret(properties.getSecret()); |
| | | config.setMsgDataFormat(properties.getMsgDataFormat()); |
| | | WxMaService wxMaService = new WxMaServiceImpl(); |
| | | wxMaService.setWxMaConfig(config); |
| | | return wxMaService; |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.applets.config; |
| | | |
| | | import lombok.Data; |
| | | import lombok.Getter; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 微信配置 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-23 14:52 |
| | | **/ |
| | | @Data |
| | | @Component |
| | | @ConfigurationProperties(prefix = "wx.miniapp") |
| | | public class WxMaProperties { |
| | | |
| | | /** |
| | | * 设置微信小程序的appid |
| | | */ |
| | | private String appid; |
| | | |
| | | /** |
| | | * 设置微信小程序的Secret |
| | | */ |
| | | private String secret; |
| | | |
| | | /** |
| | | * 设置微信小程序消息服务器配置的token |
| | | */ |
| | | private String token; |
| | | |
| | | /** |
| | | * 设置微信小程序消息服务器配置的EncodingAESKey |
| | | */ |
| | | private String aesKey; |
| | | |
| | | /** |
| | | * 消息格式,XML或者JSON |
| | | */ |
| | | private String msgDataFormat; |
| | | } |
New file |
| | |
| | | package com.panzhihua.applets.exception; |
| | | |
| | | import com.panzhihua.common.exceptions.TokenException; |
| | | import com.panzhihua.common.exceptions.UnAuthenticationException; |
| | | import com.panzhihua.common.exceptions.UnAuthorizationException; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import org.springframework.web.bind.annotation.ExceptionHandler; |
| | | import org.springframework.web.bind.annotation.RestControllerAdvice; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 全局异常捕获 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-25 14:36 |
| | | **/ |
| | | @RestControllerAdvice |
| | | public class GlobalExceptionCapture { |
| | | /** |
| | | * 拦截捕捉自定义异常 TokenException.class |
| | | * @param ex token 异常 |
| | | * @return R 401 |
| | | */ |
| | | @ExceptionHandler(value = TokenException.class) |
| | | public R myErrorHandlerTokenException(TokenException ex) { |
| | | return R.fail(ex.getCode(),ex.getMsg()); |
| | | } |
| | | |
| | | /** |
| | | * 拦截捕捉自定义异常 UnAuthenticationException.class |
| | | * @param ex 认证 异常 |
| | | * @return R 401 |
| | | */ |
| | | @ExceptionHandler(value = UnAuthenticationException.class) |
| | | public R myErrorHandlerUnAuthenticationException(UnAuthenticationException ex) { |
| | | return R.fail(ex.getCode(),ex.getMsg()); |
| | | } |
| | | |
| | | /** |
| | | * 拦截捕捉自定义异常 UnAuthorizationException.class |
| | | * @param ex 权限 异常 |
| | | * @return R 403 |
| | | */ |
| | | @ExceptionHandler(value = UnAuthorizationException.class) |
| | | public R myErrorHandlerUnAuthorizationException(UnAuthenticationException ex) { |
| | | return R.fail(ex.getCode(),ex.getMsg()); |
| | | } |
| | | |
| | | /** |
| | | * 全局异常捕捉处理 |
| | | * @param ex 所有运行时异常 |
| | | * @return R 500 |
| | | */ |
| | | @ExceptionHandler(value = Exception.class) |
| | | public R errorHandler(Exception ex) { |
| | | return R.fail(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.applets.model.vos; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 微信登录 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-23 14:12 |
| | | **/ |
| | | @Data |
| | | @ApiModel(value = "小程序登录") |
| | | public class LoginRequest { |
| | | |
| | | @ApiModelProperty(name = "code",value = "登录时获取的 code") |
| | | String code; |
| | | |
| | | @ApiModelProperty(name = "signature",value = "使用 sha1( rawData + sessionkey ) 得到字符串,用于校验用户信息") |
| | | String signature; |
| | | |
| | | @ApiModelProperty(name = "rawData",value = "不包括敏感信息的原始数据字符串,用于计算签名") |
| | | String rawData; |
| | | |
| | | @ApiModelProperty(name = "encryptedData",value = "包括敏感数据在内的完整用户信息的加密数据") |
| | | String encryptedData; |
| | | |
| | | @ApiModelProperty(name = "iv",value = "加密算法的初始向量") |
| | | String iv; |
| | | } |
New file |
| | |
| | | server: |
| | | port: 8195 |
| | | servlet: |
| | | encoding: |
| | | force-response: true #中文乱码 |
| | | |
| | | spring: |
| | | application: |
| | | name: applets |
| | | eureka: |
| | | client: |
| | | service-url: |
| | | defaultZone: http://localhost:8192/eureka/ |
| | | |
| | | feign: |
| | | hystrix: |
| | | enabled: true |
| | | |
| | | wx: |
| | | miniapp: |
| | | appid: wx93b8361ed926f3fd |
| | | secret: f346f32dab20729973451d2fd2a03d15 |
| | | msgDataFormat: JSON |
New file |
| | |
| | | HELP.md |
| | | target/ |
| | | !.mvn/wrapper/maven-wrapper.jar |
| | | !**/src/main/**/target/ |
| | | !**/src/test/**/target/ |
| | | |
| | | ### STS ### |
| | | .apt_generated |
| | | .classpath |
| | | .factorypath |
| | | .project |
| | | .settings |
| | | .springBeans |
| | | .sts4-cache |
| | | |
| | | ### IntelliJ IDEA ### |
| | | .idea |
| | | *.iws |
| | | *.iml |
| | | *.ipr |
| | | |
| | | ### NetBeans ### |
| | | /nbproject/private/ |
| | | /nbbuild/ |
| | | /dist/ |
| | | /nbdist/ |
| | | /.nb-gradle/ |
| | | build/ |
| | | !**/src/main/**/build/ |
| | | !**/src/test/**/build/ |
| | | |
| | | ### VS Code ### |
| | | .vscode/ |
New file |
| | |
| | | /* |
| | | * Copyright 2007-present the original author or authors. |
| | | * |
| | | * Licensed 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. |
| | | */ |
| | | |
| | | import java.net.*; |
| | | import java.io.*; |
| | | import java.nio.channels.*; |
| | | import java.util.Properties; |
| | | |
| | | public class MavenWrapperDownloader { |
| | | |
| | | private static final String WRAPPER_VERSION = "0.5.6"; |
| | | /** |
| | | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. |
| | | */ |
| | | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" |
| | | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; |
| | | |
| | | /** |
| | | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to |
| | | * use instead of the default one. |
| | | */ |
| | | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = |
| | | ".mvn/wrapper/maven-wrapper.properties"; |
| | | |
| | | /** |
| | | * Path where the maven-wrapper.jar will be saved to. |
| | | */ |
| | | private static final String MAVEN_WRAPPER_JAR_PATH = |
| | | ".mvn/wrapper/maven-wrapper.jar"; |
| | | |
| | | /** |
| | | * Name of the property which should be used to override the default download url for the wrapper. |
| | | */ |
| | | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; |
| | | |
| | | public static void main(String args[]) { |
| | | System.out.println("- Downloader started"); |
| | | File baseDirectory = new File(args[0]); |
| | | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); |
| | | |
| | | // If the maven-wrapper.properties exists, read it and check if it contains a custom |
| | | // wrapperUrl parameter. |
| | | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); |
| | | String url = DEFAULT_DOWNLOAD_URL; |
| | | if (mavenWrapperPropertyFile.exists()) { |
| | | FileInputStream mavenWrapperPropertyFileInputStream = null; |
| | | try { |
| | | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); |
| | | Properties mavenWrapperProperties = new Properties(); |
| | | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); |
| | | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); |
| | | } catch (IOException e) { |
| | | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); |
| | | } finally { |
| | | try { |
| | | if (mavenWrapperPropertyFileInputStream != null) { |
| | | mavenWrapperPropertyFileInputStream.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | // Ignore ... |
| | | } |
| | | } |
| | | } |
| | | System.out.println("- Downloading from: " + url); |
| | | |
| | | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); |
| | | if (!outputFile.getParentFile().exists()) { |
| | | if (!outputFile.getParentFile().mkdirs()) { |
| | | System.out.println( |
| | | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); |
| | | } |
| | | } |
| | | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); |
| | | try { |
| | | downloadFileFromURL(url, outputFile); |
| | | System.out.println("Done"); |
| | | System.exit(0); |
| | | } catch (Throwable e) { |
| | | System.out.println("- Error downloading"); |
| | | e.printStackTrace(); |
| | | System.exit(1); |
| | | } |
| | | } |
| | | |
| | | private static void downloadFileFromURL(String urlString, File destination) throws Exception { |
| | | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { |
| | | String username = System.getenv("MVNW_USERNAME"); |
| | | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); |
| | | Authenticator.setDefault(new Authenticator() { |
| | | @Override |
| | | protected PasswordAuthentication getPasswordAuthentication() { |
| | | return new PasswordAuthentication(username, password); |
| | | } |
| | | }); |
| | | } |
| | | URL website = new URL(urlString); |
| | | ReadableByteChannel rbc; |
| | | rbc = Channels.newChannel(website.openStream()); |
| | | FileOutputStream fos = new FileOutputStream(destination); |
| | | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); |
| | | fos.close(); |
| | | rbc.close(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip |
| | | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar |
New file |
| | |
| | | #!/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 "$@" |
New file |
| | |
| | | @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% |
New file |
| | |
| | | <?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>com.panzhihua</groupId> |
| | | <artifactId>zhihuishequ</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <groupId>com.panzhihua</groupId> |
| | | <artifactId>applets_backstage</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <name>applets_backstage</name> |
| | | <description>小程序后台管理</description> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-config</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.github.xiaoymin</groupId> |
| | | <artifactId>swagger-bootstrap-ui</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.panzhihua</groupId> |
| | | <artifactId>common</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-openfeign</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.netflix.hystrix</groupId> |
| | | <artifactId>hystrix-javanica</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | <repositories> |
| | | <repository> |
| | | <id>spring-snapshots</id> |
| | | <name>Spring Snapshots</name> |
| | | <url>https://repo.spring.io/snapshot</url> |
| | | <snapshots> |
| | | <enabled>true</enabled> |
| | | </snapshots> |
| | | </repository> |
| | | <repository> |
| | | <id>spring-milestones</id> |
| | | <name>Spring Milestones</name> |
| | | <url>https://repo.spring.io/milestone</url> |
| | | </repository> |
| | | </repositories> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.panzhihua.applets_backstage; |
| | | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.cloud.client.SpringCloudApplication; |
| | | import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; |
| | | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; |
| | | import org.springframework.cloud.openfeign.EnableFeignClients; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | @EnableSwagger2 |
| | | @SpringCloudApplication |
| | | @EnableCircuitBreaker |
| | | @EnableEurekaClient |
| | | @EnableFeignClients(basePackages = {"com.panzhihua.common.service"}) |
| | | public class AppletsBackstageApplication { |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(AppletsBackstageApplication.class, args); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.applets_backstage.api; |
| | | |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.ComActVO; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.validated.AddGroup; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区管理 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-15 09:54 |
| | | **/ |
| | | @Api(tags = {"社区管理"}) |
| | | @RestController |
| | | @RequestMapping("/communitymanager/") |
| | | public class CommunityApi { |
| | | @Resource |
| | | private CommunityService communityService; |
| | | |
| | | @ApiOperation("新增社区") |
| | | @PostMapping("community") |
| | | public R addCommunity(@RequestBody @Validated(AddGroup.class) ComActVO comActVO){ |
| | | return communityService.addCommunity(comActVO); |
| | | } |
| | | |
| | | @ApiOperation("编辑社区") |
| | | @PutMapping("community") |
| | | public R putCommunity(@RequestBody ComActVO comActVO){ |
| | | Long communityId = comActVO.getCommunityId(); |
| | | if (null==communityId||0==communityId) { |
| | | return R.fail("社区主键不能为空"); |
| | | } |
| | | return communityService.putCommunity(comActVO); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.applets_backstage.api; |
| | | |
| | | import com.panzhihua.applets_backstage.model.vos.LoginBody; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.service.auth.TokenService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 登录、登出 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 10:52 |
| | | **/ |
| | | @Api(tags = {"运营后台登录模块"}) |
| | | @RestController("/") |
| | | public class LoginApi extends BaseController { |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | @ApiOperation(value = "登录") |
| | | @PostMapping("login") |
| | | public R login(@RequestBody LoginBody loginBody){ |
| | | String account = loginBody.getAccount(); |
| | | String password = loginBody.getPassword(); |
| | | boolean empty = ObjectUtils.isEmpty(account); |
| | | boolean empty1 = ObjectUtils.isEmpty(password); |
| | | if (empty||empty1) { |
| | | return R.fail("账户密码不能为空"); |
| | | } |
| | | return tokenService.loginAppletsBackStage(account,password); |
| | | } |
| | | |
| | | @ApiOperation(value = "登出") |
| | | @PostMapping("logout") |
| | | public R login(){ |
| | | String token = this.getToken(); |
| | | if (ObjectUtils.isEmpty(token)) { |
| | | return R.ok(); |
| | | } |
| | | return tokenService.logout(token); |
| | | } |
| | | |
| | | @ApiOperation(value = "刷新token") |
| | | @GetMapping("refreshToken") |
| | | @ApiImplicitParam(name ="refreshToken",value = "登录返回的刷新token") |
| | | public R refreshToken(@RequestParam("refreshToken")String refreshToken){ |
| | | return tokenService.refreshToken(refreshToken); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.applets_backstage.api; |
| | | |
| | | import com.panzhihua.common.constants.HttpStatus; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.exceptions.UnAuthenticationException; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.user.ChangePasswordVO; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 用户 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 13:48 |
| | | **/ |
| | | @Api(tags = {"用户模块"}) |
| | | @RestController |
| | | @RequestMapping("/user/") |
| | | public class UserApi extends BaseController { |
| | | @Resource |
| | | private UserService userService; |
| | | @ApiOperation(value = "当前登录用户信息",response = LoginUserInfoVO.class) |
| | | @GetMapping("info") |
| | | public R getUserInfo(){ |
| | | Long userId = this.getUserId(); |
| | | return userService.detailUser(userId); |
| | | } |
| | | |
| | | @ApiOperation(value = "修改密码") |
| | | @PutMapping("changepassword") |
| | | public R changePassword(@Validated @RequestBody ChangePasswordVO changePasswordVO){ |
| | | Long userId = this.getUserId(); |
| | | String newPassword = changePasswordVO.getNewPassword(); |
| | | String oldPassword=changePasswordVO.getOldPassword(); |
| | | if (newPassword.equals(oldPassword)) { |
| | | return R.fail("修改失败,新密码和原密码一致"); |
| | | } |
| | | changePasswordVO.setUserId(userId); |
| | | return userService.changePassword(changePasswordVO); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.applets_backstage.config; |
| | | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import springfox.documentation.builders.ApiInfoBuilder; |
| | | import springfox.documentation.builders.PathSelectors; |
| | | import springfox.documentation.builders.RequestHandlerSelectors; |
| | | import springfox.documentation.service.ApiInfo; |
| | | import springfox.documentation.service.Contact; |
| | | import springfox.documentation.spi.DocumentationType; |
| | | import springfox.documentation.spring.web.plugins.Docket; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: swagger3 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-19 16:08 |
| | | **/ |
| | | @Configuration |
| | | public class SwaggerConfig { |
| | | @Bean |
| | | public Docket createRestApi() { |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | .apiInfo(apiInfo()) |
| | | .select() |
| | | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) |
| | | .paths(PathSelectors.any()) |
| | | .build(); |
| | | } |
| | | |
| | | private ApiInfo apiInfo() { |
| | | return new ApiInfoBuilder() |
| | | .title("小程序后台接口文档") |
| | | .description("。") |
| | | .contact(new Contact("Ray。", "http://www.ruiyeclub.cn", "ruiyeclub@foxmail.com")) |
| | | .version("1.0") |
| | | .build(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.applets_backstage.exceptions; |
| | | |
| | | import com.panzhihua.common.constants.HttpStatus; |
| | | import com.panzhihua.common.exceptions.TokenException; |
| | | import com.panzhihua.common.exceptions.UnAuthenticationException; |
| | | import com.panzhihua.common.exceptions.UnAuthorizationException; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.validation.BindingResult; |
| | | import org.springframework.validation.FieldError; |
| | | import org.springframework.validation.ObjectError; |
| | | import org.springframework.web.bind.MethodArgumentNotValidException; |
| | | import org.springframework.web.bind.annotation.ExceptionHandler; |
| | | import org.springframework.web.bind.annotation.RestControllerAdvice; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 全局异常捕获 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-25 14:36 |
| | | **/ |
| | | @Slf4j |
| | | @RestControllerAdvice |
| | | public class GlobalExceptionCapture { |
| | | /** |
| | | * 拦截捕捉自定义异常 TokenException.class |
| | | * @param ex token 异常 |
| | | * @return R 401 |
| | | */ |
| | | @ExceptionHandler(value = TokenException.class) |
| | | public R myErrorHandlerTokenException(TokenException ex) { |
| | | return R.fail(ex.getCode(),ex.getMsg()); |
| | | } |
| | | |
| | | /** |
| | | * 拦截捕捉自定义异常 UnAuthenticationException.class |
| | | * @param ex 认证 异常 |
| | | * @return R 401 |
| | | */ |
| | | @ExceptionHandler(value = UnAuthenticationException.class) |
| | | public R myErrorHandlerUnAuthenticationException(UnAuthenticationException ex) { |
| | | return R.fail(ex.getCode(),ex.getMsg()); |
| | | } |
| | | |
| | | /** |
| | | * 拦截捕捉自定义异常 UnAuthorizationException.class |
| | | * @param ex 权限 异常 |
| | | * @return R 403 |
| | | */ |
| | | @ExceptionHandler(value = UnAuthorizationException.class) |
| | | public R myErrorHandlerUnAuthorizationException(UnAuthenticationException ex) { |
| | | return R.fail(ex.getCode(),ex.getMsg()); |
| | | } |
| | | |
| | | /** |
| | | * 校验异常 |
| | | * @param ex valid |
| | | * @return 返回json |
| | | */ |
| | | @ExceptionHandler(value = MethodArgumentNotValidException.class) |
| | | public R methodArgumentNotValidException(MethodArgumentNotValidException ex) { |
| | | BindingResult result = ex.getBindingResult(); |
| | | StringBuilder errorMessage = new StringBuilder(); |
| | | if (result.hasErrors()) { |
| | | List<ObjectError> errors = result.getAllErrors(); |
| | | errors.forEach(p ->{ |
| | | FieldError fieldError = (FieldError) p; |
| | | errorMessage.append(fieldError.getDefaultMessage()); |
| | | errorMessage.append(" "); |
| | | }); |
| | | } |
| | | return R.fail(HttpStatus.BAD_REQUEST,errorMessage.toString()); |
| | | } |
| | | |
| | | /** |
| | | * 全局异常捕捉处理 |
| | | * @param ex 所有运行时异常 |
| | | * @return R 500 |
| | | */ |
| | | @ExceptionHandler(value = Exception.class) |
| | | public R errorHandler(Exception ex) { |
| | | log.error("捕获全局异常【{}】",ex.getMessage()); |
| | | return R.fail(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.applets_backstage.model.vos; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 登录 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 10:54 |
| | | **/ |
| | | @Data |
| | | @ApiModel(value = "小程序后台登录") |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class LoginBody { |
| | | |
| | | @ApiModelProperty(value = "登录账户") |
| | | private String account; |
| | | @ApiModelProperty(value = "登录密码") |
| | | private String password; |
| | | } |
New file |
| | |
| | | server: |
| | | port: 8197 |
| | | encoding: |
| | | force-response: true #中文乱码 |
| | | spring: |
| | | application: |
| | | name: appletsbackstage |
| | | |
| | | eureka: |
| | | client: |
| | | service-url: |
| | | defaultZone: http://localhost:8192/eureka/ |
| | | |
| | | feign: |
| | | hystrix: |
| | | enabled: true |
| | | |
| | | |
New file |
| | |
| | | HELP.md |
| | | target/ |
| | | !.mvn/wrapper/maven-wrapper.jar |
| | | !**/src/main/**/target/ |
| | | !**/src/test/**/target/ |
| | | |
| | | ### STS ### |
| | | .apt_generated |
| | | .classpath |
| | | .factorypath |
| | | .project |
| | | .settings |
| | | .springBeans |
| | | .sts4-cache |
| | | |
| | | ### IntelliJ IDEA ### |
| | | .idea |
| | | *.iws |
| | | *.iml |
| | | *.ipr |
| | | |
| | | ### NetBeans ### |
| | | /nbproject/private/ |
| | | /nbbuild/ |
| | | /dist/ |
| | | /nbdist/ |
| | | /.nb-gradle/ |
| | | build/ |
| | | !**/src/main/**/build/ |
| | | !**/src/test/**/build/ |
| | | |
| | | ### VS Code ### |
| | | .vscode/ |
New file |
| | |
| | | /* |
| | | * Copyright 2007-present the original author or authors. |
| | | * |
| | | * Licensed 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. |
| | | */ |
| | | |
| | | import java.net.*; |
| | | import java.io.*; |
| | | import java.nio.channels.*; |
| | | import java.util.Properties; |
| | | |
| | | public class MavenWrapperDownloader { |
| | | |
| | | private static final String WRAPPER_VERSION = "0.5.6"; |
| | | /** |
| | | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. |
| | | */ |
| | | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" |
| | | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; |
| | | |
| | | /** |
| | | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to |
| | | * use instead of the default one. |
| | | */ |
| | | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = |
| | | ".mvn/wrapper/maven-wrapper.properties"; |
| | | |
| | | /** |
| | | * Path where the maven-wrapper.jar will be saved to. |
| | | */ |
| | | private static final String MAVEN_WRAPPER_JAR_PATH = |
| | | ".mvn/wrapper/maven-wrapper.jar"; |
| | | |
| | | /** |
| | | * Name of the property which should be used to override the default download url for the wrapper. |
| | | */ |
| | | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; |
| | | |
| | | public static void main(String args[]) { |
| | | System.out.println("- Downloader started"); |
| | | File baseDirectory = new File(args[0]); |
| | | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); |
| | | |
| | | // If the maven-wrapper.properties exists, read it and check if it contains a custom |
| | | // wrapperUrl parameter. |
| | | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); |
| | | String url = DEFAULT_DOWNLOAD_URL; |
| | | if (mavenWrapperPropertyFile.exists()) { |
| | | FileInputStream mavenWrapperPropertyFileInputStream = null; |
| | | try { |
| | | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); |
| | | Properties mavenWrapperProperties = new Properties(); |
| | | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); |
| | | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); |
| | | } catch (IOException e) { |
| | | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); |
| | | } finally { |
| | | try { |
| | | if (mavenWrapperPropertyFileInputStream != null) { |
| | | mavenWrapperPropertyFileInputStream.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | // Ignore ... |
| | | } |
| | | } |
| | | } |
| | | System.out.println("- Downloading from: " + url); |
| | | |
| | | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); |
| | | if (!outputFile.getParentFile().exists()) { |
| | | if (!outputFile.getParentFile().mkdirs()) { |
| | | System.out.println( |
| | | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); |
| | | } |
| | | } |
| | | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); |
| | | try { |
| | | downloadFileFromURL(url, outputFile); |
| | | System.out.println("Done"); |
| | | System.exit(0); |
| | | } catch (Throwable e) { |
| | | System.out.println("- Error downloading"); |
| | | e.printStackTrace(); |
| | | System.exit(1); |
| | | } |
| | | } |
| | | |
| | | private static void downloadFileFromURL(String urlString, File destination) throws Exception { |
| | | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { |
| | | String username = System.getenv("MVNW_USERNAME"); |
| | | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); |
| | | Authenticator.setDefault(new Authenticator() { |
| | | @Override |
| | | protected PasswordAuthentication getPasswordAuthentication() { |
| | | return new PasswordAuthentication(username, password); |
| | | } |
| | | }); |
| | | } |
| | | URL website = new URL(urlString); |
| | | ReadableByteChannel rbc; |
| | | rbc = Channels.newChannel(website.openStream()); |
| | | FileOutputStream fos = new FileOutputStream(destination); |
| | | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); |
| | | fos.close(); |
| | | rbc.close(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip |
| | | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar |
New file |
| | |
| | | #!/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 "$@" |
New file |
| | |
| | | @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% |
New file |
| | |
| | | <?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>com.panzhihua</groupId> |
| | | <artifactId>zhihuishequ</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <groupId>com.panzhihua</groupId> |
| | | <artifactId>auth</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <name>auth</name> |
| | | <description>认证授权中心</description> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-config</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-openfeign</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-security</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.panzhihua</groupId> |
| | | <artifactId>common</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-redis</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.jsonwebtoken</groupId> |
| | | <artifactId>jjwt</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-api</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>ch.qos.logback</groupId> |
| | | <artifactId>logback-core</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>ch.qos.logback</groupId> |
| | | <artifactId>logback-classic</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.commons</groupId> |
| | | <artifactId>commons-pool2</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.netflix.hystrix</groupId> |
| | | <artifactId>hystrix-javanica</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-boot-starter</artifactId> |
| | | </dependency> |
| | | <!--阿里数据库连接池 --> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>druid-spring-boot-starter</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>mysql</groupId> |
| | | <artifactId>mysql-connector-java</artifactId> |
| | | <scope>runtime</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>eu.bitwalker</groupId> |
| | | <artifactId>UserAgentUtils</artifactId> |
| | | <version>1.21</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | </plugin> |
| | | |
| | | <plugin> |
| | | <groupId>com.spotify</groupId> |
| | | <artifactId>docker-maven-plugin</artifactId> |
| | | <version>1.2.0</version> |
| | | <configuration> |
| | | <imageName>registry.cn-hangzhou.aliyuncs.com/wooddeep/auth:v4</imageName> |
| | | <serverId>my-docker-registry</serverId> |
| | | <baseImage>java</baseImage> |
| | | <entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint> |
| | | <resources> |
| | | <resource> |
| | | <targetPath>/</targetPath> |
| | | <directory>${project.build.directory}</directory> |
| | | <include>${project.build.finalName}.jar</include> |
| | | </resource> |
| | | </resources> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | <repositories> |
| | | <repository> |
| | | <id>spring-snapshots</id> |
| | | <name>Spring Snapshots</name> |
| | | <url>https://repo.spring.io/snapshot</url> |
| | | <snapshots> |
| | | <enabled>true</enabled> |
| | | </snapshots> |
| | | </repository> |
| | | <repository> |
| | | <id>spring-milestones</id> |
| | | <name>Spring Milestones</name> |
| | | <url>https://repo.spring.io/milestone</url> |
| | | </repository> |
| | | </repositories> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.panzhihua.auth; |
| | | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.cloud.client.SpringCloudApplication; |
| | | import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; |
| | | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; |
| | | import org.springframework.cloud.openfeign.EnableFeignClients; |
| | | |
| | | @SpringCloudApplication |
| | | @EnableFeignClients(basePackages = {"com.panzhihua.common.service"}) |
| | | @EnableCircuitBreaker |
| | | @EnableEurekaClient |
| | | public class AuthApplication { |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(AuthApplication.class, args); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.api; |
| | | |
| | | import com.panzhihua.auth.service.LoginService; |
| | | import com.panzhihua.common.exceptions.TokenException; |
| | | import com.panzhihua.common.exceptions.UnAuthenticationException; |
| | | import com.panzhihua.common.model.vos.LoginReturnVO; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.utlis.JWTTokenUtil; |
| | | import io.jsonwebtoken.Claims; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 登录\登出 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-19 16:56 |
| | | **/ |
| | | @RestController |
| | | @RequestMapping("/") |
| | | public class LoginApi { |
| | | @Resource |
| | | private LoginService loginService; |
| | | |
| | | /** |
| | | * 小程序登录 |
| | | * |
| | | * @param openId 微信标识 |
| | | * @return jwt |
| | | */ |
| | | @PostMapping("/loginApplets") |
| | | public R loginApplets(@RequestParam("openId") String openId) { |
| | | LoginReturnVO loginReturnVO = loginService.loginApplets(openId); |
| | | return R.ok(loginReturnVO); |
| | | } |
| | | |
| | | /** |
| | | * 用户登出 |
| | | * |
| | | * @param token 登录用户token |
| | | * @return 登出结果 |
| | | */ |
| | | @PostMapping("/logout") |
| | | public R logout(@RequestParam("token") String token) { |
| | | loginService.logoutApplets(token); |
| | | return R.ok(); |
| | | } |
| | | /** |
| | | * 运营后台登录 |
| | | * @param account 账户 |
| | | * @param password 密码 |
| | | * @return 登录结果 |
| | | */ |
| | | @PostMapping("/loginAppletsBackStage") |
| | | public R loginAppletsBackStage(@RequestParam("account") String account, @RequestParam("password")String password){ |
| | | LoginReturnVO loginReturnVO =loginService.loginAppletsBackStage(account,password); |
| | | return R.ok(loginReturnVO); |
| | | } |
| | | /** |
| | | * 社区后台登录 |
| | | * @param account 账户 |
| | | * @param password 密码 |
| | | * @return 登录结果 |
| | | */ |
| | | @PostMapping("/loginCommunityBackage") |
| | | public R loginCommunityBackage(@RequestParam("account") String account, @RequestParam("password")String password){ |
| | | LoginReturnVO loginReturnVO =loginService.loginCommunityBackage(account,password); |
| | | return R.ok(loginReturnVO); |
| | | } |
| | | /** |
| | | * 认证中心刷新token |
| | | * @param refreshToken 用户端保存的刷新token |
| | | * @return 新的token 和刷新token |
| | | */ |
| | | @PostMapping("/refreshToken") |
| | | public R refreshToken(@RequestParam("refreshToken")String refreshToken){ |
| | | Boolean expired = JWTTokenUtil.isTokenExpired(refreshToken); |
| | | if (expired) { |
| | | throw new TokenException("刷新token已过期"); |
| | | } |
| | | Claims claims = JWTTokenUtil.getClaimsFromToken(refreshToken); |
| | | boolean empty = ObjectUtils.isEmpty(claims); |
| | | if (empty) { |
| | | throw new TokenException("刷新token校验失败"); |
| | | } |
| | | String subject = claims.getSubject(); |
| | | Integer type = (Integer)claims.get("type"); |
| | | boolean empty1 = ObjectUtils.isEmpty(subject); |
| | | boolean empty2 = ObjectUtils.isEmpty(type); |
| | | if (empty1||empty2) { |
| | | throw new TokenException("刷新token校验失败"); |
| | | } |
| | | LoginUserInfoVO loginUserInfoVO=new LoginUserInfoVO(); |
| | | loginUserInfoVO.setUserId(Long.valueOf(subject)); |
| | | loginUserInfoVO.setType(type); |
| | | String token = JWTTokenUtil.generateToken(loginUserInfoVO); |
| | | String refeshToken = JWTTokenUtil.generateRefeshToken(loginUserInfoVO); |
| | | LoginReturnVO loginReturnVO=new LoginReturnVO(); |
| | | loginReturnVO.setToken(token); |
| | | loginReturnVO.setRefreshToken(refeshToken); |
| | | return R.ok(loginReturnVO); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.config; |
| | | |
| | | import lombok.Data; |
| | | import org.springframework.boot.context.properties.ConfigurationProperties; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * 读取项目相关配置 |
| | | * |
| | | * @author huanghongfa |
| | | */ |
| | | @Data |
| | | @Component |
| | | @ConfigurationProperties(prefix = "auth") |
| | | public class AuthConfig |
| | | { |
| | | /** 项目名称 */ |
| | | public String name; |
| | | /** 版本 */ |
| | | public String version; |
| | | |
| | | /** 上传路径 */ |
| | | public static String profile; |
| | | /** 获取地址开关 */ |
| | | public static boolean addressEnabled; |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.config; |
| | | |
| | | |
| | | import com.panzhihua.common.constants.Constants; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.cors.CorsConfiguration; |
| | | import org.springframework.web.cors.UrlBasedCorsConfigurationSource; |
| | | import org.springframework.web.filter.CorsFilter; |
| | | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; |
| | | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
| | | |
| | | /** |
| | | * 通用配置 |
| | | * |
| | | * @author huanghongfa |
| | | */ |
| | | @Configuration |
| | | public class ResourcesConfig implements WebMvcConfigurer |
| | | { |
| | | |
| | | @Override |
| | | public void addResourceHandlers(ResourceHandlerRegistry registry) |
| | | { |
| | | /** 本地文件上传路径 */ |
| | | registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + AuthConfig.profile + "/"); |
| | | |
| | | /** swagger配置 */ |
| | | registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/"); |
| | | registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 跨域配置 |
| | | */ |
| | | @Bean |
| | | public CorsFilter corsFilter() |
| | | { |
| | | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); |
| | | CorsConfiguration config = new CorsConfiguration(); |
| | | config.setAllowCredentials(true); |
| | | // 设置访问源地址 |
| | | config.addAllowedOrigin("*"); |
| | | // 设置访问源请求头 |
| | | config.addAllowedHeader("*"); |
| | | // 设置访问源请求方法 |
| | | config.addAllowedMethod("*"); |
| | | // 对接口配置跨域设置 |
| | | source.registerCorsConfiguration("/**", config); |
| | | return new CorsFilter(source); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.config; |
| | | |
| | | |
| | | import com.panzhihua.auth.handel.UserAuthenticationProvider; |
| | | import com.panzhihua.auth.handel.UserLoginFailureHandler; |
| | | import com.panzhihua.auth.handel.UserLoginSuccessHandler; |
| | | import com.panzhihua.auth.handel.UserLogoutSuccessHandler; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.security.authentication.AuthenticationManager; |
| | | import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; |
| | | import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
| | | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; |
| | | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; |
| | | import org.springframework.security.config.http.SessionCreationPolicy; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * SpringSecurity配置类 |
| | | * @Author youcong |
| | | */ |
| | | @EnableWebSecurity |
| | | public class SecurityConfig extends WebSecurityConfigurerAdapter { |
| | | /** |
| | | * 自定义登录逻辑验证器 |
| | | */ |
| | | @Resource |
| | | private UserAuthenticationProvider userAuthenticationProvider; |
| | | |
| | | /** |
| | | * 加密方式 |
| | | * @Author youcong |
| | | */ |
| | | @Bean |
| | | public BCryptPasswordEncoder bCryptPasswordEncoder(){ |
| | | return new BCryptPasswordEncoder(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 配置登录验证逻辑 |
| | | */ |
| | | @Override |
| | | protected void configure(AuthenticationManagerBuilder auth){ |
| | | //这里可启用我们自己的登陆验证逻辑 |
| | | auth.authenticationProvider(userAuthenticationProvider); |
| | | } |
| | | |
| | | /** |
| | | * 解决 无法直接注入 AuthenticationManager |
| | | * |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @Bean |
| | | @Override |
| | | public AuthenticationManager authenticationManagerBean() throws Exception |
| | | { |
| | | return super.authenticationManagerBean(); |
| | | } |
| | | /** |
| | | * 配置security的控制逻辑 |
| | | * @Author youcong |
| | | * @Param http 请求 |
| | | */ |
| | | @Override |
| | | protected void configure(HttpSecurity http) throws Exception { |
| | | |
| | | http.authorizeRequests() |
| | | .anyRequest().permitAll() |
| | | .and() |
| | | // 配置登录成功自定义处理类 |
| | | .formLogin() |
| | | .successHandler(new UserLoginSuccessHandler()) |
| | | // 配置登录失败自定义处理类 |
| | | .failureHandler(new UserLoginFailureHandler()) |
| | | .and() |
| | | // 配置登出地址 |
| | | .logout() |
| | | .logoutUrl("/login/userLogout") |
| | | // 配置用户登出自定义处理类 |
| | | .logoutSuccessHandler(new UserLogoutSuccessHandler()) |
| | | .and() |
| | | // 开启跨域 |
| | | .cors() |
| | | .and() |
| | | // 取消跨站请求伪造防护 |
| | | .csrf().disable(); |
| | | // 基于Token不需要session |
| | | http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); |
| | | // 禁用缓存 |
| | | http.headers().cacheControl(); |
| | | |
| | | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | BCryptPasswordEncoder bCryptPasswordEncoder=new BCryptPasswordEncoder(); |
| | | String encode = bCryptPasswordEncoder.encode("123456"); |
| | | System.out.println(encode); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.exceptions; |
| | | |
| | | import com.panzhihua.common.exceptions.TokenException; |
| | | import com.panzhihua.common.exceptions.UnAuthenticationException; |
| | | import com.panzhihua.common.exceptions.UnAuthorizationException; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import org.springframework.security.core.AuthenticationException; |
| | | import org.springframework.security.core.userdetails.UsernameNotFoundException; |
| | | import org.springframework.web.bind.annotation.ExceptionHandler; |
| | | import org.springframework.web.bind.annotation.RestControllerAdvice; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 全局异常捕获 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-25 14:36 |
| | | **/ |
| | | @RestControllerAdvice |
| | | public class GlobalExceptionCapture { |
| | | /** |
| | | * 拦截捕捉自定义异常 TokenException.class |
| | | * @param ex token 异常 |
| | | * @return R 401 |
| | | */ |
| | | @ExceptionHandler(value = TokenException.class) |
| | | public R myErrorHandlerTokenException(TokenException ex) { |
| | | return R.fail(ex.getCode(),ex.getMsg()); |
| | | } |
| | | |
| | | /** |
| | | * 拦截捕捉自定义异常 UnAuthenticationException.class |
| | | * @param ex 认证 异常 |
| | | * @return R 401 |
| | | */ |
| | | @ExceptionHandler(value = UnAuthenticationException.class) |
| | | public R myErrorHandlerUnAuthenticationException(UnAuthenticationException ex) { |
| | | return R.fail(ex.getCode(),ex.getMsg()); |
| | | } |
| | | |
| | | /** |
| | | * 拦截捕捉自定义异常 UnAuthorizationException.class |
| | | * @param ex 权限 异常 |
| | | * @return R 403 |
| | | */ |
| | | @ExceptionHandler(value = UnAuthorizationException.class) |
| | | public R myErrorHandlerUnAuthorizationException(UnAuthenticationException ex) { |
| | | return R.fail(ex.getCode(),ex.getMsg()); |
| | | } |
| | | /** |
| | | * securtity认证异常 AuthenticationException |
| | | * @param ex 权限 异常 |
| | | * @return R 500 |
| | | */ |
| | | @ExceptionHandler(value = AuthenticationException.class) |
| | | public R myErrorHandlerUnAuthorizationException(AuthenticationException ex) { |
| | | return R.fail(ex.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * 全局异常捕捉处理 |
| | | * @param ex 所有运行时异常 |
| | | * @return R 500 |
| | | */ |
| | | @ExceptionHandler(value = Exception.class) |
| | | public R errorHandler(Exception ex) { |
| | | return R.fail(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.handel; |
| | | |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import org.springframework.security.authentication.AuthenticationProvider; |
| | | import org.springframework.security.authentication.BadCredentialsException; |
| | | import org.springframework.security.authentication.LockedException; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.AuthenticationException; |
| | | import org.springframework.security.core.GrantedAuthority; |
| | | import org.springframework.security.core.authority.SimpleGrantedAuthority; |
| | | import org.springframework.security.core.userdetails.UsernameNotFoundException; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 登录认证 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 16:14 |
| | | **/ |
| | | @Component |
| | | public class UserAuthenticationProvider implements AuthenticationProvider { |
| | | @Resource |
| | | private UserService userService; |
| | | @Override |
| | | public Authentication authenticate(Authentication authentication) throws AuthenticationException { |
| | | // 获取表单输入中返回的用户名 |
| | | String userName = (String) authentication.getPrincipal(); |
| | | // 获取表单中输入的密码 |
| | | String password = (String) authentication.getCredentials(); |
| | | // 查询用户是否存在 |
| | | R<LoginUserInfoVO> r = userService.getUserInfo(userName); |
| | | if (r.getCode()!=200) { |
| | | throw new UsernameNotFoundException("用户名不存在"); |
| | | } |
| | | LoginUserInfoVO loginUserInfoVO = r.getData(); |
| | | List<GrantedAuthority> grantedAuthorityList=new ArrayList<>(); |
| | | Set<String> roles = loginUserInfoVO.getRoles(); |
| | | if (!ObjectUtils.isEmpty(roles)) { |
| | | roles.forEach(s -> { |
| | | grantedAuthorityList.add(new SimpleGrantedAuthority(s)); |
| | | }); |
| | | } |
| | | if (ObjectUtils.isEmpty(loginUserInfoVO.getAccount())) { |
| | | throw new UsernameNotFoundException("用户名不存在"); |
| | | } |
| | | // 我们还要判断密码是否正确,这里我们的密码使用BCryptPasswordEncoder进行加密的 |
| | | if (!new BCryptPasswordEncoder().matches(password, loginUserInfoVO.getPassword())) { |
| | | throw new BadCredentialsException("密码不正确"); |
| | | } |
| | | // 还可以加一些其他信息的判断,比如用户账号已停用等判断 |
| | | if (loginUserInfoVO.getStatus().intValue()==2) { |
| | | throw new LockedException("该用户已被禁用"); |
| | | } |
| | | return new UsernamePasswordAuthenticationToken(loginUserInfoVO, password, grantedAuthorityList); |
| | | } |
| | | |
| | | @Override |
| | | public boolean supports(Class<?> aClass) { |
| | | return true; |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.handel; |
| | | |
| | | import com.panzhihua.common.utlis.ResultUtil; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import org.springframework.security.authentication.BadCredentialsException; |
| | | import org.springframework.security.authentication.LockedException; |
| | | import org.springframework.security.core.AuthenticationException; |
| | | import org.springframework.security.core.userdetails.UsernameNotFoundException; |
| | | import org.springframework.security.web.authentication.AuthenticationFailureHandler; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 登录失败 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 16:02 |
| | | **/ |
| | | public class UserLoginFailureHandler implements AuthenticationFailureHandler { |
| | | /** |
| | | * 登录失败返回结果 |
| | | * @Author youcong |
| | | */ |
| | | @Override |
| | | public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception){ |
| | | // 这些对于操作的处理类可以根据不同异常进行不同处理 |
| | | if (exception instanceof UsernameNotFoundException){ |
| | | ResultUtil.responseJson(response, R.fail("用户名不存在")); |
| | | } |
| | | if (exception instanceof LockedException){ |
| | | ResultUtil.responseJson(response,R.fail("用户被冻结")); |
| | | } |
| | | if (exception instanceof BadCredentialsException){ |
| | | ResultUtil.responseJson(response,R.fail("密码错误")); |
| | | } |
| | | ResultUtil.responseJson(response,R.fail("登录失败")); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.handel; |
| | | |
| | | import com.panzhihua.common.utlis.JWTTokenUtil; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.utlis.ResultUtil; |
| | | import com.panzhihua.common.constants.TokenConstant; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.web.authentication.AuthenticationSuccessHandler; |
| | | |
| | | import javax.servlet.FilterChain; |
| | | import javax.servlet.ServletException; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 登录成功 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 15:23 |
| | | **/ |
| | | public class UserLoginSuccessHandler implements AuthenticationSuccessHandler { |
| | | @Override |
| | | public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, FilterChain chain, Authentication authentication) throws IOException, ServletException { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException { |
| | | // 组装JWT |
| | | LoginUserInfoVO loginUserInfoVO = (LoginUserInfoVO) authentication.getPrincipal(); |
| | | String token = JWTTokenUtil.generateToken(loginUserInfoVO); |
| | | token = TokenConstant.TOKEN_PRE + token; |
| | | // 封装返回参数 |
| | | R<String> ok = R.ok(token); |
| | | ResultUtil.responseJson(httpServletResponse,ok); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.handel; |
| | | |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.utlis.ResultUtil; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 登出成功处理 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 16:08 |
| | | **/ |
| | | public class UserLogoutSuccessHandler implements LogoutSuccessHandler { |
| | | /** |
| | | * 用户登出返回结果 |
| | | * 这里应该让前端清除掉Token |
| | | * @Author youcong |
| | | */ |
| | | @Override |
| | | public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication){ |
| | | SecurityContextHolder.clearContext(); |
| | | ResultUtil.responseJson(response, R.ok()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.manager; |
| | | |
| | | import com.panzhihua.auth.model.dos.SysOperLogDO; |
| | | import com.panzhihua.common.constants.Constants; |
| | | import com.panzhihua.auth.model.dos.SysLogininforDO; |
| | | import com.panzhihua.common.utlis.AddressUtils; |
| | | import com.panzhihua.common.utlis.IpUtils; |
| | | import com.panzhihua.common.utlis.LogUtils; |
| | | import com.panzhihua.common.utlis.ServletUtils; |
| | | import eu.bitwalker.useragentutils.UserAgent; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.TimerTask; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 异步工厂 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-20 15:28 |
| | | **/ |
| | | @Slf4j |
| | | public class AsyncFactoryNew { |
| | | |
| | | /** |
| | | * 记录登录信息 |
| | | * |
| | | * @param username 用户名 |
| | | * @param status 状态 |
| | | * @param message 消息 |
| | | * @param args 列表 |
| | | * @return 任务task |
| | | */ |
| | | public static TimerTask recordLogininfor(final String username, final String status, final String message, |
| | | final Object... args) |
| | | { |
| | | final UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent")); |
| | | final String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); |
| | | return new TimerTask() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | String address = AddressUtils.getRealAddressByIP(ip); |
| | | StringBuilder s = new StringBuilder(); |
| | | s.append(LogUtils.getBlock(ip)); |
| | | s.append(address); |
| | | s.append(LogUtils.getBlock(username)); |
| | | s.append(LogUtils.getBlock(status)); |
| | | s.append(LogUtils.getBlock(message)); |
| | | // 打印信息到日志 |
| | | log.info(s.toString(), args); |
| | | // 获取客户端操作系统 |
| | | String os = userAgent.getOperatingSystem().getName(); |
| | | // 获取客户端浏览器 |
| | | String browser = userAgent.getBrowser().getName(); |
| | | // 封装对象 |
| | | SysLogininforDO logininfor = new SysLogininforDO(); |
| | | logininfor.setUserName(username); |
| | | logininfor.setIpaddr(ip); |
| | | logininfor.setLoginLocation(address); |
| | | logininfor.setBrowser(browser); |
| | | logininfor.setOs(os); |
| | | logininfor.setMsg(message); |
| | | // 日志状态 |
| | | if (Constants.LOGIN_SUCCESS.equals(status) || Constants.LOGOUT.equals(status)) |
| | | { |
| | | logininfor.setStatus(Constants.SUCCESS+""); |
| | | } |
| | | else if (Constants.LOGIN_FAIL.equals(status)) |
| | | { |
| | | logininfor.setStatus(Constants.FAIL+""); |
| | | } |
| | | // 插入数据 |
| | | // SpringUtils.getBean(ISysLogininforService.class).insertLogininfor(logininfor); |
| | | } |
| | | }; |
| | | } |
| | | |
| | | /** |
| | | * 操作日志记录 |
| | | * |
| | | * @param operLog 操作日志信息 |
| | | * @return 任务task |
| | | */ |
| | | public static TimerTask recordOper(final SysOperLogDO operLog) |
| | | { |
| | | return new TimerTask() |
| | | { |
| | | @Override |
| | | public void run() |
| | | { |
| | | // 远程查询操作地点 |
| | | operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp())); |
| | | // SpringUtils.getBean(ISysOperLogService.class).insertOperlog(operLog); |
| | | } |
| | | }; |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.manager; |
| | | |
| | | import com.panzhihua.common.utlis.SpringUtils; |
| | | import com.panzhihua.common.utlis.Threads; |
| | | |
| | | import java.util.TimerTask; |
| | | import java.util.concurrent.ScheduledExecutorService; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 异步任务 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-20 15:30 |
| | | **/ |
| | | public class AsyncManagerNew { |
| | | |
| | | /** |
| | | * 操作延迟10毫秒 |
| | | */ |
| | | private final int OPERATE_DELAY_TIME = 10; |
| | | |
| | | /** |
| | | * 异步操作任务调度线程池 |
| | | */ |
| | | private ScheduledExecutorService executor = SpringUtils.getBean("scheduledExecutorService"); |
| | | |
| | | /** |
| | | * 单例模式 |
| | | */ |
| | | private AsyncManagerNew(){} |
| | | |
| | | private static AsyncManagerNew me = new AsyncManagerNew(); |
| | | |
| | | public static AsyncManagerNew me() |
| | | { |
| | | return me; |
| | | } |
| | | |
| | | /** |
| | | * 执行任务 |
| | | * |
| | | * @param task 任务 |
| | | */ |
| | | public void execute(TimerTask task) |
| | | { |
| | | executor.schedule(task, OPERATE_DELAY_TIME, TimeUnit.MILLISECONDS); |
| | | } |
| | | |
| | | /** |
| | | * 停止任务线程池 |
| | | */ |
| | | public void shutdown() |
| | | { |
| | | Threads.shutdownAndAwaitTermination(executor); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.manager; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.PreDestroy; |
| | | |
| | | /** |
| | | * 确保应用退出时能关闭后台线程 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class ShutdownManager |
| | | { |
| | | private static final Logger logger = LoggerFactory.getLogger("sys-user"); |
| | | |
| | | @PreDestroy |
| | | public void destroy() |
| | | { |
| | | shutdownAsyncManager(); |
| | | } |
| | | |
| | | /** |
| | | * 停止异步执行任务 |
| | | */ |
| | | private void shutdownAsyncManager() |
| | | { |
| | | try |
| | | { |
| | | logger.info("====关闭后台任务任务线程池===="); |
| | | AsyncManagerNew.me().shutdown(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | logger.error(e.getMessage(), e); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.model.dos; |
| | | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 系统访问记录表 sys_logininfor |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Data |
| | | public class SysLogininforDO |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** ID */ |
| | | private Long infoId; |
| | | |
| | | /** 用户账号 */ |
| | | private String userName; |
| | | |
| | | /** 登录状态 0成功 1失败 */ |
| | | private String status; |
| | | |
| | | /** 登录IP地址 */ |
| | | private String ipaddr; |
| | | |
| | | /** 登录地点 */ |
| | | private String loginLocation; |
| | | |
| | | /** 浏览器类型 */ |
| | | private String browser; |
| | | |
| | | /** 操作系统 */ |
| | | private String os; |
| | | |
| | | /** 提示消息 */ |
| | | private String msg; |
| | | |
| | | /** 访问时间 */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date loginTime; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.model.dos; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 操作日志记录表 oper_log |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Data |
| | | public class SysOperLogDO |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 日志主键 */ |
| | | private Long operId; |
| | | |
| | | /** 操作模块 */ |
| | | private String title; |
| | | |
| | | /** 业务类型(0其它 1新增 2修改 3删除) */ |
| | | private Integer businessType; |
| | | |
| | | /** 业务类型数组 */ |
| | | private Integer[] businessTypes; |
| | | |
| | | /** 请求方法 */ |
| | | private String method; |
| | | |
| | | /** 请求方式 */ |
| | | private String requestMethod; |
| | | |
| | | /** 操作类别(0其它 1后台用户 2手机端用户) */ |
| | | private Integer operatorType; |
| | | |
| | | /** 操作人员 */ |
| | | private String operName; |
| | | |
| | | /** 部门名称 */ |
| | | private String deptName; |
| | | |
| | | /** 请求url */ |
| | | private String operUrl; |
| | | |
| | | /** 操作地址 */ |
| | | private String operIp; |
| | | |
| | | /** 操作地点 */ |
| | | private String operLocation; |
| | | |
| | | /** 请求参数 */ |
| | | private String operParam; |
| | | |
| | | /** 返回参数 */ |
| | | private String jsonResult; |
| | | |
| | | /** 操作状态(0正常 1异常) */ |
| | | private Integer status; |
| | | |
| | | /** 错误消息 */ |
| | | private String errorMsg; |
| | | |
| | | /** 操作时间 */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date operTime; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.model.vos; |
| | | |
| | | import org.springframework.security.core.GrantedAuthority; |
| | | import org.springframework.security.core.userdetails.UserDetails; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Collection; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 权限实体 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 15:26 |
| | | **/ |
| | | public class SelfUserEntity implements Serializable, UserDetails { |
| | | private static final long serialVersionUID = 1L; |
| | | /** |
| | | * 用户ID |
| | | */ |
| | | private Long userId; |
| | | /** |
| | | * 用户名 |
| | | */ |
| | | private String username; |
| | | /** |
| | | * 密码 |
| | | */ |
| | | private String password; |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private String status; |
| | | |
| | | /** |
| | | * 显示名称 |
| | | */ |
| | | private String displayName; |
| | | /** |
| | | * 用户参数 |
| | | */ |
| | | private Map<String, String> userParamMap; |
| | | /** |
| | | * 用户角色 |
| | | */ |
| | | private Collection<GrantedAuthority> authorities; |
| | | /** |
| | | * 账户是否过期 |
| | | */ |
| | | private boolean isAccountNonExpired = false; |
| | | /** |
| | | * 账户是否被锁定 |
| | | */ |
| | | private boolean isAccountNonLocked = false; |
| | | /** |
| | | * 证书是否过期 |
| | | */ |
| | | private boolean isCredentialsNonExpired = false; |
| | | /** |
| | | * 账户是否有效 |
| | | */ |
| | | private boolean isEnabled = true; |
| | | |
| | | |
| | | public static long getSerialVersionUID() { |
| | | return serialVersionUID; |
| | | } |
| | | |
| | | public Long getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Long userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | @Override |
| | | public String getUsername() { |
| | | return username; |
| | | } |
| | | |
| | | public void setUsername(String username) { |
| | | this.username = username; |
| | | } |
| | | |
| | | @Override |
| | | public String getPassword() { |
| | | return password; |
| | | } |
| | | |
| | | public void setPassword(String password) { |
| | | this.password = password; |
| | | } |
| | | |
| | | |
| | | public void setAuthorities(Collection<GrantedAuthority> authorities) { |
| | | this.authorities = authorities; |
| | | } |
| | | |
| | | |
| | | public void setEnabled(boolean enabled) { |
| | | isEnabled = enabled; |
| | | } |
| | | |
| | | public void setStatus(String status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public String getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public String getDisplayName() { |
| | | return displayName; |
| | | } |
| | | |
| | | public void setDisplayName(String displayName) { |
| | | this.displayName = displayName; |
| | | } |
| | | |
| | | public Map<String, String> getUserParamMap() { |
| | | return userParamMap; |
| | | } |
| | | |
| | | public void setUserParamMap(Map<String, String> userParamMap) { |
| | | this.userParamMap = userParamMap; |
| | | } |
| | | |
| | | @Override |
| | | public Collection<GrantedAuthority> getAuthorities() { |
| | | return authorities; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isAccountNonExpired() { |
| | | return isAccountNonExpired; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isAccountNonLocked() { |
| | | return isAccountNonLocked; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isCredentialsNonExpired() { |
| | | return isCredentialsNonExpired; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isEnabled() { |
| | | return isEnabled; |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.service; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 菜单 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-20 11:37 |
| | | **/ |
| | | public interface ISysMenuService { |
| | | Set<String> selectMenuPermsByUserId(Long userId); |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.service; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 角色 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-20 11:36 |
| | | **/ |
| | | public interface ISysRoleService { |
| | | |
| | | Set<String> selectRolePermissionByUserId(Long userId); |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.service; |
| | | |
| | | import com.panzhihua.common.model.vos.LoginReturnVO; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: token |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-19 17:06 |
| | | **/ |
| | | public interface LoginService { |
| | | |
| | | /** |
| | | * 微信小程序登录 |
| | | * |
| | | * @param openId 微信标识 |
| | | * @return jwt |
| | | */ |
| | | LoginReturnVO loginApplets(String openId); |
| | | |
| | | /** |
| | | * 小程序用户登出 |
| | | * |
| | | * @param token 登录用户token |
| | | */ |
| | | void logoutApplets(String token); |
| | | /** |
| | | * 小程序后台登录 |
| | | * @param account 账户 |
| | | * @param password 密码 |
| | | * @return 登录结果 |
| | | */ |
| | | LoginReturnVO loginAppletsBackStage(String account, String password); |
| | | /** |
| | | * 社区后台登录 |
| | | * @param account 账户 |
| | | * @param password 密码 |
| | | * @return 登录结果 |
| | | */ |
| | | LoginReturnVO loginCommunityBackage(String account, String password); |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.service.impl; |
| | | |
| | | import com.panzhihua.auth.service.ISysMenuService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: ISysMenuService |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-20 13:28 |
| | | **/ |
| | | @Service |
| | | public class ISysMenuServiceImpl implements ISysMenuService { |
| | | @Override |
| | | public Set<String> selectMenuPermsByUserId(Long userId) { |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.service.impl; |
| | | |
| | | import com.panzhihua.auth.service.ISysRoleService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: ISysRoleService |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-20 13:27 |
| | | **/ |
| | | @Service |
| | | public class ISysRoleServiceImpl implements ISysRoleService { |
| | | @Override |
| | | public Set<String> selectRolePermissionByUserId(Long userId) { |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.auth.service.impl; |
| | | |
| | | import com.panzhihua.auth.service.LoginService; |
| | | import com.panzhihua.common.constants.TokenConstant; |
| | | import com.panzhihua.common.model.vos.LoginReturnVO; |
| | | import com.panzhihua.common.utlis.JWTTokenUtil; |
| | | import com.panzhihua.common.constants.UserConstants; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | | import org.springframework.data.redis.core.ValueOperations; |
| | | import org.springframework.security.authentication.AuthenticationManager; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | import org.springframework.security.core.Authentication; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: token |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-19 17:07 |
| | | **/ |
| | | @Service |
| | | public class LoginServiceImpl implements LoginService { |
| | | @Resource |
| | | private AuthenticationManager authenticationManager; |
| | | @Autowired |
| | | private StringRedisTemplate redisTemplate; |
| | | |
| | | /** |
| | | * 微信小程序登录 |
| | | * |
| | | * @param openId 微信标识 |
| | | * @return jwt |
| | | */ |
| | | @Override |
| | | public LoginReturnVO loginApplets(String openId) { |
| | | Authentication authentication = null; |
| | | authentication = authenticationManager |
| | | .authenticate(new UsernamePasswordAuthenticationToken(openId+"_1", UserConstants.PASSWORD)); |
| | | LoginUserInfoVO loginUser = (LoginUserInfoVO) authentication.getPrincipal(); |
| | | String token = JWTTokenUtil.generateToken(loginUser); |
| | | String refeshToken = JWTTokenUtil.generateRefeshToken(loginUser); |
| | | LoginReturnVO loginReturnVO=new LoginReturnVO(); |
| | | loginReturnVO.setToken(token); |
| | | loginReturnVO.setRefreshToken(refeshToken); |
| | | return loginReturnVO; |
| | | } |
| | | |
| | | /** |
| | | * 小程序用户登出 |
| | | * |
| | | * @param token 登录用户token |
| | | */ |
| | | @Override |
| | | public void logoutApplets(String token) { |
| | | ValueOperations<String, String> valueOperations = redisTemplate.opsForValue(); |
| | | token= token.replaceAll(TokenConstant.TOKEN_PRE,""); |
| | | valueOperations.set(UserConstants.LOGOUT_TOKEN+token,token, TokenConstant.EXPIRETIME, TimeUnit.MINUTES); |
| | | } |
| | | |
| | | /** |
| | | * 运营后台登录 |
| | | * |
| | | * @param account 账户 |
| | | * @param password 密码 |
| | | * @return 登录结果 |
| | | */ |
| | | @Override |
| | | public LoginReturnVO loginAppletsBackStage(String account, String password) { |
| | | Authentication authentication = null; |
| | | authentication = authenticationManager |
| | | .authenticate(new UsernamePasswordAuthenticationToken(account+"_2", password)); |
| | | LoginUserInfoVO loginUser = (LoginUserInfoVO) authentication.getPrincipal(); |
| | | String token = JWTTokenUtil.generateToken(loginUser); |
| | | String refeshToken = JWTTokenUtil.generateRefeshToken(loginUser); |
| | | LoginReturnVO loginReturnVO=new LoginReturnVO(); |
| | | loginReturnVO.setToken(token); |
| | | loginReturnVO.setRefreshToken(refeshToken); |
| | | return loginReturnVO; |
| | | } |
| | | |
| | | /** |
| | | * 社区后台登录 |
| | | * |
| | | * @param account 账户 |
| | | * @param password 密码 |
| | | * @return 登录结果 |
| | | */ |
| | | @Override |
| | | public LoginReturnVO loginCommunityBackage(String account, String password) { |
| | | Authentication authentication = null; |
| | | authentication = authenticationManager |
| | | .authenticate(new UsernamePasswordAuthenticationToken(account+"_3", password)); |
| | | LoginUserInfoVO loginUser = (LoginUserInfoVO) authentication.getPrincipal(); |
| | | String token = JWTTokenUtil.generateToken(loginUser); |
| | | String refeshToken = JWTTokenUtil.generateRefeshToken(loginUser); |
| | | LoginReturnVO loginReturnVO=new LoginReturnVO(); |
| | | loginReturnVO.setToken(token); |
| | | loginReturnVO.setRefreshToken(refeshToken); |
| | | return loginReturnVO; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | server: |
| | | port: 8191 |
| | | spring: |
| | | application: |
| | | name: auth |
| | | datasource: |
| | | type: com.alibaba.druid.pool.DruidDataSource |
| | | driverClassName: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://localhost:3306/smart_life?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 |
| | | username: root |
| | | password: 123456 |
| | | druid: |
| | | # 初始连接数 |
| | | initialSize: 5 |
| | | # 最小连接池数量 |
| | | minIdle: 10 |
| | | # 最大连接池数量 |
| | | maxActive: 20 |
| | | # 配置获取连接等待超时的时间 |
| | | maxWait: 60000 |
| | | # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 |
| | | timeBetweenEvictionRunsMillis: 60000 |
| | | # 配置一个连接在池中最小生存的时间,单位是毫秒 |
| | | minEvictableIdleTimeMillis: 300000 |
| | | # 配置一个连接在池中最大生存的时间,单位是毫秒 |
| | | maxEvictableIdleTimeMillis: 900000 |
| | | # 配置检测连接是否有效 |
| | | validationQuery: SELECT 1 FROM DUAL |
| | | testWhileIdle: true |
| | | testOnBorrow: false |
| | | testOnReturn: false |
| | | webStatFilter: |
| | | enabled: true |
| | | statViewServlet: |
| | | enabled: true |
| | | # 设置白名单,不填则允许所有访问 |
| | | allow: |
| | | url-pattern: /monitor/druid/* |
| | | filter: |
| | | stat: |
| | | enabled: true |
| | | # 慢SQL记录 |
| | | log-slow-sql: false |
| | | slow-sql-millis: 1000 |
| | | merge-sql: true |
| | | wall: |
| | | config: |
| | | multi-statement-allow: true |
| | | # redis 配置 |
| | | redis: |
| | | # 地址 |
| | | host: localhost |
| | | # 端口,默认为6379 |
| | | port: 6379 |
| | | # 密码 |
| | | password: |
| | | # 连接超时时间 |
| | | timeout: 10s |
| | | lettuce: |
| | | pool: |
| | | # 连接池中的最小空闲连接 |
| | | min-idle: 0 |
| | | # 连接池中的最大空闲连接 |
| | | max-idle: 8 |
| | | # 连接池的最大数据库连接数 |
| | | max-active: 8 |
| | | # #连接池最大阻塞等待时间(使用负值表示没有限制) |
| | | max-wait: -1ms |
| | | |
| | | # token配置 |
| | | token: |
| | | # 令牌自定义标识 |
| | | header: Authorization |
| | | # 令牌密钥 |
| | | secret: abcdefghijklmnopqrstuvwxyz |
| | | # 令牌有效期(默认30分钟) |
| | | expireTime: 30 |
| | | |
| | | auth: |
| | | # 名称 |
| | | name: zhihuishequ |
| | | # 版本 |
| | | version: 3.2.1 |
| | | # 版权年份 |
| | | copyrightYear: 2020 |
| | | # 实例演示开关 |
| | | demoEnabled: true |
| | | # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) |
| | | profile: D:/ruoyi/uploadPath |
| | | # 获取ip地址开关 |
| | | addressEnabled: false |
| | | # 验证码类型 math 数组计算 char 字符验证 |
| | | captchaType: math |
| | | |
| | | eureka: |
| | | client: |
| | | service-url: |
| | | defaultZone: http://localhost:8192/eureka |
| | | instance: |
| | | prefer‐ip‐address: true #可以跨域访问 |
| | | |
| | | |
| | | feign: |
| | | hystrix: |
| | | enabled: true |
| | | |
| | | mybatis-plus: |
| | | #SIMPLE:该执行器类型不做特殊的事情,为每个语句的执行创建一个新的预处理语句,REUSE:该执行器类型会复用预处理语句,BATCH:该执行器类型会批量执行所有的更新语句 |
| | | default-executor-type: REUSE |
| | | configuration: |
| | | # 是否开启自动驼峰命名规则(camel case)映射,即从经典数据库列名 A_COLUMN(下划线命名) 到经典 Java 属性名 aColumn(驼峰命名) 的类似映射 |
| | | map-underscore-to-camel-case: true |
| | | # 全局地开启或关闭配置文件中的所有映射器已经配置的任何缓存,默认为 true |
| | | cache-enabled: false |
| | | #如果查询结果中包含空值的列,则 MyBatis 在映射的时候,不会映射这个字段 |
| | | call-setters-on-nulls: true |
| | | # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用 |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl |
| | | global-config: |
| | | db-config: |
| | | #表名下划线命名默认true |
| | | table-underline: true |
| | | #id类型 |
| | | id-type: auto |
| | | #是否开启大写命名,默认不开启 |
| | | #capital-mode: false |
| | | #逻辑已删除值,(逻辑删除下有效) 需要注入逻辑策略LogicSqlInjector 以@Bean方式注入 |
| | | logic-not-delete-value: 0 |
| | | #逻辑未删除值,(逻辑删除下有效) |
| | | logic-delete-value: 1 |
| | | #数据库类型 |
| | | db-type: mysql |
| | | |
| | | |
| | | |
| | | |
New file |
| | |
| | | <?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <parent> |
| | | <artifactId>zhihuishequ</artifactId> |
| | | <groupId>com.panzhihua</groupId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <artifactId>common</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | <packaging>jar</packaging> |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-context</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>ch.qos.logback</groupId> |
| | | <artifactId>logback-classic</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.tomcat.embed</groupId> |
| | | <artifactId>tomcat-embed-core</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.commons</groupId> |
| | | <artifactId>commons-lang3</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>fastjson</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-web</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.fasterxml.jackson.core</groupId> |
| | | <artifactId>jackson-annotations</artifactId> |
| | | </dependency> |
| | | <!-- 获取浏览器信息 --> |
| | | <dependency> |
| | | <groupId>eu.bitwalker</groupId> |
| | | <artifactId>UserAgentUtils</artifactId> |
| | | <version>1.21</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework</groupId> |
| | | <artifactId>spring-webmvc</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger2</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.jsonwebtoken</groupId> |
| | | <artifactId>jjwt</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-redis</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-openfeign</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.commons</groupId> |
| | | <artifactId>commons-pool2</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>commons-net</groupId> |
| | | <artifactId>commons-net</artifactId> |
| | | <version>3.6</version> |
| | | </dependency> |
| | | <!-- 阿里easyexcel--> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>easyexcel</artifactId> |
| | | <version>2.2.6</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.jcraft</groupId> |
| | | <artifactId>jsch</artifactId> |
| | | <version>0.1.53</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>jakarta.validation</groupId> |
| | | <artifactId>jakarta.validation-api</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.hibernate.validator</groupId> |
| | | <artifactId>hibernate-validator</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | |
| | | </project> |
New file |
| | |
| | | package com.panzhihua.common.constants; |
| | | |
| | | /** |
| | | * 通用常量信息 |
| | | * |
| | | * @author HUANGHONGFA |
| | | */ |
| | | public class Constants |
| | | { |
| | | /** |
| | | * UTF-8 字符集 |
| | | */ |
| | | public static final String UTF8 = "UTF-8"; |
| | | |
| | | /** |
| | | * GBK 字符集 |
| | | */ |
| | | public static final String GBK = "GBK"; |
| | | |
| | | /** |
| | | * http请求 |
| | | */ |
| | | public static final String HTTP = "http://"; |
| | | |
| | | /** |
| | | * https请求 |
| | | */ |
| | | public static final String HTTPS = "https://"; |
| | | |
| | | /** |
| | | * 成功标记 |
| | | */ |
| | | public static final Integer SUCCESS = 200; |
| | | |
| | | /** |
| | | * 失败标记 |
| | | */ |
| | | public static final Integer FAIL = 500; |
| | | |
| | | /** |
| | | * 登录成功 |
| | | */ |
| | | public static final String LOGIN_SUCCESS = "Success"; |
| | | |
| | | /** |
| | | * 注销 |
| | | */ |
| | | public static final String LOGOUT = "Logout"; |
| | | |
| | | /** |
| | | * 注册 |
| | | */ |
| | | public static final String REGISTER = "Register"; |
| | | |
| | | /** |
| | | * 登录失败 |
| | | */ |
| | | public static final String LOGIN_FAIL = "Error"; |
| | | |
| | | /** |
| | | * 当前记录起始索引 |
| | | */ |
| | | public static final String PAGE_NUM = "pageNum"; |
| | | |
| | | /** |
| | | * 每页显示记录数 |
| | | */ |
| | | public static final String PAGE_SIZE = "pageSize"; |
| | | |
| | | /** |
| | | * 排序列 |
| | | */ |
| | | public static final String ORDER_BY_COLUMN = "orderByColumn"; |
| | | |
| | | /** |
| | | * 排序的方向 "desc" 或者 "asc". |
| | | */ |
| | | public static final String IS_ASC = "isAsc"; |
| | | |
| | | /** |
| | | * 验证码 redis key |
| | | */ |
| | | public static final String CAPTCHA_CODE_KEY = "captcha_codes:"; |
| | | |
| | | /** |
| | | * 验证码有效期(分钟) |
| | | */ |
| | | public static final long CAPTCHA_EXPIRATION = 2; |
| | | |
| | | /** |
| | | * 令牌有效期(分钟) |
| | | */ |
| | | public final static long TOKEN_EXPIRE = 720; |
| | | |
| | | /** |
| | | * 参数管理 cache key |
| | | */ |
| | | public static final String SYS_CONFIG_KEY = "sys_config:"; |
| | | |
| | | /** |
| | | * 字典管理 cache key |
| | | */ |
| | | public static final String SYS_DICT_KEY = "sys_dict:"; |
| | | |
| | | /** |
| | | * 资源映射路径 前缀 |
| | | */ |
| | | public static final String RESOURCE_PREFIX = "/profile"; |
| | | /** |
| | | * 令牌前缀 |
| | | */ |
| | | public static final String LOGIN_USER_KEY = "login_user_key"; |
| | | /** |
| | | * 令牌前缀 |
| | | */ |
| | | public static final String TOKEN_PREFIX = "Bearer "; |
| | | /** |
| | | * 登录用户 redis key |
| | | */ |
| | | public static final String LOGIN_TOKEN_KEY = "login_tokens:"; |
| | | /** |
| | | * 防重提交 redis key |
| | | */ |
| | | public static final String REPEAT_SUBMIT_KEY = "repeat_submit:"; |
| | | |
| | | public static final String AES_KEY="35^*M@dp$5xDB&P@"; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.constants; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: ftp |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-30 13:39 |
| | | **/ |
| | | public class FtpConstants { |
| | | /** |
| | | * ftp站点 |
| | | */ |
| | | public static final String FTPHOST="47.104.148.185"; |
| | | /** |
| | | * 端口号 |
| | | */ |
| | | public static final Integer FTPPORT=22; |
| | | /** |
| | | * ftp访问用户名 |
| | | */ |
| | | public static final String FTPUSERNAME="root"; |
| | | /** |
| | | * ftp访问密码 |
| | | */ |
| | | public static final String FTPPASSWORD="evanN7F2K5M6"; |
| | | /** |
| | | * excel模板 |
| | | */ |
| | | public static final String FTPFILEPATH_MUBAN="/mnt/data/ftp/muban/"; |
| | | /** |
| | | * 党员保存 |
| | | */ |
| | | public static final String FTPFILEPATH_IDCARD="/mnt/data/ftp/idcard/"; |
| | | /** |
| | | * http访问路径 |
| | | */ |
| | | public static final String HTTP_URL="http://image.panzhihua.nhys.cdnhxx.com/"; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.constants; |
| | | |
| | | /** |
| | | * 返回状态码 |
| | | * |
| | | * @author huanghongfa |
| | | */ |
| | | public class HttpStatus |
| | | { |
| | | /** |
| | | * 操作成功 |
| | | */ |
| | | public static final int SUCCESS = 200; |
| | | |
| | | /** |
| | | * 对象创建成功 |
| | | */ |
| | | public static final int CREATED = 201; |
| | | |
| | | /** |
| | | * 请求已经被接受 |
| | | */ |
| | | public static final int ACCEPTED = 202; |
| | | |
| | | /** |
| | | * 操作已经执行成功,但是没有返回数据 |
| | | */ |
| | | public static final int NO_CONTENT = 204; |
| | | |
| | | /** |
| | | * 资源已被移除 |
| | | */ |
| | | public static final int MOVED_PERM = 301; |
| | | |
| | | /** |
| | | * 重定向 |
| | | */ |
| | | public static final int SEE_OTHER = 303; |
| | | |
| | | /** |
| | | * 资源没有被修改 |
| | | */ |
| | | public static final int NOT_MODIFIED = 304; |
| | | |
| | | /** |
| | | * 参数列表错误(缺少,格式不匹配) |
| | | */ |
| | | public static final int BAD_REQUEST = 400; |
| | | |
| | | /** |
| | | * 未授权 |
| | | */ |
| | | public static final int UNAUTHORIZED = 401; |
| | | |
| | | /** |
| | | * 访问受限,授权过期 |
| | | */ |
| | | public static final int FORBIDDEN = 403; |
| | | |
| | | /** |
| | | * 资源,服务未找到 |
| | | */ |
| | | public static final int NOT_FOUND = 404; |
| | | |
| | | /** |
| | | * 不允许的http方法 |
| | | */ |
| | | public static final int BAD_METHOD = 405; |
| | | |
| | | /** |
| | | * 资源冲突,或者资源被锁 |
| | | */ |
| | | public static final int CONFLICT = 409; |
| | | |
| | | /** |
| | | * 不支持的数据,媒体类型 |
| | | */ |
| | | public static final int UNSUPPORTED_TYPE = 415; |
| | | |
| | | /** |
| | | * 系统内部错误 |
| | | */ |
| | | public static final int ERROR = 500; |
| | | |
| | | /** |
| | | * 接口未实现 |
| | | */ |
| | | public static final int NOT_IMPLEMENTED = 501; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.constants; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 权限 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-25 15:13 |
| | | **/ |
| | | public class SecurityConstants { |
| | | |
| | | public static final String ROLE_ALL="springsecurity:role:all";//平台所有权限存储在redis |
| | | public static final String ROLE_USER="springsecurity:role:";//某个用户的具体权限 |
| | | public static final String ROLE_APPLETS="applets";//小程序用户通用角色 |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.constants; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: token |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 14:44 |
| | | **/ |
| | | public class TokenConstant { |
| | | |
| | | public static final String TOKEN_HEADER="Authorization"; |
| | | public static final String TOKEN_LOGOUT="token_logout"; |
| | | public static final String TOKEN_PRE="Bearer "; |
| | | public static final String TOKEN_USERINFO="token_userinfo"; |
| | | /** |
| | | * 30分钟 |
| | | */ |
| | | public static final int EXPIRETIME=300; |
| | | public static final String SECRET="UTivpbn%n9O!KnnL"; |
| | | /** |
| | | * 24小时 |
| | | */ |
| | | public static final int EXPIRETIME_REFRESH=24; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.constants; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 用户 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-25 10:13 |
| | | **/ |
| | | public class UserConstants { |
| | | |
| | | public static final String PASSWORD = "y5g9w8*0TTWV4UgJ"; |
| | | public static final String USER_ID = "user_id"; |
| | | public static final String LOGOUT_TOKEN = "logout:"; |
| | | public static final String LOGIN_USER_INFO = "login_user_info:"; |
| | | public static final String PHONE_PUT="phone_put:"; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.panzhihua.common.constants.Constants; |
| | | import com.panzhihua.common.constants.TokenConstant; |
| | | import com.panzhihua.common.constants.UserConstants; |
| | | import com.panzhihua.common.exceptions.UnAuthenticationException; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.utlis.AES; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.SneakyThrows; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | import sun.security.krb5.internal.crypto.Aes256; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 基础controller |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 09:31 |
| | | **/ |
| | | public class BaseController { |
| | | /** |
| | | * 获取request对象 |
| | | */ |
| | | public HttpServletRequest getRequest() { |
| | | return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
| | | } |
| | | |
| | | /** |
| | | * 获取登录对象信息 |
| | | * @return 对象userid |
| | | */ |
| | | public Long getUserId(){ |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | Long userId = loginUserInfo.getUserId(); |
| | | return userId; |
| | | } |
| | | |
| | | /** |
| | | * 获取登录对象所在社区id |
| | | * @return 社区id |
| | | */ |
| | | public Long getCommunityId(){ |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | Long communityId = loginUserInfo.getCommunityId(); |
| | | return communityId; |
| | | } |
| | | |
| | | /** |
| | | * 获取登录对象所在小区 |
| | | * @return 小区id |
| | | */ |
| | | public Long getAreaId(){ |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | Long areaId = loginUserInfo.getAreaId(); |
| | | return areaId; |
| | | } |
| | | |
| | | /** |
| | | * 获取登录token |
| | | * @return token |
| | | */ |
| | | public String getToken(){ |
| | | HttpServletRequest request = this.getRequest(); |
| | | String header = request.getHeader(TokenConstant.TOKEN_LOGOUT); |
| | | return header; |
| | | } |
| | | |
| | | /** |
| | | * 获取登录对象所有信息 |
| | | * @return 所有信息 |
| | | */ |
| | | @SneakyThrows |
| | | public LoginUserInfoVO getLoginUserInfo(){ |
| | | HttpServletRequest request = this.getRequest(); |
| | | String userInfo = request.getHeader(TokenConstant.TOKEN_USERINFO); |
| | | boolean empty = ObjectUtils.isEmpty(userInfo); |
| | | if (empty) { |
| | | throw new UnAuthenticationException("获取登录人信息失败"); |
| | | } |
| | | byte[] bytes = AES.parseHexStr2Byte(userInfo); |
| | | byte[] decrypt = AES.decrypt(bytes, Constants.AES_KEY); |
| | | userInfo=new String(decrypt); |
| | | LoginUserInfoVO loginUserInfoVO= JSONObject.parseObject(userInfo,LoginUserInfoVO.class); |
| | | return loginUserInfoVO; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * 用户状态 |
| | | * |
| | | * @author huanghongfa |
| | | */ |
| | | @Getter |
| | | public enum UserStatus |
| | | { |
| | | OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除"); |
| | | |
| | | private final String code; |
| | | private final String info; |
| | | |
| | | UserStatus(String code, String info) |
| | | { |
| | | this.code = code; |
| | | this.info = info; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.exceptions; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 党建异常 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-30 11:01 |
| | | **/ |
| | | public class PartyBuildingMemberException extends RuntimeException{ |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private String msg="党建异常"; |
| | | private int code = 500; |
| | | |
| | | public PartyBuildingMemberException(String msg) { |
| | | super(msg); |
| | | this.msg = msg; |
| | | } |
| | | public PartyBuildingMemberException() { |
| | | super(); |
| | | |
| | | } |
| | | public PartyBuildingMemberException(String msg, Throwable e) { |
| | | super(msg, e); |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public PartyBuildingMemberException(String msg, int code) { |
| | | super(msg); |
| | | this.msg = msg; |
| | | this.code = code; |
| | | } |
| | | |
| | | public PartyBuildingMemberException(String msg, int code, Throwable e) { |
| | | super(msg, e); |
| | | this.msg = msg; |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public void setMsg(String msg) { |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.exceptions; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: token |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 15:01 |
| | | **/ |
| | | public class TokenException extends RuntimeException{ |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private String msg="token校验失败"; |
| | | private int code = 401; |
| | | |
| | | public TokenException(String msg) { |
| | | super(msg); |
| | | this.msg = msg; |
| | | } |
| | | public TokenException() { |
| | | super(); |
| | | |
| | | } |
| | | public TokenException(String msg, Throwable e) { |
| | | super(msg, e); |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public TokenException(String msg, int code) { |
| | | super(msg); |
| | | this.msg = msg; |
| | | this.code = code; |
| | | } |
| | | |
| | | public TokenException(String msg, int code, Throwable e) { |
| | | super(msg, e); |
| | | this.msg = msg; |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public void setMsg(String msg) { |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2016-2019 人人开源 All rights reserved. |
| | | * |
| | | * https://www.renren.io |
| | | * |
| | | * 版权所有,侵权必究! |
| | | */ |
| | | |
| | | package com.panzhihua.common.exceptions; |
| | | |
| | | /** |
| | | * 未认证异常 |
| | | * |
| | | * @author Mark sunlightcs@gmail.com |
| | | */ |
| | | public class UnAuthenticationException extends RuntimeException { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private String msg="用户未认证"; |
| | | private int code = 401; |
| | | |
| | | public UnAuthenticationException(String msg) { |
| | | super(msg); |
| | | this.msg = msg; |
| | | } |
| | | public UnAuthenticationException() { |
| | | super(); |
| | | |
| | | } |
| | | public UnAuthenticationException(String msg, Throwable e) { |
| | | super(msg, e); |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public UnAuthenticationException(String msg, int code) { |
| | | super(msg); |
| | | this.msg = msg; |
| | | this.code = code; |
| | | } |
| | | |
| | | public UnAuthenticationException(String msg, int code, Throwable e) { |
| | | super(msg, e); |
| | | this.msg = msg; |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public void setMsg(String msg) { |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.exceptions; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 无权限 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 14:26 |
| | | **/ |
| | | public class UnAuthorizationException extends RuntimeException{ |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private String msg="无权限"; |
| | | private int code = 403; |
| | | |
| | | public UnAuthorizationException(String msg) { |
| | | super(msg); |
| | | this.msg = msg; |
| | | } |
| | | public UnAuthorizationException() { |
| | | super(); |
| | | |
| | | } |
| | | public UnAuthorizationException(String msg, Throwable e) { |
| | | super(msg, e); |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public UnAuthorizationException(String msg, int code) { |
| | | super(msg); |
| | | this.msg = msg; |
| | | this.code = code; |
| | | } |
| | | |
| | | public UnAuthorizationException(String msg, int code, Throwable e) { |
| | | super(msg, e); |
| | | this.msg = msg; |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public void setMsg(String msg) { |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | } |
New file |
| | |
| | | /** |
| | | * Copyright (c) 2016-2019 人人开源 All rights reserved. |
| | | * |
| | | * https://www.renren.io |
| | | * |
| | | * 版权所有,侵权必究! |
| | | */ |
| | | |
| | | package com.panzhihua.common.exceptions; |
| | | |
| | | /** |
| | | * 微信异常 |
| | | * |
| | | * @author Mark sunlightcs@gmail.com |
| | | */ |
| | | public class WeiXinException extends RuntimeException { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | private String msg="微信调用失败"; |
| | | private int code = 500; |
| | | |
| | | public WeiXinException(String msg) { |
| | | super(msg); |
| | | this.msg = msg; |
| | | } |
| | | public WeiXinException() { |
| | | super(); |
| | | |
| | | } |
| | | public WeiXinException(String msg, Throwable e) { |
| | | super(msg, e); |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public WeiXinException(String msg, int code) { |
| | | super(msg); |
| | | this.msg = msg; |
| | | this.code = code; |
| | | } |
| | | |
| | | public WeiXinException(String msg, int code, Throwable e) { |
| | | super(msg, e); |
| | | this.msg = msg; |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public void setMsg(String msg) { |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(int code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 登录返回 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-27 08:55 |
| | | **/ |
| | | @Data |
| | | @ApiModel(value = "登录返回体") |
| | | public class LoginReturnVO { |
| | | @ApiModelProperty("接口请求令牌") |
| | | private String token; |
| | | @ApiModelProperty("刷新token有效期长") |
| | | private String refreshToken; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos; |
| | | |
| | | import com.panzhihua.common.model.vos.community.ComMngStructHouseVO; |
| | | import com.panzhihua.common.model.vos.user.ComMngFamilyInfoVO; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 登录用户信息 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 09:35 |
| | | **/ |
| | | @Data |
| | | @ApiModel(value = "用户信息") |
| | | public class LoginUserInfoVO { |
| | | |
| | | @ApiModelProperty("user_id") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty("微信会话密钥") |
| | | private String sessionKey; |
| | | |
| | | @ApiModelProperty("用户在开放平台的唯一标识符") |
| | | private String unionid; |
| | | |
| | | @ApiModelProperty("登录账户") |
| | | private String account; |
| | | |
| | | @ApiModelProperty("登录密码") |
| | | private String password; |
| | | |
| | | @ApiModelProperty("微信小程序唯一标识") |
| | | private String openid; |
| | | |
| | | @ApiModelProperty("手机号") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty("昵称") |
| | | private String nickName; |
| | | |
| | | @ApiModelProperty("真实名字") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("社区id") |
| | | private Long communityId; |
| | | |
| | | @ApiModelProperty("社区名字") |
| | | private String communityName; |
| | | |
| | | @ApiModelProperty("性别 1 男 2 女") |
| | | private Integer sex; |
| | | |
| | | @ApiModelProperty("生日") |
| | | private Date birthday; |
| | | |
| | | @ApiModelProperty("头像") |
| | | private String imageUrl; |
| | | |
| | | @ApiModelProperty("用户类型 1 小程序 2 运营平台 3 社区平台") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty("职业") |
| | | private String job; |
| | | |
| | | @ApiModelProperty("是否志愿者 0否 1 是") |
| | | private Integer isVolunteer; |
| | | |
| | | @ApiModelProperty("是否党员 0 否 1 是") |
| | | private Integer isPartymember; |
| | | |
| | | @ApiModelProperty("1 启用 2 禁用") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("创建时间") |
| | | private Date createAt; |
| | | |
| | | @ApiModelProperty("最后登录时间") |
| | | private Date lastLoginTime; |
| | | |
| | | @ApiModelProperty("角色集合") |
| | | private Set<String> roles; |
| | | |
| | | @ApiModelProperty("权限集合") |
| | | private Set<String> permissions; |
| | | |
| | | @ApiModelProperty("人脸采集照片url") |
| | | private String faceUrl; |
| | | |
| | | @ApiModelProperty("驳回原因") |
| | | private String rejectReson; |
| | | |
| | | @ApiModelProperty("身份证号") |
| | | private String idCard; |
| | | |
| | | @ApiModelProperty("标签 多个用,隔开") |
| | | private String tags; |
| | | |
| | | @ApiModelProperty("家庭id") |
| | | private Long familyId; |
| | | |
| | | @ApiModelProperty(value = "分页每页数量",example = "10") |
| | | private Long pageSize; |
| | | |
| | | @ApiModelProperty(value = "分页当前记录数",example = "1") |
| | | private Long pageNum; |
| | | |
| | | @ApiModelProperty("人脸采集审核状态 0 待审核 1 审核通过 2驳回") |
| | | private Integer faceState; |
| | | |
| | | @ApiModelProperty("操作类型 1通过 2驳回 3删除") |
| | | private Integer operationType; |
| | | |
| | | @ApiModelProperty("家庭成员") |
| | | private List<ComMngFamilyInfoVO> comMngFamilyInfoVOS; |
| | | |
| | | @ApiModelProperty("房屋信息") |
| | | private List<ComMngStructHouseVO> comMngStructHouseVOS; |
| | | |
| | | @ApiModelProperty("用户小区id") |
| | | private Long areaId; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 菜单按钮权限 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-25 15:20 |
| | | **/ |
| | | @Data |
| | | public class MenuVO { |
| | | /** |
| | | *菜单路径 |
| | | */ |
| | | private String url; |
| | | /** |
| | | * 对应角色标识 |
| | | */ |
| | | private String role; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos; |
| | | |
| | | |
| | | import com.panzhihua.common.constants.Constants; |
| | | import lombok.Data; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 响应信息主体 |
| | | * |
| | | * @author HUANGHONGFA |
| | | */ |
| | | @Data |
| | | public class R<T> implements Serializable |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** 成功 */ |
| | | public static final int SUCCESS = Constants.SUCCESS; |
| | | |
| | | /** 失败 */ |
| | | public static final int FAIL = Constants.FAIL; |
| | | |
| | | private int code; |
| | | |
| | | private String msg; |
| | | |
| | | private T data; |
| | | |
| | | public static <T> R<T> ok() |
| | | { |
| | | return restResult(null, SUCCESS, "success"); |
| | | } |
| | | |
| | | public static <T> R<T> ok(T data) |
| | | { |
| | | return restResult(data, SUCCESS, "success"); |
| | | } |
| | | |
| | | public static <T> R<T> ok(T data, String msg) |
| | | { |
| | | return restResult(data, SUCCESS, msg); |
| | | } |
| | | |
| | | public static <T> R<T> fail() |
| | | { |
| | | return restResult(null, FAIL, null); |
| | | } |
| | | |
| | | public static <T> R<T> fail(String msg) |
| | | { |
| | | return restResult(null, FAIL, msg); |
| | | } |
| | | |
| | | public static <T> R<T> fail(T data) |
| | | { |
| | | return restResult(data, FAIL, null); |
| | | } |
| | | |
| | | public static <T> R<T> fail(T data, String msg) |
| | | { |
| | | return restResult(data, FAIL, msg); |
| | | } |
| | | |
| | | public static <T> R<T> fail(int code, String msg) |
| | | { |
| | | return restResult(null, code, msg); |
| | | } |
| | | public static <T> R<T> fail(int code) |
| | | { |
| | | return restResult(null, code, null); |
| | | } |
| | | |
| | | private static <T> R<T> restResult(T data, int code, String msg) |
| | | { |
| | | R<T> apiResult = new R<>(); |
| | | apiResult.setCode(code); |
| | | apiResult.setData(data); |
| | | if (ObjectUtils.isEmpty(msg)) { |
| | | apiResult.setMsg("失败"); |
| | | }else{ |
| | | apiResult.setMsg(msg); |
| | | } |
| | | |
| | | return apiResult; |
| | | } |
| | | |
| | | /** |
| | | * 请求是否成功 |
| | | * @return |
| | | */ |
| | | public static boolean isOk(R r){ |
| | | return r.code==Constants.SUCCESS.intValue(); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区活动报名名单 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-08 16:48 |
| | | **/ |
| | | @Data |
| | | @ApiModel("社区活动报名名单") |
| | | public class ActivitySignVO { |
| | | |
| | | @ApiModelProperty("活动主键") |
| | | private Long activityId; |
| | | @ApiModelProperty("人员主键") |
| | | private Long id; |
| | | @ApiModelProperty("名字") |
| | | private String name; |
| | | @ApiModelProperty("身份") |
| | | private String identity; |
| | | @ApiModelProperty("手机号") |
| | | private String phone; |
| | | @ApiModelProperty("报名时间") |
| | | private String createAt; |
| | | @ApiModelProperty("人员头像") |
| | | private String imageUrl; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 批量建房 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-16 09:40 |
| | | **/ |
| | | @Data |
| | | @ApiModel("批量建房") |
| | | public class BatchhouseVO { |
| | | |
| | | @ApiModelProperty(value = "楼栋区间-开始",example = "1") |
| | | private Integer buildingBegin; |
| | | @ApiModelProperty(value = "楼栋区间-结束",example = "10") |
| | | private Integer buildingEnd; |
| | | @ApiModelProperty(value = "单元区间-结束",example = "3") |
| | | private Integer unitEnd; |
| | | @ApiModelProperty(value = "单元区间-开始",example = "1") |
| | | private Integer unitBegin; |
| | | @ApiModelProperty(value = "楼层区间-开始",example = "1") |
| | | private Integer floorBegin; |
| | | @ApiModelProperty(value = "楼层区间-结束",example = "30") |
| | | private Integer floorEnd; |
| | | @ApiModelProperty(value = "门牌号区间-结束",example = "6") |
| | | private Integer doorEnd; |
| | | @ApiModelProperty(value = "门牌号区间-开始",example = "1") |
| | | private Integer doorBegin; |
| | | @ApiModelProperty(value = "门牌号规则-楼层",example = "1") |
| | | private String ruleFloor; |
| | | @ApiModelProperty(value = "门牌号规则-连接符",example = "-") |
| | | private String ruleConnector; |
| | | @ApiModelProperty(value = "门牌号规则-门牌号",example = "001") |
| | | private String ruleDoor; |
| | | @ApiModelProperty(value = "门牌编号是否累加 0 否 1 是",example = "0") |
| | | private Integer isAccumulation; |
| | | @ApiModelProperty(value = "小区地址编码") |
| | | private String areaCode; |
| | | @ApiModelProperty(value = "添加同级-类型 2楼栋 3 单元 4楼层 5门牌号") |
| | | private Integer type; |
| | | @ApiModelProperty(value = "添加同级-上级地址编码") |
| | | private String parentCode; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 活动奖品 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 14:17 |
| | | **/ |
| | | @Data |
| | | @ApiModel("社区》活动》活动奖品") |
| | | public class ComActActPrizeVO { |
| | | |
| | | @ApiModelProperty("自增id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("所属活动id") |
| | | private Long activityId; |
| | | |
| | | @ApiModelProperty("奖品名称") |
| | | private String prizeName; |
| | | |
| | | @ApiModelProperty("奖品图片路径") |
| | | private String prizePhoto; |
| | | |
| | | @ApiModelProperty("是否报名既有 1 是 0 不是") |
| | | private Integer type; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.hibernate.validator.constraints.Length; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区活动 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 14:01 |
| | | **/ |
| | | @Data |
| | | @ApiModel("社区活动") |
| | | public class ComActActivityVO { |
| | | |
| | | @ApiModelProperty("自增id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("活动名称") |
| | | private String activityName; |
| | | |
| | | @ApiModelProperty("负责人userID") |
| | | private Long sponsorId; |
| | | |
| | | @ApiModelProperty("负责人名字") |
| | | private String sponsorName; |
| | | |
| | | @ApiModelProperty("活动地址") |
| | | private String activityAddr; |
| | | |
| | | @ApiModelProperty("活动状态 1 待发布 2 未开始 3 报名中 4 进行中 5 已结束 6 已取消") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("发布时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date publishAt; |
| | | |
| | | @ApiModelProperty("活动结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date endAt; |
| | | |
| | | @ApiModelProperty("活动开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date beginAt; |
| | | |
| | | @ApiModelProperty("报名开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date signUpBegin; |
| | | |
| | | @ApiModelProperty("报名结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date signUpEnd; |
| | | |
| | | @ApiModelProperty("志愿者人数下线") |
| | | private Integer volunteerMin; |
| | | |
| | | @ApiModelProperty("志愿者人数上限") |
| | | private Integer volunteerMax; |
| | | |
| | | @ApiModelProperty("当前志愿者数量") |
| | | private Integer volunteerNow; |
| | | |
| | | @ApiModelProperty("参与者人数下线") |
| | | private Integer participantMin; |
| | | |
| | | @ApiModelProperty("参与者人数上限") |
| | | private Integer participantMax; |
| | | |
| | | @ApiModelProperty("当前参与者数量") |
| | | private Integer participantNow; |
| | | |
| | | @ApiModelProperty("活动封面") |
| | | private String cover; |
| | | |
| | | @ApiModelProperty("是否有奖品 1 有 0 无") |
| | | private Integer hasPrize; |
| | | |
| | | @ApiModelProperty("奖品备注") |
| | | private String prizeRemark; |
| | | |
| | | @ApiModelProperty("奖励说明") |
| | | private String rewardDesc; |
| | | |
| | | @ApiModelProperty("活动内容") |
| | | private String content; |
| | | |
| | | @ApiModelProperty("活动奖品集合") |
| | | private List<ComActActPrizeVO> comActActPrizeVOList; |
| | | |
| | | @ApiModelProperty(value = "社区id",hidden = true) |
| | | private Long communityId; |
| | | |
| | | @ApiModelProperty(value = "当前页数",example="1") |
| | | private Long pageNum; |
| | | |
| | | @ApiModelProperty(value = "每页记录数",example="10") |
| | | private Long pageSize; |
| | | |
| | | @ApiModelProperty(value = "取消原因") |
| | | private String cancelReason; |
| | | |
| | | @ApiModelProperty(value = "是否已经报名 1 已报名 0 未报名") |
| | | private Integer isSign; |
| | | |
| | | @ApiModelProperty(value = "当前登录者id",hidden = true) |
| | | private Integer userId; |
| | | |
| | | @ApiModelProperty("活动参加人员集合") |
| | | private List<ActivitySignVO>activitySignVOList; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区动态 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-08 17:25 |
| | | **/ |
| | | @Data |
| | | @ApiModel("社区活动 》社区动态") |
| | | public class ComActDynVO { |
| | | |
| | | @ApiModelProperty("主键") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("标题") |
| | | private String title; |
| | | |
| | | @ApiModelProperty("阅读数") |
| | | private Integer readNum; |
| | | |
| | | @ApiModelProperty("状态 0 待发布 1 已发布") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("是否置顶 0 否 1 是") |
| | | private Integer isTopping; |
| | | |
| | | @ApiModelProperty(value = "发布时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date publishAt; |
| | | |
| | | @ApiModelProperty("创建时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createAt; |
| | | |
| | | @ApiModelProperty("修改时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date updateAt; |
| | | |
| | | @ApiModelProperty(value = "社区id",hidden = true) |
| | | private Long communityId; |
| | | |
| | | @ApiModelProperty(value = "当前页数",example = "1") |
| | | private Long pageNum; |
| | | |
| | | @ApiModelProperty(value = "每页记录数",example = "10") |
| | | private Long pageSize; |
| | | |
| | | @ApiModelProperty("发布搜索开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date publishAtBegin; |
| | | |
| | | @ApiModelProperty("发布搜索结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date publishAtEnd; |
| | | |
| | | @ApiModelProperty("动态内容富文本") |
| | | private String content; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 随手拍 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 14:19 |
| | | **/ |
| | | @Data |
| | | @ApiModel("社区活动 》随手拍") |
| | | public class ComActEasyPhotoVO { |
| | | |
| | | @ApiModelProperty("自增id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("发起人id") |
| | | private Long sponsorId; |
| | | |
| | | @ApiModelProperty("发起人名字") |
| | | private String sponsorName; |
| | | |
| | | @ApiModelProperty("发生地址") |
| | | private String happenAddr; |
| | | |
| | | @ApiModelProperty("发起人头像") |
| | | private String imageUrl; |
| | | |
| | | @ApiModelProperty("状态 1待审核 2进行中 3已驳回 4已完成") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("处理人id") |
| | | private Long handlerId; |
| | | |
| | | @ApiModelProperty("处理人名字") |
| | | private String handlerName; |
| | | |
| | | @ApiModelProperty("查询-创建开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createBegin; |
| | | |
| | | @ApiModelProperty("查询-创建结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createEnd; |
| | | |
| | | @ApiModelProperty("详情") |
| | | private String detail; |
| | | |
| | | @ApiModelProperty("图片路径列表,逗号分隔") |
| | | private String photoPathList; |
| | | |
| | | @ApiModelProperty("处理结果") |
| | | private String handleResult; |
| | | |
| | | @ApiModelProperty("处理结果,图片路径列表,逗号分隔") |
| | | private String handlePhotoList; |
| | | |
| | | @ApiModelProperty("当前页数") |
| | | private Long pageNum; |
| | | |
| | | @ApiModelProperty("每页记录数") |
| | | private Long pageSize; |
| | | |
| | | @ApiModelProperty("审核时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date examineAt; |
| | | |
| | | @ApiModelProperty("创建时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
| | | private Date createAt; |
| | | |
| | | @ApiModelProperty("社区id") |
| | | private Long communityId; |
| | | |
| | | @ApiModelProperty("点赞数量") |
| | | private Integer giveThumbsUpNum; |
| | | |
| | | @ApiModelProperty("是否匿名发布") |
| | | private Integer isHide; |
| | | |
| | | @ApiModelProperty("是否点赞 0 否 1 是") |
| | | private Integer haveGiveThumbsUp; |
| | | |
| | | @ApiModelProperty(value = "是否需要反馈 1 是 0 不是",example = "0") |
| | | private Integer isNeedFeedBack; |
| | | |
| | | @ApiModelProperty("操作类型 1审核通过 2驳回 3反馈") |
| | | private Integer type; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.models.auth.In; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 微心愿 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 14:25 |
| | | **/ |
| | | @Data |
| | | @ApiModel("社区活动 》微心愿") |
| | | public class ComActMicroWishVO { |
| | | |
| | | @ApiModelProperty("id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("发起人id") |
| | | private Long sponsorId; |
| | | |
| | | @ApiModelProperty("发起人电话号码") |
| | | private String sponsorPhone; |
| | | |
| | | @ApiModelProperty("发起人名字") |
| | | private String sponsorName; |
| | | |
| | | @ApiModelProperty("发起人头像") |
| | | private String imageUrl; |
| | | |
| | | @ApiModelProperty("微心愿名称") |
| | | private String wishName; |
| | | |
| | | @ApiModelProperty("状态 1待审核 2待分配 3进行中 4已驳回 5待确认6 已完成") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("集星数") |
| | | private Integer starNum; |
| | | |
| | | @ApiModelProperty("形式 1分配人员 2发起活动") |
| | | private Integer form; |
| | | |
| | | @ApiModelProperty("责任人id") |
| | | private Long responsibleId; |
| | | |
| | | @ApiModelProperty("责任人名字") |
| | | private String responsibleName; |
| | | |
| | | @ApiModelProperty("查询-创建开始时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createBegin; |
| | | |
| | | @ApiModelProperty("查询-创建结束时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createEnd; |
| | | |
| | | @ApiModelProperty("创建时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createAt; |
| | | |
| | | @ApiModelProperty("审核 时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date examineAt; |
| | | |
| | | @ApiModelProperty("分配 时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date distributionAt; |
| | | |
| | | @ApiModelProperty("评分") |
| | | private Integer score; |
| | | |
| | | @ApiModelProperty("详情") |
| | | private String detail; |
| | | |
| | | @ApiModelProperty("图片路径列表,逗号分隔") |
| | | private String photoPathList; |
| | | |
| | | @ApiModelProperty("当前页数") |
| | | private Long pageNum; |
| | | |
| | | @ApiModelProperty("每页记录数") |
| | | private Long pageSize; |
| | | |
| | | @ApiModelProperty(value = "社区id",hidden = true) |
| | | private Long communityId; |
| | | |
| | | @ApiModelProperty("用户评价") |
| | | private String evaluate; |
| | | |
| | | @ApiModelProperty("用户评价时间") |
| | | private Date evaluateAt; |
| | | |
| | | @ApiModelProperty("反馈时间") |
| | | private Date feedbackAt; |
| | | |
| | | @ApiModelProperty("完成情况图片列表,逗号分隔") |
| | | private String finishPhotoPathList; |
| | | |
| | | @ApiModelProperty("完成情况描述") |
| | | private String finish; |
| | | |
| | | @ApiModelProperty("驳回理由") |
| | | private String rejectReason; |
| | | |
| | | @ApiModelProperty("反馈文字") |
| | | private String feedback; |
| | | |
| | | @ApiModelProperty("反馈图片集合,逗号分隔") |
| | | private String feedbackPhotoPathList; |
| | | |
| | | @ApiModelProperty(value = "操作类型 1 审核通过 2驳回 3分配人员 4发起活动 5反馈",example = "1") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty(value = "小程序请求 1 是 0 不是",hidden = true) |
| | | private Integer isApplets; |
| | | |
| | | @ApiModelProperty(value = "是否点赞 1 是 0 不是",example = "1") |
| | | private Integer haveGiveThumbsUp; |
| | | |
| | | } |
| | | |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community; |
| | | |
| | | import com.panzhihua.common.validated.AddGroup; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-15 10:06 |
| | | **/ |
| | | @Data |
| | | @ApiModel("社区表") |
| | | public class ComActVO { |
| | | |
| | | @ApiModelProperty("community_id") |
| | | private Long communityId; |
| | | |
| | | @ApiModelProperty("社区名字") |
| | | @NotBlank(groups = {AddGroup.class},message = "社区名字不能为空") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("社区地址") |
| | | @NotBlank(groups = {AddGroup.class},message = "社区地址不能为空") |
| | | private String address; |
| | | |
| | | @ApiModelProperty("经度") |
| | | @NotBlank(groups = {AddGroup.class},message = "经度不能为空") |
| | | private String lng; |
| | | |
| | | @ApiModelProperty("维度") |
| | | @NotBlank(groups = {AddGroup.class},message = "纬度不能为空") |
| | | private String lat; |
| | | |
| | | @ApiModelProperty("创建时间") |
| | | private Date createAt; |
| | | |
| | | @ApiModelProperty("省份地址编码") |
| | | @NotBlank(groups = {AddGroup.class},message = "省份地址编码不能为空") |
| | | private String provinceCode; |
| | | |
| | | @ApiModelProperty("市级地址编码") |
| | | @NotBlank(groups = {AddGroup.class},message = "市级地址编码不能为空") |
| | | private String cityCode; |
| | | |
| | | @ApiModelProperty("区级地址编码") |
| | | @NotBlank(groups = {AddGroup.class},message = "区级地址编码不能为空") |
| | | private String areaCode; |
| | | |
| | | @ApiModelProperty("社区面积") |
| | | @Min(value =1,groups = {AddGroup.class},message = "社区面积不能为空") |
| | | private Double square; |
| | | |
| | | @ApiModelProperty("联系人") |
| | | @NotBlank(groups = {AddGroup.class},message = "联系人不能为空") |
| | | private String contacts; |
| | | |
| | | @ApiModelProperty("联系人电话") |
| | | @NotBlank(groups = {AddGroup.class},message = "联系人电话不能为空") |
| | | private String contactsPhone; |
| | | |
| | | @ApiModelProperty("超管账号") |
| | | @NotBlank(groups = {AddGroup.class},message = "超管账号不能为空") |
| | | private String account; |
| | | |
| | | @ApiModelProperty("账号密码") |
| | | @NotBlank(groups = {AddGroup.class},message = "账号密码不能为空") |
| | | private String password; |
| | | |
| | | @ApiModelProperty(value = "状态 0 启用 1 禁用",example = "0") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty("距离-单位米") |
| | | private String distance; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.omg.PortableInterceptor.INACTIVE; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 小区 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-14 17:01 |
| | | **/ |
| | | @Data |
| | | @ApiModel("小区") |
| | | public class ComMngStructAreaVO { |
| | | |
| | | @ApiModelProperty("自增id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("社区id") |
| | | private String communityId; |
| | | |
| | | @ApiModelProperty("小区名称") |
| | | private String areaName; |
| | | |
| | | @ApiModelProperty("地址详情") |
| | | private String addressDetail; |
| | | |
| | | @ApiModelProperty("创建时间") |
| | | private Date createAt; |
| | | |
| | | @ApiModelProperty("分页页数") |
| | | private Long pageNum; |
| | | |
| | | @ApiModelProperty("每页记录数") |
| | | private Long pageSize; |
| | | |
| | | @ApiModelProperty("地址编码") |
| | | private String areaCode; |
| | | |
| | | @ApiModelProperty("楼层规则 1 01 001") |
| | | private String roleFloor; |
| | | |
| | | @ApiModelProperty("连接符 空格 或者 -") |
| | | private String roleConnector; |
| | | |
| | | @ApiModelProperty("门牌号规则 1 01 001") |
| | | private String roleDoor; |
| | | |
| | | @ApiModelProperty("是否累加门牌号 0 否 1 是") |
| | | private Integer isAccumulation; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 其他建筑 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-14 17:03 |
| | | **/ |
| | | @Data |
| | | @ApiModel("其他建筑") |
| | | public class ComMngStructBuildTypeVO { |
| | | |
| | | @ApiModelProperty("自增id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("建筑类型名称") |
| | | private String name; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 房屋 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-14 17:10 |
| | | **/ |
| | | @Data |
| | | @ApiModel("房屋地址") |
| | | public class ComMngStructHouseVO { |
| | | |
| | | @ApiModelProperty("id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("房屋地址编号") |
| | | private String houseCode; |
| | | |
| | | @ApiModelProperty("房屋地址") |
| | | private String houseName; |
| | | |
| | | @ApiModelProperty("父类地址编码") |
| | | private String parentCode; |
| | | |
| | | @ApiModelProperty("地址类型 1小区 2楼栋 3 单元 4楼层 5房间") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty("create_at") |
| | | private Date createAt; |
| | | |
| | | @ApiModelProperty("update_at") |
| | | private Date updateAt; |
| | | |
| | | @ApiModelProperty("房屋面积") |
| | | private Double square; |
| | | |
| | | @ApiModelProperty("居住用户名字-多个用,隔开") |
| | | private String names; |
| | | |
| | | @ApiModelProperty("居住用户手机号-多个用,隔开") |
| | | private String phones; |
| | | |
| | | @ApiModelProperty("房屋状态 1 自主 2 租住 3 商用") |
| | | private Integer states; |
| | | |
| | | @ApiModelProperty("身份 1租户 2房主") |
| | | private Integer identity; |
| | | |
| | | @ApiModelProperty(value = "登录用户id",hidden = true) |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty(value = "小区地址id",hidden = true) |
| | | private Long areaId; |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 其他建筑 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-14 17:22 |
| | | **/ |
| | | @Data |
| | | @ApiModel("其他建筑") |
| | | public class ComMngStructOtherBuildVO { |
| | | |
| | | @ApiModelProperty("自增id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("建筑名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("建筑类型id") |
| | | private Long typeId; |
| | | |
| | | @ApiModelProperty("面积") |
| | | private Double square; |
| | | |
| | | @ApiModelProperty("建筑地址") |
| | | private String address; |
| | | |
| | | @ApiModelProperty("建筑状态 1建筑中 2使用中") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty("楼层类型 高层 中层 底层") |
| | | private String layerType; |
| | | |
| | | @ApiModelProperty("创建时间") |
| | | private Date createAt; |
| | | |
| | | @ApiModelProperty(value = "当前页数",example = "1") |
| | | private Long pageNum; |
| | | |
| | | @ApiModelProperty(value = "每页记录数",example = "10") |
| | | private Long pageSize; |
| | | |
| | | @ApiModelProperty("建筑类型名字") |
| | | private String buileTypeName; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 志愿者 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-15 09:51 |
| | | **/ |
| | | @Data |
| | | @ApiModel("社区》管理》志愿者服务 》志愿者管理") |
| | | public class ComMngVolunteerMngVO { |
| | | |
| | | @ApiModelProperty("自增id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("创建时间") |
| | | private Date createAt; |
| | | |
| | | @ApiModelProperty("状态:1- 申请;2 - 通过;3 - 驳回") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty("姓名") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("电话号码") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty("照片路径") |
| | | private String photoPath; |
| | | |
| | | @ApiModelProperty("政治面貌:1 - 党员;2- 团员;3 - 群众") |
| | | private Integer politicalFace; |
| | | |
| | | @ApiModelProperty("拒绝原因") |
| | | private String rejectReson; |
| | | |
| | | @ApiModelProperty("申请原因") |
| | | private String applyReson; |
| | | |
| | | @ApiModelProperty("居住地址") |
| | | private String address; |
| | | |
| | | @ApiModelProperty("当前页数") |
| | | private Long pageNum; |
| | | |
| | | @ApiModelProperty("每页记录数") |
| | | private Long pageSize; |
| | | |
| | | @ApiModelProperty(value = "年龄",example = "15") |
| | | private Integer age; |
| | | |
| | | @ApiModelProperty(value = "职业",example = "家庭主妇") |
| | | private String job; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.community; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 报名活动 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-10 13:59 |
| | | **/ |
| | | @Data |
| | | @ApiModel("报名活动") |
| | | public class SignactivityVO { |
| | | |
| | | @ApiModelProperty(value = "类型 1 报名 2 取消报名",example = "1",required = true) |
| | | private Integer type; |
| | | @ApiModelProperty(value = "是否志愿者 0 否 1 是",example = "1",required = true) |
| | | private Integer isVolunteer; |
| | | @ApiModelProperty(value = "活动主键",required = true) |
| | | private Long activityId; |
| | | @ApiModelProperty(value = "当前登录用户id",hidden = true) |
| | | private Long userId; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.partybuilding; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 负责人 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 14:45 |
| | | **/ |
| | | @Data |
| | | @ApiModel("负责人") |
| | | public class ActivityManagerVO { |
| | | |
| | | |
| | | @ApiModelProperty("负责人id") |
| | | private Long managerId; |
| | | |
| | | @ApiModelProperty("负责人名字") |
| | | private String name; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.partybuilding; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 动态、政策文件、阅读记录 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-02 17:17 |
| | | **/ |
| | | @Data |
| | | @ApiModel("党员动态阅读记录表") |
| | | public class ComPbDynUserVO { |
| | | |
| | | @ApiModelProperty("id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("党员动态、政策文件id") |
| | | private Long dynId; |
| | | |
| | | @ApiModelProperty("小程序用户id") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty("阅读时间") |
| | | private Date createAt; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.partybuilding; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 分页活动人员 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-01 09:50 |
| | | **/ |
| | | @Data |
| | | @ApiModel(value = "分页活动人员") |
| | | public class PageActivityMembersVO { |
| | | @ApiModelProperty(value ="手机号") |
| | | private String phone; |
| | | @ApiModelProperty(value ="姓名") |
| | | private String name; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @ApiModelProperty(value ="报名时间") |
| | | private String registrationTime; |
| | | @ApiModelProperty(value ="人员主键") |
| | | private Long id; |
| | | @ApiModelProperty(value ="当前页数") |
| | | private Long pageNum; |
| | | @ApiModelProperty(value ="每页记录数") |
| | | private Long pageSize; |
| | | @ApiModelProperty(value ="活动id",required = true) |
| | | private Long activityId; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.partybuilding; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 分页党员 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-30 16:10 |
| | | **/ |
| | | @Data |
| | | @ApiModel(value = "分页查询党员") |
| | | public class PagePartyOrganizationVO { |
| | | |
| | | @ApiModelProperty(value ="组织名字") |
| | | private String orgName; |
| | | |
| | | @ApiModelProperty(value ="账户") |
| | | private String account; |
| | | |
| | | @ApiModelProperty(value ="党员姓名") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value ="当前页数") |
| | | private Long pageNum; |
| | | |
| | | @ApiModelProperty(value ="每页记录数") |
| | | private Long pageSize; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.partybuilding; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 活动 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-01 09:08 |
| | | **/ |
| | | @Data |
| | | @ApiModel("党员活动") |
| | | public class |
| | | PartyBuildingActivityVO { |
| | | @ApiModelProperty("党员id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("活动名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("活动地点") |
| | | private String address; |
| | | |
| | | @ApiModelProperty("1 待发布 2 未开始 3 报名中 4 进行中 5 已结束 6 已取消") |
| | | private Integer status; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @ApiModelProperty("发布时间") |
| | | private Date releaseTime; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @ApiModelProperty("发布开始时间") |
| | | private Date releaseTimeBegin; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @ApiModelProperty("发布结束时间") |
| | | private Date releaseTimeEnd; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @ApiModelProperty("活动开始时间") |
| | | private Date activityTimeBegin; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @ApiModelProperty("活动结束时间") |
| | | private Date activityTimeEnd; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @ApiModelProperty("报名开始时间") |
| | | private Date enrollTimeBegin; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @ApiModelProperty("报名结束时间") |
| | | private Date enrollTimeEnd; |
| | | |
| | | @ApiModelProperty("当前页数") |
| | | private Long pageNum; |
| | | |
| | | @ApiModelProperty("每页记录数") |
| | | private Long pageSize; |
| | | |
| | | @ApiModelProperty("活动参入人数") |
| | | private Integer participationNum; |
| | | |
| | | @ApiModelProperty("活动最低参入人数-未达到到时间自动取消") |
| | | private Integer participationLowestNum; |
| | | |
| | | @ApiModelProperty("活动封面") |
| | | private String cover; |
| | | |
| | | @ApiModelProperty("活动内容-富文本") |
| | | private String richText; |
| | | |
| | | @ApiModelProperty("取消原因") |
| | | private String cancelReason; |
| | | |
| | | @ApiModelProperty("发布人") |
| | | private String createBy; |
| | | |
| | | @ApiModelProperty("社区id") |
| | | private Long communityId; |
| | | |
| | | @ApiModelProperty("活动党员列表") |
| | | private List<PartyBuildingMemberVO> partyBuildingMemberVOS; |
| | | |
| | | @ApiModelProperty("是否已经报名") |
| | | private Boolean isSign; |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.partybuilding; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 党建动态 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-01 15:53 |
| | | **/ |
| | | @Data |
| | | @ApiModel("社区管理》党建》党员动态/政策文件") |
| | | public class PartyBuildingComPbDynVO { |
| | | |
| | | @ApiModelProperty("党建动态/政策文件id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("标题") |
| | | private String title; |
| | | |
| | | @ApiModelProperty("状态 1 待发布 2 已发布") |
| | | private Integer status; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @ApiModelProperty("发布时间") |
| | | private Date publishAt; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @ApiModelProperty("发布开始时间") |
| | | private Date publishAtBegin; |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @ApiModelProperty("发布结束时间") |
| | | private Date publishAtEnd; |
| | | |
| | | @ApiModelProperty("封面url") |
| | | private String cover; |
| | | |
| | | @ApiModelProperty("创建时间") |
| | | private Date createAt; |
| | | |
| | | @ApiModelProperty("内容") |
| | | private String content; |
| | | |
| | | @ApiModelProperty("发布人id") |
| | | private Long createBy; |
| | | |
| | | @ApiModelProperty("发布人名字") |
| | | private String createByName; |
| | | |
| | | @ApiModelProperty("阅读量") |
| | | private Integer readingVolume; |
| | | |
| | | @ApiModelProperty("当前页数") |
| | | private Long pageNum; |
| | | |
| | | @ApiModelProperty("每页记录数") |
| | | private Long pageSize; |
| | | |
| | | @ApiModelProperty("1动态 2政策文件") |
| | | private Integer type; |
| | | |
| | | @ApiModelProperty("社区id") |
| | | private Long communityId; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.partybuilding; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 批量党员 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-30 14:57 |
| | | **/ |
| | | @Data |
| | | public class PartyBuildingMemberExcelVO implements Serializable { |
| | | /** |
| | | * 党员姓名 |
| | | */ |
| | | @ExcelProperty(value = "党员姓名" ,index = 0) |
| | | private String name; |
| | | /** |
| | | * 身份证号 |
| | | */ |
| | | @ExcelProperty(value = "身份证号" ,index = 1) |
| | | private String idCard; |
| | | /** |
| | | * 所属党组织 |
| | | */ |
| | | @ExcelProperty(value = "所属党组织" ,index = 2) |
| | | private String orgName; |
| | | /** |
| | | * 入党日期 |
| | | */ |
| | | @ExcelProperty(value = "入党日期" ,index = 3) |
| | | private Date joinTime; |
| | | /** |
| | | * 转正日期 |
| | | */ |
| | | @ExcelProperty(value = "转正日期" ,index = 4) |
| | | private Date employmentTime; |
| | | /** |
| | | * 所属社区 |
| | | */ |
| | | @ExcelProperty(value = "所属社区" ,index = 5) |
| | | private String communityName; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.partybuilding; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 党建 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-30 10:03 |
| | | **/ |
| | | @Data |
| | | @ApiModel("社区管理》党建》党员信息") |
| | | public class PartyBuildingMemberVO { |
| | | @ApiModelProperty(value = "姓名") |
| | | private String name; |
| | | @ApiModelProperty(value = "身份证") |
| | | private String idCard; |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | @ApiModelProperty(value = "入党时间") |
| | | private Date joinTime; |
| | | @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") |
| | | @ApiModelProperty(value = "转正时间") |
| | | private Date employmentTime; |
| | | @ApiModelProperty(value = "所属党组织id") |
| | | private Long orgId; |
| | | @ApiModelProperty(value = "头像图片路径") |
| | | private String photoPath; |
| | | @ApiModelProperty(value = "社区ID",hidden=true) |
| | | private Long communityId; |
| | | @ApiModelProperty(value = "社区名字") |
| | | private String communityName; |
| | | @ApiModelProperty(value = "党组织名字") |
| | | private String orgName; |
| | | @ApiModelProperty(value = "手机号") |
| | | private String phone; |
| | | @ApiModelProperty(value = "党龄") |
| | | private Integer partyAge; |
| | | @ApiModelProperty(value = "状态") |
| | | private String status; |
| | | @ApiModelProperty(value = "党员唯一标识id") |
| | | private Long id; |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.partybuilding; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 党委 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-01 14:15 |
| | | **/ |
| | | @Data |
| | | @ApiModel("党委") |
| | | public class PartyCommitteeVO { |
| | | @ApiModelProperty(value = "党员id") |
| | | private Long PartyMemberId; |
| | | @ApiModelProperty(value = "身份id") |
| | | private Long roleId; |
| | | @ApiModelProperty(value = "身份名字") |
| | | private String roleName; |
| | | @ApiModelProperty(value = "社区id") |
| | | private Long communityId; |
| | | @ApiModelProperty(value = "主键") |
| | | private Long id; |
| | | @ApiModelProperty(value = "当前页数") |
| | | private Long pageNum; |
| | | @ApiModelProperty(value = "每页记录数") |
| | | private Long pageSize; |
| | | @ApiModelProperty(value = "党员姓名") |
| | | private String name; |
| | | @ApiModelProperty(value = "党员照片") |
| | | private String photoPath; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.partybuilding; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 党组织 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-30 11:15 |
| | | **/ |
| | | @Data |
| | | @ApiModel("党组织") |
| | | public class PartyOrganizationVO { |
| | | @ApiModelProperty(value = "党组织id") |
| | | private Long id; |
| | | @ApiModelProperty(value = "党组织名字") |
| | | private String name; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.user; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.Pattern; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 修改密码 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 10:23 |
| | | **/ |
| | | @Data |
| | | @ApiModel("修改密码") |
| | | public class ChangePasswordVO { |
| | | |
| | | @ApiModelProperty("旧密码") |
| | | @NotEmpty(message = "旧密码不能为空") |
| | | private String oldPassword; |
| | | |
| | | @ApiModelProperty("新密码") |
| | | @NotEmpty(message = "新密码不能为空") |
| | | @Pattern(message="密码格式为6-16个字符,英文,数字,且必须包含英文和数字",regexp="^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$") |
| | | private String newPassword; |
| | | |
| | | |
| | | @ApiModelProperty(hidden = true,value = "当前登录用户id") |
| | | private Long userId; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.user; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 家庭 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-14 16:53 |
| | | **/ |
| | | @Data |
| | | @ApiModel("社区》社区管理》家庭信息") |
| | | public class ComMngFamilyInfoVO { |
| | | |
| | | @ApiModelProperty("自增id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("本人id") |
| | | private Long userId; |
| | | |
| | | @ApiModelProperty("与本人关系") |
| | | private String relationship; |
| | | |
| | | @ApiModelProperty("名字") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("身份证号") |
| | | private String idCard; |
| | | |
| | | @ApiModelProperty("手机号") |
| | | private String phone; |
| | | |
| | | @ApiModelProperty("年龄") |
| | | private Integer age; |
| | | |
| | | @ApiModelProperty("健康状况") |
| | | private String health; |
| | | |
| | | @ApiModelProperty("工作") |
| | | private String job; |
| | | |
| | | @ApiModelProperty("create_at") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createAt; |
| | | |
| | | @ApiModelProperty("update_at") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date updateAt; |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.user; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 工作类型 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-14 16:55 |
| | | **/ |
| | | @Data |
| | | @ApiModel("社区》社区管理》工作类型") |
| | | public class ComMngJobSetVO { |
| | | |
| | | @ApiModelProperty("自增id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("工作名称") |
| | | private String jobName; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.user; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 工作类型 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-14 17:27 |
| | | **/ |
| | | @Data |
| | | @ApiModel("社区》社区管理》工作类型") |
| | | public class ComMngUserTagVO { |
| | | |
| | | @ApiModelProperty("自增id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("标签名称") |
| | | private String tagName; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.user; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 角色 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-01 13:55 |
| | | **/ |
| | | @Data |
| | | @ApiModel("角色信息") |
| | | public class RoleVO { |
| | | |
| | | @ApiModelProperty("角色id") |
| | | private Long roleId; |
| | | |
| | | @ApiModelProperty("角色名称") |
| | | private String roleName; |
| | | |
| | | @ApiModelProperty("角色权限字符串") |
| | | private String roleKey; |
| | | |
| | | @ApiModelProperty("显示顺序") |
| | | private Integer roleSort; |
| | | |
| | | @ApiModelProperty("数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限 )") |
| | | private String dataScope; |
| | | |
| | | @ApiModelProperty("菜单树选择项是否关联显示") |
| | | private boolean menuCheckStrictly; |
| | | |
| | | @ApiModelProperty("部门树选择项是否关联显示") |
| | | private boolean deptCheckStrictly; |
| | | |
| | | @ApiModelProperty("角色状态(0正常 1停用)") |
| | | private String status; |
| | | |
| | | @ApiModelProperty("创建者") |
| | | private String createBy; |
| | | |
| | | @ApiModelProperty("创建时间") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty("更新者") |
| | | private String updateBy; |
| | | |
| | | @ApiModelProperty("更新时间") |
| | | private Date updateTime; |
| | | |
| | | @ApiModelProperty("备注") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty("社区id") |
| | | private Integer communityId; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.model.vos.user; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 修改手机号 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-17 15:25 |
| | | **/ |
| | | @Data |
| | | @ApiModel("修改手机号") |
| | | public class |
| | | UserPhoneVO { |
| | | |
| | | @ApiModelProperty("老手机号") |
| | | private String oldPhone; |
| | | @ApiModelProperty("新手机号") |
| | | private String newPhone; |
| | | @ApiModelProperty("短信验证码") |
| | | private String smsCode; |
| | | @ApiModelProperty(value = "当前登录用户id",hidden = true) |
| | | private Long userId; |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.service.auth; |
| | | |
| | | import com.panzhihua.common.model.vos.R; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 认证授权 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 09:18 |
| | | **/ |
| | | @FeignClient(name = "auth") |
| | | public interface TokenService { |
| | | /** |
| | | * 小程序用户登录 |
| | | * @param openId 小程序唯一标识 |
| | | * @return 登录结果 |
| | | */ |
| | | @PostMapping("/loginApplets") |
| | | R loginApplets(@RequestParam("openId") String openId); |
| | | |
| | | /** |
| | | * 用户登出 |
| | | * @param token 登录用户token |
| | | * @return 登出结果 |
| | | */ |
| | | @PostMapping("/logout") |
| | | R logout(@RequestParam("token") String token); |
| | | |
| | | /** |
| | | * 社区后台登录 |
| | | * @param account 账户 |
| | | * @param password 密码 |
| | | * @return 登录结果 |
| | | */ |
| | | @PostMapping("/loginCommunityBackage") |
| | | R loginCommunityBackage(@RequestParam("account") String account, @RequestParam("password")String password); |
| | | |
| | | /** |
| | | * 小程序后台登录 |
| | | * @param account 账户 |
| | | * @param password 密码 |
| | | * @return 登录结果 |
| | | */ |
| | | @PostMapping("/loginAppletsBackStage") |
| | | R loginAppletsBackStage(@RequestParam("account") String account, @RequestParam("password")String password); |
| | | |
| | | /** |
| | | * 认证中心刷新token |
| | | * @param refreshToken 用户端保存的刷新token |
| | | * @return 新的token 和刷新token |
| | | */ |
| | | @PostMapping("/refreshToken") |
| | | R refreshToken(@RequestParam("refreshToken")String refreshToken); |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.service.community; |
| | | |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.*; |
| | | import com.panzhihua.common.model.vos.user.UserPhoneVO; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 15:59 |
| | | **/ |
| | | @FeignClient(name = "community") |
| | | public interface CommunityService { |
| | | /** |
| | | * 新增社区活动 |
| | | * @param comActActivityVO 新增信息 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("/addactivity") |
| | | R addActivity(@RequestBody ComActActivityVO comActActivityVO); |
| | | |
| | | /** |
| | | * 编辑社区活动 |
| | | * @param comActActivityVO 编辑内容 |
| | | * @return 编辑结果 |
| | | */ |
| | | @PostMapping("/putactivity") |
| | | R putActivity(@RequestBody ComActActivityVO comActActivityVO); |
| | | |
| | | /** |
| | | * 删除社区活动 |
| | | * @param comActActivityVO 活动主键 |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("deleteactivity") |
| | | R deleteActivity(@RequestBody ComActActivityVO comActActivityVO); |
| | | |
| | | /** |
| | | * 分页查询社区活动 |
| | | * @param comActActivityVO 查询参数 |
| | | * @return 分页集合 |
| | | */ |
| | | @PostMapping("pageactivity") |
| | | R pageActivity(@RequestBody ComActActivityVO comActActivityVO); |
| | | |
| | | /** |
| | | * 发布活动 |
| | | * @param comActActivityVO 主键id 发布时间 |
| | | * @return 发布结果 |
| | | */ |
| | | @PostMapping("releaseactivity") |
| | | R releaseActivity(@RequestBody ComActActivityVO comActActivityVO); |
| | | |
| | | /** |
| | | * 取消活动 |
| | | * @param comActActivityVO 取消原因 |
| | | * @return 取消结果 |
| | | */ |
| | | @PostMapping("cancelactivity") |
| | | R cancelActivity(@RequestBody ComActActivityVO comActActivityVO); |
| | | |
| | | /** |
| | | * 活动详情 |
| | | * @param id 活动id |
| | | * @param userId 当前登录者id |
| | | * @return 详情 |
| | | */ |
| | | @PostMapping("detailactivity") |
| | | R detailActivity(@RequestParam("id") Long id, @RequestParam("userId")Long userId); |
| | | |
| | | /** |
| | | * 活动报名名单 |
| | | * @param activitySignVO 查询参数 |
| | | * @return 报名人员集合 |
| | | */ |
| | | @PostMapping("listactivitysign") |
| | | R listActivitySign(@RequestBody ActivitySignVO activitySignVO); |
| | | |
| | | /** |
| | | * 新增社区动态 |
| | | * @param comActDynVO 新增信息 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("adddynamic") |
| | | R addDynamic(@RequestBody ComActDynVO comActDynVO); |
| | | |
| | | /** |
| | | * 编辑社区动态 |
| | | * @param comActDynVO 编辑内容 |
| | | * @return 编辑结果 |
| | | */ |
| | | @PostMapping("putdynamic") |
| | | R putDynamic(@RequestBody ComActDynVO comActDynVO); |
| | | |
| | | /** |
| | | * 删除社区动态 |
| | | * @param comActDynVO 动态id |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("deletedynamic") |
| | | R deleteDynamic(@RequestBody ComActDynVO comActDynVO); |
| | | |
| | | /** |
| | | * 分页查询社区动态 |
| | | * @param comActDynVO 查询参数 |
| | | * @return 动态集合 |
| | | */ |
| | | @PostMapping("pagedynamic") |
| | | R pageDynamic(@RequestBody ComActDynVO comActDynVO); |
| | | |
| | | /** |
| | | * 社区动态详情 |
| | | * @param id 动态id |
| | | * @return 详情 |
| | | */ |
| | | @PostMapping("detaildynamic") |
| | | R detailDynamic(@RequestParam("id") Long id); |
| | | |
| | | /** |
| | | * 分页查询随手拍 |
| | | * @param comActEasyPhotoVO 查询参数 |
| | | * @return 心愿列表 |
| | | */ |
| | | @PostMapping("pageeasyphoto") |
| | | R pageEasyPhoto(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO); |
| | | |
| | | /** |
| | | * 随手拍详情 |
| | | * @param id 随手拍主键 |
| | | * @param userId 登录用户id |
| | | * @return 详情内容 |
| | | */ |
| | | @PostMapping("detaileasyphoto") |
| | | R detailEasyPhoto(@RequestParam("id") Long id, @RequestParam("userId")Long userId); |
| | | |
| | | /** |
| | | * 分页查询微心愿 |
| | | * @param comActMicroWishVO 查询参数 |
| | | * @return 分页集合 |
| | | */ |
| | | @PostMapping("pagemicrowish") |
| | | R pageMicroWish(@RequestBody ComActMicroWishVO comActMicroWishVO); |
| | | |
| | | /** |
| | | * 心愿详情 |
| | | * @param id 查询主键 |
| | | * @param userId 登录用户id |
| | | * @return 心愿内容 |
| | | */ |
| | | @PostMapping("detailmicrowish") |
| | | R detailMicroWish(@RequestParam("id") Long id, @RequestParam("userId")Long userId); |
| | | |
| | | /** |
| | | * 审核、分配、反馈心愿 |
| | | * @param comActMicroWishVO 具体操作 |
| | | * @return 操作结果 |
| | | */ |
| | | @PostMapping("putlmicrowish") |
| | | R putlMicroWish(@RequestBody ComActMicroWishVO comActMicroWishVO); |
| | | |
| | | /** |
| | | * 分页展示我的所有活动 时间倒序排列 |
| | | * @param comActActivityVO 分页参数 |
| | | * @return 分页集合 |
| | | */ |
| | | @PostMapping("pagemyactivity") |
| | | R pageMyActivity(@RequestBody ComActActivityVO comActActivityVO); |
| | | |
| | | /** |
| | | * 报名/取消报名社区活动 |
| | | * @param signactivityVO 报名参数 |
| | | * @return 报名 取消报名 结果 |
| | | */ |
| | | @PostMapping("signactivity") |
| | | R signActivity(@RequestBody SignactivityVO signactivityVO); |
| | | |
| | | /** |
| | | * 上传随手拍 |
| | | * @param comActEasyPhotoVO 上传数据 |
| | | * @return 上传结果 |
| | | */ |
| | | @PostMapping("addeasyphoto") |
| | | R addEasyPhoto(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO); |
| | | |
| | | /** |
| | | * 发布微心愿 |
| | | * @param comActMicroWishVO 发布内容 |
| | | * @return 发布结果 |
| | | */ |
| | | @PostMapping("addmicrowish") |
| | | R addMicroWish(@RequestBody ComActMicroWishVO comActMicroWishVO); |
| | | |
| | | /** |
| | | * 点赞/取消点赞随手拍 |
| | | * @param comActEasyPhotoVO 操作参数 |
| | | * @return 操作结果 |
| | | */ |
| | | @PostMapping("puteasyphoto") |
| | | R putEasyPhoto(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO); |
| | | |
| | | /** |
| | | * 点赞/取消点赞微心愿 |
| | | * @param comActMicroWishVO 操作参数 |
| | | * @return 操作结果 |
| | | */ |
| | | @PostMapping("putmicrowish") |
| | | R putMicroWish(@RequestBody ComActMicroWishVO comActMicroWishVO); |
| | | |
| | | /** |
| | | * 新增社区动态浏览记录 |
| | | * @param id 动态主键 |
| | | * @param userId 登录用户id |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("adddynamicuser") |
| | | R addDynamicUser(@RequestParam("id") Long id, @RequestParam("userId")Long userId); |
| | | |
| | | /** |
| | | * 审核、反馈随手拍 |
| | | * @param comActEasyPhotoVO 操作参数 |
| | | * @return 操作结果 |
| | | */ |
| | | @PostMapping("puteasyphotostatus") |
| | | R putEasypHotoStatus(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO); |
| | | |
| | | /** |
| | | * 新增社区 |
| | | * @param comActVO 社区信息 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("addcommunity") |
| | | R addCommunity(@RequestBody ComActVO comActVO); |
| | | |
| | | /** |
| | | * 编辑社区 |
| | | * @param comActVO 编辑内容 |
| | | * @return 编辑结果 |
| | | */ |
| | | @PostMapping("putCommunity") |
| | | R putCommunity(@RequestBody ComActVO comActVO); |
| | | |
| | | /** |
| | | * 房屋信息 |
| | | * @param userId 用户id |
| | | * @return 房屋信息 |
| | | */ |
| | | @PostMapping("detailhouse") |
| | | R detailHouse(@RequestParam("userId") Long userId); |
| | | |
| | | /** |
| | | * 新增小区 |
| | | * @param comMngStructAreaVO 小区信息 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("addarea") |
| | | R addArea(@RequestBody ComMngStructAreaVO comMngStructAreaVO); |
| | | |
| | | /** |
| | | * 分页查询小区 |
| | | * @param comMngStructAreaVO 查询参数 |
| | | * @return 分页结果 |
| | | */ |
| | | @PostMapping("pagearea") |
| | | R pageArea(@RequestBody ComMngStructAreaVO comMngStructAreaVO); |
| | | |
| | | /** |
| | | * 编辑小区 |
| | | * @param comMngStructAreaVO 编辑内容 |
| | | * @return 编辑结果 |
| | | */ |
| | | @PostMapping("putarea") |
| | | R putArea(@RequestBody ComMngStructAreaVO comMngStructAreaVO); |
| | | |
| | | /** |
| | | * 删除小区 |
| | | * @param comMngStructAreaVO 地址编码 |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("deletearea") |
| | | R deleteArea(@RequestBody ComMngStructAreaVO comMngStructAreaVO); |
| | | |
| | | /** |
| | | * 小区批量建房 |
| | | * @param batchhouseVO 建房参数 |
| | | * @return 建房结果 |
| | | */ |
| | | @PostMapping("batchhouse") |
| | | R batchHouse(@RequestBody BatchhouseVO batchhouseVO); |
| | | |
| | | /** |
| | | * 展示下级建筑 |
| | | * @param houseCode 房屋编号 |
| | | * @return 下级建筑列表 |
| | | */ |
| | | @PostMapping("listsubordinatebuilding") |
| | | R listSubordinatebuilding(@RequestParam("houseCode")String houseCode); |
| | | |
| | | /** |
| | | * 添加同级地址 |
| | | * @param comMngStructHouseVO 同级参数 |
| | | * @return 添加结果 |
| | | */ |
| | | @PostMapping("addhouse") |
| | | R addHouse(@RequestBody BatchhouseVO comMngStructHouseVO); |
| | | |
| | | /** |
| | | * 编辑地址 |
| | | * @param comMngStructHouseVO 编辑内容 |
| | | * @return 编辑结果 |
| | | */ |
| | | @PostMapping("addhouse") |
| | | R putHouse(@RequestBody ComMngStructHouseVO comMngStructHouseVO); |
| | | |
| | | /** |
| | | * 删除地址 |
| | | * @param comMngStructHouseVO 删除指定地址和所有下级 |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("deletehouse") |
| | | R deleteHouse(@RequestBody ComMngStructHouseVO comMngStructHouseVO); |
| | | |
| | | /** |
| | | * 新增其他建筑 |
| | | * @param comMngStructOtherBuildVO 建筑参数 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("addotherbuild") |
| | | R addOtherbuild(@RequestBody ComMngStructOtherBuildVO comMngStructOtherBuildVO); |
| | | |
| | | /** |
| | | * 查询所有建筑类型 |
| | | * @return 类型列表 |
| | | */ |
| | | @PostMapping("listbuildtype") |
| | | R listBuildType(); |
| | | |
| | | /** |
| | | * 分页查询 其他建筑 |
| | | * @param comMngStructOtherBuildVO 分页查询参数 |
| | | * @return 查询结果 |
| | | */ |
| | | @PostMapping("pageotherbuild") |
| | | R pageOtherBuild(@RequestBody ComMngStructOtherBuildVO comMngStructOtherBuildVO); |
| | | |
| | | /** |
| | | * 增加志愿者 |
| | | * @param comMngVolunteerMngVO 志愿者信息 |
| | | * @return 增加结果 |
| | | */ |
| | | @PostMapping("addvolunteer") |
| | | R addVolunteer(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO); |
| | | |
| | | /** |
| | | * 删除志愿者 |
| | | * @param comMngVolunteerMngVO 手机号 |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("deletevolunteer") |
| | | R deleteVolunteer(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO); |
| | | |
| | | /** |
| | | * 编辑志愿者 |
| | | * @param comMngVolunteerMngVO 编辑内容 |
| | | * @return 编辑结果 |
| | | */ |
| | | @PostMapping("putvolunteer") |
| | | R putVolunteer(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO); |
| | | |
| | | /** |
| | | * 分页展示志愿者 |
| | | * @param comMngVolunteerMngVO 查询参数 |
| | | * @return 分页集合返回 |
| | | */ |
| | | @PostMapping("pagevolunteer") |
| | | R pageVolunteer(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO); |
| | | |
| | | /** |
| | | * 分页展示志愿者审核 |
| | | * @param comMngVolunteerMngVO 查询参数 |
| | | * @return 查询结果 |
| | | */ |
| | | @PostMapping("pagevolunteerexamine") |
| | | R pageVolunteerExamine(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO); |
| | | |
| | | /** |
| | | * 志愿者审核详情 |
| | | * @param id 主键 |
| | | * @return 详情 |
| | | */ |
| | | @PostMapping("detailvolunteerexamine") |
| | | R detailVolunteerExamine(@RequestParam("id") Long id); |
| | | |
| | | /** |
| | | * 志愿者审核 |
| | | * @param comMngVolunteerMngVO 审核操作 |
| | | * @return 审核结果 |
| | | */ |
| | | @PostMapping("putvolunteerexamine") |
| | | R putVolunteerExamine(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO); |
| | | |
| | | /** |
| | | * 删除志愿者审核 |
| | | * @param comMngVolunteerMngVO 主键 |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("deletevolunteerexamine") |
| | | R deleteVolunteerExamine(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO); |
| | | |
| | | /** |
| | | * 查询区域 |
| | | * @param comActVO 登录人的经纬度、或者指定区域的社区 |
| | | * @return 10个社区 |
| | | */ |
| | | @PostMapping("listcommunity") |
| | | R listCommunity(@RequestBody ComActVO comActVO); |
| | | |
| | | /** |
| | | * 用户修改手机号对应的志愿者手机号也要修改 |
| | | * @param userPhoneVO 新旧手机号 |
| | | * @return 修改结果 |
| | | */ |
| | | @PostMapping("putvolunteerphone") |
| | | R putVolunteerPhone(UserPhoneVO userPhoneVO); |
| | | |
| | | /** |
| | | * 房屋地址下拉列表 |
| | | * @param parentCode 父级编码 |
| | | * @param areaId 小区id |
| | | * @return 下级列表 |
| | | */ |
| | | @PostMapping("listhouses") |
| | | R listHouses(@RequestParam("parentCode")String parentCode, @RequestParam("areaId")Long areaId); |
| | | |
| | | /** |
| | | * 新增房屋 |
| | | * @param comMngStructHouseVO 房屋信息 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("addhouses") |
| | | R addHouses(@RequestBody ComMngStructHouseVO comMngStructHouseVO); |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.service.partybuilding; |
| | | |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.partybuilding.*; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 党建 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-30 09:50 |
| | | **/ |
| | | @FeignClient(value = "partybuilding") |
| | | public interface PartyBuildingService { |
| | | /** |
| | | * 新增党员 |
| | | * @param partyBuildingMemberVO 党员基本信息 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("/partybuildIng/addpartybuildingmember") |
| | | R addPartyBuildingMember(@RequestBody PartyBuildingMemberVO partyBuildingMemberVO); |
| | | |
| | | /** |
| | | * 平台所有的党组织 |
| | | * @return 党组织集合 |
| | | */ |
| | | @PostMapping("/partybuildIng/listpartyorganization") |
| | | R listPartyOrganization(); |
| | | |
| | | /** |
| | | * 批量新增党员 |
| | | * @param list 党员集合 |
| | | */ |
| | | @PostMapping("/partybuildIng/listsavepartybuildingmemberexcelvo") |
| | | R listSavePartyBuildingMemberExcelVO(@RequestBody List<PartyBuildingMemberExcelVO> list); |
| | | |
| | | /** |
| | | * 分页查询党员信息 |
| | | * @param pagePartyOrganizationVO 查询信息 |
| | | * @return 分页数据 |
| | | */ |
| | | @PostMapping("/partybuildIng/pagepartyorganization") |
| | | R pagePartyOrganization(@RequestBody PagePartyOrganizationVO pagePartyOrganizationVO); |
| | | |
| | | /** |
| | | * 党员活动 |
| | | * @param partyBuildingActivityVO 党员活动查询参数 |
| | | * @return 参加的所有活动 |
| | | */ |
| | | @PostMapping("/partybuildIng/listpartymemberactivities") |
| | | R listPartyMemberActivities(@RequestBody PartyBuildingActivityVO partyBuildingActivityVO); |
| | | |
| | | /** |
| | | * 活动报名名单分页查询 |
| | | * @param pageActivityMembersVO 查询参数 手机号 名字 |
| | | * @return 分页数据 |
| | | */ |
| | | @PostMapping("/partybuildIng/pageactivitymembers") |
| | | R pageActivityMembers(@RequestBody PageActivityMembersVO pageActivityMembersVO); |
| | | |
| | | /** |
| | | * 编辑党员信息 新增字段均可编辑 |
| | | * @param partyBuildingMemberVO 编辑字段 |
| | | * @return 编辑结果 |
| | | */ |
| | | @PostMapping("/partybuildIng/updatepartybuildingmember") |
| | | R updatePartyBuildingMember(@RequestBody PartyBuildingMemberVO partyBuildingMemberVO); |
| | | |
| | | /** |
| | | * 党员活动详情 |
| | | * @param id 活动id |
| | | * @return 活动详情内容 |
| | | */ |
| | | @PostMapping("/partybuildIng/activityinfo") |
| | | R activityinfo(@RequestParam("id") Long id); |
| | | |
| | | /** |
| | | * 查询指定社区的所有党员 |
| | | * @param communityId 社区id |
| | | * @return 党员列表 |
| | | */ |
| | | @PostMapping("/partybuildIng/listPartyMember") |
| | | R listPartyMember(@RequestParam("communityId")Long communityId); |
| | | |
| | | /** |
| | | * 社区下拉选择身份 |
| | | * @return 身份集合 |
| | | */ |
| | | @PostMapping("/partybuildIng/listidentity") |
| | | R listIdentity(); |
| | | |
| | | /** |
| | | * 新增党委 |
| | | * @param partyCommitteeVO 新增信息 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("/partybuildIng/addpartycommittee") |
| | | R addPartyCommittee(@RequestBody PartyCommitteeVO partyCommitteeVO); |
| | | /** |
| | | * 编辑党委 |
| | | * @param partyCommitteeVO 编辑信息 |
| | | * @return 编辑结果 |
| | | */ |
| | | @PostMapping("/partybuildIng/updatepartycommittee") |
| | | R updatePartyCommittee(@RequestBody PartyCommitteeVO partyCommitteeVO); |
| | | /** |
| | | * 删除党委 |
| | | * @param partyCommitteeVO 删除id |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("/partybuildIng/deletepartycommittee") |
| | | R deletePartyCommittee(@RequestBody PartyCommitteeVO partyCommitteeVO); |
| | | |
| | | /** |
| | | * 分页社区党委查询 |
| | | * @param partyCommitteeVO 查询参数 |
| | | * @return 分页集合 |
| | | */ |
| | | @PostMapping("/partybuildIng/pagepartycommittee") |
| | | R pagePartyCommittee(@RequestBody PartyCommitteeVO partyCommitteeVO); |
| | | |
| | | /** |
| | | * 新建党建动态 |
| | | * @param partyCommitteeVO 动态内容 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("/partybuildIng/adddynamic") |
| | | R adddYnamic(@RequestBody PartyBuildingComPbDynVO partyCommitteeVO); |
| | | |
| | | /** |
| | | * 编辑动态 |
| | | * @param partyCommitteeVO 编辑内容 |
| | | * @return 编辑结果 |
| | | */ |
| | | @PostMapping("/partybuildIng/updatedynamic") |
| | | R updateYnamic(@RequestBody PartyBuildingComPbDynVO partyCommitteeVO); |
| | | |
| | | /** |
| | | * 动态详情 |
| | | * @param id 动态主键 |
| | | * @return 详情 |
| | | */ |
| | | @PostMapping("/partybuildIng/infodynamic") |
| | | R infoYnamic(@RequestParam("id") Long id); |
| | | |
| | | /** |
| | | * 分页查询党员动态/政策文件 |
| | | * @param partyBuildingComPbDynVO 查询参数 |
| | | * @return 分页数据 |
| | | */ |
| | | @PostMapping("/partybuildIng/pagedynamic") |
| | | R pageYnamic(@RequestBody PartyBuildingComPbDynVO partyBuildingComPbDynVO); |
| | | |
| | | /** |
| | | * 删除动态 |
| | | * @param id 动态主键 |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("/partybuildIng/deletedynamic") |
| | | R deleteYnamic(@RequestParam("id") Long id); |
| | | |
| | | /** |
| | | * 新增党员活动 |
| | | * @param partyBuildingActivityVO 参数 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("/partybuildIng/addactivity") |
| | | R addactivity(@RequestBody PartyBuildingActivityVO partyBuildingActivityVO); |
| | | |
| | | /** |
| | | * 编辑党员活动 |
| | | * @param partyBuildingActivityVO 编辑内容 |
| | | * @return 编辑结果 |
| | | */ |
| | | @PostMapping("/partybuildIng/updateactivity") |
| | | R updateActivity(@RequestBody PartyBuildingActivityVO partyBuildingActivityVO); |
| | | |
| | | /** |
| | | * 发布党员活动 |
| | | * @param id 主键id |
| | | * @return 发布结果 |
| | | */ |
| | | @PostMapping("/partybuildIng/releaseactivity") |
| | | R releaseActivity(@RequestParam("id") Long id); |
| | | |
| | | /** |
| | | * 删除党员活动 |
| | | * @param id 主键id |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("/partybuildIng/deleteactivity") |
| | | R deleteActivity(@RequestParam("id") Long id); |
| | | |
| | | /** |
| | | * 分页查询党员活动 |
| | | * @param partyBuildingActivityVO 查询条件 |
| | | * @return 查询结果 |
| | | */ |
| | | @PostMapping("/partybuildIng/pageactivity") |
| | | R pageActivity(@RequestBody PartyBuildingActivityVO partyBuildingActivityVO); |
| | | |
| | | /** |
| | | * 增加阅读记录 |
| | | * @param comPbDynUserVO 记录内容 |
| | | * @return 增加结果 |
| | | */ |
| | | @PostMapping("/partybuildIng/adddynuser") |
| | | R addDynUser(@RequestBody ComPbDynUserVO comPbDynUserVO); |
| | | /** |
| | | * 删除党员 |
| | | * @param id 党员主键 |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("/partybuildIng/deletepartybuildingmember") |
| | | R deleteDynUser(@RequestParam("id") Long id); |
| | | |
| | | /** |
| | | * 取消活动 |
| | | * @param partyBuildingActivityVO 取消原因 |
| | | * @return 操作结果 |
| | | */ |
| | | @PostMapping("/partybuildIng/cancelactivity") |
| | | R cancelActivity(@RequestBody PartyBuildingActivityVO partyBuildingActivityVO); |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.service.user; |
| | | |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.MenuVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.user.ChangePasswordVO; |
| | | import com.panzhihua.common.model.vos.user.ComMngFamilyInfoVO; |
| | | import com.panzhihua.common.model.vos.user.UserPhoneVO; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: feign-userservice |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 08:58 |
| | | **/ |
| | | @FeignClient(name = "user") |
| | | public interface UserService { |
| | | |
| | | |
| | | /** |
| | | * 新增微信用户 |
| | | * @param openid 微信小程序标志 |
| | | * @param sessionKey 会话密钥 |
| | | * @param unionid 微信平台唯一ID |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("/addOrUpdate") |
| | | R addOrUpdate(@RequestParam("openid") String openid, @RequestParam("sessionKey")String sessionKey, @RequestParam("unionid")String unionid); |
| | | |
| | | /** |
| | | * 维护小程序用户基本信息 头像 昵称 性别 |
| | | * @param userId 数据库用户ID |
| | | * @param nickName 昵称 |
| | | * @param gender 性别 |
| | | * @param avatarUrl 头像 |
| | | * @return 维护结果 |
| | | */ |
| | | @PostMapping("/updateUserWeiXinInfo") |
| | | R updateUserWeiXinInfo(@RequestParam("userId")Long userId, @RequestParam("nickName")String nickName, @RequestParam("gender")int gender, @RequestParam("avatarUrl")String avatarUrl); |
| | | |
| | | /** |
| | | * 维护微信用户手机号 |
| | | * @param userId 数据库ID |
| | | * @param purePhoneNumber 没有区号的手机号 |
| | | * @return 维护结果 |
| | | */ |
| | | @PostMapping("/updateUserWeiXinPhone") |
| | | R updateUserWeiXinPhone(@RequestParam("userId")Long userId, @RequestParam("purePhoneNumber")String purePhoneNumber); |
| | | |
| | | /** |
| | | * 获取平台用户 |
| | | * @param userId 用户ID |
| | | * @return 平台用户信息 |
| | | */ |
| | | @PostMapping("/getUserInfoUserId") |
| | | R<LoginUserInfoVO> getUserInfoByUserId(@RequestParam("userId") String userId); |
| | | |
| | | /** |
| | | * 获取平台用户 |
| | | * @param userName 登录账户+_type |
| | | * @return 平台用户信息 |
| | | */ |
| | | @PostMapping(value = "/getUserInfo") |
| | | R<LoginUserInfoVO> getUserInfo(@RequestParam("userName") String userName); |
| | | |
| | | /** |
| | | * 获取平台所有权限路径url |
| | | * @return 所有url |
| | | */ |
| | | @PostMapping("/role/getAllMenu") |
| | | R<List<MenuVO>> getAllMenu(); |
| | | |
| | | /** |
| | | * |
| | | * @param username 用户的ID |
| | | * @return 用户所有角色 |
| | | */ |
| | | @PostMapping("/role/getUserRoles") |
| | | R<List<String>> getUserRoles(@RequestParam("username") String username); |
| | | |
| | | /** |
| | | * 查询社区的党委角色 |
| | | * @param communityId 社区id |
| | | * @return 党委角色列表 |
| | | */ |
| | | @PostMapping("/role/listidentity") |
| | | R listIdentity(@RequestParam("communityId")Long communityId); |
| | | |
| | | /** |
| | | * 修改用户登录密码 |
| | | * @param changePasswordVO 新密码 |
| | | * @return 修改结果 |
| | | */ |
| | | @PostMapping("changepassword") |
| | | R changePassword(@RequestBody ChangePasswordVO changePasswordVO); |
| | | |
| | | /** |
| | | * 某社区后台人员查询 |
| | | * @param param 名字 |
| | | * @param communityId 社区id |
| | | * @return 人员集合 |
| | | */ |
| | | @PostMapping("listactivitymanager") |
| | | R listActivityManager(@RequestParam("param") String param, @RequestParam("communityId")Long communityId); |
| | | |
| | | /** |
| | | *分页查询人脸识别 |
| | | * @param loginUserInfoVO 查询参数 |
| | | * @return 分页集合 |
| | | */ |
| | | @PostMapping("pageuserface") |
| | | R pageUserFace(@RequestBody LoginUserInfoVO loginUserInfoVO); |
| | | |
| | | /** |
| | | * 编辑人脸采集数据通过、驳回、删除 |
| | | * @param loginUserInfoVO 操作信息 |
| | | * @return 操作结果 |
| | | */ |
| | | @PostMapping("putuserface") |
| | | R putUserFace(@RequestBody LoginUserInfoVO loginUserInfoVO); |
| | | |
| | | /** |
| | | *分页查询人口管理 |
| | | * @param loginUserInfoVO 查询参数 |
| | | * @return 分页数据 |
| | | */ |
| | | @PostMapping("pageuser") |
| | | R pageUser(@RequestBody LoginUserInfoVO loginUserInfoVO); |
| | | |
| | | /** |
| | | * 查询所有人员标签 |
| | | * @return 标签集合 |
| | | */ |
| | | @PostMapping("listtag") |
| | | R listTag(); |
| | | |
| | | /** |
| | | * 人员详情 |
| | | * @param userId 用户id |
| | | * @return 人员详情 |
| | | */ |
| | | @PostMapping("detailuser") |
| | | R detailUser(@RequestParam("userId") Long userId); |
| | | |
| | | /** |
| | | * 设置用户标签 |
| | | * @param loginUserInfoVO 标签信息 |
| | | * @return 设置结果 |
| | | */ |
| | | @PostMapping("putusertag") |
| | | R putUserTag(@RequestBody LoginUserInfoVO loginUserInfoVO); |
| | | |
| | | /** |
| | | * 修改用户志愿者状态 |
| | | * @param phone 志愿者手机号 |
| | | * @param type 1 支援者 0不是志愿者 |
| | | */ |
| | | @PostMapping("putuserisvolunteer") |
| | | R putUserIsVolunteer(@RequestParam("phone") String phone,@RequestParam("type")int type); |
| | | |
| | | /** |
| | | * 用户绑定社区、小区 |
| | | * @param loginUserInfoVO 社区小区数据 |
| | | * @return 绑定结果 |
| | | */ |
| | | @PostMapping("putusercommunityarea") |
| | | R putUserCommunityArea(@RequestBody LoginUserInfoVO loginUserInfoVO); |
| | | |
| | | /** |
| | | * 用户实名认证 |
| | | * @param loginUserInfoVO 认证数据 |
| | | * @return 认证结果 |
| | | */ |
| | | @PostMapping("putuserauthentication") |
| | | R putUserAuthentication(@RequestBody LoginUserInfoVO loginUserInfoVO); |
| | | |
| | | /** |
| | | * 修改用户手机号 |
| | | * @param userPhoneVO 手机号信息 |
| | | * @return 修改结果 |
| | | */ |
| | | @PostMapping("putuserphone") |
| | | R putUserphone(@RequestBody UserPhoneVO userPhoneVO); |
| | | |
| | | /** |
| | | * 修改用户信息 |
| | | * @param loginUserInfoVO 修改内容 |
| | | * @return 修改结果 |
| | | */ |
| | | @PostMapping("putuser") |
| | | R putUser(LoginUserInfoVO loginUserInfoVO); |
| | | |
| | | /** |
| | | * 家庭成员列表 |
| | | * @param userId 登录用户 |
| | | * @return 成员集合 |
| | | */ |
| | | @PostMapping("listfamily") |
| | | R listFamily(@RequestParam("userId")Long userId); |
| | | |
| | | /** |
| | | * 新增家庭成员 |
| | | * @param comMngFamilyInfoVO 家庭成员基本信息 |
| | | * @return 增加结果 |
| | | */ |
| | | @PostMapping("addFamily") |
| | | R addFamily(ComMngFamilyInfoVO comMngFamilyInfoVO); |
| | | |
| | | /** |
| | | * 编辑家庭成员 |
| | | * @param comMngFamilyInfoVO 家庭成员信息 |
| | | * @return 编辑结果 |
| | | */ |
| | | @PostMapping("putfamily") |
| | | R putFamily(@RequestBody ComMngFamilyInfoVO comMngFamilyInfoVO); |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.security.InvalidKeyException; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.security.SecureRandom; |
| | | |
| | | import javax.crypto.BadPaddingException; |
| | | import javax.crypto.Cipher; |
| | | import javax.crypto.IllegalBlockSizeException; |
| | | import javax.crypto.KeyGenerator; |
| | | import javax.crypto.NoSuchPaddingException; |
| | | import javax.crypto.SecretKey; |
| | | import javax.crypto.spec.SecretKeySpec; |
| | | |
| | | public class AES { |
| | | /** |
| | | * 加密 |
| | | * |
| | | * @param content |
| | | * 需要加密的内容 |
| | | * @param password |
| | | * 加密密码 |
| | | * @return |
| | | */ |
| | | public static byte[] encrypt(String content, String password) { |
| | | try { |
| | | KeyGenerator kgen = KeyGenerator.getInstance("AES"); |
| | | kgen.init(128, new SecureRandom(password.getBytes())); |
| | | SecretKey secretKey = kgen.generateKey(); |
| | | byte[] enCodeFormat = secretKey.getEncoded(); |
| | | SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES"); |
| | | Cipher cipher = Cipher.getInstance("AES");// 创建密码器 |
| | | byte[] byteContent = content.getBytes("utf-8"); |
| | | cipher.init(Cipher.ENCRYPT_MODE, key);// 初始化 |
| | | byte[] result = cipher.doFinal(byteContent); |
| | | return result; // 加密 |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } catch (NoSuchPaddingException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvalidKeyException e) { |
| | | e.printStackTrace(); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (IllegalBlockSizeException e) { |
| | | e.printStackTrace(); |
| | | } catch (BadPaddingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 解密 |
| | | * |
| | | * @param content |
| | | * 待解密内容 |
| | | * @param password |
| | | * 解密密钥 |
| | | * @return |
| | | */ |
| | | public static byte[] decrypt(byte[] content, String password) { |
| | | try { |
| | | KeyGenerator kgen = KeyGenerator.getInstance("AES"); |
| | | kgen.init(128, new SecureRandom(password.getBytes())); |
| | | SecretKey secretKey = kgen.generateKey(); |
| | | byte[] enCodeFormat = secretKey.getEncoded(); |
| | | SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES"); |
| | | Cipher cipher = Cipher.getInstance("AES");// 创建密码器 |
| | | cipher.init(Cipher.DECRYPT_MODE, key);// 初始化 |
| | | byte[] result = cipher.doFinal(content); |
| | | return result; // 加密 |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } catch (NoSuchPaddingException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvalidKeyException e) { |
| | | e.printStackTrace(); |
| | | } catch (IllegalBlockSizeException e) { |
| | | e.printStackTrace(); |
| | | } catch (BadPaddingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 将二进制转换成16进制 |
| | | * |
| | | * @param buf |
| | | * @return |
| | | */ |
| | | public static String parseByte2HexStr(byte buf[]) { |
| | | StringBuffer sb = new StringBuffer(); |
| | | for (int i = 0; i < buf.length; i++) { |
| | | String hex = Integer.toHexString(buf[i] & 0xFF); |
| | | if (hex.length() == 1) { |
| | | hex = '0' + hex; |
| | | } |
| | | sb.append(hex.toUpperCase()); |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 将16进制转换为二进制 |
| | | * |
| | | * @param hexStr |
| | | * @return |
| | | */ |
| | | public static byte[] parseHexStr2Byte(String hexStr) { |
| | | if (hexStr.length() < 1) |
| | | return null; |
| | | byte[] result = new byte[hexStr.length() / 2]; |
| | | for (int i = 0; i < hexStr.length() / 2; i++) { |
| | | int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16); |
| | | int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2), 16); |
| | | result[i] = (byte) (high * 16 + low); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 加密 |
| | | * |
| | | * @param content |
| | | * 需要加密的内容 |
| | | * @param password |
| | | * 加密密码 |
| | | * @return |
| | | */ |
| | | public static byte[] encrypt2(String content, String password) { |
| | | try { |
| | | SecretKeySpec key = new SecretKeySpec(password.getBytes(), "AES"); |
| | | Cipher cipher = Cipher.getInstance("AES/ECB/NoPadding"); |
| | | byte[] byteContent = content.getBytes("utf-8"); |
| | | cipher.init(Cipher.ENCRYPT_MODE, key);// 初始化 |
| | | byte[] result = cipher.doFinal(byteContent); |
| | | return result; // 加密 |
| | | } catch (NoSuchAlgorithmException e) { |
| | | e.printStackTrace(); |
| | | } catch (NoSuchPaddingException e) { |
| | | e.printStackTrace(); |
| | | } catch (InvalidKeyException e) { |
| | | e.printStackTrace(); |
| | | } catch (UnsupportedEncodingException e) { |
| | | e.printStackTrace(); |
| | | } catch (IllegalBlockSizeException e) { |
| | | e.printStackTrace(); |
| | | } catch (BadPaddingException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public static void main(String[] args) throws UnsupportedEncodingException { |
| | | String content = "我是shoneworn"; |
| | | String password = "12345678"; |
| | | // 加密 |
| | | System.out.println("加密前:" + content); |
| | | byte[] encode = encrypt(content, password); |
| | | |
| | | //传输过程,不转成16进制的字符串,就等着程序崩溃掉吧 |
| | | String code = parseByte2HexStr(encode); |
| | | System.out.println("密文字符串:" + code); |
| | | byte[] decode = parseHexStr2Byte(code); |
| | | // 解密 |
| | | byte[] decryptResult = decrypt(decode, password); |
| | | System.out.println("解密后:" + new String(decryptResult, "UTF-8")); //不转码会乱码 |
| | | |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.panzhihua.common.constants.Constants; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | /** |
| | | * 获取地址类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class AddressUtils |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(AddressUtils.class); |
| | | |
| | | // IP地址查询 |
| | | public static final String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp"; |
| | | |
| | | // 未知地址 |
| | | public static final String UNKNOWN = "XX XX"; |
| | | |
| | | public static String getRealAddressByIP(String ip) |
| | | { |
| | | String address = UNKNOWN; |
| | | // 内网不查询 |
| | | if (IpUtils.internalIp(ip)) |
| | | { |
| | | return "内网IP"; |
| | | } |
| | | // if (RuoYiConfig.isAddressEnabled()) |
| | | if (true) |
| | | { |
| | | try |
| | | { |
| | | String rspStr = HttpUtils.sendGet(IP_URL, "ip=" + ip + "&json=true", Constants.GBK); |
| | | if (StringUtils.isEmpty(rspStr)) |
| | | { |
| | | log.error("获取地理位置异常 {}", ip); |
| | | return UNKNOWN; |
| | | } |
| | | JSONObject obj = JSONObject.parseObject(rspStr); |
| | | String region = obj.getString("pro"); |
| | | String city = obj.getString("city"); |
| | | return String.format("%s %s", region, city); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("获取地理位置异常 {}", ip); |
| | | } |
| | | } |
| | | return address; |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | import java.nio.charset.Charset; |
| | | import java.nio.charset.StandardCharsets; |
| | | |
| | | /** |
| | | * 字符集工具类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class CharsetKit |
| | | { |
| | | /** ISO-8859-1 */ |
| | | public static final String ISO_8859_1 = "ISO-8859-1"; |
| | | /** UTF-8 */ |
| | | public static final String UTF_8 = "UTF-8"; |
| | | /** GBK */ |
| | | public static final String GBK = "GBK"; |
| | | |
| | | /** ISO-8859-1 */ |
| | | public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1); |
| | | /** UTF-8 */ |
| | | public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8); |
| | | /** GBK */ |
| | | public static final Charset CHARSET_GBK = Charset.forName(GBK); |
| | | |
| | | /** |
| | | * 转换为Charset对象 |
| | | * |
| | | * @param charset 字符集,为空则返回默认字符集 |
| | | * @return Charset |
| | | */ |
| | | public static Charset charset(String charset) |
| | | { |
| | | return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset); |
| | | } |
| | | |
| | | /** |
| | | * 转换字符串的字符集编码 |
| | | * |
| | | * @param source 字符串 |
| | | * @param srcCharset 源字符集,默认ISO-8859-1 |
| | | * @param destCharset 目标字符集,默认UTF-8 |
| | | * @return 转换后的字符集 |
| | | */ |
| | | public static String convert(String source, String srcCharset, String destCharset) |
| | | { |
| | | return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset)); |
| | | } |
| | | |
| | | /** |
| | | * 转换字符串的字符集编码 |
| | | * |
| | | * @param source 字符串 |
| | | * @param srcCharset 源字符集,默认ISO-8859-1 |
| | | * @param destCharset 目标字符集,默认UTF-8 |
| | | * @return 转换后的字符集 |
| | | */ |
| | | public static String convert(String source, Charset srcCharset, Charset destCharset) |
| | | { |
| | | if (null == srcCharset) |
| | | { |
| | | srcCharset = StandardCharsets.ISO_8859_1; |
| | | } |
| | | |
| | | if (null == destCharset) |
| | | { |
| | | srcCharset = StandardCharsets.UTF_8; |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset)) |
| | | { |
| | | return source; |
| | | } |
| | | return new String(source.getBytes(srcCharset), destCharset); |
| | | } |
| | | |
| | | /** |
| | | * @return 系统字符集编码 |
| | | */ |
| | | public static String systemCharset() |
| | | { |
| | | return Charset.defaultCharset().name(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.nio.ByteBuffer; |
| | | import java.nio.charset.Charset; |
| | | import java.text.NumberFormat; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * 类型转换器 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class Convert |
| | | { |
| | | /** |
| | | * 转换为字符串<br> |
| | | * 如果给定的值为null,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static String toStr(Object value, String defaultValue) |
| | | { |
| | | if (null == value) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof String) |
| | | { |
| | | return (String) value; |
| | | } |
| | | return value.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 转换为字符串<br> |
| | | * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static String toStr(Object value) |
| | | { |
| | | return toStr(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为字符<br> |
| | | * 如果给定的值为null,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static Character toChar(Object value, Character defaultValue) |
| | | { |
| | | if (null == value) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Character) |
| | | { |
| | | return (Character) value; |
| | | } |
| | | |
| | | final String valueStr = toStr(value, null); |
| | | return StringUtils.isEmpty(valueStr) ? defaultValue : valueStr.charAt(0); |
| | | } |
| | | |
| | | /** |
| | | * 转换为字符<br> |
| | | * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Character toChar(Object value) |
| | | { |
| | | return toChar(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为byte<br> |
| | | * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static Byte toByte(Object value, Byte defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Byte) |
| | | { |
| | | return (Byte) value; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return ((Number) value).byteValue(); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return Byte.parseByte(valueStr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为byte<br> |
| | | * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Byte toByte(Object value) |
| | | { |
| | | return toByte(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为Short<br> |
| | | * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static Short toShort(Object value, Short defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Short) |
| | | { |
| | | return (Short) value; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return ((Number) value).shortValue(); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return Short.parseShort(valueStr.trim()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为Short<br> |
| | | * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Short toShort(Object value) |
| | | { |
| | | return toShort(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为Number<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static Number toNumber(Object value, Number defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return (Number) value; |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return NumberFormat.getInstance().parse(valueStr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为Number<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Number toNumber(Object value) |
| | | { |
| | | return toNumber(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为int<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static Integer toInt(Object value, Integer defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Integer) |
| | | { |
| | | return (Integer) value; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return ((Number) value).intValue(); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return Integer.parseInt(valueStr.trim()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为int<br> |
| | | * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Integer toInt(Object value) |
| | | { |
| | | return toInt(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为Integer数组<br> |
| | | * |
| | | * @param str 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Integer[] toIntArray(String str) |
| | | { |
| | | return toIntArray(",", str); |
| | | } |
| | | |
| | | /** |
| | | * 转换为Long数组<br> |
| | | * |
| | | * @param str 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Long[] toLongArray(String str) |
| | | { |
| | | return toLongArray(",", str); |
| | | } |
| | | |
| | | /** |
| | | * 转换为Integer数组<br> |
| | | * |
| | | * @param split 分隔符 |
| | | * @param split 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Integer[] toIntArray(String split, String str) |
| | | { |
| | | if (StringUtils.isEmpty(str)) |
| | | { |
| | | return new Integer[] {}; |
| | | } |
| | | String[] arr = str.split(split); |
| | | final Integer[] ints = new Integer[arr.length]; |
| | | for (int i = 0; i < arr.length; i++) |
| | | { |
| | | final Integer v = toInt(arr[i], 0); |
| | | ints[i] = v; |
| | | } |
| | | return ints; |
| | | } |
| | | |
| | | /** |
| | | * 转换为Long数组<br> |
| | | * |
| | | * @param split 分隔符 |
| | | * @param str 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Long[] toLongArray(String split, String str) |
| | | { |
| | | if (StringUtils.isEmpty(str)) |
| | | { |
| | | return new Long[] {}; |
| | | } |
| | | String[] arr = str.split(split); |
| | | final Long[] longs = new Long[arr.length]; |
| | | for (int i = 0; i < arr.length; i++) |
| | | { |
| | | final Long v = toLong(arr[i], null); |
| | | longs[i] = v; |
| | | } |
| | | return longs; |
| | | } |
| | | |
| | | /** |
| | | * 转换为String数组<br> |
| | | * |
| | | * @param str 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static String[] toStrArray(String str) |
| | | { |
| | | return toStrArray(",", str); |
| | | } |
| | | |
| | | /** |
| | | * 转换为String数组<br> |
| | | * |
| | | * @param split 分隔符 |
| | | * @param split 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static String[] toStrArray(String split, String str) |
| | | { |
| | | return str.split(split); |
| | | } |
| | | |
| | | /** |
| | | * 转换为long<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static Long toLong(Object value, Long defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Long) |
| | | { |
| | | return (Long) value; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return ((Number) value).longValue(); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | // 支持科学计数法 |
| | | return new BigDecimal(valueStr.trim()).longValue(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为long<br> |
| | | * 如果给定的值为<code>null</code>,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Long toLong(Object value) |
| | | { |
| | | return toLong(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为double<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static Double toDouble(Object value, Double defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Double) |
| | | { |
| | | return (Double) value; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return ((Number) value).doubleValue(); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | // 支持科学计数法 |
| | | return new BigDecimal(valueStr.trim()).doubleValue(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为double<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Double toDouble(Object value) |
| | | { |
| | | return toDouble(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为Float<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static Float toFloat(Object value, Float defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Float) |
| | | { |
| | | return (Float) value; |
| | | } |
| | | if (value instanceof Number) |
| | | { |
| | | return ((Number) value).floatValue(); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return Float.parseFloat(valueStr.trim()); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为Float<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Float toFloat(Object value) |
| | | { |
| | | return toFloat(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为boolean<br> |
| | | * String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static Boolean toBool(Object value, Boolean defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof Boolean) |
| | | { |
| | | return (Boolean) value; |
| | | } |
| | | String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | valueStr = valueStr.trim().toLowerCase(); |
| | | switch (valueStr) |
| | | { |
| | | case "true": |
| | | return true; |
| | | case "false": |
| | | return false; |
| | | case "yes": |
| | | return true; |
| | | case "ok": |
| | | return true; |
| | | case "no": |
| | | return false; |
| | | case "1": |
| | | return true; |
| | | case "0": |
| | | return false; |
| | | default: |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为boolean<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static Boolean toBool(Object value) |
| | | { |
| | | return toBool(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为Enum对象<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<br> |
| | | * |
| | | * @param clazz Enum的Class |
| | | * @param value 值 |
| | | * @param defaultValue 默认值 |
| | | * @return Enum |
| | | */ |
| | | public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value, E defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (clazz.isAssignableFrom(value.getClass())) |
| | | { |
| | | @SuppressWarnings("unchecked") |
| | | E myE = (E) value; |
| | | return myE; |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return Enum.valueOf(clazz, valueStr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为Enum对象<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> |
| | | * |
| | | * @param clazz Enum的Class |
| | | * @param value 值 |
| | | * @return Enum |
| | | */ |
| | | public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value) |
| | | { |
| | | return toEnum(clazz, value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为BigInteger<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static BigInteger toBigInteger(Object value, BigInteger defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof BigInteger) |
| | | { |
| | | return (BigInteger) value; |
| | | } |
| | | if (value instanceof Long) |
| | | { |
| | | return BigInteger.valueOf((Long) value); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return new BigInteger(valueStr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为BigInteger<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<code>null</code><br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static BigInteger toBigInteger(Object value) |
| | | { |
| | | return toBigInteger(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 转换为BigDecimal<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @param defaultValue 转换错误时的默认值 |
| | | * @return 结果 |
| | | */ |
| | | public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) |
| | | { |
| | | if (value == null) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | if (value instanceof BigDecimal) |
| | | { |
| | | return (BigDecimal) value; |
| | | } |
| | | if (value instanceof Long) |
| | | { |
| | | return new BigDecimal((Long) value); |
| | | } |
| | | if (value instanceof Double) |
| | | { |
| | | return new BigDecimal((Double) value); |
| | | } |
| | | if (value instanceof Integer) |
| | | { |
| | | return new BigDecimal((Integer) value); |
| | | } |
| | | final String valueStr = toStr(value, null); |
| | | if (StringUtils.isEmpty(valueStr)) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | try |
| | | { |
| | | return new BigDecimal(valueStr); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return defaultValue; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换为BigDecimal<br> |
| | | * 如果给定的值为空,或者转换失败,返回默认值<br> |
| | | * 转换失败不会报错 |
| | | * |
| | | * @param value 被转换的值 |
| | | * @return 结果 |
| | | */ |
| | | public static BigDecimal toBigDecimal(Object value) |
| | | { |
| | | return toBigDecimal(value, null); |
| | | } |
| | | |
| | | /** |
| | | * 将对象转为字符串<br> |
| | | * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 |
| | | * |
| | | * @param obj 对象 |
| | | * @return 字符串 |
| | | */ |
| | | public static String utf8Str(Object obj) |
| | | { |
| | | return str(obj, CharsetKit.CHARSET_UTF_8); |
| | | } |
| | | |
| | | /** |
| | | * 将对象转为字符串<br> |
| | | * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 |
| | | * |
| | | * @param obj 对象 |
| | | * @param charsetName 字符集 |
| | | * @return 字符串 |
| | | */ |
| | | public static String str(Object obj, String charsetName) |
| | | { |
| | | return str(obj, Charset.forName(charsetName)); |
| | | } |
| | | |
| | | /** |
| | | * 将对象转为字符串<br> |
| | | * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 |
| | | * |
| | | * @param obj 对象 |
| | | * @param charset 字符集 |
| | | * @return 字符串 |
| | | */ |
| | | public static String str(Object obj, Charset charset) |
| | | { |
| | | if (null == obj) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | if (obj instanceof String) |
| | | { |
| | | return (String) obj; |
| | | } |
| | | else if (obj instanceof byte[] || obj instanceof Byte[]) |
| | | { |
| | | return str((Byte[]) obj, charset); |
| | | } |
| | | else if (obj instanceof ByteBuffer) |
| | | { |
| | | return str((ByteBuffer) obj, charset); |
| | | } |
| | | return obj.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 将byte数组转为字符串 |
| | | * |
| | | * @param bytes byte数组 |
| | | * @param charset 字符集 |
| | | * @return 字符串 |
| | | */ |
| | | public static String str(byte[] bytes, String charset) |
| | | { |
| | | return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset)); |
| | | } |
| | | |
| | | /** |
| | | * 解码字节码 |
| | | * |
| | | * @param data 字符串 |
| | | * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 |
| | | * @return 解码后的字符串 |
| | | */ |
| | | public static String str(byte[] data, Charset charset) |
| | | { |
| | | if (data == null) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | if (null == charset) |
| | | { |
| | | return new String(data); |
| | | } |
| | | return new String(data, charset); |
| | | } |
| | | |
| | | /** |
| | | * 将编码的byteBuffer数据转换为字符串 |
| | | * |
| | | * @param data 数据 |
| | | * @param charset 字符集,如果为空使用当前系统字符集 |
| | | * @return 字符串 |
| | | */ |
| | | public static String str(ByteBuffer data, String charset) |
| | | { |
| | | if (data == null) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | return str(data, Charset.forName(charset)); |
| | | } |
| | | |
| | | /** |
| | | * 将编码的byteBuffer数据转换为字符串 |
| | | * |
| | | * @param data 数据 |
| | | * @param charset 字符集,如果为空使用当前系统字符集 |
| | | * @return 字符串 |
| | | */ |
| | | public static String str(ByteBuffer data, Charset charset) |
| | | { |
| | | if (null == charset) |
| | | { |
| | | charset = Charset.defaultCharset(); |
| | | } |
| | | return charset.decode(data).toString(); |
| | | } |
| | | |
| | | // ----------------------------------------------------------------------- 全角半角转换 |
| | | /** |
| | | * 半角转全角 |
| | | * |
| | | * @param input String. |
| | | * @return 全角字符串. |
| | | */ |
| | | public static String toSBC(String input) |
| | | { |
| | | return toSBC(input, null); |
| | | } |
| | | |
| | | /** |
| | | * 半角转全角 |
| | | * |
| | | * @param input String |
| | | * @param notConvertSet 不替换的字符集合 |
| | | * @return 全角字符串. |
| | | */ |
| | | public static String toSBC(String input, Set<Character> notConvertSet) |
| | | { |
| | | char c[] = input.toCharArray(); |
| | | for (int i = 0; i < c.length; i++) |
| | | { |
| | | if (null != notConvertSet && notConvertSet.contains(c[i])) |
| | | { |
| | | // 跳过不替换的字符 |
| | | continue; |
| | | } |
| | | |
| | | if (c[i] == ' ') |
| | | { |
| | | c[i] = '\u3000'; |
| | | } |
| | | else if (c[i] < '\177') |
| | | { |
| | | c[i] = (char) (c[i] + 65248); |
| | | |
| | | } |
| | | } |
| | | return new String(c); |
| | | } |
| | | |
| | | /** |
| | | * 全角转半角 |
| | | * |
| | | * @param input String. |
| | | * @return 半角字符串 |
| | | */ |
| | | public static String toDBC(String input) |
| | | { |
| | | return toDBC(input, null); |
| | | } |
| | | |
| | | /** |
| | | * 替换全角为半角 |
| | | * |
| | | * @param text 文本 |
| | | * @param notConvertSet 不替换的字符集合 |
| | | * @return 替换后的字符 |
| | | */ |
| | | public static String toDBC(String text, Set<Character> notConvertSet) |
| | | { |
| | | char c[] = text.toCharArray(); |
| | | for (int i = 0; i < c.length; i++) |
| | | { |
| | | if (null != notConvertSet && notConvertSet.contains(c[i])) |
| | | { |
| | | // 跳过不替换的字符 |
| | | continue; |
| | | } |
| | | |
| | | if (c[i] == '\u3000') |
| | | { |
| | | c[i] = ' '; |
| | | } |
| | | else if (c[i] > '\uFF00' && c[i] < '\uFF5F') |
| | | { |
| | | c[i] = (char) (c[i] - 65248); |
| | | } |
| | | } |
| | | String returnString = new String(c); |
| | | |
| | | return returnString; |
| | | } |
| | | |
| | | /** |
| | | * 数字金额大写转换 先写个完整的然后将如零拾替换成零 |
| | | * |
| | | * @param n 数字 |
| | | * @return 中文大写数字 |
| | | */ |
| | | public static String digitUppercase(double n) |
| | | { |
| | | String[] fraction = { "角", "分" }; |
| | | String[] digit = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" }; |
| | | String[][] unit = { { "元", "万", "亿" }, { "", "拾", "佰", "仟" } }; |
| | | |
| | | String head = n < 0 ? "负" : ""; |
| | | n = Math.abs(n); |
| | | |
| | | String s = ""; |
| | | for (int i = 0; i < fraction.length; i++) |
| | | { |
| | | s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", ""); |
| | | } |
| | | if (s.length() < 1) |
| | | { |
| | | s = "整"; |
| | | } |
| | | int integerPart = (int) Math.floor(n); |
| | | |
| | | for (int i = 0; i < unit[0].length && integerPart > 0; i++) |
| | | { |
| | | String p = ""; |
| | | for (int j = 0; j < unit[1].length && n > 0; j++) |
| | | { |
| | | p = digit[integerPart % 10] + unit[1][j] + p; |
| | | integerPart = integerPart / 10; |
| | | } |
| | | s = p.replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i] + s; |
| | | } |
| | | return head + s.replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", "零元整"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 转义和反转义工具类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class EscapeUtil |
| | | { |
| | | public static final String RE_HTML_MARK = "(<[^<]*?>)|(<[\\s]*?/[^<]*?>)|(<[^<]*?/[\\s]*?>)"; |
| | | |
| | | private static final char[][] TEXT = new char[64][]; |
| | | |
| | | static |
| | | { |
| | | for (int i = 0; i < 64; i++) |
| | | { |
| | | TEXT[i] = new char[] { (char) i }; |
| | | } |
| | | |
| | | // special HTML characters |
| | | TEXT['\''] = "'".toCharArray(); // 单引号 |
| | | TEXT['"'] = """.toCharArray(); // 单引号 |
| | | TEXT['&'] = "&".toCharArray(); // &符 |
| | | TEXT['<'] = "<".toCharArray(); // 小于号 |
| | | TEXT['>'] = ">".toCharArray(); // 大于号 |
| | | } |
| | | |
| | | /** |
| | | * 转义文本中的HTML字符为安全的字符 |
| | | * |
| | | * @param text 被转义的文本 |
| | | * @return 转义后的文本 |
| | | */ |
| | | public static String escape(String text) |
| | | { |
| | | return encode(text); |
| | | } |
| | | |
| | | /** |
| | | * 还原被转义的HTML特殊字符 |
| | | * |
| | | * @param content 包含转义符的HTML内容 |
| | | * @return 转换后的字符串 |
| | | */ |
| | | public static String unescape(String content) |
| | | { |
| | | return decode(content); |
| | | } |
| | | |
| | | /** |
| | | * 清除所有HTML标签,但是不删除标签内的内容 |
| | | * |
| | | * @param content 文本 |
| | | * @return 清除标签后的文本 |
| | | */ |
| | | public static String clean(String content) |
| | | { |
| | | return new HTMLFilter().filter(content); |
| | | } |
| | | |
| | | /** |
| | | * Escape编码 |
| | | * |
| | | * @param text 被编码的文本 |
| | | * @return 编码后的字符 |
| | | */ |
| | | private static String encode(String text) |
| | | { |
| | | int len; |
| | | if ((text == null) || ((len = text.length()) == 0)) |
| | | { |
| | | return StringUtils.EMPTY; |
| | | } |
| | | StringBuilder buffer = new StringBuilder(len + (len >> 2)); |
| | | char c; |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | c = text.charAt(i); |
| | | if (c < 64) |
| | | { |
| | | buffer.append(TEXT[c]); |
| | | } |
| | | else |
| | | { |
| | | buffer.append(c); |
| | | } |
| | | } |
| | | return buffer.toString(); |
| | | } |
| | | |
| | | /** |
| | | * Escape解码 |
| | | * |
| | | * @param content 被转义的内容 |
| | | * @return 解码后的字符串 |
| | | */ |
| | | public static String decode(String content) |
| | | { |
| | | if (StringUtils.isEmpty(content)) |
| | | { |
| | | return content; |
| | | } |
| | | |
| | | StringBuilder tmp = new StringBuilder(content.length()); |
| | | int lastPos = 0, pos = 0; |
| | | char ch; |
| | | while (lastPos < content.length()) |
| | | { |
| | | pos = content.indexOf("%", lastPos); |
| | | if (pos == lastPos) |
| | | { |
| | | if (content.charAt(pos + 1) == 'u') |
| | | { |
| | | ch = (char) Integer.parseInt(content.substring(pos + 2, pos + 6), 16); |
| | | tmp.append(ch); |
| | | lastPos = pos + 6; |
| | | } |
| | | else |
| | | { |
| | | ch = (char) Integer.parseInt(content.substring(pos + 1, pos + 3), 16); |
| | | tmp.append(ch); |
| | | lastPos = pos + 3; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (pos == -1) |
| | | { |
| | | tmp.append(content.substring(lastPos)); |
| | | lastPos = content.length(); |
| | | } |
| | | else |
| | | { |
| | | tmp.append(content.substring(lastPos, pos)); |
| | | lastPos = pos; |
| | | } |
| | | } |
| | | } |
| | | return tmp.toString(); |
| | | } |
| | | |
| | | public static void main(String[] args) |
| | | { |
| | | String html = "<script>alert(1);</script>"; |
| | | // String html = "<scr<script>ipt>alert(\"XSS\")</scr<script>ipt>"; |
| | | // String html = "<123"; |
| | | // String html = "123>"; |
| | | System.out.println(EscapeUtil.clean(html)); |
| | | System.out.println(EscapeUtil.escape(html)); |
| | | System.out.println(EscapeUtil.unescape(html)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | import java.util.*; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.concurrent.ConcurrentMap; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | | * HTML过滤器,用于去除XSS漏洞隐患。 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public final class HTMLFilter |
| | | { |
| | | /** |
| | | * regex flag union representing /si modifiers in php |
| | | **/ |
| | | private static final int REGEX_FLAGS_SI = Pattern.CASE_INSENSITIVE | Pattern.DOTALL; |
| | | private static final Pattern P_COMMENTS = Pattern.compile("<!--(.*?)-->", Pattern.DOTALL); |
| | | private static final Pattern P_COMMENT = Pattern.compile("^!--(.*)--$", REGEX_FLAGS_SI); |
| | | private static final Pattern P_TAGS = Pattern.compile("<(.*?)>", Pattern.DOTALL); |
| | | private static final Pattern P_END_TAG = Pattern.compile("^/([a-z0-9]+)", REGEX_FLAGS_SI); |
| | | private static final Pattern P_START_TAG = Pattern.compile("^([a-z0-9]+)(.*?)(/?)$", REGEX_FLAGS_SI); |
| | | private static final Pattern P_QUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)=([\"'])(.*?)\\2", REGEX_FLAGS_SI); |
| | | private static final Pattern P_UNQUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)(=)([^\"\\s']+)", REGEX_FLAGS_SI); |
| | | private static final Pattern P_PROTOCOL = Pattern.compile("^([^:]+):", REGEX_FLAGS_SI); |
| | | private static final Pattern P_ENTITY = Pattern.compile("&#(\\d+);?"); |
| | | private static final Pattern P_ENTITY_UNICODE = Pattern.compile("&#x([0-9a-f]+);?"); |
| | | private static final Pattern P_ENCODE = Pattern.compile("%([0-9a-f]{2});?"); |
| | | private static final Pattern P_VALID_ENTITIES = Pattern.compile("&([^&;]*)(?=(;|&|$))"); |
| | | private static final Pattern P_VALID_QUOTES = Pattern.compile("(>|^)([^<]+?)(<|$)", Pattern.DOTALL); |
| | | private static final Pattern P_END_ARROW = Pattern.compile("^>"); |
| | | private static final Pattern P_BODY_TO_END = Pattern.compile("<([^>]*?)(?=<|$)"); |
| | | private static final Pattern P_XML_CONTENT = Pattern.compile("(^|>)([^<]*?)(?=>)"); |
| | | private static final Pattern P_STRAY_LEFT_ARROW = Pattern.compile("<([^>]*?)(?=<|$)"); |
| | | private static final Pattern P_STRAY_RIGHT_ARROW = Pattern.compile("(^|>)([^<]*?)(?=>)"); |
| | | private static final Pattern P_AMP = Pattern.compile("&"); |
| | | private static final Pattern P_QUOTE = Pattern.compile("\""); |
| | | private static final Pattern P_LEFT_ARROW = Pattern.compile("<"); |
| | | private static final Pattern P_RIGHT_ARROW = Pattern.compile(">"); |
| | | private static final Pattern P_BOTH_ARROWS = Pattern.compile("<>"); |
| | | |
| | | // @xxx could grow large... maybe use sesat's ReferenceMap |
| | | private static final ConcurrentMap<String, Pattern> P_REMOVE_PAIR_BLANKS = new ConcurrentHashMap<>(); |
| | | private static final ConcurrentMap<String, Pattern> P_REMOVE_SELF_BLANKS = new ConcurrentHashMap<>(); |
| | | |
| | | /** |
| | | * set of allowed html elements, along with allowed attributes for each element |
| | | **/ |
| | | private final Map<String, List<String>> vAllowed; |
| | | /** |
| | | * counts of open tags for each (allowable) html element |
| | | **/ |
| | | private final Map<String, Integer> vTagCounts = new HashMap<>(); |
| | | |
| | | /** |
| | | * html elements which must always be self-closing (e.g. "<img />") |
| | | **/ |
| | | private final String[] vSelfClosingTags; |
| | | /** |
| | | * html elements which must always have separate opening and closing tags (e.g. "<b></b>") |
| | | **/ |
| | | private final String[] vNeedClosingTags; |
| | | /** |
| | | * set of disallowed html elements |
| | | **/ |
| | | private final String[] vDisallowed; |
| | | /** |
| | | * attributes which should be checked for valid protocols |
| | | **/ |
| | | private final String[] vProtocolAtts; |
| | | /** |
| | | * allowed protocols |
| | | **/ |
| | | private final String[] vAllowedProtocols; |
| | | /** |
| | | * tags which should be removed if they contain no content (e.g. "<b></b>" or "<b />") |
| | | **/ |
| | | private final String[] vRemoveBlanks; |
| | | /** |
| | | * entities allowed within html markup |
| | | **/ |
| | | private final String[] vAllowedEntities; |
| | | /** |
| | | * flag determining whether comments are allowed in input String. |
| | | */ |
| | | private final boolean stripComment; |
| | | private final boolean encodeQuotes; |
| | | /** |
| | | * flag determining whether to try to make tags when presented with "unbalanced" angle brackets (e.g. "<b text </b>" |
| | | * becomes "<b> text </b>"). If set to false, unbalanced angle brackets will be html escaped. |
| | | */ |
| | | private final boolean alwaysMakeTags; |
| | | |
| | | /** |
| | | * Default constructor. |
| | | */ |
| | | public HTMLFilter() |
| | | { |
| | | vAllowed = new HashMap<>(); |
| | | |
| | | final ArrayList<String> a_atts = new ArrayList<>(); |
| | | a_atts.add("href"); |
| | | a_atts.add("target"); |
| | | vAllowed.put("a", a_atts); |
| | | |
| | | final ArrayList<String> img_atts = new ArrayList<>(); |
| | | img_atts.add("src"); |
| | | img_atts.add("width"); |
| | | img_atts.add("height"); |
| | | img_atts.add("alt"); |
| | | vAllowed.put("img", img_atts); |
| | | |
| | | final ArrayList<String> no_atts = new ArrayList<>(); |
| | | vAllowed.put("b", no_atts); |
| | | vAllowed.put("strong", no_atts); |
| | | vAllowed.put("i", no_atts); |
| | | vAllowed.put("em", no_atts); |
| | | |
| | | vSelfClosingTags = new String[] { "img" }; |
| | | vNeedClosingTags = new String[] { "a", "b", "strong", "i", "em" }; |
| | | vDisallowed = new String[] {}; |
| | | vAllowedProtocols = new String[] { "http", "mailto", "https" }; // no ftp. |
| | | vProtocolAtts = new String[] { "src", "href" }; |
| | | vRemoveBlanks = new String[] { "a", "b", "strong", "i", "em" }; |
| | | vAllowedEntities = new String[] { "amp", "gt", "lt", "quot" }; |
| | | stripComment = true; |
| | | encodeQuotes = true; |
| | | alwaysMakeTags = false; |
| | | } |
| | | |
| | | /** |
| | | * Map-parameter configurable constructor. |
| | | * |
| | | * @param conf map containing configuration. keys match field names. |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public HTMLFilter(final Map<String, Object> conf) |
| | | { |
| | | |
| | | assert conf.containsKey("vAllowed") : "configuration requires vAllowed"; |
| | | assert conf.containsKey("vSelfClosingTags") : "configuration requires vSelfClosingTags"; |
| | | assert conf.containsKey("vNeedClosingTags") : "configuration requires vNeedClosingTags"; |
| | | assert conf.containsKey("vDisallowed") : "configuration requires vDisallowed"; |
| | | assert conf.containsKey("vAllowedProtocols") : "configuration requires vAllowedProtocols"; |
| | | assert conf.containsKey("vProtocolAtts") : "configuration requires vProtocolAtts"; |
| | | assert conf.containsKey("vRemoveBlanks") : "configuration requires vRemoveBlanks"; |
| | | assert conf.containsKey("vAllowedEntities") : "configuration requires vAllowedEntities"; |
| | | |
| | | vAllowed = Collections.unmodifiableMap((HashMap<String, List<String>>) conf.get("vAllowed")); |
| | | vSelfClosingTags = (String[]) conf.get("vSelfClosingTags"); |
| | | vNeedClosingTags = (String[]) conf.get("vNeedClosingTags"); |
| | | vDisallowed = (String[]) conf.get("vDisallowed"); |
| | | vAllowedProtocols = (String[]) conf.get("vAllowedProtocols"); |
| | | vProtocolAtts = (String[]) conf.get("vProtocolAtts"); |
| | | vRemoveBlanks = (String[]) conf.get("vRemoveBlanks"); |
| | | vAllowedEntities = (String[]) conf.get("vAllowedEntities"); |
| | | stripComment = conf.containsKey("stripComment") ? (Boolean) conf.get("stripComment") : true; |
| | | encodeQuotes = conf.containsKey("encodeQuotes") ? (Boolean) conf.get("encodeQuotes") : true; |
| | | alwaysMakeTags = conf.containsKey("alwaysMakeTags") ? (Boolean) conf.get("alwaysMakeTags") : true; |
| | | } |
| | | |
| | | private void reset() |
| | | { |
| | | vTagCounts.clear(); |
| | | } |
| | | |
| | | // --------------------------------------------------------------- |
| | | // my versions of some PHP library functions |
| | | public static String chr(final int decimal) |
| | | { |
| | | return String.valueOf((char) decimal); |
| | | } |
| | | |
| | | public static String htmlSpecialChars(final String s) |
| | | { |
| | | String result = s; |
| | | result = regexReplace(P_AMP, "&", result); |
| | | result = regexReplace(P_QUOTE, """, result); |
| | | result = regexReplace(P_LEFT_ARROW, "<", result); |
| | | result = regexReplace(P_RIGHT_ARROW, ">", result); |
| | | return result; |
| | | } |
| | | |
| | | // --------------------------------------------------------------- |
| | | |
| | | /** |
| | | * given a user submitted input String, filter out any invalid or restricted html. |
| | | * |
| | | * @param input text (i.e. submitted by a user) than may contain html |
| | | * @return "clean" version of input, with only valid, whitelisted html elements allowed |
| | | */ |
| | | public String filter(final String input) |
| | | { |
| | | reset(); |
| | | String s = input; |
| | | |
| | | s = escapeComments(s); |
| | | |
| | | s = balanceHTML(s); |
| | | |
| | | s = checkTags(s); |
| | | |
| | | s = processRemoveBlanks(s); |
| | | |
| | | // s = validateEntities(s); |
| | | |
| | | return s; |
| | | } |
| | | |
| | | public boolean isAlwaysMakeTags() |
| | | { |
| | | return alwaysMakeTags; |
| | | } |
| | | |
| | | public boolean isStripComments() |
| | | { |
| | | return stripComment; |
| | | } |
| | | |
| | | private String escapeComments(final String s) |
| | | { |
| | | final Matcher m = P_COMMENTS.matcher(s); |
| | | final StringBuffer buf = new StringBuffer(); |
| | | if (m.find()) |
| | | { |
| | | final String match = m.group(1); // (.*?) |
| | | m.appendReplacement(buf, Matcher.quoteReplacement("<!--" + htmlSpecialChars(match) + "-->")); |
| | | } |
| | | m.appendTail(buf); |
| | | |
| | | return buf.toString(); |
| | | } |
| | | |
| | | private String balanceHTML(String s) |
| | | { |
| | | if (alwaysMakeTags) |
| | | { |
| | | // |
| | | // try and form html |
| | | // |
| | | s = regexReplace(P_END_ARROW, "", s); |
| | | // 不追加结束标签 |
| | | s = regexReplace(P_BODY_TO_END, "<$1>", s); |
| | | s = regexReplace(P_XML_CONTENT, "$1<$2", s); |
| | | |
| | | } |
| | | else |
| | | { |
| | | // |
| | | // escape stray brackets |
| | | // |
| | | s = regexReplace(P_STRAY_LEFT_ARROW, "<$1", s); |
| | | s = regexReplace(P_STRAY_RIGHT_ARROW, "$1$2><", s); |
| | | |
| | | // |
| | | // the last regexp causes '<>' entities to appear |
| | | // (we need to do a lookahead assertion so that the last bracket can |
| | | // be used in the next pass of the regexp) |
| | | // |
| | | s = regexReplace(P_BOTH_ARROWS, "", s); |
| | | } |
| | | |
| | | return s; |
| | | } |
| | | |
| | | private String checkTags(String s) |
| | | { |
| | | Matcher m = P_TAGS.matcher(s); |
| | | |
| | | final StringBuffer buf = new StringBuffer(); |
| | | while (m.find()) |
| | | { |
| | | String replaceStr = m.group(1); |
| | | replaceStr = processTag(replaceStr); |
| | | m.appendReplacement(buf, Matcher.quoteReplacement(replaceStr)); |
| | | } |
| | | m.appendTail(buf); |
| | | |
| | | // these get tallied in processTag |
| | | // (remember to reset before subsequent calls to filter method) |
| | | final StringBuilder sBuilder = new StringBuilder(buf.toString()); |
| | | for (String key : vTagCounts.keySet()) |
| | | { |
| | | for (int ii = 0; ii < vTagCounts.get(key); ii++) |
| | | { |
| | | sBuilder.append("</").append(key).append(">"); |
| | | } |
| | | } |
| | | s = sBuilder.toString(); |
| | | |
| | | return s; |
| | | } |
| | | |
| | | private String processRemoveBlanks(final String s) |
| | | { |
| | | String result = s; |
| | | for (String tag : vRemoveBlanks) |
| | | { |
| | | if (!P_REMOVE_PAIR_BLANKS.containsKey(tag)) |
| | | { |
| | | P_REMOVE_PAIR_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?></" + tag + ">")); |
| | | } |
| | | result = regexReplace(P_REMOVE_PAIR_BLANKS.get(tag), "", result); |
| | | if (!P_REMOVE_SELF_BLANKS.containsKey(tag)) |
| | | { |
| | | P_REMOVE_SELF_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?/>")); |
| | | } |
| | | result = regexReplace(P_REMOVE_SELF_BLANKS.get(tag), "", result); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | private static String regexReplace(final Pattern regex_pattern, final String replacement, final String s) |
| | | { |
| | | Matcher m = regex_pattern.matcher(s); |
| | | return m.replaceAll(replacement); |
| | | } |
| | | |
| | | private String processTag(final String s) |
| | | { |
| | | // ending tags |
| | | Matcher m = P_END_TAG.matcher(s); |
| | | if (m.find()) |
| | | { |
| | | final String name = m.group(1).toLowerCase(); |
| | | if (allowed(name)) |
| | | { |
| | | if (false == inArray(name, vSelfClosingTags)) |
| | | { |
| | | if (vTagCounts.containsKey(name)) |
| | | { |
| | | vTagCounts.put(name, vTagCounts.get(name) - 1); |
| | | return "</" + name + ">"; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // starting tags |
| | | m = P_START_TAG.matcher(s); |
| | | if (m.find()) |
| | | { |
| | | final String name = m.group(1).toLowerCase(); |
| | | final String body = m.group(2); |
| | | String ending = m.group(3); |
| | | |
| | | // debug( "in a starting tag, name='" + name + "'; body='" + body + "'; ending='" + ending + "'" ); |
| | | if (allowed(name)) |
| | | { |
| | | final StringBuilder params = new StringBuilder(); |
| | | |
| | | final Matcher m2 = P_QUOTED_ATTRIBUTES.matcher(body); |
| | | final Matcher m3 = P_UNQUOTED_ATTRIBUTES.matcher(body); |
| | | final List<String> paramNames = new ArrayList<>(); |
| | | final List<String> paramValues = new ArrayList<>(); |
| | | while (m2.find()) |
| | | { |
| | | paramNames.add(m2.group(1)); // ([a-z0-9]+) |
| | | paramValues.add(m2.group(3)); // (.*?) |
| | | } |
| | | while (m3.find()) |
| | | { |
| | | paramNames.add(m3.group(1)); // ([a-z0-9]+) |
| | | paramValues.add(m3.group(3)); // ([^\"\\s']+) |
| | | } |
| | | |
| | | String paramName, paramValue; |
| | | for (int ii = 0; ii < paramNames.size(); ii++) |
| | | { |
| | | paramName = paramNames.get(ii).toLowerCase(); |
| | | paramValue = paramValues.get(ii); |
| | | |
| | | // debug( "paramName='" + paramName + "'" ); |
| | | // debug( "paramValue='" + paramValue + "'" ); |
| | | // debug( "allowed? " + vAllowed.get( name ).contains( paramName ) ); |
| | | |
| | | if (allowedAttribute(name, paramName)) |
| | | { |
| | | if (inArray(paramName, vProtocolAtts)) |
| | | { |
| | | paramValue = processParamProtocol(paramValue); |
| | | } |
| | | params.append(' ').append(paramName).append("=\"").append(paramValue).append("\""); |
| | | } |
| | | } |
| | | |
| | | if (inArray(name, vSelfClosingTags)) |
| | | { |
| | | ending = " /"; |
| | | } |
| | | |
| | | if (inArray(name, vNeedClosingTags)) |
| | | { |
| | | ending = ""; |
| | | } |
| | | |
| | | if (ending == null || ending.length() < 1) |
| | | { |
| | | if (vTagCounts.containsKey(name)) |
| | | { |
| | | vTagCounts.put(name, vTagCounts.get(name) + 1); |
| | | } |
| | | else |
| | | { |
| | | vTagCounts.put(name, 1); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | ending = " /"; |
| | | } |
| | | return "<" + name + params + ending + ">"; |
| | | } |
| | | else |
| | | { |
| | | return ""; |
| | | } |
| | | } |
| | | |
| | | // comments |
| | | m = P_COMMENT.matcher(s); |
| | | if (!stripComment && m.find()) |
| | | { |
| | | return "<" + m.group() + ">"; |
| | | } |
| | | |
| | | return ""; |
| | | } |
| | | |
| | | private String processParamProtocol(String s) |
| | | { |
| | | s = decodeEntities(s); |
| | | final Matcher m = P_PROTOCOL.matcher(s); |
| | | if (m.find()) |
| | | { |
| | | final String protocol = m.group(1); |
| | | if (!inArray(protocol, vAllowedProtocols)) |
| | | { |
| | | // bad protocol, turn into local anchor link instead |
| | | s = "#" + s.substring(protocol.length() + 1); |
| | | if (s.startsWith("#//")) |
| | | { |
| | | s = "#" + s.substring(3); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return s; |
| | | } |
| | | |
| | | private String decodeEntities(String s) |
| | | { |
| | | StringBuffer buf = new StringBuffer(); |
| | | |
| | | Matcher m = P_ENTITY.matcher(s); |
| | | while (m.find()) |
| | | { |
| | | final String match = m.group(1); |
| | | final int decimal = Integer.decode(match).intValue(); |
| | | m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); |
| | | } |
| | | m.appendTail(buf); |
| | | s = buf.toString(); |
| | | |
| | | buf = new StringBuffer(); |
| | | m = P_ENTITY_UNICODE.matcher(s); |
| | | while (m.find()) |
| | | { |
| | | final String match = m.group(1); |
| | | final int decimal = Integer.valueOf(match, 16).intValue(); |
| | | m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); |
| | | } |
| | | m.appendTail(buf); |
| | | s = buf.toString(); |
| | | |
| | | buf = new StringBuffer(); |
| | | m = P_ENCODE.matcher(s); |
| | | while (m.find()) |
| | | { |
| | | final String match = m.group(1); |
| | | final int decimal = Integer.valueOf(match, 16).intValue(); |
| | | m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); |
| | | } |
| | | m.appendTail(buf); |
| | | s = buf.toString(); |
| | | |
| | | s = validateEntities(s); |
| | | return s; |
| | | } |
| | | |
| | | private String validateEntities(final String s) |
| | | { |
| | | StringBuffer buf = new StringBuffer(); |
| | | |
| | | // validate entities throughout the string |
| | | Matcher m = P_VALID_ENTITIES.matcher(s); |
| | | while (m.find()) |
| | | { |
| | | final String one = m.group(1); // ([^&;]*) |
| | | final String two = m.group(2); // (?=(;|&|$)) |
| | | m.appendReplacement(buf, Matcher.quoteReplacement(checkEntity(one, two))); |
| | | } |
| | | m.appendTail(buf); |
| | | |
| | | return encodeQuotes(buf.toString()); |
| | | } |
| | | |
| | | private String encodeQuotes(final String s) |
| | | { |
| | | if (encodeQuotes) |
| | | { |
| | | StringBuffer buf = new StringBuffer(); |
| | | Matcher m = P_VALID_QUOTES.matcher(s); |
| | | while (m.find()) |
| | | { |
| | | final String one = m.group(1); // (>|^) |
| | | final String two = m.group(2); // ([^<]+?) |
| | | final String three = m.group(3); // (<|$) |
| | | // 不替换双引号为",防止json格式无效 regexReplace(P_QUOTE, """, two) |
| | | m.appendReplacement(buf, Matcher.quoteReplacement(one + two + three)); |
| | | } |
| | | m.appendTail(buf); |
| | | return buf.toString(); |
| | | } |
| | | else |
| | | { |
| | | return s; |
| | | } |
| | | } |
| | | |
| | | private String checkEntity(final String preamble, final String term) |
| | | { |
| | | |
| | | return ";".equals(term) && isValidEntity(preamble) ? '&' + preamble : "&" + preamble; |
| | | } |
| | | |
| | | private boolean isValidEntity(final String entity) |
| | | { |
| | | return inArray(entity, vAllowedEntities); |
| | | } |
| | | |
| | | private static boolean inArray(final String s, final String[] array) |
| | | { |
| | | for (String item : array) |
| | | { |
| | | if (item != null && item.equals(s)) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private boolean allowed(final String name) |
| | | { |
| | | return (vAllowed.isEmpty() || vAllowed.containsKey(name)) && !inArray(name, vDisallowed); |
| | | } |
| | | |
| | | private boolean allowedAttribute(final String name, final String paramName) |
| | | { |
| | | return allowed(name) && (vAllowed.isEmpty() || vAllowed.get(name).contains(paramName)); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | import org.apache.commons.lang3.exception.ExceptionUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import javax.servlet.ServletRequest; |
| | | import java.io.BufferedReader; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.nio.charset.Charset; |
| | | |
| | | /** |
| | | * 通用http工具封装 |
| | | * |
| | | * @author huanghongfa |
| | | */ |
| | | public class HttpHelper |
| | | { |
| | | private static final Logger LOGGER = LoggerFactory.getLogger(HttpHelper.class); |
| | | |
| | | public static String getBodyString(ServletRequest request) |
| | | { |
| | | StringBuilder sb = new StringBuilder(); |
| | | BufferedReader reader = null; |
| | | try (InputStream inputStream = request.getInputStream()) |
| | | { |
| | | reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("UTF-8"))); |
| | | String line = ""; |
| | | while ((line = reader.readLine()) != null) |
| | | { |
| | | sb.append(line); |
| | | } |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | LOGGER.warn("getBodyString出现问题!"); |
| | | } |
| | | finally |
| | | { |
| | | if (reader != null) |
| | | { |
| | | try |
| | | { |
| | | reader.close(); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | LOGGER.error(ExceptionUtils.getMessage(e)); |
| | | } |
| | | } |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | import com.panzhihua.common.constants.Constants; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import javax.net.ssl.*; |
| | | import java.io.*; |
| | | import java.net.ConnectException; |
| | | import java.net.SocketTimeoutException; |
| | | import java.net.URL; |
| | | import java.net.URLConnection; |
| | | import java.security.cert.X509Certificate; |
| | | |
| | | /** |
| | | * 通用http发送方法 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class HttpUtils |
| | | { |
| | | private static final Logger log = LoggerFactory.getLogger(HttpUtils.class); |
| | | |
| | | /** |
| | | * 向指定 URL 发送GET方法的请求 |
| | | * |
| | | * @param url 发送请求的 URL |
| | | * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 |
| | | * @return 所代表远程资源的响应结果 |
| | | */ |
| | | public static String sendGet(String url, String param) |
| | | { |
| | | return sendGet(url, param, Constants.UTF8); |
| | | } |
| | | |
| | | /** |
| | | * 向指定 URL 发送GET方法的请求 |
| | | * |
| | | * @param url 发送请求的 URL |
| | | * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 |
| | | * @param contentType 编码类型 |
| | | * @return 所代表远程资源的响应结果 |
| | | */ |
| | | public static String sendGet(String url, String param, String contentType) |
| | | { |
| | | StringBuilder result = new StringBuilder(); |
| | | BufferedReader in = null; |
| | | try |
| | | { |
| | | String urlNameString = url + "?" + param; |
| | | log.info("sendGet - {}", urlNameString); |
| | | URL realUrl = new URL(urlNameString); |
| | | URLConnection connection = realUrl.openConnection(); |
| | | connection.setRequestProperty("accept", "*/*"); |
| | | connection.setRequestProperty("connection", "Keep-Alive"); |
| | | connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); |
| | | connection.connect(); |
| | | in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType)); |
| | | String line; |
| | | while ((line = in.readLine()) != null) |
| | | { |
| | | result.append(line); |
| | | } |
| | | log.info("recv - {}", result); |
| | | } |
| | | catch (ConnectException e) |
| | | { |
| | | log.error("调用HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (SocketTimeoutException e) |
| | | { |
| | | log.error("调用HttpUtils.sendGet SocketTimeoutException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | log.error("调用HttpUtils.sendGet IOException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("调用HttpsUtil.sendGet Exception, url=" + url + ",param=" + param, e); |
| | | } |
| | | finally |
| | | { |
| | | try |
| | | { |
| | | if (in != null) |
| | | { |
| | | in.close(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); |
| | | } |
| | | } |
| | | return result.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 向指定 URL 发送POST方法的请求 |
| | | * |
| | | * @param url 发送请求的 URL |
| | | * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 |
| | | * @return 所代表远程资源的响应结果 |
| | | */ |
| | | public static String sendPost(String url, String param) |
| | | { |
| | | PrintWriter out = null; |
| | | BufferedReader in = null; |
| | | StringBuilder result = new StringBuilder(); |
| | | try |
| | | { |
| | | String urlNameString = url; |
| | | log.info("sendPost - {}", urlNameString); |
| | | URL realUrl = new URL(urlNameString); |
| | | URLConnection conn = realUrl.openConnection(); |
| | | conn.setRequestProperty("accept", "*/*"); |
| | | conn.setRequestProperty("connection", "Keep-Alive"); |
| | | conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); |
| | | conn.setRequestProperty("Accept-Charset", "utf-8"); |
| | | conn.setRequestProperty("contentType", "utf-8"); |
| | | conn.setDoOutput(true); |
| | | conn.setDoInput(true); |
| | | out = new PrintWriter(conn.getOutputStream()); |
| | | out.print(param); |
| | | out.flush(); |
| | | in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8")); |
| | | String line; |
| | | while ((line = in.readLine()) != null) |
| | | { |
| | | result.append(line); |
| | | } |
| | | log.info("recv - {}", result); |
| | | } |
| | | catch (ConnectException e) |
| | | { |
| | | log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (SocketTimeoutException e) |
| | | { |
| | | log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e); |
| | | } |
| | | finally |
| | | { |
| | | try |
| | | { |
| | | if (out != null) |
| | | { |
| | | out.close(); |
| | | } |
| | | if (in != null) |
| | | { |
| | | in.close(); |
| | | } |
| | | } |
| | | catch (IOException ex) |
| | | { |
| | | log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); |
| | | } |
| | | } |
| | | return result.toString(); |
| | | } |
| | | |
| | | public static String sendSSLPost(String url, String param) |
| | | { |
| | | StringBuilder result = new StringBuilder(); |
| | | String urlNameString = url + "?" + param; |
| | | try |
| | | { |
| | | log.info("sendSSLPost - {}", urlNameString); |
| | | SSLContext sc = SSLContext.getInstance("SSL"); |
| | | sc.init(null, new TrustManager[] { new TrustAnyTrustManager() }, new java.security.SecureRandom()); |
| | | URL console = new URL(urlNameString); |
| | | HttpsURLConnection conn = (HttpsURLConnection) console.openConnection(); |
| | | conn.setRequestProperty("accept", "*/*"); |
| | | conn.setRequestProperty("connection", "Keep-Alive"); |
| | | conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); |
| | | conn.setRequestProperty("Accept-Charset", "utf-8"); |
| | | conn.setRequestProperty("contentType", "utf-8"); |
| | | conn.setDoOutput(true); |
| | | conn.setDoInput(true); |
| | | |
| | | conn.setSSLSocketFactory(sc.getSocketFactory()); |
| | | conn.setHostnameVerifier(new TrustAnyHostnameVerifier()); |
| | | conn.connect(); |
| | | InputStream is = conn.getInputStream(); |
| | | BufferedReader br = new BufferedReader(new InputStreamReader(is)); |
| | | String ret = ""; |
| | | while ((ret = br.readLine()) != null) |
| | | { |
| | | if (ret != null && !"".equals(ret.trim())) |
| | | { |
| | | result.append(new String(ret.getBytes("ISO-8859-1"), "utf-8")); |
| | | } |
| | | } |
| | | log.info("recv - {}", result); |
| | | conn.disconnect(); |
| | | br.close(); |
| | | } |
| | | catch (ConnectException e) |
| | | { |
| | | log.error("调用HttpUtils.sendSSLPost ConnectException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (SocketTimeoutException e) |
| | | { |
| | | log.error("调用HttpUtils.sendSSLPost SocketTimeoutException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | log.error("调用HttpUtils.sendSSLPost IOException, url=" + url + ",param=" + param, e); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | log.error("调用HttpsUtil.sendSSLPost Exception, url=" + url + ",param=" + param, e); |
| | | } |
| | | return result.toString(); |
| | | } |
| | | |
| | | private static class TrustAnyTrustManager implements X509TrustManager |
| | | { |
| | | @Override |
| | | public void checkClientTrusted(X509Certificate[] chain, String authType) |
| | | { |
| | | } |
| | | |
| | | @Override |
| | | public void checkServerTrusted(X509Certificate[] chain, String authType) |
| | | { |
| | | } |
| | | |
| | | @Override |
| | | public X509Certificate[] getAcceptedIssuers() |
| | | { |
| | | return new X509Certificate[] {}; |
| | | } |
| | | } |
| | | |
| | | private static class TrustAnyHostnameVerifier implements HostnameVerifier |
| | | { |
| | | @Override |
| | | public boolean verify(String hostname, SSLSession session) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.net.InetAddress; |
| | | import java.net.UnknownHostException; |
| | | |
| | | /** |
| | | * 获取IP方法 |
| | | * |
| | | * @author huanghongfa |
| | | */ |
| | | public class IpUtils |
| | | { |
| | | public static String getIpAddr(HttpServletRequest request) |
| | | { |
| | | if (request == null) |
| | | { |
| | | return "unknown"; |
| | | } |
| | | String ip = request.getHeader("x-forwarded-for"); |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) |
| | | { |
| | | ip = request.getHeader("Proxy-Client-IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) |
| | | { |
| | | ip = request.getHeader("X-Forwarded-For"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) |
| | | { |
| | | ip = request.getHeader("WL-Proxy-Client-IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) |
| | | { |
| | | ip = request.getHeader("X-Real-IP"); |
| | | } |
| | | |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) |
| | | { |
| | | ip = request.getRemoteAddr(); |
| | | } |
| | | return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : EscapeUtil.clean(ip); |
| | | } |
| | | |
| | | public static boolean internalIp(String ip) |
| | | { |
| | | byte[] addr = textToNumericFormatV4(ip); |
| | | return internalIp(addr) || "127.0.0.1".equals(ip); |
| | | } |
| | | |
| | | private static boolean internalIp(byte[] addr) |
| | | { |
| | | if (StringUtils.isNull(addr) || addr.length < 2) |
| | | { |
| | | return true; |
| | | } |
| | | final byte b0 = addr[0]; |
| | | final byte b1 = addr[1]; |
| | | // 10.x.x.x/8 |
| | | final byte SECTION_1 = 0x0A; |
| | | // 172.16.x.x/12 |
| | | final byte SECTION_2 = (byte) 0xAC; |
| | | final byte SECTION_3 = (byte) 0x10; |
| | | final byte SECTION_4 = (byte) 0x1F; |
| | | // 192.168.x.x/16 |
| | | final byte SECTION_5 = (byte) 0xC0; |
| | | final byte SECTION_6 = (byte) 0xA8; |
| | | switch (b0) |
| | | { |
| | | case SECTION_1: |
| | | return true; |
| | | case SECTION_2: |
| | | if (b1 >= SECTION_3 && b1 <= SECTION_4) |
| | | { |
| | | return true; |
| | | } |
| | | case SECTION_5: |
| | | switch (b1) |
| | | { |
| | | case SECTION_6: |
| | | return true; |
| | | } |
| | | default: |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 将IPv4地址转换成字节 |
| | | * |
| | | * @param text IPv4地址 |
| | | * @return byte 字节 |
| | | */ |
| | | public static byte[] textToNumericFormatV4(String text) |
| | | { |
| | | if (text.length() == 0) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | byte[] bytes = new byte[4]; |
| | | String[] elements = text.split("\\.", -1); |
| | | try |
| | | { |
| | | long l; |
| | | int i; |
| | | switch (elements.length) |
| | | { |
| | | case 1: |
| | | l = Long.parseLong(elements[0]); |
| | | if ((l < 0L) || (l > 4294967295L)) { |
| | | return null; |
| | | } |
| | | bytes[0] = (byte) (int) (l >> 24 & 0xFF); |
| | | bytes[1] = (byte) (int) ((l & 0xFFFFFF) >> 16 & 0xFF); |
| | | bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); |
| | | bytes[3] = (byte) (int) (l & 0xFF); |
| | | break; |
| | | case 2: |
| | | l = Integer.parseInt(elements[0]); |
| | | if ((l < 0L) || (l > 255L)) { |
| | | return null; |
| | | } |
| | | bytes[0] = (byte) (int) (l & 0xFF); |
| | | l = Integer.parseInt(elements[1]); |
| | | if ((l < 0L) || (l > 16777215L)) { |
| | | return null; |
| | | } |
| | | bytes[1] = (byte) (int) (l >> 16 & 0xFF); |
| | | bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); |
| | | bytes[3] = (byte) (int) (l & 0xFF); |
| | | break; |
| | | case 3: |
| | | for (i = 0; i < 2; ++i) |
| | | { |
| | | l = Integer.parseInt(elements[i]); |
| | | if ((l < 0L) || (l > 255L)) { |
| | | return null; |
| | | } |
| | | bytes[i] = (byte) (int) (l & 0xFF); |
| | | } |
| | | l = Integer.parseInt(elements[2]); |
| | | if ((l < 0L) || (l > 65535L)) { |
| | | return null; |
| | | } |
| | | bytes[2] = (byte) (int) (l >> 8 & 0xFF); |
| | | bytes[3] = (byte) (int) (l & 0xFF); |
| | | break; |
| | | case 4: |
| | | for (i = 0; i < 4; ++i) |
| | | { |
| | | l = Integer.parseInt(elements[i]); |
| | | if ((l < 0L) || (l > 255L)) { |
| | | return null; |
| | | } |
| | | bytes[i] = (byte) (int) (l & 0xFF); |
| | | } |
| | | break; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | catch (NumberFormatException e) |
| | | { |
| | | return null; |
| | | } |
| | | return bytes; |
| | | } |
| | | |
| | | public static String getHostIp() |
| | | { |
| | | try |
| | | { |
| | | return InetAddress.getLocalHost().getHostAddress(); |
| | | } |
| | | catch (UnknownHostException e) |
| | | { |
| | | } |
| | | return "127.0.0.1"; |
| | | } |
| | | |
| | | public static String getHostName() |
| | | { |
| | | try |
| | | { |
| | | return InetAddress.getLocalHost().getHostName(); |
| | | } |
| | | catch (UnknownHostException e) |
| | | { |
| | | } |
| | | return "未知"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | |
| | | import com.panzhihua.common.constants.TokenConstant; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import io.jsonwebtoken.Claims; |
| | | import io.jsonwebtoken.Jwts; |
| | | import io.jsonwebtoken.SignatureAlgorithm; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * token验证处理 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Component |
| | | public class JWTTokenUtil implements Serializable { |
| | | /** |
| | | * 从数据声明生成令牌 |
| | | * |
| | | * @param claims 数据声明 |
| | | * @return 令牌 |
| | | */ |
| | | private static String generateToken(Map<String, Object> claims) { |
| | | Date expirationDate = new Date(System.currentTimeMillis() + TokenConstant.EXPIRETIME*60*1000); |
| | | return Jwts.builder().setClaims(claims).setExpiration(expirationDate).signWith(SignatureAlgorithm.HS512, TokenConstant.SECRET).compact(); |
| | | } |
| | | |
| | | /** |
| | | * 生成刷新token |
| | | * @param claims tokenbody |
| | | * @return refreshtoken |
| | | */ |
| | | private static String generateTokenRefreshToken(Map<String, Object> claims) { |
| | | Date expirationDate = new Date(System.currentTimeMillis() + TokenConstant.EXPIRETIME_REFRESH*60*60*1000); |
| | | return Jwts.builder().setClaims(claims).setExpiration(expirationDate).signWith(SignatureAlgorithm.HS512, TokenConstant.SECRET).compact(); |
| | | } |
| | | /** |
| | | * 从令牌中获取数据声明 |
| | | * |
| | | * @param token 令牌 |
| | | * @return 数据声明 |
| | | */ |
| | | public static Claims getClaimsFromToken(String token) { |
| | | Claims claims; |
| | | try { |
| | | claims = Jwts.parser().setSigningKey(TokenConstant.SECRET).parseClaimsJws(token).getBody(); |
| | | } catch (Exception e) { |
| | | claims = null; |
| | | } |
| | | return claims; |
| | | } |
| | | |
| | | /** |
| | | * 生成令牌 |
| | | * |
| | | * @param loginUserInfoVO 用户 |
| | | * @return 令牌 |
| | | */ |
| | | public static String generateToken(LoginUserInfoVO loginUserInfoVO) { |
| | | Map<String, Object> claims = new HashMap<>(2); |
| | | claims.put("sub", loginUserInfoVO.getUserId()); |
| | | claims.put("created", new Date()); |
| | | claims.put("type", loginUserInfoVO.getType()); |
| | | return generateToken(claims); |
| | | } |
| | | |
| | | /** |
| | | * 从令牌中获取用户名 |
| | | * |
| | | * @param token 令牌 |
| | | * @return 用户名 |
| | | */ |
| | | public static String getUsernameFromToken(String token) { |
| | | String username; |
| | | try { |
| | | Claims claims = getClaimsFromToken(token); |
| | | username = claims.getSubject(); |
| | | } catch (Exception e) { |
| | | username = null; |
| | | } |
| | | return username; |
| | | } |
| | | |
| | | /** |
| | | * 判断令牌是否过期 |
| | | * |
| | | * @param token 令牌 |
| | | * @return 是否过期 |
| | | */ |
| | | public static Boolean isTokenExpired(String token) { |
| | | try { |
| | | Claims claims = getClaimsFromToken(token); |
| | | Date expiration = claims.getExpiration(); |
| | | return expiration.before(new Date()); |
| | | } catch (Exception e) { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 刷新令牌 |
| | | * |
| | | * @param token 原令牌 |
| | | * @return 新令牌 |
| | | */ |
| | | public static String refreshToken(String token) { |
| | | String refreshedToken; |
| | | try { |
| | | Claims claims = getClaimsFromToken(token); |
| | | claims.put("created", new Date()); |
| | | refreshedToken = generateToken(claims); |
| | | } catch (Exception e) { |
| | | refreshedToken = null; |
| | | } |
| | | return refreshedToken; |
| | | } |
| | | |
| | | /** |
| | | * 验证令牌 |
| | | * |
| | | * @param token 令牌 |
| | | * @param loginUserInfoVO 用户 |
| | | * @return 是否有效 |
| | | */ |
| | | public static Boolean validateToken(String token, LoginUserInfoVO loginUserInfoVO) { |
| | | String username = getUsernameFromToken(token); |
| | | return (username.equals(loginUserInfoVO.getUserId()) && !isTokenExpired(token)); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | Claims claims = JWTTokenUtil.getClaimsFromToken("eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOjIsInR5cGUiOjEsImV4cCI6MTYwNjM1NzkzOSwiY3JlYXRlZCI6MTYwNjM1NjEzOTEzN30.zIj31TLHk4B9F45OszrJWfOlhZL5CWviP2RgsFP6LZuci6MlPn0iVbekioP01DRsu59mWd5FMyhd9WLvMtfxMg"); |
| | | Boolean tokenExpired = JWTTokenUtil.isTokenExpired("eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOjIsInR5cGUiOjEsImV4cCI6MTYwNjM2MDQzNSwiY3JlYXRlZCI6MTYwNjM1ODYzNTI3MX0.7R3SG6hu-sr_KiPpgepubl_1FdaooCNJ0URHWv6Jynr7m8JIar2kUAnhHfWOfHrNILQb5Q-nqxceXdavcuVOXg"); |
| | | System.out.println(claims); |
| | | } |
| | | |
| | | /** |
| | | * 生成刷新token |
| | | * @param loginUserInfoVO 登录用户基本信息 |
| | | * @return refreshtoken |
| | | */ |
| | | public static String generateRefeshToken(LoginUserInfoVO loginUserInfoVO) { |
| | | Map<String, Object> claims = new HashMap<>(2); |
| | | claims.put("sub", loginUserInfoVO.getUserId()); |
| | | claims.put("created", new Date()); |
| | | claims.put("type", loginUserInfoVO.getType()); |
| | | return generateTokenRefreshToken(claims); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | /** |
| | | * 处理并记录日志文件 |
| | | * |
| | | * @author huanghongfa |
| | | */ |
| | | public class LogUtils |
| | | { |
| | | public static String getBlock(Object msg) |
| | | { |
| | | if (msg == null) |
| | | { |
| | | msg = ""; |
| | | } |
| | | return "[" + msg.toString() + "]"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | import org.springframework.context.MessageSource; |
| | | import org.springframework.context.i18n.LocaleContextHolder; |
| | | |
| | | /** |
| | | * 获取i18n资源文件 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class MessageUtils |
| | | { |
| | | /** |
| | | * 根据消息键和参数 获取消息 委托给spring messageSource |
| | | * |
| | | * @param code 消息键 |
| | | * @param args 参数 |
| | | * @return 获取国际化翻译值 |
| | | */ |
| | | public static String message(String code, Object... args) |
| | | { |
| | | MessageSource messageSource = SpringUtils.getBean(MessageSource.class); |
| | | return messageSource.getMessage(code, args, LocaleContextHolder.getLocale()); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 返回json |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 16:03 |
| | | **/ |
| | | @Slf4j |
| | | public class ResultUtil { |
| | | |
| | | public static void responseJson(HttpServletResponse httpServletResponse,Object object){ |
| | | try { |
| | | httpServletResponse.setContentType("application/json;charset=utf-8"); |
| | | httpServletResponse.getWriter().write(JSONObject.toJSONString(object)); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | log.error("返回数据到前端失败"); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | import com.jcraft.jsch.*; |
| | | import com.panzhihua.common.constants.FtpConstants; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | | import java.io.*; |
| | | import java.util.Properties; |
| | | import java.util.Vector; |
| | | |
| | | /** |
| | | * @version 1.0.0 |
| | | * @ClassName: SFTPUtil |
| | | * @Description: sftp连接工具类 |
| | | */ |
| | | public class SFTPUtil { |
| | | private transient Logger log = LoggerFactory.getLogger(this.getClass()); |
| | | |
| | | private ChannelSftp sftp; |
| | | |
| | | private Session session; |
| | | |
| | | // FTP 登录用户名 |
| | | private String userName; |
| | | // FTP 登录密码 |
| | | private String password; |
| | | // FTP 服务器地址IP地址 |
| | | private String host; |
| | | // FTP 端口 |
| | | private int port; |
| | | |
| | | /** |
| | | * 构造基于密码认证的sftp对象 |
| | | * |
| | | * @param userName |
| | | * @param password |
| | | * @param host |
| | | * @param port |
| | | */ |
| | | public SFTPUtil(String userName, String password, String host, int port) { |
| | | this.userName = userName; |
| | | this.password = password; |
| | | this.host = host; |
| | | this.port = port; |
| | | } |
| | | |
| | | public SFTPUtil() { |
| | | this.userName = FtpConstants.FTPUSERNAME; |
| | | this.password = FtpConstants.FTPPASSWORD; |
| | | this.host = FtpConstants.FTPHOST; |
| | | this.port = FtpConstants.FTPPORT; |
| | | } |
| | | |
| | | /** |
| | | * 连接sftp服务器 |
| | | * |
| | | * @throws Exception |
| | | */ |
| | | public void login() { |
| | | try { |
| | | JSch jsch = new JSch(); |
| | | log.info("sftp connect by host:{} username:{}", host, userName); |
| | | |
| | | session = jsch.getSession(userName, host, port); |
| | | log.info("Session is build"); |
| | | if (password != null) { |
| | | session.setPassword(password); |
| | | } |
| | | Properties config = new Properties(); |
| | | config.put("StrictHostKeyChecking", "no"); |
| | | |
| | | session.setConfig(config); |
| | | session.connect(); |
| | | log.info("Session is connected"); |
| | | |
| | | Channel channel = session.openChannel("sftp"); |
| | | channel.connect(); |
| | | log.info("channel is connected"); |
| | | |
| | | sftp = (ChannelSftp) channel; |
| | | log.info(String.format("sftp server host:[%s] port:[%s] is connect successfull", host, port)); |
| | | } catch (JSchException e) { |
| | | log.error("Cannot connect to specified sftp server : {}:{} \n Exception message is: {}", new Object[]{host, port, e.getMessage()}); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 关闭连接 server |
| | | */ |
| | | public void logout() { |
| | | if (sftp != null) { |
| | | if (sftp.isConnected()) { |
| | | sftp.disconnect(); |
| | | log.info("sftp is closed already"); |
| | | } |
| | | } |
| | | if (session != null) { |
| | | if (session.isConnected()) { |
| | | session.disconnect(); |
| | | log.info("sshSession is closed already"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 递归根据路径创建文件夹 |
| | | * |
| | | * @param dirs 根据 / 分隔后的数组文件夹名称 |
| | | * @param tempPath 拼接路径 |
| | | * @param length 文件夹的格式 |
| | | * @param index 数组下标 |
| | | * @return |
| | | */ |
| | | public void mkdirDir(String[] dirs, String tempPath, int length, int index) { |
| | | // 以"/a/b/c/d"为例按"/"分隔后,第0位是"";顾下标从1开始 |
| | | index++; |
| | | if (index < length) { |
| | | // 目录不存在,则创建文件夹 |
| | | tempPath += "/" + dirs[index]; |
| | | } |
| | | try { |
| | | log.info("检测目录[" + tempPath + "]"); |
| | | sftp.cd(tempPath); |
| | | if (index < length) { |
| | | mkdirDir(dirs, tempPath, length, index); |
| | | } |
| | | } catch (SftpException ex) { |
| | | log.warn("创建目录[" + tempPath + "]"); |
| | | try { |
| | | sftp.mkdir(tempPath); |
| | | sftp.cd(tempPath); |
| | | } catch (SftpException e) { |
| | | e.printStackTrace(); |
| | | log.error("创建目录[" + tempPath + "]失败,异常信息[" + e.getMessage() + "]"); |
| | | |
| | | } |
| | | log.info("进入目录[" + tempPath + "]"); |
| | | mkdirDir(dirs, tempPath, length, index); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 将输入流的数据上传到sftp作为文件(多层目录) |
| | | * |
| | | * @param directory 上传到该目录(多层目录) |
| | | * @param sftpFileName sftp端文件名 |
| | | * @param input 输入流 |
| | | * @throws SftpException |
| | | * @throws Exception |
| | | */ |
| | | public void uploadMore(String directory, String sftpFileName, InputStream input) throws SftpException { |
| | | try { |
| | | sftp.cd(directory); |
| | | } catch (SftpException e) { |
| | | // 目录不存在,则创建文件夹 |
| | | String[] dirs = directory.split("/"); |
| | | String tempPath = ""; |
| | | int index = 0; |
| | | mkdirDir(dirs, tempPath, dirs.length, index); |
| | | } |
| | | sftp.put(input, sftpFileName);// 上传文件 |
| | | } |
| | | |
| | | /** |
| | | * 将输入流的数据上传到sftp作为文件 |
| | | * |
| | | * @param directory 上传到该目录(单层目录) |
| | | * @param sftpFileName sftp端文件名 |
| | | * @param input 输入流 |
| | | * @throws SftpException |
| | | * @throws Exception |
| | | */ |
| | | public void upload(String directory, String sftpFileName, InputStream input) throws SftpException { |
| | | try { |
| | | sftp.cd(directory); |
| | | } catch (SftpException e) { |
| | | log.warn("directory is not exist"); |
| | | sftp.mkdir(directory); |
| | | sftp.cd(directory); |
| | | } |
| | | sftp.put(input, sftpFileName); |
| | | log.info("file:{} is upload successful", sftpFileName); |
| | | } |
| | | |
| | | /** |
| | | * 上传单个文件 |
| | | * |
| | | * @param directory 上传到sftp目录 |
| | | * @param uploadFile 要上传的文件,包括路径 |
| | | * @throws FileNotFoundException |
| | | * @throws SftpException |
| | | * @throws Exception |
| | | */ |
| | | public void upload(String directory, String uploadFile) throws FileNotFoundException, SftpException { |
| | | File file = new File(uploadFile); |
| | | upload(directory, file.getName(), new FileInputStream(file)); |
| | | } |
| | | |
| | | /** |
| | | * 将byte[]上传到sftp,作为文件。注意:从String生成byte[]是,要指定字符集。 |
| | | * |
| | | * @param directory 上传到sftp目录 |
| | | * @param sftpFileName 文件在sftp端的命名 |
| | | * @param byteArr 要上传的字节数组 |
| | | * @throws SftpException |
| | | * @throws Exception |
| | | */ |
| | | public void upload(String directory, String sftpFileName, byte[] byteArr) throws SftpException { |
| | | upload(directory, sftpFileName, new ByteArrayInputStream(byteArr)); |
| | | } |
| | | |
| | | /** |
| | | * 将字符串按照指定的字符编码上传到sftp |
| | | * |
| | | * @param directory 上传到sftp目录 |
| | | * @param sftpFileName 文件在sftp端的命名 |
| | | * @param dataStr 待上传的数据 |
| | | * @param charsetName sftp上的文件,按该字符编码保存 |
| | | * @throws UnsupportedEncodingException |
| | | * @throws SftpException |
| | | * @throws Exception |
| | | */ |
| | | public void upload(String directory, String sftpFileName, String dataStr, String charsetName) throws UnsupportedEncodingException, SftpException { |
| | | upload(directory, sftpFileName, new ByteArrayInputStream(dataStr.getBytes(charsetName))); |
| | | } |
| | | |
| | | /** |
| | | * 下载文件 |
| | | * |
| | | * @param directory 下载目录 |
| | | * @param downloadFile 下载的文件 |
| | | * @param saveFile 存在本地的路径 |
| | | * @throws SftpException |
| | | * @throws FileNotFoundException |
| | | * @throws Exception |
| | | */ |
| | | public void download(String directory, String downloadFile, String saveFile) throws SftpException, FileNotFoundException { |
| | | if (directory != null && !"".equals(directory)) { |
| | | sftp.cd(directory); |
| | | } |
| | | File file = new File(saveFile); |
| | | sftp.get(downloadFile, new FileOutputStream(file)); |
| | | log.info("file:{} is download successful", downloadFile); |
| | | } |
| | | |
| | | /** |
| | | * 下载文件 |
| | | * |
| | | * @param directory 下载目录 |
| | | * @param downloadFile 下载的文件名 |
| | | * @return 字节数组 |
| | | * @throws SftpException |
| | | * @throws IOException |
| | | * @throws Exception |
| | | */ |
| | | public byte[] download(String directory, String downloadFile) throws SftpException, IOException { |
| | | if (directory != null && !"".equals(directory)) { |
| | | sftp.cd(directory); |
| | | } |
| | | InputStream is = sftp.get(downloadFile); |
| | | byte[] fileData = IOUtils.toByteArray(is); |
| | | log.info("file:{} is download successful", downloadFile); |
| | | return fileData; |
| | | } |
| | | |
| | | /** |
| | | * 删除文件 |
| | | * |
| | | * @param directory 要删除文件所在目录 |
| | | * @param deleteFile 要删除的文件 |
| | | * @throws SftpException |
| | | * @throws Exception |
| | | */ |
| | | public void delete(String directory, String deleteFile) throws SftpException { |
| | | sftp.cd(directory); |
| | | sftp.rm(deleteFile); |
| | | } |
| | | |
| | | /** |
| | | * 列出目录下的文件 |
| | | * |
| | | * @param directory 要列出的目录 |
| | | * @return |
| | | * @throws SftpException |
| | | */ |
| | | public Vector<?> listFiles(String directory) throws SftpException { |
| | | return sftp.ls(directory); |
| | | } |
| | | |
| | | public static void main(String[] args) throws SftpException, IOException { |
| | | SFTPUtil sftp = new SFTPUtil("root", "evanN7F2K5M6", "47.104.148.185", 22); |
| | | sftp.login(); |
| | | File file = new File("F:\\settings.xml"); |
| | | InputStream is = new FileInputStream(file); |
| | | // 多级目录创建并上传 |
| | | sftp.uploadMore("/mnt/data/ftp/ss", "settings.xml", is); |
| | | sftp.logout(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | |
| | | |
| | | import org.springframework.web.context.request.RequestAttributes; |
| | | import org.springframework.web.context.request.RequestContextHolder; |
| | | import org.springframework.web.context.request.ServletRequestAttributes; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * 客户端工具类 |
| | | * |
| | | * @author huanghongfa |
| | | */ |
| | | public class ServletUtils |
| | | { |
| | | /** |
| | | * 获取String参数 |
| | | */ |
| | | public static String getParameter(String name) |
| | | { |
| | | return getRequest().getParameter(name); |
| | | } |
| | | |
| | | /** |
| | | * 获取String参数 |
| | | */ |
| | | public static String getParameter(String name, String defaultValue) |
| | | { |
| | | return Convert.toStr(getRequest().getParameter(name), defaultValue); |
| | | } |
| | | |
| | | /** |
| | | * 获取Integer参数 |
| | | */ |
| | | public static Integer getParameterToInt(String name) |
| | | { |
| | | return Convert.toInt(getRequest().getParameter(name)); |
| | | } |
| | | |
| | | /** |
| | | * 获取Integer参数 |
| | | */ |
| | | public static Integer getParameterToInt(String name, Integer defaultValue) |
| | | { |
| | | return Convert.toInt(getRequest().getParameter(name), defaultValue); |
| | | } |
| | | |
| | | /** |
| | | * 获取request |
| | | */ |
| | | public static HttpServletRequest getRequest() |
| | | { |
| | | return getRequestAttributes().getRequest(); |
| | | } |
| | | |
| | | /** |
| | | * 获取response |
| | | */ |
| | | public static HttpServletResponse getResponse() |
| | | { |
| | | return getRequestAttributes().getResponse(); |
| | | } |
| | | |
| | | /** |
| | | * 获取session |
| | | */ |
| | | public static HttpSession getSession() |
| | | { |
| | | return getRequest().getSession(); |
| | | } |
| | | |
| | | public static ServletRequestAttributes getRequestAttributes() |
| | | { |
| | | RequestAttributes attributes = RequestContextHolder.getRequestAttributes(); |
| | | return (ServletRequestAttributes) attributes; |
| | | } |
| | | |
| | | /** |
| | | * 将字符串渲染到客户端 |
| | | * |
| | | * @param response 渲染对象 |
| | | * @param string 待渲染的字符串 |
| | | * @return null |
| | | */ |
| | | public static String renderString(HttpServletResponse response, String string) |
| | | { |
| | | try |
| | | { |
| | | response.setStatus(200); |
| | | response.setContentType("application/json"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | response.getWriter().print(string); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 是否是Ajax异步请求 |
| | | * |
| | | * @param request |
| | | */ |
| | | public static boolean isAjaxRequest(HttpServletRequest request) |
| | | { |
| | | String accept = request.getHeader("accept"); |
| | | if (accept != null && accept.indexOf("application/json") != -1) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | String xRequestedWith = request.getHeader("X-Requested-With"); |
| | | if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | String uri = request.getRequestURI(); |
| | | if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml")) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | String ajax = request.getParameter("__ajax"); |
| | | if (StringUtils.inStringIgnoreCase(ajax, "json", "xml")) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.aop.framework.AopContext; |
| | | import org.springframework.beans.BeansException; |
| | | import org.springframework.beans.factory.NoSuchBeanDefinitionException; |
| | | import org.springframework.beans.factory.config.BeanFactoryPostProcessor; |
| | | import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.context.ApplicationContextAware; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | /** |
| | | * spring工具类 方便在非spring管理环境中获取bean |
| | | * |
| | | * @author huanghongfa |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationContextAware |
| | | { |
| | | /** Spring应用上下文环境 */ |
| | | private static ConfigurableListableBeanFactory beanFactory; |
| | | |
| | | private static ApplicationContext applicationContext; |
| | | |
| | | @Override |
| | | public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException |
| | | { |
| | | SpringUtils.beanFactory = beanFactory; |
| | | } |
| | | |
| | | @Override |
| | | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException |
| | | { |
| | | SpringUtils.applicationContext = applicationContext; |
| | | } |
| | | |
| | | /** |
| | | * 获取对象 |
| | | * |
| | | * @param name |
| | | * @return Object 一个以所给名字注册的bean的实例 |
| | | * @throws org.springframework.beans.BeansException |
| | | * |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public static <T> T getBean(String name) throws BeansException |
| | | { |
| | | return (T) beanFactory.getBean(name); |
| | | } |
| | | |
| | | /** |
| | | * 获取类型为requiredType的对象 |
| | | * |
| | | * @param clz |
| | | * @return |
| | | * @throws org.springframework.beans.BeansException |
| | | * |
| | | */ |
| | | public static <T> T getBean(Class<T> clz) throws BeansException |
| | | { |
| | | T result = (T) beanFactory.getBean(clz); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 如果BeanFactory包含一个与所给名称匹配的bean定义,则返回true |
| | | * |
| | | * @param name |
| | | * @return boolean |
| | | */ |
| | | public static boolean containsBean(String name) |
| | | { |
| | | return beanFactory.containsBean(name); |
| | | } |
| | | |
| | | /** |
| | | * 判断以给定名字注册的bean定义是一个singleton还是一个prototype。 如果与给定名字相应的bean定义没有被找到,将会抛出一个异常(NoSuchBeanDefinitionException) |
| | | * |
| | | * @param name |
| | | * @return boolean |
| | | * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException |
| | | * |
| | | */ |
| | | public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException |
| | | { |
| | | return beanFactory.isSingleton(name); |
| | | } |
| | | |
| | | /** |
| | | * @param name |
| | | * @return Class 注册对象的类型 |
| | | * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException |
| | | * |
| | | */ |
| | | public static Class<?> getType(String name) throws NoSuchBeanDefinitionException |
| | | { |
| | | return beanFactory.getType(name); |
| | | } |
| | | |
| | | /** |
| | | * 如果给定的bean名字在bean定义中有别名,则返回这些别名 |
| | | * |
| | | * @param name |
| | | * @return |
| | | * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException |
| | | * |
| | | */ |
| | | public static String[] getAliases(String name) throws NoSuchBeanDefinitionException |
| | | { |
| | | return beanFactory.getAliases(name); |
| | | } |
| | | |
| | | /** |
| | | * 获取aop代理对象 |
| | | * |
| | | * @param invoker |
| | | * @return |
| | | */ |
| | | @SuppressWarnings("unchecked") |
| | | public static <T> T getAopProxy(T invoker) |
| | | { |
| | | return (T) AopContext.currentProxy(); |
| | | } |
| | | |
| | | /** |
| | | * 获取当前的环境配置,无配置返回null |
| | | * |
| | | * @return 当前的环境配置 |
| | | */ |
| | | public static String[] getActiveProfiles() |
| | | { |
| | | return applicationContext.getEnvironment().getActiveProfiles(); |
| | | } |
| | | |
| | | /** |
| | | * 获取当前的环境配置,当有多个环境配置时,只获取第一个 |
| | | * |
| | | * @return 当前的环境配置 |
| | | */ |
| | | public static String getActiveProfile() |
| | | { |
| | | final String[] activeProfiles = getActiveProfiles(); |
| | | return !ObjectUtils.isEmpty(activeProfiles) ? activeProfiles[0] : null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | /** |
| | | * 字符串格式化 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class StrFormatter |
| | | { |
| | | public static final String EMPTY_JSON = "{}"; |
| | | public static final char C_BACKSLASH = '\\'; |
| | | public static final char C_DELIM_START = '{'; |
| | | public static final char C_DELIM_END = '}'; |
| | | |
| | | /** |
| | | * 格式化字符串<br> |
| | | * 此方法只是简单将占位符 {} 按照顺序替换为参数<br> |
| | | * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br> |
| | | * 例:<br> |
| | | * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br> |
| | | * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br> |
| | | * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br> |
| | | * |
| | | * @param strPattern 字符串模板 |
| | | * @param argArray 参数列表 |
| | | * @return 结果 |
| | | */ |
| | | public static String format(final String strPattern, final Object... argArray) |
| | | { |
| | | if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray)) |
| | | { |
| | | return strPattern; |
| | | } |
| | | final int strPatternLength = strPattern.length(); |
| | | |
| | | // 初始化定义好的长度以获得更好的性能 |
| | | StringBuilder sbuf = new StringBuilder(strPatternLength + 50); |
| | | |
| | | int handledPosition = 0; |
| | | int delimIndex;// 占位符所在位置 |
| | | for (int argIndex = 0; argIndex < argArray.length; argIndex++) |
| | | { |
| | | delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition); |
| | | if (delimIndex == -1) |
| | | { |
| | | if (handledPosition == 0) |
| | | { |
| | | return strPattern; |
| | | } |
| | | else |
| | | { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果 |
| | | sbuf.append(strPattern, handledPosition, strPatternLength); |
| | | return sbuf.toString(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH) |
| | | { |
| | | if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH) |
| | | { |
| | | // 转义符之前还有一个转义符,占位符依旧有效 |
| | | sbuf.append(strPattern, handledPosition, delimIndex - 1); |
| | | sbuf.append(Convert.utf8Str(argArray[argIndex])); |
| | | handledPosition = delimIndex + 2; |
| | | } |
| | | else |
| | | { |
| | | // 占位符被转义 |
| | | argIndex--; |
| | | sbuf.append(strPattern, handledPosition, delimIndex - 1); |
| | | sbuf.append(C_DELIM_START); |
| | | handledPosition = delimIndex + 1; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | // 正常占位符 |
| | | sbuf.append(strPattern, handledPosition, delimIndex); |
| | | sbuf.append(Convert.utf8Str(argArray[argIndex])); |
| | | handledPosition = delimIndex + 2; |
| | | } |
| | | } |
| | | } |
| | | // 加入最后一个占位符后所有的字符 |
| | | sbuf.append(strPattern, handledPosition, strPattern.length()); |
| | | |
| | | return sbuf.toString(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 字符串工具类 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | public class StringUtils extends org.apache.commons.lang3.StringUtils |
| | | { |
| | | /** 空字符串 */ |
| | | private static final String NULLSTR = ""; |
| | | |
| | | /** 下划线 */ |
| | | private static final char SEPARATOR = '_'; |
| | | |
| | | /** |
| | | * 获取参数不为空值 |
| | | * |
| | | * @param value defaultValue 要判断的value |
| | | * @return value 返回值 |
| | | */ |
| | | public static <T> T nvl(T value, T defaultValue) |
| | | { |
| | | return value != null ? value : defaultValue; |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个Collection是否为空, 包含List,Set,Queue |
| | | * |
| | | * @param coll 要判断的Collection |
| | | * @return true:为空 false:非空 |
| | | */ |
| | | public static boolean isEmpty(Collection<?> coll) |
| | | { |
| | | return isNull(coll) || coll.isEmpty(); |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个Collection是否非空,包含List,Set,Queue |
| | | * |
| | | * @param coll 要判断的Collection |
| | | * @return true:非空 false:空 |
| | | */ |
| | | public static boolean isNotEmpty(Collection<?> coll) |
| | | { |
| | | return !isEmpty(coll); |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个对象数组是否为空 |
| | | * |
| | | * @param objects 要判断的对象数组 |
| | | ** @return true:为空 false:非空 |
| | | */ |
| | | public static boolean isEmpty(Object[] objects) |
| | | { |
| | | return isNull(objects) || (objects.length == 0); |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个对象数组是否非空 |
| | | * |
| | | * @param objects 要判断的对象数组 |
| | | * @return true:非空 false:空 |
| | | */ |
| | | public static boolean isNotEmpty(Object[] objects) |
| | | { |
| | | return !isEmpty(objects); |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个Map是否为空 |
| | | * |
| | | * @param map 要判断的Map |
| | | * @return true:为空 false:非空 |
| | | */ |
| | | public static boolean isEmpty(Map<?, ?> map) |
| | | { |
| | | return isNull(map) || map.isEmpty(); |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个Map是否为空 |
| | | * |
| | | * @param map 要判断的Map |
| | | * @return true:非空 false:空 |
| | | */ |
| | | public static boolean isNotEmpty(Map<?, ?> map) |
| | | { |
| | | return !isEmpty(map); |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个字符串是否为空串 |
| | | * |
| | | * @param str String |
| | | * @return true:为空 false:非空 |
| | | */ |
| | | public static boolean isEmpty(String str) |
| | | { |
| | | return isNull(str) || NULLSTR.equals(str.trim()); |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个字符串是否为非空串 |
| | | * |
| | | * @param str String |
| | | * @return true:非空串 false:空串 |
| | | */ |
| | | public static boolean isNotEmpty(String str) |
| | | { |
| | | return !isEmpty(str); |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个对象是否为空 |
| | | * |
| | | * @param object Object |
| | | * @return true:为空 false:非空 |
| | | */ |
| | | public static boolean isNull(Object object) |
| | | { |
| | | return object == null; |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个对象是否非空 |
| | | * |
| | | * @param object Object |
| | | * @return true:非空 false:空 |
| | | */ |
| | | public static boolean isNotNull(Object object) |
| | | { |
| | | return !isNull(object); |
| | | } |
| | | |
| | | /** |
| | | * * 判断一个对象是否是数组类型(Java基本型别的数组) |
| | | * |
| | | * @param object 对象 |
| | | * @return true:是数组 false:不是数组 |
| | | */ |
| | | public static boolean isArray(Object object) |
| | | { |
| | | return isNotNull(object) && object.getClass().isArray(); |
| | | } |
| | | |
| | | /** |
| | | * 去空格 |
| | | */ |
| | | public static String trim(String str) |
| | | { |
| | | return (str == null ? "" : str.trim()); |
| | | } |
| | | |
| | | /** |
| | | * 截取字符串 |
| | | * |
| | | * @param str 字符串 |
| | | * @param start 开始 |
| | | * @return 结果 |
| | | */ |
| | | public static String substring(final String str, int start) |
| | | { |
| | | if (str == null) |
| | | { |
| | | return NULLSTR; |
| | | } |
| | | |
| | | if (start < 0) |
| | | { |
| | | start = str.length() + start; |
| | | } |
| | | |
| | | if (start < 0) |
| | | { |
| | | start = 0; |
| | | } |
| | | if (start > str.length()) |
| | | { |
| | | return NULLSTR; |
| | | } |
| | | |
| | | return str.substring(start); |
| | | } |
| | | |
| | | /** |
| | | * 截取字符串 |
| | | * |
| | | * @param str 字符串 |
| | | * @param start 开始 |
| | | * @param end 结束 |
| | | * @return 结果 |
| | | */ |
| | | public static String substring(final String str, int start, int end) |
| | | { |
| | | if (str == null) |
| | | { |
| | | return NULLSTR; |
| | | } |
| | | |
| | | if (end < 0) |
| | | { |
| | | end = str.length() + end; |
| | | } |
| | | if (start < 0) |
| | | { |
| | | start = str.length() + start; |
| | | } |
| | | |
| | | if (end > str.length()) |
| | | { |
| | | end = str.length(); |
| | | } |
| | | |
| | | if (start > end) |
| | | { |
| | | return NULLSTR; |
| | | } |
| | | |
| | | if (start < 0) |
| | | { |
| | | start = 0; |
| | | } |
| | | if (end < 0) |
| | | { |
| | | end = 0; |
| | | } |
| | | |
| | | return str.substring(start, end); |
| | | } |
| | | |
| | | /** |
| | | * 格式化文本, {} 表示占位符<br> |
| | | * 此方法只是简单将占位符 {} 按照顺序替换为参数<br> |
| | | * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可<br> |
| | | * 例:<br> |
| | | * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b<br> |
| | | * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a<br> |
| | | * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b<br> |
| | | * |
| | | * @param template 文本模板,被替换的部分用 {} 表示 |
| | | * @param params 参数值 |
| | | * @return 格式化后的文本 |
| | | */ |
| | | public static String format(String template, Object... params) |
| | | { |
| | | if (isEmpty(params) || isEmpty(template)) |
| | | { |
| | | return template; |
| | | } |
| | | return StrFormatter.format(template, params); |
| | | } |
| | | |
| | | /** |
| | | * 字符串转set |
| | | * |
| | | * @param str 字符串 |
| | | * @param sep 分隔符 |
| | | * @return set集合 |
| | | */ |
| | | public static final Set<String> str2Set(String str, String sep) |
| | | { |
| | | return new HashSet<String>(str2List(str, sep, true, false)); |
| | | } |
| | | |
| | | /** |
| | | * 字符串转list |
| | | * |
| | | * @param str 字符串 |
| | | * @param sep 分隔符 |
| | | * @param filterBlank 过滤纯空白 |
| | | * @param trim 去掉首尾空白 |
| | | * @return list集合 |
| | | */ |
| | | public static final List<String> str2List(String str, String sep, boolean filterBlank, boolean trim) |
| | | { |
| | | List<String> list = new ArrayList<String>(); |
| | | if (StringUtils.isEmpty(str)) |
| | | { |
| | | return list; |
| | | } |
| | | |
| | | // 过滤空白字符串 |
| | | if (filterBlank && StringUtils.isBlank(str)) |
| | | { |
| | | return list; |
| | | } |
| | | String[] split = str.split(sep); |
| | | for (String string : split) |
| | | { |
| | | if (filterBlank && StringUtils.isBlank(string)) |
| | | { |
| | | continue; |
| | | } |
| | | if (trim) |
| | | { |
| | | string = string.trim(); |
| | | } |
| | | list.add(string); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 下划线转驼峰命名 |
| | | */ |
| | | public static String toUnderScoreCase(String str) |
| | | { |
| | | if (str == null) |
| | | { |
| | | return null; |
| | | } |
| | | StringBuilder sb = new StringBuilder(); |
| | | // 前置字符是否大写 |
| | | boolean preCharIsUpperCase = true; |
| | | // 当前字符是否大写 |
| | | boolean curreCharIsUpperCase = true; |
| | | // 下一字符是否大写 |
| | | boolean nexteCharIsUpperCase = true; |
| | | for (int i = 0; i < str.length(); i++) |
| | | { |
| | | char c = str.charAt(i); |
| | | if (i > 0) |
| | | { |
| | | preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1)); |
| | | } |
| | | else |
| | | { |
| | | preCharIsUpperCase = false; |
| | | } |
| | | |
| | | curreCharIsUpperCase = Character.isUpperCase(c); |
| | | |
| | | if (i < (str.length() - 1)) |
| | | { |
| | | nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1)); |
| | | } |
| | | |
| | | if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) |
| | | { |
| | | sb.append(SEPARATOR); |
| | | } |
| | | else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) |
| | | { |
| | | sb.append(SEPARATOR); |
| | | } |
| | | sb.append(Character.toLowerCase(c)); |
| | | } |
| | | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 是否包含字符串 |
| | | * |
| | | * @param str 验证字符串 |
| | | * @param strs 字符串组 |
| | | * @return 包含返回true |
| | | */ |
| | | public static boolean inStringIgnoreCase(String str, String... strs) |
| | | { |
| | | if (str != null && strs != null) |
| | | { |
| | | for (String s : strs) |
| | | { |
| | | if (str.equalsIgnoreCase(trim(s))) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld |
| | | * |
| | | * @param name 转换前的下划线大写方式命名的字符串 |
| | | * @return 转换后的驼峰式命名的字符串 |
| | | */ |
| | | public static String convertToCamelCase(String name) |
| | | { |
| | | StringBuilder result = new StringBuilder(); |
| | | // 快速检查 |
| | | if (name == null || name.isEmpty()) |
| | | { |
| | | // 没必要转换 |
| | | return ""; |
| | | } |
| | | else if (!name.contains("_")) |
| | | { |
| | | // 不含下划线,仅将首字母大写 |
| | | return name.substring(0, 1).toUpperCase() + name.substring(1); |
| | | } |
| | | // 用下划线将原始字符串分割 |
| | | String[] camels = name.split("_"); |
| | | for (String camel : camels) |
| | | { |
| | | // 跳过原始字符串中开头、结尾的下换线或双重下划线 |
| | | if (camel.isEmpty()) |
| | | { |
| | | continue; |
| | | } |
| | | // 首字母大写 |
| | | result.append(camel.substring(0, 1).toUpperCase()); |
| | | result.append(camel.substring(1).toLowerCase()); |
| | | } |
| | | return result.toString(); |
| | | } |
| | | |
| | | /** |
| | | * 驼峰式命名法 例如:user_name->userName |
| | | */ |
| | | public static String toCamelCase(String s) |
| | | { |
| | | if (s == null) |
| | | { |
| | | return null; |
| | | } |
| | | s = s.toLowerCase(); |
| | | StringBuilder sb = new StringBuilder(s.length()); |
| | | boolean upperCase = false; |
| | | for (int i = 0; i < s.length(); i++) |
| | | { |
| | | char c = s.charAt(i); |
| | | |
| | | if (c == SEPARATOR) |
| | | { |
| | | upperCase = true; |
| | | } |
| | | else if (upperCase) |
| | | { |
| | | sb.append(Character.toUpperCase(c)); |
| | | upperCase = false; |
| | | } |
| | | else |
| | | { |
| | | sb.append(c); |
| | | } |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | |
| | | @SuppressWarnings("unchecked") |
| | | public static <T> T cast(Object obj) |
| | | { |
| | | return (T) obj; |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.utlis; |
| | | |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.concurrent.*; |
| | | |
| | | /** |
| | | * 线程相关工具类. |
| | | * |
| | | * @author huanghongfa |
| | | */ |
| | | @Slf4j |
| | | public class Threads { |
| | | /** |
| | | * sleep等待,单位为毫秒 |
| | | */ |
| | | public static void sleep(long milliseconds) { |
| | | try { |
| | | Thread.sleep(milliseconds); |
| | | } catch (InterruptedException e) { |
| | | return; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 停止线程池 |
| | | * 先使用shutdown, 停止接收新任务并尝试完成所有已存在任务. |
| | | * 如果超时, 则调用shutdownNow, 取消在workQueue中Pending的任务,并中断所有阻塞函数. |
| | | * 如果仍人超時,則強制退出. |
| | | * 另对在shutdown时线程本身被调用中断做了处理. |
| | | */ |
| | | public static void shutdownAndAwaitTermination(ExecutorService pool) { |
| | | if (pool != null && !pool.isShutdown()) { |
| | | pool.shutdown(); |
| | | try { |
| | | if (!pool.awaitTermination(120, TimeUnit.SECONDS)) { |
| | | pool.shutdownNow(); |
| | | if (!pool.awaitTermination(120, TimeUnit.SECONDS)) { |
| | | // log.info("Pool did not terminate"); |
| | | |
| | | } |
| | | } |
| | | } catch (InterruptedException ie) { |
| | | pool.shutdownNow(); |
| | | Thread.currentThread().interrupt(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 打印线程异常信息 |
| | | */ |
| | | public static void printException(Runnable r, Throwable t) { |
| | | if (t == null && r instanceof Future<?>) { |
| | | try { |
| | | Future<?> future = (Future<?>) r; |
| | | if (future.isDone()) { |
| | | future.get(); |
| | | } |
| | | } catch (CancellationException ce) { |
| | | t = ce; |
| | | } catch (ExecutionException ee) { |
| | | t = ee.getCause(); |
| | | } catch (InterruptedException ie) { |
| | | Thread.currentThread().interrupt(); |
| | | } |
| | | } |
| | | if (t != null) { |
| | | // log.error(t.getMessage(), t); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.common.validated; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 新增校验组 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-18 17:35 |
| | | **/ |
| | | public interface AddGroup { |
| | | } |
New file |
| | |
| | | #Generated by Maven |
| | | #Fri Nov 27 17:26:33 CST 2020 |
| | | version=1.0-SNAPSHOT |
| | | groupId=com.panzhihua |
| | | artifactId=common |
New file |
| | |
| | | com\panzhihua\common\constants\Constants.class |
| | | com\panzhihua\common\controller\BaseController.class |
| | | com\panzhihua\common\utlis\HttpHelper.class |
| | | com\panzhihua\common\service\user\UserService.class |
| | | com\panzhihua\common\utlis\HttpUtils$TrustAnyTrustManager.class |
| | | com\panzhihua\common\utlis\IpUtils.class |
| | | com\panzhihua\common\utlis\HttpUtils.class |
| | | com\panzhihua\common\model\vos\R.class |
| | | com\panzhihua\common\utlis\StringUtils.class |
| | | com\panzhihua\common\model\vos\LoginUserInfoVO.class |
| | | com\panzhihua\common\utlis\HttpUtils$TrustAnyHostnameVerifier.class |
| | | com\panzhihua\common\utlis\SpringUtils.class |
| | | com\panzhihua\common\constants\TokenConstant.class |
| | | com\panzhihua\common\exceptions\TokenException.class |
| | | com\panzhihua\common\utlis\HTMLFilter.class |
| | | com\panzhihua\common\utlis\Convert.class |
| | | com\panzhihua\common\utlis\MessageUtils.class |
| | | com\panzhihua\common\utlis\EscapeUtil.class |
| | | com\panzhihua\common\utlis\LogUtils.class |
| | | com\panzhihua\common\model\vos\LoginReturnVO.class |
| | | com\panzhihua\common\constants\HttpStatus.class |
| | | com\panzhihua\common\exceptions\UnAuthenticationException.class |
| | | com\panzhihua\common\utlis\Threads.class |
| | | com\panzhihua\common\service\auth\TokenService.class |
| | | com\panzhihua\common\utlis\ResultUtil.class |
| | | com\panzhihua\common\utlis\HttpUtils$1.class |
| | | com\panzhihua\common\constants\UserConstants.class |
| | | com\panzhihua\common\exceptions\UnAuthorizationException.class |
| | | com\panzhihua\common\utlis\JWTTokenUtil.class |
| | | com\panzhihua\common\utlis\AddressUtils.class |
| | | com\panzhihua\common\constants\SecurityConstants.class |
| | | com\panzhihua\common\utlis\ServletUtils.class |
| | | com\panzhihua\common\model\vos\MenuVO.class |
| | | com\panzhihua\common\utlis\CharsetKit.class |
| | | com\panzhihua\common\utlis\StrFormatter.class |
| | | com\panzhihua\common\exceptions\WeiXinException.class |
| | | com\panzhihua\common\enums\UserStatus.class |
New file |
| | |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\controller\BaseController.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\utlis\HttpHelper.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\constants\UserConstants.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\model\vos\R.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\utlis\ServletUtils.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\utlis\ResultUtil.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\utlis\StrFormatter.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\utlis\EscapeUtil.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\exceptions\UnAuthenticationException.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\utlis\AddressUtils.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\utlis\StringUtils.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\utlis\HTMLFilter.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\model\vos\LoginUserInfoVO.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\utlis\CharsetKit.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\constants\Constants.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\enums\UserStatus.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\utlis\HttpUtils.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\utlis\LogUtils.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\service\user\UserService.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\utlis\Convert.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\utlis\JWTTokenUtil.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\exceptions\TokenException.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\utlis\MessageUtils.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\exceptions\UnAuthorizationException.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\model\vos\LoginReturnVO.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\service\auth\TokenService.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\utlis\SpringUtils.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\constants\TokenConstant.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\utlis\Threads.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\constants\SecurityConstants.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\model\vos\MenuVO.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\constants\HttpStatus.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\utlis\IpUtils.java |
| | | F:\nahan\panzhihua_zhihuishequ\zhihuishequ\springcloud_k8s_panzhihuazhihuishequ\common\src\main\java\com\panzhihua\common\exceptions\WeiXinException.java |
New file |
| | |
| | | HELP.md |
| | | target/ |
| | | !.mvn/wrapper/maven-wrapper.jar |
| | | !**/src/main/**/target/ |
| | | !**/src/test/**/target/ |
| | | |
| | | ### STS ### |
| | | .apt_generated |
| | | .classpath |
| | | .factorypath |
| | | .project |
| | | .settings |
| | | .springBeans |
| | | .sts4-cache |
| | | |
| | | ### IntelliJ IDEA ### |
| | | .idea |
| | | *.iws |
| | | *.iml |
| | | *.ipr |
| | | |
| | | ### NetBeans ### |
| | | /nbproject/private/ |
| | | /nbbuild/ |
| | | /dist/ |
| | | /nbdist/ |
| | | /.nb-gradle/ |
| | | build/ |
| | | !**/src/main/**/build/ |
| | | !**/src/test/**/build/ |
| | | |
| | | ### VS Code ### |
| | | .vscode/ |
New file |
| | |
| | | /* |
| | | * Copyright 2007-present the original author or authors. |
| | | * |
| | | * Licensed 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. |
| | | */ |
| | | |
| | | import java.net.*; |
| | | import java.io.*; |
| | | import java.nio.channels.*; |
| | | import java.util.Properties; |
| | | |
| | | public class MavenWrapperDownloader { |
| | | |
| | | private static final String WRAPPER_VERSION = "0.5.6"; |
| | | /** |
| | | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. |
| | | */ |
| | | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" |
| | | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; |
| | | |
| | | /** |
| | | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to |
| | | * use instead of the default one. |
| | | */ |
| | | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = |
| | | ".mvn/wrapper/maven-wrapper.properties"; |
| | | |
| | | /** |
| | | * Path where the maven-wrapper.jar will be saved to. |
| | | */ |
| | | private static final String MAVEN_WRAPPER_JAR_PATH = |
| | | ".mvn/wrapper/maven-wrapper.jar"; |
| | | |
| | | /** |
| | | * Name of the property which should be used to override the default download url for the wrapper. |
| | | */ |
| | | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; |
| | | |
| | | public static void main(String args[]) { |
| | | System.out.println("- Downloader started"); |
| | | File baseDirectory = new File(args[0]); |
| | | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); |
| | | |
| | | // If the maven-wrapper.properties exists, read it and check if it contains a custom |
| | | // wrapperUrl parameter. |
| | | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); |
| | | String url = DEFAULT_DOWNLOAD_URL; |
| | | if (mavenWrapperPropertyFile.exists()) { |
| | | FileInputStream mavenWrapperPropertyFileInputStream = null; |
| | | try { |
| | | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); |
| | | Properties mavenWrapperProperties = new Properties(); |
| | | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); |
| | | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); |
| | | } catch (IOException e) { |
| | | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); |
| | | } finally { |
| | | try { |
| | | if (mavenWrapperPropertyFileInputStream != null) { |
| | | mavenWrapperPropertyFileInputStream.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | // Ignore ... |
| | | } |
| | | } |
| | | } |
| | | System.out.println("- Downloading from: " + url); |
| | | |
| | | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); |
| | | if (!outputFile.getParentFile().exists()) { |
| | | if (!outputFile.getParentFile().mkdirs()) { |
| | | System.out.println( |
| | | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); |
| | | } |
| | | } |
| | | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); |
| | | try { |
| | | downloadFileFromURL(url, outputFile); |
| | | System.out.println("Done"); |
| | | System.exit(0); |
| | | } catch (Throwable e) { |
| | | System.out.println("- Error downloading"); |
| | | e.printStackTrace(); |
| | | System.exit(1); |
| | | } |
| | | } |
| | | |
| | | private static void downloadFileFromURL(String urlString, File destination) throws Exception { |
| | | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { |
| | | String username = System.getenv("MVNW_USERNAME"); |
| | | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); |
| | | Authenticator.setDefault(new Authenticator() { |
| | | @Override |
| | | protected PasswordAuthentication getPasswordAuthentication() { |
| | | return new PasswordAuthentication(username, password); |
| | | } |
| | | }); |
| | | } |
| | | URL website = new URL(urlString); |
| | | ReadableByteChannel rbc; |
| | | rbc = Channels.newChannel(website.openStream()); |
| | | FileOutputStream fos = new FileOutputStream(destination); |
| | | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); |
| | | fos.close(); |
| | | rbc.close(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip |
| | | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar |
New file |
| | |
| | | #!/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 "$@" |
New file |
| | |
| | | @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% |
New file |
| | |
| | | <?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>com.panzhihua</groupId> |
| | | <artifactId>zhihuishequ</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <groupId>com.panzhihua</groupId> |
| | | <artifactId>community_backstage</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <name>community_backstage</name> |
| | | <description>社区后台</description> |
| | | |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-config</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-openfeign</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.panzhihua</groupId> |
| | | <artifactId>common</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.netflix.hystrix</groupId> |
| | | <artifactId>hystrix-javanica</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.github.xiaoymin</groupId> |
| | | <artifactId>swagger-bootstrap-ui</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | <repositories> |
| | | <repository> |
| | | <id>spring-snapshots</id> |
| | | <name>Spring Snapshots</name> |
| | | <url>https://repo.spring.io/snapshot</url> |
| | | <snapshots> |
| | | <enabled>true</enabled> |
| | | </snapshots> |
| | | </repository> |
| | | <repository> |
| | | <id>spring-milestones</id> |
| | | <name>Spring Milestones</name> |
| | | <url>https://repo.spring.io/milestone</url> |
| | | </repository> |
| | | </repositories> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.panzhihua.community_backstage; |
| | | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.cloud.client.SpringCloudApplication; |
| | | import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; |
| | | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; |
| | | import org.springframework.cloud.openfeign.EnableFeignClients; |
| | | import org.springframework.context.annotation.ComponentScan; |
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2; |
| | | |
| | | @EnableSwagger2 |
| | | @SpringCloudApplication |
| | | @EnableCircuitBreaker |
| | | @EnableEurekaClient |
| | | @EnableFeignClients(basePackages = {"com.panzhihua.common.service"}) |
| | | @ComponentScan("com.panzhihua") |
| | | public class CommunityBackstageApplication { |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(CommunityBackstageApplication.class, args); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.community_backstage.api; |
| | | |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.*; |
| | | import com.panzhihua.common.model.vos.partybuilding.ActivityManagerVO; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区活动 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 14:38 |
| | | **/ |
| | | @Slf4j |
| | | @Api(tags = {"社区动态/随手拍/微心愿/社区活动"}) |
| | | @RestController |
| | | @RequestMapping("/communityactivity/") |
| | | public class CommunityActivityAPI extends BaseController { |
| | | @Resource |
| | | private UserService userService; |
| | | @Resource |
| | | private CommunityService communityService; |
| | | |
| | | @ApiOperation(value = "活动负责人下拉选择",response = ActivityManagerVO.class) |
| | | @GetMapping("listactivitymanager") |
| | | @ApiImplicitParam(name = "param",value = "搜索参数【不传返回所有后台人员】",required = false) |
| | | public R listActivityManager(String param) { |
| | | Long communityId = this.getCommunityId(); |
| | | if (ObjectUtils.isEmpty(param)) { |
| | | param=""; |
| | | } |
| | | return userService.listActivityManager(param,communityId); |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "新增社区活动") |
| | | @PostMapping("activity") |
| | | public R addActivity(@RequestBody ComActActivityVO ComActActivityVO) { |
| | | Long communityId = this.getCommunityId(); |
| | | ComActActivityVO.setCommunityId(communityId); |
| | | return communityService.addActivity(ComActActivityVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑社区活动") |
| | | @PutMapping("activity") |
| | | public R putActivity(@RequestBody ComActActivityVO ComActActivityVO) { |
| | | Long id = ComActActivityVO.getId(); |
| | | if (ObjectUtils.isEmpty(id)) { |
| | | return R.fail("活动id主键不能为空"); |
| | | } |
| | | Long communityId = this.getCommunityId(); |
| | | ComActActivityVO.setCommunityId(communityId); |
| | | return communityService.putActivity(ComActActivityVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "删除社区活动") |
| | | @DeleteMapping("activity") |
| | | public R deleteActivity(@RequestBody ComActActivityVO ComActActivityVO) { |
| | | Long id = ComActActivityVO.getId(); |
| | | if (null==id||0==id) { |
| | | return R.fail("活动id主键不能为空"); |
| | | } |
| | | return communityService.deleteActivity(ComActActivityVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询社区活动") |
| | | @PostMapping("pageactivity") |
| | | public R pageActivity(@RequestBody ComActActivityVO ComActActivityVO) { |
| | | Long communityId = this.getCommunityId(); |
| | | ComActActivityVO.setCommunityId(communityId); |
| | | return communityService.pageActivity(ComActActivityVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "发布活动") |
| | | @PostMapping("releaseactivity") |
| | | public R releaseActivity(@RequestBody ComActActivityVO ComActActivityVO) { |
| | | Long id = ComActActivityVO.getId(); |
| | | if (ObjectUtils.isEmpty(id)) { |
| | | return R.fail("活动id主键不能为空"); |
| | | } |
| | | ComActActivityVO.setPublishAt(new Date()); |
| | | ComActActivityVO.setStatus(2); |
| | | return communityService.releaseActivity(ComActActivityVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "取消活动") |
| | | @PutMapping("cancelactivity") |
| | | public R cancelActivity(@RequestBody @Validated ComActActivityVO ComActActivityVO) { |
| | | Long id = ComActActivityVO.getId(); |
| | | if (null==id||0==id) { |
| | | return R.fail("活动id主键不能为空"); |
| | | } |
| | | ComActActivityVO.setStatus(6); |
| | | return communityService.cancelActivity(ComActActivityVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "活动详情") |
| | | @GetMapping("detailactivity") |
| | | public R detailActivity(@RequestParam("id") Long id) { |
| | | Long userId = this.getUserId(); |
| | | return communityService.detailActivity(id, userId); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询活动报名名单集合") |
| | | @PostMapping("listactivitysign") |
| | | public R listActivitySign(@RequestBody ActivitySignVO activitySignVO) { |
| | | if (ObjectUtils.isEmpty(activitySignVO.getActivityId())) { |
| | | return R.fail("活动id主键不能为空"); |
| | | } |
| | | return communityService.listActivitySign(activitySignVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增社区动态") |
| | | @PostMapping("dynamic") |
| | | public R addDynamic(@RequestBody ComActDynVO comActDynVO) { |
| | | Long communityId = this.getCommunityId(); |
| | | comActDynVO.setCommunityId(communityId); |
| | | Date publishAt = comActDynVO.getPublishAt(); |
| | | long time = publishAt.getTime(); |
| | | long l = System.currentTimeMillis(); |
| | | if (l>=time) { |
| | | comActDynVO.setStatus(1); |
| | | } |
| | | return communityService.addDynamic(comActDynVO); |
| | | //todo 五天自动取消置顶状态 |
| | | //todo 发布时间到了直接修改状态为已发布 |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑社区动态、取消置顶、设置置顶") |
| | | @PutMapping("dynamic") |
| | | public R putDynamic(@RequestBody ComActDynVO comActDynVO) { |
| | | Long communityId = this.getCommunityId(); |
| | | Long id = comActDynVO.getId(); |
| | | if (ObjectUtils.isEmpty(id)) { |
| | | return R.fail("动态主键不能为空"); |
| | | } |
| | | Date publishAt = comActDynVO.getPublishAt(); |
| | | if (!ObjectUtils.isEmpty(publishAt)) { |
| | | long time = publishAt.getTime(); |
| | | long l = System.currentTimeMillis(); |
| | | if (l>=time) { |
| | | comActDynVO.setStatus(1); |
| | | } |
| | | } |
| | | comActDynVO.setCommunityId(communityId); |
| | | return communityService.putDynamic(comActDynVO); |
| | | //todo 五天自动取消置顶状态 |
| | | } |
| | | |
| | | @ApiOperation(value = "删除社区动态") |
| | | @DeleteMapping("dynamic") |
| | | public R deleteDynamic(@RequestBody ComActDynVO comActDynVO) { |
| | | Long id = comActDynVO.getId(); |
| | | if (ObjectUtils.isEmpty(id)) { |
| | | return R.fail("动态主键不能为空"); |
| | | } |
| | | return communityService.deleteDynamic(comActDynVO); |
| | | //todo 五天自动取消置顶状态 |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询社区动态") |
| | | @PostMapping("pagedynamic") |
| | | public R pageDynamic(@RequestBody ComActDynVO comActDynVO) { |
| | | Long communityId = this.getCommunityId(); |
| | | comActDynVO.setCommunityId(communityId); |
| | | return communityService.pageDynamic(comActDynVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "社区动态详情") |
| | | @GetMapping("detaildynamic") |
| | | @ApiImplicitParam(name ="id",value = "社区动态主键",required = true) |
| | | public R detailDynamic(@RequestParam("id") Long id) { |
| | | return communityService.detailDynamic(id); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "分页查询随手拍") |
| | | @PostMapping("pageeasyphoto") |
| | | public R pageEasyPhoto(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO) { |
| | | Long communityId = this.getCommunityId(); |
| | | comActEasyPhotoVO.setCommunityId(communityId); |
| | | return communityService.pageEasyPhoto(comActEasyPhotoVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "随手拍详情") |
| | | @GetMapping("easyphoto") |
| | | public R detailEasyPhoto(@RequestParam("id")Long id) { |
| | | Long userId = this.getUserId(); |
| | | return communityService.detailEasyPhoto(id, userId); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询微心愿") |
| | | @PostMapping("pagemicrowish") |
| | | public R pageMicroWish(@RequestBody ComActMicroWishVO comActMicroWishVO) { |
| | | Long communityId = this.getCommunityId(); |
| | | comActMicroWishVO.setCommunityId(communityId); |
| | | return communityService.pageMicroWish(comActMicroWishVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "心愿详情") |
| | | @GetMapping("detailmicrowish") |
| | | public R detailMicroWish(@RequestParam("id")Long id) { |
| | | Long userId = this.getUserId(); |
| | | return communityService.detailMicroWish(id,userId); |
| | | } |
| | | |
| | | @ApiOperation(value = "审核、分配、反馈心愿") |
| | | @PutMapping("putmicrowish") |
| | | public R putlMicroWish(@RequestBody ComActMicroWishVO comActMicroWishVO) { |
| | | Long id = comActMicroWishVO.getId(); |
| | | if (ObjectUtils.isEmpty(id)) { |
| | | return R.fail("心愿主键不能为空"); |
| | | } |
| | | return communityService.putlMicroWish(comActMicroWishVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "微心愿人员下拉搜索") |
| | | @GetMapping("listmanagers") |
| | | @ApiImplicitParam(name = "param",value = "搜索参数【不传返回所有后台人员】",required = false) |
| | | public R listManagers(String param) { |
| | | Long communityId = this.getCommunityId(); |
| | | if (ObjectUtils.isEmpty(param)) { |
| | | param=""; |
| | | } |
| | | return userService.listActivityManager(param,communityId); |
| | | } |
| | | |
| | | @ApiOperation(value = "审核、反馈随手拍") |
| | | @PutMapping("puteasyphoto") |
| | | public R putEasypHotoStatus(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO) { |
| | | Integer type = comActEasyPhotoVO.getType(); |
| | | if (null==type||type>3||type<1) { |
| | | return R.fail("操作类型错误"); |
| | | } |
| | | Long id = comActEasyPhotoVO.getId(); |
| | | if (ObjectUtils.isEmpty(id)) { |
| | | return R.fail("随手拍主键不能为空"); |
| | | } |
| | | return communityService.putEasypHotoStatus(comActEasyPhotoVO); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.community_backstage.api; |
| | | |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.*; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区管理 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-15 10:40 |
| | | **/ |
| | | @Slf4j |
| | | @Api(tags = {"社区管理"}) |
| | | @RestController |
| | | @RequestMapping("/communitymanager/") |
| | | public class CommunityManagerApi { |
| | | @Resource |
| | | private UserService userService; |
| | | @Resource |
| | | private CommunityService communityService; |
| | | |
| | | @ApiOperation(value = "分页查询人脸采集",response = LoginUserInfoVO.class) |
| | | @PutMapping("pageuserface") |
| | | public R pageUserFace(@RequestBody LoginUserInfoVO loginUserInfoVO){ |
| | | return userService.pageUserFace(loginUserInfoVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑人脸采集数据通过、驳回、删除") |
| | | @PutMapping("putuserface") |
| | | public R putUserFace(@RequestBody LoginUserInfoVO loginUserInfoVO){ |
| | | Integer operationType = loginUserInfoVO.getOperationType(); |
| | | if (null==operationType||operationType.intValue()>3||operationType.intValue()<1) { |
| | | return R.fail("操作类型错误"); |
| | | } |
| | | Long userId = loginUserInfoVO.getUserId(); |
| | | if (null==userId||0==userId) { |
| | | return R.fail("用户主键不能为空"); |
| | | } |
| | | return userService.putUserFace(loginUserInfoVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询人口管理",response = LoginUserInfoVO.class) |
| | | @PutMapping("pageuser") |
| | | public R pageUser(@RequestBody LoginUserInfoVO loginUserInfoVO){ |
| | | return userService.pageUser(loginUserInfoVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询所有人员标签") |
| | | @GetMapping("listtag") |
| | | public R listTag(){ |
| | | return userService.listTag(); |
| | | } |
| | | |
| | | @ApiOperation(value = "人员详情",response = LoginUserInfoVO.class) |
| | | @GetMapping("detailuser") |
| | | @ApiImplicitParam(name ="userId",value = "人员id",required = true) |
| | | public R detailUser(@RequestParam("userId")Long userId){ |
| | | R r = userService.detailUser(userId); |
| | | boolean ok = R.isOk(r); |
| | | if (ok) { |
| | | Object data = r.getData(); |
| | | if (!ObjectUtils.isEmpty(data)) { |
| | | LoginUserInfoVO loginUserInfoVO=(LoginUserInfoVO)data; |
| | | R r1=communityService.detailHouse(userId); |
| | | if (R.isOk(r1)) { |
| | | Object data1 = r1.getData(); |
| | | if (!ObjectUtils.isEmpty(data1)) { |
| | | loginUserInfoVO.setComMngStructHouseVOS((List<ComMngStructHouseVO>)data1); |
| | | r.setData(loginUserInfoVO); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return r; |
| | | } |
| | | |
| | | @ApiOperation(value = "设置标签") |
| | | @PutMapping("usertag") |
| | | public R putUserTag(@RequestBody LoginUserInfoVO loginUserInfoVO){ |
| | | Long userId = loginUserInfoVO.getUserId(); |
| | | if (null==userId||0==userId) { |
| | | return R.fail("用户主键不能为空"); |
| | | } |
| | | return userService.putUserTag(loginUserInfoVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增小区") |
| | | @PostMapping("area") |
| | | public R addArea(@RequestBody ComMngStructAreaVO comMngStructAreaVO){ |
| | | String communityId = comMngStructAreaVO.getCommunityId(); |
| | | comMngStructAreaVO.setCommunityId(communityId); |
| | | return communityService.addArea(comMngStructAreaVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询小区",response =ComMngStructAreaVO.class ) |
| | | @PostMapping("pagearea") |
| | | public R pageArea(@RequestBody ComMngStructAreaVO comMngStructAreaVO){ |
| | | String communityId = comMngStructAreaVO.getCommunityId(); |
| | | comMngStructAreaVO.setCommunityId(communityId); |
| | | return communityService.pageArea(comMngStructAreaVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑小区") |
| | | @PutMapping("area") |
| | | public R putArea(@RequestBody ComMngStructAreaVO comMngStructAreaVO){ |
| | | String areaCode = comMngStructAreaVO.getAreaCode(); |
| | | if (ObjectUtils.isEmpty(areaCode)) { |
| | | return R.fail("地址编码不能为空"); |
| | | } |
| | | return communityService.putArea(comMngStructAreaVO); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "删除小区") |
| | | @DeleteMapping("area") |
| | | public R deleteArea(@RequestBody ComMngStructAreaVO comMngStructAreaVO){ |
| | | String areaCode = comMngStructAreaVO.getAreaCode(); |
| | | if (ObjectUtils.isEmpty(areaCode)) { |
| | | return R.fail("地址编码不能为空"); |
| | | } |
| | | return communityService.deleteArea(comMngStructAreaVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "批量建房") |
| | | @PostMapping("batchhouse") |
| | | public R batchHouse(@RequestBody BatchhouseVO batchhouseVO){ |
| | | String areaCode = batchhouseVO.getAreaCode(); |
| | | if (ObjectUtils.isEmpty(areaCode)) { |
| | | return R.fail("小区地址编码不能为空"); |
| | | } |
| | | return communityService.batchHouse(batchhouseVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "展示下级建筑") |
| | | @GetMapping("listsubordinatebuilding") |
| | | public R listSubordinatebuilding(@RequestParam("houseCode")String houseCode){ |
| | | return communityService.listSubordinatebuilding(houseCode); |
| | | } |
| | | |
| | | @ApiOperation(value = "添加同级地址") |
| | | @PostMapping("house") |
| | | public R addHouse(@RequestBody BatchhouseVO batchhouseVO){ |
| | | String parentCode = batchhouseVO.getParentCode(); |
| | | Integer type = batchhouseVO.getType(); |
| | | if (ObjectUtils.isEmpty(parentCode)) { |
| | | return R.fail("父级地址编码不能为空"); |
| | | } |
| | | if (null==type||type>5||type<2) { |
| | | return R.fail("同级类型错误"); |
| | | } |
| | | return communityService.addHouse(batchhouseVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑地址") |
| | | @PutMapping("house") |
| | | public R putHouse(@RequestBody ComMngStructHouseVO comMngStructHouseVO){ |
| | | String houseCode = comMngStructHouseVO.getHouseCode(); |
| | | if (ObjectUtils.isEmpty(houseCode)) { |
| | | return R.fail("址编码不能为空"); |
| | | } |
| | | return communityService.putHouse(comMngStructHouseVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "删除地址-删除所有下级") |
| | | @DeleteMapping("house") |
| | | public R deleteHouse(@RequestBody ComMngStructHouseVO comMngStructHouseVO){ |
| | | String houseCode = comMngStructHouseVO.getHouseCode(); |
| | | if (ObjectUtils.isEmpty(houseCode)) { |
| | | return R.fail("址编码不能为空"); |
| | | } |
| | | return communityService.deleteHouse(comMngStructHouseVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增其他建筑") |
| | | @PostMapping("otherbuild") |
| | | public R addOtherbuild(@RequestBody ComMngStructOtherBuildVO comMngStructOtherBuildVO){ |
| | | return communityService.addOtherbuild(comMngStructOtherBuildVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询所有建筑类型",response = ComMngStructBuildTypeVO.class) |
| | | @GetMapping("listbuildtype") |
| | | public R listBuildType(){ |
| | | return communityService.listBuildType(); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询其他建筑",response = ComMngStructOtherBuildVO.class) |
| | | @GetMapping("pageotherbuild") |
| | | public R pageOtherBuild(@RequestBody ComMngStructOtherBuildVO comMngStructOtherBuildVO){ |
| | | return communityService.pageOtherBuild(comMngStructOtherBuildVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "增加志愿者") |
| | | @PostMapping("volunteer") |
| | | public R addVolunteer(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO){ |
| | | comMngVolunteerMngVO.setState(3); |
| | | R r = communityService.addVolunteer(comMngVolunteerMngVO); |
| | | // 支援者添加成功,修改小程序用户的志愿者状态,通过手机号 |
| | | if (R.isOk(r)) { |
| | | String phone = comMngVolunteerMngVO.getPhone(); |
| | | R r1 = userService.putUserIsVolunteer(phone,1); |
| | | if (R.isOk(r1)) { |
| | | log.info("修改手机号【{}】的支援者状态为是",phone); |
| | | }else{ |
| | | log.info("手机号【{}】没有小程序用户",phone); |
| | | } |
| | | } |
| | | return r; |
| | | } |
| | | |
| | | @ApiOperation(value = "删除志愿者") |
| | | @DeleteMapping("volunteer") |
| | | public R deleteVolunteer(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO){ |
| | | String phone1 = comMngVolunteerMngVO.getPhone(); |
| | | if (ObjectUtils.isEmpty(phone1)) { |
| | | return R.fail("志愿者手机号不能为空"); |
| | | } |
| | | R r = communityService.deleteVolunteer(comMngVolunteerMngVO); |
| | | // 支援者添加成功,修改小程序用户的志愿者状态,通过手机号 |
| | | if (R.isOk(r)) { |
| | | String phone = comMngVolunteerMngVO.getPhone(); |
| | | R r1 = userService.putUserIsVolunteer(phone,0); |
| | | if (R.isOk(r1)) { |
| | | log.info("修改手机号【{}】的支援者状态为否",phone); |
| | | }else{ |
| | | log.info("手机号【{}】没有小程序用户",phone); |
| | | } |
| | | } |
| | | return r; |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑志愿者") |
| | | @PutMapping("volunteer") |
| | | public R putVolunteer(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO){ |
| | | Long id = comMngVolunteerMngVO.getId(); |
| | | if (null==id||0==id) { |
| | | return R.fail("志愿者主键不能为空"); |
| | | } |
| | | return communityService.putVolunteer(comMngVolunteerMngVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页展示志愿者") |
| | | @PutMapping("pagevolunteer") |
| | | public R pageVolunteer(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO){ |
| | | return communityService.pageVolunteer(comMngVolunteerMngVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页展示志愿者审核") |
| | | @PutMapping("pagevolunteerexamine") |
| | | public R pageVolunteerExamine(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO){ |
| | | return communityService.pageVolunteerExamine(comMngVolunteerMngVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "志愿者审核详情") |
| | | @GetMapping("volunteerexamine") |
| | | public R detailVolunteerExamine(@RequestParam("id")Long id){ |
| | | return communityService.detailVolunteerExamine(id); |
| | | } |
| | | |
| | | @ApiOperation(value = "志愿者审核") |
| | | @PutMapping("volunteerexamine") |
| | | public R putVolunteerExamine(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO){ |
| | | Long id = comMngVolunteerMngVO.getId(); |
| | | if (null==id||0==id) { |
| | | return R.fail("审核主键不能为空"); |
| | | } |
| | | return communityService.putVolunteerExamine(comMngVolunteerMngVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "删除志愿者审核") |
| | | @DeleteMapping("volunteerexamine") |
| | | public R deleteVolunteerExamine(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO){ |
| | | Long id = comMngVolunteerMngVO.getId(); |
| | | if (null==id||0==id) { |
| | | return R.fail("审核主键不能为空"); |
| | | } |
| | | return communityService.deleteVolunteerExamine(comMngVolunteerMngVO); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.community_backstage.api; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.jcraft.jsch.SftpException; |
| | | import com.panzhihua.common.constants.FtpConstants; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.partybuilding.*; |
| | | import com.panzhihua.common.model.vos.user.RoleVO; |
| | | import com.panzhihua.common.service.partybuilding.PartyBuildingService; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.common.utlis.SFTPUtil; |
| | | import com.panzhihua.community_backstage.listen.PartyBuildingMemberExcelListen; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.io.FileUtils; |
| | | import org.springframework.core.io.FileSystemResource; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.commons.CommonsMultipartFile; |
| | | |
| | | import javax.activation.MimetypesFileTypeMap; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区党建引领 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-30 09:45 |
| | | **/ |
| | | @Slf4j |
| | | @Api(tags = {"社区党建引领"}) |
| | | @RestController |
| | | @RequestMapping("/communitypartybuilding/") |
| | | public class CommunityPartyBuildingApi extends BaseController { |
| | | @Resource |
| | | private PartyBuildingService partyBuildingService; |
| | | @Resource |
| | | private UserService userService; |
| | | /** |
| | | * 导入模板名字 |
| | | */ |
| | | private final String UPLOAD_EXCEL = "社区党员数据导入模板.xlsx"; |
| | | |
| | | @ApiOperation(value = "社区所有党组织",response = PartyOrganizationVO.class) |
| | | @GetMapping("listpartyorganization") |
| | | public R listPartyOrganization() { |
| | | return partyBuildingService.listPartyOrganization(); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增党员") |
| | | @PostMapping("addpartybuildingmember") |
| | | public R addPartyBuildingMember(@RequestBody PartyBuildingMemberVO partyBuildingMemberVO) { |
| | | Long communityId = this.getCommunityId(); |
| | | partyBuildingMemberVO.setCommunityId(communityId); |
| | | return partyBuildingService.addPartyBuildingMember(partyBuildingMemberVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑党员") |
| | | @PutMapping("updatepartybuildingmember") |
| | | public R updatePartyBuildingMember(@RequestBody PartyBuildingMemberVO partyBuildingMemberVO) { |
| | | Long id = partyBuildingMemberVO.getId(); |
| | | if (null==id||0==id) { |
| | | return R.fail("党员id不能为空"); |
| | | } |
| | | return partyBuildingService.updatePartyBuildingMember(partyBuildingMemberVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "下载模板-导入党员") |
| | | @GetMapping(value = "downloadtemplate",headers="Accept=application/octet-stream") |
| | | public ResponseEntity<byte[]> downloadTemplate() { |
| | | SFTPUtil sftp = new SFTPUtil(); |
| | | sftp.login(); |
| | | try { |
| | | |
| | | byte[] download = sftp.download(FtpConstants.FTPFILEPATH_MUBAN, UPLOAD_EXCEL); |
| | | ResponseEntity.BodyBuilder bodyBuilder = ResponseEntity.ok(); |
| | | bodyBuilder.contentType(MediaType.APPLICATION_OCTET_STREAM); |
| | | String encodeFileName = URLEncoder.encode(UPLOAD_EXCEL, "UTF-8"); |
| | | bodyBuilder.header("Content-Disposition","attachment;filename="+encodeFileName); |
| | | return bodyBuilder.body(download); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | log.error("下载模板失败【{}】",e.getMessage()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @ApiOperation(value = "上传照片") |
| | | @PostMapping(value = "uploadimage",consumes = "multipart/*",headers = "content-type=multipart/form-date") |
| | | public R uploadImage(@RequestParam MultipartFile file, HttpServletRequest request) { |
| | | String name = file.getOriginalFilename(); |
| | | try { |
| | | SFTPUtil sftp = new SFTPUtil(); |
| | | sftp.login(); |
| | | InputStream is = file.getInputStream(); |
| | | sftp.uploadMore(FtpConstants.FTPFILEPATH_IDCARD, name, is); |
| | | sftp.logout(); |
| | | return R.ok(FtpConstants.HTTP_URL+"/idcard/" + name); |
| | | } catch (Exception e) { |
| | | log.error("上传照片失败【{}】", e.getMessage()); |
| | | return R.fail(); |
| | | } |
| | | |
| | | } |
| | | |
| | | @ApiOperation(value = "批量新增党员导入excel") |
| | | @PostMapping(value = "downloadtemplate", consumes = "multipart/*",headers = "content-type=multipart/form-date") |
| | | public R downloadTemplate(@RequestParam MultipartFile file, HttpServletRequest request) { |
| | | String fileName = file.getOriginalFilename(); //获取文件名 |
| | | if (!fileName.equals(UPLOAD_EXCEL)) { |
| | | return R.fail(400, "文件名字错误"); |
| | | } |
| | | InputStream inputStream = null; |
| | | try { |
| | | inputStream = file.getInputStream();//todo 导入要看数据库有无重复数据 加入社区字段 身份证字段导入重复判断 |
| | | EasyExcel.read(inputStream, PartyBuildingMemberExcelVO.class, new PartyBuildingMemberExcelListen(partyBuildingService)).sheet().doRead(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | log.error("导入模板失败【{}】",e.getMessage()); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "党员管理分页查询",response = PartyBuildingMemberVO.class) |
| | | @PostMapping("pagepartyorganization") |
| | | public R pagePartyOrganization(@RequestBody PagePartyOrganizationVO pagePartyOrganizationVO) { |
| | | return partyBuildingService.pagePartyOrganization(pagePartyOrganizationVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "党员档案--党员活动",response = PartyBuildingActivityVO.class) |
| | | @PostMapping("listpartymemberactivities") |
| | | public R listPartyMemberActivities(@RequestBody PartyBuildingActivityVO partyBuildingActivityVO) { |
| | | return partyBuildingService.listPartyMemberActivities(partyBuildingActivityVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "活动报名名单分页查询",response = PageActivityMembersVO.class) |
| | | @PostMapping("pageactivitymembers") |
| | | public R pageActivityMembers(@RequestBody PageActivityMembersVO pageActivityMembersVO) { |
| | | return partyBuildingService.pageActivityMembers(pageActivityMembersVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "活动详情",response = PartyBuildingActivityVO.class) |
| | | @GetMapping("activityinfo") |
| | | public R activityinfo(@RequestParam("id") Long id) { |
| | | return partyBuildingService.activityinfo(id); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增党员活动") |
| | | @PostMapping("addactivity") |
| | | public R addActivity(@RequestBody PartyBuildingActivityVO partyBuildingActivityVO) { |
| | | return partyBuildingService.addactivity(partyBuildingActivityVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑党员活动") |
| | | @PutMapping("updateactivity") |
| | | public R updateActivity(@RequestBody PartyBuildingActivityVO partyBuildingActivityVO) { |
| | | Long id = partyBuildingActivityVO.getId(); |
| | | if (null==id||0==id) {//todo 修改报名人数 最低人数 0 的判断 |
| | | return R.fail("主键不能为空"); |
| | | } |
| | | return partyBuildingService.updateActivity(partyBuildingActivityVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "发布党员活动") |
| | | @PutMapping("releaseactivity") |
| | | public R releaseActivity(@RequestBody PartyBuildingActivityVO partyBuildingActivityVO) { |
| | | Long id = partyBuildingActivityVO.getId(); |
| | | if (null==id||0==id) { |
| | | return R.fail("主键不能为空"); |
| | | } |
| | | return partyBuildingService.releaseActivity(id); |
| | | } |
| | | |
| | | @ApiOperation(value = "删除党员活动") |
| | | @DeleteMapping("deleteactivity") |
| | | public R deleteActivity(@RequestBody PartyBuildingActivityVO partyBuildingActivityVO) { |
| | | Long id = partyBuildingActivityVO.getId(); |
| | | if (null==id||0==id) { |
| | | return R.fail("主键不能为空"); |
| | | } |
| | | return partyBuildingService.deleteActivity(id); |
| | | } |
| | | |
| | | @ApiOperation(value = "取消党员活动") |
| | | @PutMapping("cancelactivity") |
| | | public R cancelActivity(@RequestBody PartyBuildingActivityVO partyBuildingActivityVO) { |
| | | Long id = partyBuildingActivityVO.getId(); |
| | | String cancelReason = partyBuildingActivityVO.getCancelReason(); |
| | | boolean emptycancelReason = ObjectUtils.isEmpty(cancelReason); |
| | | boolean emptyid = ObjectUtils.isEmpty(id); |
| | | if (emptycancelReason||emptyid) { |
| | | return R.fail("参数不全"); |
| | | } |
| | | // R r = partyBuildingService.deleteActivity(id); |
| | | return partyBuildingService.cancelActivity(partyBuildingActivityVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询党员活动",response = PageActivityMembersVO.class) |
| | | @PostMapping("pageactivity") |
| | | public R pageActivity(@RequestBody PartyBuildingActivityVO partyBuildingActivityVO) { |
| | | Long CommunityId=this.getCommunityId(); |
| | | partyBuildingActivityVO.setCommunityId(CommunityId); |
| | | return partyBuildingService.pageActivity(partyBuildingActivityVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "社区下拉选择党员",response = PartyBuildingMemberVO.class) |
| | | @GetMapping("listpartymember") |
| | | public R listPartyMember() { |
| | | Long communityId =this.getCommunityId(); |
| | | return partyBuildingService.listPartyMember(communityId); |
| | | } |
| | | |
| | | @ApiOperation(value = "社区下拉选择身份",response = RoleVO.class) |
| | | @GetMapping("listidentity") |
| | | public R listIdentity() { |
| | | Long communityId =this.getCommunityId(); |
| | | return userService.listIdentity(communityId); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增党委") |
| | | @PostMapping("addpartycommittee") |
| | | public R addPartyCommittee(@RequestBody PartyCommitteeVO partyCommitteeVO) { |
| | | Long communityId =this.getCommunityId(); |
| | | partyCommitteeVO.setCommunityId(communityId); |
| | | return partyBuildingService.addPartyCommittee(partyCommitteeVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑党委") |
| | | @PutMapping("updatepartycommittee") |
| | | public R updatePartyCommittee(@RequestBody PartyCommitteeVO partyCommitteeVO) { |
| | | Long communityId = this.getCommunityId(); |
| | | partyCommitteeVO.setCommunityId(communityId); |
| | | return partyBuildingService.updatePartyCommittee(partyCommitteeVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "删除党委") |
| | | @DeleteMapping("deletepartycommittee") |
| | | public R deletePartyCommittee(@RequestBody PartyCommitteeVO partyCommitteeVO) { |
| | | Long communityId = this.getCommunityId(); |
| | | partyCommitteeVO.setCommunityId(communityId); |
| | | return partyBuildingService.deletePartyCommittee(partyCommitteeVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页党委查询",response = PartyCommitteeVO.class) |
| | | @PostMapping("pagepartycommittee") |
| | | public R pagePartyCommittee(@RequestBody PartyCommitteeVO partyCommitteeVO) { |
| | | Long communityId = this.getCommunityId(); |
| | | partyCommitteeVO.setCommunityId(communityId); |
| | | return partyBuildingService.pagePartyCommittee(partyCommitteeVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "新建动态/政策文件") |
| | | @PostMapping("adddynamic") |
| | | public R adddYnamic(@RequestBody PartyBuildingComPbDynVO partyCommitteeVO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | partyCommitteeVO.setCreateBy(loginUserInfo.getUserId()); |
| | | partyCommitteeVO.setCommunityId(loginUserInfo.getCommunityId()); |
| | | return partyBuildingService.adddYnamic(partyCommitteeVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑动态/政策文件") |
| | | @PutMapping("updatedynamic") |
| | | public R updateYnamic(@RequestBody PartyBuildingComPbDynVO partyCommitteeVO) { |
| | | Long id = partyCommitteeVO.getId(); |
| | | if (null==id||0==id) { |
| | | return R.fail("动态主键不能为空"); |
| | | } |
| | | return partyBuildingService.updateYnamic(partyCommitteeVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "动态/政策文件详情",response = PartyBuildingComPbDynVO.class) |
| | | @GetMapping("infodynamic") |
| | | public R infoYnamic(@RequestParam("id") Long id) { |
| | | return partyBuildingService.infoYnamic(id); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询党员动态/政策文件",response = PartyCommitteeVO.class) |
| | | @PostMapping("pagedynamic") |
| | | public R pageYnamic(@RequestBody PartyBuildingComPbDynVO partyBuildingComPbDynVO) { |
| | | Integer type = partyBuildingComPbDynVO.getType(); |
| | | if (null==type||0==type) { |
| | | return R.fail("类型不能为空"); |
| | | } |
| | | Long communityId=this.getCommunityId(); |
| | | partyBuildingComPbDynVO.setCommunityId(communityId); |
| | | return partyBuildingService.pageYnamic(partyBuildingComPbDynVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "删除动态/政策文件") |
| | | @DeleteMapping("deletedynamic") |
| | | public R deleteYnamic(@RequestBody PartyBuildingComPbDynVO partyBuildingComPbDynVO) { |
| | | Long id = partyBuildingComPbDynVO.getId(); |
| | | if (null==id||0==id) { |
| | | return R.fail("动态主键不能为空"); |
| | | } |
| | | return partyBuildingService.deleteYnamic(id); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "删除党员") |
| | | @DeleteMapping("deletepartybuildingmember") |
| | | public R deleteDynUser(@RequestBody PartyBuildingMemberVO partyBuildingMemberVO){ |
| | | Long id = partyBuildingMemberVO.getId(); |
| | | if (null==id||0==id) { |
| | | return R.fail("党员主键不能为空");//todo 加限制只能删除自己小区的党员 或者日志记录 |
| | | } |
| | | return partyBuildingService.deleteDynUser(id); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.community_backstage.api; |
| | | |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.vos.LoginReturnVO; |
| | | import com.panzhihua.common.model.vos.user.ChangePasswordVO; |
| | | import com.panzhihua.common.service.auth.TokenService; |
| | | import com.panzhihua.community_backstage.model.vos.LoginBody; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 登录 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 11:27 |
| | | **/ |
| | | @RestController |
| | | @RequestMapping("/") |
| | | @Api(tags = {"社区平台登录模块"}) |
| | | public class LoginApi extends BaseController { |
| | | @Resource |
| | | private TokenService tokenService; |
| | | |
| | | @ApiOperation(value = "社区平台登录",response = LoginReturnVO.class) |
| | | @PostMapping("login") |
| | | public R login(@RequestBody LoginBody loginBody){ |
| | | String account = loginBody.getAccount(); |
| | | String password = loginBody.getPassword(); |
| | | boolean empty = ObjectUtils.isEmpty(account); |
| | | boolean empty1 = ObjectUtils.isEmpty(password); |
| | | if (empty||empty1) { |
| | | return R.fail("账户密码不能为空"); |
| | | } |
| | | return tokenService.loginCommunityBackage(account, password); |
| | | } |
| | | |
| | | @ApiOperation(value = "刷新token",response =LoginReturnVO.class) |
| | | @GetMapping("refreshToken") |
| | | @ApiImplicitParam(name ="refreshToken",value = "登录返回的刷新token") |
| | | public R refreshToken(@RequestParam("refreshToken")String refreshToken){ |
| | | return tokenService.refreshToken(refreshToken); |
| | | } |
| | | |
| | | @ApiOperation(value = "用户登出") |
| | | @PostMapping("logout") |
| | | public R updateUserWeiXinPhone(){ |
| | | String token = this.getToken(); |
| | | boolean empty2 = ObjectUtils.isEmpty(token); |
| | | if (empty2) { |
| | | return R.ok(); |
| | | } |
| | | return tokenService.logout(token); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.community_backstage.api; |
| | | |
| | | import com.panzhihua.common.constants.HttpStatus; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.exceptions.UnAuthenticationException; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.user.ChangePasswordVO; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 用户模块 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 13:51 |
| | | **/ |
| | | @RestController |
| | | @Api(tags = {"用户模块"}) |
| | | @RequestMapping("/") |
| | | public class UserApi extends BaseController { |
| | | @Resource |
| | | private UserService userService; |
| | | @ApiOperation(value = "当前登录用户信息",response = LoginUserInfoVO.class) |
| | | @GetMapping("user") |
| | | public R detailUser(){ |
| | | Long userId = this.getUserId(); |
| | | return userService.detailUser(userId); |
| | | } |
| | | |
| | | @ApiOperation(value = "修改密码") |
| | | @PutMapping("changepassword") |
| | | public R changePassword(@Validated @RequestBody ChangePasswordVO changePasswordVO){ |
| | | Long userId = this.getUserId(); |
| | | String newPassword = changePasswordVO.getNewPassword(); |
| | | String oldPassword=changePasswordVO.getOldPassword(); |
| | | if (newPassword.equals(oldPassword)) { |
| | | return R.fail("修改失败,新密码和原密码一致"); |
| | | } |
| | | changePasswordVO.setUserId(userId); |
| | | return userService.changePassword(changePasswordVO); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.community_backstage.config; |
| | | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import springfox.documentation.builders.ApiInfoBuilder; |
| | | import springfox.documentation.builders.PathSelectors; |
| | | import springfox.documentation.builders.RequestHandlerSelectors; |
| | | import springfox.documentation.service.ApiInfo; |
| | | import springfox.documentation.service.Contact; |
| | | import springfox.documentation.spi.DocumentationType; |
| | | import springfox.documentation.spring.web.plugins.Docket; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: swagger3 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-19 16:08 |
| | | **/ |
| | | @Configuration |
| | | public class SwaggerConfig { |
| | | @Bean |
| | | public Docket createRestApi() { |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | .apiInfo(apiInfo()) |
| | | .select() |
| | | .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) |
| | | .paths(PathSelectors.any()) |
| | | .build(); |
| | | } |
| | | |
| | | private ApiInfo apiInfo() { |
| | | return new ApiInfoBuilder() |
| | | .title("社区后台管理接口") |
| | | .description("。") |
| | | .contact(new Contact("Ray。", "http://www.ruiyeclub.cn", "ruiyeclub@foxmail.com")) |
| | | .version("1.0") |
| | | .build(); |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.community_backstage.listen; |
| | | |
| | | import com.alibaba.excel.context.AnalysisContext; |
| | | import com.alibaba.excel.event.AnalysisEventListener; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.panzhihua.common.constants.HttpStatus; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.partybuilding.PartyBuildingMemberExcelVO; |
| | | import com.panzhihua.common.service.partybuilding.PartyBuildingService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 党员导入监听 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-30 15:12 |
| | | **/ |
| | | @Slf4j |
| | | public class PartyBuildingMemberExcelListen extends AnalysisEventListener<PartyBuildingMemberExcelVO> { |
| | | |
| | | private PartyBuildingService partyBuildingService; |
| | | |
| | | |
| | | public PartyBuildingMemberExcelListen(PartyBuildingService partyBuildingService){ |
| | | this.partyBuildingService = partyBuildingService; |
| | | } |
| | | |
| | | |
| | | private static final int BATCH_COUNT = 100; |
| | | private List<PartyBuildingMemberExcelVO> list = new ArrayList<>(); |
| | | @Override |
| | | public void invoke(PartyBuildingMemberExcelVO partyBuildingMemberExcelVO, AnalysisContext analysisContext) { |
| | | list.add(partyBuildingMemberExcelVO); |
| | | // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM |
| | | if(list.size() >= BATCH_COUNT){ |
| | | log.info("excel导入数据【{}】", JSONObject.toJSONString(list)); |
| | | R r = this.partyBuildingService.listSavePartyBuildingMemberExcelVO(list); |
| | | if (r.getCode()!= HttpStatus.SUCCESS) { |
| | | log.error("excel导入数据失败【{}】",r.getMsg()); |
| | | } |
| | | list.clear(); //清空list |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void doAfterAllAnalysed(AnalysisContext analysisContext) { |
| | | log.info("excel导入数据【{}】", JSONObject.toJSONString(list)); |
| | | this.partyBuildingService.listSavePartyBuildingMemberExcelVO(list); //确保最后遗留的数据保存在数据库中 |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.community_backstage.model.vos; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 登录 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-24 10:54 |
| | | **/ |
| | | @Data |
| | | @ApiModel(value = "社区管理后台登录") |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class LoginBody { |
| | | |
| | | @ApiModelProperty(value = "登录账户") |
| | | private String account; |
| | | @ApiModelProperty(value = "登录密码") |
| | | private String password; |
| | | } |
New file |
| | |
| | | server: |
| | | port: 8199 |
| | | encoding: |
| | | force-response: true #中文乱码 |
| | | |
| | | spring: |
| | | application: |
| | | name: communitybackstage |
| | | |
| | | eureka: |
| | | client: |
| | | service-url: |
| | | defaultZone: http://localhost:8192/eureka/ |
| | | |
| | | feign: |
| | | hystrix: |
| | | enabled: true |
New file |
| | |
| | | HELP.md |
| | | target/ |
| | | !.mvn/wrapper/maven-wrapper.jar |
| | | !**/src/main/**/target/ |
| | | !**/src/test/**/target/ |
| | | |
| | | ### STS ### |
| | | .apt_generated |
| | | .classpath |
| | | .factorypath |
| | | .project |
| | | .settings |
| | | .springBeans |
| | | .sts4-cache |
| | | |
| | | ### IntelliJ IDEA ### |
| | | .idea |
| | | *.iws |
| | | *.iml |
| | | *.ipr |
| | | |
| | | ### NetBeans ### |
| | | /nbproject/private/ |
| | | /nbbuild/ |
| | | /dist/ |
| | | /nbdist/ |
| | | /.nb-gradle/ |
| | | build/ |
| | | !**/src/main/**/build/ |
| | | !**/src/test/**/build/ |
| | | |
| | | ### VS Code ### |
| | | .vscode/ |
New file |
| | |
| | | /* |
| | | * Copyright 2007-present the original author or authors. |
| | | * |
| | | * Licensed 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. |
| | | */ |
| | | |
| | | import java.net.*; |
| | | import java.io.*; |
| | | import java.nio.channels.*; |
| | | import java.util.Properties; |
| | | |
| | | public class MavenWrapperDownloader { |
| | | |
| | | private static final String WRAPPER_VERSION = "0.5.6"; |
| | | /** |
| | | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. |
| | | */ |
| | | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" |
| | | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; |
| | | |
| | | /** |
| | | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to |
| | | * use instead of the default one. |
| | | */ |
| | | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = |
| | | ".mvn/wrapper/maven-wrapper.properties"; |
| | | |
| | | /** |
| | | * Path where the maven-wrapper.jar will be saved to. |
| | | */ |
| | | private static final String MAVEN_WRAPPER_JAR_PATH = |
| | | ".mvn/wrapper/maven-wrapper.jar"; |
| | | |
| | | /** |
| | | * Name of the property which should be used to override the default download url for the wrapper. |
| | | */ |
| | | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; |
| | | |
| | | public static void main(String args[]) { |
| | | System.out.println("- Downloader started"); |
| | | File baseDirectory = new File(args[0]); |
| | | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); |
| | | |
| | | // If the maven-wrapper.properties exists, read it and check if it contains a custom |
| | | // wrapperUrl parameter. |
| | | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); |
| | | String url = DEFAULT_DOWNLOAD_URL; |
| | | if (mavenWrapperPropertyFile.exists()) { |
| | | FileInputStream mavenWrapperPropertyFileInputStream = null; |
| | | try { |
| | | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); |
| | | Properties mavenWrapperProperties = new Properties(); |
| | | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); |
| | | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); |
| | | } catch (IOException e) { |
| | | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); |
| | | } finally { |
| | | try { |
| | | if (mavenWrapperPropertyFileInputStream != null) { |
| | | mavenWrapperPropertyFileInputStream.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | // Ignore ... |
| | | } |
| | | } |
| | | } |
| | | System.out.println("- Downloading from: " + url); |
| | | |
| | | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); |
| | | if (!outputFile.getParentFile().exists()) { |
| | | if (!outputFile.getParentFile().mkdirs()) { |
| | | System.out.println( |
| | | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); |
| | | } |
| | | } |
| | | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); |
| | | try { |
| | | downloadFileFromURL(url, outputFile); |
| | | System.out.println("Done"); |
| | | System.exit(0); |
| | | } catch (Throwable e) { |
| | | System.out.println("- Error downloading"); |
| | | e.printStackTrace(); |
| | | System.exit(1); |
| | | } |
| | | } |
| | | |
| | | private static void downloadFileFromURL(String urlString, File destination) throws Exception { |
| | | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { |
| | | String username = System.getenv("MVNW_USERNAME"); |
| | | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); |
| | | Authenticator.setDefault(new Authenticator() { |
| | | @Override |
| | | protected PasswordAuthentication getPasswordAuthentication() { |
| | | return new PasswordAuthentication(username, password); |
| | | } |
| | | }); |
| | | } |
| | | URL website = new URL(urlString); |
| | | ReadableByteChannel rbc; |
| | | rbc = Channels.newChannel(website.openStream()); |
| | | FileOutputStream fos = new FileOutputStream(destination); |
| | | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); |
| | | fos.close(); |
| | | rbc.close(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip |
| | | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar |
New file |
| | |
| | | #!/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 "$@" |
New file |
| | |
| | | @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% |
New file |
| | |
| | | <?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>com.panzhihua</groupId> |
| | | <artifactId>zhihuishequ</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <groupId>com.panzhihua</groupId> |
| | | <artifactId>config_server</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <name>config_server</name> |
| | | <description>config配置中心</description> |
| | | |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-config-server</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-bus-amqp</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-actuator</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> |
| | | </dependency> |
| | | |
| | | |
| | | |
| | | </dependencies> |
| | | |
| | | |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | </plugin> |
| | | <plugin> |
| | | <groupId>com.spotify</groupId> |
| | | <artifactId>docker-maven-plugin</artifactId> |
| | | <version>1.2.0</version> |
| | | <configuration> |
| | | <imageName>registry.cn-hangzhou.aliyuncs.com/wooddeep/config-server:v0.3</imageName> |
| | | <serverId>my-docker-registry</serverId> |
| | | <baseImage>java</baseImage> |
| | | <entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint> |
| | | <resources> |
| | | <resource> |
| | | <targetPath>/</targetPath> |
| | | <directory>${project.build.directory}</directory> |
| | | <include>${project.build.finalName}.jar</include> |
| | | </resource> |
| | | </resources> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | <repositories> |
| | | <repository> |
| | | <id>spring-snapshots</id> |
| | | <name>Spring Snapshots</name> |
| | | <url>https://repo.spring.io/snapshot</url> |
| | | <snapshots> |
| | | <enabled>true</enabled> |
| | | </snapshots> |
| | | </repository> |
| | | <repository> |
| | | <id>spring-milestones</id> |
| | | <name>Spring Milestones</name> |
| | | <url>https://repo.spring.io/milestone</url> |
| | | </repository> |
| | | </repositories> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.panzhihua.config_server; |
| | | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.cloud.client.SpringCloudApplication; |
| | | import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; |
| | | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; |
| | | |
| | | @EnableCircuitBreaker |
| | | @SpringCloudApplication |
| | | @EnableEurekaClient |
| | | public class ConfigServerApplication { |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(ConfigServerApplication.class, args); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | |
| | | server: |
| | | port: 8193 |
| | | |
| | | eureka: |
| | | instance: |
| | | preferIpAddress: true |
| | | client: |
| | | serviceUrl: |
| | | defaultZone: http://${EUREKA_URL:localhost}:8192/eureka |
| | | |
| | | spring: |
| | | application: |
| | | name: config |
| | | |
| | | cloud: |
| | | config: |
| | | server: |
| | | git: |
| | | uri: http://gitlab.nhys.cdnhxx.com/root/zhihuishequ/-/tree/master/config_repo |
| | | # search-paths: adminConfig |
| | | username: huanghongfa |
| | | password: huanghongfa123456 |
| | | basedir: F:\nahan\panzhihua_zhihuishequ\zhihuishequ |
New file |
| | |
| | | apiVersion: v1 |
| | | kind: Pod |
| | | metadata: |
| | | name: busybox |
| | | namespace: default |
| | | spec: |
| | | containers: |
| | | - image: busybox |
| | | command: |
| | | - sleep |
| | | - "3600" |
| | | imagePullPolicy: IfNotPresent |
| | | name: busybox |
| | | restartPolicy: Always |
New file |
| | |
| | | --- |
| | | apiVersion: apps/v1 |
| | | kind: Deployment |
| | | metadata: |
| | | name: config-server |
| | | spec: |
| | | selector: |
| | | matchLabels: |
| | | app: springcloud-config-server |
| | | |
| | | replicas: 1 |
| | | |
| | | template: |
| | | metadata: |
| | | labels: |
| | | app: springcloud-config-server |
| | | spec: |
| | | containers: |
| | | - name: config-server-instance |
| | | image: registry.cn-hangzhou.aliyuncs.com/wooddeep/config-server:v0.3 |
| | | env: |
| | | - name: EUREKA_URL |
| | | value: eureka-server |
| | | ports: |
| | | - containerPort: 8765 |
| | | |
| | | |
| | | --- |
| | | kind: Service |
| | | apiVersion: v1 |
| | | metadata: |
| | | name: config-server |
| | | spec: |
| | | selector: |
| | | app: springcloud-config-server |
| | | ports: |
| | | - protocol: TCP |
| | | port: 8765 |
| | | targetPort: 8765 |
| | | #type: NodePort |
| | | |
| | | |
New file |
| | |
| | | --- |
| | | apiVersion: apps/v1 |
| | | |
| | | kind: Deployment |
| | | |
| | | metadata: |
| | | |
| | | name: eureka-server |
| | | |
| | | spec: |
| | | |
| | | selector: |
| | | |
| | | matchLabels: |
| | | |
| | | app: spring-boot-app |
| | | |
| | | replicas: 1 |
| | | |
| | | template: |
| | | |
| | | metadata: |
| | | |
| | | labels: |
| | | |
| | | app: spring-boot-app |
| | | |
| | | spec: |
| | | |
| | | containers: |
| | | |
| | | - name: eureka-server-instance |
| | | |
| | | image: registry.cn-hangzhou.aliyuncs.com/wooddeep/eureka-server:v3 |
| | | |
| | | ports: |
| | | |
| | | - containerPort: 8761 |
| | | env: |
| | | - name: EUREKA_URL |
| | | value: eureka-server |
| | | |
| | | --- |
| | | |
| | | apiVersion: v1 |
| | | kind: Service |
| | | metadata: |
| | | name: eureka-server |
| | | spec: |
| | | ports: |
| | | - port: 8761 |
| | | targetPort: 8761 |
| | | name: http |
| | | selector: |
| | | app: spring-boot-app |
| | | type: NodePort |
| | | |
| | | |
| | | |
| | | |
New file |
| | |
| | | --- |
| | | apiVersion: apps/v1 |
| | | kind: Deployment |
| | | metadata: |
| | | name: service-api |
| | | spec: |
| | | selector: |
| | | matchLabels: |
| | | app: springcloud-service-api |
| | | |
| | | replicas: 1 |
| | | |
| | | template: |
| | | metadata: |
| | | labels: |
| | | app: springcloud-service-api |
| | | spec: |
| | | containers: |
| | | - name: service-api-instance |
| | | image: registry.cn-hangzhou.aliyuncs.com/wooddeep/service-api:v4.2 |
| | | env: |
| | | - name: EUREKA_URL |
| | | value: eureka-server |
| | | - name: CONFIG_URL |
| | | value: config-server |
| | | ports: |
| | | - containerPort: 8764 |
| | | |
| | | |
| | | --- |
| | | kind: Service |
| | | apiVersion: v1 |
| | | metadata: |
| | | name: service-api |
| | | spec: |
| | | selector: |
| | | app: springcloud-service-api |
| | | ports: |
| | | - protocol: TCP |
| | | port: 8764 |
| | | targetPort: 8764 |
| | | #type: NodePort |
| | | |
| | | |
New file |
| | |
| | | --- |
| | | apiVersion: apps/v1 |
| | | kind: Deployment |
| | | metadata: |
| | | name: service-tp |
| | | spec: |
| | | selector: |
| | | matchLabels: |
| | | app: springcloud-service-tp |
| | | |
| | | replicas: 1 |
| | | |
| | | template: |
| | | metadata: |
| | | labels: |
| | | app: springcloud-service-tp |
| | | spec: |
| | | containers: |
| | | - name: service-tp-instance |
| | | image: registry.cn-hangzhou.aliyuncs.com/wooddeep/service-tp:v3 |
| | | env: |
| | | - name: EUREKA_URL |
| | | value: eureka-server |
| | | ports: |
| | | - containerPort: 8763 |
| | | |
| | | |
| | | --- |
| | | kind: Service |
| | | apiVersion: v1 |
| | | metadata: |
| | | name: service-tp |
| | | spec: |
| | | selector: |
| | | app: springcloud-service-tp |
| | | ports: |
| | | - protocol: TCP |
| | | port: 8763 |
| | | targetPort: 8763 |
| | | #type: NodePort |
| | | |
| | | |
New file |
| | |
| | | --- |
| | | apiVersion: apps/v1 |
| | | kind: Deployment |
| | | metadata: |
| | | name: service-zuul |
| | | spec: |
| | | selector: |
| | | matchLabels: |
| | | app: springcloud-service-zuul |
| | | |
| | | replicas: 1 |
| | | |
| | | template: |
| | | metadata: |
| | | labels: |
| | | app: springcloud-service-zuul |
| | | spec: |
| | | containers: |
| | | - name: service-zuul-instance |
| | | image: registry.cn-hangzhou.aliyuncs.com/magiclian/service-zuul:v3 |
| | | env: |
| | | - name: EUREKA_URL |
| | | value: eureka-server |
| | | ports: |
| | | - containerPort: 8762 |
| | | |
| | | |
| | | --- |
| | | kind: Service |
| | | apiVersion: v1 |
| | | metadata: |
| | | name: service-zuul |
| | | spec: |
| | | selector: |
| | | app: springcloud-service-zuul |
| | | ports: |
| | | - protocol: TCP |
| | | port: 8762 |
| | | targetPort: 8762 |
| | | type: NodePort |
| | | |
| | | |
| | | |
New file |
| | |
| | | HELP.md |
| | | target/ |
| | | !.mvn/wrapper/maven-wrapper.jar |
| | | !**/src/main/**/target/ |
| | | !**/src/test/**/target/ |
| | | |
| | | ### STS ### |
| | | .apt_generated |
| | | .classpath |
| | | .factorypath |
| | | .project |
| | | .settings |
| | | .springBeans |
| | | .sts4-cache |
| | | |
| | | ### IntelliJ IDEA ### |
| | | .idea |
| | | *.iws |
| | | *.iml |
| | | *.ipr |
| | | |
| | | ### NetBeans ### |
| | | /nbproject/private/ |
| | | /nbbuild/ |
| | | /dist/ |
| | | /nbdist/ |
| | | /.nb-gradle/ |
| | | build/ |
| | | !**/src/main/**/build/ |
| | | !**/src/test/**/build/ |
| | | |
| | | ### VS Code ### |
| | | .vscode/ |
New file |
| | |
| | | /* |
| | | * Copyright 2007-present the original author or authors. |
| | | * |
| | | * Licensed 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. |
| | | */ |
| | | |
| | | import java.net.*; |
| | | import java.io.*; |
| | | import java.nio.channels.*; |
| | | import java.util.Properties; |
| | | |
| | | public class MavenWrapperDownloader { |
| | | |
| | | private static final String WRAPPER_VERSION = "0.5.6"; |
| | | /** |
| | | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. |
| | | */ |
| | | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" |
| | | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; |
| | | |
| | | /** |
| | | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to |
| | | * use instead of the default one. |
| | | */ |
| | | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = |
| | | ".mvn/wrapper/maven-wrapper.properties"; |
| | | |
| | | /** |
| | | * Path where the maven-wrapper.jar will be saved to. |
| | | */ |
| | | private static final String MAVEN_WRAPPER_JAR_PATH = |
| | | ".mvn/wrapper/maven-wrapper.jar"; |
| | | |
| | | /** |
| | | * Name of the property which should be used to override the default download url for the wrapper. |
| | | */ |
| | | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; |
| | | |
| | | public static void main(String args[]) { |
| | | System.out.println("- Downloader started"); |
| | | File baseDirectory = new File(args[0]); |
| | | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); |
| | | |
| | | // If the maven-wrapper.properties exists, read it and check if it contains a custom |
| | | // wrapperUrl parameter. |
| | | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); |
| | | String url = DEFAULT_DOWNLOAD_URL; |
| | | if (mavenWrapperPropertyFile.exists()) { |
| | | FileInputStream mavenWrapperPropertyFileInputStream = null; |
| | | try { |
| | | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); |
| | | Properties mavenWrapperProperties = new Properties(); |
| | | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); |
| | | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); |
| | | } catch (IOException e) { |
| | | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); |
| | | } finally { |
| | | try { |
| | | if (mavenWrapperPropertyFileInputStream != null) { |
| | | mavenWrapperPropertyFileInputStream.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | // Ignore ... |
| | | } |
| | | } |
| | | } |
| | | System.out.println("- Downloading from: " + url); |
| | | |
| | | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); |
| | | if (!outputFile.getParentFile().exists()) { |
| | | if (!outputFile.getParentFile().mkdirs()) { |
| | | System.out.println( |
| | | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); |
| | | } |
| | | } |
| | | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); |
| | | try { |
| | | downloadFileFromURL(url, outputFile); |
| | | System.out.println("Done"); |
| | | System.exit(0); |
| | | } catch (Throwable e) { |
| | | System.out.println("- Error downloading"); |
| | | e.printStackTrace(); |
| | | System.exit(1); |
| | | } |
| | | } |
| | | |
| | | private static void downloadFileFromURL(String urlString, File destination) throws Exception { |
| | | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { |
| | | String username = System.getenv("MVNW_USERNAME"); |
| | | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); |
| | | Authenticator.setDefault(new Authenticator() { |
| | | @Override |
| | | protected PasswordAuthentication getPasswordAuthentication() { |
| | | return new PasswordAuthentication(username, password); |
| | | } |
| | | }); |
| | | } |
| | | URL website = new URL(urlString); |
| | | ReadableByteChannel rbc; |
| | | rbc = Channels.newChannel(website.openStream()); |
| | | FileOutputStream fos = new FileOutputStream(destination); |
| | | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); |
| | | fos.close(); |
| | | rbc.close(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip |
| | | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar |
New file |
| | |
| | | #!/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 "$@" |
New file |
| | |
| | | @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% |
New file |
| | |
| | | <?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>com.panzhihua</groupId> |
| | | <artifactId>zhihuishequ</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <groupId>com.panzhihua</groupId> |
| | | <artifactId>eureka_server</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <name>eureka_server</name> |
| | | <description>eureka注册中心</description> |
| | | |
| | | |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> |
| | | </dependency> |
| | | |
| | | |
| | | |
| | | </dependencies> |
| | | |
| | | |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | </plugin> |
| | | |
| | | <plugin> |
| | | <groupId>com.spotify</groupId> |
| | | <artifactId>docker-maven-plugin</artifactId> |
| | | <version>1.2.0</version> |
| | | <configuration> |
| | | <imageName>eureka-server:v1</imageName> |
| | | <baseImage>java</baseImage> |
| | | <entryPoint>["java", "-jar", "/${project.build.finalName}.jar"]</entryPoint> |
| | | <resources> |
| | | <resource> |
| | | <targetPath>/</targetPath> |
| | | <directory>${project.build.directory}</directory> |
| | | <include>${project.build.finalName}.jar</include> |
| | | </resource> |
| | | </resources> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | <repositories> |
| | | <repository> |
| | | <id>spring-snapshots</id> |
| | | <name>Spring Snapshots</name> |
| | | <url>https://repo.spring.io/snapshot</url> |
| | | <snapshots> |
| | | <enabled>true</enabled> |
| | | </snapshots> |
| | | </repository> |
| | | <repository> |
| | | <id>spring-milestones</id> |
| | | <name>Spring Milestones</name> |
| | | <url>https://repo.spring.io/milestone</url> |
| | | </repository> |
| | | </repositories> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.panzhihua.eureka_server; |
| | | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.cloud.client.SpringCloudApplication; |
| | | import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; |
| | | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; |
| | | |
| | | @SpringCloudApplication |
| | | @EnableEurekaServer |
| | | @EnableCircuitBreaker |
| | | public class EurekaServerApplication { |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(EurekaServerApplication.class, args); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | server: |
| | | port: 8192 |
| | | |
| | | eureka: |
| | | instance: |
| | | hostname: eureka-server |
| | | preferIpAddress: true |
| | | client: |
| | | registerWithEureka: false #是否将自己注册到Eureka-Server中,默认的为true |
| | | fetchRegistry: false #是否从Eureka-Server中获取服务注册信息,默认为true |
| | | serviceUrl: |
| | | defaultZone: http://${EUREKA_URL:localhost}:${server.port}/eureka/ |
| | | server: |
| | | enable-self-preservation: false #是否开启自我保护模式 |
| | | eviction‐interval‐timer‐in‐ms: 10000 #服务注册表清理间隔(单位毫秒,默认是60*1000) |
| | | spring: |
| | | application: |
| | | name: eureka |
New file |
| | |
| | | <?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| | | <modelVersion>4.0.0</modelVersion> |
| | | |
| | | <groupId>com.panzhihua</groupId> |
| | | <artifactId>zhihuishequ</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | |
| | | <name>zhihuishequ</name> |
| | | <description>攀枝花智慧社区</description> |
| | | |
| | | <properties> |
| | | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| | | <java.version>1.8</java.version> |
| | | <spring-cloud.version>Hoxton.SR9</spring-cloud.version> |
| | | <spring-boot.version>2.3.4.RELEASE</spring-boot.version> |
| | | <mybatis-plus.version>3.4.1</mybatis-plus.version> |
| | | <swagger-annotations.version>2.1.5</swagger-annotations.version> |
| | | <swagger-bootstrap-ui.version>1.9.6</swagger-bootstrap-ui.version> |
| | | <swagger-models.version>2.0.0-rc2</swagger-models.version> |
| | | <swagger-core.version>2.1.5</swagger-core.version> |
| | | <commons.io.version>2.5</commons.io.version> |
| | | <poi.version>3.17</poi.version> |
| | | <commons.fileupload.version>1.3.3</commons.fileupload.version> |
| | | <velocity.version>1.7</velocity.version> |
| | | <fastjson.version>1.2.74</fastjson.version> |
| | | <common-pool.version>2.6.2</common-pool.version> |
| | | <common.version>1.0-SNAPSHOT</common.version> |
| | | <druid.version>1.2.3</druid.version> |
| | | <feign-form.version>1.2.3</feign-form.version> |
| | | <spring-data-redis.version>2.2.0.M4</spring-data-redis.version> |
| | | <logback-classic.version>1.3.0-alpha4</logback-classic.version> |
| | | <jjwt.version>0.9.1</jjwt.version> |
| | | <logback-core.version>1.1.11</logback-core.version> |
| | | <logback-classic.version>1.1.11</logback-classic.version> |
| | | <swagger-annotations.version>2.1.5</swagger-annotations.version> |
| | | <slf4j-api.version>1.7.25</slf4j-api.version> |
| | | <feign-httpclient.version>8.17.0</feign-httpclient.version> |
| | | <druid-spring-boot-starter.version>1.2.3</druid-spring-boot-starter.version> |
| | | <spring-cloud-starter-netflix-hystrix.version>2.2.6.RELEASE</spring-cloud-starter-netflix-hystrix.version> |
| | | <spring-boot-starter-data-redis.version>2.4.0</spring-boot-starter-data-redis.version> |
| | | <springfox-boot-starter.version>3.0.0</springfox-boot-starter.version> |
| | | </properties> |
| | | |
| | | <!-- 依赖声明 --> |
| | | <dependencyManagement> |
| | | <dependencies> |
| | | |
| | | <!-- SpringCloud 微服务 --> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-dependencies</artifactId> |
| | | <version>${spring-cloud.version}</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | </dependency> |
| | | |
| | | <!-- SpringBoot 依赖配置 --> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-dependencies</artifactId> |
| | | <version>${spring-boot.version}</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | </dependency> |
| | | |
| | | <!-- mybatis-plus 依赖配置 --> |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-boot-starter</artifactId> |
| | | <version>${mybatis-plus.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- Swagger 依赖配置 --> |
| | | <dependency> |
| | | <groupId>com.github.xiaoymin</groupId> |
| | | <artifactId>swagger-bootstrap-ui</artifactId> |
| | | <version>1.9.6</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger-ui</artifactId> |
| | | <version>2.9.2</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>io.springfox</groupId> |
| | | <artifactId>springfox-swagger2</artifactId> |
| | | <version>2.9.2</version> |
| | | </dependency> |
| | | |
| | | <!-- io常用工具类 --> |
| | | <dependency> |
| | | <groupId>commons-io</groupId> |
| | | <artifactId>commons-io</artifactId> |
| | | <version>${commons.io.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- excel工具 --> |
| | | <dependency> |
| | | <groupId>org.apache.poi</groupId> |
| | | <artifactId>poi-ooxml</artifactId> |
| | | <version>${poi.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 文件上传工具类 --> |
| | | <dependency> |
| | | <groupId>commons-fileupload</groupId> |
| | | <artifactId>commons-fileupload</artifactId> |
| | | <version>${commons.fileupload.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 代码生成使用模板 --> |
| | | <dependency> |
| | | <groupId>org.apache.velocity</groupId> |
| | | <artifactId>velocity</artifactId> |
| | | <version>${velocity.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- JSON 解析器和生成器 --> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>fastjson</artifactId> |
| | | <version>${fastjson.version}</version> |
| | | </dependency> |
| | | |
| | | <!-- 公共资源池 --> |
| | | <dependency> |
| | | <groupId>org.apache.commons</groupId> |
| | | <artifactId>commons-pool2</artifactId> |
| | | <version>${common-pool.version}</version> |
| | | </dependency> |
| | | <!--公共模块--> |
| | | <dependency> |
| | | <groupId>com.panzhihua</groupId> |
| | | <artifactId>common</artifactId> |
| | | <version>${common.version}</version> |
| | | </dependency> |
| | | <!-- 数据库连接池 --> |
| | | <!-- https://mvnrepository.com/artifact/com.alibaba/druid-spring-boot-starter --> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>druid-spring-boot-starter</artifactId> |
| | | <version>${druid-spring-boot-starter.version}</version> |
| | | </dependency> |
| | | <!-- 日志--> |
| | | <dependency> |
| | | <groupId>org.slf4j</groupId> |
| | | <artifactId>slf4j-api</artifactId> |
| | | <version>${slf4j-api.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>ch.qos.logback</groupId> |
| | | <artifactId>logback-core</artifactId> |
| | | <version>${logback-core.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>ch.qos.logback</groupId> |
| | | <artifactId>logback-classic</artifactId> |
| | | <version>${logback-classic.version}</version> |
| | | </dependency> |
| | | <!-- redis--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-data-redis</artifactId> |
| | | <version>${spring-boot-starter-data-redis.version}</version> |
| | | </dependency> |
| | | <!-- jwt--> |
| | | <!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt --> |
| | | <dependency> |
| | | <groupId>io.jsonwebtoken</groupId> |
| | | <artifactId>jjwt</artifactId> |
| | | <version>${jjwt.version}</version> |
| | | </dependency> |
| | | <!-- 断路器--> |
| | | <!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-netflix-hystrix --> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-netflix-hystrix</artifactId> |
| | | <version>${spring-cloud-starter-netflix-hystrix.version}</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.netflix.feign</groupId> |
| | | <artifactId>feign-httpclient</artifactId> |
| | | <version>${feign-httpclient.version}</version> |
| | | </dependency> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | </dependencies> |
| | | </dependencyManagement> |
| | | |
| | | <modules> |
| | | <module>eureka_server</module> |
| | | <module>config_server</module> |
| | | <module>common</module> |
| | | <module>service_partybuilding</module> |
| | | <module>zuul</module> |
| | | <module>auth</module> |
| | | <module>applets_backstage</module> |
| | | <module>applets</module> |
| | | <module>community_backstage</module> |
| | | <module>service_community</module> |
| | | </modules> |
| | | <packaging>pom</packaging> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.apache.maven.plugins</groupId> |
| | | <artifactId>maven-compiler-plugin</artifactId> |
| | | <configuration> |
| | | <source>${java.version}</source> |
| | | <target>${java.version}</target> |
| | | <encoding>${project.build.sourceEncoding}</encoding> |
| | | </configuration> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | </project> |
New file |
| | |
| | | HELP.md |
| | | target/ |
| | | !.mvn/wrapper/maven-wrapper.jar |
| | | !**/src/main/**/target/ |
| | | !**/src/test/**/target/ |
| | | |
| | | ### STS ### |
| | | .apt_generated |
| | | .classpath |
| | | .factorypath |
| | | .project |
| | | .settings |
| | | .springBeans |
| | | .sts4-cache |
| | | |
| | | ### IntelliJ IDEA ### |
| | | .idea |
| | | *.iws |
| | | *.iml |
| | | *.ipr |
| | | |
| | | ### NetBeans ### |
| | | /nbproject/private/ |
| | | /nbbuild/ |
| | | /dist/ |
| | | /nbdist/ |
| | | /.nb-gradle/ |
| | | build/ |
| | | !**/src/main/**/build/ |
| | | !**/src/test/**/build/ |
| | | |
| | | ### VS Code ### |
| | | .vscode/ |
New file |
| | |
| | | /* |
| | | * Copyright 2007-present the original author or authors. |
| | | * |
| | | * Licensed 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. |
| | | */ |
| | | |
| | | import java.net.*; |
| | | import java.io.*; |
| | | import java.nio.channels.*; |
| | | import java.util.Properties; |
| | | |
| | | public class MavenWrapperDownloader { |
| | | |
| | | private static final String WRAPPER_VERSION = "0.5.6"; |
| | | /** |
| | | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. |
| | | */ |
| | | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" |
| | | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; |
| | | |
| | | /** |
| | | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to |
| | | * use instead of the default one. |
| | | */ |
| | | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = |
| | | ".mvn/wrapper/maven-wrapper.properties"; |
| | | |
| | | /** |
| | | * Path where the maven-wrapper.jar will be saved to. |
| | | */ |
| | | private static final String MAVEN_WRAPPER_JAR_PATH = |
| | | ".mvn/wrapper/maven-wrapper.jar"; |
| | | |
| | | /** |
| | | * Name of the property which should be used to override the default download url for the wrapper. |
| | | */ |
| | | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; |
| | | |
| | | public static void main(String args[]) { |
| | | System.out.println("- Downloader started"); |
| | | File baseDirectory = new File(args[0]); |
| | | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); |
| | | |
| | | // If the maven-wrapper.properties exists, read it and check if it contains a custom |
| | | // wrapperUrl parameter. |
| | | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); |
| | | String url = DEFAULT_DOWNLOAD_URL; |
| | | if (mavenWrapperPropertyFile.exists()) { |
| | | FileInputStream mavenWrapperPropertyFileInputStream = null; |
| | | try { |
| | | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); |
| | | Properties mavenWrapperProperties = new Properties(); |
| | | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); |
| | | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); |
| | | } catch (IOException e) { |
| | | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); |
| | | } finally { |
| | | try { |
| | | if (mavenWrapperPropertyFileInputStream != null) { |
| | | mavenWrapperPropertyFileInputStream.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | // Ignore ... |
| | | } |
| | | } |
| | | } |
| | | System.out.println("- Downloading from: " + url); |
| | | |
| | | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); |
| | | if (!outputFile.getParentFile().exists()) { |
| | | if (!outputFile.getParentFile().mkdirs()) { |
| | | System.out.println( |
| | | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); |
| | | } |
| | | } |
| | | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); |
| | | try { |
| | | downloadFileFromURL(url, outputFile); |
| | | System.out.println("Done"); |
| | | System.exit(0); |
| | | } catch (Throwable e) { |
| | | System.out.println("- Error downloading"); |
| | | e.printStackTrace(); |
| | | System.exit(1); |
| | | } |
| | | } |
| | | |
| | | private static void downloadFileFromURL(String urlString, File destination) throws Exception { |
| | | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { |
| | | String username = System.getenv("MVNW_USERNAME"); |
| | | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); |
| | | Authenticator.setDefault(new Authenticator() { |
| | | @Override |
| | | protected PasswordAuthentication getPasswordAuthentication() { |
| | | return new PasswordAuthentication(username, password); |
| | | } |
| | | }); |
| | | } |
| | | URL website = new URL(urlString); |
| | | ReadableByteChannel rbc; |
| | | rbc = Channels.newChannel(website.openStream()); |
| | | FileOutputStream fos = new FileOutputStream(destination); |
| | | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); |
| | | fos.close(); |
| | | rbc.close(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip |
| | | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar |
New file |
| | |
| | | #!/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 "$@" |
New file |
| | |
| | | @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% |
New file |
| | |
| | | <?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>com.panzhihua</groupId> |
| | | <artifactId>zhihuishequ</artifactId> |
| | | <version>1.0-SNAPSHOT</version> |
| | | </parent> |
| | | <groupId>com.panzhihua</groupId> |
| | | <artifactId>service_community</artifactId> |
| | | <version>0.0.1-SNAPSHOT</version> |
| | | <name>service_community</name> |
| | | <description>社区</description> |
| | | |
| | | |
| | | |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-web</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-config</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-starter-openfeign</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-test</artifactId> |
| | | <scope>test</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.alibaba</groupId> |
| | | <artifactId>druid-spring-boot-starter</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>mysql</groupId> |
| | | <artifactId>mysql-connector-java</artifactId> |
| | | <scope>runtime</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.netflix.hystrix</groupId> |
| | | <artifactId>hystrix-javanica</artifactId> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.baomidou</groupId> |
| | | <artifactId>mybatis-plus-boot-starter</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.panzhihua</groupId> |
| | | <artifactId>common</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.springframework.data</groupId> |
| | | <artifactId>spring-data-redis</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | | <dependencyManagement> |
| | | <dependencies> |
| | | <dependency> |
| | | <groupId>org.springframework.cloud</groupId> |
| | | <artifactId>spring-cloud-dependencies</artifactId> |
| | | <version>${spring-cloud.version}</version> |
| | | <type>pom</type> |
| | | <scope>import</scope> |
| | | </dependency> |
| | | </dependencies> |
| | | </dependencyManagement> |
| | | |
| | | <build> |
| | | <plugins> |
| | | <plugin> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-maven-plugin</artifactId> |
| | | </plugin> |
| | | </plugins> |
| | | </build> |
| | | |
| | | <repositories> |
| | | <repository> |
| | | <id>spring-milestones</id> |
| | | <name>Spring Milestones</name> |
| | | <url>https://repo.spring.io/milestone</url> |
| | | </repository> |
| | | </repositories> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.panzhihua.service_community; |
| | | |
| | | import org.springframework.boot.SpringApplication; |
| | | import org.springframework.cloud.client.SpringCloudApplication; |
| | | import org.springframework.cloud.netflix.eureka.EnableEurekaClient; |
| | | |
| | | @SpringCloudApplication |
| | | @EnableEurekaClient |
| | | public class ServiceCommunityApplication { |
| | | |
| | | public static void main(String[] args) { |
| | | SpringApplication.run(ServiceCommunityApplication.class, args); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.api; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.*; |
| | | import com.panzhihua.common.model.vos.user.UserPhoneVO; |
| | | import com.panzhihua.service_community.model.dos.ComActActPrizeDO; |
| | | import com.panzhihua.service_community.model.dos.ComActDynDO; |
| | | import com.panzhihua.service_community.model.dos.ComActMicroWishDO; |
| | | import com.panzhihua.service_community.model.dos.ComMngStructAreaDO; |
| | | import com.panzhihua.service_community.service.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区活动 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 16:02 |
| | | **/ |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/") |
| | | public class CommunityApi { |
| | | @Resource |
| | | private ComActActivityService comActActivityService; |
| | | @Resource |
| | | private ComActActPrizeService comActActPrizeService; |
| | | @Resource |
| | | private ComActDynService comActDynService; |
| | | @Resource |
| | | private ComActMicroWishService comActMicroWishService; |
| | | @Resource |
| | | private ComActEasyPhotoService comActEasyPhotoService; |
| | | @Resource |
| | | private ComActService comActService; |
| | | @Resource |
| | | private ComMngStructHouseService comMngStructHouseService; |
| | | @Resource |
| | | private ComMngStructAreaService comMngStructAreaService; |
| | | @Resource |
| | | private ComMngStructOtherBuildService comMngStructOtherBuildService; |
| | | @Resource |
| | | private ComMngVolunteerMngService comMngVolunteerMngService; |
| | | |
| | | /** |
| | | * 新增社区活动 |
| | | * |
| | | * @param comActActivityVO 新增信息 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("addactivity") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R addActivity(@RequestBody ComActActivityVO comActActivityVO) { |
| | | R r = comActActivityService.addActivity(comActActivityVO); |
| | | boolean ok = R.isOk(r); |
| | | if (ok) { |
| | | Long activityId = (Long) r.getData(); |
| | | Integer hasPrize = comActActivityVO.getHasPrize(); |
| | | if (hasPrize.intValue() > 0) { |
| | | List<ComActActPrizeVO> comActActPrizeVOList = comActActivityVO.getComActActPrizeVOList(); |
| | | if (!ObjectUtils.isEmpty(comActActPrizeVOList)) { |
| | | List<ComActActPrizeDO> comActActPrizeDOS = new ArrayList<>(); |
| | | comActActPrizeVOList.forEach(comActActPrizeVO -> { |
| | | ComActActPrizeDO comActActPrizeDO = new ComActActPrizeDO(); |
| | | BeanUtils.copyProperties(comActActPrizeVO, comActActPrizeDO); |
| | | comActActPrizeDO.setActivityId(activityId); |
| | | comActActPrizeDOS.add(comActActPrizeDO); |
| | | }); |
| | | boolean saveBatch = comActActPrizeService.saveBatch(comActActPrizeDOS); |
| | | if (!saveBatch) { |
| | | return R.fail("保存奖品失败"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } else { |
| | | return R.fail(); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 编辑社区活动 |
| | | * |
| | | * @param comActActivityVO 编辑内容 |
| | | * @return 编辑结果 |
| | | */ |
| | | @PostMapping("putactivity") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R putActivity(@RequestBody ComActActivityVO comActActivityVO) { |
| | | R r = comActActivityService.putActivity(comActActivityVO); |
| | | List<ComActActPrizeVO> comActActPrizeVOList = comActActivityVO.getComActActPrizeVOList(); |
| | | boolean ok = R.isOk(r); |
| | | if (ok) { |
| | | Integer hasPrize = comActActivityVO.getHasPrize(); |
| | | if (!ObjectUtils.isEmpty(comActActPrizeVOList) && hasPrize.intValue() == 1) { |
| | | Long actActivityVOId = comActActivityVO.getId(); |
| | | comActActPrizeService.remove(new QueryWrapper<ComActActPrizeDO>().lambda().eq(ComActActPrizeDO::getActivityId, actActivityVOId)); |
| | | if (!ObjectUtils.isEmpty(comActActPrizeVOList)) { |
| | | List<ComActActPrizeDO> comActActPrizeDOS = new ArrayList<>(); |
| | | comActActPrizeVOList.forEach(comActActPrizeVO -> { |
| | | ComActActPrizeDO comActActPrizeDO = new ComActActPrizeDO(); |
| | | BeanUtils.copyProperties(comActActPrizeVO, comActActPrizeDO); |
| | | comActActPrizeDO.setActivityId(actActivityVOId); |
| | | comActActPrizeDOS.add(comActActPrizeDO); |
| | | }); |
| | | boolean saveBatch = comActActPrizeService.saveBatch(comActActPrizeDOS); |
| | | if (!saveBatch) { |
| | | return R.fail("保存奖品失败"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return r; |
| | | } |
| | | |
| | | /** |
| | | * 删除社区活动 |
| | | * |
| | | * @param comActActivityVO 活动主键 |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("deleteactivity") |
| | | public R deleteActivity(@RequestBody ComActActivityVO comActActivityVO) { |
| | | boolean remove = comActActivityService.removeById(comActActivityVO.getId()); |
| | | if (remove) { |
| | | comActActPrizeService.remove(new QueryWrapper<ComActActPrizeDO>().lambda().eq(ComActActPrizeDO::getActivityId, comActActivityVO.getId())); |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询社区活动 |
| | | * |
| | | * @param comActActivityVO 查询参数 |
| | | * @return 分页集合 |
| | | */ |
| | | @PostMapping("pageactivity") |
| | | public R pageActivity(@RequestBody ComActActivityVO comActActivityVO) { |
| | | R r = comActActivityService.pageActivity(comActActivityVO); |
| | | if (R.isOk(r)) { |
| | | Page<ComActActivityVO> page = (Page<ComActActivityVO>) r.getData(); |
| | | List<ComActActivityVO> content = page.getRecords(); |
| | | if (!ObjectUtils.isEmpty(content)) { |
| | | List<ComActActPrizeVO> comActActPrizeVOList = new ArrayList<>(); |
| | | content.forEach(comActActivityVO1 -> { |
| | | Long id = comActActivityVO1.getId(); |
| | | List<ComActActPrizeDO> list = comActActPrizeService.list(new QueryWrapper<ComActActPrizeDO>().lambda().eq(ComActActPrizeDO::getActivityId, id)); |
| | | if (!ObjectUtils.isEmpty(list)) { |
| | | list.forEach(comActActPrizeDO -> { |
| | | ComActActPrizeVO comActActPrizeVO = new ComActActPrizeVO(); |
| | | BeanUtils.copyProperties(comActActPrizeDO, comActActPrizeVO); |
| | | comActActPrizeVOList.add(comActActPrizeVO); |
| | | }); |
| | | } |
| | | comActActivityVO1.setComActActPrizeVOList(comActActPrizeVOList); |
| | | comActActPrizeVOList.clear(); |
| | | }); |
| | | } |
| | | |
| | | } |
| | | return r; |
| | | } |
| | | |
| | | /** |
| | | * 发布活动 |
| | | * |
| | | * @param comActActivityVO 主键id 发布时间 |
| | | * @return 发布结果 |
| | | */ |
| | | @PostMapping("releaseactivity") |
| | | public R releaseActivity(@RequestBody ComActActivityVO comActActivityVO) { |
| | | return comActActivityService.releaseActivity(comActActivityVO); |
| | | } |
| | | |
| | | /** |
| | | * 取消活动 |
| | | * |
| | | * @param comActActivityVO 取消原因 |
| | | * @return 取消结果 |
| | | */ |
| | | @PostMapping("cancelactivity") |
| | | public R cancelActivity(@RequestBody ComActActivityVO comActActivityVO) { |
| | | return comActActivityService.cancelActivity(comActActivityVO); |
| | | } |
| | | |
| | | /** |
| | | * 活动详情 |
| | | * |
| | | * @param id 活动id |
| | | * @return 详情 |
| | | */ |
| | | @PostMapping("detailactivity") |
| | | public R detailActivity(@RequestParam("id") Long id, @RequestParam("userId") Long userId) { |
| | | ComActActivityVO comActActivityVO = comActActivityService.inforActivity(id, userId); |
| | | if (ObjectUtils.isEmpty(comActActivityVO)) { |
| | | return R.fail("活动不存在"); |
| | | } |
| | | List<ComActActPrizeDO> comActActPrizeDOS = comActActPrizeService.list(new QueryWrapper<ComActActPrizeDO>().lambda().eq(ComActActPrizeDO::getActivityId, id)); |
| | | if (!ObjectUtils.isEmpty(comActActPrizeDOS)) { |
| | | List<ComActActPrizeVO> comActActPrizeVOS = new ArrayList<>(); |
| | | comActActPrizeDOS.forEach(comActActPrizeDO -> { |
| | | ComActActPrizeVO comActActPrizeVO = new ComActActPrizeVO(); |
| | | BeanUtils.copyProperties(comActActPrizeDO, comActActPrizeVO); |
| | | comActActPrizeVOS.add(comActActPrizeVO); |
| | | }); |
| | | comActActivityVO.setComActActPrizeVOList(comActActPrizeVOS); |
| | | } |
| | | ActivitySignVO activitySignVO = new ActivitySignVO(); |
| | | activitySignVO.setActivityId(id); |
| | | R r = comActActivityService.listActivitySign(activitySignVO); |
| | | if (R.isOk(r)) { |
| | | List<ActivitySignVO> activitySignVOS = (List<ActivitySignVO>) r.getData(); |
| | | comActActivityVO.setActivitySignVOList(activitySignVOS); |
| | | } |
| | | return R.ok(comActActivityVO); |
| | | } |
| | | |
| | | /** |
| | | * 活动报名名单 |
| | | * |
| | | * @param activitySignVO 查询参数 |
| | | * @return 报名人员集合 |
| | | */ |
| | | @PostMapping("listactivitysign") |
| | | public R listActivitySign(@RequestBody ActivitySignVO activitySignVO) { |
| | | return comActActivityService.listActivitySign(activitySignVO); |
| | | } |
| | | |
| | | /** |
| | | * 新增社区动态 |
| | | * |
| | | * @param comActDynVO 新增信息 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("adddynamic") |
| | | public R addDynamic(@RequestBody ComActDynVO comActDynVO) { |
| | | ComActDynDO comActDynDO = new ComActDynDO(); |
| | | BeanUtils.copyProperties(comActDynVO, comActDynDO); |
| | | boolean save = comActDynService.save(comActDynDO); |
| | | if (save) { |
| | | // 最多只能设置三条置顶状态,后边设置会取消先前设置的置顶 |
| | | Integer isTopping = comActDynVO.getIsTopping(); |
| | | boolean b = isTopping.intValue() == 1; |
| | | if (b) { |
| | | List<ComActDynDO> list = comActDynService.list(new QueryWrapper<ComActDynDO>().lambda().eq(ComActDynDO::getIsTopping, 1).eq(ComActDynDO::getCommunityId, comActDynVO.getCommunityId())); |
| | | if (!ObjectUtils.isEmpty(list)) { |
| | | int size = list.size(); |
| | | if (size == 4) { |
| | | List<ComActDynDO> collect = list.stream().sorted(Comparator.comparing(ComActDynDO::getCreateAt)).collect(Collectors.toList()); |
| | | ComActDynDO comActDynDO1 = collect.get(0); |
| | | comActDynDO1.setIsTopping(0); |
| | | boolean update = comActDynService.updateById(comActDynDO1); |
| | | if (!update) { |
| | | return R.fail("修改置顶状态失败"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 编辑社区动态 |
| | | * |
| | | * @param comActDynVO 编辑内容 |
| | | * @return 编辑结果 |
| | | */ |
| | | @PostMapping("putdynamic") |
| | | public R putDynamic(@RequestBody ComActDynVO comActDynVO) { |
| | | ComActDynDO comActDynDO = new ComActDynDO(); |
| | | BeanUtils.copyProperties(comActDynVO, comActDynDO); |
| | | boolean update = comActDynService.updateById(comActDynDO); |
| | | if (update) { |
| | | // 最多只能设置三条置顶状态,后边设置会取消先前设置的置顶 |
| | | Integer isTopping = comActDynVO.getIsTopping(); |
| | | boolean b = isTopping.intValue() == 1; |
| | | if (b) { |
| | | List<ComActDynDO> list = comActDynService.list(new QueryWrapper<ComActDynDO>().lambda().eq(ComActDynDO::getIsTopping, 1).eq(ComActDynDO::getCommunityId, comActDynVO.getCommunityId())); |
| | | if (!ObjectUtils.isEmpty(list)) { |
| | | int size = list.size(); |
| | | if (size == 4) { |
| | | List<ComActDynDO> collect = list.stream().sorted(Comparator.comparing(ComActDynDO::getUpdateAt)).collect(Collectors.toList()); |
| | | ComActDynDO comActDynDO1 = collect.get(0); |
| | | comActDynDO1.setIsTopping(0); |
| | | boolean updateById = comActDynService.updateById(comActDynDO1); |
| | | if (!updateById) { |
| | | return R.fail("修改置顶状态失败"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 删除社区动态 |
| | | * |
| | | * @param comActDynVO 动态id |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("deletedynamic") |
| | | public R deleteDynamic(@RequestBody ComActDynVO comActDynVO) { |
| | | boolean b = comActDynService.removeById(comActDynVO.getId()); |
| | | if (b) { |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询社区动态 |
| | | * |
| | | * @param comActDynVO 查询参数 |
| | | * @return 动态集合 |
| | | */ |
| | | @PostMapping("pagedynamic") |
| | | public R pageDynamic(@RequestBody ComActDynVO comActDynVO) { |
| | | return comActDynService.pageDynamic(comActDynVO); |
| | | } |
| | | |
| | | /** |
| | | * 社区动态详情 |
| | | * |
| | | * @param id 动态id |
| | | * @return 详情 |
| | | */ |
| | | @PostMapping("detaildynamic") |
| | | public R detailDynamic(@RequestParam("id") Long id) { |
| | | return comActDynService.detailDynamic(id); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分页查询随手拍 |
| | | * |
| | | * @param comActEasyPhotoVO 查询参数 |
| | | * @return 心愿列表 |
| | | */ |
| | | @PostMapping("pageeasyphoto") |
| | | public R pageEasyPhoto(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO) { |
| | | return comActEasyPhotoService.pageEasyPhoto(comActEasyPhotoVO); |
| | | } |
| | | |
| | | /** |
| | | * 随手拍详情 |
| | | * |
| | | * @param id 随手拍主键 |
| | | * @param userId 登录用户 |
| | | * @return 详情内容 |
| | | */ |
| | | @PostMapping("detaileasyphoto") |
| | | public R detailEasyPhoto(@RequestParam("id") Long id, @RequestParam("userId") Long userId) { |
| | | return comActEasyPhotoService.detailEasyPhoto(id, userId); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询微心愿 |
| | | * |
| | | * @param comActMicroWishVO 查询参数 |
| | | * @return 分页集合 |
| | | */ |
| | | @PostMapping("pagemicrowish") |
| | | public R pageMicroWish(@RequestBody ComActMicroWishVO comActMicroWishVO) { |
| | | return comActMicroWishService.pageMicroWish(comActMicroWishVO); |
| | | } |
| | | |
| | | /** |
| | | * 心愿详情 |
| | | * |
| | | * @param id 查询主键 |
| | | * @param userId 登录用户id |
| | | * @return 心愿内容 |
| | | */ |
| | | @PostMapping("detailmicrowish") |
| | | public R detailMicroWish(@RequestParam("id") Long id, @RequestParam("userId") Long userId) { |
| | | return comActMicroWishService.detailMicroWish(id, userId); |
| | | } |
| | | |
| | | /** |
| | | * 审核、分配、反馈心愿 |
| | | * |
| | | * @param comActMicroWishVO 具体操作 |
| | | * @return 操作结果 |
| | | */ |
| | | @PostMapping("putlmicrowish") |
| | | public R putlMicroWish(@RequestBody ComActMicroWishVO comActMicroWishVO) { |
| | | return comActMicroWishService.putlMicroWish(comActMicroWishVO); |
| | | } |
| | | |
| | | /** |
| | | * 分页展示我的所有活动 时间倒序排列 |
| | | * |
| | | * @param comActActivityVO 分页参数 |
| | | * @return 分页集合 |
| | | */ |
| | | @PostMapping("pagemyactivity") |
| | | public R pageMyActivity(@RequestBody ComActActivityVO comActActivityVO) { |
| | | return comActActivityService.pageMyActivity(comActActivityVO); |
| | | } |
| | | |
| | | /** |
| | | * 报名/取消报名社区活动 |
| | | * |
| | | * @param signactivityVO 报名参数 |
| | | * @return 报名 取消报名 结果 |
| | | */ |
| | | @PostMapping("signactivity") |
| | | public R signActivity(@RequestBody SignactivityVO signactivityVO) { |
| | | return comActActivityService.signActivity(signactivityVO); |
| | | } |
| | | |
| | | /** |
| | | * 上传随手拍 |
| | | * |
| | | * @param comActEasyPhotoVO 上传数据 |
| | | * @return 上传结果 |
| | | */ |
| | | @PostMapping("addeasyphoto") |
| | | public R addEasyPhoto(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO) { |
| | | return comActEasyPhotoService.addEasyPhoto(comActEasyPhotoVO); |
| | | } |
| | | |
| | | /** |
| | | * 发布微心愿 |
| | | * |
| | | * @param comActMicroWishVO 发布内容 |
| | | * @return 发布结果 |
| | | */ |
| | | @PostMapping("addmicrowish") |
| | | public R addMicroWish(@RequestBody ComActMicroWishVO comActMicroWishVO) { |
| | | ComActMicroWishDO comActMicroWishDO = new ComActMicroWishDO(); |
| | | BeanUtils.copyProperties(comActMicroWishVO, comActMicroWishDO); |
| | | boolean save = comActMicroWishService.save(comActMicroWishDO); |
| | | if (save) { |
| | | return R.ok(); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | /** |
| | | * 点赞/取消点赞随手拍 |
| | | * |
| | | * @param comActEasyPhotoVO 操作参数 |
| | | * @return 操作结果 |
| | | */ |
| | | @PostMapping("puteasyphoto") |
| | | public R putEasyPhoto(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO) { |
| | | return comActEasyPhotoService.putEasyPhoto(comActEasyPhotoVO); |
| | | } |
| | | |
| | | /** |
| | | * 点赞/取消点赞微心愿 |
| | | * |
| | | * @param comActMicroWishVO 操作参数 |
| | | * @return 操作结果 |
| | | */ |
| | | @PostMapping("putmicrowish") |
| | | public R putMicroWish(@RequestBody ComActMicroWishVO comActMicroWishVO) { |
| | | return comActMicroWishService.comActMicroWishVO(comActMicroWishVO); |
| | | } |
| | | |
| | | /** |
| | | * 新增社区动态浏览记录 |
| | | * |
| | | * @param id 动态主键 |
| | | * @param userId 登录用户id |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("adddynamicuser") |
| | | public R addDynamicUser(@RequestParam("id") Long id, @RequestParam("userId") Long userId) { |
| | | return comActDynService.addDynamicUser(id, userId); |
| | | } |
| | | |
| | | /** |
| | | * 审核反馈随手拍 |
| | | * |
| | | * @param comActEasyPhotoVO 操作参数 |
| | | * @return 操作结果 |
| | | */ |
| | | @PostMapping("puteasyphotostatus") |
| | | public R putEasypHotoStatus(@RequestBody ComActEasyPhotoVO comActEasyPhotoVO) { |
| | | return comActEasyPhotoService.putEasypHotoStatus(comActEasyPhotoVO); |
| | | } |
| | | |
| | | /** |
| | | * 新增社区 |
| | | * |
| | | * @param comActVO 社区信息 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("addcommunity") |
| | | R addCommunity(@RequestBody ComActVO comActVO) { |
| | | return comActService.addCommunity(comActVO); |
| | | } |
| | | |
| | | /** |
| | | * 编辑社区 |
| | | * |
| | | * @param comActVO 编辑内容 |
| | | * @return 编辑结果 |
| | | */ |
| | | @PutMapping("putCommunity") |
| | | public R putCommunity(@RequestBody ComActVO comActVO) { |
| | | return comActService.putCommunity(comActVO); |
| | | } |
| | | |
| | | /** |
| | | * 房屋信息 |
| | | * |
| | | * @param userId 用户id |
| | | * @return 房屋信息 |
| | | */ |
| | | @PostMapping("detailhouse") |
| | | public R detailHouse(@RequestParam("userId") Long userId) { |
| | | return comMngStructHouseService.detailHouse(userId); |
| | | } |
| | | |
| | | /** |
| | | * 新增小区 |
| | | * |
| | | * @param comMngStructAreaVO 小区信息 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("addarea") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | R addArea(@RequestBody ComMngStructAreaVO comMngStructAreaVO) { |
| | | R r = comMngStructAreaService.addArea(comMngStructAreaVO); |
| | | if (R.isOk(r)) { |
| | | String areaCode = (String) r.getData(); |
| | | comMngStructAreaVO.setAreaCode(areaCode); |
| | | R r1 = comMngStructHouseService.addHouseArea(comMngStructAreaVO); |
| | | if (!R.isOk(r1)) { |
| | | throw new RuntimeException("新增小区地址失败"); |
| | | } |
| | | } |
| | | return r; |
| | | } |
| | | |
| | | /** |
| | | * 分页查询小区 |
| | | * |
| | | * @param comMngStructAreaVO 查询参数 |
| | | * @return 分页结果 |
| | | */ |
| | | @PostMapping("pagearea") |
| | | public R pageArea(@RequestBody ComMngStructAreaVO comMngStructAreaVO) { |
| | | return comMngStructAreaService.pageArea(comMngStructAreaVO); |
| | | } |
| | | |
| | | /** |
| | | * 编辑小区 |
| | | * |
| | | * @param comMngStructAreaVO 编辑内容 |
| | | * @return 编辑结果 |
| | | */ |
| | | @PostMapping("putarea") |
| | | public R putArea(@RequestBody ComMngStructAreaVO comMngStructAreaVO) { |
| | | return comMngStructAreaService.putArea(comMngStructAreaVO); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除小区 |
| | | * |
| | | * @param comMngStructAreaVO 地址编码 |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("deletearea") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R deleteArea(@RequestBody ComMngStructAreaVO comMngStructAreaVO) { |
| | | // 先删除小区小面所有房屋、删除用户和小区房屋的绑定关系 |
| | | R r = comMngStructHouseService.batchDeleteHouse(comMngStructAreaVO); |
| | | if (R.isOk(r)) { |
| | | R r1 = comMngStructAreaService.deleteArea(comMngStructAreaVO); |
| | | if (!R.isOk(r1)) { |
| | | throw new RuntimeException("删除小区失败"); |
| | | } |
| | | } |
| | | return r; |
| | | } |
| | | |
| | | /** |
| | | * 小区批量建房 |
| | | * |
| | | * @param batchhouseVO 建房参数 |
| | | * @return 建房结果 |
| | | */ |
| | | @PostMapping("batchhouse") |
| | | public R batchHouse(@RequestBody BatchhouseVO batchhouseVO) { |
| | | return comMngStructHouseService.batchHouse(batchhouseVO); |
| | | } |
| | | |
| | | /** |
| | | * 展示下级建筑 |
| | | * |
| | | * @param houseCode 房屋编号 |
| | | * @return 下级建筑列表 |
| | | */ |
| | | @PostMapping("listsubordinatebuilding") |
| | | public R listSubordinatebuilding(@RequestParam("houseCode") String houseCode) { |
| | | return comMngStructHouseService.listSubordinatebuilding(houseCode); |
| | | } |
| | | |
| | | /** |
| | | * 添加同级地址 |
| | | * |
| | | * @param batchhouseVO 添加地址 |
| | | * @return 添加结果 |
| | | */ |
| | | @PostMapping("addhouse") |
| | | public R addHouse(@RequestBody BatchhouseVO batchhouseVO) { |
| | | R r=comMngStructAreaService.selectAreaByAreaCode(batchhouseVO.getAreaCode()); |
| | | if (R.isOk(r)) { |
| | | ComMngStructAreaDO comMngStructAreaDO = (ComMngStructAreaDO)r.getData(); |
| | | return comMngStructHouseService.addHouse(batchhouseVO,comMngStructAreaDO); |
| | | } |
| | | return r; |
| | | } |
| | | |
| | | /** |
| | | * 编辑地址 |
| | | * |
| | | * @param comMngStructHouseVO 编辑内容 |
| | | * @return 编辑结果 |
| | | */ |
| | | @PutMapping("puthouse") |
| | | public R putHouse(@RequestBody ComMngStructHouseVO comMngStructHouseVO) { |
| | | return comMngStructHouseService.putHouse(comMngStructHouseVO); |
| | | } |
| | | |
| | | /** |
| | | * 删除地址 |
| | | * |
| | | * @param comMngStructHouseVO 删除指定地址和所有下级 |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("deletehouse") |
| | | public R deleteHouse(@RequestBody ComMngStructHouseVO comMngStructHouseVO) { |
| | | return comMngStructHouseService.deleteHouse(comMngStructHouseVO); |
| | | } |
| | | |
| | | /** |
| | | * 新增其他建筑 |
| | | * |
| | | * @param comMngStructOtherBuildVO 建筑参数 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("addotherbuild") |
| | | public R addOtherbuild(@RequestBody ComMngStructOtherBuildVO comMngStructOtherBuildVO) { |
| | | return comMngStructOtherBuildService.addOtherbuild(comMngStructOtherBuildVO); |
| | | } |
| | | |
| | | /** |
| | | * 查询所有建筑类型 |
| | | * @return 类型列表 |
| | | */ |
| | | @PostMapping("listbuildtype") |
| | | public R listBuildType(){ |
| | | return comMngStructOtherBuildService.listBuildType(); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询 其他建筑 |
| | | * @param comMngStructOtherBuildVO 分页查询参数 |
| | | * @return 查询结果 |
| | | */ |
| | | @PostMapping("pageotherbuild") |
| | | public R pageOtherBuild(@RequestBody ComMngStructOtherBuildVO comMngStructOtherBuildVO){ |
| | | return comMngStructOtherBuildService.pageOtherBuild(comMngStructOtherBuildVO); |
| | | } |
| | | |
| | | /** |
| | | * 增加志愿者 |
| | | * @param comMngVolunteerMngVO 志愿者信息 |
| | | * @return 增加结果 |
| | | */ |
| | | @PostMapping("addvolunteer") |
| | | R addVolunteer(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO){ |
| | | return comMngVolunteerMngService.addVolunteer(comMngVolunteerMngVO); |
| | | } |
| | | |
| | | /** |
| | | * 删除志愿者 |
| | | * @param comMngVolunteerMngVO 手机号 |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("deletevolunteer") |
| | | public R deleteVolunteer(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO){ |
| | | return comMngVolunteerMngService.deleteVolunteer(comMngVolunteerMngVO); |
| | | } |
| | | |
| | | /** |
| | | * 编辑志愿者 |
| | | * @param comMngVolunteerMngVO 编辑内容 |
| | | * @return 编辑结果 |
| | | */ |
| | | @PostMapping("putvolunteer") |
| | | R putVolunteer(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO){ |
| | | return comMngVolunteerMngService.putVolunteer(comMngVolunteerMngVO); |
| | | } |
| | | |
| | | /** |
| | | * 分页展示志愿者 |
| | | * @param comMngVolunteerMngVO 查询参数 |
| | | * @return 分页集合返回 |
| | | */ |
| | | @PostMapping("pagevolunteer") |
| | | public R pageVolunteer(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO){ |
| | | return comMngVolunteerMngService.pageVolunteer(comMngVolunteerMngVO); |
| | | } |
| | | |
| | | /** |
| | | * 分页展示志愿者审核 |
| | | * @param comMngVolunteerMngVO 查询参数 |
| | | * @return 查询结果 |
| | | */ |
| | | @PostMapping("pagevolunteerexamine") |
| | | public R pageVolunteerExamine(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO){ |
| | | return comMngVolunteerMngService.pageVolunteerExamine(comMngVolunteerMngVO); |
| | | } |
| | | |
| | | /** |
| | | * 志愿者审核详情 |
| | | * @param id 主键 |
| | | * @return 详情 |
| | | */ |
| | | @PostMapping("detailvolunteerexamine") |
| | | public R detailVolunteerExamine(@RequestParam("id") Long id){ |
| | | return comMngVolunteerMngService.detailVolunteerExamine(id); |
| | | } |
| | | |
| | | /** |
| | | * 志愿者审核 |
| | | * @param comMngVolunteerMngVO 审核操作 |
| | | * @return 审核结果 |
| | | */ |
| | | @PostMapping("putvolunteerexamine") |
| | | public R putVolunteerExamine(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO){ |
| | | return comMngVolunteerMngService.putVolunteerExamine(comMngVolunteerMngVO); |
| | | } |
| | | |
| | | /** |
| | | * 删除志愿者审核 |
| | | * @param comMngVolunteerMngVO 主键 |
| | | * @return 删除结果 |
| | | */ |
| | | @PostMapping("deletevolunteerexamine") |
| | | public R deleteVolunteerExamine(@RequestBody ComMngVolunteerMngVO comMngVolunteerMngVO){ |
| | | return comMngVolunteerMngService.deleteVolunteerExamine(comMngVolunteerMngVO); |
| | | } |
| | | |
| | | /** |
| | | * 查询区域 |
| | | * @param comActVO 登录人的经纬度、或者指定区域的社区 |
| | | * @return 社区集合 |
| | | */ |
| | | @PostMapping("listcommunity") |
| | | public R listCommunity(@RequestBody ComActVO comActVO){ |
| | | return comActService.listCommunity(comActVO); |
| | | } |
| | | |
| | | /** |
| | | * 用户修改手机号对应的志愿者手机号也要修改 |
| | | * @param userPhoneVO 新旧手机号 |
| | | * @return 修改结果 |
| | | */ |
| | | @PostMapping("putvolunteerphone") |
| | | public R putVolunteerPhone(UserPhoneVO userPhoneVO){ |
| | | return comMngVolunteerMngService.putVolunteerPhone(userPhoneVO); |
| | | } |
| | | |
| | | /** |
| | | * 房屋地址下拉列表 |
| | | * @param parentCode 父级编码 |
| | | * @param areaId 小区id |
| | | * @return 下级列表 |
| | | */ |
| | | @PostMapping("listhouses") |
| | | public R listHouses(@RequestParam("parentCode")String parentCode, @RequestParam("areaId")Long areaId){ |
| | | if (ObjectUtils.isEmpty(parentCode)) { |
| | | R r = comMngStructAreaService.selectAreaById(areaId); |
| | | if (R.isOk(r)) { |
| | | parentCode =(String) r.getData(); |
| | | } |
| | | } |
| | | return comMngStructHouseService.putVolunteerPhone(parentCode); |
| | | } |
| | | |
| | | /** |
| | | * 新增房屋 |
| | | * @param comMngStructHouseVO 房屋信息 |
| | | * @return 新增结果 |
| | | */ |
| | | @PostMapping("addhouses") |
| | | public R addHouses(@RequestBody ComMngStructHouseVO comMngStructHouseVO){ |
| | | return comMngStructHouseService.addHouses(comMngStructHouseVO); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.config; |
| | | |
| | | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.reflection.MetaObject; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 自动填充 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-11 14:23 |
| | | **/ |
| | | @Slf4j |
| | | @Component |
| | | public class MyMetaObjectHandler implements MetaObjectHandler { |
| | | @Override |
| | | public void insertFill(MetaObject metaObject) { |
| | | log.info("start insert fill ...."); |
| | | // this.strictInsertFill(metaObject, "createTime", Date.class, new Date()); // 起始版本 3.3.0(推荐使用) |
| | | // 或者 |
| | | this.strictInsertFill(metaObject, "createAt", () -> new Date(), Date.class); // 起始版本 3.3.3(推荐) |
| | | this.strictInsertFill(metaObject, "updateAt", () -> new Date(), Date.class); // 起始版本 3.3.3(推荐) |
| | | // 或者 |
| | | // this.fillStrategy(metaObject, "createTime", LocalDateTime.now()); // 也可以使用(3.3.0 该方法有bug) |
| | | } |
| | | |
| | | @Override |
| | | public void updateFill(MetaObject metaObject) { |
| | | log.info("start update fill ...."); |
| | | // this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now()); // 起始版本 3.3.0(推荐) |
| | | // 或者 |
| | | this.strictUpdateFill(metaObject, "updateAt", () -> new Date(), Date.class); // 起始版本 3.3.3(推荐) |
| | | // 或者 |
| | | // this.fillStrategy(metaObject, "updateTime", LocalDateTime.now()); // 也可以使用(3.3.0 该方法有bug) |
| | | } |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.config; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.DbType; |
| | | import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer; |
| | | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
| | | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 分页 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-11-30 16:26 |
| | | **/ |
| | | @Configuration |
| | | public class MybatisPlusConfig { |
| | | |
| | | /** |
| | | * 新的分页插件,一缓和二缓遵循mybatis的规则,需要设置 MybatisConfiguration#useDeprecatedExecutor = false 避免缓存出现问题(该属性会在旧插件移除后一同移除) |
| | | */ |
| | | @Bean |
| | | public MybatisPlusInterceptor mybatisPlusInterceptor() { |
| | | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); |
| | | interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.H2)); |
| | | return interceptor; |
| | | } |
| | | |
| | | @Bean |
| | | public ConfigurationCustomizer configurationCustomizer() { |
| | | return configuration -> configuration.setUseDeprecatedExecutor(false); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.panzhihua.service_community.model.dos.ComActActPrizeDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 活动奖品 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 14:16 |
| | | **/ |
| | | @Mapper |
| | | public interface ComActActPrizeDAO extends BaseMapper<ComActActPrizeDO> { |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.panzhihua.common.model.vos.community.ActivitySignVO; |
| | | import com.panzhihua.service_community.model.dos.ComActActSignDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区活动报名记录 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 14:09 |
| | | **/ |
| | | @Mapper |
| | | public interface ComActActSignDAO extends BaseMapper<ComActActSignDO> { |
| | | @Select("<script> " + |
| | | "SELECT\n" + |
| | | "a.id,\n" + |
| | | "u.image_url,\n" + |
| | | "u.name,\n" + |
| | | "case WHEN u.is_partymember = 1 THEN '党员' WHEN a.is_volunteer = 1 THEN '志愿者' ELSE '居民' END identity,\n" + |
| | | "u.phone,\n" + |
| | | "a.create_at \n" + |
| | | "FROM\n" + |
| | | "com_act_act_sign a\n" + |
| | | "JOIN sys_user u ON a.user_id = u.user_id \n" + |
| | | "WHERE\n" + |
| | | "a.activity_id = #{activityId} \n" + |
| | | "<if test='phone != null and phone.trim() != ""'>" + |
| | | "AND u.phone = #{phone} \n" + |
| | | " </if> " + |
| | | "<if test='name != null and name.trim() != ""'>" + |
| | | "AND u.`name` = #{name} \n" + |
| | | " </if> " + |
| | | "<if test='identity != null and identity.trim() != "" and identity==党员.toString()'>" + |
| | | "AND is_partymember = 1 \n" + |
| | | " </if> " + |
| | | "<if test='identity != null and identity.trim() != "" and identity==志愿者.toString()'>" + |
| | | "AND is_partymember = 2 and is_volunteer=1 \n" + |
| | | " </if> " + |
| | | "<if test='identity != null and identity.trim() != "" and identity==居民.toString()'>" + |
| | | "AND is_partymember = 2 and is_volunteer=2 \n" + |
| | | " </if> " + |
| | | " order by a.create_at desc "+ |
| | | "</script>") |
| | | List<ActivitySignVO> listActivitySign(ActivitySignVO activitySignVO); |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.vos.community.ComActActivityVO; |
| | | import com.panzhihua.common.model.vos.partybuilding.PageActivityMembersVO; |
| | | import com.panzhihua.service_community.model.dos.ComActActivityDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区活动 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 13:59 |
| | | **/ |
| | | @Mapper |
| | | public interface ComActActivityDAO extends BaseMapper<ComActActivityDO> { |
| | | // @Select("<script> " + |
| | | // " <where>" + |
| | | // "<if test='nameCn != null and nameCn.trim() != ""'>" + |
| | | // " </if> " + |
| | | // "<if test='nameCn != null and nameCn.trim() != ""'>" + |
| | | // " </if> " + |
| | | // "<if test='nameCn != null and nameCn.trim() != ""'>" + |
| | | // " </if> " + |
| | | // " </where>" + |
| | | // "</script>") |
| | | @Select("<script> " + |
| | | "SELECT \n" + |
| | | "a.id,\n" + |
| | | "a.activity_name,\n" + |
| | | "u.`name` sponsorName,\n" + |
| | | "a.activity_addr,\n" + |
| | | "a.`status`,\n" + |
| | | "a.publish_at,\n" + |
| | | "a.begin_at,\n" + |
| | | "a.end_at,\n" + |
| | | "a.volunteer_max,\n" + |
| | | "count(if(s.is_volunteer=1,s.id,null))volunteer_now,\n"+ |
| | | "count(if(s.is_volunteer=0,s.id,null))participant_now,\n"+ |
| | | "a.participant_max,\n" + |
| | | "a.sign_up_begin,\n" + |
| | | "a.sign_up_end\n" + |
| | | "FROM\n" + |
| | | "com_act_activity a \n" + |
| | | "join sys_user u on a.sponsor_id=u.user_id\n" + |
| | | "left join com_act_act_sign s on a.id=s.activity_id \n"+ |
| | | " where a.community_id=#{comActActivityVO.communityId}" + |
| | | "<if test='comActActivityVO.activityName != null and comActActivityVO.activityName.trim() != ""'>" + |
| | | " and a.activity_name = #{comActActivityVO.activityName} \n" + |
| | | " </if> " + |
| | | "<if test='comActActivityVO.status != null and comActActivityVO.status !=0'>" + |
| | | "AND a.`status` = #{comActActivityVO.status} \n" + |
| | | " </if> " + |
| | | "<if test='comActActivityVO.beginAt != null '>" + |
| | | "AND a.begin_at <![CDATA[ >= ]]> #{comActActivityVO.beginAt} AND a.end_at <![CDATA[ <= ]]> #{comActActivityVO.endAt} \n" + |
| | | " </if> " + |
| | | " group by a.id "+ |
| | | "</script>") |
| | | IPage<ComActActivityVO> pageActivity( Page page, @Param("comActActivityVO") ComActActivityVO comActActivityVO); |
| | | |
| | | @Select("SELECT \n" + |
| | | "u.name sponsorName,\n" + |
| | | "count(if(s.is_volunteer=1,s.id,null))volunteer_now,\n"+ |
| | | "count(if(s.is_volunteer=0,s.id,null))participant_now,\n"+ |
| | | "a.* \n" + |
| | | "FROM \n" + |
| | | "com_act_activity a \n" + |
| | | "join sys_user u on a.sponsor_id=u.user_id \n"+ |
| | | "left join com_act_act_sign s on a.id=s.activity_id \n"+ |
| | | "where a.id=#{id} \n"+ |
| | | " group by a.id " |
| | | ) |
| | | ComActActivityVO inforActivity(Long id); |
| | | |
| | | @Select("SELECT\n" + |
| | | "a.* \n" + |
| | | "FROM\n" + |
| | | "com_act_act_sign s\n" + |
| | | "JOIN com_act_activity a ON s.activity_id = a.id \n" + |
| | | "WHERE\n" + |
| | | "s.user_id = #{comActActivityVO.sponsorId} \n" + |
| | | "ORDER BY\n" + |
| | | "s.create_at DESC") |
| | | IPage<ComActActivityVO> pageMyActivity(Page page, @Param("comActActivityVO") ComActActivityVO comActActivityVO); |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.panzhihua.common.model.vos.community.ComActVO; |
| | | import com.panzhihua.service_community.model.dos.ComActDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 14:13 |
| | | **/ |
| | | @Mapper |
| | | public interface ComActDAO extends BaseMapper<ComActDO> { |
| | | // @Select("<script> " + |
| | | // " <where>" + |
| | | // "<if test='nameCn != null and nameCn.trim() != ""'>" + |
| | | // " </if> " + |
| | | // "<if test='nameCn != null and nameCn.trim() != ""'>" + |
| | | // " </if> " + |
| | | // "<if test='nameCn != null and nameCn.trim() != ""'>" + |
| | | // " </if> " + |
| | | // " </where>" + |
| | | // "</script>") |
| | | |
| | | @Select("<script> " + |
| | | "SELECT\n" + |
| | | "c.community_id,\n" + |
| | | "c.`name`,\n" + |
| | | "ST_Distance_Sphere ( Point ( #{lng}, #{lat} ), Point ( c.lng, c.lat ) ) AS distance \n" + |
| | | "FROM\n" + |
| | | "com_act c \n" + |
| | | " <where>" + |
| | | "<if test='areaCode != null and areaCode.trim() != ""'>" + |
| | | "c.area_code = #{areaCode} \n" + |
| | | " </if> " + |
| | | " </where>" + |
| | | "ORDER BY\n" + |
| | | "distance ASC" + |
| | | "<if test='lng != null and lng.trim() != ""'>" + |
| | | " limit 10 " + |
| | | " </if> " + |
| | | "</script>") |
| | | List<ComActVO> listCommunity(ComActVO comActVO); |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.vos.community.ComActActivityVO; |
| | | import com.panzhihua.common.model.vos.community.ComActDynVO; |
| | | import com.panzhihua.service_community.model.dos.ComActDynDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区动态 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 14:06 |
| | | **/ |
| | | @Mapper |
| | | public interface ComActDynDAO extends BaseMapper<ComActDynDO> { |
| | | @Select("<script> " + |
| | | "SELECT \n" + |
| | | "d.id,\n" + |
| | | "d.title,\n" + |
| | | "COUNT(u.id)readNum,\n" + |
| | | "d.`status`,\n" + |
| | | "d.is_topping,\n" + |
| | | "d.publish_at,\n" + |
| | | "d.create_at\n" + |
| | | "FROM\n" + |
| | | "com_act_dyn d\n" + |
| | | "LEFT JOIN com_act_dyn_user u ON d.id = u.dyn_id \n" + |
| | | "WHERE\n" + |
| | | "d.community_id=#{comActDynVO.communityId}\n" + |
| | | "<if test='comActDynVO.title != null and comActDynVO.title.trim() != ""'>" + |
| | | "AND d.title = #{comActDynVO.title} \n" + |
| | | " </if> " + |
| | | "<if test='comActDynVO.isTopping != null '>" + |
| | | "AND d.is_topping = #{comActDynVO.isTopping} \n" + |
| | | " </if> " + |
| | | "<if test='comActDynVO.status != null '>" + |
| | | "AND d.`status` = #{comActDynVO.status} \n" + |
| | | " </if> " + |
| | | "<if test='comActDynVO.publishAtBegin != null '>" + |
| | | "AND d.publish_at BETWEEN #{comActDynVO.publishAtBegin} \n" + |
| | | "AND #{comActDynVO.publishAtEnd}" + |
| | | " </if> " + |
| | | " group by d.id "+ |
| | | " order by d.is_topping desc, d.create_at desc "+ |
| | | "</script>") |
| | | IPage<ComActDynVO> pageDynamic(Page page, @Param("comActDynVO") ComActDynVO comActDynVO); |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.panzhihua.service_community.model.dos.ComActDynUserDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区动态阅读记录 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-10 10:32 |
| | | **/ |
| | | @Mapper |
| | | public interface ComActDynUserDAO extends BaseMapper<ComActDynUserDO> { |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.vos.community.ComActEasyPhotoVO; |
| | | import com.panzhihua.service_community.model.dos.ComActEasyPhotoDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 随手拍 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 14:22 |
| | | **/ |
| | | @Mapper |
| | | public interface ComActEasyPhotoDAO extends BaseMapper<ComActEasyPhotoDO> { |
| | | @Select("<script> " + |
| | | "SELECT\n" + |
| | | "p.id,\n" + |
| | | "u.`name` sponsor_name,\n" + |
| | | "u.phone sponsor_phone,\n" + |
| | | "count(pu.id)giveThumbsUpNum,\n" + |
| | | "u.image_url,\n" + |
| | | "p.happen_addr,\n" + |
| | | "su.`name` handler_name,\n" + |
| | | "p.`status`,\n" + |
| | | "p.`detail`,\n" + |
| | | "p.create_at,\n" + |
| | | "p.examine_at \n" + |
| | | "FROM\n" + |
| | | "com_act_easy_photo p\n" + |
| | | "JOIN sys_user u ON p.sponsor_id = u.user_id \n" + |
| | | "left join com_act_easy_photo_user pu ON p.id = pu.easy_photo_id \n" + |
| | | "<if test='comActEasyPhotoVO.sponsorName != null and comActEasyPhotoVO.sponsorName.trim() != ""'>" + |
| | | "AND u.`name` = #{comActEasyPhotoVO.sponsorName} \n" + |
| | | " </if> " + |
| | | "left JOIN sys_user su ON p.handler_id = su.user_id \n" + |
| | | "<if test='comActEasyPhotoVO.handlerName != null and comActEasyPhotoVO.handlerName.trim() != ""'>" + |
| | | "AND su.`name` = #{comActEasyPhotoVO.handlerName} \n" + |
| | | " </if> " + |
| | | " where p.community_id=#{comActEasyPhotoVO.communityId} " + |
| | | "<if test='comActEasyPhotoVO.happenAddr != null and comActEasyPhotoVO.happenAddr.trim() != ""'>" + |
| | | "AND p.happen_addr = #{comActEasyPhotoVO.happenAddr} \n" + |
| | | " </if> " + |
| | | "<if test='comActEasyPhotoVO.status != null and comActEasyPhotoVO.status!=0' >" + |
| | | "AND p.`status` = #{comActEasyPhotoVO.status} \n" + |
| | | " </if> " + |
| | | "<if test='comActEasyPhotoVO.createBegin != null '>" + |
| | | "AND p.create_at BETWEEN #{comActEasyPhotoVO.createBegin} \n" + |
| | | "AND #{comActEasyPhotoVO.createEnd}" + |
| | | " </if> " + |
| | | "<if test='comActEasyPhotoVO.sponsorId != null and comActEasyPhotoVO.sponsorId != 0'>" + |
| | | "AND p.sponsor_id =#{comActEasyPhotoVO.sponsorId} \n" + |
| | | " </if> " + |
| | | " group by p.id "+ |
| | | "</script>") |
| | | IPage<ComActEasyPhotoVO> pageEasyPhoto(Page page, @Param("comActEasyPhotoVO") ComActEasyPhotoVO comActEasyPhotoVO); |
| | | @Select("SELECT \n" + |
| | | "p.id,\n" + |
| | | "p.create_at,\n" + |
| | | "u.`name`,\n" + |
| | | "u.`image_url`,\n" + |
| | | "u.phone,\n" + |
| | | "p.detail,\n" + |
| | | "p.status,\n" + |
| | | "p.is_hide,\n" + |
| | | "p.happen_addr,\n" + |
| | | "su.`name`,\n" + |
| | | "p.handle_result,\n" + |
| | | "p.photo_path_list,\n" + |
| | | "p.handle_photo_list\n" + |
| | | "FROM\n" + |
| | | "com_act_easy_photo p\n" + |
| | | "JOIN sys_user u on p.sponsor_id=u.user_id\n" + |
| | | "LEFT JOIN sys_user su on p.handler_id=su.user_id\n" + |
| | | "WHERE p.id=#{id}") |
| | | ComActEasyPhotoVO detailEasyPhoto(Long id); |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.panzhihua.service_community.model.dos.ComActEasyPhotoUserDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 随手拍点赞 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-10 15:14 |
| | | **/ |
| | | @Mapper |
| | | public interface ComActEasyPhotoUserDAO extends BaseMapper<ComActEasyPhotoUserDO> { |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.vos.community.ComActMicroWishVO; |
| | | import com.panzhihua.service_community.model.dos.ComActMicroWishDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 微心愿 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 14:27 |
| | | **/ |
| | | @Mapper |
| | | public interface ComActMicroWishDAO extends BaseMapper<ComActMicroWishDO> { |
| | | |
| | | @Select("<script> " + |
| | | "SELECT\n" + |
| | | "w.id,\n" + |
| | | "u.name sponsor_name,\n" + |
| | | "u.image_url ,\n" + |
| | | "w.sponsor_phone,\n" + |
| | | "w.wish_name,\n" + |
| | | "w.`status`,\n" + |
| | | "count(wu.id)star_num,\n" + |
| | | "w.`detail`,\n" + |
| | | "w.form,\n" + |
| | | "su.`name` responsible_name,\n" + |
| | | "w.score,\n" + |
| | | "w.create_at \n" + |
| | | "FROM\n" + |
| | | "com_act_micro_wish w\n" + |
| | | "left join com_act_micro_wish_user wu on w.id=wu.micro_wish_id "+ |
| | | "JOIN sys_user u ON w.sponsor_id = u.user_id \n" + |
| | | "<if test='comActMicroWishVO.sponsorName != null and comActMicroWishVO.sponsorName.trim() != ""'>" + |
| | | "AND u.name = #{comActMicroWishVO.sponsorName} \n" + |
| | | " </if> " + |
| | | "LEFT JOIN sys_user su ON w.responsible_id = su.user_id \n" + |
| | | "<if test='comActMicroWishVO.responsibleName != null and comActMicroWishVO.responsibleName.trim() != ""'>" + |
| | | "AND su.`name` = #{comActMicroWishVO.responsibleName} \n" + |
| | | " </if> " + |
| | | "WHERE\n" + |
| | | "w.community_id=#{comActMicroWishVO.communityId} \n" + |
| | | "<if test='comActMicroWishVO.sponsorPhone != null and comActMicroWishVO.sponsorPhone.trim() != ""'>" + |
| | | "AND w.sponsor_phone = #{comActMicroWishVO.sponsorPhone} \n" + |
| | | " </if> " + |
| | | "<if test='comActMicroWishVO.status != null and comActMicroWishVO.status!=0 '>" + |
| | | "AND w.`status` = #{comActMicroWishVO.status} \n" + |
| | | " </if> " + |
| | | "<if test='comActMicroWishVO.createBegin != null '>" + |
| | | "AND w.create_at BETWEEN #{comActMicroWishVO.createBegin} \n" + |
| | | "AND #{comActMicroWishVO.createEnd}" + |
| | | " </if> " + |
| | | "<if test='comActMicroWishVO.isApplets != null and comActMicroWishVO.isApplets != 0'>" + |
| | | "AND w.status in (3,6) \n" + |
| | | " </if> " + |
| | | " group by w.id \n"+ |
| | | "ORDER BY w.`status`, w.create_at "+ |
| | | "</script>") |
| | | IPage<ComActMicroWishVO> pageMicroWish(Page page, @Param("comActMicroWishVO") ComActMicroWishVO comActMicroWishVO); |
| | | @Select("SELECT\n" + |
| | | "w.id,\n" + |
| | | "u.name sponsor_name,\n" + |
| | | "w.create_at,\n" + |
| | | "u.image_url,\n" + |
| | | "w.sponsor_phone,\n" + |
| | | "w.`status`,\n" + |
| | | "w.wish_name,\n" + |
| | | "count(wu.id)startNum,\n" + |
| | | "w.detail,\n" + |
| | | "w.photo_path_list,\n" + |
| | | "su.`name` responsible_name,\n" + |
| | | "w.form,\n" + |
| | | "w.examine_at,\n" + |
| | | "w.finish,\n" + |
| | | "w.finish_photo_path_list,\n" + |
| | | "w.finish_at,\n" + |
| | | "w.score,\n" + |
| | | "w.evaluate_at,\n" + |
| | | "w.evaluate \n" + |
| | | "FROM\n" + |
| | | "com_act_micro_wish w\n" + |
| | | "JOIN sys_user u ON w.sponsor_id = u.user_id\n" + |
| | | "LEFT JOIN sys_user su ON w.responsible_id = su.user_id \n" + |
| | | "LEFT JOIN com_act_micro_wish_user wu ON w.id = wu.micro_wish_id \n" + |
| | | "WHERE\n" + |
| | | "w.id =#{id}"+ |
| | | " group by w.id " |
| | | ) |
| | | ComActMicroWishVO detailMicroWish(Long id); |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.panzhihua.service_community.model.dos.ComActMicroWishUserDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 微心愿点赞 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-10 16:19 |
| | | **/ |
| | | @Mapper |
| | | public interface ComActMicroWishUserDAO extends BaseMapper<ComActMicroWishUserDO> { |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.vos.community.ComActDynVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngStructAreaVO; |
| | | import com.panzhihua.service_community.model.dos.ComMngStructAreaDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 小区 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-14 17:00 |
| | | **/ |
| | | @Mapper |
| | | public interface ComMngStructAreaDAO extends BaseMapper<ComMngStructAreaDO> { |
| | | // @Select("<script> " + |
| | | // " <where>" + |
| | | // "<if test='nameCn != null and nameCn.trim() != ""'>" + |
| | | // " </if> " + |
| | | // "<if test='nameCn != null and nameCn.trim() != ""'>" + |
| | | // " </if> " + |
| | | // "<if test='nameCn != null and nameCn.trim() != ""'>" + |
| | | // " </if> " + |
| | | // " </where>" + |
| | | // "</script>") |
| | | @Select("<script> " + |
| | | "SELECT\n" + |
| | | "id,\n" + |
| | | "area_name,\n" + |
| | | "address_detail,\n" + |
| | | "create_at \n" + |
| | | "FROM\n" + |
| | | "com_mng_struct_area \n" + |
| | | "WHERE\n" + |
| | | "community_id = #{comMngStructAreaVO.communityId} \n" + |
| | | "<if test='comMngStructAreaVO.areaName != null and comMngStructAreaVO.areaName.trim() != ""'>" + |
| | | "AND area_name = #{comMngStructAreaVO.areaName}" + |
| | | " </if> " + |
| | | "</script>") |
| | | IPage<ComActDynVO> pageArea(Page page, @Param("comMngStructAreaVO") ComMngStructAreaVO comMngStructAreaVO); |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.vos.community.ComActDynVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngStructOtherBuildVO; |
| | | import com.panzhihua.service_community.model.dos.ComMngStructBuildTypeDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 其他建筑 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-14 17:05 |
| | | **/ |
| | | @Mapper |
| | | public interface ComMngStructBuildTypeDAO extends BaseMapper<ComMngStructBuildTypeDO> { |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.panzhihua.service_community.model.dos.ComMngStructHouseDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Options; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.apache.ibatis.mapping.StatementType; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 房屋 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-14 17:09 |
| | | **/ |
| | | @Mapper |
| | | public interface ComMngStructHouseDAO extends BaseMapper<ComMngStructHouseDO> { |
| | | @Select("{call smart_life.removeByParentCode(#{areaCode,jdbcType=VARCHAR,mode=IN})}") |
| | | @Options(statementType = StatementType.CALLABLE) |
| | | int batchDeleteHouse(String areaCode); |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.service_community.model.dos.ComMngStructHouseUserDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 房屋人员关系 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-15 15:13 |
| | | **/ |
| | | @Mapper |
| | | public interface ComMngStructHouseUserDAO extends BaseMapper<ComMngStructHouseUserDO> { |
| | | @Select("select u.name,u.phone from com_mng_struct_house_user h left join sys_user u on h.user_id=u.user_id") |
| | | List<LoginUserInfoVO> selectListHouseUser(String houseCode1); |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.vos.community.ComMngStructOtherBuildVO; |
| | | import com.panzhihua.service_community.model.dos.ComMngStructOtherBuildDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 其他建筑 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-14 17:21 |
| | | **/ |
| | | @Mapper |
| | | public interface ComMngStructOtherBuildDAO extends BaseMapper<ComMngStructOtherBuildDO> { |
| | | |
| | | // @Select("<script> " + |
| | | // " <where>" + |
| | | // "<if test='nameCn != null and nameCn.trim() != ""'>" + |
| | | // " </if> " + |
| | | // "<if test='nameCn != null and nameCn.trim() != ""'>" + |
| | | // " </if> " + |
| | | // "<if test='nameCn != null and nameCn.trim() != ""'>" + |
| | | // " </if> " + |
| | | // " </where>" + |
| | | // "</script>") |
| | | @Select("<script> " + |
| | | "SELECT \n" + |
| | | "b.id,\n" + |
| | | "b.`name`,\n" + |
| | | "t.name buileTypeName,\n" + |
| | | "b.square,\n" + |
| | | "b.address,\n" + |
| | | "b.`state`,\n" + |
| | | "b.layer_type,\n" + |
| | | "b.create_at\n" + |
| | | "FROM\n" + |
| | | "com_mng_struct_other_build b \n" + |
| | | "join com_mng_struct_build_type t on b.type_id=t.id\n" + |
| | | " <where>" + |
| | | "<if test='comMngStructOtherBuildVO.name != null and comMngStructOtherBuildVO.name.trim() != ""'>" + |
| | | "b.name = #{comMngStructOtherBuildVO.name}"+ |
| | | " </if> " + |
| | | " </where>" + |
| | | "</script>") |
| | | IPage<ComMngStructOtherBuildVO> pageOtherBuild(Page page, @Param("comMngStructOtherBuildVO") ComMngStructOtherBuildVO comMngStructOtherBuildVO); |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.dao; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.model.vos.community.ComMngStructOtherBuildVO; |
| | | import com.panzhihua.common.model.vos.community.ComMngVolunteerMngVO; |
| | | import com.panzhihua.service_community.model.dos.ComMngVolunteerMngDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 志愿者 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-15 09:50 |
| | | **/ |
| | | @Mapper |
| | | public interface ComMngVolunteerMngDAO extends BaseMapper<ComMngVolunteerMngDO> { |
| | | // @Select("<script> " + |
| | | // " <where>" + |
| | | // "<if test='nameCn != null and nameCn.trim() != ""'>" + |
| | | // " </if> " + |
| | | // "<if test='nameCn != null and nameCn.trim() != ""'>" + |
| | | // " </if> " + |
| | | // "<if test='nameCn != null and nameCn.trim() != ""'>" + |
| | | // " </if> " + |
| | | // " </where>" + |
| | | // "</script>") |
| | | @Select("<script> " + |
| | | "SELECT\n" + |
| | | "id,\n" + |
| | | "`name`,\n" + |
| | | "photo_path,\n" + |
| | | "phone,\n" + |
| | | "create_at \n" + |
| | | "FROM\n" + |
| | | "com_mng_volunteer_mng \n" + |
| | | " where state=2 " + |
| | | "<if test='comMngVolunteerMngVO.name != null and comMngVolunteerMngVO.name.trim() != ""'>" + |
| | | " and name = #{comMngVolunteerMngVO.name} \n" + |
| | | " </if> " + |
| | | "<if test='comMngVolunteerMngVO.phone != null and comMngVolunteerMngVO.phone.trim() != ""'>" + |
| | | "AND phone = #{comMngVolunteerMngVO.phone}" + |
| | | " </if> " + |
| | | "</script>") |
| | | IPage<ComMngVolunteerMngVO> pageVolunteer(Page page, @Param("comMngVolunteerMngVO") ComMngVolunteerMngVO comMngVolunteerMngVO); |
| | | |
| | | @Select("<script> " + |
| | | "SELECT\n" + |
| | | "id,\n" + |
| | | "`name`,\n" + |
| | | "state,\n" + |
| | | "phone,\n" + |
| | | "create_at \n" + |
| | | "FROM\n" + |
| | | "com_mng_volunteer_mng \n" + |
| | | "WHERE\n" + |
| | | "state in (1,3)\n" + |
| | | "<if test='comMngVolunteerMngVO.name != null and comMngVolunteerMngVO.name.trim() != ""'>" + |
| | | "and name = #{comMngVolunteerMngVO.name} \n" + |
| | | " </if> " + |
| | | "<if test='comMngVolunteerMngVO.phone != null and comMngVolunteerMngVO.phone.trim() != ""'>" + |
| | | "AND phone = #{comMngVolunteerMngVO.phone}\n" + |
| | | " </if> " + |
| | | "<if test='comMngVolunteerMngVO.state != null and comMngVolunteerMngVO.state != 0'>" + |
| | | "and state=#{comMngVolunteerMngVO.state}\n" + |
| | | " </if> " + |
| | | "ORDER BY state asc " + |
| | | "</script>") |
| | | IPage<ComMngVolunteerMngVO> pageVolunteerExamine(Page page, @Param("comMngVolunteerMngVO") ComMngVolunteerMngVO comMngVolunteerMngVO); |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.model.dos; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 活动奖品 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 14:14 |
| | | **/ |
| | | @Data |
| | | @TableName(value = "com_act_act_prize") |
| | | public class ComActActPrizeDO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 自增id |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 所属活动id |
| | | */ |
| | | private Long activityId; |
| | | |
| | | /** |
| | | * 奖品名称 |
| | | */ |
| | | private String prizeName; |
| | | |
| | | /** |
| | | * 奖品图片路径 |
| | | */ |
| | | private String prizePhoto; |
| | | |
| | | /** |
| | | * 是否报名既有 1 是 0 不是 |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createAt; |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.model.dos; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 活动报名列表 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 14:07 |
| | | **/ |
| | | @Data |
| | | @TableName(value = "com_act_act_sign") |
| | | public class ComActActSignDO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | |
| | | /** |
| | | * 自增id |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 所属活动id |
| | | */ |
| | | private Long activityId; |
| | | |
| | | /** |
| | | * 用户id, 和用户信息表的相关id关联 |
| | | */ |
| | | private Long userId; |
| | | /** |
| | | * 报名时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createAt; |
| | | /** |
| | | * 是否是志愿者 |
| | | * 0 不是 1 是 |
| | | */ |
| | | private Integer isVolunteer; |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.model.dos; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区活动 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 13:56 |
| | | **/ |
| | | @Data |
| | | @TableName(value = "com_act_activity") |
| | | public class ComActActivityDO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 自增id |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 活动名称 |
| | | */ |
| | | private String activityName; |
| | | |
| | | /** |
| | | * 负责人userID |
| | | */ |
| | | private Long sponsorId; |
| | | |
| | | /** |
| | | * 活动地址 |
| | | */ |
| | | private String activityAddr; |
| | | |
| | | /** |
| | | * 活动状态 |
| | | */ |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 发布时间 |
| | | */ |
| | | private Date publishAt; |
| | | |
| | | /** |
| | | * 互动结束时间 |
| | | */ |
| | | private Date endAt; |
| | | |
| | | /** |
| | | * 活动开始时间 |
| | | */ |
| | | private Date beginAt; |
| | | |
| | | /** |
| | | * 报名开始时间 |
| | | */ |
| | | private Date signUpBegin; |
| | | |
| | | /** |
| | | * 报名结束时间 |
| | | */ |
| | | private Date signUpEnd; |
| | | |
| | | /** |
| | | * 志愿者人数下线 |
| | | */ |
| | | private Integer volunteerMin; |
| | | |
| | | /** |
| | | * 志愿者人数上限 |
| | | */ |
| | | private Integer volunteerMax; |
| | | |
| | | /** |
| | | * 参与者人数下线 |
| | | */ |
| | | private Integer participantMin; |
| | | |
| | | /** |
| | | * 参与者人数上限 |
| | | */ |
| | | private Integer participantMax; |
| | | |
| | | /** |
| | | * 活动封面 |
| | | */ |
| | | private String cover; |
| | | |
| | | /** |
| | | * 是否有奖品 1 有 0 无 |
| | | */ |
| | | private Integer hasPrize; |
| | | |
| | | /** |
| | | * 奖品备注 |
| | | */ |
| | | private String prizeRemark; |
| | | /** |
| | | * 奖励说明 |
| | | */ |
| | | private String rewardDesc; |
| | | /** |
| | | * 活动内容 |
| | | */ |
| | | private String content; |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createAt; |
| | | /** |
| | | * 取消原因 |
| | | */ |
| | | private String cancelReason; |
| | | /** |
| | | * 社区id |
| | | */ |
| | | private Long communityId; |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.model.dos; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区表 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 14:12 |
| | | **/ |
| | | @Data |
| | | @TableName(value = "com_act") |
| | | public class ComActDO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * community_id |
| | | */ |
| | | @TableId(type=IdType.AUTO) |
| | | private Long communityId; |
| | | |
| | | /** |
| | | * 社区名字 |
| | | */ |
| | | private String name; |
| | | |
| | | /** |
| | | * 社区地址 |
| | | */ |
| | | private String address; |
| | | |
| | | /** |
| | | * 经度 |
| | | */ |
| | | private String lng; |
| | | |
| | | /** |
| | | * 维度 |
| | | */ |
| | | private String lat; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createAt; |
| | | |
| | | /** |
| | | * 省份地址编码 |
| | | */ |
| | | private String provinceCode; |
| | | |
| | | /** |
| | | * 市级地址编码 |
| | | */ |
| | | private String cityCode; |
| | | |
| | | /** |
| | | * 区级地址编码 |
| | | */ |
| | | private String areaCode; |
| | | |
| | | /** |
| | | * 社区面积 |
| | | */ |
| | | private Double square; |
| | | |
| | | /** |
| | | * 联系人 |
| | | */ |
| | | private String contacts; |
| | | |
| | | /** |
| | | * 联系人电话 |
| | | */ |
| | | private String contactsPhone; |
| | | |
| | | /** |
| | | * 超管账号 |
| | | */ |
| | | private String account; |
| | | |
| | | /** |
| | | * 账号密码 |
| | | */ |
| | | private String password; |
| | | |
| | | /** |
| | | * 状态 0 启用 1 禁用 |
| | | */ |
| | | private boolean state; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.model.dos; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区动态 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 14:05 |
| | | **/ |
| | | @Data |
| | | @TableName(value = "com_act_dyn") |
| | | public class ComActDynDO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 自增id |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 标题 |
| | | */ |
| | | private String title; |
| | | /** |
| | | * 状态 |
| | | */ |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 是否置顶 |
| | | */ |
| | | private Integer isTopping; |
| | | |
| | | /** |
| | | * 发布时间 |
| | | */ |
| | | private Date publishAt; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createAt; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Date updateAt; |
| | | /** |
| | | * 社区id |
| | | */ |
| | | private Long communityId; |
| | | /** |
| | | * 动态内容富文本 |
| | | */ |
| | | private String content; |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.model.dos; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区动态阅读记录 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-09 10:23 |
| | | **/ |
| | | @Data |
| | | @TableName(value = "com_act_dyn_user") |
| | | public class ComActDynUserDO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * id |
| | | */ |
| | | @TableId(type= IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 社区动态id |
| | | */ |
| | | private Long dynId; |
| | | |
| | | /** |
| | | * user表id |
| | | */ |
| | | private Long userId; |
| | | |
| | | /** |
| | | * 阅读时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createAt; |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.model.dos; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 随手拍 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 14:21 |
| | | **/ |
| | | @Data |
| | | @TableName(value = "com_act_easy_photo") |
| | | public class ComActEasyPhotoDO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 自增id |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 发起人id |
| | | */ |
| | | private Long sponsorId; |
| | | |
| | | /** |
| | | * 发生地址 |
| | | */ |
| | | private String happenAddr; |
| | | |
| | | /** |
| | | * 状态 1待审核 2进行中 3已驳回 4已完成 |
| | | */ |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 处理人id |
| | | */ |
| | | private Long handlerId; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createAt; |
| | | |
| | | /** |
| | | * 审核时间 |
| | | */ |
| | | private Date examineAt; |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | private String detail; |
| | | |
| | | /** |
| | | * 图片路径列表,逗号分隔 |
| | | */ |
| | | private String photoPathList; |
| | | |
| | | /** |
| | | * 处理结果 |
| | | */ |
| | | private String handleResult; |
| | | |
| | | /** |
| | | * 处理结果,图片路径列表,逗号分隔 |
| | | */ |
| | | private String handlePhotoList; |
| | | /** |
| | | * 社区id |
| | | */ |
| | | private Long communityId; |
| | | /** |
| | | * 是否匿名发布 |
| | | */ |
| | | private Integer isHide; |
| | | |
| | | /** |
| | | * 随手拍是否需要反馈 |
| | | * 0 不需要 1 需要 |
| | | */ |
| | | private Integer isNeedFeedBack; |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.model.dos; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 随手拍点赞 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-10 15:12 |
| | | **/ |
| | | @Data |
| | | @TableName(value = "com_act_easy_photo_user") |
| | | public class ComActEasyPhotoUserDO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * id |
| | | */ |
| | | @TableId(type= IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 随手拍主键id |
| | | */ |
| | | private Long easyPhotoId; |
| | | |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Long userId; |
| | | |
| | | /** |
| | | * 点赞时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createAt; |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.model.dos; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 微心愿 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-07 14:24 |
| | | **/ |
| | | @Data |
| | | @TableName(value = "com_act_micro_wish") |
| | | public class ComActMicroWishDO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 自增id |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 发起人id |
| | | */ |
| | | private Long sponsorId; |
| | | |
| | | /** |
| | | * 发起人电话号码 |
| | | */ |
| | | private String sponsorPhone; |
| | | |
| | | /** |
| | | * 微心愿名称 |
| | | */ |
| | | private String wishName; |
| | | |
| | | /** |
| | | * 状态 |
| | | * 状态 1待审核 2待分配 3进行中 4已驳回 5待确认6 已完成 |
| | | */ |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 形式 1分配人员 2发起活动 |
| | | */ |
| | | private Integer form; |
| | | |
| | | /** |
| | | * 责任人id |
| | | */ |
| | | private Long responsibleId; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createAt; |
| | | |
| | | /** |
| | | * 审核时间 |
| | | */ |
| | | private Date examineAt; |
| | | /** |
| | | * 分配时间 |
| | | */ |
| | | private Date distributionAt; |
| | | |
| | | /** |
| | | * 评分 |
| | | */ |
| | | private Integer score; |
| | | |
| | | /** |
| | | * 详情 |
| | | */ |
| | | private String detail; |
| | | |
| | | /** |
| | | * 图片路径列表,逗号分隔 |
| | | */ |
| | | private String photoPathList; |
| | | /** |
| | | * 社区id |
| | | */ |
| | | private Long communityId; |
| | | |
| | | /** |
| | | * 用户评价 |
| | | */ |
| | | private String evaluate; |
| | | |
| | | /** |
| | | * 用户评价时间 |
| | | */ |
| | | private Date evaluateAt; |
| | | |
| | | /** |
| | | * 反馈时间 |
| | | */ |
| | | private Date feedbackAt; |
| | | |
| | | /** |
| | | * 完成情况图片列表,逗号分隔 |
| | | */ |
| | | private String finishPhotoPathList; |
| | | |
| | | /** |
| | | * 完成情况描述 |
| | | */ |
| | | private String finish; |
| | | /** |
| | | * 驳回理由 |
| | | */ |
| | | private String rejectReason; |
| | | |
| | | /** |
| | | * 反馈文字 |
| | | */ |
| | | private String feedback; |
| | | |
| | | /** |
| | | * 反馈图片集合,逗号分隔 |
| | | */ |
| | | private String feedbackPhotoPathList; |
| | | |
| | | } |
New file |
| | |
| | | package com.panzhihua.service_community.model.dos; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 微心愿点赞 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-10 16:18 |
| | | **/ |
| | | @Data |
| | | @TableName(value = "com_act_micro_wish_user") |
| | | public class ComActMicroWishUserDO implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * id |
| | | */ |
| | | @TableId(type= IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 微心愿id |
| | | */ |
| | | private Long microWishId; |
| | | |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private Long userId; |
| | | |
| | | /** |
| | | * 点赞时间 |
| | | */ |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createAt; |
| | | } |
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComMngStructAreaDO.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComMngStructBuildTypeDO.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComMngStructHouseDO.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComMngStructHouseUserDO.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComMngStructOtherBuildDO.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComMngVolunteerMngDO.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActActPrizeService.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActActivityService.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActDynService.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActEasyPhotoService.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActMicroWishService.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActService.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngStructAreaService.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngStructHouseService.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngStructOtherBuildService.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComMngVolunteerMngService.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActPrizeServiceImpl.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActDynServiceImpl.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoServiceImpl.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActMicroWishServiceImpl.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActServiceImpl.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngStructAreaServiceImpl.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngStructHouseServiceImpl.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngStructOtherBuildServiceImpl.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComMngVolunteerMngServiceImpl.java
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/application.yml
springcloud_k8s_panzhihuazhihuishequ/service_community/src/test/java/com/panzhihua/service_community/ServiceCommunityApplicationTests.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/.gitignore
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/.mvn/wrapper/MavenWrapperDownloader.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/.mvn/wrapper/maven-wrapper.jar
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/.mvn/wrapper/maven-wrapper.properties
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/mvnw
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/mvnw.cmd
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/pom.xml
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/ServiceDangjianApplication.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/api/PartyBuildIngApi.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/config/MybatisPlusConfig.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/dao/ComBpActivityDAO.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/dao/ComPbActivityMemberDAO.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/dao/ComPbDynDAO.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/dao/ComPbDynUserDAO.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/dao/ComPbMemberDAO.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/dao/ComPbMemberRoleDAO.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/dao/ComPbOrgDAO.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/model/dos/ComBpActivityDO.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/model/dos/ComPbActivityMemberDO.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/model/dos/ComPbDynDO.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/model/dos/ComPbDynUserDO.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/model/dos/ComPbMemberDO.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/model/dos/ComPbMemberRoleDO.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/model/dos/ComPbOrgDO.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/ComBpActivityService.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/ComPbMemberService.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/PartyOrganizationService.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/ComBpActivityServiceImpl.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/ComPbMemberServiceImpl.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/PartyOrganizationServiceImpl.java
springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/resources/application.yml
springcloud_k8s_panzhihuazhihuishequ/service_user/.gitignore
springcloud_k8s_panzhihuazhihuishequ/service_user/.mvn/wrapper/MavenWrapperDownloader.java
springcloud_k8s_panzhihuazhihuishequ/service_user/.mvn/wrapper/maven-wrapper.jar
springcloud_k8s_panzhihuazhihuishequ/service_user/.mvn/wrapper/maven-wrapper.properties
springcloud_k8s_panzhihuazhihuishequ/service_user/mvnw
springcloud_k8s_panzhihuazhihuishequ/service_user/mvnw.cmd
springcloud_k8s_panzhihuazhihuishequ/service_user/pom.xml
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/ServiceUserApplication.java
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/api/RoleApi.java
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/api/UserApi.java
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/dao/ComMngFamilyInfoDAO.java
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/dao/ComMngStructHouseDAO.java
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/dao/ComMngUserTagDAO.java
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/dao/RoleDAO.java
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/dao/UserDao.java
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/model/dos/ComMngFamilyInfoDO.java
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/model/dos/ComMngStructHouseDO.java
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/model/dos/ComMngUserTagDO.java
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/model/dos/SysDeptDO.java
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/model/dos/SysRoleDO.java
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/model/dos/SysUserDO.java
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/RoleService.java
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/UserService.java
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/RoleServiceImpl.java
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/resources/application.yml
springcloud_k8s_panzhihuazhihuishequ/service_user/src/test/java/com/panzhihua/service_user/ServiceUserApplicationTests.java
springcloud_k8s_panzhihuazhihuishequ/zuul/.gitignore
springcloud_k8s_panzhihuazhihuishequ/zuul/.mvn/wrapper/MavenWrapperDownloader.java
springcloud_k8s_panzhihuazhihuishequ/zuul/.mvn/wrapper/maven-wrapper.jar
springcloud_k8s_panzhihuazhihuishequ/zuul/.mvn/wrapper/maven-wrapper.properties
springcloud_k8s_panzhihuazhihuishequ/zuul/mvnw
springcloud_k8s_panzhihuazhihuishequ/zuul/mvnw.cmd
springcloud_k8s_panzhihuazhihuishequ/zuul/pom.xml
springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/ZuulApplication.java
springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/config/SpringSecurityConfig.java
springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/config/SwaggerConfig.java
springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/filters/JWTAuthenticationTokenFilter.java
springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/filters/SafeboxRequestWrapper.java
springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/filters/SercuritFilter.java
springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/handles/UserAuthAccessDeniedHandler.java
springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/java/com/panzhihua/zuul/manager/RoleAccessDecisionManager.java
springcloud_k8s_panzhihuazhihuishequ/zuul/src/main/resources/application.yml |