Ver código fonte

链接开发

anderx 4 anos atrás
pai
commit
bf5e175fed
34 arquivos alterados com 1833 adições e 10 exclusões
  1. 14 0
      .idea/artifacts/kede_web_hn_war.xml
  2. 12 2
      .idea/artifacts/kede_web_hn_war_exploded.xml
  3. 12 0
      .idea/dataSources.xml
  4. 55 0
      .idea/free-mybatis-generator-config.xml
  5. 1 0
      .idea/inspectionProfiles/Project_Default.xml
  6. 4 4
      .idea/libraries/Maven__com_alibaba_fastjson_1_2_31.xml
  7. 124 0
      .idea/uiDesigner.xml
  8. 1 1
      kede-web-hn.iml
  9. 1 1
      pom.xml
  10. 1 0
      src/main/java/com/kede/common/constant/ErrorConstants.java
  11. 22 2
      src/main/java/com/kede/common/controller/BaseController.java
  12. 22 0
      src/main/java/com/kede/common/dao/LinksMapper.java
  13. 17 0
      src/main/java/com/kede/common/dao/PopularCitiesMapper.java
  14. 48 0
      src/main/java/com/kede/common/enums/LinksEnum.java
  15. 44 0
      src/main/java/com/kede/common/enums/PopularCitiesEnum.java
  16. 160 0
      src/main/java/com/kede/common/mapper/LinksMapper.xml
  17. 138 0
      src/main/java/com/kede/common/mapper/PopularCitiesMapper.xml
  18. 116 0
      src/main/java/com/kede/common/model/Links.java
  19. 103 0
      src/main/java/com/kede/common/model/PopularCities.java
  20. 183 0
      src/main/java/com/kede/common/utils/RedisUtil.java
  21. 91 0
      src/main/java/com/kede/linksAndHot/bo/InputLinks.java
  22. 62 0
      src/main/java/com/kede/linksAndHot/bo/InputLinksList.java
  23. 87 0
      src/main/java/com/kede/linksAndHot/bo/InputPopularCities.java
  24. 54 0
      src/main/java/com/kede/linksAndHot/bo/InputPopularCitiesList.java
  25. 86 0
      src/main/java/com/kede/linksAndHot/bo/outLinksList.java
  26. 67 0
      src/main/java/com/kede/linksAndHot/bo/outPopularCitiesList.java
  27. 34 0
      src/main/java/com/kede/linksAndHot/bo/publicLinks.java
  28. 63 0
      src/main/java/com/kede/linksAndHot/controller/AdminHotApiController.java
  29. 60 0
      src/main/java/com/kede/linksAndHot/controller/AdminLinksApiController.java
  30. 19 0
      src/main/java/com/kede/linksAndHot/service/LinkesService.java
  31. 17 0
      src/main/java/com/kede/linksAndHot/service/PopularCitiesService.java
  32. 58 0
      src/main/java/com/kede/linksAndHot/service/impl/LinkesServiceImpl.java
  33. 49 0
      src/main/java/com/kede/linksAndHot/service/impl/PopularCitiesServiceImpl.java
  34. 8 0
      src/main/webapp/WEB-INF/views/common.html

+ 14 - 0
.idea/artifacts/kede_web_hn_war.xml

@@ -0,0 +1,14 @@
+<component name="ArtifactManager">
+  <artifact type="war" name="kede-web-hn:war">
+    <output-path>$PROJECT_DIR$/target</output-path>
+    <properties id="maven-jee-properties">
+      <options>
+        <module>kede-web-hn</module>
+        <packaging>war</packaging>
+      </options>
+    </properties>
+    <root id="archive" name="local.war">
+      <element id="artifact" artifact-name="kede-web-hn:war exploded" />
+    </root>
+  </artifact>
+</component>

+ 12 - 2
.idea/artifacts/kede_web_hn_war_exploded.xml

@@ -1,6 +1,13 @@
 <component name="ArtifactManager">
   <artifact type="exploded-war" build-on-make="true" name="kede-web-hn:war exploded">
-    <output-path>$PROJECT_DIR$/out/artifacts/kede_web_hn_war_exploded</output-path>
+    <output-path>$PROJECT_DIR$/target/kede-web-hn-0.0.1-SNAPSHOT</output-path>
+    <properties id="maven-jee-properties">
+      <options>
+        <exploded>true</exploded>
+        <module>kede-web-hn</module>
+        <packaging>war</packaging>
+      </options>
+    </properties>
     <root id="root">
       <element id="directory" name="WEB-INF">
         <element id="directory" name="classes">
@@ -59,7 +66,7 @@
           <element id="library" level="project" name="Maven: org.apache.shiro:shiro-quartz:1.3.2" />
           <element id="library" level="project" name="Maven: org.opensymphony.quartz:quartz:1.6.1" />
           <element id="library" level="project" name="Maven: org.apache.shiro:shiro-spring:1.3.2" />
-          <element id="library" level="project" name="Maven: com.alibaba:fastjson:1.2.31" />
+          <element id="library" level="project" name="Maven: com.alibaba:fastjson:1.2.41" />
           <element id="library" level="project" name="Maven: org.aspectj:aspectjrt:1.6.10" />
           <element id="library" level="project" name="Maven: org.aspectj:aspectjweaver:1.6.10" />
           <element id="library" level="project" name="Maven: cglib:cglib:2.2.2" />
@@ -94,6 +101,9 @@
           <element id="library" level="project" name="Maven: javax.xml.bind:jaxb-api:2.3.0" />
         </element>
       </element>
+      <element id="directory" name="META-INF">
+        <element id="file-copy" path="$PROJECT_DIR$/target/kede-web-hn-0.0.1-SNAPSHOT/META-INF/MANIFEST.MF" />
+      </element>
       <element id="javaee-facet-resources" facet="kede-web-hn/web/Web" />
     </root>
   </artifact>

