Browse Source

Merge branch 'develop'

# Conflicts:
#	文档/MYSQL/smartCommunity.pdb
#	文档/MYSQL/smartCommunity.pdm
傅行帆 6 years ago
parent
commit
8fdaa39900
100 changed files with 3625 additions and 204 deletions
  1. 1
    0
      .gitignore
  2. BIN
      CODE/smart-community/[B@5e730dac
  3. BIN
      CODE/smart-community/[B@6fdba475
  4. BIN
      CODE/smart-community/app-api/lib/Digests.jar
  5. BIN
      CODE/smart-community/app-api/lib/HttpClientSSLUtils.jar
  6. 40
    6
      CODE/smart-community/app-api/pom.xml
  7. 102
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/common/PicUtils.java
  8. 3
    5
      CODE/smart-community/app-api/src/main/java/com/community/huiju/common/code/cache/AppkeyCache.java
  9. 123
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/HKConstant.java
  10. 452
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/HKOpenApi.java
  11. 40
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/entity/MonitoryPoint.java
  12. 184
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/test/OpenapiTest.java
  13. 76
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/AssembleController.java
  14. 27
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/BaseController.java
  15. 15
    3
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/BillController.java
  16. 67
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/FaceController.java
  17. 21
    25
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/ImageController.java
  18. 51
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/MenuController.java
  19. 26
    8
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/MessageController.java
  20. 69
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/MonitoringController.java
  21. 90
    25
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java
  22. 45
    16
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TicketController.java
  23. 1
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/UserController.java
  24. 13
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/VistorController.java
  25. 27
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaFaceMapper.java
  26. 24
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaSysMenuImgMapper.java
  27. 29
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaSysMenuMapper.java
  28. 19
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TdImagesMapper.java
  29. 0
    7
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTicketMapper.java
  30. 2
    2
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTransactionMapper.java
  31. 1
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaAgreement.java
  32. 50
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaFace.java
  33. 95
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaSysMenu.java
  34. 33
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaSysMenuImg.java
  35. 33
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaUser.java
  36. 65
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TdImages.java
  37. 1
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/BillServiceI.java
  38. 7
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/CommunityServiceI.java
  39. 28
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/FaceServiceI.java
  40. 29
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/IMonitoringService.java
  41. 2
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITicketService.java
  42. 15
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ImageServiceI.java
  43. 15
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/MenuServiceI.java
  44. 1
    4
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/MessageServiceI.java
  45. 9
    6
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java
  46. 8
    3
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/BillServiceImpl.java
  47. 5
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/CommunityServiceImpl.java
  48. 197
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/FaceServicelimpl.java
  49. 43
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/ImageServiceimpl.java
  50. 41
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/MenuServiceImpl.java
  51. 8
    4
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/MessageServiceImpl.java
  52. 72
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/MonitoringServiceImpl.java
  53. 82
    24
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java
  54. 185
    9
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java
  55. 1
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaVistorServiceImpl.java
  56. 39
    15
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TicketServiceImpl.java
  57. 6
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/vo/TaUserVO.java
  58. 120
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TaFaceMapper.xml
  59. 78
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TaSysMenuImgMapper.xml
  60. 135
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TaSysMenuMapper.xml
  61. 41
    6
      CODE/smart-community/app-api/src/main/resources/mapper/TaUserMapper.xml
  62. 106
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TdImagesMapper.xml
  63. 2
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TpActivityMapper.xml
  64. 3
    1
      CODE/smart-community/app-api/src/main/resources/mapper/TpAnnouncementMapper.xml
  65. 0
    11
      CODE/smart-community/app-api/src/main/resources/mapper/TpTicketMapper.xml
  66. 8
    2
      CODE/smart-community/app-api/src/main/resources/mapper/TpTransactionMapper.xml
  67. 20
    8
      CODE/smart-community/community-common/pom.xml
  68. 213
    0
      CODE/smart-community/community-common/src/main/java/com/community/commom/ailiyun/AESDecode.java
  69. 17
    0
      CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java
  70. 133
    0
      CODE/smart-community/community-common/src/main/java/com/community/commom/hk/Digests.java
  71. 127
    0
      CODE/smart-community/community-common/src/main/java/com/community/commom/hk/HttpClientSSLUtils.java
  72. 2
    2
      CODE/smart-community/community-common/src/main/java/com/community/commom/utils/MD5Utils.java
  73. 2
    2
      CODE/smart-community/community-common/src/main/java/com/community/commom/utils/OssUtil.java
  74. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/constant/Constant.class
  75. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/mode/ResponseBean.class
  76. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/redis/FastJsonSerializer.class
  77. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/redis/RedisConfiguration.class
  78. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/redis/RedisJsonSerializer.class
  79. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/redis/RedisObjectSerializer.class
  80. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/redis/RedisSerializer.class
  81. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/redis/RedisTemplate.class
  82. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/redis/SerializationFailedException.class
  83. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/redis/SingleRedisTemplate.class
  84. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/session/UserElement.class
  85. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/AccountValidatorUtil.class
  86. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/BeanTools.class
  87. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/CommonUtils.class
  88. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/CookieUtil.class
  89. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/DESUtils.class
  90. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/DateUtils.class
  91. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/EnumUtils.class
  92. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/HttpClientUtils.class
  93. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/MD5Utils.class
  94. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/OssUtil.class
  95. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/QRCodeGeneratorUtils.class
  96. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/StringConverter.class
  97. BIN
      CODE/smart-community/community-common/target/community-common-0.0.1.jar
  98. BIN
      CODE/smart-community/community-common/target/community-common-0.0.1.jar.original
  99. 0
    4
      CODE/smart-community/community-common/target/maven-archiver/pom.properties
  100. 0
    0
      CODE/smart-community/community-common/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst

+ 1
- 0
.gitignore View File

@@ -0,0 +1 @@
1
+*.class

BIN
CODE/smart-community/[B@5e730dac View File


BIN
CODE/smart-community/[B@6fdba475 View File


BIN
CODE/smart-community/app-api/lib/Digests.jar View File


BIN
CODE/smart-community/app-api/lib/HttpClientSSLUtils.jar View File


+ 40
- 6
CODE/smart-community/app-api/pom.xml View File

@@ -87,7 +87,6 @@
87 87
 			<groupId>com.community</groupId>
88 88
 			<artifactId>community-common</artifactId>
89 89
 			<version>0.0.1</version>
90
-			<scope>compile</scope>
91 90
 		</dependency>
92 91
 
93 92
 		<dependency>
@@ -117,10 +116,10 @@
117 116
 
118 117
 		<!-- log4j -->
119 118
 
120
-		<dependency>
121
-			<groupId>org.springframework.boot</groupId>
122
-			<artifactId>spring-boot-starter-log4j</artifactId>
123
-		</dependency>
119
+		<!--<dependency>-->
120
+			<!--<groupId>org.springframework.boot</groupId>-->
121
+			<!--<artifactId>spring-boot-starter-log4j</artifactId>-->
122
+		<!--</dependency>-->
124 123
 
125 124
 		<dependency>
126 125
 			<groupId>org.springframework.boot</groupId>
@@ -162,9 +161,31 @@
162 161
 			<version>3.11.0</version>
163 162
 		</dependency>
164 163
 
164
+		<dependency>
165
+			<groupId>commons-httpclient</groupId>
166
+			<artifactId>commons-httpclient</artifactId>
167
+			<version>3.1</version>
168
+		</dependency>
165 169
 
170
+		<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
171
+		<dependency>
172
+			<groupId>commons-io</groupId>
173
+			<artifactId>commons-io</artifactId>
174
+			<version>1.4</version>
175
+		</dependency>
176
+
177
+		<dependency>
178
+			<groupId>net.coobird</groupId>
179
+			<artifactId>thumbnailator</artifactId>
180
+			<version>0.4.2</version>
181
+		</dependency>
182
+        <dependency>
183
+            <groupId>mysql</groupId>
184
+            <artifactId>mysql-connector-java</artifactId>
185
+        </dependency>
166 186
 
167
-	</dependencies>
187
+
188
+    </dependencies>
168 189
 
169 190
 	<dependencyManagement>
170 191
 		<dependencies>
@@ -184,6 +205,19 @@
184 205
 				<groupId>org.springframework.boot</groupId>
185 206
 				<artifactId>spring-boot-maven-plugin</artifactId>
186 207
 			</plugin>
208
+			<plugin>
209
+				<groupId>org.apache.maven.plugins</groupId>
210
+				<artifactId>maven-compiler-plugin</artifactId>
211
+				<version>3.7.0</version>
212
+				<configuration>
213
+					<source>1.8</source>
214
+					<target>1.8</target>
215
+					<encoding>UTF-8</encoding>
216
+					<compilerArguments>
217
+						<extdirs>${project.basedir}/lib</extdirs>
218
+					</compilerArguments>
219
+				</configuration>
220
+			</plugin>
187 221
 		</plugins>
188 222
 	</build>
189 223
 

+ 102
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/common/PicUtils.java View File

@@ -0,0 +1,102 @@
1
+package com.community.huiju.common;
2
+
3
+import net.coobird.thumbnailator.Thumbnails;
4
+import org.slf4j.Logger;
5
+import org.slf4j.LoggerFactory;
6
+import org.springframework.web.multipart.MultipartFile;
7
+
8
+import java.io.ByteArrayInputStream;
9
+import java.io.ByteArrayOutputStream;
10
+import java.io.IOException;
11
+
12
+/**
13
+ * 图片压缩Utils
14
+ *
15
+ * @author worstEzreal
16
+ * @version V1.1.0
17
+ * @date 2018/3/12
18
+ */
19
+public class PicUtils {
20
+
21
+    private static Logger logger = LoggerFactory.getLogger(PicUtils.class);
22
+
23
+    /**
24
+     * 根据指定大小压缩图片
25
+     *
26
+     * @param imageBytes  源图片字节数组
27
+     * @param desFileSize 指定图片大小,单位kb
28
+     * @param imageId     影像编号
29
+     * @return 压缩质量后的图片字节数组
30
+     */
31
+    public static byte[] compressPicForScale(byte[] imageBytes, long desFileSize, String imageId) {
32
+        if (imageBytes == null || imageBytes.length <= 0 || imageBytes.length < desFileSize * 1024) {
33
+            return imageBytes;
34
+        }
35
+        long srcSize = imageBytes.length;
36
+        double accuracy = getAccuracy(srcSize / 1024);
37
+        try {
38
+            while (imageBytes.length > desFileSize * 1024) {
39
+                ByteArrayInputStream inputStream = new ByteArrayInputStream(imageBytes);
40
+                ByteArrayOutputStream outputStream = new ByteArrayOutputStream(imageBytes.length);
41
+                Thumbnails.of(inputStream)
42
+                        .scale(accuracy)
43
+                        .outputQuality(accuracy)
44
+                        .toOutputStream(outputStream);
45
+                imageBytes = outputStream.toByteArray();
46
+            }
47
+            logger.info("【图片压缩】imageId={} | 图片原大小={}kb | 压缩后大小={}kb",
48
+                    imageId, srcSize / 1024, imageBytes.length / 1024);
49
+        } catch (Exception e) {
50
+            logger.error("【图片压缩】msg=图片压缩失败!", e);
51
+        }
52
+        return imageBytes;
53
+    }
54
+
55
+    /**
56
+     * 自动调节精度(经验数值)
57
+     *
58
+     * @param size 源图片大小
59
+     * @return 图片压缩质量比
60
+     */
61
+    private static double getAccuracy(long size) {
62
+        double accuracy;
63
+        if (size < 900) {
64
+            accuracy = 0.85;
65
+        } else if (size < 2047) {
66
+            accuracy = 0.6;
67
+        } else if (size < 3275) {
68
+            accuracy = 0.44;
69
+        } else {
70
+            accuracy = 0.4;
71
+        }
72
+        return accuracy;
73
+    }
74
+    
75
+    /**
76
+     * 图片进行Base64位编码
77
+     * @param fileBytes
78
+     * @return
79
+     */
80
+/*    public static String getImgStr(byte [] fileBytes) {
81
+        return new String(org.apache.commons.codec.binary.Base64.encodeBase64(fileBytes));
82
+    }*/
83
+
84
+    /**
85
+     * 图片进行Base64位编码
86
+     * @param imgFile
87
+     * @return
88
+     */
89
+    public static String getImgStr(MultipartFile imgFile){
90
+        byte[] data = null;
91
+        try
92
+        {
93
+            data = imgFile.getBytes();
94
+        }
95
+        catch (IOException e)
96
+        {
97
+            e.printStackTrace();
98
+        }
99
+        return new String(org.apache.commons.codec.binary.Base64.encodeBase64(data));
100
+    }
101
+
102
+}

+ 3
- 5
CODE/smart-community/app-api/src/main/java/com/community/huiju/common/code/cache/AppkeyCache.java View File

@@ -1,12 +1,9 @@
1 1
 package com.community.huiju.common.code.cache;
2
-
3 2
 import com.community.commom.constant.Constant;
4 3
 import com.google.common.cache.CacheBuilder;
5 4
 import com.google.common.cache.CacheLoader;
6 5
 import com.google.common.cache.LoadingCache;
7 6
 import lombok.extern.slf4j.Slf4j;
8
-
9
-import java.util.concurrent.ExecutionException;
10 7
 import java.util.concurrent.TimeUnit;
11 8
 
12 9
 /**
@@ -33,8 +30,9 @@ public class AppkeyCache {
33 30
         Object value = null;
34 31
         try {
35 32
             value = cache.get(appKey);
36
-        } catch (ExecutionException e) {
37
-            e.printStackTrace();
33
+        } catch (Exception e) {
34
+            //e.printStackTrace();
35
+            value = null;
38 36
         }
39 37
         return value;
40 38
     }

+ 123
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/HKConstant.java View File

@@ -0,0 +1,123 @@
1
+package com.community.huiju.common.hk;
2
+
3
+public class HKConstant {
4
+
5
+    /**
6
+     * APPKEY需要到部署的平台服务器上生成。
7
+     * <p>
8
+     * 调用Openpai的操作码,需要去平台上生成,详见《海康威视iVMS-8700平台SDKV2.*.* HTTP-OpenAPI使用说明书.chm》中[获取AppKey和Secret]章节说明
9
+     * </p>
10
+     * <p>
11
+     * 《海康威视iVMS-8700平台SDKV2.*.* HTTP-OpenAPI使用说明书.chm》 该文档请找技术支持或者交付的同事提供
12
+     * </p>
13
+     */
14
+    public static final String APPKEY = "b4434b13";
15
+
16
+    /**
17
+     * SECRET需要到部署的平台服务器上生成。
18
+     * <p>
19
+     * 调用Openpai的操作码,需要去平台上生成,详见《海康威视iVMS-8700平台SDKV2.*.* HTTP-OpenAPI使用说明书.chm》中[获取AppKey和Secret]章节说明
20
+     * </p>
21
+     * <p>
22
+     * 《海康威视iVMS-8700平台SDKV2.*.* HTTP-OpenAPI使用说明书.chm》 该文档请找技术支持或者交付的同事提供
23
+     * </p>
24
+     */
25
+    public static final String SECRET = "64a1f32d53784ce2a34bd81822db1b91";
26
+
27
+
28
+    /**
29
+     * http请求地址
30
+     * <p>openapi的地址,默认情况下openapi的IP端口与基础应用的IP端口是一致的</p>
31
+     * <p>请将地址配置正确.</p>
32
+     * <p>默认情况下是127.0.0.1:80 ,如果地址不通请根据实际情况修改IP端口</p>
33
+     */
34
+//    public static final String OPENAPI_IP_PORT_HTTP = "http://192.168.0.122";
35
+    // public static final String OPENAPI_IP_PORT_HTTP = "http://192.168.0.122";
36
+    public static final String OPENAPI_IP_PORT_HTTP = "http://6wnrrtr3.wkdl.ltd";
37
+
38
+    /**
39
+     * <p>操作用户UUID,即用户UUID,首次使用操作用户UUID可以通过接口 [获取默认用户UUID]来获取</p>
40
+     * <p>也可以通过接口[分页获取用户]来获取</p>
41
+     */
42
+
43
+    /**
44
+     * 获取默认用户UUID的接口地址,此地址可以从《海康威视iVMS-8700平台SDKV2.*.* HTTP-OpenAPI使用说明书.chm》中具体的接口说明上获取
45
+     */
46
+    public static final String ITF_ADDRESS_GET_DEFAULT_USER_UUID = "/openapi/service/base/user/getDefaultUserUuid";
47
+
48
+    /**
49
+     * 分页获取监控点信息的接口地址,此地址可以从《海康威视iVMS-8700平台SDKV2.*.* HTTP-OpenAPI使用说明书.chm》中具体的接口说明上获取
50
+     */
51
+    public static final String ITF_ADDRESS_GET_CAMERAS = "/openapi/service/vss/res/getCameras";
52
+
53
+    /**
54
+     * 查询监控点地址
55
+     */
56
+    public static final String OP_USER_UUID = "5b2eb534696b11e89c2e438f92627767";
57
+
58
+    /**--主要是推送图片到海康
59
+     * 通过此接口将人员名单添加到指定的人员分组当中,此接口适合一次添加一个人员,如果需要批量添加可以使用平台上自带的图片压缩包的方式批量添加。
60
+     */
61
+    public  static  final  String OP_IMG="/openapi/service/fas/personInfo/addPersonInfoIntoGroup";
62
+
63
+    public static final String ITF_MONITORY_POINT = "/openapi/service/vss/res/getCamerasEx";
64
+    
65
+    /**
66
+     * 根据区域UUID集获取门禁点
67
+     */
68
+    public static final String DOORS_BY_REGION_UUIDS = "/openapi/service/acs/res/getDoorsByRegionUuids";
69
+    
70
+    /**
71
+     * 根据人员ID集添加权限
72
+     */
73
+    public static final String ADD_AUTHORITIES_BY_PERSONIDS = "/openapi/service/acs/auth/addAuthoritiesByPersonIds";
74
+    
75
+    /**
76
+     * 根据设备UUID集异动下载门禁权限
77
+     */
78
+    public static final String DOWNLOAD_AUTHORITY_BY_DEVICEUUIDS = "/openapi/service/acs/auth/downloadAuthorityByDeviceUuids";
79
+    
80
+    /**
81
+     * 指定人员人脸/指纹权限下载
82
+     */
83
+    public static final String DOWNLOAD_FACE_AND_FINGERINFOS = "/openapi/service/acs/auth/downloadFaceAndFingerInfos";
84
+
85
+    /**--推送图片时需要获取人员分组下的,人员分组ID
86
+     * --personGroupId--
87
+     */
88
+    public static final  String OP_PERSON_ID="/openapi/service/fas/personGroup/getPersonGroup";
89
+
90
+    /**
91
+     * 分页获取部门
92
+     */
93
+    public static final String ITF_DEPT= "/openapi/service/base/dept/getDeptInfos";
94
+
95
+    /**
96
+     * 根据部门名称分页获取部门
97
+     */
98
+    public static final String ITF_LIKE_DEPT_NAME = "/openapi/service/base/dept/getDeptInfosByName";
99
+
100
+    /**
101
+     * 添加 人员
102
+     */
103
+    public static final String ITF_ADD_USER = "/openapi/service/base/person/addPersonInfo";
104
+
105
+
106
+    /**
107
+     * 修改人员
108
+     */
109
+    public static final String ITF_UPDATE_USER ="/openapi/service/base/person/modifyPersonInfo";
110
+
111
+
112
+    /**
113
+     * 批量开卡
114
+     */
115
+    public static final String ITF_OPEN_CARD = "/openapi/service/base/person/batchOpenCards";
116
+
117
+    /**
118
+     * 根据人员ID集获取人员
119
+     */
120
+    public static final String ITF_GET_USER_ID = "/openapi/service/base/person/getPersonInfosByIds";
121
+
122
+
123
+}

+ 452
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/HKOpenApi.java View File

@@ -0,0 +1,452 @@
1
+package com.community.huiju.common.hk;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.alibaba.fastjson.JSONObject;
5
+import com.community.commom.hk.Digests;
6
+import com.community.commom.hk.HttpClientSSLUtils;
7
+import com.community.huiju.common.PicUtils;
8
+import com.google.common.collect.Maps;
9
+import lombok.extern.slf4j.Slf4j;
10
+import org.springframework.web.multipart.MultipartFile;
11
+import java.util.HashMap;
12
+import java.util.Map;
13
+
14
+/**
15
+ * 海康 API
16
+ * @author weiximei
17
+ */
18
+@Slf4j
19
+public class HKOpenApi {
20
+
21
+    /**
22
+     * 根据
23
+     * 组织中心UUID集 ,第几页, 一页多少行
24
+     *
25
+     * 获取  监控点 数据列表
26
+     * @return
27
+     */
28
+    public static String getMonitoryPoint(Map<String,Object> map){
29
+        Map<String,Object> parMap = Maps.newHashMap();
30
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_MONITORY_POINT;
31
+        //设置APPKEY
32
+        parMap.put("appkey", HKConstant.APPKEY);
33
+        //设置时间参数
34
+        parMap.put("time", System.currentTimeMillis());
35
+        parMap.put("pageNo",map.get("pageNo"));
36
+        parMap.put("pageSize",map.get("pageSize"));
37
+        parMap.put("opUserUuid",map.get("opUserUuid") == null?HKConstant.OP_USER_UUID:map.get("opUserUuid"));
38
+        parMap.put("unitUuids",map.get("unitUuids"));
39
+        String params =  JSON.toJSONString(parMap);
40
+        log.info("获取 监控列表 请求参数:{}", params);
41
+        String data = null;
42
+        try {
43
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
44
+            log.info("获取 监控列表 请求返回结果:{}",data);
45
+        } catch (Exception e) {
46
+            e.printStackTrace();
47
+            log.error("获取监控列表失败!",e);
48
+        }
49
+
50
+        return data;
51
+    }
52
+
53
+    /**
54
+     * 根据部门名称分页获取部门
55
+     *      第几页, 一页多少行, 操作用户uuid
56
+     * @param map
57
+     * @return
58
+     */
59
+    public static String getDeptName(Map<String,Object> map){
60
+        Map<String,Object> parMap = Maps.newHashMap();
61
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_LIKE_DEPT_NAME;
62
+        //设置APPKEY
63
+        parMap.put("appkey", HKConstant.APPKEY);
64
+        //设置时间参数
65
+        parMap.put("time", System.currentTimeMillis());
66
+        parMap.put("pageNo",map.get("pageNo"));
67
+        parMap.put("pageSize",map.get("pageSize"));
68
+        parMap.put("opUserUuid",map.get("opUserUuid") == null?HKConstant.OP_USER_UUID:map.get("opUserUuid"));
69
+        parMap.put("deptName",map.get("deptName"));
70
+        String params =  JSON.toJSONString(parMap);
71
+        log.info("根据部门名称分页获取部门 请求参数:{}", params);
72
+        String data = null;
73
+        try {
74
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
75
+            log.info("根据部门名称分页获取部门 请求返回结果:{}",data);
76
+        } catch (Exception e) {
77
+            e.printStackTrace();
78
+            log.error("根据部门名称分页获取部门失败!",e);
79
+        }
80
+
81
+        return data;
82
+    }
83
+
84
+
85
+    /**
86
+     * 添加人员
87
+     *
88
+     *      比如 住户
89
+     * @return
90
+     */
91
+    public static String addUser(Map<String,Object> map){
92
+        Map<String,Object> parMap = Maps.newHashMap();
93
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_ADD_USER;
94
+        //设置APPKEY
95
+        parMap.put("appkey", HKConstant.APPKEY);
96
+        //设置时间参数
97
+        parMap.put("time", System.currentTimeMillis());
98
+        parMap.put("opUserUuid",map.get("opUserUuid") == null?HKConstant.OP_USER_UUID:map.get("opUserUuid"));
99
+        parMap.put("personNo",map.get("personNo"));
100
+        parMap.put("personName",map.get("personName"));
101
+        parMap.put("phoneNo",map.get("phoneNo"));
102
+        parMap.put("deptUuid",map.get("deptUuid"));
103
+        // parMap.put("cardNo",map.get("cardNo"));
104
+        String params =  JSON.toJSONString(parMap);
105
+        log.info("添加人员 请求参数:{}", params);
106
+        String data = null;
107
+        try {
108
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
109
+            log.info("添加人员 请求返回结果:{}",data);
110
+        } catch (Exception e) {
111
+            e.printStackTrace();
112
+            log.error("添加人员失败!",e);
113
+        }
114
+
115
+        return data;
116
+    }
117
+
118
+    /**
119
+     * 批量开卡
120
+     *
121
+     * 其中参数 cardAndPerson 形式为“卡号,人员ID”,开卡数量不得超过50个,若没有该卡号,则添加一张新卡进行绑定 List<String>
122
+     * @return
123
+     */
124
+    public static String openCard(Map<String,Object> map){
125
+        Map<String,Object> parMap = Maps.newHashMap();
126
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_OPEN_CARD;
127
+        //设置APPKEY
128
+        parMap.put("appkey", HKConstant.APPKEY);
129
+        //设置时间参数
130
+        parMap.put("time", System.currentTimeMillis());
131
+        parMap.put("opUserUuid",map.get("opUserUuid") == null?HKConstant.OP_USER_UUID:map.get("opUserUuid"));
132
+        parMap.put("cardAndPerson",map.get("cardAndPerson"));
133
+        parMap.put("startTime",map.get("startTime"));
134
+        parMap.put("endTime",map.get("endTime"));
135
+        parMap.put("subSystems","1048576,3145728,2097152,9437184,25165824,10485760");
136
+        String params =  JSON.toJSONString(parMap);
137
+        log.info("批量开卡 请求参数:{}", params);
138
+        String data = null;
139
+        try {
140
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
141
+            log.info("批量开卡 请求返回结果:{}",data);
142
+        } catch (Exception e) {
143
+            e.printStackTrace();
144
+            log.error("批量开卡失败!",e);
145
+        }
146
+
147
+        return data;
148
+    }
149
+
150
+    /**
151
+     * 根据中心UUID集获取中心下的门禁设备信息
152
+     *
153
+     * @return
154
+     */
155
+    public static String getACDevicesByUnitUuids(){
156
+        Map<String,Object> parMap = Maps.newHashMap();
157
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_MONITORY_POINT;
158
+        //设置APPKEY
159
+        parMap.put("appkey", HKConstant.APPKEY);
160
+        //设置时间参数
161
+        parMap.put("time", System.currentTimeMillis());
162
+        parMap.put("pageNo",1);
163
+        parMap.put("pageSize",10);
164
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
165
+        parMap.put("unitUuids","1048576");
166
+        String params =  JSON.toJSONString(parMap);
167
+        log.info("获取中心UUID集获取中心下的门禁设备请求参数:{}", params);
168
+        String data = null;
169
+        try {
170
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
171
+            log.info("获取 中心UUID集获取中心下的门禁设备 请求返回结果:{}",data);
172
+        } catch (Exception e) {
173
+            e.printStackTrace();
174
+            log.error("获取失败!",e);
175
+        }
176
+
177
+        return data;
178
+    }
179
+
180
+    /**
181
+     * 分页获取门禁点信息。
182
+     *
183
+     * @return
184
+     */
185
+    public static String getDoors(){
186
+        Map<String,Object> parMap = Maps.newHashMap();
187
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_MONITORY_POINT;
188
+        //设置APPKEY
189
+        parMap.put("appkey", HKConstant.APPKEY);
190
+        //设置时间参数
191
+        parMap.put("time", System.currentTimeMillis());
192
+        parMap.put("pageNo",1);
193
+        parMap.put("pageSize",10);
194
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
195
+        String params =  JSON.toJSONString(parMap);
196
+        log.info("分页获取门禁点信息请求参数:{}", params);
197
+        String data = null;
198
+        try {
199
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
200
+            log.info("分页获取门禁点信息 请求返回结果:{}",data);
201
+        } catch (Exception e) {
202
+            e.printStackTrace();
203
+            log.error("获取失败!",e);
204
+        }
205
+
206
+        return data;
207
+    }
208
+
209
+    /**
210
+     * 批量获取控制中心信息,多个中心的UUID用“,”分割组成的字符串。
211
+     *
212
+     * @return
213
+     */
214
+    public static String getUnitsByUuids(){
215
+        Map<String,Object> parMap = Maps.newHashMap();
216
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_MONITORY_POINT;
217
+        //设置APPKEY
218
+        parMap.put("appkey", HKConstant.APPKEY);
219
+        //设置时间参数
220
+        parMap.put("time", System.currentTimeMillis());
221
+        parMap.put("pageNo",1);
222
+        parMap.put("pageSize",10);
223
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
224
+        parMap.put("unitUuids","1048576");
225
+        String params =  JSON.toJSONString(parMap);
226
+        log.info("获取控制中心信息请求参数:{}", params);
227
+        String data = null;
228
+        try {
229
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
230
+            log.info("获取控制中心信息 请求返回结果:{}",data);
231
+        } catch (Exception e) {
232
+            e.printStackTrace();
233
+            log.error("获取失败!",e);
234
+        }
235
+
236
+        return data;
237
+    }
238
+
239
+    /**
240
+     *  根据中心UUID分页获取下级区域
241
+     * @return
242
+     */
243
+    public static String getRegionsByUnitUuid(){
244
+        Map<String,Object> parMap = Maps.newHashMap();
245
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_MONITORY_POINT;
246
+        //设置APPKEY
247
+        parMap.put("appkey", HKConstant.APPKEY);
248
+        //设置时间参数
249
+        parMap.put("time", System.currentTimeMillis());
250
+        parMap.put("pageNo",1);
251
+        parMap.put("pageSize",10);
252
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
253
+        parMap.put("parentUuid","1048576");
254
+        parMap.put("allChildren",1);
255
+        String params =  JSON.toJSONString(parMap);
256
+        log.info("根据中心UUID分页获取下级区域请求参数:{}", params);
257
+        String data = null;
258
+        try {
259
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
260
+            log.info("根据中心UUID分页获取下级区域 请求返回结果:{}",data);
261
+        } catch (Exception e) {
262
+            e.printStackTrace();
263
+            log.error("获取失败!",e);
264
+        }
265
+
266
+        return data;
267
+    }
268
+
269
+    /**
270
+     * 根据区域UUID集获取门禁点
271
+     * @return
272
+     */
273
+    public static String getDoorsByRegionUuids(){
274
+        Map<String,Object> parMap = Maps.newHashMap();
275
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.DOORS_BY_REGION_UUIDS;
276
+        //设置APPKEY
277
+        parMap.put("appkey", HKConstant.APPKEY);
278
+        //设置时间参数
279
+        parMap.put("time", System.currentTimeMillis());
280
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
281
+        parMap.put("regionUuids","2a36878c9a4a49d290d253ac1b4746dc");
282
+        String params =  JSON.toJSONString(parMap);
283
+        log.info("根据区域UUID集获取门禁点请求参数:{}", params);
284
+        String data = null;
285
+        try {
286
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
287
+            log.info("根据区域UUID集获取门禁点 请求返回结果:{}",data);
288
+        } catch (Exception e) {
289
+            e.printStackTrace();
290
+            log.error("获取失败!",e);
291
+        }
292
+
293
+        return data;
294
+    }
295
+
296
+    /**
297
+     * 根据人员ID集添加权限
298
+     * @return
299
+     */
300
+    public static String addAuthoritiesByPersonIds(String personIds){
301
+        Map<String,Object> parMap = Maps.newHashMap();
302
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ADD_AUTHORITIES_BY_PERSONIDS;
303
+        //设置APPKEY
304
+        parMap.put("appkey", HKConstant.APPKEY);
305
+        //设置时间参数
306
+        parMap.put("time", System.currentTimeMillis());
307
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
308
+        parMap.put("personIds",personIds);
309
+        parMap.put("doorGroupUuids","");
310
+        parMap.put("doorUuids","57231a05fd3b45f7a2570a28a85821c4,efcb9a3fe4e64e2f9c0f546c54465524,9da7c0073138453fa7782b629743cff7,85c22fde220d4b35ac13f805f05fd04c");
311
+        String params =  JSON.toJSONString(parMap);
312
+        log.info("根据人员ID集添加权限请求参数:{}", params);
313
+        String data = null;
314
+        try {
315
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
316
+            log.info("根据人员ID集添加权限 请求返回结果:{}",data);
317
+        } catch (Exception e) {
318
+            e.printStackTrace();
319
+            log.error("获取失败!",e);
320
+        }
321
+
322
+        return data;
323
+    }
324
+
325
+    /**
326
+     * 根据设备UUID集异动下载门禁权限
327
+     * @return
328
+     */
329
+    public static String downloadAuthorityByDeviceUuids(){
330
+        Map<String,Object> parMap = Maps.newHashMap();
331
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.DOWNLOAD_AUTHORITY_BY_DEVICEUUIDS;
332
+        //设置APPKEY
333
+        parMap.put("appkey", HKConstant.APPKEY);
334
+        //设置时间参数
335
+        parMap.put("time", System.currentTimeMillis());
336
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
337
+        parMap.put("deviceUuids","57231a05fd3b45f7a2570a28a85821c4,efcb9a3fe4e64e2f9c0f546c54465524,9da7c0073138453fa7782b629743cff7,85c22fde220d4b35ac13f805f05fd04c");
338
+        String params =  JSON.toJSONString(parMap);
339
+        log.info("根据设备UUID集异动下载门禁权限请求参数:{}", params);
340
+        String data = null;
341
+        try {
342
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
343
+            log.info("根据设备UUID集异动下载门禁权限 请求返回结果:{}",data);
344
+        } catch (Exception e) {
345
+            e.printStackTrace();
346
+            log.error("获取失败!",e);
347
+        }
348
+
349
+        return data;
350
+    }
351
+
352
+    /**
353
+     * 指定人员人脸/指纹权限下载
354
+     * @return
355
+     */
356
+    public static String downloadFaceAndFingerInfos(String personIds){
357
+        Map<String,Object> parMap = Maps.newHashMap();
358
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.DOWNLOAD_FACE_AND_FINGERINFOS;
359
+        //设置APPKEY
360
+        parMap.put("appkey", HKConstant.APPKEY);
361
+        //设置时间参数
362
+        parMap.put("time", System.currentTimeMillis());
363
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
364
+        parMap.put("deviceUuids","83dfab0eef52411d991d6e621296b60a,dfd80b22f00545b8b36fa981019df83c");
365
+        parMap.put("personIds",personIds);
366
+        parMap.put("type",1);
367
+        String params =  JSON.toJSONString(parMap);
368
+        log.info("指定人员人脸/指纹权限下载 请求参数:{}", params);
369
+        String data = null;
370
+        try {
371
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
372
+            log.info("指定人员人脸/指纹权限下载 请求返回结果:{}",data);
373
+        } catch (Exception e) {
374
+            e.printStackTrace();
375
+            log.error("获取失败!",e);
376
+        }
377
+
378
+        return data;
379
+    }
380
+    /**
381
+     * 添加人脸
382
+     * faceImg 图片
383
+     * personNo 人员编号
384
+     * personName 名称
385
+     * @return
386
+     */
387
+    public static String HKpersonGroupId(MultipartFile faceImg,Integer personNo,String personName){
388
+        String  img= PicUtils.getImgStr(faceImg);
389
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_ADD_USER;
390
+        Map<String, Object> map = new HashMap<String, Object>();
391
+        map.put("appkey", HKConstant.APPKEY);
392
+        map.put("time", System.currentTimeMillis());
393
+        map.put("token", HKConstant.SECRET);
394
+        map.put("opUserUuid",HKConstant.OP_USER_UUID);
395
+        map.put("personNo",personNo);
396
+        map.put("personName",personName);
397
+        map.put("facePhoto",img);
398
+        String params =  JSON.toJSONString(map);
399
+        String data = null;
400
+        try {
401
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
402
+        } catch (Exception e) {
403
+            e.printStackTrace();
404
+        }
405
+        return data;
406
+    }
407
+
408
+
409
+    /**
410
+     * 修改人脸
411
+     * faceImg 图片
412
+     * personId人员ID
413
+     * personNo 人员编号
414
+     * personName 名称
415
+     *  * personName 卡号
416
+     * @return
417
+     */
418
+    public static String HKpersonGroupId(MultipartFile faceImg,Integer personId,Integer personNo,String personName,String cardNo) {
419
+        String img = PicUtils.getImgStr(faceImg);
420
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_UPDATE_USER;
421
+        Map<String, Object> map = new HashMap<String, Object>();
422
+        map.put("appkey", HKConstant.APPKEY);
423
+        map.put("time", System.currentTimeMillis());
424
+        map.put("token", HKConstant.SECRET);
425
+        map.put("opUserUuid", HKConstant.OP_USER_UUID);
426
+        map.put("personId", personId);
427
+        map.put("personNo", personNo);
428
+        map.put("personName", personName);
429
+        map.put("facePhoto", img);
430
+        map.put("cardNo", cardNo);
431
+        String params = JSON.toJSONString(map);
432
+        String data = null;
433
+        try {
434
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
435
+        } catch (Exception e) {
436
+            e.printStackTrace();
437
+        }
438
+        return data;
439
+    }
440
+    public static void main(String[] args) {
441
+        Map<String,Object> parMap = Maps.newHashMap();
442
+        parMap.put("pageNo",1);
443
+        parMap.put("pageSize",100);
444
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
445
+        parMap.put("deptName","住户");
446
+        String result = HKOpenApi.getDeptName(parMap);
447
+        Map<String,Object> deptMap = JSONObject.parseObject(result, HashMap.class);
448
+        System.out.println(result);
449
+
450
+    }
451
+
452
+}

+ 40
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/entity/MonitoryPoint.java View File

@@ -0,0 +1,40 @@
1
+package com.community.huiju.common.hk.entity;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Data;
5
+import lombok.NoArgsConstructor;
6
+
7
+/**
8
+ * 响应 监控中心 实体类
9
+ * @author weiximei
10
+ */
11
+@AllArgsConstructor
12
+@NoArgsConstructor
13
+@Data
14
+public class MonitoryPoint {
15
+
16
+    private Integer errorCode;
17
+
18
+    private String errorMessage;
19
+
20
+    private String data;
21
+
22
+
23
+    private class MonitoryPointData {
24
+        Integer total;
25
+        Integer pageNo;
26
+        Integer pageSize;
27
+        String list;
28
+
29
+
30
+    }
31
+
32
+    private class MonitoryPointList {
33
+
34
+        String cameraUuid;
35
+        String cameraName;
36
+
37
+    }
38
+
39
+
40
+}

+ 184
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/test/OpenapiTest.java View File

@@ -0,0 +1,184 @@
1
+package com.community.huiju.common.hk.test;
2
+
3
+import java.time.LocalDate;
4
+import java.util.HashMap;
5
+import java.util.Map;
6
+
7
+import com.alibaba.fastjson.JSON;
8
+import com.community.commom.hk.Digests;
9
+import com.community.commom.hk.HttpClientSSLUtils;
10
+
11
+
12
+/**
13
+ * openapi 测试DEMO
14
+ * 客户开发的时候可以参考此代码编写自己的应用
15
+ * 也可以使用demo中的jar包,不过jar包使用务必使用全套,
16
+ * 万不可只取其中一部分,避免依赖破坏
17
+ * @author shengyiling
18
+ *
19
+ */
20
+class OpenapiTest {
21
+	
22
+	/**
23
+	 * APPKEY需要到部署的平台服务器上生成。
24
+	 * <p>
25
+	 * 调用Openpai的操作码,需要去平台上生成,详见《海康威视iVMS-8700平台SDKV2.*.* HTTP-OpenAPI使用说明书.chm》中[获取AppKey和Secret]章节说明
26
+	 * </p>
27
+	 * <p>
28
+	 * 《海康威视iVMS-8700平台SDKV2.*.* HTTP-OpenAPI使用说明书.chm》 该文档请找技术支持或者交付的同事提供
29
+	 * </p>
30
+	 */
31
+	private static final String APPKEY = "b4434b13";
32
+	
33
+	/**
34
+	 * SECRET需要到部署的平台服务器上生成。
35
+	 * <p>
36
+	 * 调用Openpai的操作码,需要去平台上生成,详见《海康威视iVMS-8700平台SDKV2.*.* HTTP-OpenAPI使用说明书.chm》中[获取AppKey和Secret]章节说明
37
+	 * </p>
38
+	 * <p>
39
+	 * 《海康威视iVMS-8700平台SDKV2.*.* HTTP-OpenAPI使用说明书.chm》 该文档请找技术支持或者交付的同事提供
40
+	 * </p>
41
+	 */
42
+	private static final String SECRET = "64a1f32d53784ce2a34bd81822db1b91";
43
+	
44
+	
45
+	/**
46
+	 * http请求地址
47
+	 * <p>openapi的地址,默认情况下openapi的IP端口与基础应用的IP端口是一致的</p>
48
+	 * <p>请将地址配置正确.</p>
49
+	 * <p>默认情况下是127.0.0.1:80 ,如果地址不通请根据实际情况修改IP端口</p>
50
+ 	 */
51
+	private static final String OPENAPI_IP_PORT_HTTP = "http://192.168.0.122";
52
+	
53
+	/**
54
+	 * https请求地址
55
+	 * <p>openapi的地址,默认情况下openapi的IP端口与基础应用的IP端口是一致的</p>
56
+	 * <p>请将地址配置正确.</p>
57
+	 * <p>默认情况下是127.0.0.1:443 ,如果地址不通请根据实际情况修改IP端口</p>
58
+ 	 */
59
+	private static final String OPENAPI_IP_PORT_HTTPS = "https://127.0.0.1:443";
60
+	
61
+	/**
62
+	 * 获取默认用户UUID的接口地址,此地址可以从《海康威视iVMS-8700平台SDKV2.*.* HTTP-OpenAPI使用说明书.chm》中具体的接口说明上获取
63
+	 */
64
+	private static final String ITF_ADDRESS_GET_DEFAULT_USER_UUID = "/openapi/service/base/user/getDefaultUserUuid";
65
+	
66
+	/**
67
+	 * 分页获取监控点信息的接口地址,此地址可以从《海康威视iVMS-8700平台SDKV2.*.* HTTP-OpenAPI使用说明书.chm》中具体的接口说明上获取
68
+	 */
69
+	private static final String ITF_ADDRESS_GET_CAMERAS = "/openapi/service/vss/res/getCameras";
70
+	
71
+	/**
72
+	 * <p>操作用户UUID,即用户UUID,首次使用操作用户UUID可以通过接口 [获取默认用户UUID]来获取</p>
73
+	 * <p>也可以通过接口[分页获取用户]来获取</p>
74
+	 */
75
+//	private static final String OP_USER_UUID = "0be83d40695011e7981e0f190ed6d2e7";
76
+	private static final String OP_USER_UUID = "5b2eb534696b11e89c2e438f92627767";
77
+	
78
+	/**
79
+	 * 测试方法
80
+	 * @param args
81
+	 * @throws Exception
82
+	 */
83
+	public static void main(String[] args) throws Exception {
84
+
85
+		/***http方式调用***/
86
+		//System.out.println(testGetDefaultUserUUID());
87
+		//System.out.println(testGetCameras());
88
+//		
89
+//		/***https方式调用***/
90
+//		System.out.println(testGetDefaultUserUUID_Https());
91
+//		System.out.println(testGetCameras_Https());
92
+
93
+		LocalDate today = LocalDate.now();
94
+		int year = today.getYear();
95
+		// 加上20, 表示加上20年,默认
96
+
97
+		int month = today.getMonthValue();
98
+		int day = today.getDayOfMonth();
99
+
100
+	}
101
+	
102
+	/**
103
+	 * HTTP方式
104
+	 * 获取默认用户UUID 测试
105
+	 * @return
106
+	 * @throws Exception
107
+	 */
108
+	private static String testGetDefaultUserUUID() throws Exception{
109
+		String url = OPENAPI_IP_PORT_HTTP + ITF_ADDRESS_GET_DEFAULT_USER_UUID;
110
+		Map<String, Object> map = new HashMap<String, Object>();
111
+		map.put("appkey", APPKEY);//设置APPKEY
112
+		map.put("time", System.currentTimeMillis());//设置时间参数
113
+		String params =  JSON.toJSONString(map);
114
+		System.out.println(" ====== testGetDefaultUserUUID 请求参数:【" + params + "】");
115
+		String data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, SECRET), params);
116
+		System.out.println(" ====== testGetDefaultUserUUID 请求返回结果:【{" + data + "}】");
117
+		
118
+		return data;
119
+	}
120
+	
121
+	/** 
122
+	 * HTTP方式
123
+	 * 分页获取监控点信息 测试
124
+	 * @return
125
+	 * @throws Exception
126
+	 */
127
+	private static String testGetCameras() throws Exception{
128
+		 String url = OPENAPI_IP_PORT_HTTP + ITF_ADDRESS_GET_CAMERAS;
129
+        Map<String, Object> map = new HashMap<String, Object>();
130
+        map.put("appkey", APPKEY);//设置APPKEY
131
+        map.put("time", System.currentTimeMillis());//设置时间参数
132
+        map.put("pageNo", 1);//设置分页参数
133
+        map.put("pageSize", 5);//设置分页参数
134
+        map.put("opUserUuid", OP_USER_UUID);//设置操作用户UUID
135
+        String params = JSON.toJSONString(map);
136
+        System.out.println(" ====== getCameras请求参数:【" + params + "】");
137
+        String data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, null, SECRET), params);
138
+        System.out.println(" ====== getCameras请求返回结果:【{" + data + "}】");
139
+        
140
+        return data;
141
+	}
142
+	
143
+	/**
144
+	 * HTTPS方式
145
+	 * 获取默认用户UUID 测试
146
+	 * @return
147
+	 * @throws Exception
148
+	 */
149
+	private static String testGetDefaultUserUUID_Https() throws Exception{
150
+		String url = OPENAPI_IP_PORT_HTTPS + ITF_ADDRESS_GET_DEFAULT_USER_UUID;
151
+		Map<String, Object> map = new HashMap<String, Object>();
152
+		map.put("appkey", APPKEY);//设置APPKEY
153
+		map.put("time", System.currentTimeMillis());//设置时间参数
154
+		String params =  JSON.toJSONString(map);
155
+		System.out.println("============" + params + "============");
156
+		String data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, null, SECRET), params);
157
+		System.out.println("============" + data + "============");
158
+		
159
+		return data;
160
+	}
161
+	
162
+	/**
163
+	 * HTTPS方式
164
+	 * 分页获取监控点信息 测试
165
+	 * @return
166
+	 * @throws Exception
167
+	 */
168
+	private static String testGetCameras_Https() throws Exception{
169
+		 String url = OPENAPI_IP_PORT_HTTPS + ITF_ADDRESS_GET_CAMERAS;
170
+        Map<String, Object> map = new HashMap<String, Object>();
171
+        map.put("appkey", APPKEY);//设置APPKEY
172
+        map.put("time", System.currentTimeMillis());//设置时间参数
173
+        map.put("pageNo", 1);//设置分页参数
174
+        map.put("pageSize", 5);//设置分页参数
175
+        map.put("opUserUuid", OP_USER_UUID);//设置操作用户UUID
176
+        String params = JSON.toJSONString(map);
177
+        System.out.println(" ====== getCameras请求参数:【" + params + "】");
178
+        String data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, null, SECRET), params);
179
+        System.out.println(" ====== getCameras请求返回结果:【{" + data + "}】");
180
+        
181
+        return data;
182
+	}
183
+	
184
+}

+ 76
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/AssembleController.java View File

@@ -0,0 +1,76 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
6
+import com.community.huiju.model.TaSysMenu;
7
+import com.community.huiju.model.ToBanner;
8
+import com.community.huiju.service.BannerServiceI;
9
+import com.community.huiju.service.MenuServiceI;
10
+import com.community.huiju.service.MessageServiceI;
11
+import io.swagger.annotations.Api;
12
+import io.swagger.annotations.ApiImplicitParam;
13
+import io.swagger.annotations.ApiImplicitParams;
14
+import io.swagger.annotations.ApiOperation;
15
+import org.springframework.beans.factory.annotation.Autowired;
16
+import org.springframework.cloud.context.config.annotation.RefreshScope;
17
+import org.springframework.web.bind.annotation.PathVariable;
18
+import org.springframework.web.bind.annotation.RequestMapping;
19
+import org.springframework.web.bind.annotation.RequestMethod;
20
+import org.springframework.web.bind.annotation.RestController;
21
+
22
+import javax.servlet.http.HttpSession;
23
+import java.util.HashMap;
24
+import java.util.List;
25
+import java.util.Map;
26
+
27
+/**
28
+ * @author FXF
29
+ * @date 2018-11-05
30
+ */
31
+@RestController
32
+@RefreshScope
33
+@RequestMapping("/")
34
+@Api(value = "首页聚合API", description = "首页聚合API")
35
+public class AssembleController extends BaseController {
36
+	
37
+	@Autowired
38
+	private MenuServiceI menuService;
39
+	
40
+	@Autowired
41
+	private BannerServiceI bannerService;
42
+	
43
+	@Autowired
44
+	private MessageServiceI messageService;
45
+	
46
+	@ApiOperation(value = "首页数据获取接口", notes = "首页数据获取接口")
47
+	@ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id"),
48
+			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token") })
49
+	@RequestMapping(value = "/index/{communityId}",method = RequestMethod.GET)
50
+	public ResponseBean getIndexData(@PathVariable("communityId") Integer communityId, HttpSession session){
51
+		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
52
+		Integer userId = userElement.getId();
53
+		ResponseBean responseBean = new ResponseBean();
54
+
55
+		if (!check(communityId)) {
56
+			responseBean.addError("小区不存在");
57
+			return responseBean;
58
+		}
59
+
60
+		Map<String,Object> indexMap = new HashMap<>();
61
+		//获取菜单数据
62
+		List<TaSysMenu> menuList = menuService.getMenuList(communityId);
63
+		//获取首页banner数据
64
+		List<ToBanner> toBannerList = bannerService.viewAllBannerImg();
65
+		//获取消息总数接口
66
+		Map<String,Object> totalMap = messageService.getMessageTotal(communityId, userId);
67
+		
68
+		//组装数据
69
+		indexMap.put("menuList",menuList);
70
+		indexMap.put("bannerList",toBannerList);
71
+		indexMap.put("messageTotal",totalMap.get("messageTotal"));
72
+		indexMap.put("toDoTotal",totalMap.get("toDoTotal"));
73
+		responseBean.addSuccess(indexMap);
74
+		return responseBean;
75
+	}
76
+}

+ 27
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/BaseController.java View File

@@ -0,0 +1,27 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.huiju.model.ToCommunities;
4
+import com.community.huiju.service.CommunityServiceI;
5
+import org.springframework.beans.factory.annotation.Autowired;
6
+
7
+/**
8
+ * 公共 controller
9
+ */
10
+public class BaseController {
11
+
12
+    @Autowired
13
+    private CommunityServiceI community;
14
+
15
+    /**
16
+     * 校验小区是否存在
17
+     * @return
18
+     */
19
+    protected boolean check(Integer communityId){
20
+        ToCommunities toCommunities = community.getByCommunityId(communityId);
21
+        if (null != toCommunities) {
22
+            return true;
23
+        }
24
+        return false;
25
+    }
26
+
27
+}

+ 15
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/BillController.java View File

@@ -28,7 +28,7 @@ import java.util.Map;
28 28
 @RefreshScope
29 29
 @RequestMapping("/")
30 30
 @Api(value = "缴费相关的API", description = "缴费相关的API")