+ 12 - 0
.idea/dataSources.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="DataSourceManagerImpl" format="xml" multifile-model="true">
+    <data-source source="LOCAL" name="aft_ow@localhost" uuid="13c97e82-140a-49c4-8123-c91cf0f18438">
+      <driver-ref>mysql.8</driver-ref>
+      <synchronize>true</synchronize>
+      <jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
+      <jdbc-url>jdbc:mysql://localhost:3306/aft_ow</jdbc-url>
+      <working-dir>$ProjectFileDir$</working-dir>
+    </data-source>
+  </component>
+</project>

+ 55 - 0
.idea/free-mybatis-generator-config.xml

@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="PersistentConfig">
+    <option name="historyConfigList">
+      <map>
+        <entry key="links">
+          <value>
+            <Config>
+              <option name="comment" value="true" />
+              <option name="daoMvnPath" value="src/main/java" />
+              <option name="daoName" value="LinksMapper" />
+              <option name="daoPackage" value="com.kede.common.dao" />
+              <option name="daoPostfix" value="Mapper" />
+              <option name="modelMvnPath" value="src/main/java" />
+              <option name="modelName" value="Links" />
+              <option name="modelPackage" value="com.kede.common.model" />
+              <option name="name" value="links" />
+              <option name="overrideJava" value="true" />
+              <option name="overrideXML" value="true" />
+              <option name="primaryKey" value="id" />
+              <option name="projectFolder" value="$PROJECT_DIR$" />
+              <option name="tableName" value="links" />
+              <option name="useSchemaPrefix" value="true" />
+              <option name="xmlMvnPath" value="src/main/java" />
+              <option name="xmlPackage" value="com.kede.common.mapper" />
+            </Config>
+          </value>
+        </entry>
+        <entry key="popular_cities">
+          <value>
+            <Config>
+              <option name="comment" value="true" />
+              <option name="daoMvnPath" value="src/main/java" />
+              <option name="daoName" value="PopularCitiesMapper" />
+              <option name="daoPackage" value="com.kede.common.dao" />
+              <option name="daoPostfix" value="Mapper" />
+              <option name="modelMvnPath" value="src/main/java" />
+              <option name="modelName" value="PopularCities" />
+              <option name="modelPackage" value="com.kede.common.model" />
+              <option name="name" value="popular_cities" />
+              <option name="overrideJava" value="true" />
+              <option name="overrideXML" value="true" />
+              <option name="primaryKey" value="id" />
+              <option name="projectFolder" value="$PROJECT_DIR$" />
+              <option name="tableName" value="popular_cities" />
+              <option name="useSchemaPrefix" value="true" />
+              <option name="xmlMvnPath" value="src/main/java" />
+              <option name="xmlPackage" value="com.kede.common.mapper" />
+            </Config>
+          </value>
+        </entry>
+      </map>
+    </option>
+  </component>
+</project>

+ 1 - 0
.idea/inspectionProfiles/Project_Default.xml

@@ -1,6 +1,7 @@
 <component name="InspectionProjectProfileManager">
   <profile version="1.0">
     <option name="myName" value="Project Default" />
+    <inspection_tool class="MybatisMapperXmlInspection" enabled="false" level="ERROR" enabled_by_default="false" />
     <inspection_tool class="ThymeleafVariablesResolveInspection" enabled="false" level="ERROR" enabled_by_default="false" />
   </profile>
 </component>

+ 4 - 4
.idea/libraries/Maven__com_alibaba_fastjson_1_2_31.xml

@@ -1,13 +1,13 @@
 <component name="libraryTable">
-  <library name="Maven: com.alibaba:fastjson:1.2.31">
+  <library name="Maven: com.alibaba:fastjson:1.2.41">
     <CLASSES>
-      <root url="jar://$MAVEN_REPOSITORY$/com/alibaba/fastjson/1.2.31/fastjson-1.2.31.jar!/" />
+      <root url="jar://$MAVEN_REPOSITORY$/com/alibaba/fastjson/1.2.41/fastjson-1.2.41.jar!/" />
     </CLASSES>
     <JAVADOC>
-      <root url="jar://$MAVEN_REPOSITORY$/com/alibaba/fastjson/1.2.31/fastjson-1.2.31-javadoc.jar!/" />
+      <root url="jar://$MAVEN_REPOSITORY$/com/alibaba/fastjson/1.2.41/fastjson-1.2.41-javadoc.jar!/" />
     </JAVADOC>
     <SOURCES>
-      <root url="jar://$MAVEN_REPOSITORY$/com/alibaba/fastjson/1.2.31/fastjson-1.2.31-sources.jar!/" />
+      <root url="jar://$MAVEN_REPOSITORY$/com/alibaba/fastjson/1.2.41/fastjson-1.2.41-sources.jar!/" />
     </SOURCES>
   </library>
 </component>

+ 124 - 0
.idea/uiDesigner.xml

@@ -0,0 +1,124 @@
+<?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>

+ 1 - 1
kede-web-hn.iml

@@ -94,7 +94,7 @@
     <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:4.2.5.RELEASE" level="project" />
-    <orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.31" level="project" />
+    <orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.41" level="project" />
     <orderEntry type="library" name="Maven: org.aspectj:aspectjrt:1.6.10" level="project" />
     <orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.6.10" level="project" />
     <orderEntry type="library" name="Maven: cglib:cglib:2.2.2" level="project" />

+ 1 - 1
pom.xml

@@ -272,7 +272,7 @@
 		<dependency>
 			<groupId>com.alibaba</groupId>
 			<artifactId>fastjson</artifactId>
-			<version>1.2.31</version>
+			<version>1.2.41</version>
 		</dependency>
 
 		<!-- AspectJ -->

+ 1 - 0
src/main/java/com/kede/common/constant/ErrorConstants.java

@@ -14,6 +14,7 @@ public class ErrorConstants {
 
 	public static final String	PARAM_INTEGER_ERROR					= "PARAM_INTEGER_ERROR";
 
+	/** 参数不能*/
 	public static final String	PARAM_EMPTY_ERROR					= "PARAM_EMPTY_ERROR";
 	
 	public static final String	PARAM_BEING_ERROR					= "PARAM_BEING_ERROR";

+ 22 - 2
src/main/java/com/kede/common/controller/BaseController.java

@@ -4,12 +4,19 @@ import java.text.DateFormat;
 import java.text.MessageFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.List;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 
+import com.kede.linksAndHot.bo.InputLinksList;
+import com.kede.linksAndHot.bo.outLinksList;
+import com.kede.linksAndHot.bo.publicLinks;
+import com.kede.linksAndHot.service.LinkesService;
+import com.kede.linksAndHot.service.PopularCitiesService;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.propertyeditors.CustomDateEditor;
 import org.springframework.core.io.support.ResourcePropertySource;
@@ -26,6 +33,11 @@ import com.kede.core.shiro.token.TokenManager;
 
 @Controller
 public class BaseController {
+	@Autowired
+	private LinkesService linkesService;
+	@Autowired
+	private PopularCitiesService popularCitiesService;
+
 	@Resource(name = "errorResource")
 	private ResourcePropertySource	errorResource;
 
@@ -107,7 +119,6 @@ public class BaseController {
 
 	@ModelAttribute
 	public void prepareModel(HttpServletRequest request, Model model) {
-
 		model.addAttribute("staticDomain", avatarHost);
 		model.addAttribute("staticHost", staticHost);
 		model.addAttribute("avatarHost", avatarHost);
@@ -118,7 +129,8 @@ public class BaseController {
 		model.addAttribute("shiro", SecurityUtils.getSubject());
 		model.addAttribute("isLogin", TokenManager.isLogin());
 		model.addAttribute("csrf", TokenManager.getCSRF());
-		model.addAttribute("isAdmin", false);
+		model.addAttribute("links",getLinks());
+//		model.addAttribute("popularCities",getpopularCities());
 		if (TokenManager.isLogin() && TokenManager.getToken() instanceof Admin) {
 			model.addAttribute("adminData", TokenManager.getAdminToken());
 			model.addAttribute("userName", TokenManager.getAdminToken().getName());
@@ -126,4 +138,12 @@ public class BaseController {
 			model.addAttribute("isAdmin", true);
 		}
 	}
+
+	private Object getpopularCities() {
+		return popularCitiesService.getAllpopularCities();
+	}
+
+	private List<publicLinks> getLinks(){
+		return linkesService.getAllLinks();
+	}
 }

+ 22 - 0
src/main/java/com/kede/common/dao/LinksMapper.java

@@ -0,0 +1,22 @@
+package com.kede.common.dao;
+
+import com.kede.common.model.Links;
+import com.kede.linksAndHot.bo.publicLinks;
+
+import java.util.List;
+
+public interface LinksMapper {
+    int deleteByPrimaryKey(Integer id);
+
+    int insert(Links record);
+
+    int insertSelective(Links record);
+
+    Links selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(Links record);
+
+    int updateByPrimaryKey(Links record);
+
+    List<publicLinks> getAll();
+}

+ 17 - 0
src/main/java/com/kede/common/dao/PopularCitiesMapper.java

@@ -0,0 +1,17 @@
+package com.kede.common.dao;
+
+import com.kede.common.model.PopularCities;
+
+public interface PopularCitiesMapper {
+    int deleteByPrimaryKey(Integer id);
+
+    int insert(PopularCities record);
+
+    int insertSelective(PopularCities record);
+
+    PopularCities selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(PopularCities record);
+
+    int updateByPrimaryKey(PopularCities record);
+}

+ 48 - 0
src/main/java/com/kede/common/enums/LinksEnum.java

@@ -0,0 +1,48 @@
+package com.kede.common.enums;
+
+import com.kede.common.constant.ErrorConstants;
+
+import javax.validation.constraints.NotNull;
+import java.util.HashMap;
+import java.util.Map;
+
+public enum LinksEnum {
+
+    SORT("sort","排序"),
+    STATUS("status","状态"),
+    MUTUALCHAIN("mutualChain","互链"),
+    NAME("name","名称"),
+    URL("url","友链地址"),
+    NOT("not","未知");
+
+    private String code;
+    private String desc;
+
+    private static Map<String,LinksEnum> status=new HashMap<String,LinksEnum>();
+
+    private LinksEnum(String code,String desc){
+        this.code=code;
+        this.desc=desc;
+    }
+
+    static {
+        for (LinksEnum value:LinksEnum.values()){
+            status.put(value.code,value);
+        }
+    }
+
+    public static LinksEnum getField(String code){
+        if (status.containsKey(code)){
+            return status.get(code);
+        }
+        return NOT;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+}

+ 44 - 0
src/main/java/com/kede/common/enums/PopularCitiesEnum.java

@@ -0,0 +1,44 @@
+package com.kede.common.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum PopularCitiesEnum {
+
+    SORT("sort","排序"),
+    STATUS("status","状态"),
+    NAME("name","城市名称"),
+    NOT("not","未知");
+
+    private String code;
+    private String desc;
+
+    private static Map<String,PopularCitiesEnum> status=new HashMap<String,PopularCitiesEnum>();
+
+    private PopularCitiesEnum(String code,String desc){
+        this.code=code;
+        this.desc=desc;
+    }
+
+    static {
+        for (PopularCitiesEnum value:PopularCitiesEnum.values()){
+            status.put(value.code,value);
+        }
+    }
+
+    public static PopularCitiesEnum getField(String code){
+        if (status.containsKey(code)){
+            return status.get(code);
+        }
+        return NOT;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+}
+

+ 160 - 0
src/main/java/com/kede/common/mapper/LinksMapper.xml

@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.kede.common.dao.LinksMapper">
+  <resultMap id="BaseResultMap" type="com.kede.common.model.Links">
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="sort" jdbcType="INTEGER" property="sort" />
+    <result column="status" jdbcType="INTEGER" property="status" />
+    <result column="mutual_chain" jdbcType="INTEGER" property="mutualChain" />
+    <result column="name" jdbcType="VARCHAR" property="name" />
+    <result column="url" jdbcType="VARCHAR" property="url" />
+    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, sort, `status`, mutual_chain, `name`, url, remarks, create_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from links
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from links
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.kede.common.model.Links" useGeneratedKeys="true">
+    insert into links (sort, `status`, mutual_chain, 
+      `name`, url, remarks, 
+      create_time)
+    values (#{sort,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{mutualChain,jdbcType=INTEGER}, 
+      #{name,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, 
+      #{createTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.kede.common.model.Links" useGeneratedKeys="true">
+    insert into links
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="sort != null">
+        sort,
+      </if>
+      <if test="status != null">
+        `status`,
+      </if>
+      <if test="mutualChain != null">
+        mutual_chain,
+      </if>
+      <if test="name != null">
+        `name`,
+      </if>
+      <if test="url != null">
+        url,
+      </if>
+      <if test="remarks != null">
+        remarks,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="sort != null">
+        #{sort,jdbcType=INTEGER},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=INTEGER},
+      </if>
+      <if test="mutualChain != null">
+        #{mutualChain,jdbcType=INTEGER},
+      </if>
+      <if test="name != null">
+        #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="url != null">
+        #{url,jdbcType=VARCHAR},
+      </if>
+      <if test="remarks != null">
+        #{remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.kede.common.model.Links">
+    update links
+    <set>
+      <if test="sort != null">
+        sort = #{sort,jdbcType=INTEGER},
+      </if>
+      <if test="status != null">
+        `status` = #{status,jdbcType=INTEGER},
+      </if>
+      <if test="mutualChain != null">
+        mutual_chain = #{mutualChain,jdbcType=INTEGER},
+      </if>
+      <if test="name != null">
+        `name` = #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="url != null">
+        url = #{url,jdbcType=VARCHAR},
+      </if>
+      <if test="remarks != null">
+        remarks = #{remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.kede.common.model.Links">
+    update links
+    set sort = #{sort,jdbcType=INTEGER},
+      `status` = #{status,jdbcType=INTEGER},
+      mutual_chain = #{mutualChain,jdbcType=INTEGER},
+      `name` = #{name,jdbcType=VARCHAR},
+      url = #{url,jdbcType=VARCHAR},
+      remarks = #{remarks,jdbcType=VARCHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+
+  <select id="linkesList" resultType="com.kede.linksAndHot.bo.outLinksList">
+    select id,sort,status,mutual_chain mutualChain,name,url,remarks,
+           date_format(create_time,'%Y-%m-%d %H:%i:%S') createTimes
+    from links where 1=1
+    <if test="name !=null">
+      and name like concat('%',#{name},'%')
+    </if>
+    <if test="mutualChain !=null">
+      and mutual_chain = #{mutualChain}
+    </if>
+    <if test="status !=null">
+      and status = #{status}
+    </if>
+    order by sort
+    <if test="sortType ==0">
+    desc
+    </if>
+    <if test="page_sql !=null">
+      ${page_sql}
+    </if>
+  </select>
+  <select id="linksCount" resultType="integer">
+    select count(*)
+    from links where 1=1
+    <if test="name !=null">
+      and name like concat('%',#{name},'%')
+    </if>
+    <if test="mutualChain !=null">
+      and mutual_chain = #{mutualChain}
+    </if>
+    <if test="status !=null">
+      and status = #{status}
+    </if>
+  </select>
+  <select id="getAll" resultType="com.kede.linksAndHot.bo.publicLinks">
+    select id,name,url from links where status =1
+  </select>
+</mapper>

+ 138 - 0
src/main/java/com/kede/common/mapper/PopularCitiesMapper.xml

@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.kede.common.dao.PopularCitiesMapper">
+  <resultMap id="BaseResultMap" type="com.kede.common.model.PopularCities">
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="sort" jdbcType="INTEGER" property="sort" />
+    <result column="status" jdbcType="INTEGER" property="status" />
+    <result column="name" jdbcType="VARCHAR" property="name" />
+    <result column="url" jdbcType="VARCHAR" property="url" />
+    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, sort, `status`, `name`, url, remarks, create_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from popular_cities
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from popular_cities
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.kede.common.model.PopularCities" useGeneratedKeys="true">
+    insert into popular_cities (sort, `status`, `name`, 
+      url, remarks, create_time
+      )
+    values (#{sort,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, 
+      #{url,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}
+      )
+  </insert>
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.kede.common.model.PopularCities" useGeneratedKeys="true">
+    insert into popular_cities
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="sort != null">
+        sort,
+      </if>
+      <if test="status != null">
+        `status`,
+      </if>
+      <if test="name != null">
+        `name`,
+      </if>
+      <if test="url != null">
+        url,
+      </if>
+      <if test="remarks != null">
+        remarks,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="sort != null">
+        #{sort,jdbcType=INTEGER},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=INTEGER},
+      </if>
+      <if test="name != null">
+        #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="url != null">
+        #{url,jdbcType=VARCHAR},
+      </if>
+      <if test="remarks != null">
+        #{remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.kede.common.model.PopularCities">
+    update popular_cities
+    <set>
+      <if test="sort != null">
+        sort = #{sort,jdbcType=INTEGER},
+      </if>
+      <if test="status != null">
+        `status` = #{status,jdbcType=INTEGER},
+      </if>
+      <if test="name != null">
+        `name` = #{name,jdbcType=VARCHAR},
+      </if>
+      <if test="url != null">
+        url = #{url,jdbcType=VARCHAR},
+      </if>
+      <if test="remarks != null">
+        remarks = #{remarks,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.kede.common.model.PopularCities">
+    update popular_cities
+    set sort = #{sort,jdbcType=INTEGER},
+      `status` = #{status,jdbcType=INTEGER},
+      `name` = #{name,jdbcType=VARCHAR},
+      url = #{url,jdbcType=VARCHAR},
+      remarks = #{remarks,jdbcType=VARCHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <select id="popularCitiesList" resultType="com.kede.linksAndHot.bo.outPopularCitiesList">
+    select id,sort,status,name,url,remarks, date_format(create_time,'%Y-%m-%d %H:%i:%S') createTimes
+    from popular_cities where 1=1
+    <if test="name !=null">
+      and name like concat('%',#{name},'%')
+    </if>
+    <if test="status !=null">
+      and status = #{status}
+    </if>
+    order by sort
+    <if test="sortType ==0">
+      desc
+    </if>
+    <if test="page_sql !=null">
+      ${page_sql}
+    </if>
+  </select>
+  <select id="popularCitiesCount" resultType="integer">
+    select count(*)
+    from popular_cities where 1=1
+    <if test="name !=null">
+      and name like concat('%',#{name},'%')
+    </if>
+    <if test="status !=null">
+      and status = #{status}
+    </if>
+  </select>
+</mapper>

+ 116 - 0
src/main/java/com/kede/common/model/Links.java

@@ -0,0 +1,116 @@
+package com.kede.common.model;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * links
+ * @author 
+ */
+public class Links implements Serializable {
+    /**
+     * 编号
+     */
+    private Integer id;
+
+    /**
+     * 排序
+     */
+    private Integer sort;
+
+    /**
+     * 状态 0正常 1冻结
+     */
+    private Integer status;
+
+    /**
+     * 互链 0 否 1是
+     */
+    private Integer mutualChain;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 友链地址
+     */
+    private String url;
+
+    /**
+     * 备注
+     */
+    private String remarks;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    private static final long serialVersionUID = 1L;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getSort() {
+        return sort;
+    }
+
+    public void setSort(Integer sort) {
+        this.sort = sort;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Integer getMutualChain() {
+        return mutualChain;
+    }
+
+    public void setMutualChain(Integer mutualChain) {
+        this.mutualChain = mutualChain;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+}

+ 103 - 0
src/main/java/com/kede/common/model/PopularCities.java

@@ -0,0 +1,103 @@
+package com.kede.common.model;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * popular_cities
+ * @author 
+ */
+public class PopularCities implements Serializable {
+    /**
+     * 编号
+     */
+    private Integer id;
+
+    /**
+     * 排序
+     */
+    private Integer sort;
+
+    /**
+     * 状态 0正常 1冻结
+     */
+    private Integer status;
+
+    /**
+     * 热门城市
+     */
+    private String name;
+
+    /**
+     * 友链地址
+     */
+    private String url;
+
+    /**
+     * 备注
+     */
+    private String remarks;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    private static final long serialVersionUID = 1L;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getSort() {
+        return sort;
+    }
+
+    public void setSort(Integer sort) {
+        this.sort = sort;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+}

+ 183 - 0
src/main/java/com/kede/common/utils/RedisUtil.java

@@ -0,0 +1,183 @@
+package com.kede.common.utils;
+
+
+import com.alibaba.fastjson.JSON;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import redis.clients.jedis.Jedis;
+import redis.clients.jedis.JedisPool;
+
+import java.io.*;
+import java.util.List;
+
+/**
+ * redis辅助类
+ * @author 
+ *
+ */
+public class RedisUtil {
+	@Value(value = "${jedis.host}")
+	private  String host;
+	@Value(value = "${jedis.password}")
+	private  String pwd;
+	@Autowired
+	private  JedisPool pool;//创建代理对象
+	
+	
+	
+//	 /**
+//     * 初始化Redis连接池
+//     */
+//    public RedisUtil() {
+//    	if (pool==null) {
+//    		try {
+//    			JedisPoolConfig config = new JedisPoolConfig();
+//    			config.setBlockWhenExhausted(false);
+//    			config.setEvictionPolicyClassName("org.apache.commons.pool2.impl.DefaultEvictionPolicy"); 
+//    			config.setJmxEnabled(true);
+//    			config.setJmxNamePrefix("pool");
+//    			config.setLifo(true);
+//    			config.setMaxIdle(8);
+//    			config.setMaxTotal(8);
+//    			config.setMaxWaitMillis(-1);
+//    			config.setMinEvictableIdleTimeMillis(1800000L);
+//    			config.setMinIdle(0);
+//    			config.setNumTestsPerEvictionRun(3);
+//    			config.setSoftMinEvictableIdleTimeMillis(1800000L);
+//    			config.setTestOnBorrow(false);
+//    			config.setTestWhileIdle(false);
+//    			config.setTimeBetweenEvictionRunsMillis(-1);
+//    			pool = new JedisPool(config, host, 6379, 10000, pwd);
+//    		} catch (Exception e) {
+//    			e.printStackTrace();
+//    		}
+//		}
+//    }
+
+	
+	
+	public boolean presence(String key){
+		Jedis jedis = pool.getResource();
+		boolean bool=true;
+		try {
+			bool =jedis.exists(key);//进行判断
+		}catch(Exception e){
+			e.printStackTrace();//输出错误信息
+		}finally {
+			jedis.close();//释放资源
+		}
+		return bool;
+	}
+	/**
+	 * 将缓存中数据进行反序列化
+	 * @param key
+	 * @param clazz
+	 * @return
+	 */
+	@SuppressWarnings("unchecked")
+	public <T>List<T> getObject(String key,Class<T> clazz){
+		Jedis jedis = pool.getResource();
+		ByteArrayInputStream is=null;
+		ObjectInputStream ois=null;
+		try {
+			//将缓存中数据存入byte数组中
+			byte[] b = jedis.get(key.getBytes());
+			is= new ByteArrayInputStream(b);
+			ois = new ObjectInputStream(is);
+			return(List<T>)ois.readObject();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally{
+			try {
+				is.close();
+				ois.close();
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+			jedis.close();
+		}
+		return null;
+	}
+	/**
+	 * 将对象进行序列化存入redis中
+	 * @param object
+	 * @param key
+	 */
+	public void saveObject(Object object,String key){
+		Jedis jedis=pool.getResource();
+		ByteArrayOutputStream os=null;
+		ObjectOutputStream oos=null;
+		try {
+			os=new ByteArrayOutputStream();
+			oos =new ObjectOutputStream(os);
+			byte[] b=os.toByteArray();
+			JSON.toJSONString(b);
+			jedis.set(key.getBytes(), b);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}finally{
+			try {
+				os.close();
+				oos.close();
+			} catch (Exception e2) {
+				e2.printStackTrace();
+			}
+			jedis.close();
+		}
+	}
+	// 把List集合对象转换成json格式保存到指定的键中
+	public void saveJsonArray(Object object, String key) {
+		Jedis jedis = pool.getResource();
+		try {
+			// 格式化成Json字符串
+			String array = JSON.toJSONString(object);
+			jedis.set(key, array.toString()); // 存入缓存
+		} finally {
+			jedis.close();
+		}
+	}
+	
+		public void setString(String key, String value) {
+			Jedis jedis = pool.getResource();
+			try {
+				jedis.set(key,value); // 存入缓存
+			} finally {
+				jedis.close();
+			}
+		}
+		
+		public void deleteString(String key) {
+			Jedis jedis = pool.getResource();
+			try {
+				jedis.del(key);
+			} finally {
+				jedis.close();
+			}
+		}
+		
+		public String getString(String key) {
+			Jedis jedis = pool.getResource();
+			String str=new String();
+			try {
+				str=jedis.get(key);
+			} finally {
+				jedis.close();
+			}
+			return str;
+		}
+
+	// 通过键取出Json字符串并转换成 <T>这个T所指定的类型
+	public  <T> T getJsonArray(String key, Class<T> clazz) {
+		Jedis jedis = pool.getResource();
+		try {
+			String str = jedis.get(key);
+			// 把字符串转换回集合对象 clazz是指定的类型
+			return JSON.parseObject(str, clazz);
+		} finally {
+			jedis.close();
+		}
+	}
+}
+
+

+ 91 - 0
src/main/java/com/kede/linksAndHot/bo/InputLinks.java

@@ -0,0 +1,91 @@
+package com.kede.linksAndHot.bo;
+
+import com.kede.common.constant.ErrorConstants;
+import com.kede.common.model.Links;
+
+import javax.validation.constraints.NotNull;
+
+public class InputLinks extends Links {
+    /**
+     * 排序
+     */
+    @NotNull(message= ErrorConstants.PARAM_EMPTY_ERROR)
+    private Integer sort;
+
+    /**
+     * 状态 0正常 1冻结
+     */
+    @NotNull(message= ErrorConstants.PARAM_EMPTY_ERROR)
+    private Integer status;
+
+    /**
+     * 互链 0 否 1是
+     */
+    @NotNull(message= ErrorConstants.PARAM_EMPTY_ERROR)
+    private Integer mutualChain;
+
+    /**
+     * 名称
+     */
+    @NotNull(message= ErrorConstants.PARAM_EMPTY_ERROR)
+    private String name;
+
+    /**
+     * 友链地址
+     */
+    @NotNull(message= ErrorConstants.PARAM_EMPTY_ERROR)
+    private String url;
+
+
+    @Override
+    public Integer getSort() {
+        return sort;
+    }
+
+    @Override
+    public void setSort(Integer sort) {
+        this.sort = sort;
+    }
+
+    @Override
+    public Integer getStatus() {
+        return status;
+    }
+
+    @Override
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    @Override
+    public Integer getMutualChain() {
+        return mutualChain;
+    }
+
+    @Override
+    public void setMutualChain(Integer mutualChain) {
+        this.mutualChain = mutualChain;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public String getUrl() {
+        return url;
+    }
+
+    @Override
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+
+}

+ 62 - 0
src/main/java/com/kede/linksAndHot/bo/InputLinksList.java

@@ -0,0 +1,62 @@
+package com.kede.linksAndHot.bo;
+
+public class InputLinksList {
+    /** 排序从高到低 */
+    private Integer sortType;
+    /** 名称 */
+    private String name;
+    /** 互链 0否 1是 */
+    private Integer mutualChain;
+    /** 状态 0正常 1冻结*/
+    private Integer status;
+    private Integer pageNo;
+    private Integer pageSize;
+
+    public Integer getSortType() {
+        return sortType;
+    }
+
+    public void setSortType(Integer sortType) {
+        this.sortType = sortType;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getMutualChain() {
+        return mutualChain;
+    }
+
+    public void setMutualChain(Integer mutualChain) {
+        this.mutualChain = mutualChain;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Integer getPageNo() {
+        return pageNo;
+    }
+
+    public void setPageNo(Integer pageNo) {
+        this.pageNo = pageNo;
+    }
+
+    public Integer getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(Integer pageSize) {
+        this.pageSize = pageSize;
+    }
+}

+ 87 - 0
src/main/java/com/kede/linksAndHot/bo/InputPopularCities.java

@@ -0,0 +1,87 @@
+package com.kede.linksAndHot.bo;
+
+import com.kede.common.constant.ErrorConstants;
+import com.kede.common.model.PopularCities;
+
+import javax.validation.constraints.NotNull;
+
+public class InputPopularCities extends PopularCities {
+
+    /**
+     * 排序
+     */
+    @NotNull(message = ErrorConstants.PARAM_EMPTY_ERROR)
+    private Integer sort;
+
+    /**
+     * 状态 0正常 1冻结
+     */
+    @NotNull(message = ErrorConstants.PARAM_EMPTY_ERROR)
+    private Integer status;
+
+    /**
+     * 热门城市
+     */
+    @NotNull(message = ErrorConstants.PARAM_EMPTY_ERROR)
+    private String name;
+
+    /**
+     * 友链地址
+     */
+    private String url;
+
+    /**
+     * 备注
+     */
+    private String remarks;
+
+    @Override
+    public Integer getSort() {
+        return sort;
+    }
+
+    @Override
+    public void setSort(Integer sort) {
+        this.sort = sort;
+    }
+
+    @Override
+    public Integer getStatus() {
+        return status;
+    }
+
+    @Override
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public String getUrl() {
+        return url;
+    }
+
+    @Override
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    @Override
+    public String getRemarks() {
+        return remarks;
+    }
+
+    @Override
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+}

+ 54 - 0
src/main/java/com/kede/linksAndHot/bo/InputPopularCitiesList.java

@@ -0,0 +1,54 @@
+package com.kede.linksAndHot.bo;
+
+public class InputPopularCitiesList {
+
+    private Integer sortType;
+
+    private String name;
+
+    private Integer status;
+
+    private Integer pageSize;
+
+    private Integer pageNo;
+
+    public Integer getSortType() {
+        return sortType;
+    }
+
+    public void setSortType(Integer sortType) {
+        this.sortType = sortType;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Integer getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(Integer pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public Integer getPageNo() {
+        return pageNo;
+    }
+
+    public void setPageNo(Integer pageNo) {
+        this.pageNo = pageNo;
+    }
+}

+ 86 - 0
src/main/java/com/kede/linksAndHot/bo/outLinksList.java

@@ -0,0 +1,86 @@
+package com.kede.linksAndHot.bo;
+
+public class outLinksList {
+
+
+
+    private Integer id;
+
+    private Integer sort;
+
+    private Integer status;
+
+    private Integer mutualChain;
+
+    private String name;
+
+    private String url;
+
+    private String remarks;
+
+    private String createTimes;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getSort() {
+        return sort;
+    }
+
+    public void setSort(Integer sort) {
+        this.sort = sort;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Integer getMutualChain() {
+        return mutualChain;
+    }
+
+    public void setMutualChain(Integer mutualChain) {
+        this.mutualChain = mutualChain;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
+    public String getCreateTimes() {
+        return createTimes;
+    }
+
+    public void setCreateTimes(String createTimes) {
+        this.createTimes = createTimes;
+    }
+}

+ 67 - 0
src/main/java/com/kede/linksAndHot/bo/outPopularCitiesList.java

@@ -0,0 +1,67 @@
+package com.kede.linksAndHot.bo;
+
+public class outPopularCitiesList {
+    private Integer id;
+    private Integer sort;
+    private Integer status;
+    private String name;
+    private String url;
+    private String remarks;
+    private String createTimes;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getSort() {
+        return sort;
+    }
+
+    public void setSort(Integer sort) {
+        this.sort = sort;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public String getRemarks() {
+        return remarks;
+    }
+
+    public void setRemarks(String remarks) {
+        this.remarks = remarks;
+    }
+
+    public String getCreateTimes() {
+        return createTimes;
+    }
+
+    public void setCreateTimes(String createTimes) {
+        this.createTimes = createTimes;
+    }
+}

+ 34 - 0
src/main/java/com/kede/linksAndHot/bo/publicLinks.java

@@ -0,0 +1,34 @@
+package com.kede.linksAndHot.bo;
+
+
+import java.io.Serializable;
+
+public class publicLinks implements Serializable {
+    private String id;
+    private String name;
+    private String url;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+}

+ 63 - 0
src/main/java/com/kede/linksAndHot/controller/AdminHotApiController.java

@@ -0,0 +1,63 @@
+package com.kede.linksAndHot.controller;
+
+import com.kede.common.bo.Result;
+import com.kede.common.constant.ErrorConstants;
+import com.kede.common.controller.BaseApiController;
+import com.kede.common.enums.LinksEnum;
+import com.kede.common.enums.PopularCitiesEnum;
+import com.kede.common.model.Links;
+import com.kede.linksAndHot.bo.InputLinksList;
+import com.kede.linksAndHot.bo.InputPopularCities;
+import com.kede.linksAndHot.bo.InputPopularCitiesList;
+import com.kede.linksAndHot.service.LinkesService;
+import com.kede.linksAndHot.service.PopularCitiesService;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+
+@RestController
+@RequestMapping(value = "/api/admin/popularCities")
+public class AdminHotApiController extends BaseApiController {
+	@Resource
+ 	private PopularCitiesService popularCitiesService;
+	
+
+	@RequestMapping(value = "/add", method = RequestMethod.POST)
+	public Result add(@Validated InputPopularCities in, BindingResult bindingResult) {
+		Result res =new Result();
+		if (bindingResult.hasErrors()) {
+			String meg=bindingResult.getFieldError().getDefaultMessage();
+			String name= PopularCitiesEnum.getField(bindingResult.getFieldError().getField()).getDesc();
+			res.getError().add(buildError(meg,"",name));
+			return res;
+		}
+		if(!res.getError().isEmpty())return res;
+		res.data(popularCitiesService.add(in));
+		return res;
+	}
+
+	@RequestMapping(value = "/update", method = RequestMethod.POST)
+	public Result update(InputPopularCities in) {
+		Result res =new Result();
+		if (in.getId()==null){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","编号"));
+			return res;
+		}
+		res.data(popularCitiesService.update(in));
+		return res;
+	}
+
+	@RequestMapping(value = "/list", method = RequestMethod.GET)
+	public Result list(InputPopularCitiesList in ) {
+		Result res =new Result();
+
+		res.data(popularCitiesService.list(in));
+		return res;
+	}
+
+}

+ 60 - 0
src/main/java/com/kede/linksAndHot/controller/AdminLinksApiController.java

@@ -0,0 +1,60 @@
+package com.kede.linksAndHot.controller;
+
+import com.kede.common.bo.Result;
+import com.kede.common.constant.ErrorConstants;
+import com.kede.common.controller.BaseApiController;
+import com.kede.common.enums.LinksEnum;
+import com.kede.common.model.Links;
+import com.kede.linksAndHot.bo.InputLinks;
+import com.kede.linksAndHot.bo.InputLinksList;
+import com.kede.linksAndHot.service.LinkesService;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+
+@RestController
+@RequestMapping(value = "/api/admin/links")
+public class AdminLinksApiController extends BaseApiController {
+	@Resource
+ 	private LinkesService linkesService;
+	
+
+	@RequestMapping(value = "/add", method = RequestMethod.POST)
+	public Result add(@Validated InputLinks in, BindingResult bindingResult) {
+		Result res =new Result();
+		if (bindingResult.hasErrors()) {
+			String meg=bindingResult.getFieldError().getDefaultMessage();
+			String name=LinksEnum.getField(bindingResult.getFieldError().getField()).getDesc();
+			res.getError().add(buildError(meg,"",name));
+			return res;
+		}
+		if(!res.getError().isEmpty())return res;
+		res.data(linkesService.add(in));
+		return res;
+	}
+
+	@RequestMapping(value = "/update", method = RequestMethod.POST)
+	public Result update(Links in) {
+		Result res =new Result();
+		if (in.getId()==null){
+			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","编号"));
+			return res;
+		}
+		res.data(linkesService.update(in));
+		return res;
+	}
+
+	@RequestMapping(value = "/list", method = RequestMethod.GET)
+	public Result list(InputLinksList in ) {
+		Result res =new Result();
+
+		res.data(linkesService.list(in));
+		return res;
+	}
+
+}

+ 19 - 0
src/main/java/com/kede/linksAndHot/service/LinkesService.java

@@ -0,0 +1,19 @@
+package com.kede.linksAndHot.service;
+
+import com.kede.common.model.Links;
+import com.kede.linksAndHot.bo.InputLinks;
+import com.kede.linksAndHot.bo.InputLinksList;
+import com.kede.linksAndHot.bo.outLinksList;
+import com.kede.linksAndHot.bo.publicLinks;
+
+import java.util.List;
+
+public interface LinkesService {
+    int add(InputLinks in);
+
+    int update(Links in);
+
+    Object list(InputLinksList in);
+
+    List<publicLinks> getAllLinks();
+}

+ 17 - 0
src/main/java/com/kede/linksAndHot/service/PopularCitiesService.java

@@ -0,0 +1,17 @@
+package com.kede.linksAndHot.service;
+
+
+import com.kede.common.model.Links;
+import com.kede.linksAndHot.bo.InputLinksList;
+import com.kede.linksAndHot.bo.InputPopularCities;
+import com.kede.linksAndHot.bo.InputPopularCitiesList;
+
+public interface PopularCitiesService {
+    int add(InputPopularCities in);
+
+    int update(InputPopularCities in);
+
+    Object list(InputPopularCitiesList in);
+
+    Object getAllpopularCities();
+}

+ 58 - 0
src/main/java/com/kede/linksAndHot/service/impl/LinkesServiceImpl.java

@@ -0,0 +1,58 @@
+package com.kede.linksAndHot.service.impl;
+
+import com.kede.common.dao.LinksMapper;
+import com.kede.common.model.Links;
+import com.kede.common.utils.RedisUtil;
+import com.kede.core.mybatis.BaseMybatisDao;
+import com.kede.linksAndHot.bo.InputLinks;
+import com.kede.linksAndHot.bo.InputLinksList;
+import com.kede.linksAndHot.bo.outLinksList;
+import com.kede.linksAndHot.bo.publicLinks;
+import com.kede.linksAndHot.service.LinkesService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class LinkesServiceImpl extends BaseMybatisDao<LinksMapper> implements LinkesService {
+    @Autowired
+    private LinksMapper linksMapper;
+    @Autowired
+    private RedisUtil redisUtil;
+
+    @Override
+    public int add(InputLinks in) {
+        return linksMapper.insertSelective(in);
+    }
+
+    @Override
+    public int update(Links in) {
+        return linksMapper.updateByPrimaryKeySelective(in);
+    }
+
+    @Override
+    public Object list(InputLinksList in) {
+        Map<String, Object> params = new HashMap<String, Object>();
+        if(in.getName()!=null)params.put("name",in.getName());
+        if(in.getMutualChain()!=null)params.put("mutualChain",in.getMutualChain());
+        if(in.getStatus()!=null)params.put("status",in.getStatus());
+        if(in.getSortType()!=null)params.put("sortType",in.getSortType());
+        return findPage("linkesList","linksCount",params,in.getPageNo(), in.getPageSize());
+    }
+
+    @Override
+    public List<publicLinks> getAllLinks() {
+        List<publicLinks> list=new ArrayList<>();
+        if (list.isEmpty()){
+            list=linksMapper.getAll();
+//            redisUtil.saveObject(list,"allLinks");
+
+        }
+        return list;
+    }
+}

+ 49 - 0
src/main/java/com/kede/linksAndHot/service/impl/PopularCitiesServiceImpl.java

@@ -0,0 +1,49 @@
+package com.kede.linksAndHot.service.impl;
+
+import com.kede.common.dao.PopularCitiesMapper;
+import com.kede.common.model.Links;
+import com.kede.core.mybatis.BaseMybatisDao;
+import com.kede.linksAndHot.bo.InputLinksList;
+import com.kede.linksAndHot.bo.InputPopularCities;
+import com.kede.linksAndHot.bo.InputPopularCitiesList;
+import com.kede.linksAndHot.service.PopularCitiesService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Service
+@Transactional
+public class PopularCitiesServiceImpl extends BaseMybatisDao<PopularCitiesMapper> implements PopularCitiesService {
+    @Autowired
+    private PopularCitiesMapper popularCitiesMapper;
+
+    @Override
+    public int add(InputPopularCities in) {
+        return popularCitiesMapper.insertSelective(in);
+    }
+
+    @Override
+    public int update(InputPopularCities in) {
+        return popularCitiesMapper.updateByPrimaryKeySelective(in);
+    }
+
+    @Override
+    public Object list(InputPopularCitiesList in) {
+        Map<String,Object> param=new HashMap<>();
+        if (in.getName()!=null)param.put("name",in.getName());
+        if (in.getSortType()!=null)param.put("sortType",in.getSortType());
+        if(in.getStatus()!=null)param.put("status",in.getStatus());
+        return findPage("popularCitiesList","popularCitiesCount",param, in.getPageNo(), in.getPageSize());
+    }
+
+    @Override
+    public Object getAllpopularCities() {
+        Map<String,Object> param=new HashMap<>();
+        param.put("status",1);
+        return findList("popularCitiesList",param,1,9999);
+    }
+}

+ 8 - 0
src/main/webapp/WEB-INF/views/common.html

@@ -606,6 +606,14 @@
         }
         /*]]>*/
     </script>
+    <script th:inline="javascript" th:if="${adminData!=null}">
+        /*<![CDATA[*/
+        window.paramData = {
+            links : /*[[${links}]]*/'',
+            popularCities : /*[[${popularCities}]]*/'',
+        }
+        /*]]>*/
+    </script>
     <script th:if="${type}!='houtai'">
         var _hmt = _hmt || [];
         (function() {