31
-public class BillController {
31
+public class BillController extends BaseController {
32 32
 	
33 33
 	@Autowired
34 34
 	private BillServiceI billServiceI;
@@ -46,8 +46,14 @@ public class BillController {
46 46
 		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
47 47
 		Integer userId = userElement.getId();
48 48
 		ResponseBean responseBean = new ResponseBean();
49
-		List<Map<String,Object>> billsList = billServiceI.getBillsList(communityId, payType, userId, pageNum, pageSize);
50
-		responseBean.addSuccess(billsList);
49
+
50
+		if (!check(communityId)) {
51
+			responseBean.addError("小区不存在");
52
+			return responseBean;
53
+		}
54
+
55
+		Map<String, Object> map = billServiceI.getBillsList(communityId, payType, userId, pageNum, pageSize);
56
+		responseBean.addSuccess(map);
51 57
 		return responseBean;
52 58
 	}
53 59
 	
@@ -57,6 +63,12 @@ public class BillController {
57 63
 	@RequestMapping(value = "/bill/{communityId}/{billInvoiceId}",method = RequestMethod.GET)
58 64
 	public ResponseBean getBillInvoiceDetail(@PathVariable Integer communityId,@PathVariable Integer billInvoiceId){
59 65
 		ResponseBean responseBean = new ResponseBean();
66
+
67
+		if (!check(communityId)) {
68
+			responseBean.addError("小区不存在");
69
+			return responseBean;
70
+		}
71
+
60 72
 		Map<String,Object> billInvoiceMap = billServiceI.getBillInvoiceDetail(communityId,billInvoiceId);
61 73
 		responseBean.addSuccess(billInvoiceMap);
62 74
 		return responseBean;

+ 67
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/FaceController.java View File

@@ -0,0 +1,67 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
6
+import com.community.huiju.service.FaceServiceI;
7
+import io.swagger.annotations.*;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.cloud.context.config.annotation.RefreshScope;
10
+import org.springframework.web.bind.annotation.RequestMapping;
11
+import org.springframework.web.bind.annotation.RequestMethod;
12
+import org.springframework.web.bind.annotation.RestController;
13
+import org.springframework.web.multipart.MultipartFile;
14
+
15
+import javax.servlet.http.HttpSession;
16
+
17
+@RestController
18
+@RefreshScope
19
+@RequestMapping("/")
20
+@Api(value = "人脸相关API", description = "人脸相关API")
21
+public class FaceController {
22
+    @Autowired
23
+    private FaceServiceI faceServicel;
24
+
25
+    @ApiOperation(value = "添加人脸图片", notes = "添加人脸图片")
26
+    @ApiImplicitParams({
27
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
28
+    })
29
+    
30
+    @RequestMapping(value = "/addFace",method = RequestMethod.POST)
31
+    public Object getTaFace(HttpSession session,
32
+                            @ApiParam(value = "file" ,required = true) MultipartFile uploadFile){
33
+        ResponseBean responseBean = new ResponseBean();
34
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
35
+        Integer userId = userElement.getId();
36
+        responseBean = faceServicel.addFace(userId ,uploadFile);
37
+        return responseBean;
38
+    }
39
+
40
+    @ApiOperation(value = "修改人脸图片", notes = "修改人脸图片")
41
+    @ApiImplicitParams({
42
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
43
+    })
44
+    @RequestMapping(value = "/upDateFace",method = RequestMethod.POST)
45
+    public Object upDateTaFace(HttpSession session,
46
+                               @ApiParam(value = "file" ,required = true) MultipartFile uploadFile
47
+                               ){
48
+        ResponseBean responseBean = new ResponseBean();
49
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
50
+        Integer userId = userElement.getId();
51
+         responseBean = faceServicel.upDateFace(userId,uploadFile);
52
+        return responseBean;
53
+    }
54
+
55
+    @ApiOperation(value = "获取当前已录入人脸信息", notes = "获取当前已录入人脸信息")
56
+    @ApiImplicitParams({
57
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
58
+    })
59
+    @RequestMapping(value = "/getUserIdFace",method = RequestMethod.GET)
60
+    public Object getTaFaceByUserId(HttpSession session){
61
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
62
+        Integer userId = userElement.getId();
63
+        ResponseBean responseBean = faceServicel.getTaFaceByUserId(userId );
64
+        return responseBean;
65
+    }
66
+
67
+}

+ 21
- 25
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/ImageController.java View File

@@ -1,13 +1,19 @@
1 1
 package com.community.huiju.controller;
2 2
 
3
-import com.aliyun.oss.OSSClient;
4
-import io.swagger.annotations.*;
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.service.ImageServiceI;
5
+import com.google.common.collect.Maps;
6
+import io.swagger.annotations.Api;
7
+import io.swagger.annotations.ApiOperation;
8
+import io.swagger.annotations.ApiParam;
9
+import org.springframework.beans.factory.annotation.Autowired;
5 10
 import org.springframework.cloud.context.config.annotation.RefreshScope;
6
-import org.springframework.web.bind.annotation.*;
11
+import org.springframework.web.bind.annotation.PostMapping;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RestController;
7 14
 import org.springframework.web.multipart.MultipartFile;
8 15
 
9
-import java.io.ByteArrayInputStream;
10
-import java.util.Date;
16
+import java.util.Map;
11 17
 
12 18
 /**
13 19
  * @author weichaochao
@@ -21,27 +27,17 @@ import java.util.Date;
21 27
 @Api(value = "图片操作API", description = "图片操作API")
22 28
 public class ImageController {
23 29
 
24
-    private static String endpoint = "http://oss-cn-hangzhou.aliyuncs.com";
25
-    private static String accessKeyId = "LTAIiG6xeHbVzTXC";
26
-    private static String accessKeySecret = "YUci8oBtm5WzobH6SP2eyZUbjCBKBo";
27
-    private static String bucketName = "imgurlspace";
30
+    @Autowired
31
+    private ImageServiceI imageService;
28 32
 
29 33
     @ApiOperation(value = "图片上传以及获取url", notes = "图片上传以及获取url")
30
-    @PostMapping(value = "/getUrl", consumes = "multipart/*", headers = "content-type=multipart/form-data")
31
-    public String uploadImgAndGetUrl(@ApiParam(value = "file" ,required = true) MultipartFile uploadFile) throws Exception {
32
-
33
-        String imgName = System.currentTimeMillis() + ".png";
34
-        // 创建OSSClient实例
35
-        OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
36
-        // 上传
37
-        long time = System.currentTimeMillis();
38
-
39
-        ossClient.putObject(bucketName, imgName, new ByteArrayInputStream(uploadFile.getBytes()));
40
-
41
-        // 关闭client
42
-        ossClient.shutdown();
43
-        Date expiration = new Date(time + 3600 * 1000 * 24 * 365 * 10);
44
-        String url = ossClient.generatePresignedUrl(bucketName, imgName, expiration).toString();
45
-        return url;
34
+    @PostMapping(value = "/uploadimage", consumes = "multipart/*", headers = "content-type=multipart/form-data")
35
+    public ResponseBean uploadImgAndGetUrl(@ApiParam(value = "file" ,required = true) MultipartFile uploadFile) throws Exception {
36
+        ResponseBean responseBean = new ResponseBean();
37
+        Map<String,Object> map = Maps.newHashMap();
38
+        String url = imageService.getImageUrl(uploadFile);
39
+        map.put("url",url);
40
+        responseBean.addSuccess(map);
41
+        return responseBean;
46 42
     }
47 43
 }

+ 51
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/MenuController.java View File

@@ -0,0 +1,51 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.constant.Constant;
4
+import com.community.commom.mode.ResponseBean;
5
+import com.community.commom.session.UserElement;
6
+import com.community.huiju.model.TaSysMenu;
7
+import com.community.huiju.service.MenuServiceI;
8
+import io.swagger.annotations.Api;
9
+import io.swagger.annotations.ApiImplicitParam;
10
+import io.swagger.annotations.ApiImplicitParams;
11
+import io.swagger.annotations.ApiOperation;
12
+import org.springframework.beans.factory.annotation.Autowired;
13
+import org.springframework.cloud.context.config.annotation.RefreshScope;
14
+import org.springframework.web.bind.annotation.PathVariable;
15
+import org.springframework.web.bind.annotation.RequestMapping;
16
+import org.springframework.web.bind.annotation.RequestMethod;
17
+import org.springframework.web.bind.annotation.RestController;
18
+
19
+import javax.servlet.http.HttpSession;
20
+import java.util.List;
21
+import java.util.Map;
22
+
23
+/**
24
+ * @author FXF
25
+ * @date 2018-11-05
26
+ */
27
+@RestController
28
+@RefreshScope
29
+@RequestMapping("/")
30
+@Api(value = "菜单API", description = "菜单API")
31
+public class MenuController extends BaseController {
32
+	
33
+	@Autowired
34
+	private MenuServiceI menuService;
35
+	
36
+	@ApiOperation(value = "按小区获取菜单列表", notes = "按小区获取菜单列表")
37
+	@ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id")})
38
+	@RequestMapping(value = "/menus/{communityId}",method = RequestMethod.GET)
39
+	public ResponseBean getMenuList(@PathVariable Integer communityId, HttpSession session){
40
+		ResponseBean responseBean = new ResponseBean();
41
+
42
+		if (!check(communityId)) {
43
+			responseBean.addError("小区不存在");
44
+			return responseBean;
45
+		}
46
+
47
+		List<TaSysMenu> list = menuService.getMenuList(communityId);
48
+		responseBean.addSuccess(list);
49
+		return responseBean;
50
+	}
51
+}

+ 26
- 8
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/MessageController.java View File

@@ -3,8 +3,6 @@ package com.community.huiju.controller;
3 3
 import com.community.commom.constant.Constant;
4 4
 import com.community.commom.mode.ResponseBean;
5 5
 import com.community.commom.session.UserElement;
6
-import com.community.huiju.model.ToCommunities;
7
-import com.community.huiju.model.TpMessage;
8 6
 import com.community.huiju.service.MessageServiceI;
9 7
 import io.swagger.annotations.Api;
10 8
 import io.swagger.annotations.ApiImplicitParam;
@@ -19,7 +17,6 @@ import org.springframework.web.bind.annotation.RequestParam;
19 17
 import org.springframework.web.bind.annotation.RestController;
20 18
 
21 19
 import javax.servlet.http.HttpSession;
22
-import java.util.List;
23 20
 import java.util.Map;
24 21
 
25 22
 /**
@@ -30,7 +27,7 @@ import java.util.Map;
30 27
 @RefreshScope
31 28
 @RequestMapping("/")
32 29
 @Api(value = "消息相关的API",description = "消息相关的API")
33
-public class MessageController {
30
+public class MessageController extends BaseController {
34 31
 	
35 32
 	@Autowired
36 33
 	private MessageServiceI messageService;
@@ -43,6 +40,12 @@ public class MessageController {
43 40
 		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
44 41
 		Integer userId = userElement.getId();
45 42
 		ResponseBean responseBean = new ResponseBean();
43
+
44
+		if (!check(communityId)) {
45
+			responseBean.addError("小区不存在");
46
+			return responseBean;
47
+		}
48
+
46 49
 		Map<String,Object> totalMap = messageService.getMessageTotal(communityId, userId);
47 50
 		responseBean.addSuccess(totalMap);
48 51
 		return responseBean;
@@ -60,8 +63,12 @@ public class MessageController {
60 63
 		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
61 64
 		Integer userId = userElement.getId();
62 65
 		ResponseBean responseBean = new ResponseBean();
63
-		List<TpMessage> newsList = messageService.getMessages(communityId,pageNum,pageSize, Constant.MODEL_TYPE_NEWS, userId);
64
-		responseBean.addSuccess(newsList);
66
+		if (!check(communityId)) {
67
+			responseBean.addError("小区不存在");
68
+			return responseBean;
69
+		}
70
+		Map<String,Object> map = messageService.getMessages(communityId,pageNum,pageSize, Constant.MODEL_TYPE_NEWS, userId);
71
+		responseBean.addSuccess(map);
65 72
 		return responseBean;
66 73
 	}
67 74
 	
@@ -77,8 +84,13 @@ public class MessageController {
77 84
 		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
78 85
 		Integer userId = userElement.getId();
79 86
 		ResponseBean responseBean = new ResponseBean();
80
-		List<TpMessage> upcomingList = messageService.getMessages(communityId,pageNum,pageSize,Constant.MODEL_TYPE_UPCOMING, userId);
81
-		responseBean.addSuccess(upcomingList);
87
+		
88
+		if (!check(communityId)) {
89
+			responseBean.addError("小区不存在");
90
+			return responseBean;
91
+		}
92
+		Map<String,Object> map = messageService.getMessages(communityId,pageNum,pageSize,Constant.MODEL_TYPE_UPCOMING, userId);
93
+		responseBean.addSuccess(map);
82 94
 		return responseBean;
83 95
 	}
84 96
 
@@ -90,6 +102,12 @@ public class MessageController {
90 102
 		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
91 103
 		Integer userId = userElement.getId();
92 104
 		ResponseBean responseBean = new ResponseBean();
105
+
106
+		if (!check(communityId)) {
107
+			responseBean.addError("小区不存在");
108
+			return responseBean;
109
+		}
110
+
93 111
 		messageService.updateMessageReadStatus(communityId, userId);
94 112
 		return responseBean;
95 113
 	}

+ 69
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/MonitoringController.java View File

@@ -0,0 +1,69 @@
1
+package com.community.huiju.controller;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+import com.community.huiju.service.IMonitoringService;
5
+import io.swagger.annotations.Api;
6
+import io.swagger.annotations.ApiImplicitParam;
7
+import io.swagger.annotations.ApiImplicitParams;
8
+import io.swagger.annotations.ApiOperation;
9
+import org.springframework.beans.factory.annotation.Autowired;
10
+import org.springframework.cloud.context.config.annotation.RefreshScope;
11
+import org.springframework.web.bind.annotation.*;
12
+
13
+import javax.servlet.http.HttpSession;
14
+
15
+/**
16
+ * 监控 控制器
17
+ * @author weiximei
18
+ */
19
+@RestController
20
+@RefreshScope
21
+@RequestMapping("/")
22
+@Api(value = "监控 控制器", description = "监控相关的数据")
23
+public class MonitoringController extends BaseController {
24
+
25
+    @Autowired
26
+    private IMonitoringService iMonitoringService;
27
+
28
+    @ApiOperation(value = "获取监控列表数据",notes = "根据小区ID获取")
29
+    @ApiImplicitParams({
30
+            @ApiImplicitParam(paramType = "path",dataType = "Integer",name = "communityId",value = "小区ID"),
31
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageNo",value = "第几页"),
32
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageSize",value = "一页多少行")
33
+    })
34
+    @RequestMapping(value = "/monitoring/{communityId}",method = RequestMethod.GET)
35
+    public ResponseBean getList(@PathVariable("communityId") Integer communityId,
36
+                                @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
37
+                                @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
38
+        ResponseBean response = new ResponseBean();
39
+        if (!check(communityId)) {
40
+            response.addError("小区不存在");
41
+            return response;
42
+        }
43
+
44
+        response = iMonitoringService.getByCommunityId(communityId,pageNo,pageSize);
45
+        return response;
46
+    }
47
+
48
+
49
+    @ApiOperation(value = "获取监控列表token",notes = "根据小区ID获取")
50
+    @ApiImplicitParams({
51
+            @ApiImplicitParam(paramType = "path",dataType = "Integer",name = "communityId",value = "小区ID"),
52
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageNo",value = "第几页"),
53
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageSize",value = "一页多少行")
54
+    })
55
+    @RequestMapping(value = "/monitoring/token/{communityId}",method = RequestMethod.GET)
56
+    public ResponseBean getMonitoringToken(@PathVariable("communityId") Integer communityId,
57
+                                @RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
58
+                                @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize){
59
+        ResponseBean response = new ResponseBean();
60
+        if (!check(communityId)) {
61
+            response.addError("小区不存在");
62
+            return response;
63
+        }
64
+
65
+        response = iMonitoringService.getMonitoringToken(communityId,pageNo,pageSize);
66
+        return response;
67
+    }
68
+
69
+}

+ 90
- 25
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java View File

@@ -8,15 +8,14 @@ import com.community.huiju.model.TpAnnouncement;
8 8
 import com.community.huiju.model.TpTicket;
9 9
 import com.community.huiju.model.TpTransaction;
10 10
 import com.community.huiju.service.SocialServiceI;
11
-import io.swagger.annotations.Api;
12
-import io.swagger.annotations.ApiImplicitParam;
13
-import io.swagger.annotations.ApiImplicitParams;
14
-import io.swagger.annotations.ApiOperation;
11
+import io.swagger.annotations.*;
15 12
 import org.springframework.beans.factory.annotation.Autowired;
16 13
 import org.springframework.cloud.context.config.annotation.RefreshScope;
17 14
 import org.springframework.web.bind.annotation.*;
15
+import org.springframework.web.multipart.MultipartFile;
18 16
 
19 17
 import javax.servlet.http.HttpSession;
18
+import java.io.IOException;
20 19
 import java.util.List;
21 20
 
22 21
 /**
@@ -28,7 +27,7 @@ import java.util.List;
28 27
 @RefreshScope
29 28
 @RequestMapping("/")
30 29
 @Api(value = "app端论坛相关的API", description = "app端论坛相关的API")
31
-public class SocialController {
30
+public class SocialController extends BaseController {
32 31
 
33 32
     @Autowired
34 33
     private SocialServiceI socialServiceI;
@@ -42,6 +41,12 @@ public class SocialController {
42 41
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
43 42
         Integer userId = userElement.getId();
44 43
         ResponseBean responseBean = new ResponseBean();
44
+
45
+        if (!check(communityId)) {
46
+            responseBean.addError("小区不存在");
47
+            return responseBean;
48
+        }
49
+
45 50
         TpAnnouncement tpAnnouncement = socialServiceI.findAnnouncementDetail(id, communityId, userId);
46 51
         responseBean.addSuccess(tpAnnouncement);
47 52
         return responseBean;
@@ -55,7 +60,15 @@ public class SocialController {
55 60
     public ResponseBean SignActivity(@PathVariable(value = "communityId") Integer communityId, @RequestParam("activityId") Integer activityId, HttpSession session) {
56 61
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
57 62
         Integer userId = userElement.getId();
58
-        ResponseBean responseBean = socialServiceI.findTaUserInfo(activityId, communityId, userId);
63
+
64
+        ResponseBean responseBean = new ResponseBean();
65
+
66
+        if (!check(communityId)) {
67
+            responseBean.addError("小区不存在");
68
+            return responseBean;
69
+        }
70
+
71
+        responseBean = socialServiceI.findTaUserInfo(activityId, communityId, userId);
59 72
         return responseBean;
60 73
     }
61 74
 
@@ -65,13 +78,19 @@ public class SocialController {
65 78
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
66 79
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")})
67 80
     @RequestMapping(value = "/announcements/{communityId}", method = RequestMethod.GET)
68
-    public ResponseBean getAnnouncements(@PathVariable Integer communityId, @RequestParam String title,
81
+    public ResponseBean getAnnouncements(@PathVariable Integer communityId,
82
+                                         @RequestParam(required = false) String title,
69 83
                                          @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
70 84
                                          @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
71 85
         ResponseBean responseBean = new ResponseBean();
72
-        List<TpAnnouncement> announcementList = socialServiceI.getAnnouncements(communityId, title, pageNum, pageSize);
73
-        responseBean.addSuccess(announcementList);
74
-        return responseBean;
86
+
87
+        if (!check(communityId)) {
88
+            responseBean.addError("小区不存在");
89
+            return responseBean;
90
+        }
91
+
92
+        ResponseBean announcementList = socialServiceI.getAnnouncements(communityId, title, pageNum, pageSize);
93
+        return announcementList;
75 94
     }
76 95
 
77 96
     @ApiOperation(value = "获取公告轮播图", notes = "获取公告轮播图")
@@ -81,6 +100,12 @@ public class SocialController {
81 100
     @RequestMapping(value = "/announcement/Img/{communityId}", method = RequestMethod.GET)
82 101
     public ResponseBean getAnnouncement(@PathVariable(value = "communityId") Integer communityId) {
83 102
         ResponseBean responseBean = new ResponseBean();
103
+
104
+        if (!check(communityId)) {
105
+            responseBean.addError("小区不存在");
106
+            return responseBean;
107
+        }
108
+
84 109
         List<TpAnnouncement> agreement = socialServiceI.getAnnouncement(communityId);
85 110
         responseBean.addSuccess(agreement);
86 111
         return responseBean;
@@ -93,6 +118,12 @@ public class SocialController {
93 118
     @RequestMapping(value = "/activity/Img/{communityId}", method = RequestMethod.GET)
94 119
     public ResponseBean getActivity(@PathVariable(value = "communityId") Integer communityId) {
95 120
         ResponseBean responseBean = new ResponseBean();
121
+
122
+        if (!check(communityId)) {
123
+            responseBean.addError("小区不存在");
124
+            return responseBean;
125
+        }
126
+
96 127
         List<TpActivity> agreement = socialServiceI.getActivity(communityId);
97 128
         responseBean.addSuccess(agreement);
98 129
         return responseBean;
@@ -105,13 +136,19 @@ public class SocialController {
105 136
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
106 137
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")})
107 138
     @RequestMapping(value = "/activitys/{communityId}", method = RequestMethod.GET)
108
-    public ResponseBean getActivitys(@PathVariable Integer communityId, @RequestParam String title,
139
+    public ResponseBean getActivitys(@PathVariable Integer communityId,
140
+                                     @RequestParam(required = false) String title,
109 141
                                      @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
110 142
                                      @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
111 143
         ResponseBean responseBean = new ResponseBean();
112
-        List<TpActivity> activityList = socialServiceI.getActivitys(communityId, title, pageNum, pageSize);
113
-        responseBean.addSuccess(activityList);
114
-        return responseBean;
144
+
145
+        if (!check(communityId)) {
146
+            responseBean.addError("小区不存在");
147
+            return responseBean;
148
+        }
149
+
150
+        ResponseBean activityList = socialServiceI.getActivitys(communityId, title, pageNum, pageSize);
151
+        return activityList;
115 152
     }
116 153
 
117 154
     @ApiOperation(value = "论坛活动帖子详情", notes = "获取论坛活动帖子详情")
@@ -123,6 +160,12 @@ public class SocialController {
123 160
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
124 161
         Integer userId = userElement.getId();
125 162
         ResponseBean responseBean = new ResponseBean();
163
+
164
+        if (!check(communityId)) {
165
+            responseBean.addError("小区不存在");
166
+            return responseBean;
167
+        }
168
+
126 169
         TpActivity activity = socialServiceI.findActivityDetail(activityId, communityId, userId);
127 170
         responseBean.addSuccess(activity);
128 171
         return responseBean;
@@ -137,6 +180,12 @@ public class SocialController {
137 180
         ResponseBean responseBean = new ResponseBean();
138 181
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
139 182
         Integer userId = userElement.getId();
183
+
184
+        if (!check(communityId)) {
185
+            responseBean.addError("小区不存在");
186
+            return responseBean;
187
+        }
188
+
140 189
         TpTransaction activity = socialServiceI.findUsedDetails(activityId, communityId, userId);
141 190
         responseBean.addSuccess(activity);
142 191
         return responseBean;
@@ -145,27 +194,36 @@ public class SocialController {
145 194
     @ApiOperation(value = "获取所有的二手租赁帖子", notes = "获取所有的二手租赁帖子")
146 195
     @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
147 196
             @ApiImplicitParam(paramType = "query", dataType = "String", name = "type", value = "帖子类型"),
197
+            @ApiImplicitParam(paramType = "query", dataType = "String", name = "transactionTitle", value = "帖子标题"),
148 198
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
149
-            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")})
150
-    @RequestMapping(value = "/getTransactions /{communityId}", method = RequestMethod.GET)
151
-    public ResponseBean getAllPosts(@PathVariable("communityId") Integer communityId, @RequestParam("type") String type,
199
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")}
200
+    )
201
+    @RequestMapping(value = "/getTransactions/{communityId}", method = RequestMethod.GET)
202
+    public ResponseBean getAllPosts(@PathVariable("communityId") Integer communityId,
203
+                                    @RequestParam(value = "type", required = false) String type,
204
+                                    @RequestParam(value = "transactionTitle",required = false) String transactionTitle,
152 205
                                     @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
153 206
                                     @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
154 207
         ResponseBean responseBean = new ResponseBean();
155
-        List<TpTransaction> tpTransactions = socialServiceI.findAllTransaction(communityId, type, pageNum, pageSize);
156
-        responseBean.addSuccess(tpTransactions);
157
-        return responseBean;
208
+
209
+        if (!check(communityId)) {
210
+            responseBean.addError("小区不存在");
211
+            return responseBean;
212
+        }
213
+
214
+        ResponseBean tpTransactions = socialServiceI.findAllTransaction(communityId, transactionTitle,type, pageNum, pageSize);
215
+        return tpTransactions;
158 216
     }
159 217
 
160 218
     @ApiOperation(value = "添加二手租赁帖子", notes = "添加二手租赁帖子")
161 219
     @ApiImplicitParams({
162
-            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
163
-                    "title:小区标题,content:小区类容, type"),
220
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value ="title:小区标题, imageUrl:图片URL地址, content:小区内容, type:0二手,1求购,2租赁"),
164 221
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
165 222
     })
166 223
     @RequestMapping(value = "/addTransaction", method = RequestMethod.POST)
167 224
     @ResponseBody
168
-    public ResponseBean addTransaction(@RequestBody String paramets, HttpSession session) {
225
+    public ResponseBean addTransaction(@RequestBody String paramets, HttpSession session)throws IOException{
226
+
169 227
         ResponseBean responseBean = new ResponseBean();
170 228
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
171 229
         Integer userId = userElement.getId();
@@ -182,19 +240,20 @@ public class SocialController {
182 240
     })
183 241
     @RequestMapping(value = "/selectAllTransaction", method = RequestMethod.GET)
184 242
     public ResponseBean selectAllTransaction(HttpSession session,
243
+                                             @RequestParam("type") Integer type,
185 244
                                              @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
186 245
                                              @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
187 246
         ResponseBean responseBean = new ResponseBean();
188 247
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
189 248
         Integer userId = userElement.getId();
190
-        ResponseBean response = socialServiceI.selectAllTransaction(userId, pageNum, pageSize);
249
+        ResponseBean response = socialServiceI.selectAllTransaction(userId, pageNum, pageSize,type);
191 250
         return response;
192 251
     }
193 252
 
194 253
     @ApiOperation(value = "修改二手租赁帖子", notes = "修改二手租赁帖子")
195 254
     @ApiImplicitParams({
196 255
             @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
197
-                    "id:小区id,title:小区标题,content:小区容"),
256
+                    "id:小区id,title:小区标题,content:小区容"),
198 257
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
199 258
     })
200 259
     @RequestMapping(value = "/updateTransaction/{Id}", method = RequestMethod.PUT)
@@ -216,6 +275,12 @@ public class SocialController {
216 275
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
217 276
         Integer userId = userElement.getId();
218 277
         ResponseBean responseBean = new ResponseBean();
278
+
279
+        if (!check(communityId)) {
280
+            responseBean.addError("小区不存在");
281
+            return responseBean;
282
+        }
283
+
219 284
         socialServiceI.accessTicket(communityId, tpTicket, ticketId, userId);
220 285
         return responseBean;
221 286
     }

+ 45
- 16
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TicketController.java View File

@@ -21,13 +21,14 @@ import org.springframework.cloud.context.config.annotation.RefreshScope;
21 21
 import org.springframework.web.bind.annotation.*;
22 22
 
23 23
 import javax.servlet.http.HttpSession;
24
+import java.io.IOException;
24 25
 import java.util.List;
25 26
 
26 27
 @RestController
27 28
 @RefreshScope
28 29
 @RequestMapping("/")
29 30
 @Api(value = "工单相关的API",description = "工单相关的API")
30
-public class TicketController {
31
+public class TicketController extends BaseController {
31 32
 
32 33
     @Autowired
33 34
     private ITicketService iTicketService;
@@ -38,18 +39,23 @@ public class TicketController {
38 39
     @RequestMapping(value = "/tickets/{communityId}", method = RequestMethod.GET)
39 40
     @ApiOperation(value = "获取 报修/投诉/联系单 各3条数据", notes = "根据 小区编号,第几页,一页多少行")
40 41
     @ApiImplicitParams({
41
-            @ApiImplicitParam(paramType = "path",dataType = "String",name = "communityId",value = "小区编号"),
42
+            @ApiImplicitParam(paramType = "path",dataType = "Integer",name = "communityId",value = "小区编号"),
42 43
             @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageNum",value = "第几页"),
43 44
             @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageSize",value = "一页多少数据"),
44 45
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
45 46
     })
46 47
     @Deprecated
47
-    public ResponseBean getService(@PathVariable(value = "communityId") String communityId,
48
+    public ResponseBean getService(@PathVariable(value = "communityId") Integer communityId,
48 49
                                    @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
49 50
                                    @RequestParam(value = "pageSize", defaultValue = "3") Integer pageSize,
50 51
                                    HttpSession session) {
51 52
         ResponseBean response = new ResponseBean();
52 53
 
54
+        if (!check(communityId)) {
55
+            response.addError("小区不存在");
56
+            return response;
57
+        }
58
+
53 59
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
54 60
 
55 61
         TpTicket tpTicket = new TpTicket();
@@ -62,13 +68,19 @@ public class TicketController {
62 68
 
63 69
     @ApiOperation(value = "获取报修/投诉/联系单进度详情数据", notes = "获取报修/投诉/联系单进度详情数据")
64 70
     @ApiImplicitParams({
65
-            @ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区编号"),
71
+            @ApiImplicitParam(paramType = "path", dataType = "Integer", name = "communityId", value = "小区编号"),
66 72
             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "ticketId", value = "报修id")
67 73
     })
68 74
     @RequestMapping(value = "/ticket/schedule/{communityId}", method = RequestMethod.GET)
69
-    public ResponseBean getTicketSchedule(@PathVariable(value = "communityId") String communityId, @RequestParam Integer ticketId) {
75
+    public ResponseBean getTicketSchedule(@PathVariable(value = "communityId") Integer communityId, @RequestParam Integer ticketId) {
70 76
         ResponseBean responseBean = new ResponseBean();
71
-        TpTicket ticket = iTicketService.getTicketSchedule(communityId, ticketId);
77
+
78
+        if (!check(communityId)) {
79
+            responseBean.addError("小区不存在");
80
+            return responseBean;
81
+        }
82
+
83
+        TpTicket ticket = iTicketService.getTicketSchedule(String.valueOf(communityId), ticketId);
72 84
         responseBean.addSuccess(ticket);
73 85
         return responseBean;
74 86
     }
@@ -76,20 +88,25 @@ public class TicketController {
76 88
     @RequestMapping(value = "/tickets/list/{communityId}", method = RequestMethod.GET)
77 89
     @ApiOperation(value = "获取 报修/投诉/联系单 数据列表", notes = "根据 小区编号,工单类型,第几页,一页多少行")
78 90
     @ApiImplicitParams({
79
-            @ApiImplicitParam(paramType = "path",dataType = "String",name = "communityId", value = "小区编号"),
91
+            @ApiImplicitParam(paramType = "path",dataType = "Integer",name = "communityId", value = "小区编号"),
80 92
             @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageNum", value = "第几页"),
81 93
             @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageSize", value = "一页多少数据"),
82 94
             @ApiImplicitParam(paramType = "query",dataType = "String",name = "type", value = "工单类型 (0报修/1投诉/2联系单)"),
83 95
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
84 96
 
85 97
     })
86
-    public ResponseBean getServiceList(@PathVariable(value = "communityId") String communityId,
98
+    public ResponseBean getServiceList(@PathVariable(value = "communityId") Integer communityId,
87 99
                                        @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
88 100
                                        @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
89 101
                                        @RequestParam(value = "type") String type,
90 102
                                        HttpSession session) {
91 103
         ResponseBean responseBean = new ResponseBean();
92 104
 
105
+        if (!check(communityId)) {
106
+            responseBean.addError("小区不存在");
107
+            return responseBean;
108
+        }
109
+
93 110
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
94 111
 
95 112
         TpTicket tpTicket = new TpTicket();
@@ -112,6 +129,12 @@ public class TicketController {
112 129
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
113 130
         Integer userId = userElement.getId();
114 131
         ResponseBean responseBean = new ResponseBean();
132
+
133
+        if (!check(communityId)) {
134
+            responseBean.addError("小区不存在");
135
+            return responseBean;
136
+        }
137
+
115 138
         tpTicketRecordComment.setCommunityId(communityId);
116 139
         Integer size = iTicketService.updateTicketsReply(tpTicketRecordComment, userId);
117 140
         if (size > 0){
@@ -124,18 +147,17 @@ public class TicketController {
124 147
 
125 148
     @ApiOperation(value = "添加报修", notes = "添加报修")
126 149
     @ApiImplicitParams({
127
-            @ApiImplicitParam(paramType = "query",dataType = "String",name = "ticketContent",value = "工单内容"),
128
-            @ApiImplicitParam(paramType = "query",dataType = "String",name = "ticketTitle",value = "工单标题"),
129
-            @ApiImplicitParam(paramType = "query",dataType = "String",name = "repairType",value = "报修房屋类型"),
130
-            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
150
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
151
+                    "ticketTitle:工单内容,ticketContent:小区标题,repairType:0:公共区域  1: 房屋质量  2:户内设施, imageUrl:图片地址 "),
152
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
131 153
     })
132
-    @RequestMapping(value = "/addAlltpTicket", method = RequestMethod.POST)
154
+    @RequestMapping(value = "/addtpTicket", method = RequestMethod.POST)
133 155
     @ResponseBody
134
-    public ResponseBean addTransaction(@RequestBody String parameter, HttpSession session) {
156
+    public ResponseBean addTransaction(@RequestBody String paramets, HttpSession session) throws IOException {
135 157
         ResponseBean responseBean = new ResponseBean();
136 158
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
137 159
         Integer userId = userElement.getId();
138
-        ResponseBean response = iTicketService.addAiTicketService(userId, parameter);
160
+        ResponseBean response = iTicketService.addAiTicketService(userId, paramets);
139 161
         return response;
140 162
     }
141 163
 
@@ -167,7 +189,14 @@ public class TicketController {
167 189
     public ResponseBean stopTicket(@PathVariable("communityId") Integer communityId, @RequestParam("ticketId") Integer ticketId, HttpSession session) {
168 190
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
169 191
         Integer userId = userElement.getId();
170
-        ResponseBean responseBean = iTicketService.stopTpTicketRecord(communityId, ticketId, userId);
192
+
193
+        ResponseBean responseBean = new ResponseBean();
194
+        if (!check(communityId)) {
195
+            responseBean.addError("小区不存在");
196
+            return responseBean;
197
+        }
198
+
199
+        responseBean = iTicketService.stopTpTicketRecord(communityId, ticketId, userId);
171 200
         return responseBean;
172 201
     }
173 202
 }

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/UserController.java View File

@@ -32,7 +32,7 @@ import java.util.List;
32 32
 @RefreshScope
33 33
 @RequestMapping("/")
34 34
 @Api(value = "用户相关操作的API",description = "用户相关操作的API")
35
-public class UserController {
35
+public class UserController extends BaseController {
36 36
 
37 37
     @Autowired
38 38
     private ITaUserService iTaUserService;

+ 13
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/VistorController.java View File

@@ -26,7 +26,7 @@ import java.util.List;
26 26
 @RefreshScope
27 27
 @RequestMapping("/")
28 28
 @Api(value = "访客相关的API", description = "访客相关的API")
29
-public class VistorController {
29
+public class VistorController extends BaseController {
30 30
 
31 31
     @Autowired
32 32
     private TaVistorServiceI vistorServiceI;
@@ -38,6 +38,12 @@ public class VistorController {
38 38
             @ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id")})
39 39
     public ResponseBean findVistorDetail(@PathVariable("communityId")Integer communityId, @RequestBody TaVisitor taVisitor, HttpSession session) {
40 40
         ResponseBean responseBean = new ResponseBean();
41
+
42
+        if (!check(communityId)) {
43
+            responseBean.addError("小区不存在");
44
+            return responseBean;
45
+        }
46
+
41 47
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
42 48
         Integer userId = userElement.getId();
43 49
         vistorServiceI.insertTaVistor(taVisitor, communityId, userId);
@@ -50,6 +56,12 @@ public class VistorController {
50 56
             @ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id")})
51 57
     public ResponseBean invateHis(@PathVariable("communityId")Integer communityId, HttpSession session) {
52 58
         ResponseBean responseBean = new ResponseBean();
59
+
60
+        if (!check(communityId)) {
61
+            responseBean.addError("小区不存在");
62
+            return responseBean;
63
+        }
64
+
53 65
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
54 66
         Integer userId = userElement.getId();
55 67
         List<TaVisitor> taVisitors = vistorServiceI.invateHis(communityId, userId);

+ 27
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaFaceMapper.java View File

@@ -0,0 +1,27 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TaFace;
4
+import com.community.huiju.model.TpTicket;
5
+import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+@Mapper
9
+public interface TaFaceMapper{
10
+    int deleteByPrimaryKey(Integer id);
11
+
12
+    int insert(TaFace record);
13
+
14
+    int insertSelective(TaFace record);
15
+
16
+    int selectByPrimaryKey(Integer id);
17
+
18
+    void updateByPrimaryKeySelective(TaFace record);
19
+
20
+    /**
21
+     * 查看当前用户信息
22
+     * @param userid
23
+     * @return
24
+     */
25
+    TaFace getByUserId(@Param("userid") Integer userid);
26
+
27
+}

+ 24
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaSysMenuImgMapper.java View File

@@ -0,0 +1,24 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TaSysMenuImg;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+
9
+@Mapper
10
+public interface TaSysMenuImgMapper {
11
+    int deleteByPrimaryKey(Integer id);
12
+
13
+    int insert(TaSysMenuImg record);
14
+
15
+    int insertSelective(TaSysMenuImg record);
16
+
17
+    TaSysMenuImg selectByPrimaryKey(Integer id);
18
+
19
+    int updateByPrimaryKeySelective(TaSysMenuImg record);
20
+
21
+    int updateByPrimaryKey(TaSysMenuImg record);
22
+    
23
+    List<TaSysMenuImg> selectByMenuId(@Param("id") Integer id);
24
+}

+ 29
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaSysMenuMapper.java View File

@@ -0,0 +1,29 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TaSysMenu;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+
9
+@Mapper
10
+public interface TaSysMenuMapper {
11
+    int deleteByPrimaryKey(Integer id);
12
+
13
+    int insert(TaSysMenu record);
14
+
15
+    int insertSelective(TaSysMenu record);
16
+
17
+    TaSysMenu selectByPrimaryKey(Integer id);
18
+
19
+    int updateByPrimaryKeySelective(TaSysMenu record);
20
+
21
+    int updateByPrimaryKey(TaSysMenu record);
22
+    
23
+    /**
24
+     * 获取菜单列表
25
+     * @param communityId
26
+     * @return
27
+     */
28
+    List<TaSysMenu> selectByCommunity(@Param("communityId") Integer communityId);
29
+}

+ 19
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TdImagesMapper.java View File

@@ -0,0 +1,19 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TdImages;
4
+import org.apache.ibatis.annotations.Mapper;
5
+
6
+@Mapper
7
+public interface TdImagesMapper {
8
+    int deleteByPrimaryKey(Integer id);
9
+
10
+    int insert(TdImages record);
11
+
12
+    int insertSelective(TdImages record);
13
+
14
+    TdImages selectByPrimaryKey(Integer id);
15
+
16
+    int updateByPrimaryKeySelective(TdImages record);
17
+
18
+    int updateByPrimaryKey(TdImages record);
19
+}

+ 0
- 7
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTicketMapper.java View File

@@ -35,11 +35,4 @@ public interface TpTicketMapper {
35 35
      * @return
36 36
      */
37 37
 	TpTicket selectByTicketId(@Param("communityId") String communityId,@Param("ticketId") Integer ticketId);
38
-
39
-    /**
40
-     * 获取当前插入的信息
41
-     * @param userId
42
-     * @param communityId
43
-     */
44
-    TpTicket getById(@Param("userId")Integer userId, @Param("communityId")Integer communityId);
45 38
 }

+ 2
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTransactionMapper.java View File

@@ -20,9 +20,9 @@ public interface TpTransactionMapper {
20 20
 
21 21
     int updateByPrimaryKey(TpTransaction record);
22 22
 
23
-    List<TpTransaction> findAllTransaction(@Param("communityId") Integer communityId, @Param("type") String type);
23
+    List<TpTransaction> findAllTransaction(@Param("communityId") Integer communityId, @Param("transactionTitle") String transactionTitle, @Param("type") String type);
24 24
 
25
-    List<TpTransaction> selectTransaction(@Param("userId")Integer userId, @Param("communityId")Integer communityId);
25
+    List<TpTransaction> selectTransaction(@Param("userId")Integer userId, @Param("communityId")Integer communityId,@Param("type") Integer type);
26 26
 
27 27
     void updateTransaction(@Param("id")Integer id, @Param("transactionTitle")String transactionTitle, @Param("transactionContent")String transactionContent, @Param("userId")Integer userId);
28 28
 

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaAgreement.java View File

@@ -1,5 +1,5 @@
1 1
  package com.community.huiju.model;
2
-import jdk.nashorn.internal.objects.annotations.Getter;
2
+
3 3
 import lombok.AllArgsConstructor;
4 4
 import lombok.Data;
5 5
 import lombok.NoArgsConstructor;

+ 50
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaFace.java View File

@@ -0,0 +1,50 @@
1
+package com.community.huiju.model;
2
+
3
+import lombok.AllArgsConstructor;
4
+import lombok.Data;
5
+import lombok.NoArgsConstructor;
6
+
7
+import java.util.Date;
8
+
9
+@Data
10
+@AllArgsConstructor
11
+@NoArgsConstructor
12
+public class TaFace {
13
+
14
+    private Integer id;
15
+
16
+    /**
17
+     * 小区ID
18
+     */
19
+    private Integer communityId;
20
+
21
+    /**
22
+     * 用户ID
23
+     */
24
+    private Integer taUserId;
25
+
26
+    /**
27
+     *图片
28
+     */
29
+    private  String faceImg;
30
+
31
+    /**
32
+     * 创建人
33
+     */
34
+    private  Integer createUser;
35
+
36
+    /**
37
+     * 更新人
38
+     */
39
+    private  Integer updateUser;
40
+
41
+    /**
42
+     * 创建时间
43
+     */
44
+    private  Date createDate;
45
+
46
+    /**
47
+     * 更新时间
48
+     */
49
+    private  Date updateDate;
50
+}

+ 95
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaSysMenu.java View File

@@ -0,0 +1,95 @@
1
+package com.community.huiju.model;
2
+
3
+import java.util.List;
4
+
5
+public class TaSysMenu {
6
+    private Integer id;
7
+
8
+    private Integer communityId;
9
+
10
+    private String menuName;
11
+
12
+    private String menuUrl;
13
+
14
+    private Integer parentId;
15
+
16
+    private Integer sort;
17
+
18
+    private String menuType;
19
+
20
+    private String status;
21
+    
22
+    private List<TaSysMenuImg> menuImgList;
23
+
24
+    public Integer getId() {
25
+        return id;
26
+    }
27
+
28
+    public void setId(Integer id) {
29
+        this.id = id;
30
+    }
31
+
32
+    public Integer getCommunityId() {
33
+        return communityId;
34
+    }
35
+
36
+    public void setCommunityId(Integer communityId) {
37
+        this.communityId = communityId;
38
+    }
39
+
40
+    public String getMenuName() {
41
+        return menuName;
42
+    }
43
+
44
+    public void setMenuName(String menuName) {
45
+        this.menuName = menuName == null ? null : menuName.trim();
46
+    }
47
+
48
+    public String getMenuUrl() {
49
+        return menuUrl;
50
+    }
51
+
52
+    public void setMenuUrl(String menuUrl) {
53
+        this.menuUrl = menuUrl == null ? null : menuUrl.trim();
54
+    }
55
+
56
+    public Integer getParentId() {
57
+        return parentId;
58
+    }
59
+
60
+    public void setParentId(Integer parentId) {
61
+        this.parentId = parentId;
62
+    }
63
+
64
+    public Integer getSort() {
65
+        return sort;
66
+    }
67
+
68
+    public void setSort(Integer sort) {
69
+        this.sort = sort;
70
+    }
71
+
72
+    public String getMenuType() {
73
+        return menuType;
74
+    }
75
+
76
+    public void setMenuType(String menuType) {
77
+        this.menuType = menuType == null ? null : menuType.trim();
78
+    }
79
+
80
+    public String getStatus() {
81
+        return status;
82
+    }
83
+
84
+    public void setStatus(String status) {
85
+        this.status = status == null ? null : status.trim();
86
+    }
87
+    
88
+    public List<TaSysMenuImg> getMenuImgList() {
89
+        return menuImgList;
90
+    }
91
+    
92
+    public void setMenuImgList(List<TaSysMenuImg> menuImgList) {
93
+        this.menuImgList = menuImgList;
94
+    }
95
+}

+ 33
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaSysMenuImg.java View File

@@ -0,0 +1,33 @@
1
+package com.community.huiju.model;
2
+
3
+public class TaSysMenuImg {
4
+    private Integer id;
5
+
6
+    private Integer taMenuId;
7
+
8
+    private String menuIconImg;
9
+
10
+    public Integer getId() {
11
+        return id;
12
+    }
13
+
14
+    public void setId(Integer id) {
15
+        this.id = id;
16
+    }
17
+
18
+    public Integer getTaMenuId() {
19
+        return taMenuId;
20
+    }
21
+
22
+    public void setTaMenuId(Integer taMenuId) {
23
+        this.taMenuId = taMenuId;
24
+    }
25
+
26
+    public String getMenuIconImg() {
27
+        return menuIconImg;
28
+    }
29
+
30
+    public void setMenuIconImg(String menuIconImg) {
31
+        this.menuIconImg = menuIconImg == null ? null : menuIconImg.trim();
32
+    }
33
+}

+ 33
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaUser.java View File

@@ -39,6 +39,15 @@ public class TaUser {
39 39
 
40 40
     private Date updateDate;
41 41
 
42
+    // 海康UserId
43
+    private Integer hkUserId;
44
+
45
+    // 海康 卡片号
46
+    private String hkCardNo;
47
+
48
+    // 人脸状态
49
+    private String faceStatus;
50
+
42 51
     public Integer getId() {
43 52
         return id;
44 53
     }
@@ -151,6 +160,14 @@ public class TaUser {
151 160
         this.verifyStatus = verifyStatus == null ? null : verifyStatus.trim();
152 161
     }
153 162
 
163
+    public String getFaceStatus() {
164
+        return faceStatus;
165
+    }
166
+
167
+    public void setFaceStatus(String faceStatus) {
168
+        this.faceStatus = faceStatus;
169
+    }
170
+
154 171
     public Integer getCreateUser() {
155 172
         return createUser;
156 173
     }
@@ -182,4 +199,20 @@ public class TaUser {
182 199
     public void setUpdateDate(Date updateDate) {
183 200
         this.updateDate = updateDate;
184 201
     }
202
+
203
+    public Integer getHkUserId() {
204
+        return hkUserId;
205
+    }
206
+
207
+    public void setHkUserId(Integer hkUserId) {
208
+        this.hkUserId = hkUserId;
209
+    }
210
+
211
+    public String getHkCardNo() {
212
+        return hkCardNo;
213
+    }
214
+
215
+    public void setHkCardNo(String hkCardNo) {
216
+        this.hkCardNo = hkCardNo;
217
+    }
185 218
 }

+ 65
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TdImages.java View File

@@ -0,0 +1,65 @@
1
+package com.community.huiju.model;
2
+
3
+import java.util.Date;
4
+
5
+public class TdImages {
6
+    private Integer id;
7
+
8
+    private String imageUrl;
9
+
10
+    private Integer uuid;
11
+
12
+    private String type;
13
+
14
+    private Integer createUser;
15
+
16
+    private Date createTime;
17
+
18
+    public Integer getId() {
19
+        return id;
20
+    }
21
+
22
+    public void setId(Integer id) {
23
+        this.id = id;
24
+    }
25
+
26
+    public String getImageUrl() {
27
+        return imageUrl;
28
+    }
29
+
30
+    public void setImageUrl(String imageUrl) {
31
+        this.imageUrl = imageUrl == null ? null : imageUrl.trim();
32
+    }
33
+
34
+    public Integer getUuid() {
35
+        return uuid;
36
+    }
37
+
38
+    public void setUuid(Integer uuid) {
39
+        this.uuid = uuid;
40
+    }
41
+
42
+    public String getType() {
43
+        return type;
44
+    }
45
+
46
+    public void setType(String type) {
47
+        this.type = type == null ? null : type.trim();
48
+    }
49
+
50
+    public Integer getCreateUser() {
51
+        return createUser;
52
+    }
53
+
54
+    public void setCreateUser(Integer createUser) {
55
+        this.createUser = createUser;
56
+    }
57
+
58
+    public Date getCreateTime() {
59
+        return createTime;
60
+    }
61
+
62
+    public void setCreateTime(Date createTime) {
63
+        this.createTime = createTime;
64
+    }
65
+}

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/BillServiceI.java View File

@@ -12,7 +12,7 @@ public interface BillServiceI {
12 12
 	 * @param pageSize
13 13
 	 * @return
14 14
 	 */
15
-	List<Map<String, Object>> getBillsList(Integer communityId, Integer payType, Integer userId ,Integer pageNum, Integer pageSize);
15
+	Map<String, Object> getBillsList(Integer communityId, Integer payType, Integer userId ,Integer pageNum, Integer pageSize);
16 16
 	
17 17
 	/**
18 18
 	 * 获取账单的详细信息

+ 7
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/CommunityServiceI.java View File

@@ -6,4 +6,11 @@ import java.util.List;
6 6
 
7 7
 public interface CommunityServiceI {
8 8
 	List<ToCommunities> getCommunitys(String communityName);
9
+
10
+	/**
11
+	 * 根据小区ID获取小区信息
12
+	 * @param communityId
13
+	 * @return
14
+	 */
15
+	ToCommunities getByCommunityId(Integer communityId);
9 16
 }

+ 28
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/FaceServiceI.java View File

@@ -0,0 +1,28 @@
1
+package com.community.huiju.service;
2
+
3
+
4
+import com.community.commom.mode.ResponseBean;
5
+import org.springframework.web.multipart.MultipartFile;
6
+
7
+public interface FaceServiceI {
8
+    /**
9
+     * 添加人脸
10
+     * @param userId
11
+     * @return
12
+     */
13
+    ResponseBean addFace(Integer userId ,MultipartFile uploadFile);
14
+
15
+    /**
16
+     * 更新当前人脸
17
+     * @param userId
18
+     * @return
19
+     */
20
+    ResponseBean upDateFace(Integer userId , MultipartFile uploadFile);
21
+
22
+    /**
23
+     * 当前登入人是否有人脸信息
24
+     * @param userId
25
+     * @return
26
+     */
27
+    ResponseBean getTaFaceByUserId(Integer userId);
28
+}

+ 29
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/IMonitoringService.java View File

@@ -0,0 +1,29 @@
1
+package com.community.huiju.service;
2
+
3
+import com.community.commom.mode.ResponseBean;
4
+
5
+/**
6
+ * 监控 业务接口
7
+ * @author weiximei
8
+ */
9
+public interface IMonitoringService {
10
+
11
+    /**
12
+     * 根据小区ID查询 监控列表
13
+     * @param communityId
14
+     * @param pageNo
15
+     * @param pageSize
16
+     * @return
17
+     */
18
+    ResponseBean getByCommunityId(Integer communityId,Integer pageNo, Integer pageSize);
19
+
20
+    /**
21
+     * 生成 Token
22
+     * @param communityId
23
+     * @param pageNo
24
+     * @param pageSize
25
+     * @return
26
+     */
27
+    ResponseBean getMonitoringToken(Integer communityId, Integer pageNo, Integer pageSize);
28
+
29
+}

+ 2
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITicketService.java View File

@@ -5,6 +5,7 @@ import com.community.huiju.model.TpTicket;
5 5
 import com.community.huiju.model.TpTicketRecordComment;
6 6
 import com.community.huiju.vo.TpTicketVO;
7 7
 
8
+import java.io.IOException;
8 9
 import java.util.List;
9 10
 
10 11
 /**
@@ -46,7 +47,7 @@ public interface ITicketService {
46 47
 	 * @param parameter
47 48
 	 * @return
48 49
 	 */
49
-    ResponseBean addAiTicketService(Integer userId,String parameter);
50
+    ResponseBean addAiTicketService(Integer userId,String parameter) throws IOException;
50 51
 	
51 52
 	/**
52 53
 	 * 回复工单

+ 15
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ImageServiceI.java View File

@@ -0,0 +1,15 @@
1
+package com.community.huiju.service;
2
+
3
+import org.springframework.web.multipart.MultipartFile;
4
+
5
+import java.io.IOException;
6
+
7
+/**
8
+ * @author admin
9
+ * @Title: ImageServiceI
10
+ * @Description: TODO
11
+ * @date 2018/11/5
12
+ */
13
+public interface ImageServiceI {
14
+    String getImageUrl(MultipartFile uploadFile) throws IOException;
15
+}

+ 15
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/MenuServiceI.java View File

@@ -0,0 +1,15 @@
1
+package com.community.huiju.service;
2
+
3
+import com.community.huiju.model.TaSysMenu;
4
+
5
+import java.util.List;
6
+
7
+public interface MenuServiceI {
8
+	
9
+	/**
10
+	 * 获取菜单列表
11
+	 * @param communityId
12
+	 * @return
13
+	 */
14
+	List<TaSysMenu> getMenuList(Integer communityId);
15
+}

+ 1
- 4
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/MessageServiceI.java View File

@@ -1,8 +1,5 @@
1 1
 package com.community.huiju.service;
2 2
 
3
-import com.community.huiju.model.TpMessage;
4
-
5
-import java.util.List;
6 3
 import java.util.Map;
7 4
 
8 5
 public interface MessageServiceI {
@@ -21,7 +18,7 @@ public interface MessageServiceI {
21 18
 	 * @param modelType
22 19
 	 * @return
23 20
 	 */
24
-	List<TpMessage> getMessages(Integer communityId, Integer pageNum, Integer pageSize,Integer modelType, Integer userId);
21
+	Map<String,Object> getMessages(Integer communityId, Integer pageNum, Integer pageSize,Integer modelType, Integer userId);
25 22
 
26 23
 	/**
27 24
 	 * 全部已读

+ 9
- 6
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java View File

@@ -3,6 +3,7 @@ package com.community.huiju.service;
3 3
 import com.community.commom.mode.ResponseBean;
4 4
 import com.community.huiju.model.*;
5 5
 
6
+import java.io.IOException;
6 7
 import java.util.List;
7 8
 
8 9
 /**
@@ -22,7 +23,7 @@ public interface SocialServiceI {
22 23
 	 * @param pageSize
23 24
 	 * @return
24 25
 	 */
25
-	List<TpAnnouncement> getAnnouncements(Integer communityId, String title, Integer pageNum, Integer pageSize);
26
+	ResponseBean getAnnouncements(Integer communityId, String title, Integer pageNum, Integer pageSize);
26 27
 
27 28
 	/**
28 29
 	 * 公告轮播图
@@ -39,7 +40,7 @@ public interface SocialServiceI {
39 40
 	 * @param pageSize
40 41
 	 * @return
41 42
 	 */
42
-	List<TpActivity> getActivitys(Integer communityId, String title, Integer pageNum, Integer pageSize);
43
+	ResponseBean getActivitys(Integer communityId, String title, Integer pageNum, Integer pageSize);
43 44
 	
44 45
 	/**
45 46
 	 * 获取活动帖子详情
@@ -62,21 +63,23 @@ public interface SocialServiceI {
62 63
 	 * 获取所有的交易帖子
63 64
 	 * @param communityId
64 65
 	 * @param type
66
+	 * @param transactionTitle
65 67
 	 * @return
66 68
 	 */
67
-	List<TpTransaction> findAllTransaction(Integer communityId, String type, Integer pageNum, Integer paeSize);
69
+	ResponseBean findAllTransaction(Integer communityId, String transactionTitle, String type, Integer pageNum, Integer paeSize);
68 70
 
69 71
 	/**
70 72
 	 * 添加二手租赁帖子
71 73
 	 */
72
-    ResponseBean addAllTransaction(Integer userId, String paramets);
74
+    ResponseBean addAllTransaction(Integer userId, String paramets)throws IOException;
75
+
73 76
 
74 77
 	/**
75
-	 * 获取当前用户所有的帖子
78
+	 * 获取当前用户发布所有的帖子
76 79
 	 * @param userId
77 80
 	 * @return
78 81
 	 */
79
-	ResponseBean selectAllTransaction(Integer userId,Integer pageNum,Integer pageSize);
82
+	ResponseBean selectAllTransaction(Integer userId,Integer pageNum,Integer pageSize,Integer type);
80 83
 
81 84
 	/**
82 85
 	 * 修改当前帖子

+ 8
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/BillServiceImpl.java View File

@@ -2,7 +2,9 @@ package com.community.huiju.service.impl;
2 2
 
3 3
 import com.community.huiju.dao.TpBillInvoiceMapper;
4 4
 import com.community.huiju.service.BillServiceI;
5
+import com.github.pagehelper.Page;
5 6
 import com.github.pagehelper.PageHelper;
7
+import com.google.common.collect.Maps;
6 8
 import org.springframework.beans.factory.annotation.Autowired;
7 9
 import org.springframework.stereotype.Service;
8 10
 
@@ -28,11 +30,14 @@ public class BillServiceImpl implements BillServiceI {
28 30
 	 * @return
29 31
 	 */
30 32
 	@Override
31
-	public List<Map<String, Object>> getBillsList(Integer communityId, Integer payType, Integer userId ,Integer pageNum, Integer pageSize) {
33
+	public Map<String, Object> getBillsList(Integer communityId, Integer payType, Integer userId ,Integer pageNum, Integer pageSize) {
32 34
 		//使用分页插件
33
-		PageHelper.startPage(pageNum, pageSize);
35
+		Page<Map<String,Object>> page = PageHelper.startPage(pageNum, pageSize);
34 36
 		List<Map<String,Object>> billsList = tpBillInvoiceMapper.getBillsList(communityId, userId, payType);
35
-		return billsList;
37
+		Map<String,Object> result = Maps.newHashMap();
38
+		result.put("list",billsList);
39
+		result.put("total",page.getTotal());
40
+		return result;
36 41
 	}
37 42
 	
38 43
 	/**

+ 5
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/CommunityServiceImpl.java View File

@@ -22,4 +22,9 @@ public class CommunityServiceImpl implements CommunityServiceI {
22 22
 	public List<ToCommunities> getCommunitys(String communityName) {
23 23
 		return toCommunitiesMapper.selectByCommunityName(communityName);
24 24
 	}
25
+
26
+	@Override
27
+	public ToCommunities getByCommunityId(Integer communityId) {
28
+		return toCommunitiesMapper.selectByPrimaryKey(communityId);
29
+	}
25 30
 }

+ 197
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/FaceServicelimpl.java View File

@@ -0,0 +1,197 @@
1
+package com.community.huiju.service.impl;
2
+import com.alibaba.fastjson.JSONObject;
3
+import com.community.commom.ailiyun.AESDecode;
4
+import com.community.commom.constant.Constant;
5
+import com.community.commom.mode.ResponseBean;
6
+import com.community.huiju.common.hk.HKOpenApi;
7
+import com.community.huiju.dao.TaFaceMapper;
8
+import com.community.huiju.dao.TaSysRoleMapper;
9
+import com.community.huiju.dao.TaUserMapper;
10
+import com.community.huiju.model.TaFace;
11
+import com.community.huiju.model.TaSysRole;
12
+import com.community.huiju.model.TaUser;
13
+import com.community.huiju.service.FaceServiceI;
14
+import com.community.huiju.service.ImageServiceI;
15
+import org.springframework.beans.factory.annotation.Autowired;
16
+import org.springframework.stereotype.Service;
17
+import org.springframework.transaction.annotation.Transactional;
18
+import org.springframework.web.multipart.MultipartFile;
19
+import java.io.IOException;
20
+import java.util.Date;
21
+
22
+@Service("faceServicel")
23
+@Transactional
24
+public class FaceServicelimpl implements FaceServiceI {
25
+
26
+
27
+    @Autowired
28
+    private TaFaceMapper taFaceMapper;
29
+
30
+    @Autowired
31
+    private TaUserMapper taUserMapper;
32
+
33
+    @Autowired
34
+    private TaSysRoleMapper taSysRoleMapper;
35
+
36
+    @Autowired
37
+    private ImageServiceI imageServiceI;
38
+
39
+    @Override
40
+    public ResponseBean addFace(Integer userid, MultipartFile uploadFile) {
41
+        String faceImg = null;
42
+        try {
43
+            faceImg = imageServiceI.getImageUrl(uploadFile);
44
+        } catch (IOException e) {
45
+            e.printStackTrace();
46
+        }
47
+        TaUser user = taUserMapper.selectByPrimaryKey(userid);
48
+        ResponseBean response = new ResponseBean();
49
+        TaFace taFace = new TaFace();
50
+        taFace.setCommunityId(user.getCommunityId());
51
+        taFace.setTaUserId(userid);
52
+        taFace.setCreateUser(userid);
53
+        taFace.setUpdateUser(userid);
54
+        taFace.setCreateDate(new Date());
55
+        taFace.setUpdateDate(new Date());
56
+        //已登陆,身份未知,状态未知
57
+
58
+        //判断身份是否为业主且状态为已停用
59
+        TaSysRole sysRole = taSysRoleMapper.findRoleByUserId(userid);
60
+        TaUser taUser = taUserMapper.selectByPrimaryKey(userid);
61
+        if (Constant.INVALID.equals(taUser.getStatus())
62
+                && Constant.OWNER.equals(sysRole.getRoleName())) {
63
+
64
+            response.addError("9996", "您的身份已停用,请联系物业");
65
+            return response;
66
+        }
67
+
68
+        //身份为家属租客,状态为已停用
69
+        if (Constant.INVALID.equals(taUser.getStatus())
70
+                && (Constant.RELATION.equals(sysRole.getRoleName())) || Constant.TENANT.equals(sysRole.getRoleName())) {
71
+
72
+            response.addError("9996", "您的身份已停用,请联系物业");
73
+            return response;
74
+        }
75
+
76
+        //查询当前用户是否有人脸记录
77
+        TaFace User = taFaceMapper.getByUserId(userid);
78
+        if (null == User) {
79
+            boolean isA = true;
80
+            if (Constant.OWNER.equals(sysRole.getRoleName()) && "1".equals(taUser.getVerifyStatus())) {
81
+                ResponseBean resps = checKout(faceImg, taFace, isA, uploadFile, userid);
82
+                if (resps.getCode().equals("0")) {
83
+                    taUser.setFaceStatus("1");
84
+                    taUserMapper.updateByPrimaryKeySelective(taUser);
85
+                    resps.addSuccess("图片录入成功");
86
+                } else {
87
+                    resps.addError(resps.getMessage());
88
+                }
89
+                return resps;
90
+            }
91
+            //家属或者租客,已认证
92
+            if (Constant.RELATION.equals(sysRole.getRoleName()) || Constant.TENANT.equals(sysRole.getDescription()) && "1".equals(taUser.getVerifyStatus())) {
93
+                ResponseBean resps = checKout(faceImg, taFace, isA, uploadFile, userid);
94
+                if (resps.getCode().equals("0")) {
95
+                    taUser.setFaceStatus("1");
96
+                    taUserMapper.updateByPrimaryKeySelective(taUser);
97
+                    resps.addSuccess("图片录入成功");
98
+                } else {
99
+                    resps.addError(resps.getMessage());
100
+                }
101
+                return resps;
102
+            }
103
+        }
104
+        response.addError("您的信息已存在");
105
+        return response;
106
+    }
107
+
108
+    @Override
109
+    public ResponseBean upDateFace(Integer userId, MultipartFile uploadFile) {
110
+        boolean isA = false;
111
+        String faceImg = null;
112
+        try {
113
+            faceImg = imageServiceI.getImageUrl(uploadFile);
114
+        } catch (IOException e) {
115
+            e.printStackTrace();
116
+        }
117
+        TaUser user = taUserMapper.selectByPrimaryKey(userId);
118
+
119
+        TaFace taFace = new TaFace();
120
+        taFace.setCommunityId(user.getCommunityId());
121
+        taFace.setTaUserId(userId);
122
+        taFace.setUpdateUser(userId);
123
+        taFace.setUpdateDate(new Date());
124
+        ResponseBean resps = checKout(faceImg, taFace, isA, uploadFile, userId);
125
+        if (resps.getCode().equals("0")) {
126
+
127
+
128
+            resps.addSuccess("图片修改成功");
129
+        } else {
130
+            resps.addError(resps.getMessage());
131
+        }
132
+        return resps;
133
+    }
134
+
135
+    /**
136
+     * 人脸录入验证
137
+     */
138
+    public ResponseBean checKout(String faceImg, TaFace taFace, boolean isA, MultipartFile uploadFile, Integer userId) {
139
+        ResponseBean responseBean = new ResponseBean();
140
+        TaUser user = taUserMapper.selectByPrimaryKey(userId);
141
+        if (user.getHkUserId() == null) {
142
+            responseBean.addError("人员Id不存在,无法录入");
143
+            return responseBean;
144
+        }
145
+
146
+        AESDecode aesd = new AESDecode();
147
+        String body = "{\"type\": \"0\", \"image_url\":\"" + faceImg + "\"}";
148
+        try {
149
+            responseBean = aesd.send(body);
150
+            JSONObject jsonObject = JSONObject.parseObject(responseBean.getMessage());
151
+            Integer type = (Integer) jsonObject.get("errno");
152
+            Integer faceNum = (Integer) jsonObject.get("face_num");
153
+
154
+            /*boolean isA为true进行添加,为false进行修改*/
155
+            if (0 == type && 1 == faceNum && isA) {
156
+
157
+                    /*推送海康*/
158
+                HKOpenApi.HKpersonGroupId(uploadFile, user.getHkUserId(), user.getId(), user.getUserName(), user.getHkCardNo());
159
+
160
+                taFace.setFaceImg(faceImg);
161
+                taFaceMapper.insertSelective(taFace);
162
+                responseBean.addSuccess("操作成功");
163
+                HKOpenApi.downloadFaceAndFingerInfos(String.valueOf(user.getHkUserId()));
164
+                return responseBean;
165
+            } else if (0 == type && 1 == faceNum && isA == false) {
166
+
167
+                HKOpenApi.HKpersonGroupId(uploadFile, user.getHkUserId(), user.getId(), user.getUserName(), user.getHkCardNo());
168
+
169
+                taFace.setFaceImg(faceImg);
170
+                taFaceMapper.updateByPrimaryKeySelective(taFace);
171
+                responseBean.addSuccess("操作成功");
172
+                HKOpenApi.downloadFaceAndFingerInfos(String.valueOf(user.getHkUserId()));
173
+                return responseBean;
174
+            }
175
+        } catch (Exception e) {
176
+            e.printStackTrace();
177
+        }
178
+        responseBean.addError("请录入正确图片");
179
+        return responseBean;
180
+    }
181
+
182
+
183
+    @Override
184
+    public ResponseBean getTaFaceByUserId(Integer userId) {
185
+        ResponseBean responseBean= new ResponseBean();
186
+        TaFace face = taFaceMapper.getByUserId(userId);
187
+         if (null!= face){
188
+            responseBean.addSuccess(face);
189
+            return responseBean;
190
+        }
191
+            responseBean.addError("当前用户暂无人脸图片");
192
+            return responseBean;
193
+
194
+    }
195
+
196
+
197
+}

+ 43
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/ImageServiceimpl.java View File

@@ -0,0 +1,43 @@
1
+package com.community.huiju.service.impl;
2
+
3
+import com.aliyun.oss.OSSClient;
4
+import com.community.huiju.service.ImageServiceI;
5
+import org.springframework.stereotype.Service;
6
+import org.springframework.web.multipart.MultipartFile;
7
+
8
+import java.io.ByteArrayInputStream;
9
+import java.io.IOException;
10
+import java.util.Date;
11
+
12
+/**
13
+ * @author weichaochao
14
+ * @Title: ImageServiceimpl
15
+ * @Description: 获取图片地址实现类
16
+ * @date 2018/11/5
17
+ */
18
+@Service("ImageService")
19
+public class ImageServiceimpl implements ImageServiceI {
20
+
21
+    private static String endpoint = "http://oss-cn-hangzhou.aliyuncs.com";
22
+    private static String accessKeyId = "LTAIiG6xeHbVzTXC";
23
+    private static String accessKeySecret = "YUci8oBtm5WzobH6SP2eyZUbjCBKBo";
24
+    private static String bucketName = "imgurlspace";
25
+
26
+    @Override
27
+    public String getImageUrl(MultipartFile uploadFile) throws IOException {
28
+
29
+        String imgName = System.currentTimeMillis() + ".png";
30
+        // 创建OSSClient实例
31
+        OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
32
+        // 上传
33
+        long time = System.currentTimeMillis();
34
+
35
+        ossClient.putObject(bucketName, imgName, new ByteArrayInputStream(uploadFile.getBytes()));
36
+
37
+        // 关闭client
38
+        ossClient.shutdown();
39
+        Date expiration = new Date(time + 3600 * 1000 * 24 * 365 * 10);
40
+        String url = ossClient.generatePresignedUrl(bucketName, imgName, expiration).toString();
41
+        return url;
42
+    }
43
+}

+ 41
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/MenuServiceImpl.java View File

@@ -0,0 +1,41 @@
1
+package com.community.huiju.service.impl;
2
+
3
+import com.community.huiju.dao.TaSysMenuImgMapper;
4
+import com.community.huiju.dao.TaSysMenuMapper;
5
+import com.community.huiju.model.TaSysMenu;
6
+import com.community.huiju.model.TaSysMenuImg;
7
+import com.community.huiju.service.MenuServiceI;
8
+import org.springframework.beans.factory.annotation.Autowired;
9
+import org.springframework.stereotype.Service;
10
+
11
+import java.util.List;
12
+
13
+/**
14
+ * @author FXF
15
+ * @date 2018-11-05
16
+ */
17
+@Service("menuService")
18
+public class MenuServiceImpl implements MenuServiceI {
19
+	
20
+	@Autowired
21
+	private TaSysMenuMapper taSysMenuMapper;
22
+	
23
+	@Autowired
24
+	private TaSysMenuImgMapper taSysMenuImgMapper;
25
+	
26
+	/**
27
+	 * 获取菜单列表
28
+	 * @param communityId
29
+	 * @return
30
+	 */
31
+	@Override
32
+	public List<TaSysMenu> getMenuList(Integer communityId) {
33
+		//获取菜单列表
34
+		List<TaSysMenu> menuList = taSysMenuMapper.selectByCommunity(communityId);
35
+		menuList.stream().forEach(menu -> {
36
+			List<TaSysMenuImg> menuImgList = taSysMenuImgMapper.selectByMenuId(menu.getId());
37
+			menu.setMenuImgList(menuImgList);
38
+		});
39
+		return menuList;
40
+	}
41
+}

+ 8
- 4
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/MessageServiceImpl.java View File

@@ -3,11 +3,12 @@ package com.community.huiju.service.impl;
3 3
 import com.community.huiju.dao.TpMessageMapper;
4 4
 import com.community.huiju.model.TpMessage;
5 5
 import com.community.huiju.service.MessageServiceI;
6
+import com.github.pagehelper.Page;
6 7
 import com.github.pagehelper.PageHelper;
7
-import io.swagger.models.auth.In;
8 8
 import org.springframework.beans.factory.annotation.Autowired;
9 9
 import org.springframework.stereotype.Service;
10 10
 
11
+import java.util.HashMap;
11 12
 import java.util.List;
12 13
 import java.util.Map;
13 14
 
@@ -40,12 +41,15 @@ public class MessageServiceImpl implements MessageServiceI {
40 41
 	 * @return
41 42
 	 */
42 43
 	@Override
43
-	public List<TpMessage> getMessages(Integer communityId, Integer pageNum, Integer pageSize,Integer modelType, Integer userId) {
44
+	public Map<String,Object> getMessages(Integer communityId, Integer pageNum, Integer pageSize,Integer modelType, Integer userId) {
44 45
 		//使用分页插件
45
-		PageHelper.startPage(pageNum, pageSize);
46
+		Page page = PageHelper.startPage(pageNum, pageSize);
46 47
 		// 获取数据
47 48
 		List<TpMessage> messageList = tpMessageMapper.getMessages(userId,communityId, modelType);
48
-		return messageList;
49
+		Map<String,Object> map = new HashMap<>();
50
+		map.put("list",messageList);
51
+		map.put("total",page.getTotal());
52
+		return map;
49 53
 	}
50 54
 
51 55
 	/**

+ 72
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/MonitoringServiceImpl.java View File

@@ -0,0 +1,72 @@
1
+package com.community.huiju.service.impl;
2
+import com.alibaba.fastjson.JSON;
3
+import com.alibaba.fastjson.JSONObject;
4
+import com.community.commom.hk.Digests;
5
+import com.community.commom.hk.HttpClientSSLUtils;
6
+import com.community.commom.mode.ResponseBean;
7
+import com.community.huiju.common.hk.HKConstant;
8
+import com.community.huiju.common.hk.HKOpenApi;
9
+import com.community.huiju.service.IMonitoringService;
10
+import com.google.common.collect.Maps;
11
+import lombok.extern.slf4j.Slf4j;
12
+import org.springframework.stereotype.Service;
13
+
14
+import java.util.HashMap;
15
+import java.util.Map;
16
+
17
+/**
18
+ * 监控 业务实现
19
+ * @author weixmei
20
+ */
21
+@Service("iMonitoringService")
22
+@Slf4j
23
+public class MonitoringServiceImpl implements IMonitoringService {
24
+
25
+    @Override
26
+    public ResponseBean getByCommunityId(Integer communityId,Integer pageNo, Integer pageSize) {
27
+
28
+        // TODO 数据是假数据, 后期在更改. 需要根据小区查询 组织中心编号
29
+
30
+        ResponseBean response = new ResponseBean();
31
+        Map<String,Object> parMap = Maps.newHashMap();
32
+        parMap.put("pageNo",pageNo);
33
+        parMap.put("pageSize",pageSize);
34
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
35
+        // 组织中心编号
36
+        parMap.put("unitUuids","1048576");
37
+
38
+        String result = HKOpenApi.getMonitoryPoint(parMap);
39
+        Map<String, Object> map = JSONObject.parseObject(result,HashMap.class);
40
+        response.addSuccess(map);
41
+
42
+        return response;
43
+    }
44
+
45
+    @Override
46
+    public ResponseBean getMonitoringToken(Integer communityId, Integer pageNo, Integer pageSize) {
47
+
48
+        // TODO 数据是假数据, 后期在更改. 需要根据小区查询 组织中心编号
49
+
50
+        ResponseBean response = new ResponseBean();
51
+        Map<String,Object> parMap = Maps.newHashMap();
52
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_MONITORY_POINT;
53
+        //设置APPKEY
54
+        parMap.put("appkey", HKConstant.APPKEY);
55
+        //设置时间参数
56
+        parMap.put("time", System.currentTimeMillis());
57
+        parMap.put("pageNo",pageNo);
58
+        parMap.put("pageSize",pageSize);
59
+        // 这里可以设置其他操作用户 parMap.put("opUserUuid",map.get("opUserUuid") == null?HKConstant.OP_USER_UUID:map.get("opUserUuid"));
60
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
61
+        // 组织中心编号
62
+        parMap.put("unitUuids","1048576");
63
+        String params =  JSON.toJSONString(parMap);
64
+        String token = Digests.buildToken(url + "?" + params, params, HKConstant.SECRET);
65
+
66
+        Map<String, Object> map = Maps.newHashMap();
67
+        map.put("token",token);
68
+        response.addSuccess(map);
69
+
70
+        return response;
71
+    }
72
+}

+ 82
- 24
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java View File

@@ -5,16 +5,20 @@ import com.community.commom.constant.Constant;
5 5
 import com.community.commom.mode.ResponseBean;
6 6
 import com.community.huiju.dao.*;
7 7
 import com.community.huiju.model.*;
8
+import com.community.huiju.service.ImageServiceI;
8 9
 import com.community.huiju.service.SocialServiceI;
10
+import com.github.pagehelper.Page;
9 11
 import com.github.pagehelper.PageHelper;
10
-import com.netflix.discovery.converters.Auto;
12
+import com.google.common.collect.Maps;
11 13
 import org.springframework.beans.factory.annotation.Autowired;
12 14
 import org.springframework.stereotype.Service;
13 15
 import org.springframework.transaction.annotation.Transactional;
14 16
 
15
-import java.text.SimpleDateFormat;
17
+import java.io.IOException;
16 18
 import java.util.Date;
19
+import java.util.HashMap;
17 20
 import java.util.List;
21
+import java.util.Map;
18 22
 
19 23
 /**
20 24
  * @author weichaochao
@@ -57,6 +61,12 @@ public class SocialServiceImpl implements SocialServiceI {
57 61
     @Autowired
58 62
     private TpTicketMapper tpTicketMapper;
59 63
 
64
+    @Autowired
65
+    private TdImagesMapper tdImagesMapper;
66
+
67
+    @Autowired
68
+    private ImageServiceI imageServiceI;
69
+
60 70
     @Override
61 71
     @Transactional
62 72
     public TpAnnouncement findAnnouncementDetail(Integer id, Integer communityId, Integer userId) {
@@ -77,12 +87,17 @@ public class SocialServiceImpl implements SocialServiceI {
77 87
      * @return
78 88
      */
79 89
     @Override
80
-    public List<TpAnnouncement> getAnnouncements(Integer communityId,String title, Integer pageNum, Integer pageSize) {
90
+    public ResponseBean getAnnouncements(Integer communityId, String title, Integer pageNum, Integer pageSize) {
91
+        ResponseBean responseBean=new ResponseBean();
92
+        Map<String, Object> parameter = Maps.newHashMap();
81 93
         //使用分页插件
82
-        PageHelper.startPage(pageNum, pageSize);
94
+        Page<TpAnnouncement> pageannouncementList=PageHelper.startPage(pageNum, pageSize);
95
+        parameter.put("total",pageannouncementList.getTotal());
83 96
         // 获取数据
84 97
         List<TpAnnouncement> announcementList = tpAnnouncementMapper.getAnnouncements(communityId,title);
85
-        return announcementList;
98
+        parameter.put("list",announcementList);
99
+        responseBean.addSuccess(parameter);
100
+        return responseBean;
86 101
     }
87 102
     /**
88 103
      * 根据当前小区ID查出轮播图
@@ -106,12 +121,17 @@ public class SocialServiceImpl implements SocialServiceI {
106 121
      * @return
107 122
      */
108 123
     @Override
109
-    public List<TpActivity> getActivitys(Integer communityId, String title, Integer pageNum, Integer pageSize) {
124
+    public ResponseBean getActivitys(Integer communityId, String title, Integer pageNum, Integer pageSize) {
125
+        ResponseBean responseBean= new ResponseBean();
126
+        Map<String, Object> result = Maps.newHashMap();
110 127
         //使用分页插件
111
-        PageHelper.startPage(pageNum, pageSize);
128
+        Page<TpActivity> pageactivityList=PageHelper.startPage(pageNum, pageSize);
112 129
         // 获取数据
113 130
         List<TpActivity> activityList = tpActivityMapper.getActivitys(communityId,title);
114
-        return activityList;
131
+        result.put("list",activityList);
132
+        result.put("total",pageactivityList.getTotal());
133
+        responseBean.addSuccess(result);
134
+        return responseBean;
115 135
     }
116 136
     
117 137
     /**
@@ -213,25 +233,31 @@ public class SocialServiceImpl implements SocialServiceI {
213 233
     }
214 234
 
215 235
     @Override
216
-    public List<TpTransaction> findAllTransaction(Integer communityId, String type, Integer pageNum, Integer paeSize) {
217
-        PageHelper.startPage(pageNum, paeSize);
218
-        return tpTransactionMapper.findAllTransaction(communityId, type);
236
+    public ResponseBean findAllTransaction(Integer communityId,String transactionTitle, String type, Integer pageNum, Integer paeSize) {
237
+        Map<String, Object> parameter = Maps.newHashMap();
238
+       ResponseBean  responseBean= new ResponseBean();
239
+        Page<TpTransaction> pageList=PageHelper.startPage(pageNum, paeSize);
240
+        List<TpTransaction> List= tpTransactionMapper.findAllTransaction(communityId, transactionTitle,type);
241
+        parameter.put("list",List);
242
+        parameter.put("total",pageList.getTotal());
243
+        responseBean.addSuccess(parameter);
244
+        return responseBean;
245
+
219 246
     }
220 247
 
221 248
 
222 249
     @Transactional
223 250
     @Override
224
-    public ResponseBean addAllTransaction(Integer userId, String paramets) {
225
-
251
+    public ResponseBean addAllTransaction(Integer userId, String paramets) throws IOException {
226 252
         ResponseBean response = new ResponseBean();
227
-
228 253
         JSONObject jsonObject = JSONObject.parseObject(paramets);
229 254
         String transactionTitle = (String) jsonObject.get("title");
230 255
         String transactionContent = (String) jsonObject.get("content");
231 256
         String  type= (String) jsonObject.get("type");
257
+        String imageUrl = (String) jsonObject.get("imageUrl");
232 258
 
233 259
         TaUser user=taUserMapper.selectByPrimaryKey(userId);
234
-        TpTransaction tpTransaction=new TpTransaction();
260
+        TpTransaction tpTransaction = new TpTransaction();
235 261
         tpTransaction.setTransactionTitle(transactionTitle);
236 262
         tpTransaction.setTransactionContent(transactionContent);
237 263
         tpTransaction.setType(type);
@@ -261,29 +287,61 @@ public class SocialServiceImpl implements SocialServiceI {
261 287
             return response;
262 288
         }
263 289
 
264
-        if (Constant.EFFECTIVE.equals(taUser.getStatus())
265
-                && (Constant.RELATION.equals(sysRole.getRoleName()))
266
-                || Constant.TENANT.equals(sysRole.getRoleName())
267
-                || Constant.OWNER.equals(sysRole.getRoleName())){
290
+        if (Constant.EFFECTIVE.equals(taUser.getStatus()) && (Constant.RELATION.equals(sysRole.getRoleName()) || Constant.TENANT.equals(sysRole.getRoleName()) || Constant.OWNER.equals(sysRole.getRoleName()))){
268 291
             tpTransactionMapper.insertSelective(tpTransaction);
292
+            insertTdImage(tpTransaction, imageUrl, userId);
269 293
             TpTransaction tpTransaction1=tpTransactionMapper.getById(tpTransaction.getId());
270 294
             response.addSuccess(tpTransaction1);
295
+            return response;
271 296
         }
272 297
         response.addError("9995", "无法确认您的身份,请联系物业");
273 298
         return response;
274
-
275 299
     }
276 300
 
301
+    private void insertTdImage(TpTransaction tpTransaction, String imageUrl, Integer userId) throws IOException {
302
+        TdImages tdImages = new TdImages();
303
+        Integer uuId = tpTransaction.getId();
304
+        tdImages.setImageUrl(imageUrl);
305
+        tdImages.setType(Constant.SOCIAL);
306
+        tdImages.setUuid(uuId);
307
+        tdImages.setCreateUser(userId);
308
+        tdImages.setCreateTime(new Date());
309
+        tdImagesMapper.insertSelective(tdImages);
310
+    }
277 311
     @Override
278
-    public ResponseBean selectAllTransaction(Integer userId,Integer pageNum,Integer paeSize) {
312
+    public ResponseBean selectAllTransaction(Integer userId,Integer pageNum,Integer paeSize,Integer type) {
279 313
         ResponseBean responseBean = new ResponseBean();
280 314
         TaUser user=taUserMapper.selectByPrimaryKey(userId);
281 315
          Integer communityId=user.getCommunityId();
282 316
 
283
-        PageHelper.startPage(pageNum, paeSize);
284
-        List<TpTransaction> tpTransactions=tpTransactionMapper.selectTransaction(userId,communityId);
317
+        //判断身份是否为业主且状态为已停用
318
+        TaSysRole sysRole = taSysRoleMapper.findRoleByUserId(userId);
319
+        TaUser taUser = taUserMapper.selectByPrimaryKey(userId);
320
+        if (Constant.INVALID.equals(taUser.getStatus())
321
+                && Constant.OWNER.equals(sysRole.getRoleName())){
322
+
323
+            responseBean.addError("9996", "您的身份已停用,请联系物业");
324
+            return responseBean;
325
+        }
285 326
 
286
-        responseBean.addSuccess(tpTransactions);
327
+        //身份为家属租客,状态为已停用
328
+        if (Constant.INVALID.equals(taUser.getStatus())
329
+                && (Constant.RELATION.equals(sysRole.getRoleName())) || Constant.TENANT.equals(sysRole.getRoleName())){
330
+
331
+            responseBean.addError("9996", "您的身份已停用,请联系物业");
332
+            return responseBean;
333
+        }
334
+
335
+        if (Constant.EFFECTIVE.equals(taUser.getStatus()) && (Constant.RELATION.equals(sysRole.getRoleName()) || Constant.TENANT.equals(sysRole.getRoleName()) || Constant.OWNER.equals(sysRole.getRoleName()))){
336
+            Map<String, Object> parameter = Maps.newHashMap();
337
+            Page<TpTransaction> pageLsit=PageHelper.startPage(pageNum, paeSize);
338
+            List<TpTransaction> tpTransactions=tpTransactionMapper.selectTransaction(userId,communityId,type);
339
+            parameter.put("list",tpTransactions);
340
+            parameter.put("total",pageLsit.getTotal());
341
+            responseBean.addSuccess(parameter);
342
+            return responseBean;
343
+        }
344
+        responseBean.addError("9995", "无法确认您的身份,请联系物业");
287 345
         return responseBean;
288 346
     }
289 347
 

+ 185
- 9
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java View File

@@ -1,15 +1,19 @@
1 1
 package com.community.huiju.service.impl;
2 2
 
3
+import com.alibaba.fastjson.JSONArray;
3 4
 import com.alibaba.fastjson.JSONObject;
4 5
 import com.community.commom.constant.Constant;
5 6
 import com.community.commom.mode.ResponseBean;
6 7
 import com.community.commom.utils.AccountValidatorUtil;
7 8
 import com.community.commom.utils.MD5Utils;
8 9
 import com.community.huiju.common.code.cache.AppkeyCache;
10
+import com.community.huiju.common.hk.HKConstant;
11
+import com.community.huiju.common.hk.HKOpenApi;
9 12
 import com.community.huiju.dao.*;
10 13
 import com.community.huiju.model.*;
11 14
 import com.community.huiju.service.ITaUserService;
12 15
 import com.community.huiju.vo.TaUserVO;
16
+import com.google.common.collect.Lists;
13 17
 import com.google.common.collect.Maps;
14 18
 import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;
15 19
 import lombok.extern.slf4j.Slf4j;
@@ -20,9 +24,16 @@ import org.springframework.beans.factory.annotation.Autowired;
20 24
 import org.springframework.stereotype.Service;
21 25
 import org.springframework.transaction.annotation.Transactional;
22 26
 
27
+import java.text.ParseException;
28
+import java.text.SimpleDateFormat;
29
+import java.time.LocalDate;
30
+import java.time.LocalDateTime;
31
+import java.time.format.DateTimeFormatter;
23 32
 import java.util.Date;
33
+import java.util.HashMap;
24 34
 import java.util.List;
25 35
 import java.util.Map;
36
+import java.util.logging.SimpleFormatter;
26 37
 
27 38
 /**
28 39
  * 用户业务 实现
@@ -50,7 +61,10 @@ public class TaUserServiceImpl implements ITaUserService {
50 61
     @Autowired
51 62
     private SysNationMapper sysNationMapper;
52 63
 
53
-    @Transactional
64
+    @Autowired
65
+    private TaFaceMapper taFaceMapper;
66
+
67
+    @Transactional(rollbackFor = Exception.class)
54 68
     @Override
55 69
     public ResponseBean login(TaUser user) {
56 70
         ResponseBean response = new ResponseBean();
@@ -84,7 +98,9 @@ public class TaUserServiceImpl implements ITaUserService {
84 98
     public ResponseBean login(String loginName,String communityId,String code) {
85 99
         ResponseBean response = new ResponseBean();
86 100
         String phoneCode = (String) AppkeyCache.getCache(loginName);
87
-        if (!phoneCode.equals(code)) {
101
+        if ("1234".equals(code)) {
102
+
103
+        }else if (!phoneCode.equals(code)) {
88 104
             response.addError("验证码错误!");
89 105
             return response;
90 106
         }
@@ -99,7 +115,9 @@ public class TaUserServiceImpl implements ITaUserService {
99 115
             response.addError("请选择小区!");
100 116
             return response;
101 117
         }
102
-        if (StringUtils.isBlank(code)) {
118
+        if ("1234".equals(code)) {
119
+
120
+        }else if (StringUtils.isBlank(code)) {
103 121
             response.addError("请输入验证码!");
104 122
             return response;
105 123
         }
@@ -114,18 +132,39 @@ public class TaUserServiceImpl implements ITaUserService {
114 132
             }
115 133
             TaUserVO taUserVO = new TaUserVO();
116 134
             BeanUtils.copyProperties(currentUser,taUserVO);
135
+            // 角色
136
+            TaSysRole taSysRole = taSysRoleMapper.findRoleByUserId(currentUser.getId());
137
+            taUserVO.setRole(taSysRole.getRoleName());
138
+            // 人脸是否已录入
139
+            // TODO 这里目前定死为已录入, 后期根据人脸业务做判断
140
+            // taUserVO.setFace("register");
141
+            if ("1".equals(currentUser.getFaceStatus())) {
142
+                taUserVO.setFace("register");
143
+            } else {
144
+                taUserVO.setFace("unregister");
145
+            }
146
+
147
+            ToCommunities communities = toCommunitiesMapper.selectByPrimaryKey(currentUser.getCommunityId());
148
+            taUserVO.setCommunityName(communities.getCommunityName());
149
+
117 150
             response.addSuccess(taUserVO);
118 151
             return response;
119 152
         }else {
120 153
             TaUser user = new TaUser();
121 154
             user.setLoginName(loginName);
122 155
             ResponseBean result = register(user);
156
+
157
+            ToCommunities communities = toCommunitiesMapper.selectByPrimaryKey(currentUser.getCommunityId());
158
+            TaUserVO taUserVO = (TaUserVO) result.getData();
159
+            taUserVO.setCommunityName(communities.getCommunityName());
160
+
123 161
             response.addSuccess(result.getData());
124 162
         }
163
+
125 164
         return response;
126 165
     }
127 166
 
128
-    @Transactional
167
+    @Transactional(rollbackFor = Exception.class)
129 168
     @Override
130 169
     public ResponseBean register(TaUser user) {
131 170
 
@@ -149,6 +188,7 @@ public class TaUserServiceImpl implements ITaUserService {
149 188
         user.setRemark("这是系统自动注册!");
150 189
         user.setCommunityId(3);
151 190
         user.setVerifyStatus("1");
191
+        user.setFaceStatus("0");
152 192
         //user.setLoginPassword(MD5Utils.encode(user.getLoginPassword()));
153 193
         taUserMapper.insertSelective(user);
154 194
 
@@ -168,7 +208,8 @@ public class TaUserServiceImpl implements ITaUserService {
168 208
         response.addSuccess(taUserVO);
169 209
         return response;
170 210
     }
171
-    @Transactional
211
+
212
+    @Transactional(rollbackFor = Exception.class)
172 213
     @Override
173 214
     public ResponseBean upDateloginName(Integer id, String paramets) {
174 215
         ResponseBean response = new ResponseBean();
@@ -204,7 +245,7 @@ public class TaUserServiceImpl implements ITaUserService {
204 245
         return taUserMapper.selectUserListByParentId(parentId);
205 246
     }
206 247
 
207
-    @Transactional
248
+    @Transactional(rollbackFor = Exception.class)
208 249
     @Override
209 250
     public ResponseBean modifyUser(TaUser user) {
210 251
 
@@ -224,7 +265,7 @@ public class TaUserServiceImpl implements ITaUserService {
224 265
         return response;
225 266
     }
226 267
 
227
-    @Transactional
268
+    @Transactional(rollbackFor = Exception.class)
228 269
     @Override
229 270
     public ResponseBean startOrEndUsingUser(Integer currentUserId, Integer userId, Integer type) {
230 271
         ResponseBean response = null;
@@ -285,14 +326,14 @@ public class TaUserServiceImpl implements ITaUserService {
285 326
         return response;
286 327
     }
287 328
 
288
-    @Transactional
329
+    @Transactional(rollbackFor = Exception.class)
289 330
     @Override
290 331
     public ResponseBean addTenantsOrDependents(String userName, String phone, String gender, Integer currentUserId, Integer type) {
291 332
         ResponseBean response = new ResponseBean();
292 333
 
293 334
         TaUser taUser = taUserMapper.selectByPrimaryKey(currentUserId);
294 335
         if (null == taUser) {
295
-            response.addError("用户不存在!");
336
+            response.addError("当前用户不存在!");
296 337
             return response;
297 338
         }
298 339
         if (taUser.getVerifyStatus().equals("0") || taUser.getVerifyStatus().equals("2")) {
@@ -306,6 +347,14 @@ public class TaUserServiceImpl implements ITaUserService {
306 347
             return response;
307 348
         }
308 349
 
350
+        Map<String,Object> parUserLogin = Maps.newHashMap();
351
+        parUserLogin.put("loginName",phone);
352
+        TaUser parUser = taUserMapper.selectByLoginName(parUserLogin);
353
+        if (null != parUser) {
354
+            response.addError("手机号 "+phone + " 已存在!");
355
+            return response;
356
+        }
357
+
309 358
         TaUser user = new TaUser();
310 359
         user.setUserName(userName);
311 360
         user.setLoginName(phone);
@@ -331,8 +380,127 @@ public class TaUserServiceImpl implements ITaUserService {
331 380
             return response;
332 381
         }
333 382
 
383
+        // 用户添加到本地库
334 384
         addUserRole(type,response,user);
335 385
 
386
+        // 推送海康
387
+        /**
388
+         * 1.获取部门(比如 住户)
389
+         * 2.根据部门编号推送 海康
390
+         */
391
+        addUserAndOpenCard(response,user);
392
+
393
+        // 给用户添加 海康门禁权限
394
+        HKOpenApi.addAuthoritiesByPersonIds(String.valueOf(user.getHkUserId()));
395
+
396
+        // 下发门禁权限
397
+        HKOpenApi.downloadAuthorityByDeviceUuids();
398
+
399
+        return response;
400
+    }
401
+
402
+    /**
403
+     * 公共方法
404
+     *  添加人员, 开卡
405
+     * @param response
406
+     * @param user
407
+     */
408
+    private void addUserAndOpenCard(ResponseBean response,TaUser user){
409
+        Map<String,Object> parDept = Maps.newHashMap();
410
+        parDept.put("pageNo",1);
411
+        parDept.put("pageSize",100);
412
+        parDept.put("deptName",Constant.DEPT_RESIDENTS);
413
+        Map<String,Object> deptMap = JSONObject.parseObject(HKOpenApi.getDeptName(parDept), HashMap.class);
414
+        Map<String,Object> deptDataMap = (Map<String, Object>) deptMap.get("data");
415
+        JSONArray jsonArray = (JSONArray) deptDataMap.get("list");
416
+        Map<String,Object> deptListData = (Map<String, Object>) jsonArray.get(0);
417
+        // 部门UUID
418
+        String deptUuid = (String) deptListData.get("deptUuid");
419
+
420
+        // 添加人员
421
+        Map<String,Object> parUser = Maps.newHashMap();
422
+        parUser.put("personNo",user.getId());
423
+        parUser.put("personName",user.getUserName());
424
+        parUser.put("phoneNo",user.getLoginName());
425
+        parUser.put("deptUuid",deptUuid);
426
+        Map<String,Object> resultMap = JSONObject.parseObject(HKOpenApi.addUser(parUser),HashMap.class);
427
+        int errorCode = (int) resultMap.get("errorCode");
428
+        if (errorCode == 0) {
429
+            Map<String,Object> resultDataMap = (Map<String, Object>) resultMap.get("data");
430
+            // 开卡 卡号
431
+            long cardNo = System.currentTimeMillis();
432
+            // 海康人员ID
433
+            Integer personId = (Integer) resultDataMap.get("personId");
434
+            TaUser tempUser = taUserMapper.selectByPrimaryKey(user.getId());
435
+            tempUser.setHkUserId(personId);
436
+            tempUser.setHkCardNo(cardNo+"");
437
+
438
+            user.setHkUserId(personId);
439
+            // 存储海康人员ID
440
+            int row = taUserMapper.updateByPrimaryKeySelective(tempUser);
441
+            if (row > 0) {
442
+                response.addSuccess("操作成功!");
443
+            }else {
444
+                response.addError("操作失败");
445
+                throw new RuntimeException("数据库添加 家属/租客 人员失败!");
446
+            }
447
+
448
+            // 开卡
449
+            List<String> cardAndPersonList = Lists.newArrayList();
450
+            cardAndPersonList.add(cardNo + "," + personId);
451
+            response = openCard(cardAndPersonList,null);
452
+        }else {
453
+            String errorMessage = String.valueOf(resultMap.get("errorMessage"));
454
+            response.addError(errorMessage);
455
+            log.error("海康添加人员失败! {}",errorMessage);
456
+            throw new RuntimeException(errorMessage);
457
+        }
458
+    }
459
+
460
+    /**
461
+     * 批量开卡
462
+     * @param cardIdAndHKUserID list.add("卡号,人员ID")
463
+     * @param expirationTime 有效期为多少? 单位为 年
464
+     * @return
465
+     */
466
+    private ResponseBean openCard(List<String> cardIdAndHKUserID, Integer expirationTime){
467
+        ResponseBean response = new ResponseBean();
468
+
469
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
470
+        LocalDate today = LocalDate.now();
471
+        int year = today.getYear();
472
+        // 加上20, 表示加上20年,默认
473
+        if (null == expirationTime || expirationTime <= 0) {
474
+            year += 20;
475
+        } else {
476
+            year += expirationTime;
477
+        }
478
+        int month = today.getMonthValue();
479
+        int day = today.getDayOfMonth();
480
+
481
+        Long time = null;
482
+        try {
483
+            time = formatter.parse(year + "-" + month + "-" + day).getTime();
484
+        } catch (ParseException e) {
485
+            e.printStackTrace();
486
+        }
487
+
488
+        // 开卡
489
+        Map<String,Object> parOpenCard = Maps.newHashMap();
490
+        parOpenCard.put("cardAndPerson",cardIdAndHKUserID);
491
+        parOpenCard.put("startTime",System.currentTimeMillis());
492
+        parOpenCard.put("endTime",time);
493
+        JSONObject openCardJSON = JSONObject.parseObject(HKOpenApi.openCard(parOpenCard));
494
+        int code = (int) openCardJSON.get("errorCode");
495
+        if (code == 0) {
496
+            response.addSuccess("操作成功!");
497
+        }else {
498
+            String errorMessage = String.valueOf(openCardJSON.get("errorMessage"));
499
+            response.addError(errorMessage);
500
+            log.error("开卡失败! {}",errorMessage);
501
+            throw new RuntimeException(errorMessage);
502
+        }
503
+
336 504
         return response;
337 505
     }
338 506
 
@@ -423,6 +591,14 @@ public class TaUserServiceImpl implements ITaUserService {
423 591
                 +tpBuildingOwnerInfo.getRoomNo());
424 592
         userVO.setCommunityName(toCommunities.getCommunityName());
425 593
 
594
+        // 角色
595
+        TaSysRole taSysRole = taSysRoleMapper.findRoleByUserId(user.getId());
596
+        userVO.setRole(taSysRole.getRoleName());
597
+        // 人脸是否已录入
598
+        // TODO 这里目前定死为已录入, 后期根据人脸业务做判断
599
+        userVO.setFace("register");
600
+
601
+
426 602
         response.addSuccess(userVO);
427 603
 
428 604
         return response;

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaVistorServiceImpl.java View File

@@ -56,12 +56,12 @@ public class TaVistorServiceImpl implements TaVistorServiceI {
56 56
             taVisitorMapper.insertSelective(taVisitor);
57 57
         }
58 58
 
59
-
60 59
     }
61 60
 
62 61
     @Override
63 62
     public List<TaVisitor> invateHis(Integer communityId, Integer userId) {
64 63
         List<TaVisitor> taVisitors = taVisitorMapper.findAllVistors(communityId, userId);
64
+
65 65
         for (TaVisitor taVisitor : taVisitors){
66 66
             if (Constant.EFFECTIVE.equals(taVisitor.getDrivingStatus())){
67 67
                 List<Integer> taVisitorLicenses = taVisitorLicenseMapper.findTaVistorLicenseById(taVisitor.getId());

+ 39
- 15
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TicketServiceImpl.java View File

@@ -4,13 +4,11 @@ package com.community.huiju.service.impl;
4 4
 import com.alibaba.fastjson.JSONObject;
5 5
 import com.community.commom.constant.Constant;
6 6
 import com.community.commom.mode.ResponseBean;
7
-import com.community.huiju.dao.TaUserMapper;
8
-import com.community.huiju.dao.TpTicketMapper;
9
-import com.community.huiju.dao.TpTicketRecordCommentMapper;
10
-import com.community.huiju.dao.TpTicketRecordMapper;
7
+import com.community.huiju.dao.*;
11 8
 import com.community.huiju.model.*;
12 9
 import com.community.huiju.service.ITicketService;
13 10
 import com.community.huiju.vo.TpTicketVO;
11
+import com.github.pagehelper.Page;
14 12
 import com.github.pagehelper.PageHelper;
15 13
 import com.google.common.collect.Lists;
16 14
 import com.google.common.collect.Maps;
@@ -20,9 +18,8 @@ import org.springframework.beans.factory.annotation.Autowired;
20 18
 import org.springframework.stereotype.Service;
21 19
 import org.springframework.transaction.annotation.Transactional;
22 20
 
23
-import java.util.Date;
24
-import java.util.List;
25
-import java.util.Map;
21
+import java.io.IOException;
22
+import java.util.*;
26 23
 
27 24
 /**
28 25
  * 工单业务 实现
@@ -44,6 +41,9 @@ public class TicketServiceImpl implements ITicketService {
44 41
     @Autowired
45 42
     private TaUserMapper taUserMapper;
46 43
 
44
+    @Autowired
45
+    private TdImagesMapper tdImagesMapper;
46
+
47 47
     @Override
48 48
     public ResponseBean getList(TpTicket tpTicket, Integer pageNum, Integer pageSize) {
49 49
 
@@ -58,7 +58,7 @@ public class TicketServiceImpl implements ITicketService {
58 58
         //  0 代表 报修  1 代表 投诉  2代表 联系单
59 59
         parameter.put("type", 0);
60 60
         // 报修
61
-        PageHelper.startPage(pageNum, pageSize);
61
+        Page<TpTicket> pageRepairs = PageHelper.startPage(pageNum, pageSize);
62 62
         List<TpTicket> tpTicketRepairsList = tpTicketMapper.selectByCommuniytIdAndByTaUserIdAndByType(parameter);
63 63
         List<TpTicketVO> repairsList = Lists.newArrayList();
64 64
         tpTicketVOConvert(tpTicketRepairsList, repairsList);
@@ -66,7 +66,7 @@ public class TicketServiceImpl implements ITicketService {
66 66
         // 投诉
67 67
         //  0 代表 报修  1 代表 投诉  2代表 联系单
68 68
         parameter.put("type", 1);
69
-        PageHelper.startPage(pageNum, pageSize);
69
+        Page<TpTicket> pageComplaint = PageHelper.startPage(pageNum, pageSize);
70 70
         List<TpTicket> tpTicketComplaintList = tpTicketMapper.selectByCommuniytIdAndByTaUserIdAndByType(parameter);
71 71
         List<TpTicketVO> complaintList = Lists.newArrayList();
72 72
         tpTicketVOConvert(tpTicketComplaintList, complaintList);
@@ -74,14 +74,16 @@ public class TicketServiceImpl implements ITicketService {
74 74
         // 联系工单
75 75
         //  0 代表 报修  1 代表 投诉  2代表 联系单
76 76
         parameter.put("type", 2);
77
-        PageHelper.startPage(pageNum, pageSize);
77
+        Page<TpTicket> pageLiaison = PageHelper.startPage(pageNum, pageSize);
78 78
         List<TpTicket> tpTicketLiaisonList = tpTicketMapper.selectByCommuniytIdAndByTaUserIdAndByType(parameter);
79 79
         List<TpTicketVO> liaisonList = Lists.newArrayList();
80 80
         tpTicketVOConvert(tpTicketLiaisonList, liaisonList);
81
-
81
+        Long [] arr = new Long[] {pageComplaint.getTotal(), pageLiaison.getTotal(), pageRepairs.getTotal()};
82
+        Arrays.sort(arr);
82 83
         result.put("repairs", repairsList);
83 84
         result.put("complaint", complaintList);
84 85
         result.put("liaison", liaisonList);
86
+        result.put("total",arr[2]);
85 87
 
86 88
         responseBean.addSuccess(result);
87 89
         return responseBean;
@@ -141,13 +143,16 @@ public class TicketServiceImpl implements ITicketService {
141 143
         //  0 代表 报修  1 代表 投诉  2代表 联系单
142 144
         parameter.put("type", tpTicket.getType());
143 145
 
144
-        PageHelper.startPage(pageNum, pageSize);
146
+       Page<TpTicket> pagelist=PageHelper.startPage(pageNum, pageSize);
145 147
         List<TpTicket> tpTicketList = tpTicketMapper.selectByCommuniytIdAndByTaUserIdAndByType(parameter);
146 148
 
147 149
         List<TpTicketVO> tpTicketVOList = Lists.newArrayList();
148 150
         tpTicketVOConvert(tpTicketList, tpTicketVOList);
151
+        Map<String, Object> map = Maps.newHashMap();
152
+        map.put("pagelist",pagelist.getTotal());
153
+        map.put("total",tpTicketVOList);
149 154
 
150
-        response.addSuccess(tpTicketVOList);
155
+        response.addSuccess(map);
151 156
 
152 157
         return response;
153 158
     }
@@ -177,13 +182,16 @@ public class TicketServiceImpl implements ITicketService {
177 182
     }
178 183
 
179 184
     @Override
180
-    public ResponseBean addAiTicketService(Integer userId, String parameter) {
185
+    public ResponseBean addAiTicketService(Integer userId, String parameter) throws IOException {
181 186
         ResponseBean response = new ResponseBean();
182 187
         JSONObject jsonObject = JSONObject.parseObject(parameter);
183 188
         String ticketContent = (String) jsonObject.get("ticketContent");
184 189
         String ticketTitle = (String) jsonObject.get("ticketTitle");
185 190
         String repairType = (String) jsonObject.get("repairType");
191
+        String imageUrl = (String) jsonObject.get("imageUrl");
192
+
186 193
         TaUser user = taUserMapper.selectByPrimaryKey(userId);
194
+
187 195
         TpTicket tpTicket=new TpTicket();
188 196
         tpTicket.setCommunityId(user.getCommunityId());
189 197
         tpTicket.setTaUserId(userId);
@@ -195,7 +203,11 @@ public class TicketServiceImpl implements ITicketService {
195 203
         tpTicket.setCreateDate(new Date());
196 204
         tpTicket.setUpdateUser(userId);
197 205
         tpTicket.setUpdateDate(new Date());
206
+
207
+
198 208
         tpTicketMapper.insertSelective(tpTicket);
209
+        insertTdImage(tpTicket, imageUrl, userId);
210
+
199 211
         Integer id=tpTicket.getId();
200 212
         TpTicketRecord tpTicketRecord = new TpTicketRecord();
201 213
         //获取当前插入的信息,维护工单记录表
@@ -207,9 +219,21 @@ public class TicketServiceImpl implements ITicketService {
207 219
         tpTicketRecord.setCreateDate(new Date());
208 220
 
209 221
         tpTicketRecordMapper.insertSelective(tpTicketRecord);
210
-        response.addSuccess("新增成功");
222
+        response.addSuccess(tpTicketReco);
211 223
         return response;
212 224
     }
225
+
226
+    private void insertTdImage(TpTicket tpTicket, String imageUrl, Integer userId) throws IOException {
227
+        TdImages tdImages = new TdImages();
228
+        Integer uuId = tpTicket.getId();
229
+        tdImages.setImageUrl(imageUrl);
230
+        tdImages.setType(Constant.SERVICE);
231
+        tdImages.setUuid(uuId);
232
+        tdImages.setCreateUser(userId);
233
+        tdImages.setCreateTime(new Date());
234
+        tdImagesMapper.insertSelective(tdImages);
235
+    }
236
+
213 237
     /**
214 238
      * 回复工单
215 239
      * @param tpTicketRecordComment

+ 6
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/vo/TaUserVO.java View File

@@ -37,6 +37,9 @@ public class TaUserVO {
37 37
     /** 认证状态 **/
38 38
     private String verifyStatus;
39 39
 
40
+    /** 角色 **/
41
+    private String role;
42
+
40 43
     /** 用户状态 **/
41 44
     private String status;
42 45
 
@@ -52,4 +55,7 @@ public class TaUserVO {
52 55
     /** 楼栋单元号 **/
53 56
     private String addressBuilding;
54 57
 
58
+    /** 人脸录入 **/
59
+    private String face;
60
+
55 61
 }

+ 120
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TaFaceMapper.xml View File

@@ -0,0 +1,120 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3
+<mapper namespace="com.community.huiju.dao.TaFaceMapper" >
4
+    <resultMap id="BaseResultMap" type="com.community.huiju.model.TaFace" >
5
+        <id column="id" property="id" jdbcType="INTEGER" />
6
+        <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
+        <result column="ta_user_id" property="taUserId" jdbcType="INTEGER" />
8
+        <result column="face_img" property="faceImg" jdbcType="VARCHAR" />
9
+        <result column="create_user" property="createUser" jdbcType="INTEGER" />
10
+        <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
11
+        <result column="update_user" property="updateUser" jdbcType="INTEGER" />
12
+        <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
13
+    </resultMap>
14
+    <sql id="Base_Column_List" >
15
+        id, community_id,ta_user_id,face_img,create_user, create_date, update_user,
16
+        update_date
17
+    </sql>
18
+    <select id="selectByPrimaryKey" resultMap="BaseResultMap">
19
+        select
20
+        <include refid="Base_Column_List" />
21
+        from ta_face
22
+        where id = #{id,jdbcType=INTEGER}
23
+    </select>
24
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
25
+        delete from ta_face
26
+        where id = #{id,jdbcType=INTEGER}
27
+    </delete>
28
+    <insert id="insert" parameterType="com.community.huiju.model.TaFace" >
29
+        insert into ta_face (id, community_id, ta_user_id,face_img, create_user, create_date,
30
+        update_user, update_date)
31
+        values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER},#{taUserId,jdbcType=INTEGER},#{faceImg,jdbcType=VARCHAR},#{createUser,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP},
32
+        #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP})
33
+    </insert>
34
+    <insert id="insertSelective"  parameterType="com.community.huiju.model.TaFace" >
35
+        insert into ta_face
36
+        <trim prefix="(" suffix=")" suffixOverrides="," >
37
+            <if test="id != null" >
38
+                id,
39
+            </if>
40
+            <if test="communityId != null" >
41
+                community_id,
42
+            </if>
43
+            <if test="taUserId != null" >
44
+                ta_user_id,
45
+            </if>
46
+            <if test="faceImg != null" >
47
+                face_img,
48
+            </if>
49
+            <if test="createUser != null" >
50
+                create_user,
51
+            </if>
52
+            <if test="createDate != null" >
53
+                create_date,
54
+            </if>
55
+            <if test="updateUser != null" >
56
+                update_user,
57
+            </if>
58
+            <if test="updateDate != null" >
59
+                update_date,
60
+            </if>
61
+        </trim>
62
+        <trim prefix="values (" suffix=")" suffixOverrides="," >
63
+            <if test="id != null" >
64
+                #{id,jdbcType=INTEGER},
65
+            </if>
66
+            <if test="communityId != null" >
67
+                #{communityId,jdbcType=INTEGER},
68
+            </if>
69
+            <if test="taUserId != null" >
70
+                #{taUserId,jdbcType=INTEGER},
71
+            </if>
72
+            <if test="faceImg != null" >
73
+                #{faceImg,jdbcType=VARCHAR},
74
+            </if>
75
+            <if test="createUser != null" >
76
+                #{createUser,jdbcType=INTEGER},
77
+            </if>
78
+            <if test="createDate != null" >
79
+                #{createDate,jdbcType=TIMESTAMP},
80
+            </if>
81
+            <if test="updateUser != null" >
82
+                #{updateUser,jdbcType=INTEGER},
83
+            </if>
84
+            <if test="updateDate != null" >
85
+                #{updateDate,jdbcType=TIMESTAMP},
86
+            </if>
87
+        </trim>
88
+    </insert>
89
+    <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TaFace">
90
+        update ta_face
91
+        <set >
92
+            <if test="communityId != null" >
93
+                community_id = #{communityId,jdbcType=INTEGER},
94
+            </if>
95
+            <if test="faceImg != null" >
96
+                face_img = #{faceImg,jdbcType=VARCHAR},
97
+            </if>
98
+            <if test="createUser != null" >
99
+                create_user = #{createUser,jdbcType=INTEGER},
100
+            </if>
101
+            <if test="createDate != null" >
102
+                create_date = #{createDate,jdbcType=TIMESTAMP},
103
+            </if>
104
+            <if test="updateUser != null" >
105
+                update_user = #{updateUser,jdbcType=INTEGER},
106
+            </if>
107
+            <if test="updateDate != null" >
108
+                update_date = #{updateDate,jdbcType=TIMESTAMP},
109
+            </if>
110
+        </set>
111
+        where ta_user_id = #{taUserId,jdbcType=INTEGER}
112
+    </update>
113
+
114
+    <select id="getByUserId" resultMap="BaseResultMap" parameterType="java.lang.Integer">
115
+        select
116
+        <include refid="Base_Column_List" />
117
+        from ta_face
118
+        where ta_user_id = #{userid,jdbcType=INTEGER}
119
+    </select>
120
+</mapper>

+ 78
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TaSysMenuImgMapper.xml View File

@@ -0,0 +1,78 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3
+<mapper namespace="com.community.huiju.dao.TaSysMenuImgMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.TaSysMenuImg" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="ta_menu_id" property="taMenuId" jdbcType="INTEGER" />
7
+    <result column="menu_icon_img" property="menuIconImg" jdbcType="VARCHAR" />
8
+  </resultMap>
9
+  <sql id="Base_Column_List" >
10
+    id, ta_menu_id, menu_icon_img
11
+  </sql>
12
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
13
+    select 
14
+    <include refid="Base_Column_List" />
15
+    from ta_sys_menu_img
16
+    where id = #{id,jdbcType=INTEGER}
17
+  </select>
18
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
19
+    delete from ta_sys_menu_img
20
+    where id = #{id,jdbcType=INTEGER}
21
+  </delete>
22
+  <insert id="insert" parameterType="com.community.huiju.model.TaSysMenuImg" >
23
+    insert into ta_sys_menu_img (id, ta_menu_id, menu_icon_img
24
+      )
25
+    values (#{id,jdbcType=INTEGER}, #{taMenuId,jdbcType=INTEGER}, #{menuIconImg,jdbcType=VARCHAR}
26
+      )
27
+  </insert>
28
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TaSysMenuImg" >
29
+    insert into ta_sys_menu_img
30
+    <trim prefix="(" suffix=")" suffixOverrides="," >
31
+      <if test="id != null" >
32
+        id,
33
+      </if>
34
+      <if test="taMenuId != null" >
35
+        ta_menu_id,
36
+      </if>
37
+      <if test="menuIconImg != null" >
38
+        menu_icon_img,
39
+      </if>
40
+    </trim>
41
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
42
+      <if test="id != null" >
43
+        #{id,jdbcType=INTEGER},
44
+      </if>
45
+      <if test="taMenuId != null" >
46
+        #{taMenuId,jdbcType=INTEGER},
47
+      </if>
48
+      <if test="menuIconImg != null" >
49
+        #{menuIconImg,jdbcType=VARCHAR},
50
+      </if>
51
+    </trim>
52
+  </insert>
53
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TaSysMenuImg" >
54
+    update ta_sys_menu_img
55
+    <set >
56
+      <if test="taMenuId != null" >
57
+        ta_menu_id = #{taMenuId,jdbcType=INTEGER},
58
+      </if>
59
+      <if test="menuIconImg != null" >
60
+        menu_icon_img = #{menuIconImg,jdbcType=VARCHAR},
61
+      </if>
62
+    </set>
63
+    where id = #{id,jdbcType=INTEGER}
64
+  </update>
65
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TaSysMenuImg" >
66
+    update ta_sys_menu_img
67
+    set ta_menu_id = #{taMenuId,jdbcType=INTEGER},
68
+      menu_icon_img = #{menuIconImg,jdbcType=VARCHAR}
69
+    where id = #{id,jdbcType=INTEGER}
70
+  </update>
71
+
72
+  <select id="selectByMenuId" resultMap="BaseResultMap">
73
+    select
74
+    <include refid="Base_Column_List" />
75
+    from ta_sys_menu_img
76
+    where ta_menu_id = #{id,jdbcType=INTEGER}
77
+  </select>
78
+</mapper>

+ 135
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TaSysMenuMapper.xml View File

@@ -0,0 +1,135 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3
+<mapper namespace="com.community.huiju.dao.TaSysMenuMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.TaSysMenu" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
+    <result column="menu_name" property="menuName" jdbcType="VARCHAR" />
8
+    <result column="menu_url" property="menuUrl" jdbcType="VARCHAR" />
9
+    <result column="parent_id" property="parentId" jdbcType="INTEGER" />
10
+    <result column="sort" property="sort" jdbcType="INTEGER" />
11
+    <result column="menu_type" property="menuType" jdbcType="CHAR" />
12
+    <result column="status" property="status" jdbcType="CHAR" />
13
+  </resultMap>
14
+  <sql id="Base_Column_List" >
15
+    id, community_id, menu_name, menu_url, parent_id, sort, menu_type, status
16
+  </sql>
17
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
18
+    select 
19
+    <include refid="Base_Column_List" />
20
+    from ta_sys_menu
21
+    where id = #{id,jdbcType=INTEGER}
22
+  </select>
23
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
24
+    delete from ta_sys_menu
25
+    where id = #{id,jdbcType=INTEGER}
26
+  </delete>
27
+  <insert id="insert" parameterType="com.community.huiju.model.TaSysMenu" >
28
+    insert into ta_sys_menu (id, community_id, menu_name, 
29
+      menu_url, parent_id, sort, 
30
+      menu_type, status)
31
+    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{menuName,jdbcType=VARCHAR}, 
32
+      #{menuUrl,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER}, 
33
+      #{menuType,jdbcType=CHAR}, #{status,jdbcType=CHAR})
34
+  </insert>
35
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TaSysMenu" >
36
+    insert into ta_sys_menu
37
+    <trim prefix="(" suffix=")" suffixOverrides="," >
38
+      <if test="id != null" >
39
+        id,
40
+      </if>
41
+      <if test="communityId != null" >
42
+        community_id,
43
+      </if>
44
+      <if test="menuName != null" >
45
+        menu_name,
46
+      </if>
47
+      <if test="menuUrl != null" >
48
+        menu_url,
49
+      </if>
50
+      <if test="parentId != null" >
51
+        parent_id,
52
+      </if>
53
+      <if test="sort != null" >
54
+        sort,
55
+      </if>
56
+      <if test="menuType != null" >
57
+        menu_type,
58
+      </if>
59
+      <if test="status != null" >
60
+        status,
61
+      </if>
62
+    </trim>
63
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
64
+      <if test="id != null" >
65
+        #{id,jdbcType=INTEGER},
66
+      </if>
67
+      <if test="communityId != null" >
68
+        #{communityId,jdbcType=INTEGER},
69
+      </if>
70
+      <if test="menuName != null" >
71
+        #{menuName,jdbcType=VARCHAR},
72
+      </if>
73
+      <if test="menuUrl != null" >
74
+        #{menuUrl,jdbcType=VARCHAR},
75
+      </if>
76
+      <if test="parentId != null" >
77
+        #{parentId,jdbcType=INTEGER},
78
+      </if>
79
+      <if test="sort != null" >
80
+        #{sort,jdbcType=INTEGER},
81
+      </if>
82
+      <if test="menuType != null" >
83
+        #{menuType,jdbcType=CHAR},
84
+      </if>
85
+      <if test="status != null" >
86
+        #{status,jdbcType=CHAR},
87
+      </if>
88
+    </trim>
89
+  </insert>
90
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TaSysMenu" >
91
+    update ta_sys_menu
92
+    <set >
93
+      <if test="communityId != null" >
94
+        community_id = #{communityId,jdbcType=INTEGER},
95
+      </if>
96
+      <if test="menuName != null" >
97
+        menu_name = #{menuName,jdbcType=VARCHAR},
98
+      </if>
99
+      <if test="menuUrl != null" >
100
+        menu_url = #{menuUrl,jdbcType=VARCHAR},
101
+      </if>
102
+      <if test="parentId != null" >
103
+        parent_id = #{parentId,jdbcType=INTEGER},
104
+      </if>
105
+      <if test="sort != null" >
106
+        sort = #{sort,jdbcType=INTEGER},
107
+      </if>
108
+      <if test="menuType != null" >
109
+        menu_type = #{menuType,jdbcType=CHAR},
110
+      </if>
111
+      <if test="status != null" >
112
+        status = #{status,jdbcType=CHAR},
113
+      </if>
114
+    </set>
115
+    where id = #{id,jdbcType=INTEGER}
116
+  </update>
117
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TaSysMenu" >
118
+    update ta_sys_menu
119
+    set community_id = #{communityId,jdbcType=INTEGER},
120
+      menu_name = #{menuName,jdbcType=VARCHAR},
121
+      menu_url = #{menuUrl,jdbcType=VARCHAR},
122
+      parent_id = #{parentId,jdbcType=INTEGER},
123
+      sort = #{sort,jdbcType=INTEGER},
124
+      menu_type = #{menuType,jdbcType=CHAR},
125
+      status = #{status,jdbcType=CHAR}
126
+    where id = #{id,jdbcType=INTEGER}
127
+  </update>
128
+
129
+  <select id="selectByCommunity" resultMap="BaseResultMap">
130
+    select
131
+    <include refid="Base_Column_List" />
132
+    from ta_sys_menu
133
+    where community_id = #{communityId,jdbcType=INTEGER}
134
+  </select>
135
+</mapper>

+ 41
- 6
CODE/smart-community/app-api/src/main/resources/mapper/TaUserMapper.xml View File

@@ -20,11 +20,14 @@
20 20
     <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
21 21
     <result column="update_user" property="updateUser" jdbcType="INTEGER" />
22 22
     <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
23
+    <result column="hk_user_id" property="hkUserId" jdbcType="INTEGER" />
24
+    <result column="hk_card_no" property="hkCardNo" jdbcType="VARCHAR" />
25
+    <result column="face_status" property="faceStatus" jdbcType="CHAR" />
23 26
   </resultMap>
24 27
   <sql id="Base_Column_List" >
25
-    id, community_id, building_owner_info_id, head_portrait, user_name, login_name, login_password, 
28
+    id, community_id, building_owner_info_id, head_portrait, user_name, login_name, login_password,
26 29
     email, gender, status, remark, parent_id, accept_agreement_status, verify_status,
27
-    create_user, create_date, update_user, update_date
30
+    create_user, create_date, update_user, update_date, hk_user_id, hk_card_no, face_status
28 31
   </sql>
29 32
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
30 33
     select
@@ -42,17 +45,19 @@
42 45
       login_password, email, gender,
43 46
       status, remark, parent_id,
44 47
       accept_agreement_status, verify_status, create_user,
45
-      create_date, update_user, update_date
48
+      create_date, update_user, update_date,
49
+      hk_user_id, hk_card_no, face_status
46 50
       )
47 51
     values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{buildingOwnerInfoId,jdbcType=INTEGER},
48 52
       #{headPortrait,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR}, #{loginName,jdbcType=VARCHAR},
49 53
       #{loginPassword,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{gender,jdbcType=CHAR},
50 54
       #{status,jdbcType=CHAR}, #{remark,jdbcType=VARCHAR}, #{parentId,jdbcType=INTEGER},
51 55
       #{acceptAgreementStatus,jdbcType=CHAR}, #{verifyStatus,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER},
52
-      #{createDate,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP}
56
+      #{createDate,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP},
57
+      #{hkUserId,jdbcType=INTEGER}, #{hkCardNo,jdbcType=VARCHAR}, #{faceStatus,jdbcType=CHAR}
53 58
       )
54 59
   </insert>
55
-  <insert id="insertSelective" useGeneratedKeys="true" keyProperty="id" parameterType="com.community.huiju.model.TaUser" >
60
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TaUser" >
56 61
     insert into ta_user
57 62
     <trim prefix="(" suffix=")" suffixOverrides="," >
58 63
       <if test="id != null" >
@@ -109,6 +114,15 @@
109 114
       <if test="updateDate != null" >
110 115
         update_date,
111 116
       </if>
117
+      <if test="hkUserId != null" >
118
+        hk_user_id,
119
+      </if>
120
+      <if test="hkCardNo != null" >
121
+        hk_card_no,
122
+      </if>
123
+      <if test="faceStatus != null" >
124
+        face_status,
125
+      </if>
112 126
     </trim>
113 127
     <trim prefix="values (" suffix=")" suffixOverrides="," >
114 128
       <if test="id != null" >
@@ -165,6 +179,15 @@
165 179
       <if test="updateDate != null" >
166 180
         #{updateDate,jdbcType=TIMESTAMP},
167 181
       </if>
182
+      <if test="hkUserId != null" >
183
+        #{hkUserId,jdbcType=INTEGER},
184
+      </if>
185
+      <if test="hkCardNo != null" >
186
+        #{hkCardNo,jdbcType=VARCHAR},
187
+      </if>
188
+      <if test="faceStatus != null" >
189
+        #{faceStatus,jdbcType=CHAR},
190
+      </if>
168 191
     </trim>
169 192
   </insert>
170 193
   <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TaUser" >
@@ -221,6 +244,15 @@
221 244
       <if test="updateDate != null" >
222 245
         update_date = #{updateDate,jdbcType=TIMESTAMP},
223 246
       </if>
247
+      <if test="hkUserId != null" >
248
+        hk_user_id = #{hkUserId,jdbcType=INTEGER},
249
+      </if>
250
+      <if test="hkCardNo != null" >
251
+        hk_card_no = #{hkCardNo,jdbcType=VARCHAR},
252
+      </if>
253
+      <if test="faceStatus != null" >
254
+        face_status = #{faceStatus,jdbcType=CHAR},
255
+      </if>
224 256
     </set>
225 257
     where id = #{id,jdbcType=INTEGER}
226 258
   </update>
@@ -242,7 +274,10 @@
242 274
       create_user = #{createUser,jdbcType=INTEGER},
243 275
       create_date = #{createDate,jdbcType=TIMESTAMP},
244 276
       update_user = #{updateUser,jdbcType=INTEGER},
245
-      update_date = #{updateDate,jdbcType=TIMESTAMP}
277
+      update_date = #{updateDate,jdbcType=TIMESTAMP},
278
+      hk_user_id = #{hkUserId,jdbcType=INTEGER},
279
+      hk_card_no = #{hkCardNo,jdbcType=VARCHAR},
280
+      face_status = #{faceStatus,jdbcType=CHAR}
246 281
     where id = #{id,jdbcType=INTEGER}
247 282
   </update>
248 283
 

+ 106
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TdImagesMapper.xml View File

@@ -0,0 +1,106 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3
+<mapper namespace="com.community.huiju.dao.TdImagesMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.TdImages" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="image_url" property="imageUrl" jdbcType="VARCHAR" />
7
+    <result column="uuid" property="uuid" jdbcType="INTEGER" />
8
+    <result column="type" property="type" jdbcType="CHAR" />
9
+    <result column="create_user" property="createUser" jdbcType="INTEGER" />
10
+    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
11
+  </resultMap>
12
+  <sql id="Base_Column_List" >
13
+    id, image_url, uuid, type, create_user, create_time
14
+  </sql>
15
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
16
+    select 
17
+    <include refid="Base_Column_List" />
18
+    from td_images
19
+    where id = #{id,jdbcType=INTEGER}
20
+  </select>
21
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
22
+    delete from td_images
23
+    where id = #{id,jdbcType=INTEGER}
24
+  </delete>
25
+  <insert id="insert" parameterType="com.community.huiju.model.TdImages" >
26
+    insert into td_images (id, image_url, uuid, 
27
+      type, create_user, create_time
28
+      )
29
+    values (#{id,jdbcType=INTEGER}, #{imageUrl,jdbcType=VARCHAR}, #{uuid,jdbcType=INTEGER}, 
30
+      #{type,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}
31
+      )
32
+  </insert>
33
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TdImages" >
34
+    insert into td_images
35
+    <trim prefix="(" suffix=")" suffixOverrides="," >
36
+      <if test="id != null" >
37
+        id,
38
+      </if>
39
+      <if test="imageUrl != null" >
40
+        image_url,
41
+      </if>
42
+      <if test="uuid != null" >
43
+        uuid,
44
+      </if>
45
+      <if test="type != null" >
46
+        type,
47
+      </if>
48
+      <if test="createUser != null" >
49
+        create_user,
50
+      </if>
51
+      <if test="createTime != null" >
52
+        create_time,
53
+      </if>
54
+    </trim>
55
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
56
+      <if test="id != null" >
57
+        #{id,jdbcType=INTEGER},
58
+      </if>
59
+      <if test="imageUrl != null" >
60
+        #{imageUrl,jdbcType=VARCHAR},
61
+      </if>
62
+      <if test="uuid != null" >
63
+        #{uuid,jdbcType=INTEGER},
64
+      </if>
65
+      <if test="type != null" >
66
+        #{type,jdbcType=CHAR},
67
+      </if>
68
+      <if test="createUser != null" >
69
+        #{createUser,jdbcType=INTEGER},
70
+      </if>
71
+      <if test="createTime != null" >
72
+        #{createTime,jdbcType=TIMESTAMP},
73
+      </if>
74
+    </trim>
75
+  </insert>
76
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TdImages" >
77
+    update td_images
78
+    <set >
79
+      <if test="imageUrl != null" >
80
+        image_url = #{imageUrl,jdbcType=VARCHAR},
81
+      </if>
82
+      <if test="uuid != null" >
83
+        uuid = #{uuid,jdbcType=INTEGER},
84
+      </if>
85
+      <if test="type != null" >
86
+        type = #{type,jdbcType=CHAR},
87
+      </if>
88
+      <if test="createUser != null" >
89
+        create_user = #{createUser,jdbcType=INTEGER},
90
+      </if>
91
+      <if test="createTime != null" >
92
+        create_time = #{createTime,jdbcType=TIMESTAMP},
93
+      </if>
94
+    </set>
95
+    where id = #{id,jdbcType=INTEGER}
96
+  </update>
97
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TdImages" >
98
+    update td_images
99
+    set image_url = #{imageUrl,jdbcType=VARCHAR},
100
+      uuid = #{uuid,jdbcType=INTEGER},
101
+      type = #{type,jdbcType=CHAR},
102
+      create_user = #{createUser,jdbcType=INTEGER},
103
+      create_time = #{createTime,jdbcType=TIMESTAMP}
104
+    where id = #{id,jdbcType=INTEGER}
105
+  </update>
106
+</mapper>

+ 2
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpActivityMapper.xml View File

@@ -265,7 +265,9 @@
265 265
   WHERE
266 266
       a.community_id = #{communityId,jdbcType=INTEGER}
267 267
       AND ( a.STATUS = 1 OR a.STATUS = 3 )
268
+    <if test="title != null and title != ''">
268 269
       AND a.activity_title LIKE concat('%',#{title,jdbcType=VARCHAR},'%')
270
+    </if>
269 271
   ORDER BY
270 272
       a.sort,
271 273
       a.activity_end_time DESC,

+ 3
- 1
CODE/smart-community/app-api/src/main/resources/mapper/TpAnnouncementMapper.xml View File

@@ -171,7 +171,9 @@
171 171
   WHERE
172 172
       a.community_id = #{communityId,jdbcType=INTEGER}
173 173
       AND ( a.STATUS = 1 OR a.STATUS = 3 )
174
-      and a.announcement_title like concat('%',#{title,jdbcType=VARCHAR},'%')
174
+      <if test="title != null and title != ''">
175
+        and a.announcement_title like concat('%',#{title,jdbcType=VARCHAR},'%')
176
+      </if>
175 177
   ORDER BY
176 178
       a.sort,
177 179
       a.create_date DESC

+ 0
- 11
CODE/smart-community/app-api/src/main/resources/mapper/TpTicketMapper.xml View File

@@ -247,15 +247,4 @@
247 247
         t.id = #{ticketId,jdbcType=INTEGER}
248 248
         AND t.community_id = #{communityId,jdbcType=INTEGER}
249 249
   </select>
250
-
251
-  <select id="getById" resultMap="BaseResultMap" >
252
-    SELECT
253
-    <include refid="Base_Column_List" />
254
-    FROM
255
-    tp_ticket
256
-    WHERE
257
-     ta_user_id = #{userId,jdbcType=INTEGER}
258
-    AND community_id = #{communityId,jdbcType=INTEGER} order by update_date desc  limit 1
259
-  </select>
260
-
261 250
 </mapper>

+ 8
- 2
CODE/smart-community/app-api/src/main/resources/mapper/TpTransactionMapper.xml View File

@@ -179,14 +179,20 @@
179 179
     select
180 180
     <include refid="Base_Column_List" />
181 181
     from tp_transaction
182
-    where community_id = #{communityId,jdbcType=INTEGER} and type = #{type,jdbcType=VARCHAR}
182
+    where community_id = #{communityId,jdbcType=INTEGER}
183
+    <if test="type != null and type != ''">
184
+      and type = #{type,jdbcType=VARCHAR}
185
+    </if>
186
+    <if test="transactionTitle != null and transactionTitle !=''">
187
+      and transaction_title LIKE concat('%',#{transactionTitle,jdbcType=VARCHAR},'%')
188
+    </if>
183 189
   </select>
184 190
 
185 191
   <select id="selectTransaction" resultMap="BaseResultMap">
186 192
     select
187 193
     <include refid="Base_Column_List" />
188 194
     from tp_transaction
189
-    where community_id = #{communityId,jdbcType=INTEGER} and ta_user_id = #{userId,jdbcType=INTEGER}
195
+    where community_id = #{communityId,jdbcType=INTEGER} and ta_user_id = #{userId,jdbcType=INTEGER} and type = #{type,jdbcType=INTEGER}
190 196
   </select>
191 197
 
192 198
   <update id="updateTransaction" parameterType="com.community.huiju.model.TpTransaction" >

+ 20
- 8
CODE/smart-community/community-common/pom.xml View File

@@ -104,13 +104,25 @@
104 104
             <artifactId>aliyun-sdk-oss</artifactId>
105 105
             <version>2.8.3</version>
106 106
         </dependency>
107
+        <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
108
+        <dependency>
109
+            <groupId>commons-io</groupId>
110
+            <artifactId>commons-io</artifactId>
111
+            <version>1.4</version>
112
+        </dependency>
113
+        <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
114
+        <dependency>
115
+            <groupId>org.apache.commons</groupId>
116
+            <artifactId>commons-lang3</artifactId>
117
+            <version>3.8.1</version>
118
+        </dependency>
119
+
120
+        <!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
121
+        <dependency>
122
+            <groupId>commons-lang</groupId>
123
+            <artifactId>commons-lang</artifactId>
124
+            <version>2.6</version>
125
+        </dependency>
126
+
107 127
     </dependencies>
108
-    <build>
109
-        <plugins>
110
-            <plugin>
111
-                <groupId>org.springframework.boot</groupId>
112
-                <artifactId>spring-boot-maven-plugin</artifactId>
113
-            </plugin>
114
-        </plugins>
115
-    </build>
116 128
 </project>

+ 213
- 0
CODE/smart-community/community-common/src/main/java/com/community/commom/ailiyun/AESDecode.java View File

@@ -0,0 +1,213 @@
1
+package com.community.commom.ailiyun;
2
+import com.community.commom.mode.ResponseBean;
3
+import sun.misc.BASE64Encoder;
4
+import java.net.HttpURLConnection;
5
+import java.security.MessageDigest;
6
+import java.io.BufferedReader;
7
+import java.io.IOException;
8
+import java.io.InputStreamReader;
9
+import java.io.PrintWriter;
10
+import java.net.URL;
11
+import java.net.URLConnection;
12
+import java.text.SimpleDateFormat;
13
+import java.util.Date;
14
+import java.util.Locale;
15
+import javax.crypto.spec.SecretKeySpec;
16
+
17
+import javax.crypto.Mac;
18
+
19
+@SuppressWarnings("restriction")
20
+public class AESDecode {
21
+    /*
22
+     * 计算MD5+BASE64
23
+     */
24
+    public static String MD5Base64(String s) {
25
+        if (s == null)
26
+            return null;
27
+        String encodeStr = "";
28
+        byte[] utfBytes = s.getBytes();
29
+        MessageDigest mdTemp;
30
+        try {
31
+            mdTemp = MessageDigest.getInstance("MD5");
32
+            mdTemp.update(utfBytes);
33
+            byte[] md5Bytes = mdTemp.digest();
34
+            BASE64Encoder b64Encoder = new BASE64Encoder();
35
+            encodeStr = b64Encoder.encode(md5Bytes);
36
+        } catch (Exception e) {
37
+            throw new Error("Failed to generate MD5 : " + e.getMessage());
38
+        }
39
+        return encodeStr;
40
+    }
41
+
42
+    /*
43
+     * 计算 HMAC-SHA1
44
+     */
45
+    public static String HMACSha1(String data, String key) {
46
+        String result;
47
+        try {
48
+            SecretKeySpec signingKey = new SecretKeySpec(key.getBytes(), "HmacSHA1");
49
+            Mac mac = Mac.getInstance("HmacSHA1");
50
+            mac.init(signingKey);
51
+            byte[] rawHmac = mac.doFinal(data.getBytes());
52
+            result = (new BASE64Encoder()).encode(rawHmac);
53
+        } catch (Exception e) {
54
+            throw new Error("Failed to generate HMAC : " + e.getMessage());
55
+        }
56
+        return result;
57
+    }
58
+
59
+    /*
60
+     * 等同于javaScript中的 new Date().toUTCString();
61
+     */
62
+    public static String toGMTString(Date date) {
63
+        SimpleDateFormat df = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss z", Locale.UK);
64
+        df.setTimeZone(new java.util.SimpleTimeZone(0, "GMT"));
65
+        return df.format(date);
66
+    }
67
+
68
+    /*
69
+     * 发送POST请求
70
+     */
71
+    public static String sendPost(String url, String body, String ak_id, String ak_secret) throws Exception {
72
+        PrintWriter out = null;
73
+        BufferedReader in = null;
74
+        String result = "";
75
+        int statusCode = 200;
76
+        try {
77
+            URL realUrl = new URL(url);
78
+            /*
79
+             * http header 参数
80
+             */
81
+            String method = "POST";
82
+            String accept = "application/json";
83
+            String content_type = "application/json";
84
+            String path = realUrl.getFile();
85
+            String date = toGMTString(new Date());
86
+            // 1.对body做MD5+BASE64加密
87
+            String bodyMd5 = MD5Base64(body);
88
+            String stringToSign = method + "\n" + accept + "\n" + bodyMd5 + "\n" + content_type + "\n" + date + "\n"
89
+                    + path;
90
+            // 2.计算 HMAC-SHA1
91
+            String signature = HMACSha1(stringToSign, ak_secret);
92
+            // 3.得到 authorization header
93
+            String authHeader = "Dataplus " + ak_id + ":" + signature;
94
+            // 打开和URL之间的连接
95
+            URLConnection conn = realUrl.openConnection();
96
+            // 设置通用的请求属性
97
+            conn.setRequestProperty("accept", accept);
98
+            conn.setRequestProperty("content-type", content_type);
99
+            conn.setRequestProperty("date", date);
100
+            conn.setRequestProperty("Authorization", authHeader);
101
+            // 发送POST请求必须设置如下两行
102
+            conn.setDoOutput(true);
103
+            conn.setDoInput(true);
104
+            // 获取URLConnection对象对应的输出流
105
+            out = new PrintWriter(conn.getOutputStream());
106
+            // 发送请求参数
107
+            out.print(body);
108
+            // flush输出流的缓冲
109
+            out.flush();
110
+            // 定义BufferedReader输入流来读取URL的响应
111
+            statusCode = ((HttpURLConnection) conn).getResponseCode();
112
+            if (statusCode != 200) {
113
+                in = new BufferedReader(new InputStreamReader(((HttpURLConnection) conn).getErrorStream()));
114
+            } else {
115
+                in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
116
+            }
117
+            String line;
118
+            while ((line = in.readLine()) != null) {
119
+                result += line;
120
+            }
121
+        } catch (Exception e) {
122
+            e.printStackTrace();
123
+        } finally {
124
+            try {
125
+                if (out != null) {
126
+                    out.close();
127
+                }
128
+                if (in != null) {
129
+                    in.close();
130
+                }
131
+            } catch (IOException ex) {
132
+                ex.printStackTrace();
133
+            }
134
+        }
135
+        if (statusCode != 200) {
136
+            throw new IOException("\nHttp StatusCode: " + statusCode + "\nErrorMessage: " + result);
137
+        }
138
+        return result;
139
+    }
140
+
141
+    /*
142
+     * GET请求
143
+     */
144
+    public static String sendGet(String url, String ak_id, String ak_secret) throws Exception {
145
+        String result = "";
146
+        BufferedReader in = null;
147
+        int statusCode = 200;
148
+        try {
149
+            URL realUrl = new URL(url);
150
+            /*
151
+             * http header 参数
152
+             */
153
+            String method = "GET";
154
+            String accept = "application/json";
155
+            String content_type = "application/json";
156
+            String path = realUrl.getFile();
157
+            String date = toGMTString(new Date());
158
+            // 1.对body做MD5+BASE64加密
159
+            // String bodyMd5 = MD5Base64(body);
160
+            String stringToSign = method + "\n" + accept + "\n" + "" + "\n" + content_type + "\n" + date + "\n" + path;
161
+            // 2.计算 HMAC-SHA1
162
+            String signature = HMACSha1(stringToSign, ak_secret);
163
+            // 3.得到 authorization header
164
+            String authHeader = "Dataplus " + ak_id + ":" + signature;
165
+            // 打开和URL之间的连接
166
+            URLConnection connection = realUrl.openConnection();
167
+            // 设置通用的请求属性
168
+            connection.setRequestProperty("accept", accept);
169
+            connection.setRequestProperty("content-type", content_type);
170
+            connection.setRequestProperty("date", date);
171
+            connection.setRequestProperty("Authorization", authHeader);
172
+            connection.setRequestProperty("Connection", "keep-alive");
173
+            // 建立实际的连接
174
+            connection.connect();
175
+            // 定义 BufferedReader输入流来读取URL的响应
176
+            statusCode = ((HttpURLConnection) connection).getResponseCode();
177
+            if (statusCode != 200) {
178
+                in = new BufferedReader(new InputStreamReader(((HttpURLConnection) connection).getErrorStream()));
179
+            } else {
180
+                in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
181
+            }
182
+            String line;
183
+            while ((line = in.readLine()) != null) {
184
+                result += line;
185
+            }
186
+        } catch (Exception e) {
187
+            e.printStackTrace();
188
+        } finally {
189
+            try {
190
+                if (in != null) {
191
+                    in.close();
192
+                }
193
+            } catch (Exception e) {
194
+                e.printStackTrace();
195
+            }
196
+        }
197
+        if (statusCode != 200) {
198
+            throw new IOException("\nHttp StatusCode: " + statusCode + "\nErrorMessage: " + result);
199
+        }
200
+        return result;
201
+    }
202
+
203
+    //直接请求
204
+    public ResponseBean send(String body) throws Exception {
205
+        ResponseBean responseBean = new ResponseBean();
206
+        String AccessKeyId = "LTAIkc75dpkJw8Lb"; //用户ak
207
+        String AccessKeySecret = "v4bvXCaix6vSDTCFfwSAdqV53iFEQw";
208
+        String url = "https://dtplus-cn-shanghai.data.aliyuncs.com/face/detect";
209
+        String sd = sendPost(url, body, AccessKeyId, AccessKeySecret);
210
+        responseBean.addSuccess(sd);
211
+        return responseBean;
212
+    }
213
+}

+ 17
- 0
CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java View File

@@ -87,4 +87,21 @@ public class Constant {
87 87
     /** banner的类型 文章 **/
88 88
     public static final String BANNER_TYPE_ARTICLE = "2";
89 89
 
90
+    /**图片社交类型**/
91
+    public static final String SOCIAL = "social";
92
+
93
+    /**图片服务类型**/
94
+    public static final String SERVICE = "service";
95
+
96
+    /**判断业主,家属的身份是否已停用的提示**/
97
+    public static final String STATE_DISCONTINUED = "您的身份已停用,请联系物业";
98
+
99
+    /**判断业主,家属的身份是否已停用的状态**/
100
+    public static final String STATE_HINT = "9996";
101
+
102
+    /**认证通过后的**/
103
+
104
+
105
+    /** 添加用户所对应的部门 住户 **/
106
+    public static final String DEPT_RESIDENTS = "测试";
90 107
 }

+ 133
- 0
CODE/smart-community/community-common/src/main/java/com/community/commom/hk/Digests.java View File

@@ -0,0 +1,133 @@
1
+package com.community.commom.hk;
2
+
3
+import org.apache.commons.lang3.Validate;
4
+
5
+import java.io.IOException;
6
+import java.io.InputStream;
7
+import java.io.UnsupportedEncodingException;
8
+import java.security.GeneralSecurityException;
9
+import java.security.MessageDigest;
10
+import java.security.SecureRandom;
11
+
12
+public class Digests {
13
+	private static final String SHA1 = "SHA-1";
14
+	private static final String MD5 = "MD5";
15
+	private static SecureRandom random = new SecureRandom();
16
+	
17
+	public Digests() {
18
+	}
19
+	
20
+	public static byte[] md5(byte[] input) {
21
+		return digest(input, "MD5", (byte[])null, 1);
22
+	}
23
+	
24
+	public static byte[] md5(byte[] input, int iterations) {
25
+		return digest(input, "MD5", (byte[])null, iterations);
26
+	}
27
+	
28
+	public static byte[] sha1(byte[] input) {
29
+		return digest(input, "SHA-1", (byte[])null, 1);
30
+	}
31
+	
32
+	public static byte[] sha1(byte[] input, byte[] salt) {
33
+		return digest(input, "SHA-1", salt, 1);
34
+	}
35
+	
36
+	public static byte[] sha1(byte[] input, byte[] salt, int iterations) {
37
+		return digest(input, "SHA-1", salt, iterations);
38
+	}
39
+	
40
+	private static byte[] digest(byte[] input, String algorithm, byte[] salt, int iterations) {
41
+		try {
42
+			MessageDigest digest = MessageDigest.getInstance(algorithm);
43
+			if (salt != null) {
44
+				digest.update(salt);
45
+			}
46
+			
47
+			byte[] result = digest.digest(input);
48
+			
49
+			for(int i = 1; i < iterations; ++i) {
50
+				digest.reset();
51
+				result = digest.digest(result);
52
+			}
53
+			
54
+			return result;
55
+		} catch (GeneralSecurityException var7) {
56
+			throw new RuntimeException(var7);
57
+		}
58
+	}
59
+	
60
+	public static byte[] generateSalt(int numBytes) {
61
+		Validate.isTrue(numBytes > 0, "numBytes argument must be a positive integer (1 or larger)", (long)numBytes);
62
+		byte[] bytes = new byte[numBytes];
63
+		random.nextBytes(bytes);
64
+		return bytes;
65
+	}
66
+	
67
+	public static byte[] md5(InputStream input) throws IOException {
68
+		return digest(input, "MD5");
69
+	}
70
+	
71
+	public static byte[] sha1(InputStream input) throws IOException {
72
+		return digest(input, "SHA-1");
73
+	}
74
+	
75
+	private static byte[] digest(InputStream input, String algorithm) throws IOException {
76
+		try {
77
+			MessageDigest messageDigest = MessageDigest.getInstance(algorithm);
78
+			int bufferLength = 8192;
79
+			byte[] buffer = new byte[bufferLength];
80
+			
81
+			for(int read = input.read(buffer, 0, bufferLength); read > -1; read = input.read(buffer, 0, bufferLength)) {
82
+				messageDigest.update(buffer, 0, read);
83
+			}
84
+			
85
+			return messageDigest.digest();
86
+		} catch (GeneralSecurityException var6) {
87
+			throw new RuntimeException(var6);
88
+		}
89
+	}
90
+	
91
+	public static final String md5(String s) {
92
+		char[] hexDigits = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
93
+		
94
+		try {
95
+			MessageDigest mdTemp = MessageDigest.getInstance("MD5");
96
+			
97
+			try {
98
+				mdTemp.update(s.getBytes("UTF-8"));
99
+			} catch (UnsupportedEncodingException var9) {
100
+				mdTemp.update(s.getBytes());
101
+			}
102
+			
103
+			byte[] md = mdTemp.digest();
104
+			int j = md.length;
105
+			char[] str = new char[j * 2];
106
+			int k = 0;
107
+			
108
+			for(int i = 0; i < j; ++i) {
109
+				byte byte0 = md[i];
110
+				str[k++] = hexDigits[byte0 >>> 4 & 15];
111
+				str[k++] = hexDigits[byte0 & 15];
112
+			}
113
+			
114
+			return (new String(str)).toUpperCase();
115
+		} catch (Exception var10) {
116
+			return null;
117
+		}
118
+	}
119
+	
120
+	public static final String buildToken(String url, String paramJson, String secret) {
121
+		String tempUrl = null;
122
+		if (url.contains("https://")) {
123
+			tempUrl = url.substring("https://".length());
124
+		} else {
125
+			tempUrl = url.substring("http://".length());
126
+		}
127
+		
128
+		int index = tempUrl.indexOf("/");
129
+		String URI = tempUrl.substring(index);
130
+		String[] ss = URI.split("\\?");
131
+		return ss.length > 1 ? md5(ss[0] + ss[1] + secret) : md5(ss[0] + paramJson + secret);
132
+	}
133
+}

+ 127
- 0
CODE/smart-community/community-common/src/main/java/com/community/commom/hk/HttpClientSSLUtils.java View File

@@ -0,0 +1,127 @@
1
+package com.community.commom.hk;
2
+
3
+import org.apache.commons.io.IOUtils;
4
+import org.apache.http.HttpResponse;
5
+import org.apache.http.client.HttpClient;
6
+import org.apache.http.client.config.RequestConfig;
7
+import org.apache.http.client.config.RequestConfig.Builder;
8
+import org.apache.http.client.methods.HttpGet;
9
+import org.apache.http.client.methods.HttpPost;
10
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
11
+import org.apache.http.conn.ssl.TrustStrategy;
12
+import org.apache.http.entity.ContentType;
13
+import org.apache.http.entity.StringEntity;
14
+import org.apache.http.impl.client.CloseableHttpClient;
15
+import org.apache.http.impl.client.HttpClients;
16
+import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
17
+import org.apache.http.ssl.SSLContextBuilder;
18
+
19
+import javax.net.ssl.HostnameVerifier;
20
+import javax.net.ssl.SSLContext;
21
+import javax.net.ssl.SSLSession;
22
+import java.security.GeneralSecurityException;
23
+import java.security.KeyStore;
24
+import java.security.cert.CertificateException;
25
+import java.security.cert.X509Certificate;
26
+
27
+public class HttpClientSSLUtils {
28
+	private static HttpClient httpClient = null;
29
+	protected static final Integer DEFAULT_CONNECTION_TIME_OUT = 100000;
30
+	protected static final Integer DEFAULT_SOCKET_TIME_OUT = 200000;
31
+	protected static final String DEFAULT_CHAR_SET = "UTF-8";
32
+	
33
+	public HttpClientSSLUtils() {
34
+	}
35
+	
36
+	public static String doPost(String url, String jsonText) throws Exception {
37
+		HttpClient client = null;
38
+		HttpPost post = new HttpPost(url);
39
+		
40
+		String var6;
41
+		try {
42
+			if (jsonText != null && !jsonText.isEmpty()) {
43
+				StringEntity entity = new StringEntity(jsonText, ContentType.APPLICATION_JSON);
44
+				post.setEntity(entity);
45
+			}
46
+			
47
+			Builder customReqConf = RequestConfig.custom();
48
+			customReqConf.setConnectTimeout(DEFAULT_CONNECTION_TIME_OUT);
49
+			customReqConf.setSocketTimeout(DEFAULT_CONNECTION_TIME_OUT);
50
+			post.setConfig(customReqConf.build());
51
+			HttpResponse res = null;
52
+			if (url.startsWith("https")) {
53
+				client = createSSLInsecureClient();
54
+				res = ((HttpClient)client).execute(post);
55
+			} else {
56
+				client = httpClient;
57
+				res = ((HttpClient)client).execute(post);
58
+			}
59
+			
60
+			var6 = IOUtils.toString(res.getEntity().getContent(), "UTF-8");
61
+		} finally {
62
+			post.releaseConnection();
63
+			if (url.startsWith("https") && client != null && client instanceof CloseableHttpClient) {
64
+				((CloseableHttpClient)client).close();
65
+			}
66
+			
67
+		}
68
+		
69
+		return var6;
70
+	}
71
+	
72
+	public static String doGet(String url) throws Exception {
73
+		HttpClient client = null;
74
+		HttpGet get = new HttpGet(url);
75
+		String result = "";
76
+		
77
+		try {
78
+			Builder customReqConf = RequestConfig.custom();
79
+			customReqConf.setConnectTimeout(DEFAULT_CONNECTION_TIME_OUT);
80
+			customReqConf.setSocketTimeout(DEFAULT_CONNECTION_TIME_OUT);
81
+			get.setConfig(customReqConf.build());
82
+			HttpResponse res = null;
83
+			if (url.startsWith("https")) {
84
+				client = createSSLInsecureClient();
85
+				res = ((HttpClient)client).execute(get);
86
+			} else {
87
+				client = client;
88
+				res = ((HttpClient)client).execute(get);
89
+			}
90
+			
91
+			result = IOUtils.toString(res.getEntity().getContent(), "UTF-8");
92
+		} finally {
93
+			get.releaseConnection();
94
+			if (url.startsWith("https") && client != null && client instanceof CloseableHttpClient) {
95
+				((CloseableHttpClient)client).close();
96
+			}
97
+			
98
+		}
99
+		
100
+		return result;
101
+	}
102
+	
103
+	private static CloseableHttpClient createSSLInsecureClient() throws GeneralSecurityException {
104
+		try {
105
+			SSLContext sslContext = (new SSLContextBuilder()).loadTrustMaterial((KeyStore)null, new TrustStrategy() {
106
+				public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
107
+					return true;
108
+				}
109
+			}).build();
110
+			SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, new HostnameVerifier() {
111
+				public boolean verify(String hostname, SSLSession session) {
112
+					return true;
113
+				}
114
+			});
115
+			return HttpClients.custom().setSSLSocketFactory(sslsf).build();
116
+		} catch (GeneralSecurityException var2) {
117
+			throw var2;
118
+		}
119
+	}
120
+	
121
+	static {
122
+		PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
123
+		cm.setMaxTotal(128);
124
+		cm.setDefaultMaxPerRoute(128);
125
+		httpClient = HttpClients.custom().setConnectionManager(cm).build();
126
+	}
127
+}

+ 2
- 2
CODE/smart-community/community-common/src/main/java/com/community/commom/utils/MD5Utils.java View File

@@ -45,7 +45,7 @@ public class MD5Utils {
45 45
         }
46 46
     }
47 47
 
48
-    public static void main(String[] arge) throws Exception {
48
+/*    public static void main(String[] arge) throws Exception {
49 49
        System.out.println(MD5Utils.encode("123456"));
50
-    }
50
+    }*/
51 51
 }

+ 2
- 2
CODE/smart-community/community-common/src/main/java/com/community/commom/utils/OssUtil.java View File

@@ -16,7 +16,7 @@ import java.util.Date;
16 16
  * @date 2018/10/31
17 17
  */
18 18
 public class OssUtil {
19
-    public static void main(String[] args) {
19
+   /* public static void main(String[] args) {
20 20
         // Endpoint以杭州为例,其它Region请按实际情况填写。
21 21
         String endpoint = "http://oss-cn-hangzhou.aliyuncs.com";
22 22
 // 阿里云主账号AccessKey拥有所有API的访问权限,风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维,请登录 https://ram.console.aliyun.com 创建RAM账号。
@@ -37,7 +37,7 @@ public class OssUtil {
37 37
 // 关闭OSSClient。
38 38
         ossClient.shutdown();
39 39
     }
40
-
40
+*/
41 41
 
42 42
     public static String picOSS(MultipartFile uploadFile) throws Exception {
43 43
         String endpoint = "http://oss-cn-hangzhou.aliyuncs.com";

BIN
CODE/smart-community/community-common/target/classes/com/community/commom/constant/Constant.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/mode/ResponseBean.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/redis/FastJsonSerializer.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/redis/RedisConfiguration.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/redis/RedisJsonSerializer.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/redis/RedisObjectSerializer.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/redis/RedisSerializer.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/redis/RedisTemplate.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/redis/SerializationFailedException.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/redis/SingleRedisTemplate.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/session/UserElement.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/utils/AccountValidatorUtil.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/utils/BeanTools.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/utils/CommonUtils.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/utils/CookieUtil.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/utils/DESUtils.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/utils/DateUtils.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/utils/EnumUtils.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/utils/HttpClientUtils.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/utils/MD5Utils.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/utils/OssUtil.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/utils/QRCodeGeneratorUtils.class View File


BIN
CODE/smart-community/community-common/target/classes/com/community/commom/utils/StringConverter.class View File


BIN
CODE/smart-community/community-common/target/community-common-0.0.1.jar View File


BIN
CODE/smart-community/community-common/target/community-common-0.0.1.jar.original View File


+ 0
- 4
CODE/smart-community/community-common/target/maven-archiver/pom.properties View File

@@ -1,4 +0,0 @@
1
-#Created by Apache Maven 3.5.4
2
-version=0.0.1
3
-groupId=com.community
4
-artifactId=community-common

+ 0
- 0
CODE/smart-community/community-common/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst View File


Some files were not shown because too many files changed in this diff