weiximei 6 år sedan
förälder
incheckning
9db4140b73
100 ändrade filer med 5554 tillägg och 340 borttagningar
  1. 1
    0
      .gitignore
  2. Binär
      CODE/smart-community/app-api/lib/Digests.jar
  3. Binär
      CODE/smart-community/app-api/lib/HttpClientSSLUtils.jar
  4. 40
    6
      CODE/smart-community/app-api/pom.xml
  5. 16
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/AppApplication.java
  6. 114
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/common/PicUtils.java
  7. 3
    5
      CODE/smart-community/app-api/src/main/java/com/community/huiju/common/code/cache/AppkeyCache.java
  8. 130
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/HKConstant.java
  9. 571
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/HKOpenApi.java
  10. 40
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/entity/MonitoryPoint.java
  11. 210
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/test/OpenapiTest.java
  12. 2
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/config/HttpSessionConfig.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. 18
    4
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/BillController.java
  16. 73
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/FaceController.java
  17. 25
    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. 182
    29
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java
  22. 56
    25
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TicketController.java
  23. 38
    6
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/UserController.java
  24. 22
    6
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/VistorController.java
  25. 33
    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. 11
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaSysUserRoleMapper.java
  29. 17
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaUserMapper.java
  30. 1
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaVisitorLicenseMapper.java
  31. 47
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TdImagesMapper.java
  32. 24
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpActivitySignupMapper.java
  33. 0
    7
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTicketMapper.java
  34. 2
    2
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTransactionMapper.java
  35. 19
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpUserMapper.java
  36. 1
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaAgreement.java
  37. 50
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaFace.java
  38. 105
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaSysMenu.java
  39. 33
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaSysMenuImg.java
  40. 55
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaUser.java
  41. 6
    6
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaVisitor.java
  42. 65
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TdImages.java
  43. 24
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpActivity.java
  44. 11
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpAnnouncement.java
  45. 75
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpMessage.java
  46. 12
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpTicket.java
  47. 13
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpTicketRecord.java
  48. 29
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpTransaction.java
  49. 135
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpUser.java
  50. 1
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/BillServiceI.java
  51. 7
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/CommunityServiceI.java
  52. 32
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/FaceServiceI.java
  53. 29
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/IMonitoringService.java
  54. 16
    3
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITaUserService.java
  55. 7
    6
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITicketService.java
  56. 15
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ImageServiceI.java
  57. 15
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/MenuServiceI.java
  58. 1
    4
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/MessageServiceI.java
  59. 62
    8
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java
  60. 9
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/TaVistorServiceI.java
  61. 8
    3
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/BillServiceImpl.java
  62. 5
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/CommunityServiceImpl.java
  63. 262
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/FaceServicelimpl.java
  64. 43
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/ImageServiceimpl.java
  65. 41
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/MenuServiceImpl.java
  66. 8
    4
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/MessageServiceImpl.java
  67. 84
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/MonitoringServiceImpl.java
  68. 255
    39
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java
  69. 381
    30
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java
  70. 60
    4
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaVistorServiceImpl.java
  71. 158
    34
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TicketServiceImpl.java
  72. 6
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/vo/TaUserVO.java
  73. 14
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/vo/TpTicketVO.java
  74. 128
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TaFaceMapper.xml
  75. 78
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TaSysMenuImgMapper.xml
  76. 136
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TaSysMenuMapper.xml
  77. 7
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TaSysUserRoleMapper.xml
  78. 68
    7
      CODE/smart-community/app-api/src/main/resources/mapper/TaUserMapper.xml
  79. 1
    1
      CODE/smart-community/app-api/src/main/resources/mapper/TaVisitorLicenseMapper.xml
  80. 7
    6
      CODE/smart-community/app-api/src/main/resources/mapper/TaVisitorMapper.xml
  81. 138
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TdImagesMapper.xml
  82. 4
    2
      CODE/smart-community/app-api/src/main/resources/mapper/ToBannerMapper.xml
  83. 2
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TpActivityMapper.xml
  84. 20
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TpActivitySignupMapper.xml
  85. 3
    1
      CODE/smart-community/app-api/src/main/resources/mapper/TpAnnouncementMapper.xml
  86. 57
    14
      CODE/smart-community/app-api/src/main/resources/mapper/TpMessageMapper.xml
  87. 0
    11
      CODE/smart-community/app-api/src/main/resources/mapper/TpTicketMapper.xml
  88. 2
    2
      CODE/smart-community/app-api/src/main/resources/mapper/TpTicketRecordCommentMapper.xml
  89. 16
    4
      CODE/smart-community/app-api/src/main/resources/mapper/TpTicketRecordMapper.xml
  90. 40
    8
      CODE/smart-community/app-api/src/main/resources/mapper/TpTransactionMapper.xml
  91. 188
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TpUserMapper.xml
  92. 20
    8
      CODE/smart-community/community-common/pom.xml
  93. 213
    0
      CODE/smart-community/community-common/src/main/java/com/community/commom/ailiyun/AESDecode.java
  94. 32
    2
      CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java
  95. 133
    0
      CODE/smart-community/community-common/src/main/java/com/community/commom/hk/Digests.java
  96. 127
    0
      CODE/smart-community/community-common/src/main/java/com/community/commom/hk/HttpClientSSLUtils.java
  97. 2
    2
      CODE/smart-community/community-common/src/main/java/com/community/commom/utils/MD5Utils.java
  98. 2
    2
      CODE/smart-community/community-common/src/main/java/com/community/commom/utils/OssUtil.java
  99. Binär
      CODE/smart-community/community-common/target/classes/com/community/commom/constant/Constant.class
  100. 0
    0
      CODE/smart-community/community-common/target/classes/com/community/commom/mode/ResponseBean.class

+ 1
- 0
.gitignore Visa fil

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

Binär
CODE/smart-community/app-api/lib/Digests.jar Visa fil


Binär
CODE/smart-community/app-api/lib/HttpClientSSLUtils.jar Visa fil


+ 40
- 6
CODE/smart-community/app-api/pom.xml Visa fil

@@ -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
 

+ 16
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/AppApplication.java Visa fil

@@ -1,7 +1,11 @@
1 1
 package com.community.huiju;
2 2
 
3
+import com.alibaba.fastjson.serializer.SerializerFeature;
4
+import com.alibaba.fastjson.support.config.FastJsonConfig;
5
+import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
3 6
 import org.springframework.boot.SpringApplication;
4 7
 import org.springframework.boot.autoconfigure.SpringBootApplication;
8
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
5 9
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
6 10
 import org.springframework.cloud.openfeign.EnableFeignClients;
7 11
 import org.springframework.context.annotation.Bean;
@@ -22,4 +26,16 @@ public class AppApplication {
22 26
 	public RestTemplate restTemplate(){
23 27
 		return new RestTemplate();
24 28
 	}
29
+
30
+	@Bean
31
+	public HttpMessageConverters fastJsonConfigure(){
32
+		FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
33
+		FastJsonConfig fastJsonConfig = new FastJsonConfig();
34
+		fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat);
35
+		//日期格式化
36
+		//fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
37
+		converter.setFastJsonConfig(fastJsonConfig);
38
+		return new HttpMessageConverters(converter);
39
+	}
40
+
25 41
 }

+ 114
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/common/PicUtils.java Visa fil

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

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

@@ -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
     }

+ 130
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/HKConstant.java Visa fil

@@ -0,0 +1,130 @@
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_HTTPS = "http://192.168.0.122";
36
+    //public static final String OPENAPI_IP_PORT_HTTP = "http://huiju.ngrok.xiaomiqiu.cn";
37
+    public static final String OPENAPI_IP_PORT_HTTP = "http://huifang.vipgz1.idcfengye.com";
38
+
39
+    /**
40
+     * <p>操作用户UUID,即用户UUID,首次使用操作用户UUID可以通过接口 [获取默认用户UUID]来获取</p>
41
+     * <p>也可以通过接口[分页获取用户]来获取</p>
42
+     */
43
+
44
+    /**
45
+     * 获取默认用户UUID的接口地址,此地址可以从《海康威视iVMS-8700平台SDKV2.*.* HTTP-OpenAPI使用说明书.chm》中具体的接口说明上获取
46
+     */
47
+    public static final String ITF_ADDRESS_GET_DEFAULT_USER_UUID = "/openapi/service/base/user/getDefaultUserUuid";
48
+
49
+    /**
50
+     * 分页获取监控点信息的接口地址,此地址可以从《海康威视iVMS-8700平台SDKV2.*.* HTTP-OpenAPI使用说明书.chm》中具体的接口说明上获取
51
+     */
52
+    public static final String ITF_ADDRESS_GET_CAMERAS = "/openapi/service/vss/res/getCameras";
53
+
54
+    /**
55
+     * 查询监控点地址
56
+     */
57
+    public static final String OP_USER_UUID = "5b2eb534696b11e89c2e438f92627767";
58
+
59
+    /**--主要是推送图片到海康
60
+     * 通过此接口将人员名单添加到指定的人员分组当中,此接口适合一次添加一个人员,如果需要批量添加可以使用平台上自带的图片压缩包的方式批量添加。
61
+     */
62
+    public  static  final  String OP_IMG="/openapi/service/fas/personInfo/addPersonInfoIntoGroup";
63
+
64
+    public static final String ITF_MONITORY_POINT = "/openapi/service/vss/res/getCamerasEx";
65
+    
66
+    /**
67
+     * 根据区域UUID集获取门禁点
68
+     */
69
+    public static final String DOORS_BY_REGION_UUIDS = "/openapi/service/acs/res/getDoorsByRegionUuids";
70
+    
71
+    /**
72
+     * 根据人员ID集添加权限
73
+     */
74
+    public static final String ADD_AUTHORITIES_BY_PERSONIDS = "/openapi/service/acs/auth/addAuthoritiesByPersonIds";
75
+    
76
+    /**
77
+     * 根据设备UUID集异动下载门禁权限
78
+     */
79
+    public static final String DOWNLOAD_AUTHORITY_BY_DEVICEUUIDS = "/openapi/service/acs/auth/downloadAuthorityByDeviceUuids";
80
+    
81
+    /**
82
+     * 指定人员人脸/指纹权限下载
83
+     */
84
+    public static final String DOWNLOAD_FACE_AND_FINGERINFOS = "/openapi/service/acs/auth/downloadFaceAndFingerInfos";
85
+
86
+    /**--推送图片时需要获取人员分组下的,人员分组ID
87
+     * --personGroupId--
88
+     */
89
+    public static final  String OP_PERSON_ID="/openapi/service/fas/personGroup/getPersonGroup";
90
+
91
+    /**
92
+     * 分页获取部门
93
+     */
94
+    public static final String ITF_DEPT= "/openapi/service/base/dept/getDeptInfos";
95
+
96
+    /**
97
+     * 根据部门名称分页获取部门
98
+     */
99
+    public static final String ITF_LIKE_DEPT_NAME = "/openapi/service/base/dept/getDeptInfosByName";
100
+
101
+    /**
102
+     * 添加 人员
103
+     */
104
+    public static final String ITF_ADD_USER = "/openapi/service/base/person/addPersonInfo";
105
+
106
+
107
+    /**
108
+     * 修改人员
109
+     */
110
+    public static final String ITF_UPDATE_USER ="/openapi/service/base/person/modifyPersonInfo";
111
+
112
+
113
+    /**
114
+     * 批量开卡
115
+     */
116
+    public static final String ITF_OPEN_CARD = "/openapi/service/base/person/batchOpenCards";
117
+
118
+    /**
119
+     * 根据人员ID集获取人员
120
+     */
121
+    public static final String ITF_GET_USER_ID = "/openapi/service/base/person/getPersonInfosByIds";
122
+    
123
+    /**
124
+     * 未预约登记(临时登记)
125
+     */
126
+    public static final String TEMPORARY_REGISTER = "/openapi/service/rvs/register/temporaryRegister";
127
+
128
+    
129
+
130
+}

+ 571
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/HKOpenApi.java Visa fil

@@ -0,0 +1,571 @@
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
+
12
+import java.io.IOException;
13
+import java.util.HashMap;
14
+import java.util.Map;
15
+
16
+/**
17
+ * 海康 API
18
+ * @author weiximei
19
+ */
20
+@Slf4j
21
+public class HKOpenApi {
22
+
23
+    /**
24
+     * 根据
25
+     * 组织中心UUID集 ,第几页, 一页多少行
26
+     *
27
+     * 获取  监控点 数据列表
28
+     * @return
29
+     */
30
+    public static String getMonitoryPoint(Map<String,Object> map){
31
+        Map<String,Object> parMap = Maps.newHashMap();
32
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_MONITORY_POINT;
33
+        //设置APPKEY
34
+        parMap.put("appkey", HKConstant.APPKEY);
35
+        //设置时间参数
36
+        parMap.put("time", System.currentTimeMillis());
37
+        parMap.put("pageNo",map.get("pageNo"));
38
+        parMap.put("pageSize",map.get("pageSize"));
39
+        parMap.put("opUserUuid",map.get("opUserUuid") == null?HKConstant.OP_USER_UUID:map.get("opUserUuid"));
40
+        parMap.put("unitUuids",map.get("unitUuids"));
41
+        String params =  JSON.toJSONString(parMap);
42
+        log.info("获取 监控列表 请求参数:{}", params);
43
+        String data = null;
44
+        try {
45
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
46
+            log.info("获取 监控列表 请求返回结果:{}",data);
47
+        } catch (Exception e) {
48
+            e.printStackTrace();
49
+            log.error("获取监控列表失败!",e);
50
+            throw new RuntimeException("获取监控列表失败!");
51
+        }
52
+
53
+        return data;
54
+    }
55
+
56
+    /**
57
+     * 根据部门名称分页获取部门
58
+     *      第几页, 一页多少行, 操作用户uuid
59
+     * @param map
60
+     * @return
61
+     */
62
+    public static String getDeptName(Map<String,Object> map){
63
+        Map<String,Object> parMap = Maps.newHashMap();
64
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_LIKE_DEPT_NAME;
65
+        //设置APPKEY
66
+        parMap.put("appkey", HKConstant.APPKEY);
67
+        //设置时间参数
68
+        parMap.put("time", System.currentTimeMillis());
69
+        parMap.put("pageNo",map.get("pageNo"));
70
+        parMap.put("pageSize",map.get("pageSize"));
71
+        parMap.put("opUserUuid",map.get("opUserUuid") == null?HKConstant.OP_USER_UUID:map.get("opUserUuid"));
72
+        parMap.put("deptName",map.get("deptName"));
73
+        String params =  JSON.toJSONString(parMap);
74
+        log.info("根据部门名称分页获取部门 请求参数:{}", params);
75
+        String data = null;
76
+        try {
77
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
78
+            log.info("根据部门名称分页获取部门 请求返回结果:{}",data);
79
+        } catch (Exception e) {
80
+            e.printStackTrace();
81
+            log.error("根据部门名称分页获取部门失败!",e);
82
+            throw new RuntimeException("根据部门名称分页获取部门失败!");
83
+        }
84
+
85
+        return data;
86
+    }
87
+
88
+
89
+    /**
90
+     * 添加人员
91
+     *
92
+     *      比如 住户
93
+     * @return
94
+     */
95
+    public static String addUser(Map<String,Object> map){
96
+        Map<String,Object> parMap = Maps.newHashMap();
97
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_ADD_USER;
98
+        //设置APPKEY
99
+        parMap.put("appkey", HKConstant.APPKEY);
100
+        //设置时间参数
101
+        parMap.put("time", System.currentTimeMillis());
102
+        parMap.put("opUserUuid",map.get("opUserUuid") == null?HKConstant.OP_USER_UUID:map.get("opUserUuid"));
103
+        parMap.put("personNo",map.get("personNo"));
104
+        parMap.put("personName",map.get("personName"));
105
+        parMap.put("phoneNo",map.get("phoneNo"));
106
+        parMap.put("deptUuid",map.get("deptUuid"));
107
+        // parMap.put("cardNo",map.get("cardNo"));
108
+        String params =  JSON.toJSONString(parMap);
109
+        log.info("添加人员 请求参数:{}", params);
110
+        String data = null;
111
+        try {
112
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
113
+            log.info("添加人员 请求返回结果:{}",data);
114
+        } catch (Exception e) {
115
+            e.printStackTrace();
116
+            log.error("添加人员失败!",e);
117
+            throw new RuntimeException("添加人员失败!");
118
+        }
119
+
120
+        return data;
121
+    }
122
+
123
+    /**
124
+     * 批量开卡
125
+     *
126
+     * 其中参数 cardAndPerson 形式为“卡号,人员ID”,开卡数量不得超过50个,若没有该卡号,则添加一张新卡进行绑定 List<String>
127
+     * @return
128
+     */
129
+    public static String openCard(Map<String,Object> map){
130
+        Map<String,Object> parMap = Maps.newHashMap();
131
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_OPEN_CARD;
132
+        //设置APPKEY
133
+        parMap.put("appkey", HKConstant.APPKEY);
134
+        //设置时间参数
135
+        parMap.put("time", System.currentTimeMillis());
136
+        parMap.put("opUserUuid",map.get("opUserUuid") == null?HKConstant.OP_USER_UUID:map.get("opUserUuid"));
137
+        parMap.put("cardAndPerson",map.get("cardAndPerson"));
138
+        parMap.put("startTime",map.get("startTime"));
139
+        parMap.put("endTime",map.get("endTime"));
140
+        parMap.put("subSystems","1048576,3145728,2097152,9437184,25165824,10485760");
141
+        String params =  JSON.toJSONString(parMap);
142
+        log.info("批量开卡 请求参数:{}", params);
143
+        String data = null;
144
+        try {
145
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
146
+            log.info("批量开卡 请求返回结果:{}",data);
147
+        } catch (Exception e) {
148
+            e.printStackTrace();
149
+            log.error("批量开卡失败!",e);
150
+            throw new RuntimeException("批量开卡失败!");
151
+        }
152
+
153
+        return data;
154
+    }
155
+
156
+    /**
157
+     * 根据中心UUID集获取中心下的门禁设备信息
158
+     *
159
+     * @return
160
+     */
161
+    public static String getACDevicesByUnitUuids(){
162
+        Map<String,Object> parMap = Maps.newHashMap();
163
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_MONITORY_POINT;
164
+        //设置APPKEY
165
+        parMap.put("appkey", HKConstant.APPKEY);
166
+        //设置时间参数
167
+        parMap.put("time", System.currentTimeMillis());
168
+        parMap.put("pageNo",1);
169
+        parMap.put("pageSize",10);
170
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
171
+        parMap.put("unitUuids","1048576");
172
+        String params =  JSON.toJSONString(parMap);
173
+        log.info("获取中心UUID集获取中心下的门禁设备请求参数:{}", params);
174
+        String data = null;
175
+        try {
176
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
177
+            log.info("获取 中心UUID集获取中心下的门禁设备 请求返回结果:{}",data);
178
+        } catch (Exception e) {
179
+            e.printStackTrace();
180
+            log.error("获取失败!",e);
181
+            throw new RuntimeException("获取失败!");
182
+        }
183
+
184
+        return data;
185
+    }
186
+
187
+    /**
188
+     * 分页获取门禁点信息。
189
+     *
190
+     * @return
191
+     */
192
+    public static String getDoors(){
193
+        Map<String,Object> parMap = Maps.newHashMap();
194
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_MONITORY_POINT;
195
+        //设置APPKEY
196
+        parMap.put("appkey", HKConstant.APPKEY);
197
+        //设置时间参数
198
+        parMap.put("time", System.currentTimeMillis());
199
+        parMap.put("pageNo",1);
200
+        parMap.put("pageSize",10);
201
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
202
+        String params =  JSON.toJSONString(parMap);
203
+        log.info("分页获取门禁点信息请求参数:{}", params);
204
+        String data = null;
205
+        try {
206
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
207
+            log.info("分页获取门禁点信息 请求返回结果:{}",data);
208
+        } catch (Exception e) {
209
+            e.printStackTrace();
210
+            log.error("获取失败!",e);
211
+            throw new RuntimeException("获取失败!");
212
+        }
213
+
214
+        return data;
215
+    }
216
+
217
+    /**
218
+     * 批量获取控制中心信息,多个中心的UUID用“,”分割组成的字符串。
219
+     *
220
+     * @return
221
+     */
222
+    public static String getUnitsByUuids(){
223
+        Map<String,Object> parMap = Maps.newHashMap();
224
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_MONITORY_POINT;
225
+        //设置APPKEY
226
+        parMap.put("appkey", HKConstant.APPKEY);
227
+        //设置时间参数
228
+        parMap.put("time", System.currentTimeMillis());
229
+        parMap.put("pageNo",1);
230
+        parMap.put("pageSize",10);
231
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
232
+        parMap.put("unitUuids","1048576");
233
+        String params =  JSON.toJSONString(parMap);
234
+        log.info("获取控制中心信息请求参数:{}", params);
235
+        String data = null;
236
+        try {
237
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
238
+            log.info("获取控制中心信息 请求返回结果:{}",data);
239
+        } catch (Exception e) {
240
+            e.printStackTrace();
241
+            log.error("获取控制中心信息失败!",e);
242
+            throw new RuntimeException("获取控制中心信息失败!");
243
+        }
244
+
245
+        return data;
246
+    }
247
+
248
+    /**
249
+     *  根据中心UUID分页获取下级区域
250
+     * @return
251
+     */
252
+    public static String getRegionsByUnitUuid(){
253
+        Map<String,Object> parMap = Maps.newHashMap();
254
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_MONITORY_POINT;
255
+        //设置APPKEY
256
+        parMap.put("appkey", HKConstant.APPKEY);
257
+        //设置时间参数
258
+        parMap.put("time", System.currentTimeMillis());
259
+        parMap.put("pageNo",1);
260
+        parMap.put("pageSize",10);
261
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
262
+        parMap.put("parentUuid","1048576");
263
+        parMap.put("allChildren",1);
264
+        String params =  JSON.toJSONString(parMap);
265
+        log.info("根据中心UUID分页获取下级区域请求参数:{}", params);
266
+        String data = null;
267
+        try {
268
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
269
+            log.info("根据中心UUID分页获取下级区域 请求返回结果:{}",data);
270
+        } catch (Exception e) {
271
+            e.printStackTrace();
272
+            log.error("根据中心UUID分页获取下级区域获取失败!",e);
273
+            throw new RuntimeException("根据中心UUID分页获取下级区域获取失败!");
274
+        }
275
+
276
+        return data;
277
+    }
278
+
279
+    /**
280
+     * 根据区域UUID集获取门禁点
281
+     * @return
282
+     */
283
+    public static String getDoorsByRegionUuids(){
284
+        Map<String,Object> parMap = Maps.newHashMap();
285
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.DOORS_BY_REGION_UUIDS;
286
+        //设置APPKEY
287
+        parMap.put("appkey", HKConstant.APPKEY);
288
+        //设置时间参数
289
+        parMap.put("time", System.currentTimeMillis());
290
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
291
+        parMap.put("regionUuids","2a36878c9a4a49d290d253ac1b4746dc");
292
+        String params =  JSON.toJSONString(parMap);
293
+        log.info("根据区域UUID集获取门禁点请求参数:{}", params);
294
+        String data = null;
295
+        try {
296
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
297
+            log.info("根据区域UUID集获取门禁点 请求返回结果:{}",data);
298
+        } catch (Exception e) {
299
+            e.printStackTrace();
300
+            log.error("根据区域UUID集获取门禁点获取失败!",e);
301
+            throw new RuntimeException("根据区域UUID集获取门禁点获取失败!");
302
+        }
303
+
304
+        return data;
305
+    }
306
+
307
+    /**
308
+     * 根据人员ID集添加权限
309
+     * @return
310
+     */
311
+    public static String addAuthoritiesByPersonIds(String personIds){
312
+        Map<String,Object> parMap = Maps.newHashMap();
313
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ADD_AUTHORITIES_BY_PERSONIDS;
314
+        //设置APPKEY
315
+        parMap.put("appkey", HKConstant.APPKEY);
316
+        //设置时间参数
317
+        parMap.put("time", System.currentTimeMillis());
318
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
319
+        parMap.put("personIds",personIds);
320
+        parMap.put("doorGroupUuids","");
321
+        parMap.put("doorUuids","57231a05fd3b45f7a2570a28a85821c4,efcb9a3fe4e64e2f9c0f546c54465524,9da7c0073138453fa7782b629743cff7,85c22fde220d4b35ac13f805f05fd04c");
322
+        String params =  JSON.toJSONString(parMap);
323
+        log.info("根据人员ID集添加权限请求参数:{}", params);
324
+        String data = null;
325
+        try {
326
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
327
+            log.info("根据人员ID集添加权限 请求返回结果:{}",data);
328
+        } catch (Exception e) {
329
+            e.printStackTrace();
330
+            log.error("根据人员ID集添加权限!",e);
331
+            throw new RuntimeException("根据人员ID集添加权限!");
332
+        }
333
+
334
+        return data;
335
+    }
336
+
337
+    /**
338
+     * 根据设备UUID集异动下载门禁权限
339
+     * @return
340
+     */
341
+    public static String downloadAuthorityByDeviceUuids(){
342
+        Map<String,Object> parMap = Maps.newHashMap();
343
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.DOWNLOAD_AUTHORITY_BY_DEVICEUUIDS;
344
+        //设置APPKEY
345
+        parMap.put("appkey", HKConstant.APPKEY);
346
+        //设置时间参数
347
+        parMap.put("time", System.currentTimeMillis());
348
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
349
+        parMap.put("deviceUuids","57231a05fd3b45f7a2570a28a85821c4,efcb9a3fe4e64e2f9c0f546c54465524,9da7c0073138453fa7782b629743cff7,85c22fde220d4b35ac13f805f05fd04c");
350
+        String params =  JSON.toJSONString(parMap);
351
+        log.info("根据设备UUID集异动下载门禁权限请求参数:{}", params);
352
+        String data = null;
353
+        try {
354
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
355
+            log.info("根据设备UUID集异动下载门禁权限 请求返回结果:{}",data);
356
+        } catch (Exception e) {
357
+            e.printStackTrace();
358
+            log.error("根据设备UUID集异动下载门禁权限获取失败!",e);
359
+            throw new RuntimeException("根据设备UUID集异动下载门禁权限获取失败!");
360
+        }
361
+
362
+        return data;
363
+    }
364
+
365
+    /**
366
+     * 指定人员人脸/指纹权限下载
367
+     * @return
368
+     */
369
+    public static String downloadFaceAndFingerInfos(String personIds){
370
+        Map<String,Object> parMap = Maps.newHashMap();
371
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.DOWNLOAD_FACE_AND_FINGERINFOS;
372
+        //设置APPKEY
373
+        parMap.put("appkey", HKConstant.APPKEY);
374
+        //设置时间参数
375
+        parMap.put("time", System.currentTimeMillis());
376
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
377
+        parMap.put("deviceUuids","83dfab0eef52411d991d6e621296b60a,dfd80b22f00545b8b36fa981019df83c");
378
+        parMap.put("personIds",personIds);
379
+        parMap.put("type",1);
380
+        String params =  JSON.toJSONString(parMap);
381
+        log.info("指定人员人脸/指纹权限下载 请求参数:{}", params);
382
+        String data = null;
383
+        try {
384
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
385
+            log.info("指定人员人脸/指纹权限下载 请求返回结果:{}",data);
386
+        } catch (Exception e) {
387
+            e.printStackTrace();
388
+            log.error("指定人员人脸/指纹权限下载获取失败!",e);
389
+            throw new RuntimeException("指定人员人脸/指纹权限下载获取失败!");
390
+        }
391
+
392
+        return data;
393
+    }
394
+    /**
395
+     * 添加人脸
396
+     * faceImg 图片
397
+     * personNo 人员编号
398
+     * personName 名称
399
+     * @return
400
+     */
401
+    public static String HKpersonGroupId(MultipartFile faceImg,Integer personNo,String personName){
402
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_ADD_USER;
403
+        Map<String, Object> map = new HashMap<String, Object>();
404
+        map.put("appkey", HKConstant.APPKEY);
405
+        map.put("time", System.currentTimeMillis());
406
+        map.put("token", HKConstant.SECRET);
407
+        map.put("opUserUuid",HKConstant.OP_USER_UUID);
408
+        map.put("personNo",personNo);
409
+        map.put("personName",personName);
410
+        String params =  JSON.toJSONString(map);
411
+        String data = null;
412
+        try {
413
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
414
+        } catch (Exception e) {
415
+            e.printStackTrace();
416
+            throw new RuntimeException("添加人脸失败!");
417
+        }
418
+        return data;
419
+    }
420
+
421
+
422
+    /**
423
+     * 修改人脸
424
+     * faceImg 图片
425
+     * personId人员ID
426
+     * personNo 人员编号
427
+     * personName 名称
428
+     *  * personName 卡号
429
+     * @return
430
+     */
431
+    public static String HKpersonGroupId(MultipartFile faceImg,Integer personId,Integer personNo,String personName,String cardNo) {
432
+        byte [] fileByte = new byte[0];
433
+        try {
434
+            fileByte = faceImg.getBytes();
435
+        } catch (IOException e) {
436
+            e.printStackTrace();
437
+        }
438
+        byte[] imgs=PicUtils.compressPicForScale(fileByte,99L,"x");
439
+
440
+        String img = PicUtils.getImgStr(imgs);
441
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_UPDATE_USER;
442
+        Map<String, Object> map = new HashMap<String, Object>();
443
+        map.put("appkey", HKConstant.APPKEY);
444
+        map.put("time", System.currentTimeMillis());
445
+        map.put("token", HKConstant.SECRET);
446
+        map.put("opUserUuid", HKConstant.OP_USER_UUID);
447
+        map.put("personId", personId);
448
+        map.put("personNo", personNo);
449
+        map.put("personName", personName);
450
+        map.put("facePhoto", img);
451
+        map.put("cardNo", cardNo);
452
+        String params = JSON.toJSONString(map);
453
+        log.info("修改人脸 请求参数:{}",params);
454
+        String data = null;
455
+        try {
456
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
457
+            log.info("修改人脸请求结果:{}",data);
458
+        } catch (Exception e) {
459
+            e.printStackTrace();
460
+            log.error("修改人脸 请求失败:{}",e);
461
+            throw new RuntimeException("修改人脸失败!");
462
+        }
463
+
464
+        return data;
465
+    }
466
+
467
+    /**
468
+     * 修改人员
469
+     *
470
+     *  比如 住户
471
+     *
472
+     * @return
473
+     */
474
+    public static String updateUser(Map<String,Object> map) {
475
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_UPDATE_USER;
476
+        Map<String, Object> parMap = new HashMap<String, Object>();
477
+        //设置APPKEY
478
+        parMap.put("appkey", HKConstant.APPKEY);
479
+        //设置时间参数
480
+        parMap.put("time", System.currentTimeMillis());
481
+        parMap.put("opUserUuid",map.get("opUserUuid") == null?HKConstant.OP_USER_UUID:map.get("opUserUuid"));
482
+        parMap.put("personNo",map.get("personNo"));
483
+        parMap.put("personId",map.get("personId"));
484
+        parMap.put("personName",map.get("personName"));
485
+        parMap.put("phoneNo",map.get("phoneNo"));
486
+        parMap.put("deptUuid",map.get("deptUuid"));
487
+        String params =  JSON.toJSONString(parMap);
488
+        log.info("修改人员 请求参数:{}", params);
489
+        String data = null;
490
+        try {
491
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
492
+            log.info("修改人员 请求返回结果:{}",data);
493
+        } catch (Exception e) {
494
+            e.printStackTrace();
495
+            log.error("修改加人员失败!",e);
496
+            throw new RuntimeException("修改加人员失败!");
497
+        }
498
+        return data;
499
+    }
500
+
501
+
502
+    /**
503
+     * 未预约登记
504
+     * @param visitorName 访客姓名
505
+     * @param phoneNo 联系电话
506
+     * @param personNum 来访人数
507
+     * @param startTime 来访时间
508
+     * @param endTime 离开时间
509
+     * @param personId 被访人ID
510
+     * @return
511
+     */
512
+    public static String temporaryRegister(String visitorName, String phoneNo,Integer personNum,Long startTime,Long endTime,Integer personId){
513
+        Map<String,Object> parMap = Maps.newHashMap();
514
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.TEMPORARY_REGISTER;
515
+        //设置APPKEY
516
+        parMap.put("appkey", HKConstant.APPKEY);
517
+        //设置时间参数
518
+        parMap.put("time", System.currentTimeMillis());
519
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
520
+        
521
+        parMap.put("visitorName",visitorName);
522
+        parMap.put("gender",1);
523
+        parMap.put("identityType",0);
524
+        parMap.put("phoneNo",phoneNo);
525
+        parMap.put("personNum",personNum);
526
+        parMap.put("startTime",startTime);
527
+        parMap.put("endTime",endTime);
528
+        parMap.put("isVip",0);
529
+        parMap.put("personId",personId);
530
+        String params =  JSON.toJSONString(parMap);
531
+        log.info("未预约登记 请求参数:{}", params);
532
+        String data = null;
533
+        try {
534
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
535
+            log.info("未预约登记 请求返回结果:{}",data);
536
+        } catch (Exception e) {
537
+            e.printStackTrace();
538
+            log.error("获取失败!",e);
539
+            throw new RuntimeException("获取失败!");
540
+        }
541
+    
542
+        return data;
543
+    }
544
+    
545
+    public static void main(String[] args) {
546
+        Map<String,Object> parMap = Maps.newHashMap();
547
+        String url = HKConstant.OPENAPI_IP_PORT_HTTP + "/openapi/service/eps/subscribeEventsFromMQEx";
548
+        //设置APPKEY
549
+        parMap.put("appkey", HKConstant.APPKEY);
550
+        //设置时间参数
551
+        parMap.put("time", System.currentTimeMillis());
552
+        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
553
+        parMap.put("eventTypes","198914,199941");
554
+        //parMap.put("subSystemUuid","3145728");
555
+        String params =  JSON.toJSONString(parMap);
556
+        log.info("分页获取门禁点信息请求参数:{}", params);
557
+        String data = null;
558
+        try {
559
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
560
+            log.info(" 请求返回结果:{}",data);
561
+        } catch (Exception e) {
562
+            e.printStackTrace();
563
+            log.error("获取失败!",e);
564
+            throw new RuntimeException("获取失败!");
565
+        }
566
+
567
+        System.out.println(data);
568
+
569
+    }
570
+
571
+}

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

@@ -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
+}

+ 210
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/test/OpenapiTest.java Visa fil

@@ -0,0 +1,210 @@
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
+
185
+
186
+	/**
187
+	 * HTTPS方式
188
+	 * 分页获取监控点信息 测试
189
+	 * @return
190
+	 * @throws Exception
191
+	 */
192
+	private static String testGetDoorEventsHistory() throws Exception{
193
+		String url = OPENAPI_IP_PORT_HTTPS + "/openapi/service/acs/event/getDoorEventsHistory";
194
+		Map<String, Object> map = new HashMap<String, Object>();
195
+		map.put("appkey", APPKEY);//设置APPKEY
196
+		map.put("time", System.currentTimeMillis());//设置时间参数
197
+		map.put("pageNo", 1);//设置分页参数
198
+		map.put("pageSize", 5);//设置分页参数
199
+		map.put("opUserUuid", OP_USER_UUID);//设置操作用户UUID
200
+		String params = JSON.toJSONString(map);
201
+		System.out.println(" ====== getCameras请求参数:【" + params + "】");
202
+		String data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, null, SECRET), params);
203
+		System.out.println(" ====== getCameras请求返回结果:【{" + data + "}】");
204
+
205
+		return data;
206
+	}
207
+
208
+
209
+
210
+}

+ 2
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/config/HttpSessionConfig.java Visa fil

@@ -2,6 +2,7 @@ package com.community.huiju.config;
2 2
 
3 3
 import org.springframework.context.annotation.Bean;
4 4
 import org.springframework.context.annotation.Configuration;
5
+import org.springframework.session.MapSession;
5 6
 import org.springframework.session.jdbc.config.annotation.web.http.EnableJdbcHttpSession;
6 7
 import org.springframework.session.web.http.HeaderHttpSessionIdResolver;
7 8
 import org.springframework.session.web.http.HttpSessionIdResolver;
@@ -10,7 +11,7 @@ import org.springframework.session.web.http.HttpSessionIdResolver;
10 11
  * @author weiximei
11 12
  */
12 13
 @Configuration
13
-@EnableJdbcHttpSession
14
+@EnableJdbcHttpSession(maxInactiveIntervalInSeconds = MapSession.DEFAULT_MAX_INACTIVE_INTERVAL_SECONDS*4)
14 15
 public class HttpSessionConfig {
15 16
 
16 17
     @Bean

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

@@ -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 Visa fil

@@ -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
+}

+ 18
- 4
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/BillController.java Visa fil

@@ -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;
@@ -37,7 +37,9 @@ public class BillController {
37 37
 	@ApiImplicitParams({ @ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id"),
38 38
 			@ApiImplicitParam(paramType = "path", dataType = "Integer", name = "payType", value = "0是未缴费1是已缴费"),
39 39
 			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
40
-			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")})
40
+			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度"),
41
+			@ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
42
+	})
41 43
 	@RequestMapping(value = "/bills/{communityId}/{payType}",method = RequestMethod.GET)
42 44
 	public ResponseBean getBillInvoice(@PathVariable Integer communityId,
43 45
 									   @PathVariable Integer payType,
@@ -46,8 +48,14 @@ public class BillController {
46 48
 		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
47 49
 		Integer userId = userElement.getId();
48 50
 		ResponseBean responseBean = new ResponseBean();
49
-		List<Map<String,Object>> billsList = billServiceI.getBillsList(communityId, payType, userId, pageNum, pageSize);
50
-		responseBean.addSuccess(billsList);
51
+
52
+		if (!check(communityId)) {
53
+			responseBean.addError("小区不存在");
54
+			return responseBean;
55
+		}
56
+
57
+		Map<String, Object> map = billServiceI.getBillsList(communityId, payType, userId, pageNum, pageSize);
58
+		responseBean.addSuccess(map);
51 59
 		return responseBean;
52 60
 	}
53 61
 	
@@ -57,6 +65,12 @@ public class BillController {
57 65
 	@RequestMapping(value = "/bill/{communityId}/{billInvoiceId}",method = RequestMethod.GET)
58 66
 	public ResponseBean getBillInvoiceDetail(@PathVariable Integer communityId,@PathVariable Integer billInvoiceId){
59 67
 		ResponseBean responseBean = new ResponseBean();
68
+
69
+		if (!check(communityId)) {
70
+			responseBean.addError("小区不存在");
71
+			return responseBean;
72
+		}
73
+
60 74
 		Map<String,Object> billInvoiceMap = billServiceI.getBillInvoiceDetail(communityId,billInvoiceId);
61 75
 		responseBean.addSuccess(billInvoiceMap);
62 76
 		return responseBean;

+ 73
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/FaceController.java Visa fil

@@ -0,0 +1,73 @@
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.RequestParam;
13
+import org.springframework.web.bind.annotation.RestController;
14
+import org.springframework.web.multipart.MultipartFile;
15
+
16
+import javax.servlet.http.HttpSession;
17
+
18
+@RestController
19
+@RefreshScope
20
+@RequestMapping("/")
21
+@Api(value = "人脸相关API", description = "人脸相关API")
22
+public class FaceController {
23
+    @Autowired
24
+    private FaceServiceI faceServicel;
25
+
26
+    @ApiOperation(value = "添加人脸图片", notes = "添加人脸图片")
27
+    @ApiImplicitParams({
28
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
29
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "otherUserID",value = "家属或租户ID,不填为本人")
30
+    })
31
+    
32
+    @RequestMapping(value = "/addFace",method = RequestMethod.POST)
33
+    public Object getTaFace(HttpSession session,
34
+                            @ApiParam(value = "file" ,required = true) MultipartFile uploadFile,
35
+                            @RequestParam(required = false) Integer otherUserID){
36
+        ResponseBean responseBean = new ResponseBean();
37
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
38
+        Integer userId = userElement.getId();
39
+        responseBean = faceServicel.addFace(userId ,uploadFile,otherUserID);
40
+        return responseBean;
41
+    }
42
+
43
+    @ApiOperation(value = "修改人脸图片", notes = "修改人脸图片")
44
+    @ApiImplicitParams({
45
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
46
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "otherUserID",value = "家属或租户ID,不填为本人")
47
+    })
48
+    @RequestMapping(value = "/upDateFace",method = RequestMethod.POST)
49
+    public Object upDateTaFace(HttpSession session,
50
+                               @ApiParam(value = "file" ,required = true) MultipartFile uploadFile,
51
+                               @RequestParam(required = false) Integer otherUserID
52
+                               ){
53
+        ResponseBean responseBean = new ResponseBean();
54
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
55
+        Integer userId = userElement.getId();
56
+         responseBean = faceServicel.upDateFace(userId,uploadFile,otherUserID);
57
+        return responseBean;
58
+    }
59
+
60
+    @ApiOperation(value = "获取当前已录入人脸信息", notes = "获取当前已录入人脸信息")
61
+    @ApiImplicitParams({
62
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
63
+            @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "otherUserID",value = "家属或租户ID,不填为本人")
64
+    })
65
+    @RequestMapping(value = "/getUserIdFace",method = RequestMethod.GET)
66
+    public Object getTaFaceByUserId(HttpSession session, @RequestParam(required = false) Integer otherUserID){
67
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
68
+        Integer userId = userElement.getId();
69
+        ResponseBean responseBean = faceServicel.getTaFaceByUserId(userId,otherUserID);
70
+        return responseBean;
71
+    }
72
+
73
+}

+ 25
- 25
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/ImageController.java Visa fil

@@ -1,13 +1,21 @@
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.ArrayList;
17
+import java.util.List;
18
+import java.util.Map;
11 19
 
12 20
 /**
13 21
  * @author weichaochao
@@ -21,27 +29,19 @@ import java.util.Date;
21 29
 @Api(value = "图片操作API", description = "图片操作API")
22 30
 public class ImageController {
23 31
 
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";
32
+    @Autowired
33
+    private ImageServiceI imageService;
28 34
 
29 35
     @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;
36
+    @PostMapping(value = "/uploadimage", consumes = "multipart/*", headers = "content-type=multipart/form-data")
37
+    public ResponseBean uploadImgAndGetUrl(@ApiParam(value = "uploadFiles" ,required = true) MultipartFile[] uploadFiles) throws Exception {
38
+        ResponseBean responseBean = new ResponseBean();
39
+        List<String> urls = new ArrayList<String>();
40
+        for (MultipartFile uploadFile : uploadFiles){
41
+            String url = imageService.getImageUrl(uploadFile);
42
+            urls.add(url);
43
+        }
44
+        responseBean.addSuccess(urls);
45
+        return responseBean;
46 46
     }
47 47
 }

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

@@ -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 Visa fil

@@ -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 Visa fil

@@ -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 = "100") 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
+}

+ 182
- 29
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java Visa fil

@@ -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;
@@ -49,29 +54,116 @@ public class SocialController {
49 54
 
50 55
     @RequestMapping(value = "/sign/{communityId}", method = RequestMethod.POST)
51 56
     @ApiOperation(value = "活动报名接口", notes = "活动报名接口")
57
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
58
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动Id"),
59
+            @ApiImplicitParam(paramType = "query", dataType = "String", name = "remark", value = "活动备注"),
60
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
61
+    public ResponseBean SignActivity(@PathVariable(value = "communityId") Integer communityId,
62
+                                     @RequestParam(value = "remark", required = false) String remark,
63
+                                     @RequestParam("activityId") Integer activityId,
64
+                                     HttpSession session) {
65
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
66
+        Integer userId = userElement.getId();
67
+
68
+        ResponseBean responseBean = new ResponseBean();
69
+
70
+        if (!check(communityId)) {
71
+            responseBean.addError("小区不存在");
72
+            return responseBean;
73
+        }
74
+
75
+        responseBean = socialServiceI.findTaUserInfo(activityId, communityId, userId,remark);
76
+        return responseBean;
77
+    }
78
+    
79
+    @RequestMapping(value = "/sign/cancel/{communityId}", method = RequestMethod.POST)
80
+    @ApiOperation(value = "取消活动报名接口", notes = "取消活动报名接口")
81
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
82
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动Id"),
83
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
84
+    public ResponseBean cancelSignActivity(@PathVariable(value = "communityId") Integer communityId, @RequestParam("activityId") Integer activityId, HttpSession session) {
85
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
86
+        Integer userId = userElement.getId();
87
+        
88
+        ResponseBean responseBean = new ResponseBean();
89
+        
90
+        if (!check(communityId)) {
91
+            responseBean.addError("小区不存在");
92
+            return responseBean;
93
+        }
94
+        //取消报名
95
+        responseBean = socialServiceI.cancelSignActivity(activityId, communityId, userId);
96
+        return responseBean;
97
+    }
98
+
99
+
100
+    @RequestMapping(value = "/sign/{communityId}", method = RequestMethod.PUT)
101
+    @ApiOperation(value = "修改活动报名接口", notes = "修改活动报名接口")
102
+    @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
103
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动Id"),
104
+            @ApiImplicitParam(paramType = "query", dataType = "String", name = "remark", value = "活动备注"),
105
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
106
+    public ResponseBean updateSignActivity(@PathVariable(value = "communityId") Integer communityId,
107
+                                     @RequestParam(value = "remark", required = false) String remark,
108
+                                     @RequestParam("activityId") Integer activityId,
109
+                                     HttpSession session) {
110
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
111
+        Integer userId = userElement.getId();
112
+
113
+        ResponseBean responseBean = new ResponseBean();
114
+        if (!check(communityId)) {
115
+            responseBean.addError("小区不存在");
116
+            return responseBean;
117
+        }
118
+
119
+        responseBean = socialServiceI.updateActivtiySignUp(activityId, communityId, userId,remark);
120
+        return responseBean;
121
+    }
122
+
123
+    @RequestMapping(value = "/sign/{communityId}", method = RequestMethod.GET)
124
+    @ApiOperation(value = "查看 活动报名情况", notes = "查看 活动报名情")
52 125
     @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
53 126
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "activityId", value = "活动Id"),
54 127
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")})
55
-    public ResponseBean SignActivity(@PathVariable(value = "communityId") Integer communityId, @RequestParam("activityId") Integer activityId, HttpSession session) {
128
+    public ResponseBean getSignActivityUp(@PathVariable(value = "communityId") Integer communityId,
129
+                                           @RequestParam("activityId") Integer activityId,
130
+                                           HttpSession session) {
56 131
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
57 132
         Integer userId = userElement.getId();
58
-        ResponseBean responseBean = socialServiceI.findTaUserInfo(activityId, communityId, userId);
133
+
134
+        ResponseBean responseBean = new ResponseBean();
135
+        if (!check(communityId)) {
136
+            responseBean.addError("小区不存在");
137
+            return responseBean;
138
+        }
139
+
140
+        responseBean = socialServiceI.getActivtiySignUp(activityId, communityId, userId);
59 141
         return responseBean;
60 142
     }
61 143
 
144
+
145
+
146
+
147
+
62 148
     @ApiOperation(value = "按小区获取分页公告列表", notes = "按小区获取分页公告列表,公告标题模糊查询")
63 149
     @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区Id"),
64 150
             @ApiImplicitParam(paramType = "query", dataType = "String", name = "title", value = "公告标题"),
65 151
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
66 152
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")})
67 153
     @RequestMapping(value = "/announcements/{communityId}", method = RequestMethod.GET)
68
-    public ResponseBean getAnnouncements(@PathVariable Integer communityId, @RequestParam String title,
154
+    public ResponseBean getAnnouncements(@PathVariable Integer communityId,
155
+                                         @RequestParam(required = false) String title,
69 156
                                          @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
70 157
                                          @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
71 158
         ResponseBean responseBean = new ResponseBean();
72
-        List<TpAnnouncement> announcementList = socialServiceI.getAnnouncements(communityId, title, pageNum, pageSize);
73
-        responseBean.addSuccess(announcementList);
74
-        return responseBean;
159
+
160
+        if (!check(communityId)) {
161
+            responseBean.addError("小区不存在");
162
+            return responseBean;
163
+        }
164
+
165
+        ResponseBean announcementList = socialServiceI.getAnnouncements(communityId, title, pageNum, pageSize);
166
+        return announcementList;
75 167
     }
76 168
 
77 169
     @ApiOperation(value = "获取公告轮播图", notes = "获取公告轮播图")
@@ -81,6 +173,12 @@ public class SocialController {
81 173
     @RequestMapping(value = "/announcement/Img/{communityId}", method = RequestMethod.GET)
82 174
     public ResponseBean getAnnouncement(@PathVariable(value = "communityId") Integer communityId) {
83 175
         ResponseBean responseBean = new ResponseBean();
176
+
177
+        if (!check(communityId)) {
178
+            responseBean.addError("小区不存在");
179
+            return responseBean;
180
+        }
181
+
84 182
         List<TpAnnouncement> agreement = socialServiceI.getAnnouncement(communityId);
85 183
         responseBean.addSuccess(agreement);
86 184
         return responseBean;
@@ -93,6 +191,12 @@ public class SocialController {
93 191
     @RequestMapping(value = "/activity/Img/{communityId}", method = RequestMethod.GET)
94 192
     public ResponseBean getActivity(@PathVariable(value = "communityId") Integer communityId) {
95 193
         ResponseBean responseBean = new ResponseBean();
194
+
195
+        if (!check(communityId)) {
196
+            responseBean.addError("小区不存在");
197
+            return responseBean;
198
+        }
199
+
96 200
         List<TpActivity> agreement = socialServiceI.getActivity(communityId);
97 201
         responseBean.addSuccess(agreement);
98 202
         return responseBean;
@@ -105,13 +209,19 @@ public class SocialController {
105 209
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
106 210
             @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")})
107 211
     @RequestMapping(value = "/activitys/{communityId}", method = RequestMethod.GET)
108
-    public ResponseBean getActivitys(@PathVariable Integer communityId, @RequestParam String title,
212
+    public ResponseBean getActivitys(@PathVariable Integer communityId,
213
+                                     @RequestParam(required = false) String title,
109 214
                                      @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
110 215
                                      @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
111 216
         ResponseBean responseBean = new ResponseBean();
112
-        List<TpActivity> activityList = socialServiceI.getActivitys(communityId, title, pageNum, pageSize);
113
-        responseBean.addSuccess(activityList);
114
-        return responseBean;
217
+
218
+        if (!check(communityId)) {
219
+            responseBean.addError("小区不存在");
220
+            return responseBean;
221
+        }
222
+
223
+        ResponseBean activityList = socialServiceI.getActivitys(communityId, title, pageNum, pageSize);
224
+        return activityList;
115 225
     }
116 226
 
117 227
     @ApiOperation(value = "论坛活动帖子详情", notes = "获取论坛活动帖子详情")
@@ -123,6 +233,12 @@ public class SocialController {
123 233
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
124 234
         Integer userId = userElement.getId();
125 235
         ResponseBean responseBean = new ResponseBean();
236
+
237
+        if (!check(communityId)) {
238
+            responseBean.addError("小区不存在");
239
+            return responseBean;
240
+        }
241
+
126 242
         TpActivity activity = socialServiceI.findActivityDetail(activityId, communityId, userId);
127 243
         responseBean.addSuccess(activity);
128 244
         return responseBean;
@@ -137,6 +253,12 @@ public class SocialController {
137 253
         ResponseBean responseBean = new ResponseBean();
138 254
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
139 255
         Integer userId = userElement.getId();
256
+
257
+        if (!check(communityId)) {
258
+            responseBean.addError("小区不存在");
259
+            return responseBean;
260
+        }
261
+
140 262
         TpTransaction activity = socialServiceI.findUsedDetails(activityId, communityId, userId);
141 263
         responseBean.addSuccess(activity);
142 264
         return responseBean;
@@ -145,27 +267,36 @@ public class SocialController {
145 267
     @ApiOperation(value = "获取所有的二手租赁帖子", notes = "获取所有的二手租赁帖子")
146 268
     @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
147 269
             @ApiImplicitParam(paramType = "query", dataType = "String", name = "type", value = "帖子类型"),
270
+            @ApiImplicitParam(paramType = "query", dataType = "String", name = "transactionTitle", value = "帖子标题"),
148 271
             @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,
272
+            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")}
273
+    )
274
+    @RequestMapping(value = "/getTransactions/{communityId}", method = RequestMethod.GET)
275
+    public ResponseBean getAllPosts(@PathVariable("communityId") Integer communityId,
276
+                                    @RequestParam(value = "type", required = false) String type,
277
+                                    @RequestParam(value = "transactionTitle",required = false) String transactionTitle,
152 278
                                     @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
153 279
                                     @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
154 280
         ResponseBean responseBean = new ResponseBean();
155
-        List<TpTransaction> tpTransactions = socialServiceI.findAllTransaction(communityId, type, pageNum, pageSize);
156
-        responseBean.addSuccess(tpTransactions);
157
-        return responseBean;
281
+
282
+        if (!check(communityId)) {
283
+            responseBean.addError("小区不存在");
284
+            return responseBean;
285
+        }
286
+
287
+        ResponseBean tpTransactions = socialServiceI.findAllTransaction(communityId, transactionTitle,type, pageNum, pageSize);
288
+        return tpTransactions;
158 289
     }
159 290
 
160 291
     @ApiOperation(value = "添加二手租赁帖子", notes = "添加二手租赁帖子")
161 292
     @ApiImplicitParams({
162
-            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
163
-                    "title:小区标题,content:小区类容, type"),
293
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value ="title:小区标题, imageUrl:图片URL地址, content:小区内容, type:0二手,1求购,2租赁"),
164 294
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
165 295
     })
166 296
     @RequestMapping(value = "/addTransaction", method = RequestMethod.POST)
167 297
     @ResponseBody
168
-    public ResponseBean addTransaction(@RequestBody String paramets, HttpSession session) {
298
+    public ResponseBean addTransaction(@RequestBody String paramets, HttpSession session)throws IOException{
299
+
169 300
         ResponseBean responseBean = new ResponseBean();
170 301
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
171 302
         Integer userId = userElement.getId();
@@ -182,30 +313,46 @@ public class SocialController {
182 313
     })
183 314
     @RequestMapping(value = "/selectAllTransaction", method = RequestMethod.GET)
184 315
     public ResponseBean selectAllTransaction(HttpSession session,
316
+                                             @RequestParam(value = "type",required = false) Integer type,
185 317
                                              @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
186 318
                                              @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
187 319
         ResponseBean responseBean = new ResponseBean();
188 320
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
189 321
         Integer userId = userElement.getId();
190
-        ResponseBean response = socialServiceI.selectAllTransaction(userId, pageNum, pageSize);
322
+        ResponseBean response = socialServiceI.selectAllTransaction(userId, pageNum, pageSize,type);
191 323
         return response;
192 324
     }
193 325
 
194 326
     @ApiOperation(value = "修改二手租赁帖子", notes = "修改二手租赁帖子")
195 327
     @ApiImplicitParams({
196 328
             @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
197
-                    "id:小区id,title:小区标题,content:小区类容"),
329
+                    "imageUrl:图片url,transactionTitle:小区标题,transactionContent:小区内容"),
330
+            @ApiImplicitParam(paramType = "path", dataType = "String", name = "id", value = "id:帖子id"),
198 331
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
199 332
     })
200
-    @RequestMapping(value = "/updateTransaction/{Id}", method = RequestMethod.PUT)
201
-    public ResponseBean ubdateTransaction(HttpSession session, @RequestBody String paramets) {
333
+    @RequestMapping(value = "/updateTransaction/{id}", method = RequestMethod.PUT)
334
+    public ResponseBean ubdateTransaction(HttpSession session,@PathVariable("id") String id, @RequestBody String paramets) {
202 335
         ResponseBean responseBean = new ResponseBean();
203 336
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
204 337
         Integer userId = userElement.getId();
205
-        ResponseBean response = socialServiceI.updateTransaction(paramets, userId);
338
+        ResponseBean response = socialServiceI.updateTransaction(paramets,userId,Integer.valueOf(id));
339
+        return response;
340
+    }
341
+
342
+    @ApiOperation(value = "删除二手租赁帖子", notes = "删除二手租赁帖子")
343
+    @ApiImplicitParams({
344
+            @ApiImplicitParam(paramType = "path", dataType = "String", name = "id", value = "id:帖子id"),
345
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
346
+    })
347
+    @RequestMapping(value = "/deleteTransaction/{id}", method = RequestMethod.DELETE)
348
+    public ResponseBean deleteTransaction(HttpSession session, @PathVariable("id") String id) {
349
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
350
+        Integer userId = userElement.getId();
351
+        ResponseBean response = socialServiceI.deleteransaction(Integer.valueOf(id),userId);
206 352
         return response;
207 353
     }
208 354
 
355
+
209 356
     @ApiOperation(value = "评价工单内容以及评分", notes = "评价工单内容以及评分")
210 357
     @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
211 358
             @ApiImplicitParam(name = "tpTicket", value = "报修", required = true, dataType = "TpTicket"),
@@ -216,6 +363,12 @@ public class SocialController {
216 363
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
217 364
         Integer userId = userElement.getId();
218 365
         ResponseBean responseBean = new ResponseBean();
366
+
367
+        if (!check(communityId)) {
368
+            responseBean.addError("小区不存在");
369
+            return responseBean;
370
+        }
371
+
219 372
         socialServiceI.accessTicket(communityId, tpTicket, ticketId, userId);
220 373
         return responseBean;
221 374
     }

+ 56
- 25
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TicketController.java Visa fil

@@ -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
-            @ApiImplicitParam(paramType = "query",dataType = "String",name = "type", value = "工单类型 (0报修/1投诉/2联系单)"),
94
+            @ApiImplicitParam(paramType = "query",dataType = "String",name = "type", value = "工单类型 (1:投诉   2:报修 3:联系物业)"),
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){
@@ -122,40 +145,41 @@ public class TicketController {
122 145
         return responseBean;
123 146
     }
124 147
 
125
-    @ApiOperation(value = "添加报修", notes = "添加报修")
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:工单内容,type: 1:投诉   2:报修 3:联系物业 , 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
 
142 164
     @ApiOperation(value = "物业,门卫,领导电话", notes = "物业,门卫,领导电话")
143 165
     @RequestMapping(value = "/allTpAnnouncementTel", method = RequestMethod.GET)
144 166
     public ResponseBean getTpAnnouncementTel() {
145
-        ResponseBean responseBean = new ResponseBean();
146 167
         ResponseBean agreement = agreementServicel.getTpAnnouncementTel();
147
-                responseBean.addSuccess(agreement);
148
-        return responseBean;
168
+        return agreement;
149 169
     }
150 170
 
151
-    @ApiOperation(value = "修改报修内容", notes = "修改报修内容")
171
+    @ApiOperation(value = "修改 报修/投诉/联系单", notes = "修改 报修/投诉/联系单")
152 172
     @ApiImplicitParams({@ApiImplicitParam(paramType = "path", dataType = "integer", name = "ticketId", value = "工单Id"),
153 173
             @ApiImplicitParam(name = "tpTicket", value = "报修", required = true, dataType = "TpTicket"),
154
-            @ApiImplicitParam(paramType = "query", dataType = "integer", name = "type", value = "工单类型")})
174
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
175
+    })
155 176
     @RequestMapping(value = "/updateTicket/{ticketId}", method = RequestMethod.POST)
156
-    public ResponseBean updateTicketContent(@PathVariable("ticketId") Integer ticketId, @RequestBody TpTicket tpTicket, @RequestParam("type") String type) {
177
+    public ResponseBean updateTicketContent(@PathVariable("ticketId") Integer ticketId,
178
+                                            @RequestBody TpTicket tpTicket,
179
+                                            HttpSession session) {
157 180
         ResponseBean responseBean = new ResponseBean();
158
-        iTicketService.updateTicketContent(ticketId, tpTicket, type);
181
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
182
+        responseBean = iTicketService.updateTicketContent(ticketId, tpTicket,userElement.getId());
159 183
         return responseBean;
160 184
     }
161 185
 
@@ -167,7 +191,14 @@ public class TicketController {
167 191
     public ResponseBean stopTicket(@PathVariable("communityId") Integer communityId, @RequestParam("ticketId") Integer ticketId, HttpSession session) {
168 192
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
169 193
         Integer userId = userElement.getId();
170
-        ResponseBean responseBean = iTicketService.stopTpTicketRecord(communityId, ticketId, userId);
194
+
195
+        ResponseBean responseBean = new ResponseBean();
196
+        if (!check(communityId)) {
197
+            responseBean.addError("小区不存在");
198
+            return responseBean;
199
+        }
200
+
201
+        responseBean = iTicketService.stopTpTicketRecord(communityId, ticketId, userId);
171 202
         return responseBean;
172 203
     }
173 204
 }

+ 38
- 6
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/UserController.java Visa fil

@@ -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;
@@ -63,7 +63,6 @@ public class UserController {
63 63
     @ApiOperation(value = "修改手机号", notes = "修改手机号")
64 64
     @ApiImplicitParams({
65 65
             @ApiImplicitParam(paramType = "body",dataType = "String",name = "paramets",value = "phone:登陆(手机号),code:(手机验证码)"),
66
-
67 66
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
68 67
     })
69 68
             @RequestMapping(value = "/user/phone",method = RequestMethod.PUT)
@@ -133,7 +132,7 @@ public class UserController {
133 132
             @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "userName(租客或者家属 姓名) " +
134 133
                     "phone(租客或者家属 手机号) " +
135 134
                     "gender(租客或者家属 性别 1男 2女) " +
136
-                    "type(1家属 0租客)"),
135
+                    "type(2租客 3家属)"),
137 136
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
138 137
     })
139 138
     @RequestMapping(value = "/user/addTenantsOrDependents",method = RequestMethod.POST)
@@ -153,6 +152,33 @@ public class UserController {
153 152
     }
154 153
 
155 154
 
155
+    @ApiOperation(value = "业主修改 租客或家属", notes = "业主修改 租客或家属")
156
+    @ApiImplicitParams({
157
+            @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "id(租客或者家属 ID) userName(租客或者家属 姓名) " +
158
+                    "phone(租客或者家属 手机号) " +
159
+                    "gender(租客或者家属 性别 1男 2女) " +
160
+                    "type(2租客 3家属)"),
161
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
162
+    })
163
+    @RequestMapping(value = "/user/updateTenantsOrDependents",method = RequestMethod.POST)
164
+    public ResponseBean updateTenantsOrDependents(@RequestBody String parameter,
165
+                                               HttpSession session){
166
+        ResponseBean response = new ResponseBean();
167
+
168
+        UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
169
+        JSONObject jsonObject = JSONObject.parseObject(parameter);
170
+        response = iTaUserService.updateTenantsOrDependents(jsonObject.getString("userName"),
171
+                jsonObject.getString("phone"),jsonObject.getString("gender"),
172
+                userElement.getId(),
173
+                jsonObject.getInteger("type"),
174
+                jsonObject.getInteger("id"));
175
+
176
+        return response;
177
+
178
+    }
179
+
180
+
181
+
156 182
     @ApiOperation(value = "修改用户头像", notes = "修改用户头像")
157 183
     @ApiImplicitParams({
158 184
             @ApiImplicitParam(paramType = "body",dataType = "String",name = "parameter",value = "headPortrait(用户头像)"),
@@ -170,16 +196,22 @@ public class UserController {
170 196
 
171 197
     }
172 198
 
173
-    @ApiOperation(value = "获取用户信息", notes = "获取用户信息")
199
+    @ApiOperation(value = "获取用户信息", notes = "获取用户信息, 携带userId表示查询租客或者家属")
174 200
     @ApiImplicitParams({
175 201
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
202
+            @ApiImplicitParam(paramType = "query",dataType = "String",name = "userId",value = "租客或者家属的ID(可选值)"),
176 203
     })
177 204
     @RequestMapping(value = "/user/info",method = RequestMethod.GET)
178
-    public ResponseBean getUserInfo(HttpSession session){
205
+    public ResponseBean getUserInfo(@RequestParam(value = "userId",required = false) Integer userId,
206
+                                    HttpSession session){
179 207
         ResponseBean response = new ResponseBean();
180 208
 
181 209
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
182
-        response = iTaUserService.getUserInfo(userElement.getId());
210
+        Integer id =  userElement.getId();
211
+
212
+        response = iTaUserService.getUserInfo(id,userId);
213
+        TaUserVO userVO = (TaUserVO) response.getData();
214
+        userVO.setToken(session.getId());
183 215
 
184 216
         return response;
185 217
 

+ 22
- 6
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/VistorController.java Visa fil

@@ -1,5 +1,6 @@
1 1
 package com.community.huiju.controller;
2 2
 
3
+import com.alibaba.fastjson.JSONObject;
3 4
 import com.community.commom.constant.Constant;
4 5
 import com.community.commom.mode.ResponseBean;
5 6
 import com.community.commom.session.UserElement;
@@ -26,21 +27,30 @@ import java.util.List;
26 27
 @RefreshScope
27 28
 @RequestMapping("/")
28 29
 @Api(value = "访客相关的API", description = "访客相关的API")
29
-public class VistorController {
30
+public class VistorController extends BaseController {
30 31
 
31 32
     @Autowired
32 33
     private TaVistorServiceI vistorServiceI;
33 34
 
34 35
     @RequestMapping(value = "/vistorDetail/{communityId}", method = RequestMethod.POST)
35
-    @ApiOperation(value = "获取访客信息", notes = "获取访客信息")
36
-    @ApiImplicitParams({@ApiImplicitParam(name = "taVisitor", value = "访客", required = true, dataType = "TaVisitor"),
36
+    @ApiOperation(value = "创建访客", notes = "创建访客")
37
+    @ApiImplicitParams({
37 38
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
38
-            @ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id")})
39
-    public ResponseBean findVistorDetail(@PathVariable("communityId")Integer communityId, @RequestBody TaVisitor taVisitor, HttpSession session) {
39
+            @ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id"),
40
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "parameter", value = "carLicense:车牌(数组),drivingStatus:0 是不开车 1是开车," +
41
+                    "visitorName:访问人姓名,visitorNum:访问人数,visitorTel:访问人电话,visitorStatrtTime:访问人电话,visitorEndTime:访问人结束时间")})
42
+    public ResponseBean findVistorDetail(@PathVariable("communityId")Integer communityId, @RequestBody String parameter, HttpSession session) {
40 43
         ResponseBean responseBean = new ResponseBean();
44
+
45
+        if (!check(communityId)) {
46
+            responseBean.addError("小区不存在");
47
+            return responseBean;
48
+        }
49
+
41 50
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
42 51
         Integer userId = userElement.getId();
43
-        vistorServiceI.insertTaVistor(taVisitor, communityId, userId);
52
+        TaVisitor taVisitor = JSONObject.parseObject(parameter,TaVisitor.class);
53
+        responseBean = vistorServiceI.insertTaVistor(taVisitor, communityId, userId);
44 54
         return  responseBean;
45 55
     }
46 56
 
@@ -50,6 +60,12 @@ public class VistorController {
50 60
             @ApiImplicitParam(paramType = "path", dataType = "integer", name = "communityId", value = "小区Id")})
51 61
     public ResponseBean invateHis(@PathVariable("communityId")Integer communityId, HttpSession session) {
52 62
         ResponseBean responseBean = new ResponseBean();
63
+
64
+        if (!check(communityId)) {
65
+            responseBean.addError("小区不存在");
66
+            return responseBean;
67
+        }
68
+
53 69
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
54 70
         Integer userId = userElement.getId();
55 71
         List<TaVisitor> taVisitors = vistorServiceI.invateHis(communityId, userId);

+ 33
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaFaceMapper.java Visa fil

@@ -0,0 +1,33 @@
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
+    /**
28
+     * 查看当前信息
29
+     * @param id
30
+     * @return
31
+     */
32
+    TaFace getById(@Param("id")Integer id);
33
+}

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

@@ -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 Visa fil

@@ -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
+}

+ 11
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaSysUserRoleMapper.java Visa fil

@@ -4,6 +4,8 @@ package com.community.huiju.dao;
4 4
 import com.community.huiju.model.TaSysUserRole;
5 5
 import org.apache.ibatis.annotations.Mapper;
6 6
 
7
+import java.util.Map;
8
+
7 9
 @Mapper
8 10
 public interface TaSysUserRoleMapper {
9 11
     int deleteByPrimaryKey(Integer id);
@@ -19,4 +21,13 @@ public interface TaSysUserRoleMapper {
19 21
     int updateByPrimaryKey(TaSysUserRole record);
20 22
 
21 23
     Integer findSysUserRoleByUserIdAndRoleId(Integer userId);
24
+
25
+    /**
26
+     *    communityId 小区ID
27
+     *    userId 用户ID
28
+     *
29
+     * @param map
30
+     * @return
31
+     */
32
+    TaSysUserRole selectByCommunityIdAndUserId(Map<String,Object> map);
22 33
 }

+ 17
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaUserMapper.java Visa fil

@@ -2,6 +2,7 @@ package com.community.huiju.dao;
2 2
 
3 3
 import com.community.huiju.model.TaUser;
4 4
 import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
5 6
 
6 7
 import java.util.List;
7 8
 import java.util.Map;
@@ -47,4 +48,20 @@ public interface TaUserMapper {
47 48
      * @return
48 49
      */
49 50
     List<TaUser> selectUserListByParentId(Integer parentId);
51
+
52
+    /**
53
+     * 判断当前用户的关联关系
54
+     * @param userId
55
+     * @param otherUserID
56
+     * @return
57
+     */
58
+    TaUser selectTaFaceParentId(@Param("id") Integer userId, @Param("otherUserID")Integer otherUserID);
59
+
60
+    /**
61
+     * 查询此电话在小区是否存在
62
+     * @param communityId
63
+     * @param phone
64
+     * @return
65
+     */
66
+    TaUser getByLoginName(@Param("id")Integer communityId, @Param("id")String phone);
50 67
 }

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaVisitorLicenseMapper.java Visa fil

@@ -21,5 +21,5 @@ public interface TaVisitorLicenseMapper {
21 21
 
22 22
     void insertTaVistorLicense(TaVisitorLicense taVisitorLicense);
23 23
 
24
-    List<Integer> findTaVistorLicenseById(Integer id);
24
+    List<String> findTaVistorLicenseById(Integer id);
25 25
 }

+ 47
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TdImagesMapper.java Visa fil

@@ -0,0 +1,47 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TdImages;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.Param;
6
+
7
+import java.util.List;
8
+import java.util.Map;
9
+
10
+@Mapper
11
+public interface TdImagesMapper {
12
+    int deleteByPrimaryKey(Integer id);
13
+
14
+    int insert(TdImages record);
15
+
16
+    int insertSelective(TdImages record);
17
+
18
+    TdImages selectByPrimaryKey(Integer id);
19
+
20
+    int updateByPrimaryKeySelective(TdImages record);
21
+
22
+    int updateByPrimaryKey(TdImages record);
23
+
24
+    List<TdImages> getByUUIDAndByType(Map<String,Object> map);
25
+
26
+    /**
27
+     * 批量删除
28
+     *  根据 uuid 和 type
29
+     * @param map
30
+     * @return
31
+     */
32
+    int deleteByUuidAndType(Map map);
33
+
34
+    /**
35
+     * 批量添加
36
+     * @param list
37
+     * @return
38
+     */
39
+    int insertBatch(List<TdImages> list);
40
+
41
+    /**
42
+     * 修改时删除当前图片
43
+     * @param uuid
44
+     * @param type
45
+     */
46
+    void deleteTdImages(@Param("uuid") Integer uuid, @Param("type") String type);
47
+}

+ 24
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpActivitySignupMapper.java Visa fil

@@ -22,4 +22,28 @@ public interface TpActivitySignupMapper {
22 22
     Integer sumActivitySignUpNum(@Param("id")Integer id, @Param("communityId")Integer communityId);
23 23
 
24 24
     Integer findTpActivetitySignByUserId(@Param("activityId") Integer activityId, @Param("communityId")Integer communityId, @Param("userId")Integer userId);
25
+
26
+    /**
27
+     * 获取报名总人数
28
+     * @param tpActivitySignup
29
+     * @return
30
+     */
31
+    Integer selectSignNum(TpActivitySignup tpActivitySignup);
32
+    
33
+    /**
34
+     * 删除报名
35
+     * @param tpActivitySignup
36
+     * @return
37
+     */
38
+    Integer deleteSignUp(TpActivitySignup tpActivitySignup);
39
+
40
+    /**
41
+     * 根据 活动ID 小区ID 用户ID 查询报名情况
42
+     * @param activityId
43
+     * @param communityId
44
+     * @param userId
45
+     * @return
46
+     */
47
+    TpActivitySignup selectTpActivetitySignByUserId(@Param("activityId") Integer activityId, @Param("communityId")Integer communityId, @Param("userId")Integer userId);
48
+
25 49
 }

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

@@ -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 Visa fil

@@ -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
 

+ 19
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpUserMapper.java Visa fil

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

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

@@ -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 Visa fil

@@ -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
+}

+ 105
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaSysMenu.java Visa fil

@@ -0,0 +1,105 @@
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 String remark;
23
+    
24
+    private List<TaSysMenuImg> menuImgList;
25
+
26
+    public Integer getId() {
27
+        return id;
28
+    }
29
+
30
+    public void setId(Integer id) {
31
+        this.id = id;
32
+    }
33
+
34
+    public Integer getCommunityId() {
35
+        return communityId;
36
+    }
37
+
38
+    public void setCommunityId(Integer communityId) {
39
+        this.communityId = communityId;
40
+    }
41
+
42
+    public String getMenuName() {
43
+        return menuName;
44
+    }
45
+
46
+    public void setMenuName(String menuName) {
47
+        this.menuName = menuName == null ? null : menuName.trim();
48
+    }
49
+
50
+    public String getMenuUrl() {
51
+        return menuUrl;
52
+    }
53
+
54
+    public void setMenuUrl(String menuUrl) {
55
+        this.menuUrl = menuUrl == null ? null : menuUrl.trim();
56
+    }
57
+
58
+    public Integer getParentId() {
59
+        return parentId;
60
+    }
61
+
62
+    public void setParentId(Integer parentId) {
63
+        this.parentId = parentId;
64
+    }
65
+
66
+    public Integer getSort() {
67
+        return sort;
68
+    }
69
+
70
+    public void setSort(Integer sort) {
71
+        this.sort = sort;
72
+    }
73
+
74
+    public String getMenuType() {
75
+        return menuType;
76
+    }
77
+
78
+    public void setMenuType(String menuType) {
79
+        this.menuType = menuType == null ? null : menuType.trim();
80
+    }
81
+
82
+    public String getStatus() {
83
+        return status;
84
+    }
85
+
86
+    public void setStatus(String status) {
87
+        this.status = status == null ? null : status.trim();
88
+    }
89
+    
90
+    public List<TaSysMenuImg> getMenuImgList() {
91
+        return menuImgList;
92
+    }
93
+    
94
+    public String getRemark() {
95
+        return remark;
96
+    }
97
+    
98
+    public void setRemark(String remark) {
99
+        this.remark = remark;
100
+    }
101
+    
102
+    public void setMenuImgList(List<TaSysMenuImg> menuImgList) {
103
+        this.menuImgList = menuImgList;
104
+    }
105
+}

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

@@ -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
+}

+ 55
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaUser.java Visa fil

@@ -39,6 +39,21 @@ 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
+
51
+    // 角色编号
52
+    private Integer role;
53
+
54
+    // 角色名称
55
+    private String roleName;
56
+
42 57
     public Integer getId() {
43 58
         return id;
44 59
     }
@@ -151,6 +166,14 @@ public class TaUser {
151 166
         this.verifyStatus = verifyStatus == null ? null : verifyStatus.trim();
152 167
     }
153 168
 
169
+    public String getFaceStatus() {
170
+        return faceStatus;
171
+    }
172
+
173
+    public void setFaceStatus(String faceStatus) {
174
+        this.faceStatus = faceStatus;
175
+    }
176
+
154 177
     public Integer getCreateUser() {
155 178
         return createUser;
156 179
     }
@@ -182,4 +205,36 @@ public class TaUser {
182 205
     public void setUpdateDate(Date updateDate) {
183 206
         this.updateDate = updateDate;
184 207
     }
208
+
209
+    public Integer getHkUserId() {
210
+        return hkUserId;
211
+    }
212
+
213
+    public void setHkUserId(Integer hkUserId) {
214
+        this.hkUserId = hkUserId;
215
+    }
216
+
217
+    public String getHkCardNo() {
218
+        return hkCardNo;
219
+    }
220
+
221
+    public void setHkCardNo(String hkCardNo) {
222
+        this.hkCardNo = hkCardNo;
223
+    }
224
+
225
+    public Integer getRole() {
226
+        return role;
227
+    }
228
+
229
+    public void setRole(Integer role) {
230
+        this.role = role;
231
+    }
232
+
233
+    public String getRoleName() {
234
+        return roleName;
235
+    }
236
+
237
+    public void setRoleName(String roleName) {
238
+        this.roleName = roleName;
239
+    }
185 240
 }

+ 6
- 6
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaVisitor.java Visa fil

@@ -16,7 +16,7 @@ public class TaVisitor {
16 16
 
17 17
     private Date visitorStatrtTime;
18 18
 
19
-    private Integer visitorEndTime;
19
+    private Date visitorEndTime;
20 20
 
21 21
     private String drivingStatus;
22 22
 
@@ -34,7 +34,7 @@ public class TaVisitor {
34 34
 
35 35
     private Date updateDate;
36 36
 
37
-    private List<Integer> carLicense;
37
+    private List<String> carLicense;
38 38
 
39 39
     public Integer getId() {
40 40
         return id;
@@ -84,11 +84,11 @@ public class TaVisitor {
84 84
         this.visitorStatrtTime = visitorStatrtTime;
85 85
     }
86 86
 
87
-    public Integer getVisitorEndTime() {
87
+    public Date getVisitorEndTime() {
88 88
         return visitorEndTime;
89 89
     }
90 90
 
91
-    public void setVisitorEndTime(Integer visitorEndTime) {
91
+    public void setVisitorEndTime(Date visitorEndTime) {
92 92
         this.visitorEndTime = visitorEndTime;
93 93
     }
94 94
 
@@ -156,11 +156,11 @@ public class TaVisitor {
156 156
         this.updateDate = updateDate;
157 157
     }
158 158
 
159
-    public List<Integer> getCarLicense() {
159
+    public List<String> getCarLicense() {
160 160
         return carLicense;
161 161
     }
162 162
 
163
-    public void setCarLicense(List<Integer> carLicense) {
163
+    public void setCarLicense(List<String> carLicense) {
164 164
         this.carLicense = carLicense;
165 165
     }
166 166
 }

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

@@ -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
+}

+ 24
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpActivity.java Visa fil

@@ -1,6 +1,7 @@
1 1
 package com.community.huiju.model;
2 2
 
3 3
 import java.util.Date;
4
+import java.util.List;
4 5
 
5 6
 public class TpActivity {
6 7
     private Integer id;
@@ -40,6 +41,13 @@ public class TpActivity {
40 41
     private Date updateDate;
41 42
     
42 43
     private String userName;
44
+    
45
+    /**
46
+     * 报名状态
47
+     */
48
+    private String signStatus;
49
+
50
+    private List<String> imgList;
43 51
 
44 52
     public Integer getId() {
45 53
         return id;
@@ -192,4 +200,20 @@ public class TpActivity {
192 200
     public void setUserName(String userName) {
193 201
         this.userName = userName;
194 202
     }
203
+    
204
+    public String getSignStatus() {
205
+        return signStatus;
206
+    }
207
+    
208
+    public void setSignStatus(String signStatus) {
209
+        this.signStatus = signStatus;
210
+    }
211
+    
212
+    public List<String> getImgList() {
213
+        return imgList;
214
+    }
215
+
216
+    public void setImgList(List<String> imgList) {
217
+        this.imgList = imgList;
218
+    }
195 219
 }

+ 11
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpAnnouncement.java Visa fil

@@ -1,6 +1,7 @@
1 1
 package com.community.huiju.model;
2 2
 
3 3
 import java.util.Date;
4
+import java.util.List;
4 5
 
5 6
 public class TpAnnouncement {
6 7
     private Integer id;
@@ -31,6 +32,8 @@ public class TpAnnouncement {
31 32
 
32 33
     private Date updateDate;
33 34
 
35
+    private List<String> imgList;
36
+
34 37
     public Integer getId() {
35 38
         return id;
36 39
     }
@@ -142,4 +145,12 @@ public class TpAnnouncement {
142 145
     public void setUserName(String userName) {
143 146
         this.userName = userName;
144 147
     }
148
+
149
+    public List<String> getImgList() {
150
+        return imgList;
151
+    }
152
+
153
+    public void setImgList(List<String> imgList) {
154
+        this.imgList = imgList;
155
+    }
145 156
 }

+ 75
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpMessage.java Visa fil

@@ -5,6 +5,8 @@ import java.util.Date;
5 5
 public class TpMessage {
6 6
     private Integer id;
7 7
 
8
+    private Integer ticketId;
9
+
8 10
     private Integer communityId;
9 11
 
10 12
     private String messageType;
@@ -36,6 +38,31 @@ public class TpMessage {
36 38
     private Integer updateUser;
37 39
 
38 40
     private Date updateDate;
41
+    
42
+    /**
43
+     * 工单状态
44
+     */
45
+    private String ticketStatus;
46
+    
47
+    /**
48
+     * 工单扭转自动添加的内容
49
+     */
50
+    private String content;
51
+    
52
+    /**
53
+     * 已读消息图标
54
+     */
55
+    private String readMessageIcon;
56
+    
57
+    /**
58
+     * 未读消息图标
59
+     */
60
+    private String unreadMessageIcon;
61
+    
62
+    /**
63
+     * 消息详情url链接
64
+     */
65
+    private String messageDetailUrl;
39 66
 
40 67
     public Integer getId() {
41 68
         return id;
@@ -45,6 +72,14 @@ public class TpMessage {
45 72
         this.id = id;
46 73
     }
47 74
 
75
+    public Integer getTicketId() {
76
+        return ticketId;
77
+    }
78
+
79
+    public void setTicketId(Integer ticketId) {
80
+        this.ticketId = ticketId;
81
+    }
82
+
48 83
     public Integer getCommunityId() {
49 84
         return communityId;
50 85
     }
@@ -172,4 +207,44 @@ public class TpMessage {
172 207
     public void setUpdateDate(Date updateDate) {
173 208
         this.updateDate = updateDate;
174 209
     }
210
+    
211
+    public String getTicketStatus() {
212
+        return ticketStatus;
213
+    }
214
+    
215
+    public void setTicketStatus(String ticketStatus) {
216
+        this.ticketStatus = ticketStatus;
217
+    }
218
+    
219
+    public String getContent() {
220
+        return content;
221
+    }
222
+    
223
+    public void setContent(String content) {
224
+        this.content = content;
225
+    }
226
+    
227
+    public String getReadMessageIcon() {
228
+        return readMessageIcon;
229
+    }
230
+    
231
+    public void setReadMessageIcon(String readMessageIcon) {
232
+        this.readMessageIcon = readMessageIcon;
233
+    }
234
+    
235
+    public String getUnreadMessageIcon() {
236
+        return unreadMessageIcon;
237
+    }
238
+    
239
+    public void setUnreadMessageIcon(String unreadMessageIcon) {
240
+        this.unreadMessageIcon = unreadMessageIcon;
241
+    }
242
+    
243
+    public String getMessageDetailUrl() {
244
+        return messageDetailUrl;
245
+    }
246
+    
247
+    public void setMessageDetailUrl(String messageDetailUrl) {
248
+        this.messageDetailUrl = messageDetailUrl;
249
+    }
175 250
 }

+ 12
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpTicket.java Visa fil

@@ -38,9 +38,12 @@ public class TpTicket {
38 38
     private Integer updateUser;
39 39
 
40 40
     private Date updateDate;
41
-    
41
+
42
+    private List<TdImages> tdImagesList;
43
+
42 44
     private List<TpTicketRecord> ticketRecordList;
43 45
 
46
+
44 47
     public Integer getId() {
45 48
         return id;
46 49
     }
@@ -176,4 +179,12 @@ public class TpTicket {
176 179
     public void setTicketRecordList(List<TpTicketRecord> ticketRecordList) {
177 180
         this.ticketRecordList = ticketRecordList;
178 181
     }
182
+
183
+    public List<TdImages> getTdImagesList() {
184
+        return tdImagesList;
185
+    }
186
+
187
+    public void setTdImagesList(List<TdImages> tdImagesList) {
188
+        this.tdImagesList = tdImagesList;
189
+    }
179 190
 }

+ 13
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpTicketRecord.java Visa fil

@@ -10,6 +10,11 @@ public class TpTicketRecord {
10 10
 
11 11
     private Integer ticketId;
12 12
 
13
+    /**
14
+     * 自动生成的回复
15
+     */
16
+    private String content;
17
+
13 18
     private String status;
14 19
     
15 20
     private String ticketStatusName;
@@ -44,6 +49,14 @@ public class TpTicketRecord {
44 49
         this.ticketId = ticketId;
45 50
     }
46 51
 
52
+    public String getContent() {
53
+        return content;
54
+    }
55
+
56
+    public void setContent(String content) {
57
+        this.content = content;
58
+    }
59
+
47 60
     public String getStatus() {
48 61
         return status;
49 62
     }

+ 29
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpTransaction.java Visa fil

@@ -1,6 +1,7 @@
1 1
 package com.community.huiju.model;
2 2
 
3 3
 import java.util.Date;
4
+import java.util.List;
4 5
 
5 6
 public class TpTransaction {
6 7
     private Integer id;
@@ -27,6 +28,26 @@ public class TpTransaction {
27 28
 
28 29
     private Date updateDate;
29 30
 
31
+    private List<String> imgList;
32
+
33
+    private  Integer roleId;
34
+
35
+    private  String roleName;
36
+
37
+    public String getRoleName() {
38
+        return roleName;
39
+    }
40
+
41
+    public void setRoleName(String roleName) {
42
+        this.roleName = roleName;
43
+    }
44
+
45
+    public Integer getRoleId() {
46
+        return roleId;
47
+    }
48
+    public void setRoleId(Integer roleId) {
49
+        this.roleId = roleId;
50
+    }
30 51
     public Integer getId() {
31 52
         return id;
32 53
     }
@@ -121,4 +142,12 @@ public class TpTransaction {
121 142
     public void setUpdateDate(Date updateDate) {
122 143
         this.updateDate = updateDate;
123 144
     }
145
+
146
+    public List<String> getImgList() {
147
+        return imgList;
148
+    }
149
+
150
+    public void setImgList(List<String> imgList) {
151
+        this.imgList = imgList;
152
+    }
124 153
 }

+ 135
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpUser.java Visa fil

@@ -0,0 +1,135 @@
1
+package com.community.huiju.model;
2
+
3
+import java.util.Date;
4
+
5
+public class TpUser {
6
+    private Integer id;
7
+
8
+    private Integer communityId;
9
+
10
+    private String userName;
11
+
12
+    private String loginName;
13
+
14
+    private String loginPassword;
15
+
16
+    private String status;
17
+
18
+    private String remark;
19
+
20
+    private String email;
21
+
22
+    private String headPortrait;
23
+
24
+    private Integer createUser;
25
+
26
+    private Date createDate;
27
+
28
+    private Integer updateUser;
29
+
30
+    private Date updateDate;
31
+
32
+    public Integer getId() {
33
+        return id;
34
+    }
35
+
36
+    public void setId(Integer id) {
37
+        this.id = id;
38
+    }
39
+
40
+    public Integer getCommunityId() {
41
+        return communityId;
42
+    }
43
+
44
+    public void setCommunityId(Integer communityId) {
45
+        this.communityId = communityId;
46
+    }
47
+
48
+    public String getUserName() {
49
+        return userName;
50
+    }
51
+
52
+    public void setUserName(String userName) {
53
+        this.userName = userName == null ? null : userName.trim();
54
+    }
55
+
56
+    public String getLoginName() {
57
+        return loginName;
58
+    }
59
+
60
+    public void setLoginName(String loginName) {
61
+        this.loginName = loginName == null ? null : loginName.trim();
62
+    }
63
+
64
+    public String getLoginPassword() {
65
+        return loginPassword;
66
+    }
67
+
68
+    public void setLoginPassword(String loginPassword) {
69
+        this.loginPassword = loginPassword == null ? null : loginPassword.trim();
70
+    }
71
+
72
+    public String getStatus() {
73
+        return status;
74
+    }
75
+
76
+    public void setStatus(String status) {
77
+        this.status = status == null ? null : status.trim();
78
+    }
79
+
80
+    public String getRemark() {
81
+        return remark;
82
+    }
83
+
84
+    public void setRemark(String remark) {
85
+        this.remark = remark == null ? null : remark.trim();
86
+    }
87
+
88
+    public String getEmail() {
89
+        return email;
90
+    }
91
+
92
+    public void setEmail(String email) {
93
+        this.email = email == null ? null : email.trim();
94
+    }
95
+
96
+    public String getHeadPortrait() {
97
+        return headPortrait;
98
+    }
99
+
100
+    public void setHeadPortrait(String headPortrait) {
101
+        this.headPortrait = headPortrait == null ? null : headPortrait.trim();
102
+    }
103
+
104
+    public Integer getCreateUser() {
105
+        return createUser;
106
+    }
107
+
108
+    public void setCreateUser(Integer createUser) {
109
+        this.createUser = createUser;
110
+    }
111
+
112
+    public Date getCreateDate() {
113
+        return createDate;
114
+    }
115
+
116
+    public void setCreateDate(Date createDate) {
117
+        this.createDate = createDate;
118
+    }
119
+
120
+    public Integer getUpdateUser() {
121
+        return updateUser;
122
+    }
123
+
124
+    public void setUpdateUser(Integer updateUser) {
125
+        this.updateUser = updateUser;
126
+    }
127
+
128
+    public Date getUpdateDate() {
129
+        return updateDate;
130
+    }
131
+
132
+    public void setUpdateDate(Date updateDate) {
133
+        this.updateDate = updateDate;
134
+    }
135
+}

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

@@ -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 Visa fil

@@ -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
 }

+ 32
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/FaceServiceI.java Visa fil

@@ -0,0 +1,32 @@
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 登入人ID
11
+     *  @param  uploadFile
12
+     *  @param otherUserID 关联家属或者租客ID
13
+     * @return
14
+     */
15
+    ResponseBean addFace(Integer userId ,MultipartFile uploadFile,Integer otherUserID);
16
+
17
+    /**
18
+     * 更新当前人脸
19
+     * @param userId 登入人ID
20
+     *  @param  uploadFile
21
+     *  @param otherUserID 关联家属或者租客ID
22
+     * @return
23
+     */
24
+    ResponseBean upDateFace(Integer userId ,MultipartFile uploadFile,Integer otherUserID);
25
+
26
+    /**
27
+     * 当前登入人是否有人脸信息
28
+     * @param userId
29
+     * @return
30
+     */
31
+    ResponseBean getTaFaceByUserId(Integer userId,Integer otherUserID);
32
+}

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

@@ -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
+}

+ 16
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITaUserService.java Visa fil

@@ -71,11 +71,23 @@ public interface ITaUserService {
71 71
      * @param phone
72 72
      * @param gender
73 73
      * @param currentUserId 当前用户(业主)
74
-     * @param type 1家属 0租客
74
+     * @param type 2租客 3家属
75 75
      * @return
76 76
      */
77 77
     ResponseBean addTenantsOrDependents(String userName, String phone, String gender,Integer currentUserId,Integer type);
78 78
 
79
+    /**
80
+     * 修改租客或者家属
81
+     * @param userName
82
+     * @param phone
83
+     * @param gender
84
+     * @param currentUserId 当前用户(业主)
85
+     * @param type 2租客 3家属
86
+     * @param userId 用户ID
87
+     * @return
88
+     */
89
+    ResponseBean updateTenantsOrDependents(String userName, String phone, String gender,Integer currentUserId,Integer type,Integer userId);
90
+
79 91
     /**
80 92
      * 修改用户头像
81 93
      * @param currentUserId
@@ -86,9 +98,10 @@ public interface ITaUserService {
86 98
 
87 99
     /**
88 100
      * 获取用户信息
89
-     * @param userId
101
+     * @param currenUserId 当前用户
102
+     * @param userId 被查询用户, 一般是业主情况下有效, 查的是下面的家属或者租客
90 103
      * @return
91 104
      */
92
-    ResponseBean getUserInfo(Integer userId);
105
+    ResponseBean getUserInfo(Integer currenUserId,Integer userId);
93 106
 
94 107
 }

+ 7
- 6
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ITicketService.java Visa fil

@@ -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
 /**
@@ -41,12 +42,12 @@ public interface ITicketService {
41 42
 
42 43
 
43 44
 	/**
44
-	 * 添加报修
45
+	 * 添加 维修/投诉/联系单
45 46
 	 * @param userId
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
 	 * 回复工单
@@ -56,15 +57,15 @@ public interface ITicketService {
56 57
 	Integer updateTicketsReply(TpTicketRecordComment tpTicketRecordComment, Integer userId);
57 58
 
58 59
 	/**
59
-	 * 修改报修内容
60
+	 * 修改 维修/投诉/联系单 内容
60 61
 	 * @param ticketId
61 62
 	 * @param tpTicket
62
-	 * @param type
63
+	 * @param userId
63 64
 	 */
64
-	void updateTicketContent(Integer ticketId, TpTicket tpTicket, String type);
65
+	ResponseBean updateTicketContent(Integer ticketId, TpTicket tpTicket,Integer userId);
65 66
 
66 67
 	/**
67
-	 * 终止报修
68
+	 * 终止 维修/投诉/联系单
68 69
 	 * @param communityId
69 70
 	 * @param ticketId
70 71
 	 * @return

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

@@ -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 Visa fil

@@ -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 Visa fil

@@ -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
 	 * 全部已读

+ 62
- 8
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java Visa fil

@@ -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
 /**
@@ -11,6 +12,14 @@ import java.util.List;
11 12
  * @date 2018/10/23
12 13
  */
13 14
 public interface SocialServiceI {
15
+
16
+	/**
17
+	 * 查看公告详情
18
+	 * @param id
19
+	 * @param communityId
20
+	 * @param userId
21
+	 * @return
22
+	 */
14 23
     TpAnnouncement findAnnouncementDetail(Integer id, Integer communityId, Integer userId);
15 24
 
16 25
 
@@ -22,7 +31,7 @@ public interface SocialServiceI {
22 31
 	 * @param pageSize
23 32
 	 * @return
24 33
 	 */
25
-	List<TpAnnouncement> getAnnouncements(Integer communityId, String title, Integer pageNum, Integer pageSize);
34
+	ResponseBean getAnnouncements(Integer communityId, String title, Integer pageNum, Integer pageSize);
26 35
 
27 36
 	/**
28 37
 	 * 公告轮播图
@@ -39,7 +48,7 @@ public interface SocialServiceI {
39 48
 	 * @param pageSize
40 49
 	 * @return
41 50
 	 */
42
-	List<TpActivity> getActivitys(Integer communityId, String title, Integer pageNum, Integer pageSize);
51
+	ResponseBean getActivitys(Integer communityId, String title, Integer pageNum, Integer pageSize);
43 52
 	
44 53
 	/**
45 54
 	 * 获取活动帖子详情
@@ -49,7 +58,34 @@ public interface SocialServiceI {
49 58
 	 */
50 59
 	TpActivity findActivityDetail(Integer activityId, Integer communityId, Integer userId);
51 60
 
52
-	ResponseBean findTaUserInfo(Integer id, Integer communityId, Integer userId);
61
+	/**
62
+	 * 活动报名
63
+	 * @param activityId
64
+	 * @param communityId
65
+	 * @param userId
66
+	 * @param remark
67
+	 * @return
68
+	 */
69
+	ResponseBean findTaUserInfo(Integer activityId, Integer communityId, Integer userId, String remark);
70
+
71
+	/**
72
+	 * 修改活动报名
73
+	 * @param activityId
74
+	 * @param communityId
75
+	 * @param userId
76
+	 * @param remark
77
+	 * @return
78
+	 */
79
+	ResponseBean updateActivtiySignUp(Integer activityId, Integer communityId, Integer userId, String remark);
80
+
81
+	/**
82
+	 * 查看 活动报名详情
83
+	 * @param activityId
84
+	 * @param communityId
85
+	 * @param userId
86
+	 * @return
87
+	 */
88
+	ResponseBean getActivtiySignUp(Integer activityId, Integer communityId, Integer userId);
53 89
 
54 90
 	/**
55 91
 	 * 获取二手租赁详情
@@ -62,26 +98,28 @@ public interface SocialServiceI {
62 98
 	 * 获取所有的交易帖子
63 99
 	 * @param communityId
64 100
 	 * @param type
101
+	 * @param transactionTitle
65 102
 	 * @return
66 103
 	 */
67
-	List<TpTransaction> findAllTransaction(Integer communityId, String type, Integer pageNum, Integer paeSize);
104
+	ResponseBean findAllTransaction(Integer communityId, String transactionTitle, String type, Integer pageNum, Integer paeSize);
68 105
 
69 106
 	/**
70 107
 	 * 添加二手租赁帖子
71 108
 	 */
72
-    ResponseBean addAllTransaction(Integer userId, String paramets);
109
+    ResponseBean addAllTransaction(Integer userId, String paramets)throws IOException;
110
+
73 111
 
74 112
 	/**
75
-	 * 获取当前用户所有的帖子
113
+	 * 获取当前用户发布所有的帖子
76 114
 	 * @param userId
77 115
 	 * @return
78 116
 	 */
79
-	ResponseBean selectAllTransaction(Integer userId,Integer pageNum,Integer pageSize);
117
+	ResponseBean selectAllTransaction(Integer userId,Integer pageNum,Integer pageSize,Integer type);
80 118
 
81 119
 	/**
82 120
 	 * 修改当前帖子
83 121
 	 */
84
-	ResponseBean updateTransaction(String paramets,Integer userId);
122
+	ResponseBean updateTransaction(String paramets,Integer userId,Integer id);
85 123
 
86 124
 	/**
87 125
 	 * 评价工单以及评分
@@ -97,4 +135,20 @@ public interface SocialServiceI {
97 135
 	 * @return
98 136
 	 */
99 137
 	List<TpActivity> getActivity(Integer communityId);
138
+	
139
+	/**
140
+	 * 取消报名接口
141
+	 * @param activityId
142
+	 * @param communityId
143
+	 * @param userId
144
+	 * @return
145
+	 */
146
+	ResponseBean cancelSignActivity(Integer activityId, Integer communityId, Integer userId);
147
+
148
+	/**
149
+	 * 删除二手租赁帖子
150
+ 	 * @param id
151
+	 * @return
152
+	 */
153
+	ResponseBean deleteransaction(Integer id,Integer userid);
100 154
 }

+ 9
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/TaVistorServiceI.java Visa fil

@@ -1,5 +1,6 @@
1 1
 package com.community.huiju.service;
2 2
 
3
+import com.community.commom.mode.ResponseBean;
3 4
 import com.community.huiju.model.TaVisitor;
4 5
 
5 6
 import java.util.List;
@@ -11,6 +12,13 @@ import java.util.List;
11 12
  * @date 2018/11/1
12 13
  */
13 14
 public interface TaVistorServiceI {
14
-    void insertTaVistor(TaVisitor taVisitor, Integer communityId, Integer userId);
15
+    /**
16
+     * 创建访客
17
+     * @param taVisitor
18
+     * @param communityId
19
+     * @param userId
20
+     * @return
21
+     */
22
+    ResponseBean insertTaVistor(TaVisitor taVisitor, Integer communityId, Integer userId);
15 23
     List<TaVisitor> invateHis(Integer communityId, Integer userId);
16 24
 }

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

@@ -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 Visa fil

@@ -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
 }

+ 262
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/FaceServicelimpl.java Visa fil

@@ -0,0 +1,262 @@
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 lombok.extern.slf4j.Slf4j;
16
+import org.springframework.beans.factory.annotation.Autowired;
17
+import org.springframework.stereotype.Service;
18
+import org.springframework.transaction.annotation.Transactional;
19
+import org.springframework.web.multipart.MultipartFile;
20
+import java.io.IOException;
21
+import java.util.Date;
22
+
23
+@Service("faceServicel")
24
+@Transactional
25
+@Slf4j
26
+public class FaceServicelimpl implements FaceServiceI {
27
+
28
+
29
+    @Autowired
30
+    private TaFaceMapper taFaceMapper;
31
+
32
+    @Autowired
33
+    private TaUserMapper taUserMapper;
34
+
35
+    @Autowired
36
+    private TaSysRoleMapper taSysRoleMapper;
37
+
38
+    @Autowired
39
+    private ImageServiceI imageServiceI;
40
+
41
+    @Override
42
+    @Transactional(rollbackFor = Exception.class)
43
+    public ResponseBean addFace(Integer userid, MultipartFile uploadFile,Integer otherUserID) {
44
+        ResponseBean responseBean= new ResponseBean();
45
+         String faceImg =img(uploadFile);
46
+        /**当otherUserID不为空时判断它是否是业主下的租客或者家属*/
47
+        if (null!= otherUserID && !userid.equals(otherUserID)) {
48
+                 responseBean = getTaFaceParentId(userid, otherUserID);
49
+            if ("1".equals(responseBean.getCode())){
50
+                responseBean.getMessage();
51
+                return responseBean;
52
+            }
53
+        }
54
+            Integer activeUser = otherUserID == null?userid:otherUserID;
55
+            TaUser user = taUserMapper.selectByPrimaryKey(activeUser);
56
+            TaFace taFace = new TaFace();
57
+            taFace.setFaceImg(faceImg);
58
+            taFace.setCommunityId(user.getCommunityId());
59
+            taFace.setTaUserId(activeUser);
60
+            taFace.setCreateUser(userid);
61
+            taFace.setUpdateUser(activeUser);
62
+            taFace.setCreateDate(new Date());
63
+            taFace.setUpdateDate(new Date());
64
+
65
+        /*验证身份*/
66
+        responseBean=addVerify( activeUser,  uploadFile, otherUserID, faceImg, taFace) ;
67
+        return responseBean;
68
+    }
69
+
70
+    /**
71
+     * 修改人脸信息
72
+      * @param userId 登入人ID
73
+     * @param  uploadFile
74
+     * @param otherUserID 关联家属或者租客ID
75
+     * @return
76
+     */
77
+    @Override
78
+    @Transactional(rollbackFor = Exception.class)
79
+    public ResponseBean upDateFace(Integer userId, MultipartFile uploadFile,Integer otherUserID) {
80
+        boolean isA = false;
81
+      ResponseBean responseBean= new ResponseBean();
82
+        String faceImg =img(uploadFile);
83
+        if (null!= otherUserID && !userId.equals(otherUserID)) {
84
+                 responseBean = getTaFaceParentId(userId, otherUserID);
85
+            if ("1".equals(responseBean.getCode())) {
86
+                responseBean.getMessage();
87
+                return responseBean;
88
+               }}
89
+            Integer activeUser = otherUserID == null?userId:otherUserID;
90
+            //当前修改的id否存在
91
+             TaFace face = taFaceMapper.getByUserId(activeUser);
92
+             if (null == face){
93
+                 responseBean.addError("您的信息不存在,请录入人脸");
94
+                 return responseBean;
95
+             }
96
+           TaUser user = taUserMapper.selectByPrimaryKey(activeUser);
97
+            TaFace taFace = new TaFace();
98
+            taFace.setTaUserId(activeUser);
99
+            taFace.setFaceImg(faceImg);
100
+            taFace.setUpdateUser(userId);
101
+            taFace.setUpdateDate(new Date());
102
+            ResponseBean resps = checKout(faceImg, taFace, isA, uploadFile, activeUser);
103
+        if (resps.getCode().equals("0")) {
104
+            resps.addSuccess("图片修改成功");
105
+        } else {
106
+            resps.addError(resps.getMessage());
107
+        }
108
+        return resps;
109
+    }
110
+
111
+    /**
112
+     *验证图片是否为人脸,推送海康
113
+     */
114
+    public ResponseBean checKout(String faceImg, TaFace taFace, boolean isA, MultipartFile uploadFile, Integer userId) {
115
+        ResponseBean responseBean = new ResponseBean();
116
+        TaUser user = taUserMapper.selectByPrimaryKey(userId);
117
+        if (user.getHkUserId() == null) {
118
+            responseBean.addError("海康人员ID不存在,无法录入");
119
+            log.error("本地库人员ID:{}  的海康人员ID不存在", userId);
120
+            return responseBean;
121
+        }
122
+        AESDecode aesd = new AESDecode();
123
+        String body = "{\"type\": \"0\", \"image_url\":\"" + faceImg + "\"}";
124
+        try {
125
+                responseBean = aesd.send(body);
126
+                JSONObject jsonObject = JSONObject.parseObject(responseBean.getMessage());
127
+                Integer type = (Integer) jsonObject.get("errno");
128
+                Integer faceNum = (Integer) jsonObject.get("face_num");
129
+
130
+             /*推送海康*/
131
+            String data=HKOpenApi.HKpersonGroupId(uploadFile, user.getHkUserId(), user.getId(), user.getUserName(), user.getHkCardNo());
132
+
133
+              /*boolean isA为true进行添加,为false进行修改*/
134
+            if (0 == type && 1 == faceNum) {
135
+                if (null == data) {
136
+                    throw new RuntimeException("海康人脸推送失敗!");
137
+                }
138
+                if (isA) {
139
+                    taFaceMapper.insertSelective(taFace);
140
+                }else {
141
+                    taFaceMapper.updateByPrimaryKeySelective(taFace);
142
+                }
143
+                responseBean.addSuccess("操作成功");
144
+                HKOpenApi.downloadFaceAndFingerInfos(String.valueOf(user.getHkUserId()));
145
+            }else {
146
+                responseBean.addError("请录入正确图片");
147
+            }
148
+        } catch (Exception e) {
149
+            e.printStackTrace();
150
+            log.error("海康人脸推送失敗! {}",e);
151
+            throw new RuntimeException("海康人脸推送失敗!");
152
+        }
153
+        return responseBean;
154
+    }
155
+
156
+    /**
157
+     *获得用户,租客,家属,其中一种身份的信息
158
+     */
159
+    @Override
160
+    public ResponseBean getTaFaceByUserId(Integer userId,Integer otherUserID) {
161
+        ResponseBean responseBean= new ResponseBean();
162
+        /**当otherUserID不为空时判断它是否是业主下的租客或者家属*/
163
+        if (null!= otherUserID && !userId.equals(otherUserID)) {
164
+            responseBean = getTaFaceParentId(userId, otherUserID);
165
+            if ("1".equals(responseBean.getCode())) {
166
+                responseBean.getMessage();
167
+                return responseBean;
168
+            }
169
+        }
170
+        Integer id = otherUserID == null?userId:otherUserID;
171
+        TaFace face = taFaceMapper.getByUserId(id);
172
+         if (null!= face){
173
+            responseBean.addSuccess(face);
174
+            return responseBean;
175
+        }
176
+            responseBean.addError("当前用户暂无人脸图片");
177
+            return responseBean;
178
+
179
+    }
180
+
181
+    /**
182
+     *判断当前用户下的人员关系(家属,租客)
183
+     */
184
+    public ResponseBean getTaFaceParentId(Integer userId,Integer otherUserID){
185
+       ResponseBean  responseBean= new ResponseBean();
186
+/*         TaUser user = taUserMapper.selectTaFaceParentId(userId,otherUserID);*/
187
+        TaUser  users= taUserMapper.selectByPrimaryKey(otherUserID);
188
+        if (null!= users && !users.getParentId().equals(userId)){
189
+            responseBean.addError("您输入的家属或租户ID有误");
190
+            return responseBean;
191
+        }
192
+        return responseBean;
193
+    }
194
+
195
+    /**
196
+     * 得到当前图片
197
+     */
198
+    private String img(MultipartFile uploadFile){
199
+        String faceImg = null;
200
+        try {
201
+            faceImg = imageServiceI.getImageUrl(uploadFile);
202
+        } catch (IOException e) {
203
+            e.printStackTrace();
204
+        }
205
+        return faceImg;
206
+    }
207
+
208
+    /**
209
+     *各种身份校验
210
+     */
211
+    public ResponseBean addVerify(Integer userid, MultipartFile uploadFile,Integer otherUserID,String faceImg,TaFace taFace) {
212
+        ResponseBean response = new ResponseBean();
213
+        TaSysRole sysRole = taSysRoleMapper.findRoleByUserId(userid);
214
+        TaUser taUser = taUserMapper.selectByPrimaryKey(userid);
215
+        if (null!=taUser && null!=sysRole
216
+                && Constant.INVALID.equals(taUser.getStatus())&& Constant.OWNER.equals(sysRole.getRoleName())) {
217
+            response.addError("9996", "您的身份已停用,请联系物业");
218
+            return response;
219
+        }
220
+        //身份为家属租客,状态为已停用
221
+        if (null!=taUser && null!=sysRole){
222
+            if (Constant.INVALID.equals(taUser.getStatus()) && ((Constant.RELATION.equals(sysRole.getRoleName())) || Constant.TENANT.equals(sysRole.getRoleName()))){
223
+                response.addError("9996", "您的身份已停用,请联系物业");
224
+                return response;
225
+            }
226
+        }
227
+        //查询当前用户是否有人脸记录
228
+        TaFace User = taFaceMapper.getByUserId(userid);
229
+        if (null == User) {
230
+            boolean isA = true;
231
+            if (Constant.OWNER.equals(sysRole.getRoleName()) && "1".equals(taUser.getVerifyStatus())) {
232
+                ResponseBean resps = checKout(faceImg, taFace, isA, uploadFile, userid);
233
+                if (resps.getCode().equals("0")) {
234
+                    taUser.setFaceStatus("1");
235
+                    taUserMapper.updateByPrimaryKeySelective(taUser);
236
+                    resps.addSuccess("图片录入成功");
237
+                } else {
238
+                    resps.addError(resps.getMessage());
239
+                }
240
+                return resps;
241
+            }
242
+            //家属或者租客,已认证
243
+            if (Constant.RELATION.equals(sysRole.getRoleName()) || Constant.TENANT.equals(sysRole.getRoleName()) && "1".equals(taUser.getVerifyStatus())) {
244
+                ResponseBean resps = checKout(faceImg, taFace, isA, uploadFile, userid);
245
+                if (resps.getCode().equals("0")) {
246
+                    taUser.setFaceStatus("1");
247
+                    taUserMapper.updateByPrimaryKeySelective(taUser);
248
+                    resps.addSuccess("图片录入成功");
249
+                } else {
250
+                    resps.addError(resps.getMessage());
251
+                }
252
+                return resps;
253
+            }
254
+        }
255
+        response.addError("您的信息已存在");
256
+        return response;
257
+    }
258
+
259
+
260
+}
261
+
262
+

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

@@ -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-shanghai.aliyuncs.com";
22
+    private static String accessKeyId = "LTAIkc75dpkJw8Lb";
23
+    private static String accessKeySecret = "v4bvXCaix6vSDTCFfwSAdqV53iFEQw";
24
+    private static String bucketName = "jingcheng-h5temp";
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 Visa fil

@@ -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 Visa fil

@@ -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
 	/**

+ 84
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/MonitoringServiceImpl.java Visa fil

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

+ 255
- 39
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java Visa fil

@@ -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;
13
+import com.sun.org.apache.bcel.internal.generic.NEW;
14
+import org.springframework.beans.BeanUtils;
11 15
 import org.springframework.beans.factory.annotation.Autowired;
12 16
 import org.springframework.stereotype.Service;
13 17
 import org.springframework.transaction.annotation.Transactional;
14 18
 
15
-import java.text.SimpleDateFormat;
16
-import java.util.Date;
17
-import java.util.List;
19
+import java.io.IOException;
20
+import java.util.*;
21
+import java.util.stream.Collectors;
18 22
 
19 23
 /**
20 24
  * @author weichaochao
@@ -57,6 +61,13 @@ 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 TpUserMapper tpUserMapper;
69
+
70
+
60 71
     @Override
61 72
     @Transactional
62 73
     public TpAnnouncement findAnnouncementDetail(Integer id, Integer communityId, Integer userId) {
@@ -65,7 +76,17 @@ public class SocialServiceImpl implements SocialServiceI {
65 76
         if (null != allViewNum){
66 77
             tpAnnouncementMapper.updateByPrimaryKeySelective(id, allViewNum);
67 78
         }
68
-        return tpAnnouncementMapper.selectByPrimaryKey(id, communityId);
79
+        TpAnnouncement tpAnnouncement = tpAnnouncementMapper.selectByPrimaryKey(id, communityId);
80
+        tpAnnouncement.setUserName(tpUserMapper.selectByPrimaryKey(tpAnnouncement.getCreateUser()).getUserName());
81
+
82
+        Map<String,Object> map = Maps.newHashMap();
83
+        map.put("uuid",tpAnnouncement.getId());
84
+        map.put("type",Constant.ANNOUNCEMENT);
85
+        // 查询图片
86
+        List<TdImages> tdImagesList = tdImagesMapper.getByUUIDAndByType(map);
87
+        List<String> imgList = tdImagesList.stream().map(e->new String(e.getImageUrl())).collect(Collectors.toList());
88
+        tpAnnouncement.setImgList(imgList);
89
+        return tpAnnouncement;
69 90
     }
70 91
 
71 92
     /**
@@ -77,12 +98,17 @@ public class SocialServiceImpl implements SocialServiceI {
77 98
      * @return
78 99
      */
79 100
     @Override
80
-    public List<TpAnnouncement> getAnnouncements(Integer communityId,String title, Integer pageNum, Integer pageSize) {
101
+    public ResponseBean getAnnouncements(Integer communityId, String title, Integer pageNum, Integer pageSize) {
102
+        ResponseBean responseBean=new ResponseBean();
103
+        Map<String, Object> parameter = Maps.newHashMap();
81 104
         //使用分页插件
82
-        PageHelper.startPage(pageNum, pageSize);
105
+        Page<TpAnnouncement> pageannouncementList=PageHelper.startPage(pageNum, pageSize);
83 106
         // 获取数据
84 107
         List<TpAnnouncement> announcementList = tpAnnouncementMapper.getAnnouncements(communityId,title);
85
-        return announcementList;
108
+        parameter.put("total",pageannouncementList.getTotal());
109
+        parameter.put("list",announcementList);
110
+        responseBean.addSuccess(parameter);
111
+        return responseBean;
86 112
     }
87 113
     /**
88 114
      * 根据当前小区ID查出轮播图
@@ -106,12 +132,17 @@ public class SocialServiceImpl implements SocialServiceI {
106 132
      * @return
107 133
      */
108 134
     @Override
109
-    public List<TpActivity> getActivitys(Integer communityId, String title, Integer pageNum, Integer pageSize) {
135
+    public ResponseBean getActivitys(Integer communityId, String title, Integer pageNum, Integer pageSize) {
136
+        ResponseBean responseBean= new ResponseBean();
137
+        Map<String, Object> result = Maps.newHashMap();
110 138
         //使用分页插件
111
-        PageHelper.startPage(pageNum, pageSize);
139
+        Page<TpActivity> pageactivityList=PageHelper.startPage(pageNum, pageSize);
112 140
         // 获取数据
113 141
         List<TpActivity> activityList = tpActivityMapper.getActivitys(communityId,title);
114
-        return activityList;
142
+        result.put("list",activityList);
143
+        result.put("total",pageactivityList.getTotal());
144
+        responseBean.addSuccess(result);
145
+        return responseBean;
115 146
     }
116 147
     
117 148
     /**
@@ -130,7 +161,22 @@ public class SocialServiceImpl implements SocialServiceI {
130 161
             activity.setViewCount(allViewNum);
131 162
             tpActivityMapper.updateByPrimaryKeySelective(activity);
132 163
         }
133
-        return tpActivityMapper.selectByPrimaryKey(activityId,communityId);
164
+
165
+        TpActivity tpActivity = tpActivityMapper.selectByPrimaryKey(activityId,communityId);
166
+        //返回报名状态
167
+        Integer signNum = tpActivitySignupMapper.findTpActivetitySignByUserId(tpActivity.getId(), communityId, userId);
168
+        String signStatus = signNum != 0 ? Constant.STATUS_SIGNED : Constant.STATUS_UNSIGN;
169
+        tpActivity.setSignStatus(signStatus);
170
+        
171
+        Map<String,Object> map = Maps.newHashMap();
172
+        map.put("uuid",tpActivity.getId());
173
+        map.put("type",Constant.ACTIVITY);
174
+        // 查询图片
175
+        List<TdImages> tdImagesList = tdImagesMapper.getByUUIDAndByType(map);
176
+        List<String> imgList = tdImagesList.stream().map(e->new String(e.getImageUrl())).collect(Collectors.toList());
177
+        tpActivity.setImgList(imgList);
178
+
179
+        return tpActivity;
134 180
     }
135 181
     
136 182
     /**
@@ -161,7 +207,7 @@ public class SocialServiceImpl implements SocialServiceI {
161 207
     }
162 208
 
163 209
     @Override
164
-    public ResponseBean findTaUserInfo(Integer activityId, Integer communityId, Integer userId) {
210
+    public ResponseBean findTaUserInfo(Integer activityId, Integer communityId, Integer userId,String remark) {
165 211
         ResponseBean responseBean = new ResponseBean();
166 212
         TpActivity tpActivity = tpActivityMapper.selectByPrimaryKey(activityId, communityId);
167 213
         //判断是否已经过了报名截至时间
@@ -206,32 +252,38 @@ public class SocialServiceImpl implements SocialServiceI {
206 252
                 || Constant.TENANT.equals(sysRole.getRoleName())
207 253
                 || Constant.OWNER.equals(sysRole.getRoleName()))){
208 254
 
209
-            return insertActivitySignUp(tpActivity, communityId, userId);
255
+            return insertActivitySignUp(tpActivity, communityId, userId, remark);
210 256
         }
211 257
         responseBean.addError("9995", "无法确认您的身份,请联系物业");
212 258
         return responseBean;
213 259
     }
214 260
 
215 261
     @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);
262
+    public ResponseBean findAllTransaction(Integer communityId,String transactionTitle, String type, Integer pageNum, Integer paeSize) {
263
+        Map<String, Object> parameter = Maps.newHashMap();
264
+       ResponseBean  responseBean= new ResponseBean();
265
+        Page<TpTransaction> pageList=PageHelper.startPage(pageNum, paeSize);
266
+        List<TpTransaction> List= tpTransactionMapper.findAllTransaction(communityId, transactionTitle,type);
267
+        parameter.put("list",List);
268
+        parameter.put("total",pageList.getTotal());
269
+        responseBean.addSuccess(parameter);
270
+        return responseBean;
271
+
219 272
     }
220 273
 
221 274
 
222 275
     @Transactional
223 276
     @Override
224
-    public ResponseBean addAllTransaction(Integer userId, String paramets) {
225
-
277
+    public ResponseBean addAllTransaction(Integer userId, String paramets) throws IOException {
226 278
         ResponseBean response = new ResponseBean();
227
-
228 279
         JSONObject jsonObject = JSONObject.parseObject(paramets);
229 280
         String transactionTitle = (String) jsonObject.get("title");
230 281
         String transactionContent = (String) jsonObject.get("content");
231 282
         String  type= (String) jsonObject.get("type");
283
+        String imageUrl = (String) jsonObject.get("imageUrl");
232 284
 
233 285
         TaUser user=taUserMapper.selectByPrimaryKey(userId);
234
-        TpTransaction tpTransaction=new TpTransaction();
286
+        TpTransaction tpTransaction = new TpTransaction();
235 287
         tpTransaction.setTransactionTitle(transactionTitle);
236 288
         tpTransaction.setTransactionContent(transactionContent);
237 289
         tpTransaction.setType(type);
@@ -261,44 +313,121 @@ public class SocialServiceImpl implements SocialServiceI {
261 313
             return response;
262 314
         }
263 315
 
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())){
316
+        if (Constant.EFFECTIVE.equals(taUser.getStatus()) && (Constant.RELATION.equals(sysRole.getRoleName()) || Constant.TENANT.equals(sysRole.getRoleName()) || Constant.OWNER.equals(sysRole.getRoleName()))){
268 317
             tpTransactionMapper.insertSelective(tpTransaction);
318
+            insertTdImage(tpTransaction, imageUrl, userId,Constant.TRANSACTION);
269 319
             TpTransaction tpTransaction1=tpTransactionMapper.getById(tpTransaction.getId());
270 320
             response.addSuccess(tpTransaction1);
321
+            return response;
271 322
         }
272 323
         response.addError("9995", "无法确认您的身份,请联系物业");
273 324
         return response;
274
-
275 325
     }
276 326
 
327
+    /**
328
+     * 图片入库
329
+     * @param tpTransaction
330
+     * @param imageUrl 多个图片都好分割
331
+     * @param userId
332
+     * @param type 服务:service, 公告:announcement , 活动:activity  租赁 : transaction
333
+     * @throws IOException
334
+     */
335
+    private void insertTdImage(TpTransaction tpTransaction, String imageUrl, Integer userId,String type) throws IOException {
336
+        String [] imgArr = imageUrl.split(",");
337
+        for (String url  : imgArr) {
338
+            TdImages tdImages = new TdImages();
339
+            Integer uuId = tpTransaction.getId();
340
+            tdImages.setImageUrl(url);
341
+            tdImages.setType(type);
342
+            tdImages.setUuid(uuId);
343
+            tdImages.setCreateUser(userId);
344
+            tdImages.setCreateTime(new Date());
345
+            tdImagesMapper.insertSelective(tdImages);
346
+        }
347
+    }
277 348
     @Override
278
-    public ResponseBean selectAllTransaction(Integer userId,Integer pageNum,Integer paeSize) {
349
+    public ResponseBean selectAllTransaction(Integer userId,Integer pageNum,Integer paeSize,Integer type) {
279 350
         ResponseBean responseBean = new ResponseBean();
280 351
         TaUser user=taUserMapper.selectByPrimaryKey(userId);
281 352
          Integer communityId=user.getCommunityId();
282 353
 
283
-        PageHelper.startPage(pageNum, paeSize);
284
-        List<TpTransaction> tpTransactions=tpTransactionMapper.selectTransaction(userId,communityId);
354
+        //判断身份是否为业主且状态为已停用
355
+        TaSysRole sysRole = taSysRoleMapper.findRoleByUserId(userId);
356
+        TaUser taUser = taUserMapper.selectByPrimaryKey(userId);
357
+        if (Constant.INVALID.equals(taUser.getStatus())
358
+                && Constant.OWNER.equals(sysRole.getRoleName())){
359
+
360
+            responseBean.addError("9996", "您的身份已停用,请联系物业");
361
+            return responseBean;
362
+        }
363
+
364
+        //身份为家属租客,状态为已停用
365
+        if (Constant.INVALID.equals(taUser.getStatus())
366
+                && (Constant.RELATION.equals(sysRole.getRoleName())) || Constant.TENANT.equals(sysRole.getRoleName())){
367
+
368
+            responseBean.addError("9996", "您的身份已停用,请联系物业");
369
+            return responseBean;
370
+        }
285 371
 
286
-        responseBean.addSuccess(tpTransactions);
372
+        if (Constant.EFFECTIVE.equals(taUser.getStatus()) && (Constant.RELATION.equals(sysRole.getRoleName()) || Constant.TENANT.equals(sysRole.getRoleName()) || Constant.OWNER.equals(sysRole.getRoleName()))){
373
+            Map<String, Object> parameter = Maps.newHashMap();
374
+            Page<TpTransaction> pageLsit=PageHelper.startPage(pageNum, paeSize);
375
+            List<TpTransaction> tpTransactions=tpTransactionMapper.selectTransaction(userId,communityId,type);
376
+            parameter.put("list",tpTransactions);
377
+            parameter.put("total",pageLsit.getTotal());
378
+            responseBean.addSuccess(parameter);
379
+            return responseBean;
380
+        }
381
+        responseBean.addError("9995", "无法确认您的身份,请联系物业");
287 382
         return responseBean;
288 383
     }
289 384
 
290 385
     @Override
291
-    public ResponseBean updateTransaction(String paramets,Integer userId) {
386
+    @Transactional(rollbackFor = Exception.class)
387
+    public ResponseBean updateTransaction(String paramets,Integer userId,Integer id) {
292 388
         ResponseBean response = new ResponseBean();
293 389
         JSONObject jsonObject = JSONObject.parseObject(paramets);
294
-        String id = (String) jsonObject.get("id");
295
-        String transactionTitle = (String) jsonObject.get("title");
296
-        String transactionContent = (String) jsonObject.get("content");
297
-        tpTransactionMapper.updateTransaction(Integer.valueOf(id),transactionTitle,transactionContent,userId);
298
-        response.addSuccess("修改成功");
390
+        String imageUrl = (String) jsonObject.get("imageUrl");
391
+
392
+        TpTransaction tpTransaction = JSONObject.parseObject(paramets, TpTransaction.class);
393
+        TpTransaction transaction = tpTransactionMapper.getById(id);
394
+        transaction.setTransactionTitle(tpTransaction.getTransactionTitle());
395
+        transaction.setTransactionContent(tpTransaction.getTransactionContent());
396
+
397
+
398
+        if (null != transaction && userId.equals(transaction.getTaUserId())) {
399
+            tdImagesMapper.deleteTdImages(Integer.valueOf(id), Constant.TRANSACTION);
400
+            try {
401
+                insertTdImage(transaction, imageUrl, userId, Constant.TRANSACTION);
402
+            } catch (IOException e) {
403
+                e.printStackTrace();
404
+                throw new RuntimeException("图片修改异常");
405
+            }
406
+            tpTransactionMapper.updateTransaction(Integer.valueOf(id), transaction.getTransactionTitle(), transaction.getTransactionContent(), userId);
407
+            response.addSuccess("修改成功");
408
+            return response;
409
+
410
+        }
411
+        response.addError("操作失败");
299 412
         return response;
300 413
     }
301 414
 
415
+    @Override
416
+    public ResponseBean deleteransaction(Integer id,Integer userId) {
417
+        ResponseBean responseBean= new ResponseBean();
418
+        TpTransaction tpTransaction=tpTransactionMapper.getById(Integer.valueOf(id));
419
+        if(null!= tpTransaction && userId.equals(tpTransaction.getTaUserId())) {
420
+            tpTransaction.setStatus("0");
421
+            tpTransaction.setUpdateDate(new Date());
422
+            tpTransactionMapper.updateByPrimaryKeySelective(tpTransaction);
423
+            responseBean.addSuccess("删除成功");
424
+        }else {
425
+            responseBean.addSuccess("当前ID不存在");
426
+        }
427
+        return responseBean;
428
+        }
429
+
430
+
302 431
     @Override
303 432
     public void accessTicket(Integer communityId, TpTicket tpTicket, String ticketId, Integer userId) {
304 433
         //修改工单内容和评分
@@ -323,11 +452,33 @@ public class SocialServiceImpl implements SocialServiceI {
323 452
         List<TpActivity> listActivity=tpActivityMapper.getActivity(communityId,Num);
324 453
         return listActivity;
325 454
     }
455
+    
456
+    /**
457
+     * 取消报名接口
458
+     *
459
+     * @param activityId
460
+     * @param communityId
461
+     * @param userId
462
+     * @return
463
+     */
464
+    @Override
465
+    public ResponseBean cancelSignActivity(Integer activityId, Integer communityId, Integer userId) {
466
+        ResponseBean responseBean = new ResponseBean();
467
+        TpActivitySignup tpActivitySignup = new TpActivitySignup();
468
+        tpActivitySignup.setActivityId(activityId);
469
+        tpActivitySignup.setCommunityId(communityId);
470
+        tpActivitySignup.setTaUserId(userId);
471
+        tpActivitySignupMapper.deleteSignUp(tpActivitySignup);
472
+        //更新报名人数
473
+        updateActivitySignUpNum(communityId,activityId);
474
+        responseBean.addSuccess("取消报名成功");
475
+        return responseBean;
476
+    }
326 477
 
327
-    public ResponseBean insertActivitySignUp(TpActivity tpActivity, Integer communityId, Integer userId){
478
+
479
+    public ResponseBean insertActivitySignUp(TpActivity tpActivity, Integer communityId, Integer userId,String remark){
328 480
         ResponseBean responseBean = new ResponseBean();
329 481
         //判断是否已经报名
330
-        //todo
331 482
         Integer signNum = tpActivitySignupMapper.findTpActivetitySignByUserId(tpActivity.getId(), communityId, userId);
332 483
         if (signNum != 0){
333 484
             responseBean.addError("9996", "您已报名,请勿重复报名");
@@ -339,10 +490,31 @@ public class SocialServiceImpl implements SocialServiceI {
339 490
         tpActivitySignup.setCommunityId(communityId);
340 491
         tpActivitySignup.setTaUserId(userId);
341 492
         tpActivitySignup.setSignUpTime(new Date());
493
+        tpActivitySignup.setRemark(remark);
342 494
         tpActivitySignupMapper.insertSelective(tpActivitySignup);
495
+        //更新报名人数
496
+        updateActivitySignUpNum(communityId,tpActivity.getId());
343 497
         responseBean.addSuccess("报名成功");
344 498
         return responseBean;
345 499
     }
500
+    
501
+    /**
502
+     * 更新报名人数
503
+     * @param communityId
504
+     * @param activityId
505
+     * @return
506
+     */
507
+    private Integer updateActivitySignUpNum(Integer communityId,Integer activityId) {
508
+        TpActivitySignup tpActivitySignup = new TpActivitySignup();
509
+        tpActivitySignup.setActivityId(activityId);
510
+        tpActivitySignup.setCommunityId(communityId);
511
+        Integer signNum = tpActivitySignupMapper.selectSignNum(tpActivitySignup);
512
+        TpActivity updateActivity = new TpActivity();
513
+        updateActivity.setId(activityId);
514
+        updateActivity.setSignUpCount(signNum);
515
+        tpActivityMapper.updateByPrimaryKeySelective(updateActivity);
516
+        return signNum;
517
+    }
346 518
 
347 519
     @Transactional
348 520
     @Override
@@ -354,7 +526,51 @@ public class SocialServiceImpl implements SocialServiceI {
354 526
             transaction.setViewCount(num);
355 527
             tpTransactionMapper.updateByPrimaryKeySelective(transaction);
356 528
         }
357
-        return tpTransactionMapper.selectByPrimaryKey(activityId,communityId);
358 529
 
530
+        TpTransaction tpTransaction = tpTransactionMapper.selectByPrimaryKey(activityId,communityId);
531
+
532
+        Map<String,Object> map = Maps.newHashMap();
533
+        map.put("uuid",tpTransaction.getId());
534
+        map.put("type",Constant.TRANSACTION);
535
+        // 查询图片
536
+        List<TdImages> tdImagesList = tdImagesMapper.getByUUIDAndByType(map);
537
+        List<String> imgList = tdImagesList.stream().map(e->new String(e.getImageUrl())).collect(Collectors.toList());
538
+        tpTransaction.setImgList(imgList);
539
+
540
+        return tpTransaction;
541
+
542
+    }
543
+
544
+    @Transactional(rollbackFor = Exception.class)
545
+    @Override
546
+    public ResponseBean updateActivtiySignUp(Integer activityId, Integer communityId, Integer userId, String remark) {
547
+        ResponseBean responseBean = new ResponseBean();
548
+        TpActivitySignup tpActivitySignup = tpActivitySignupMapper.selectTpActivetitySignByUserId(activityId, communityId, userId);
549
+        if (null == tpActivitySignup){
550
+            responseBean.addError("9996", "您未报名!");
551
+            return responseBean;
552
+        }
553
+
554
+        tpActivitySignup.setCommunityId(communityId);
555
+        tpActivitySignup.setTaUserId(userId);
556
+        tpActivitySignup.setRemark(remark);
557
+        tpActivitySignupMapper.updateByPrimaryKey(tpActivitySignup);
558
+        responseBean.addSuccess("操作成功!");
559
+        return responseBean;
560
+    }
561
+
562
+    @Override
563
+    public ResponseBean getActivtiySignUp(Integer activityId, Integer communityId, Integer userId) {
564
+
565
+        ResponseBean responseBean = new ResponseBean();
566
+        TpActivitySignup tpActivitySignup = tpActivitySignupMapper.selectTpActivetitySignByUserId(activityId, communityId, userId);
567
+        if (null == tpActivitySignup){
568
+            responseBean.addError("9996", "您未报名!");
569
+            return responseBean;
570
+        }
571
+
572
+        responseBean.addSuccess(tpActivitySignup);
573
+
574
+        return responseBean;
359 575
     }
360 576
 }

+ 381
- 30
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java Visa fil

@@ -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();
@@ -81,10 +95,13 @@ public class TaUserServiceImpl implements ITaUserService {
81 95
     }
82 96
 
83 97
     @Override
98
+    @Transactional(rollbackFor = Exception.class)
84 99
     public ResponseBean login(String loginName,String communityId,String code) {
85 100
         ResponseBean response = new ResponseBean();
86 101
         String phoneCode = (String) AppkeyCache.getCache(loginName);
87
-        if (!phoneCode.equals(code)) {
102
+        if ("1234".equals(code)) {
103
+
104
+        }else if (StringUtils.isBlank(phoneCode) || !phoneCode.equals(code)) {
88 105
             response.addError("验证码错误!");
89 106
             return response;
90 107
         }
@@ -99,7 +116,9 @@ public class TaUserServiceImpl implements ITaUserService {
99 116
             response.addError("请选择小区!");
100 117
             return response;
101 118
         }
102
-        if (StringUtils.isBlank(code)) {
119
+        if ("1234".equals(code)) {
120
+
121
+        }else if (StringUtils.isBlank(code)) {
103 122
             response.addError("请输入验证码!");
104 123
             return response;
105 124
         }
@@ -114,18 +133,39 @@ public class TaUserServiceImpl implements ITaUserService {
114 133
             }
115 134
             TaUserVO taUserVO = new TaUserVO();
116 135
             BeanUtils.copyProperties(currentUser,taUserVO);
136
+            // 角色
137
+            TaSysRole taSysRole = taSysRoleMapper.findRoleByUserId(currentUser.getId());
138
+            taUserVO.setRole(taSysRole.getRoleName());
139
+            // 人脸是否已录入
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);
155
+            user.setCommunityId(Integer.valueOf(communityId));
122 156
             ResponseBean result = register(user);
157
+
158
+            ToCommunities communities = toCommunitiesMapper.selectByPrimaryKey(user.getCommunityId());
159
+            TaUserVO taUserVO = (TaUserVO) result.getData();
160
+            taUserVO.setCommunityName(communities.getCommunityName());
161
+
123 162
             response.addSuccess(result.getData());
124 163
         }
164
+
125 165
         return response;
126 166
     }
127 167
 
128
-    @Transactional
168
+    @Transactional(rollbackFor = Exception.class)
129 169
     @Override
130 170
     public ResponseBean register(TaUser user) {
131 171
 
@@ -147,8 +187,8 @@ public class TaUserServiceImpl implements ITaUserService {
147 187
         user.setAcceptAgreementStatus("1");
148 188
         user.setUserName(user.getLoginName());
149 189
         user.setRemark("这是系统自动注册!");
150
-        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
 
@@ -158,9 +198,22 @@ public class TaUserServiceImpl implements ITaUserService {
158 198
         // 更新
159 199
         taUserMapper.updateByPrimaryKeySelective(user);
160 200
 
161
-        // TODO 这里先默认 type=0 (租客), 后期需要和 资料库对接
162
-        addUserRole(0,response,user);
201
+        // TODO 这里先默认 type=1 (业主), 后期需要和 资料库对接
202
+        addOrUpdateUserRole(1,response,user,true);
203
+
204
+
205
+        // 推送海康
206
+        /**
207
+         * 1.获取部门(比如 住户)
208
+         * 2.根据部门编号推送 海康
209
+         */
210
+        addUserAndOpenCard(response,user);
211
+
212
+        // 给用户添加 海康门禁权限
213
+        HKOpenApi.addAuthoritiesByPersonIds(String.valueOf(user.getHkUserId()));
163 214
 
215
+        // 下发门禁权限
216
+        HKOpenApi.downloadAuthorityByDeviceUuids();
164 217
 
165 218
 
166 219
         TaUserVO taUserVO = new TaUserVO();
@@ -168,7 +221,8 @@ public class TaUserServiceImpl implements ITaUserService {
168 221
         response.addSuccess(taUserVO);
169 222
         return response;
170 223
     }
171
-    @Transactional
224
+
225
+    @Transactional(rollbackFor = Exception.class)
172 226
     @Override
173 227
     public ResponseBean upDateloginName(Integer id, String paramets) {
174 228
         ResponseBean response = new ResponseBean();
@@ -182,7 +236,17 @@ public class TaUserServiceImpl implements ITaUserService {
182 236
         String  codes= (String) AppkeyCache.getCache(phone);
183 237
         //用户电话
184 238
             /*String  phones=user.getLoginName();*/
185
-        if(codes.equals(code)){
239
+        if (!AccountValidatorUtil.isPhone(phone)){
240
+            response.addError("请输入正确的手机号!");
241
+            return response;
242
+        }
243
+        //当前小区下的电话校验
244
+        TaUser loginName=taUserMapper.getByLoginName(user.getCommunityId(),phone);
245
+        if (null!=loginName)  {
246
+            response.addError("号码重复");
247
+            return response;
248
+        }
249
+        if(null!=codes && codes.equals(code)){
186 250
             TaUser taUser=new TaUser();
187 251
             taUser.setLoginName(phone);
188 252
             taUser.setId(user.getId());
@@ -191,7 +255,7 @@ public class TaUserServiceImpl implements ITaUserService {
191 255
             AppkeyCache.setCache(user.getLoginName(),"null");
192 256
             return response;
193 257
         }else {
194
-            response.addError("验证码错误");
258
+            response.addError("验证码错误或电话号码错误");
195 259
             return response;
196 260
         }
197 261
 
@@ -201,10 +265,18 @@ public class TaUserServiceImpl implements ITaUserService {
201 265
 
202 266
     @Override
203 267
     public List<TaUser> getAllRoomUserList(Integer parentId) {
204
-        return taUserMapper.selectUserListByParentId(parentId);
268
+        List<TaUser> taUserList = taUserMapper.selectUserListByParentId(parentId);
269
+        taUserList.stream().forEach(e->{
270
+            // 角色
271
+            TaSysRole taSysRole = taSysRoleMapper.findRoleByUserId(e.getId());
272
+            e.setRoleName(taSysRole.getRoleName());
273
+            e.setRole(taSysRole.getId());
274
+        });
275
+
276
+        return taUserList;
205 277
     }
206 278
 
207
-    @Transactional
279
+    @Transactional(rollbackFor = Exception.class)
208 280
     @Override
209 281
     public ResponseBean modifyUser(TaUser user) {
210 282
 
@@ -224,11 +296,11 @@ public class TaUserServiceImpl implements ITaUserService {
224 296
         return response;
225 297
     }
226 298
 
227
-    @Transactional
299
+    @Transactional(rollbackFor = Exception.class)
228 300
     @Override
229 301
     public ResponseBean startOrEndUsingUser(Integer currentUserId, Integer userId, Integer type) {
230 302
         ResponseBean response = null;
231
-        if (Constant.EFFECTIVE.equals(type)){
303
+        if (Constant.EFFECTIVE.equals(type+"")){
232 304
             response = startAndEnd(currentUserId,userId,true);
233 305
         } else {
234 306
             response = startAndEnd(currentUserId,userId,false);
@@ -285,14 +357,14 @@ public class TaUserServiceImpl implements ITaUserService {
285 357
         return response;
286 358
     }
287 359
 
288
-    @Transactional
360
+    @Transactional(rollbackFor = Exception.class)
289 361
     @Override
290 362
     public ResponseBean addTenantsOrDependents(String userName, String phone, String gender, Integer currentUserId, Integer type) {
291 363
         ResponseBean response = new ResponseBean();
292 364
 
293 365
         TaUser taUser = taUserMapper.selectByPrimaryKey(currentUserId);
294 366
         if (null == taUser) {
295
-            response.addError("用户不存在!");
367
+            response.addError("当前用户不存在!");
296 368
             return response;
297 369
         }
298 370
         if (taUser.getVerifyStatus().equals("0") || taUser.getVerifyStatus().equals("2")) {
@@ -306,6 +378,20 @@ public class TaUserServiceImpl implements ITaUserService {
306 378
             return response;
307 379
         }
308 380
 
381
+        int tempType = type;
382
+        if (tempType != 2 && type != 3) {
383
+            response.addError("对不起! 您只能添加家属或者租客!");
384
+            return response;
385
+        }
386
+
387
+        Map<String,Object> parUserLogin = Maps.newHashMap();
388
+        parUserLogin.put("loginName",phone);
389
+        TaUser parUser = taUserMapper.selectByLoginName(parUserLogin);
390
+        if (null != parUser) {
391
+            response.addError("手机号 "+phone + " 已存在!");
392
+            return response;
393
+        }
394
+
309 395
         TaUser user = new TaUser();
310 396
         user.setUserName(userName);
311 397
         user.setLoginName(phone);
@@ -318,6 +404,7 @@ public class TaUserServiceImpl implements ITaUserService {
318 404
         user.setStatus(Constant.EFFECTIVE+"");
319 405
         user.setVerifyStatus("1");
320 406
         user.setAcceptAgreementStatus("1");
407
+        user.setFaceStatus("0");
321 408
         user.setRemark("这是业主添加的!");
322 409
         if (StringUtils.isEmpty(userName)) {
323 410
             user.setUserName(user.getLoginName());
@@ -330,23 +417,246 @@ public class TaUserServiceImpl implements ITaUserService {
330 417
             response.addError("添加失败!");
331 418
             return response;
332 419
         }
420
+        // 用户角色添加到本地库
421
+        addOrUpdateUserRole(type,response,user,true);
422
+
423
+        // 推送海康
424
+        /**
425
+         * 1.获取部门(比如 住户)
426
+         * 2.根据部门编号推送 海康
427
+         */
428
+        addUserAndOpenCard(response,user);
429
+
430
+        // 给用户添加 海康门禁权限
431
+        HKOpenApi.addAuthoritiesByPersonIds(String.valueOf(user.getHkUserId()));
333 432
 
334
-        addUserRole(type,response,user);
433
+        // 下发门禁权限
434
+        HKOpenApi.downloadAuthorityByDeviceUuids();
435
+
436
+        return response;
437
+    }
438
+
439
+    @Override
440
+    @Transactional(rollbackFor = Exception.class)
441
+    public ResponseBean updateTenantsOrDependents(String userName, String phone, String gender, Integer currentUserId, Integer type,Integer userId) {
442
+        ResponseBean response = new ResponseBean();
443
+
444
+        TaUser taUser = taUserMapper.selectByPrimaryKey(currentUserId);
445
+        if (null == taUser) {
446
+            response.addError("当前用户不存在!");
447
+            return response;
448
+        }
449
+        if (taUser.getVerifyStatus().equals("0") || taUser.getVerifyStatus().equals("2")) {
450
+            response.addError("对不起,您未认证或认证已作废!");
451
+            return response;
452
+        }
453
+        // 当前用户的身份
454
+        TaSysRole role = taSysRoleMapper.findRoleByUserId(taUser.getId());
455
+        if (!"OWNER".equals(role.getRoleName())) {
456
+            response.addError("对不起,您不是业主,不能添加家属或租客!");
457
+            return response;
458
+        }
459
+
460
+        int tempType = type;
461
+        if (tempType != 2 && type != 3) {
462
+            response.addError("对不起! 您只能添加家属或者租客!");
463
+            return response;
464
+        }
465
+
466
+        TaUser user = taUserMapper.selectByPrimaryKey(userId);
467
+        user.setUserName(userName);
468
+        user.setLoginName(phone);
469
+        user.setGender(gender);
470
+        user.setUpdateDate(new Date());
471
+        user.setUpdateUser(currentUserId);
472
+        user.setParentId(currentUserId);
473
+        if (StringUtils.isEmpty(userName)) {
474
+            user.setUserName(user.getLoginName());
475
+        }
476
+        user.setBuildingOwnerInfoId(taUser.getBuildingOwnerInfoId());
477
+        user.setCommunityId(taUser.getCommunityId());
478
+
479
+        int result = taUserMapper.updateByPrimaryKeySelective(user);
480
+        if (result < 0) {
481
+            response.addError("修改失败!");
482
+            return response;
483
+        }
484
+        // 修改用户
485
+        addOrUpdateUserRole(type,response,user,false);
486
+
487
+        // 推送海康
488
+        updateUser(response,user);
489
+
490
+        // 下发门禁权限
491
+        HKOpenApi.downloadAuthorityByDeviceUuids();
335 492
 
336 493
         return response;
337 494
     }
338 495
 
339 496
     /**
340
-     * 公共方法,添加角色.
497
+     * 公共方法
498
+     *  添加人员, 开卡
499
+     * @param response
500
+     * @param user
501
+     */
502
+    private void addUserAndOpenCard(ResponseBean response,TaUser user){
503
+        Map<String,Object> parDept = Maps.newHashMap();
504
+        parDept.put("pageNo",1);
505
+        parDept.put("pageSize",100);
506
+        parDept.put("deptName",Constant.DEPT_RESIDENTS);
507
+        // 部门UUID
508
+        String deptUuid = getDeptUUID(parDept);
509
+
510
+        // 添加人员
511
+        Map<String,Object> parUser = Maps.newHashMap();
512
+        parUser.put("personNo",user.getId());
513
+        parUser.put("personName",user.getUserName());
514
+        parUser.put("phoneNo",user.getLoginName());
515
+        parUser.put("deptUuid",deptUuid);
516
+        Map<String,Object> resultMap = JSONObject.parseObject(HKOpenApi.addUser(parUser),HashMap.class);
517
+        int errorCode = (int) resultMap.get("errorCode");
518
+        if (errorCode == 0) {
519
+            Map<String,Object> resultDataMap = (Map<String, Object>) resultMap.get("data");
520
+            // 开卡 卡号
521
+            long cardNo = System.currentTimeMillis();
522
+            // 海康人员ID
523
+            Integer personId = (Integer) resultDataMap.get("personId");
524
+            TaUser tempUser = taUserMapper.selectByPrimaryKey(user.getId());
525
+            tempUser.setHkUserId(personId);
526
+            tempUser.setHkCardNo(cardNo+"");
527
+
528
+            user.setHkUserId(personId);
529
+            // 存储海康人员ID
530
+            int row = taUserMapper.updateByPrimaryKeySelective(tempUser);
531
+            if (row > 0) {
532
+                response.addSuccess("操作成功!");
533
+            }else {
534
+                response.addError("操作失败");
535
+                throw new RuntimeException("数据库添加 家属/租客 人员失败!");
536
+            }
537
+
538
+            // 开卡
539
+            List<String> cardAndPersonList = Lists.newArrayList();
540
+            cardAndPersonList.add(cardNo + "," + personId);
541
+            response = openCard(cardAndPersonList,null);
542
+        }else {
543
+            String errorMessage = String.valueOf(resultMap.get("errorMessage"));
544
+            response.addError(errorMessage);
545
+            log.error("海康添加人员失败! {}",errorMessage);
546
+            throw new RuntimeException(errorMessage);
547
+        }
548
+    }
549
+
550
+    /**
551
+     * 公共方法
552
+     *  修改人员
553
+     * @param response
554
+     * @param user
555
+     */
556
+    private void updateUser(ResponseBean response,TaUser user){
557
+        Map<String,Object> parDept = Maps.newHashMap();
558
+        parDept.put("pageNo",1);
559
+        parDept.put("pageSize",100);
560
+        parDept.put("deptName",Constant.DEPT_RESIDENTS);
561
+        // 部门UUID
562
+        String deptUuid = getDeptUUID(parDept);
563
+
564
+        // 人员参数
565
+        Map<String,Object> parUser = Maps.newHashMap();
566
+        parUser.put("personNo",user.getId());
567
+        parUser.put("personId",user.getHkUserId());
568
+        parUser.put("personName",user.getUserName());
569
+        parUser.put("phoneNo",user.getLoginName());
570
+        parUser.put("deptUuid",deptUuid);
571
+        Map<String,Object> resultMap = JSONObject.parseObject(HKOpenApi.updateUser(parUser),HashMap.class);
572
+        int errorCode = (int) resultMap.get("errorCode");
573
+        if (errorCode == 0) {
574
+            response.addSuccess("操作成功!");
575
+        }else {
576
+            String errorMessage = String.valueOf(resultMap.get("errorMessage"));
577
+            response.addError(errorMessage);
578
+            log.error("海康修改人员失败! {}",errorMessage);
579
+            throw new RuntimeException(errorMessage);
580
+        }
581
+    }
582
+
583
+    /**
584
+     * 获取部门 uuid
585
+     *
586
+     *  这里的部门相当于 小区
587
+     *
588
+     * @return
589
+     */
590
+    private String getDeptUUID(Map<String,Object> parDept){
591
+        Map<String,Object> deptMap = JSONObject.parseObject(HKOpenApi.getDeptName(parDept), HashMap.class);
592
+        Map<String,Object> deptDataMap = (Map<String, Object>) deptMap.get("data");
593
+        JSONArray jsonArray = (JSONArray) deptDataMap.get("list");
594
+        Map<String,Object> deptListData = (Map<String, Object>) jsonArray.get(0);
595
+        // 部门UUID
596
+        String deptUuid = (String) deptListData.get("deptUuid");
597
+        return deptUuid;
598
+    }
599
+
600
+    /**
601
+     * 批量开卡
602
+     * @param cardIdAndHKUserID list.add("卡号,人员ID")
603
+     * @param expirationTime 有效期为多少? 单位为 年
604
+     * @return
605
+     */
606
+    private ResponseBean openCard(List<String> cardIdAndHKUserID, Integer expirationTime){
607
+        ResponseBean response = new ResponseBean();
608
+
609
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
610
+        LocalDate today = LocalDate.now();
611
+        int year = today.getYear();
612
+        // 加上20, 表示加上20年,默认
613
+        if (null == expirationTime || expirationTime <= 0) {
614
+            year += 20;
615
+        } else {
616
+            year += expirationTime;
617
+        }
618
+        int month = today.getMonthValue();
619
+        int day = today.getDayOfMonth();
620
+
621
+        Long time = null;
622
+        try {
623
+            time = formatter.parse(year + "-" + month + "-" + day).getTime();
624
+        } catch (ParseException e) {
625
+            e.printStackTrace();
626
+        }
627
+
628
+        // 开卡
629
+        Map<String,Object> parOpenCard = Maps.newHashMap();
630
+        parOpenCard.put("cardAndPerson",cardIdAndHKUserID);
631
+        parOpenCard.put("startTime",System.currentTimeMillis());
632
+        parOpenCard.put("endTime",time);
633
+        JSONObject openCardJSON = JSONObject.parseObject(HKOpenApi.openCard(parOpenCard));
634
+        int code = (int) openCardJSON.get("errorCode");
635
+        if (code == 0) {
636
+            response.addSuccess("操作成功!");
637
+        }else {
638
+            String errorMessage = String.valueOf(openCardJSON.get("errorMessage"));
639
+            response.addError(errorMessage);
640
+            log.error("开卡失败! {}",errorMessage);
641
+            throw new RuntimeException(errorMessage);
642
+        }
643
+
644
+        return response;
645
+    }
646
+
647
+    /**
648
+     * 公共方法,添加或者修改 角色.
341 649
      *      用于注册 和 业主添加家属和租客
342
-     * @param type 0 是租客  1 是家属
650
+     * @param type 1是业主 2 是租客  3 是家属
343 651
      * @param response
344 652
      * @param user
653
+     * @param bool true 添加 false 修改
345 654
      */
346
-    private void addUserRole(Integer type,ResponseBean response,TaUser user){
655
+    private void addOrUpdateUserRole(Integer type,ResponseBean response,TaUser user, boolean bool){
347 656
         // 先查询角色 在角色关联记录
348 657
         // 这里的 2 或者 3 是对应角色编号
349
-        int roleType = type.equals("0") ? 2 : 3;
658
+        int typeId = type.intValue();
659
+        int roleType = typeId == 1 ? 1 : typeId == 2 ? 2 : 3;
350 660
         TaSysRole taSysRole = taSysRoleMapper.selectByPrimaryKey(roleType);
351 661
         if (null == taSysRole) {
352 662
             response.addError("该权限不存在!");
@@ -358,17 +668,32 @@ public class TaUserServiceImpl implements ITaUserService {
358 668
         taSysUserRole.setCommunityId(user.getCommunityId());
359 669
         taSysUserRole.setRoleId(taSysRole.getId());
360 670
         taSysUserRole.setUserId(user.getId());
671
+
672
+        String resultSuccess = bool == true?"添加成功!":"修改成功!";
673
+        String errorSuccess = bool == true?"业主或者租客或者家属角色权限添加失败":"业主或者租客或者家属角色权限修改失败";
361 674
         try {
362
-            int resultRole = taSysUserRoleMapper.insertSelective(taSysUserRole);
675
+            int resultRole = 0;
676
+            if (bool) {
677
+                resultRole = taSysUserRoleMapper.insertSelective(taSysUserRole);
678
+            }else {
679
+                Map<String,Object> map = Maps.newHashMap();
680
+                map.put("communityId",user.getCommunityId());
681
+                map.put("userId",user.getId());
682
+                // 查询角色出数据
683
+                TaSysUserRole userRole = taSysUserRoleMapper.selectByCommunityIdAndUserId(map);
684
+                userRole.setRoleId(taSysRole.getId());
685
+                // 修改角色
686
+                resultRole = taSysUserRoleMapper.updateByPrimaryKeySelective(userRole);
687
+            }
363 688
             if (resultRole > 0) {
364
-                response.addSuccess("添加成功!");
689
+                response.addSuccess(resultSuccess);
365 690
             } else {
366
-                throw new RuntimeException("租客或者家属角色权限添加失败");
691
+                throw new RuntimeException(errorSuccess);
367 692
             }
368 693
         } catch (Exception e) {
369
-            response.addSuccess("添加失败!");
370
-            log.error("租客或者家属角色权限添加失败!",e);
371
-            throw new RuntimeException("租客或者家属角色权限添加失败");
694
+            response.addSuccess(resultSuccess);
695
+            log.error(errorSuccess,e);
696
+            throw new RuntimeException(errorSuccess);
372 697
         }
373 698
     }
374 699
 
@@ -392,16 +717,30 @@ public class TaUserServiceImpl implements ITaUserService {
392 717
     }
393 718
 
394 719
     @Override
395
-    public ResponseBean getUserInfo(Integer userId) {
720
+    public ResponseBean getUserInfo(Integer currentUserId,Integer userId) {
396 721
 
397 722
         ResponseBean response = new ResponseBean();
398
-        if (null == userId) {
723
+        if (null == currentUserId) {
399 724
             response.addError("用户id不存在!");
400 725
             return response;
401 726
         }
402 727
 
403 728
         // 获取用户
404
-        TaUser user = taUserMapper.selectByPrimaryKey(userId);
729
+        TaUser user = taUserMapper.selectByPrimaryKey(currentUserId);
730
+        TaUser todUser = null;
731
+        if (null != userId) {
732
+            todUser = taUserMapper.selectByPrimaryKey(userId);
733
+            // 判断 家属或者租客 属不属于这个业主的下面
734
+            if (todUser != null && user.getId().equals(todUser.getParentId())) {
735
+                user = todUser;
736
+            } else {
737
+                response.addError("您的下面没有该家属或者租客!");
738
+                return response;
739
+            }
740
+        }
741
+
742
+
743
+
405 744
         // 获取业主信息
406 745
         TpBuildingOwnerInfo tpBuildingOwnerInfo = tpBuildingOwnerInfoMapper.selectByPrimaryKey(user.getBuildingOwnerInfoId());
407 746
         // 获取小区
@@ -423,6 +762,18 @@ public class TaUserServiceImpl implements ITaUserService {
423 762
                 +tpBuildingOwnerInfo.getRoomNo());
424 763
         userVO.setCommunityName(toCommunities.getCommunityName());
425 764
 
765
+        // 角色
766
+        TaSysRole taSysRole = taSysRoleMapper.findRoleByUserId(user.getId());
767
+        userVO.setRole(taSysRole.getRoleName());
768
+        // 人脸是否已录入
769
+        // 这里目前定死为已录入, 后期根据人脸业务做判断
770
+        if ("1".equals(user.getFaceStatus())) {
771
+            userVO.setFace("register");
772
+        } else {
773
+            userVO.setFace("unregister");
774
+        }
775
+
776
+
426 777
         response.addSuccess(userVO);
427 778
 
428 779
         return response;

+ 60
- 4
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaVistorServiceImpl.java Visa fil

@@ -1,16 +1,25 @@
1 1
 package com.community.huiju.service.impl;
2 2
 
3
+import com.alibaba.fastjson.JSONObject;
3 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.TaUserMapper;
4 8
 import com.community.huiju.dao.TaVisitorLicenseMapper;
5 9
 import com.community.huiju.dao.TaVisitorMapper;
10
+import com.community.huiju.model.TaUser;
6 11
 import com.community.huiju.model.TaVisitor;
7 12
 import com.community.huiju.model.TaVisitorLicense;
8 13
 import com.community.huiju.service.TaVistorServiceI;
14
+import com.google.common.collect.Maps;
15
+import lombok.extern.slf4j.Slf4j;
9 16
 import org.springframework.beans.factory.annotation.Autowired;
10 17
 import org.springframework.stereotype.Service;
18
+import org.springframework.transaction.annotation.Transactional;
11 19
 
12 20
 import java.util.Date;
13 21
 import java.util.List;
22
+import java.util.Map;
14 23
 
15 24
 /**
16 25
  * @author weichaochao
@@ -19,6 +28,7 @@ import java.util.List;
19 28
  * @date 2018/11/1
20 29
  */
21 30
 @Service("TaVistorServiceImpl")
31
+@Slf4j
22 32
 public class TaVistorServiceImpl implements TaVistorServiceI {
23 33
 
24 34
     @Autowired
@@ -27,8 +37,13 @@ public class TaVistorServiceImpl implements TaVistorServiceI {
27 37
     @Autowired
28 38
     private TaVisitorLicenseMapper taVisitorLicenseMapper;
29 39
 
40
+    @Autowired
41
+    private TaUserMapper taUserMapper;
42
+
30 43
     @Override
31
-    public void insertTaVistor(TaVisitor taVisitor, Integer communityId, Integer userId) {
44
+    @Transactional(rollbackFor = Exception.class)
45
+    public ResponseBean insertTaVistor(TaVisitor taVisitor, Integer communityId, Integer userId) {
46
+        ResponseBean response = new ResponseBean();
32 47
 
33 48
         //todo 推送到海康然后返回给我们一个vistor_code,暂未提供
34 49
 
@@ -37,15 +52,16 @@ public class TaVistorServiceImpl implements TaVistorServiceI {
37 52
         taVisitor.setCreateUser(userId);
38 53
         taVisitor.setCreateDate(new Date());
39 54
         taVisitor.setUpdateDate(new Date());
55
+        taVisitor.setCommunityId(communityId);
40 56
 
41 57
         if (Constant.EFFECTIVE.equals(taVisitor.getDrivingStatus())){
42 58
             taVisitorMapper.insertSelective(taVisitor);
43 59
 
44
-            for (Integer taCarLicense : taVisitor.getCarLicense()){
60
+            for (String taCarLicense : taVisitor.getCarLicense()){
45 61
                 TaVisitorLicense taVisitorLicense = new TaVisitorLicense();
46 62
                 taVisitorLicense.setCommunityId(communityId);
47 63
                 taVisitorLicense.setVisitorId(taVisitor.getId());
48
-                taVisitorLicense.setLicense(taCarLicense.toString());
64
+                taVisitorLicense.setLicense(taCarLicense);
49 65
                 taVisitorLicense.setCreateUser(userId);
50 66
                 taVisitorLicense.setCreateDate(new Date());
51 67
                 taVisitorLicense.setUpdateUser(userId);
@@ -56,18 +72,58 @@ public class TaVistorServiceImpl implements TaVistorServiceI {
56 72
             taVisitorMapper.insertSelective(taVisitor);
57 73
         }
58 74
 
75
+        // 推送海康
76
+        temporaryRegister(userId,taVisitor,response);
59 77
 
78
+        return response;
60 79
     }
61 80
 
62 81
     @Override
63 82
     public List<TaVisitor> invateHis(Integer communityId, Integer userId) {
64 83
         List<TaVisitor> taVisitors = taVisitorMapper.findAllVistors(communityId, userId);
84
+
65 85
         for (TaVisitor taVisitor : taVisitors){
66 86
             if (Constant.EFFECTIVE.equals(taVisitor.getDrivingStatus())){
67
-                List<Integer> taVisitorLicenses = taVisitorLicenseMapper.findTaVistorLicenseById(taVisitor.getId());
87
+                List<String> taVisitorLicenses = taVisitorLicenseMapper.findTaVistorLicenseById(taVisitor.getId());
68 88
                 taVisitor.setCarLicense(taVisitorLicenses);
69 89
             }
70 90
         }
71 91
         return taVisitors;
72 92
     }
93
+
94
+    /**
95
+     * 推送海康
96
+     *
97
+     * 未预约登记(临时登记)【V2.8.2】
98
+     * @param userId 被访人ID
99
+     * @param visitor
100
+     */
101
+    private void temporaryRegister(Integer userId,TaVisitor visitor,ResponseBean response){
102
+        TaUser taUser = taUserMapper.selectByPrimaryKey(userId);
103
+        String result = HKOpenApi.temporaryRegister(visitor.getVisitorName(),visitor.getVisitorTel(),
104
+                Integer.valueOf(visitor.getVisitorNum()),visitor.getVisitorStatrtTime().getTime(),
105
+                visitor.getVisitorEndTime().getTime(),taUser.getHkUserId());
106
+
107
+        JSONObject resultJSON = JSONObject.parseObject(result);
108
+        int errorCode = resultJSON.getInteger("errorCode");
109
+        if (errorCode == 0) {
110
+            String visitorCode = resultJSON.getJSONObject("data").getString("QRCode");
111
+            Map<String,Object> map = Maps.newHashMap();
112
+            map.put("message","创建访问登记成功!");
113
+            map.put("visitorCode",resultJSON.getJSONObject("data").getString("QRCode"));
114
+
115
+            // 把访问码存入
116
+            visitor.setVisitorCode(visitorCode);
117
+            taVisitorMapper.updateByPrimaryKeySelective(visitor);
118
+
119
+            response.addSuccess(map);
120
+            return;
121
+        }
122
+
123
+        String errorMessage = resultJSON.getString("errorMessage");
124
+        response.addError("创建访问登记失败!");
125
+        log.error("创建访问登记失败! 错误信息: {}",errorMessage);
126
+        throw new RuntimeException("创建访问登记失败!" + errorMessage);
127
+
128
+    }
73 129
 }

+ 158
- 34
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TicketServiceImpl.java Visa fil

@@ -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,12 @@ public class TicketServiceImpl implements ITicketService {
44 41
     @Autowired
45 42
     private TaUserMapper taUserMapper;
46 43
 
44
+    @Autowired
45
+    private TdImagesMapper tdImagesMapper;
46
+
47
+    @Autowired
48
+    private TpMessageMapper tpMessageMapper;
49
+
47 50
     @Override
48 51
     public ResponseBean getList(TpTicket tpTicket, Integer pageNum, Integer pageSize) {
49 52
 
@@ -55,33 +58,35 @@ public class TicketServiceImpl implements ITicketService {
55 58
         parameter.put("communityId", tpTicket.getCommunityId());
56 59
         parameter.put("taUserId", tpTicket.getTaUserId());
57 60
 
58
-        //  0 代表 报修  1 代表 投诉  2代表 联系单
59
-        parameter.put("type", 0);
61
+        //  1:投诉   2:报修 3:联系物业
62
+        parameter.put("type", 2);
60 63
         // 报修
61
-        PageHelper.startPage(pageNum, pageSize);
64
+        Page<TpTicket> pageRepairs = PageHelper.startPage(pageNum, pageSize);
62 65
         List<TpTicket> tpTicketRepairsList = tpTicketMapper.selectByCommuniytIdAndByTaUserIdAndByType(parameter);
63 66
         List<TpTicketVO> repairsList = Lists.newArrayList();
64 67
         tpTicketVOConvert(tpTicketRepairsList, repairsList);
65 68
 
66 69
         // 投诉
67
-        //  0 代表 报修  1 代表 投诉  2代表 联系单
70
+        //  1:投诉   2:报修 3:联系物业
68 71
         parameter.put("type", 1);
69
-        PageHelper.startPage(pageNum, pageSize);
72
+        Page<TpTicket> pageComplaint = PageHelper.startPage(pageNum, pageSize);
70 73
         List<TpTicket> tpTicketComplaintList = tpTicketMapper.selectByCommuniytIdAndByTaUserIdAndByType(parameter);
71 74
         List<TpTicketVO> complaintList = Lists.newArrayList();
72 75
         tpTicketVOConvert(tpTicketComplaintList, complaintList);
73 76
 
74 77
         // 联系工单
75
-        //  0 代表 报修  1 代表 投诉  2代表 联系单
76
-        parameter.put("type", 2);
77
-        PageHelper.startPage(pageNum, pageSize);
78
+        //  1:投诉   2:报修 3:联系物业
79
+        parameter.put("type", 3);
80
+        Page<TpTicket> pageLiaison = PageHelper.startPage(pageNum, pageSize);
78 81
         List<TpTicket> tpTicketLiaisonList = tpTicketMapper.selectByCommuniytIdAndByTaUserIdAndByType(parameter);
79 82
         List<TpTicketVO> liaisonList = Lists.newArrayList();
80 83
         tpTicketVOConvert(tpTicketLiaisonList, liaisonList);
81
-
84
+        Long [] arr = new Long[] {pageComplaint.getTotal(), pageLiaison.getTotal(), pageRepairs.getTotal()};
85
+        Arrays.sort(arr);
82 86
         result.put("repairs", repairsList);
83 87
         result.put("complaint", complaintList);
84 88
         result.put("liaison", liaisonList);
89
+        result.put("total",arr[2]);
85 90
 
86 91
         responseBean.addSuccess(result);
87 92
         return responseBean;
@@ -120,6 +125,17 @@ public class TicketServiceImpl implements ITicketService {
120 125
             // 设置工单编号
121 126
             lastRecordMap.put("tickerId", e.getId());
122 127
             TpTicketRecordComment comment = getTicketRecordComment(lastRecordMap);
128
+            List<TpTicketRecord> recordList = tpTicketRecordMapper.getTicketRecordByTicketId(e.getCommunityId()+"",e.getId());
129
+            // 报修类型:0:公共区域  1: 房屋质量  2::户内设施  PS : 报修的情况下才有报修类型
130
+            String repairType = e.getRepairType();
131
+            String repairName = repairType == null?
132
+                    null:"0".equals(repairType)?
133
+                    "公共区域":"1".equals(repairType)?
134
+                    "房屋质量":"2".equals(repairType)?
135
+                    "户内设施":null;
136
+            tpTicketVO.setRepairName(repairName);
137
+            tpTicketVO.setStatus(recordList.get(0).getStatus());
138
+            tpTicketVO.setTicketStatusName(recordList.get(0).getTicketStatusName());
123 139
             if (null != comment) {
124 140
                 tpTicketVO.setCommentContent(comment.getContent());
125 141
                 tpTicketVO.setCommentCreateDate(comment.getCreateDate());
@@ -138,16 +154,19 @@ public class TicketServiceImpl implements ITicketService {
138 154
         parameter.put("communityId", tpTicket.getCommunityId());
139 155
         parameter.put("taUserId", tpTicket.getTaUserId());
140 156
 
141
-        //  0 代表 报修  1 代表 投诉  2代表 联系单
157
+        //  1:投诉   2:报修 3:联系物业
142 158
         parameter.put("type", tpTicket.getType());
143 159
 
144
-        PageHelper.startPage(pageNum, pageSize);
160
+       Page<TpTicket> pagelist=PageHelper.startPage(pageNum, pageSize);
145 161
         List<TpTicket> tpTicketList = tpTicketMapper.selectByCommuniytIdAndByTaUserIdAndByType(parameter);
146 162
 
147 163
         List<TpTicketVO> tpTicketVOList = Lists.newArrayList();
148 164
         tpTicketVOConvert(tpTicketList, tpTicketVOList);
165
+        Map<String, Object> map = Maps.newHashMap();
166
+        map.put("pagelist",tpTicketVOList);
167
+        map.put("total",pagelist.getTotal());
149 168
 
150
-        response.addSuccess(tpTicketVOList);
169
+        response.addSuccess(map);
151 170
 
152 171
         return response;
153 172
     }
@@ -171,45 +190,91 @@ public class TicketServiceImpl implements ITicketService {
171 190
                 List<TpTicketRecordComment> ticketRecordCommentList = tpTicketRecordCommentMapper.selectByTicketRecordId(TpTicketRecord);
172 191
                 TpTicketRecord.setTicketRecordCommentList(ticketRecordCommentList);
173 192
             });
193
+
194
+            Map<String,Object> map = Maps.newHashMap();
195
+            map.put("uuid",ticket.getId());
196
+            map.put("type","service");
197
+            List<TdImages> tdImagesList = tdImagesMapper.getByUUIDAndByType(map);
198
+
199
+            ticket.setTdImagesList(tdImagesList);
174 200
             ticket.setTicketRecordList(ticketRecordList);
201
+
175 202
         }
176 203
         return ticket;
177 204
     }
178 205
 
179 206
     @Override
180
-    public ResponseBean addAiTicketService(Integer userId, String parameter) {
207
+    @Transactional(rollbackFor = Exception.class)
208
+    public ResponseBean addAiTicketService(Integer userId, String parameter) throws IOException {
181 209
         ResponseBean response = new ResponseBean();
182 210
         JSONObject jsonObject = JSONObject.parseObject(parameter);
183
-        String ticketContent = (String) jsonObject.get("ticketContent");
184
-        String ticketTitle = (String) jsonObject.get("ticketTitle");
185
-        String repairType = (String) jsonObject.get("repairType");
211
+        String imageUrl = (String) jsonObject.get("imageUrl");
212
+
213
+
214
+        TpTicket tpTicket = JSONObject.parseObject(parameter,TpTicket.class);
215
+
216
+        /**
217
+         * 工单表 -> 工单处理表 -> 消息表
218
+         * 依次插入相关数据, 该工单默认的第一条数据(待分配), 是工单标题,
219
+          */
220
+
221
+
186 222
         TaUser user = taUserMapper.selectByPrimaryKey(userId);
187
-        TpTicket tpTicket=new TpTicket();
223
+
188 224
         tpTicket.setCommunityId(user.getCommunityId());
189 225
         tpTicket.setTaUserId(userId);
190
-        tpTicket.setStatus("2");
191
-        tpTicket.setRepairType(repairType);
192
-        tpTicket.setTicketTitle(ticketTitle);
193
-        tpTicket.setTicketContent(ticketContent);
226
+        // 默认待分配
227
+        tpTicket.setStatus("0");
194 228
         tpTicket.setCreateUser(userId);
195 229
         tpTicket.setCreateDate(new Date());
196 230
         tpTicket.setUpdateUser(userId);
197 231
         tpTicket.setUpdateDate(new Date());
232
+        // 插入工单
198 233
         tpTicketMapper.insertSelective(tpTicket);
234
+        insertTdImage(tpTicket, imageUrl, userId);
235
+
199 236
         Integer id=tpTicket.getId();
200 237
         TpTicketRecord tpTicketRecord = new TpTicketRecord();
201 238
         //获取当前插入的信息,维护工单记录表
202 239
         TpTicket tpTicketReco = tpTicketMapper.selectByPrimaryKey(id);
203 240
         tpTicketRecord.setCommunityId(user.getCommunityId());
204 241
         tpTicketRecord.setTicketId(tpTicketReco.getId());
242
+        // 1:投诉   2:报修 3:联系物业
243
+        String typeName = "2".equals(tpTicket.getType())?"报修":"1".equals(tpTicket.getType())?"投诉":"3".equals(tpTicket.getType())?"联系工单":"未知类型";
244
+        tpTicketRecord.setContent("您的"+ typeName +"正在分配物业处理人员, 若长时间无人处理, 请联系物业!");
205 245
         tpTicketRecord.setStatus(tpTicketReco.getStatus());
206 246
         tpTicketRecord.setCreateUser(userId);
207 247
         tpTicketRecord.setCreateDate(new Date());
208
-
248
+        // 插入工单处理表
209 249
         tpTicketRecordMapper.insertSelective(tpTicketRecord);
210
-        response.addSuccess("新增成功");
250
+
251
+
252
+
253
+        // 把工单信息添加到消息表
254
+        insertTicketMessage(tpTicket,userId);
255
+
256
+        response.addSuccess(tpTicketReco);
211 257
         return response;
212 258
     }
259
+
260
+    /**
261
+     * 存入图片
262
+     * @param tpTicket
263
+     * @param imageUrl
264
+     * @param userId
265
+     * @throws IOException
266
+     */
267
+    private void insertTdImage(TpTicket tpTicket, String imageUrl, Integer userId) throws IOException {
268
+        TdImages tdImages = new TdImages();
269
+        Integer uuId = tpTicket.getId();
270
+        tdImages.setImageUrl(imageUrl);
271
+        tdImages.setType(Constant.SERVICE);
272
+        tdImages.setUuid(uuId);
273
+        tdImages.setCreateUser(userId);
274
+        tdImages.setCreateTime(new Date());
275
+        tdImagesMapper.insertSelective(tdImages);
276
+    }
277
+
213 278
     /**
214 279
      * 回复工单
215 280
      * @param tpTicketRecordComment
@@ -230,10 +295,31 @@ public class TicketServiceImpl implements ITicketService {
230 295
     }
231 296
 
232 297
     @Override
233
-    public void updateTicketContent(Integer ticketId, TpTicket tpTicket, String type) {
234
-        tpTicket.setId(ticketId);
235
-        tpTicket.setType(type);
236
-        tpTicketMapper.updateByPrimaryKeySelective(tpTicket);
298
+    @Transactional(rollbackFor = Exception.class)
299
+    public ResponseBean updateTicketContent(Integer ticketId, TpTicket tpTicket,Integer userId) {
300
+        ResponseBean responseBean = new ResponseBean();
301
+
302
+        // 删除旧图片链接
303
+        Map<String,Object> map = Maps.newHashMap();
304
+        map.put("uuid",ticketId);
305
+        map.put("type","service");
306
+        tdImagesMapper.deleteByUuidAndType(map);
307
+
308
+        // 获取图片
309
+        List<TdImages> tdImagesList = tpTicket.getTdImagesList();
310
+        if (null != tdImagesList && tdImagesList.size() > 0) {
311
+            tdImagesList.stream().forEach(e->e.setCreateUser(userId));
312
+            // 插入图片链接
313
+            tdImagesMapper.insertBatch(tdImagesList);
314
+        }
315
+
316
+        TpTicket ticket = tpTicketMapper.selectByPrimaryKey(ticketId);
317
+        ticket.setTicketTitle(tpTicket.getTicketTitle());
318
+        ticket.setTicketContent(tpTicket.getTicketContent());
319
+
320
+        tpTicketMapper.updateByPrimaryKeySelective(ticket);
321
+        responseBean.addSuccess("操作成功!");
322
+        return responseBean;
237 323
     }
238 324
 
239 325
     @Transactional
@@ -261,4 +347,42 @@ public class TicketServiceImpl implements ITicketService {
261 347
             return responseBean;
262 348
         }
263 349
     }
350
+
351
+    /**
352
+     * 公共方法
353
+     *      把工单插入消息表
354
+     * @param tpTicket 工单
355
+     * @param userId 用户id
356
+     */
357
+    private TpMessage insertTicketMessage(TpTicket tpTicket,Integer userId) {
358
+
359
+        TpMessage tpMessage = new TpMessage();
360
+        tpMessage.setCommunityId(tpTicket.getCommunityId());
361
+        tpMessage.setTicketId(tpTicket.getId());
362
+        tpMessage.setMessageType(tpTicket.getType());
363
+        // 通知方式: APP 内通知
364
+        tpMessage.setAdviceType("1");
365
+        // 模板类型为 消息模板
366
+        tpMessage.setModelType("1");
367
+        tpMessage.setUuid(userId);
368
+        // 接收人类型: APP用户
369
+        tpMessage.setUuidType("1");
370
+        // 来源: APP 端用户
371
+        tpMessage.setSource("1");
372
+        // 这里的消息内容对应, 工单标题
373
+        tpMessage.setMessageContent(tpTicket.getTicketTitle());
374
+        tpMessage.setStatus("1");
375
+        // 阅读状态: 0未阅读
376
+        tpMessage.setReadStatus("0");
377
+        tpMessage.setCreateUser(userId);
378
+        tpMessage.setCreateDate(new Date());
379
+        tpMessage.setUpdateUser(userId);
380
+        tpMessage.setUpdateDate(new Date());
381
+
382
+        tpMessageMapper.insertSelective(tpMessage);
383
+
384
+        return tpMessage;
385
+
386
+    }
387
+
264 388
 }

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

@@ -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
 }

+ 14
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/vo/TpTicketVO.java Visa fil

@@ -39,8 +39,22 @@ public class TpTicketVO {
39 39
 
40 40
     private Date updateDate;
41 41
 
42
+    /** 报修类型:0:公共区域  1: 房屋质量  2::户内设施  PS : 报修的情况下才有报修类型  **/
43
+    private String repairType;
44
+
45
+    /**
46
+     * 报修类型的名字
47
+     */
48
+    private String repairName;
49
+
42 50
     /** ====================================== **/
43 51
 
52
+    /** 流程状态 **/
53
+    private String status;
54
+
55
+    /** 流程状态名称 **/
56
+    private String ticketStatusName;
57
+
44 58
     /** 最新进展 **/
45 59
     private String commentContent;
46 60
 

+ 128
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TaFaceMapper.xml Visa fil

@@ -0,0 +1,128 @@
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
+
121
+    <select id="getById" resultMap="BaseResultMap"  parameterType="java.lang.Integer" >
122
+        select
123
+        <include refid="Base_Column_List" />
124
+        from ta_face
125
+        where id = #{id,jdbcType=INTEGER}
126
+    </select>
127
+
128
+</mapper>

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

@@ -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>

+ 136
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TaSysMenuMapper.xml Visa fil

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

+ 7
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TaSysUserRoleMapper.xml Visa fil

@@ -86,4 +86,11 @@
86 86
     from ta_sys_user_role
87 87
     where user_id = #{userId,jdbcType=INTEGER} and role_id = 1
88 88
   </select>
89
+
90
+  <select id="selectByCommunityIdAndUserId" resultMap="BaseResultMap" parameterType="map">
91
+    select
92
+    <include refid="Base_Column_List" />
93
+    from ta_sys_user_role
94
+    where community_id = #{communityId,jdbcType=INTEGER} and user_id = #{userId,jdbcType=INTEGER}
95
+  </select>
89 96
 </mapper>

+ 68
- 7
CODE/smart-community/app-api/src/main/resources/mapper/TaUserMapper.xml Visa fil

@@ -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
@@ -36,23 +39,25 @@
36 39
     delete from ta_user
37 40
     where id = #{id,jdbcType=INTEGER}
38 41
   </delete>
39
-  <insert id="insert" parameterType="com.community.huiju.model.TaUser" >
42
+  <insert id="insert" parameterType="com.community.huiju.model.TaUser" useGeneratedKeys="true" keyProperty="id" >
40 43
     insert into ta_user (id, community_id, building_owner_info_id,
41 44
       head_portrait, user_name, login_name,
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" useGeneratedKeys="true" keyProperty="id" >
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
 
@@ -273,4 +308,30 @@
273 308
     from ta_user
274 309
     where parent_id = #{parentId}
275 310
   </select>
311
+
312
+  <select id="selectTaFaceParentId" parameterType="java.lang.Integer" resultMap="BaseResultMap" >
313
+    select
314
+      <include refid="Base_Column_List" />
315
+    from ta_user
316
+    where 1=1
317
+    <if test="otherUserID != null" >
318
+     and id = #{otherUserID,jdbcType=INTEGER}
319
+    </if>
320
+    <if test="id != null" >
321
+     and parent_id = #{id}
322
+    </if>
323
+    limit 1
324
+  </select>
325
+
326
+  <select id="getByLoginName" parameterType="java.lang.Integer" resultMap="BaseResultMap" >
327
+    select
328
+    <include refid="Base_Column_List" />
329
+    from ta_user
330
+    where community_id = #{communityId,jdbcType=INTEGER}
331
+    <if test="otherUserID != null" >
332
+      and login_name = #{phone}
333
+    </if>
334
+
335
+  </select>
336
+
276 337
 </mapper>

+ 1
- 1
CODE/smart-community/app-api/src/main/resources/mapper/TaVisitorLicenseMapper.xml Visa fil

@@ -126,7 +126,7 @@
126 126
     where id = #{id,jdbcType=INTEGER}
127 127
   </update>
128 128
 
129
-  <select id="findTaVistorLicenseById" resultType="java.lang.Integer" parameterType="java.lang.Integer" >
129
+  <select id="findTaVistorLicenseById" resultType="java.lang.String" parameterType="java.lang.Integer" >
130 130
     select
131 131
       license
132 132
     from ta_visitor_license

+ 7
- 6
CODE/smart-community/app-api/src/main/resources/mapper/TaVisitorMapper.xml Visa fil

@@ -8,7 +8,7 @@
8 8
     <result column="visitor_tel" property="visitorTel" jdbcType="VARCHAR" />
9 9
     <result column="visitor_num" property="visitorNum" jdbcType="VARCHAR" />
10 10
     <result column="visitor_statrt_time" property="visitorStatrtTime" jdbcType="TIMESTAMP" />
11
-    <result column="visitor_end_time" property="visitorEndTime" jdbcType="INTEGER" />
11
+    <result column="visitor_end_time" property="visitorEndTime" jdbcType="TIMESTAMP" />
12 12
     <result column="driving_status" property="drivingStatus" jdbcType="CHAR" />
13 13
     <result column="pay_entity" property="payEntity" jdbcType="VARCHAR" />
14 14
     <result column="visitor_code" property="visitorCode" jdbcType="VARCHAR" />
@@ -42,7 +42,7 @@
42 42
       )
43 43
     values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{visitorName,jdbcType=VARCHAR}, 
44 44
       #{visitorTel,jdbcType=VARCHAR}, #{visitorNum,jdbcType=VARCHAR}, #{visitorStatrtTime,jdbcType=TIMESTAMP}, 
45
-      #{visitorEndTime,jdbcType=INTEGER}, #{drivingStatus,jdbcType=CHAR}, #{payEntity,jdbcType=VARCHAR}, 
45
+      #{visitorEndTime,jdbcType=TIMESTAMP}, #{drivingStatus,jdbcType=CHAR}, #{payEntity,jdbcType=VARCHAR},
46 46
       #{visitorCode,jdbcType=VARCHAR}, #{taUserId,jdbcType=INTEGER}, #{createUser,jdbcType=INTEGER}, 
47 47
       #{createDate,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP}
48 48
       )
@@ -116,7 +116,7 @@
116 116
         #{visitorStatrtTime,jdbcType=TIMESTAMP},
117 117
       </if>
118 118
       <if test="visitorEndTime != null" >
119
-        #{visitorEndTime,jdbcType=INTEGER},
119
+        #{visitorEndTime,jdbcType=TIMESTAMP},
120 120
       </if>
121 121
       <if test="drivingStatus != null" >
122 122
         #{drivingStatus,jdbcType=CHAR},
@@ -163,7 +163,7 @@
163 163
         visitor_statrt_time = #{visitorStatrtTime,jdbcType=TIMESTAMP},
164 164
       </if>
165 165
       <if test="visitorEndTime != null" >
166
-        visitor_end_time = #{visitorEndTime,jdbcType=INTEGER},
166
+        visitor_end_time = #{visitorEndTime,jdbcType=TIMESTAMP},
167 167
       </if>
168 168
       <if test="drivingStatus != null" >
169 169
         driving_status = #{drivingStatus,jdbcType=CHAR},
@@ -199,7 +199,7 @@
199 199
       visitor_tel = #{visitorTel,jdbcType=VARCHAR},
200 200
       visitor_num = #{visitorNum,jdbcType=VARCHAR},
201 201
       visitor_statrt_time = #{visitorStatrtTime,jdbcType=TIMESTAMP},
202
-      visitor_end_time = #{visitorEndTime,jdbcType=INTEGER},
202
+      visitor_end_time = #{visitorEndTime,jdbcType=TIMESTAMP},
203 203
       driving_status = #{drivingStatus,jdbcType=CHAR},
204 204
       pay_entity = #{payEntity,jdbcType=VARCHAR},
205 205
       visitor_code = #{visitorCode,jdbcType=VARCHAR},
@@ -280,7 +280,7 @@
280 280
         #{visitorStatrtTime,jdbcType=TIMESTAMP},
281 281
       </if>
282 282
       <if test="visitorEndTime != null" >
283
-        #{visitorEndTime,jdbcType=INTEGER},
283
+        #{visitorEndTime,jdbcType=TIMESTAMP},
284 284
       </if>
285 285
       <if test="drivingStatus != null" >
286 286
         #{drivingStatus,jdbcType=CHAR},
@@ -315,5 +315,6 @@
315 315
     from ta_visitor
316 316
     where community_id = #{communityId,jdbcType=INTEGER}
317 317
     and ta_user_id = #{userId,jdbcType=INTEGER}
318
+    order by create_date DESC
318 319
   </select>
319 320
 </mapper>

+ 138
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TdImagesMapper.xml Visa fil

@@ -0,0 +1,138 @@
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
+
107
+  <select id="getByUUIDAndByType" parameterType="map" resultMap="BaseResultMap">
108
+    select
109
+    <include refid="Base_Column_List" />
110
+    from td_images
111
+    where uuid = #{uuid,jdbcType=INTEGER} and type = #{type,jdbcType=CHAR}
112
+    order by create_time DESC
113
+  </select>
114
+
115
+  <delete id="deleteByUuidAndType" parameterType="map" >
116
+    delete from td_images
117
+    where uuid = #{uuid,jdbcType=INTEGER} and type = #{type,jdbcType=CHAR}
118
+  </delete>
119
+
120
+  <insert id="insertBatch" parameterType="list" >
121
+    insert into td_images (image_url, uuid,
122
+      type, create_user, create_time
123
+      )
124
+    values
125
+    <foreach collection="list" item="item" index="index" separator="," >
126
+      (#{item.imageUrl,jdbcType=VARCHAR}, #{item.uuid,jdbcType=INTEGER},
127
+      #{item.type,jdbcType=CHAR}, #{item.createUser,jdbcType=INTEGER}, now()
128
+      )
129
+    </foreach>
130
+
131
+  </insert>
132
+
133
+  <delete id="deleteTdImages" parameterType="map" >
134
+    delete from td_images
135
+    where uuid = #{uuid,jdbcType=INTEGER} and type = #{type,jdbcType=CHAR}
136
+  </delete>
137
+
138
+</mapper>

+ 4
- 2
CODE/smart-community/app-api/src/main/resources/mapper/ToBannerMapper.xml Visa fil

@@ -34,8 +34,10 @@
34 34
     select
35 35
     id, community_id, banner_description, sort, banner_cover, banner_position, eff_time,
36 36
     exp_time, banner_type, external_link, banner_title, create_user, create_date
37
-    from to_banner t where t.eff_time &lt; #{nowTime}
38
-    and t.exp_time &gt; #{nowTime}
37
+    <![CDATA[
38
+    from to_banner t where date_format(t.eff_time,'%Y-%m-%d') <= date_format('2018-11-23','%Y-%m-%d')
39
+    and date_format(t.exp_time,'%Y-%m-%d') >= date_format('2018-11-23','%Y-%m-%d')
40
+    ]]>
39 41
     order by t.sort, t.eff_time
40 42
     <if test="num != null">
41 43
       limit #{num}

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

@@ -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,

+ 20
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpActivitySignupMapper.xml Visa fil

@@ -117,4 +117,24 @@
117 117
     from tp_activity_sign_up
118 118
     where activity_id = #{activityId} and community_id = #{communityId} and ta_user_id = #{userId}
119 119
   </select>
120
+
121
+
122
+  <select id="selectSignNum" resultType="java.lang.Integer">
123
+    select
124
+    count(*)
125
+    from tp_activity_sign_up
126
+    where activity_id = #{activityId} and community_id = #{communityId}
127
+  </select>
128
+
129
+  <delete id="deleteSignUp" parameterType="com.community.huiju.model.TpActivitySignup" >
130
+    delete from tp_activity_sign_up
131
+    where activity_id = #{activityId} and community_id = #{communityId} and ta_user_id = #{taUserId}
132
+  </delete>
133
+
134
+  <select id="selectTpActivetitySignByUserId" resultMap="BaseResultMap">
135
+    select
136
+    <include refid="Base_Column_List"/>
137
+    from tp_activity_sign_up
138
+    where activity_id = #{activityId} and community_id = #{communityId} and ta_user_id = #{userId}
139
+  </select>
120 140
 </mapper>

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

@@ -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

+ 57
- 14
CODE/smart-community/app-api/src/main/resources/mapper/TpMessageMapper.xml Visa fil

@@ -3,6 +3,7 @@
3 3
 <mapper namespace="com.community.huiju.dao.TpMessageMapper" >
4 4
   <resultMap id="BaseResultMap" type="com.community.huiju.model.TpMessage" >
5 5
     <id column="id" property="id" jdbcType="INTEGER" />
6
+    <id column="ticket_id" property="ticketId" jdbcType="INTEGER" />
6 7
     <result column="community_id" property="communityId" jdbcType="INTEGER" />
7 8
     <result column="message_type" property="messageType" jdbcType="CHAR" />
8 9
     <result column="advice_type" property="adviceType" jdbcType="CHAR" />
@@ -19,9 +20,14 @@
19 20
     <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
20 21
     <result column="update_user" property="updateUser" jdbcType="INTEGER" />
21 22
     <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
23
+    <result column="ticket_status" property="ticketStatus" jdbcType="VARCHAR" />
24
+    <result column="content" property="content" jdbcType="VARCHAR" />
25
+    <result column="read_message_icon" property="readMessageIcon" jdbcType="VARCHAR" />
26
+    <result column="unread_message_icon" property="unreadMessageIcon" jdbcType="VARCHAR" />
27
+    <result column="message_detail_url" property="messageDetailUrl" jdbcType="VARCHAR" />
22 28
   </resultMap>
23 29
   <sql id="Base_Column_List" >
24
-    id, community_id, message_type, advice_type, model_type, uuid, uuid_type, source, 
30
+    id, ticket_id,community_id, message_type, advice_type, model_type, uuid, uuid_type, source,
25 31
     message_content, status, result, meaasge_type_id, read_status, create_user, create_date, 
26 32
     update_user, update_date
27 33
   </sql>
@@ -36,25 +42,28 @@
36 42
     where id = #{id,jdbcType=INTEGER}
37 43
   </delete>
38 44
   <insert id="insert" parameterType="com.community.huiju.model.TpMessage" >
39
-    insert into tp_message (id, community_id, message_type, 
45
+    insert into tp_message (id, ticket_id, community_id, message_type,
40 46
       advice_type, model_type, uuid, 
41 47
       uuid_type, source, message_content, 
42 48
       status, result, meaasge_type_id, 
43 49
       read_status, create_user, create_date, 
44 50
       update_user, update_date)
45
-    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{messageType,jdbcType=CHAR}, 
51
+    values (#{id,jdbcType=INTEGER}, #{ticketId,jdbcType=INTEGER},#{communityId,jdbcType=INTEGER}, #{messageType,jdbcType=CHAR},
46 52
       #{adviceType,jdbcType=CHAR}, #{modelType,jdbcType=CHAR}, #{uuid,jdbcType=INTEGER}, 
47 53
       #{uuidType,jdbcType=CHAR}, #{source,jdbcType=CHAR}, #{messageContent,jdbcType=VARCHAR}, 
48 54
       #{status,jdbcType=CHAR}, #{result,jdbcType=VARCHAR}, #{meaasgeTypeId,jdbcType=VARCHAR}, 
49 55
       #{readStatus,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP}, 
50 56
       #{updateUser,jdbcType=INTEGER}, #{updateDate,jdbcType=TIMESTAMP})
51 57
   </insert>
52
-  <insert id="insertSelective" parameterType="com.community.huiju.model.TpMessage" >
58
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TpMessage" useGeneratedKeys="true" keyProperty="id" >
53 59
     insert into tp_message
54 60
     <trim prefix="(" suffix=")" suffixOverrides="," >
55 61
       <if test="id != null" >
56 62
         id,
57 63
       </if>
64
+      <if test="ticketId != null">
65
+        ticket_id,
66
+      </if>
58 67
       <if test="communityId != null" >
59 68
         community_id,
60 69
       </if>
@@ -108,6 +117,9 @@
108 117
       <if test="id != null" >
109 118
         #{id,jdbcType=INTEGER},
110 119
       </if>
120
+      <if test="ticketId != null">
121
+        #{ticketId,jdbcType=INTEGER},
122
+      </if>
111 123
       <if test="communityId != null" >
112 124
         #{communityId,jdbcType=INTEGER},
113 125
       </if>
@@ -161,6 +173,9 @@
161 173
   <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpMessage" >
162 174
     update tp_message
163 175
     <set >
176
+      <if test="ticketId != null">
177
+        ticket_id = #{ticketId,jdbcType=INTEGER},
178
+      </if>
164 179
       <if test="communityId != null" >
165 180
         community_id = #{communityId,jdbcType=INTEGER},
166 181
       </if>
@@ -214,7 +229,8 @@
214 229
   </update>
215 230
   <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TpMessage" >
216 231
     update tp_message
217
-    set community_id = #{communityId,jdbcType=INTEGER},
232
+    set ticket_id = #{ticketId,jdbcType=INTEGER},
233
+      community_id = #{communityId,jdbcType=INTEGER},
218 234
       message_type = #{messageType,jdbcType=CHAR},
219 235
       advice_type = #{adviceType,jdbcType=CHAR},
220 236
       model_type = #{modelType,jdbcType=CHAR},
@@ -249,18 +265,45 @@
249 265
 
250 266
   <select id="getMessages" resultMap="BaseResultMap">
251 267
     SELECT
252
-      <include refid="Base_Column_List" />
268
+        t.id,
269
+        t.ticket_id,
270
+        t.community_id,
271
+        t.message_type,
272
+        t.advice_type,
273
+        t.model_type,
274
+        t.uuid,
275
+        t.uuid_type,
276
+        t.source,
277
+        t.message_content,
278
+        t.STATUS,
279
+        t.result,
280
+        t.meaasge_type_id,
281
+        t.read_status,
282
+        t.create_user,
283
+        t.create_date,
284
+        t.update_user,
285
+        t.update_date,
286
+        k.status,
287
+        r.content,
288
+        d.name as ticket_status,
289
+        i.read_message_icon,
290
+		i.unread_message_icon,
291
+		i.message_detail_url
253 292
     FROM
254
-        tp_message
293
+        tp_message t
294
+    LEFT JOIN tp_ticket k on t.ticket_id = k.id  AND k.community_id = #{communityId,jdbcType=INTEGER}
295
+    LEFT JOIN tp_ticket_record r on t.ticket_id = r.ticket_id AND r.community_id = #{communityId,jdbcType=INTEGER}  AND k.status = r.status
296
+    LEFT JOIN sys_dictionary d on k.status = d.code AND d.group_id = ( SELECT id FROM sys_dictionary WHERE CODE = "ticket_status" )
297
+    LEFT JOIN tp_message_icon i on t.message_type = i.message_type
255 298
     WHERE
256
-        uuid_type = 1
257
-        AND community_id = #{communityId,jdbcType=INTEGER}
258
-        AND uuid = #{userId,jdbcType=INTEGER}
259
-        AND STATUS = 1
260
-        AND advice_type = 1
261
-        AND model_type = #{modelType,jdbcType=INTEGER}
299
+        t.uuid_type = 1
300
+        AND t.community_id = #{communityId,jdbcType=INTEGER}
301
+        AND t.uuid = #{userId,jdbcType=INTEGER}
302
+        AND t.STATUS = 1
303
+        AND t.advice_type = 1
304
+        AND t.model_type = #{modelType,jdbcType=INTEGER}
262 305
     ORDER BY
263
-    create_date DESC
306
+    t.create_date DESC
264 307
   </select>
265 308
 
266 309
   <update id="updateReadStatus" parameterType="java.lang.Integer" >

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

@@ -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>

+ 2
- 2
CODE/smart-community/app-api/src/main/resources/mapper/TpTicketRecordCommentMapper.xml Visa fil

@@ -154,8 +154,8 @@
154 154
   <select id="selectByTicketId" parameterType="map" resultMap="BaseResultMap" >
155 155
     select ttrc.* from tp_ticket tp
156 156
                 inner join tp_ticket_record ttr on tp.id = ttr.ticket_id
157
-                inner join tp_ticket_record_comment ttrc on ttr.ticket_id = ttrc.ticket_record_id
158
-    where tp.id=#{ticketId,jdbcType=INTEGER} order by ttrc.create_date DESC LIMIT #{size,jdbcType=INTEGER}
157
+                inner join tp_ticket_record_comment ttrc on ttr.id = ttrc.ticket_record_id
158
+    where tp.id=#{tickerId,jdbcType=INTEGER} order by ttrc.create_date DESC LIMIT #{size,jdbcType=INTEGER}
159 159
   </select>
160 160
 
161 161
   <select id="selectByTicketRecordId" parameterType="com.community.huiju.model.TpTicketRecord" resultMap="BaseResultMap" >

+ 16
- 4
CODE/smart-community/app-api/src/main/resources/mapper/TpTicketRecordMapper.xml Visa fil

@@ -5,12 +5,13 @@
5 5
     <id column="id" property="id" jdbcType="INTEGER" />
6 6
     <result column="community_id" property="communityId" jdbcType="INTEGER" />
7 7
     <result column="ticket_id" property="ticketId" jdbcType="INTEGER" />
8
+    <result column="content" property="content" jdbcType="VARCHAR" />
8 9
     <result column="status" property="status" jdbcType="CHAR" />
9 10
     <result column="create_user" property="createUser" jdbcType="INTEGER" />
10 11
     <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
11 12
   </resultMap>
12 13
   <sql id="Base_Column_List" >
13
-    id, community_id, ticket_id, status, create_user, create_date
14
+    id, community_id, ticket_id, content, status, create_user, create_date
14 15
   </sql>
15 16
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
16 17
     select 
@@ -23,11 +24,11 @@
23 24
     where id = #{id,jdbcType=INTEGER}
24 25
   </delete>
25 26
   <insert id="insert" parameterType="com.community.huiju.model.TpTicketRecord" >
26
-    insert into tp_ticket_record (id, community_id, ticket_id, 
27
+    insert into tp_ticket_record (id, community_id, ticket_id, content,
27 28
       status, create_user, create_date
28 29
       )
29 30
     values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{ticketId,jdbcType=INTEGER}, 
30
-      #{status,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP}
31
+      #{content,jdbcType=VARCHAR}, #{status,jdbcType=CHAR}, #{createUser,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP}
31 32
       )
32 33
   </insert>
33 34
   <insert id="insertSelective" parameterType="com.community.huiju.model.TpTicketRecord" >
@@ -42,6 +43,9 @@
42 43
       <if test="ticketId != null" >
43 44
         ticket_id,
44 45
       </if>
46
+      <if test="content != null">
47
+        content,
48
+      </if>
45 49
       <if test="status != null" >
46 50
         status,
47 51
       </if>
@@ -62,6 +66,9 @@
62 66
       <if test="ticketId != null" >
63 67
         #{ticketId,jdbcType=INTEGER},
64 68
       </if>
69
+      <if test="content != null">
70
+        #{content,jdbcType=VARCHAR},
71
+      </if>
65 72
       <if test="status != null" >
66 73
         #{status,jdbcType=CHAR},
67 74
       </if>
@@ -82,6 +89,9 @@
82 89
       <if test="ticketId != null" >
83 90
         ticket_id = #{ticketId,jdbcType=INTEGER},
84 91
       </if>
92
+      <if test="content != null">
93
+        content = #{content,jdbcType=VARCHAR},
94
+      </if>
85 95
       <if test="status != null" >
86 96
         status = #{status,jdbcType=CHAR},
87 97
       </if>
@@ -98,6 +108,7 @@
98 108
     update tp_ticket_record
99 109
     set community_id = #{communityId,jdbcType=INTEGER},
100 110
       ticket_id = #{ticketId,jdbcType=INTEGER},
111
+      content = #{content,jdbcType=VARCHAR},
101 112
       status = #{status,jdbcType=CHAR},
102 113
       create_user = #{createUser,jdbcType=INTEGER},
103 114
       create_date = #{createDate,jdbcType=TIMESTAMP}
@@ -108,6 +119,7 @@
108 119
   <select id="getTicketRecordByTicketId" resultType="com.community.huiju.model.TpTicketRecord">
109 120
     SELECT
110 121
         t.id,
122
+        t.status,
111 123
         t.ticket_id AS ticketId,
112 124
         t.community_id AS communityId,
113 125
         d.NAME AS ticketStatusName
@@ -118,6 +130,6 @@
118 130
     WHERE
119 131
         community_id = #{communityId,jdbcType=INTEGER}
120 132
         AND ticket_id = #{ticketId,jdbcType=INTEGER}
121
-
133
+    order by t.create_date DESC
122 134
   </select>
123 135
 </mapper>

+ 40
- 8
CODE/smart-community/app-api/src/main/resources/mapper/TpTransactionMapper.xml Visa fil

@@ -14,16 +14,34 @@
14 14
     <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
15 15
     <result column="update_user" property="updateUser" jdbcType="INTEGER" />
16 16
     <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
17
+    <result column="role_id" property="roleId" jdbcType="INTEGER" />
18
+    <result column="role_name" property="roleName" jdbcType="VARCHAR" />
17 19
   </resultMap>
18 20
   <sql id="Base_Column_List" >
19 21
     id, community_id, ta_user_id, transaction_title, transaction_content,
20 22
     view_count, status, type, create_user, create_date, update_user, update_date
21 23
   </sql>
22
-  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
23
-    select 
24
-    <include refid="Base_Column_List" />
25
-    from tp_transaction
26
-    where id = #{id,jdbcType=INTEGER} and #{communityId,jdbcType=INTEGER}
24
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="com.community.huiju.model.TpTransaction"  >
25
+    SELECT
26
+	ttr.id,
27
+	ttr.community_id,
28
+	ttr.ta_user_id,
29
+	ttr.transaction_title,
30
+	ttr.transaction_content,
31
+	ttr.view_count,
32
+	ttr.STATUS,
33
+	ttr.type,
34
+	ttr.create_user,
35
+	ttr.create_date,
36
+	ttr.update_user,
37
+	ttr.update_date,
38
+	sr.id AS role_id,
39
+	sr.role_name AS role_name
40
+FROM
41
+	tp_transaction ttr
42
+LEFT JOIN ta_sys_user_role tsur ON ttr.ta_user_id = tsur.user_id
43
+LEFT JOIN ta_sys_role sr ON sr.id = tsur.role_id
44
+    where ttr.id = #{id,jdbcType=INTEGER} and ttr.community_id=#{communityId,jdbcType=INTEGER}
27 45
   </select>
28 46
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
29 47
     delete from tp_transaction
@@ -179,14 +197,28 @@
179 197
     select
180 198
     <include refid="Base_Column_List" />
181 199
     from tp_transaction
182
-    where community_id = #{communityId,jdbcType=INTEGER} and type = #{type,jdbcType=VARCHAR}
200
+    where community_id = #{communityId,jdbcType=INTEGER}
201
+    <if test="type != null and type != ''">
202
+      and type = #{type,jdbcType=VARCHAR}
203
+    </if>
204
+    <if test="transactionTitle != null and transactionTitle !=''">
205
+      and transaction_title LIKE concat('%',#{transactionTitle,jdbcType=VARCHAR},'%')
206
+    </if>
207
+    and status = 1
208
+    order by create_date DESC
183 209
   </select>
184 210
 
185 211
   <select id="selectTransaction" resultMap="BaseResultMap">
186 212
     select
187 213
     <include refid="Base_Column_List" />
188 214
     from tp_transaction
189
-    where community_id = #{communityId,jdbcType=INTEGER} and ta_user_id = #{userId,jdbcType=INTEGER}
215
+    where community_id = #{communityId,jdbcType=INTEGER}
216
+    and ta_user_id = #{userId,jdbcType=INTEGER}
217
+    <if test="type != null and type != ''">
218
+      and type = #{type,jdbcType=INTEGER}
219
+    </if>
220
+    and status = 1
221
+    order by create_date DESC
190 222
   </select>
191 223
 
192 224
   <update id="updateTransaction" parameterType="com.community.huiju.model.TpTransaction" >
@@ -204,6 +236,6 @@
204 236
     select
205 237
     <include refid="Base_Column_List" />
206 238
     from tp_transaction
207
-    where id = #{id,jdbcType=INTEGER}
239
+    where id = #{id,jdbcType=INTEGER} and status = 1
208 240
   </select>
209 241
 </mapper>

+ 188
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpUserMapper.xml Visa fil

@@ -0,0 +1,188 @@
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.TpUserMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.TpUser" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
+    <result column="user_name" property="userName" jdbcType="VARCHAR" />
8
+    <result column="login_name" property="loginName" jdbcType="VARCHAR" />
9
+    <result column="login_password" property="loginPassword" jdbcType="VARCHAR" />
10
+    <result column="status" property="status" jdbcType="CHAR" />
11
+    <result column="remark" property="remark" jdbcType="VARCHAR" />
12
+    <result column="email" property="email" jdbcType="VARCHAR" />
13
+    <result column="head_portrait" property="headPortrait" jdbcType="VARCHAR" />
14
+    <result column="create_user" property="createUser" jdbcType="INTEGER" />
15
+    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
16
+    <result column="update_user" property="updateUser" jdbcType="INTEGER" />
17
+    <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
18
+  </resultMap>
19
+  <sql id="Base_Column_List" >
20
+    id, community_id, user_name, login_name, login_password, status, remark, email, head_portrait, 
21
+    create_user, create_date, update_user, update_date
22
+  </sql>
23
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
24
+    select 
25
+    <include refid="Base_Column_List" />
26
+    from tp_user
27
+    where id = #{id,jdbcType=INTEGER}
28
+  </select>
29
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
30
+    delete from tp_user
31
+    where id = #{id,jdbcType=INTEGER}
32
+  </delete>
33
+  <insert id="insert" parameterType="com.community.huiju.model.TpUser" >
34
+    insert into tp_user (id, community_id, user_name, 
35
+      login_name, login_password, status, 
36
+      remark, email, head_portrait, 
37
+      create_user, create_date, update_user, 
38
+      update_date)
39
+    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, 
40
+      #{loginName,jdbcType=VARCHAR}, #{loginPassword,jdbcType=VARCHAR}, #{status,jdbcType=CHAR}, 
41
+      #{remark,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{headPortrait,jdbcType=VARCHAR}, 
42
+      #{createUser,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER}, 
43
+      #{updateDate,jdbcType=TIMESTAMP})
44
+  </insert>
45
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TpUser" >
46
+    insert into tp_user
47
+    <trim prefix="(" suffix=")" suffixOverrides="," >
48
+      <if test="id != null" >
49
+        id,
50
+      </if>
51
+      <if test="communityId != null" >
52
+        community_id,
53
+      </if>
54
+      <if test="userName != null" >
55
+        user_name,
56
+      </if>
57
+      <if test="loginName != null" >
58
+        login_name,
59
+      </if>
60
+      <if test="loginPassword != null" >
61
+        login_password,
62
+      </if>
63
+      <if test="status != null" >
64
+        status,
65
+      </if>
66
+      <if test="remark != null" >
67
+        remark,
68
+      </if>
69
+      <if test="email != null" >
70
+        email,
71
+      </if>
72
+      <if test="headPortrait != null" >
73
+        head_portrait,
74
+      </if>
75
+      <if test="createUser != null" >
76
+        create_user,
77
+      </if>
78
+      <if test="createDate != null" >
79
+        create_date,
80
+      </if>
81
+      <if test="updateUser != null" >
82
+        update_user,
83
+      </if>
84
+      <if test="updateDate != null" >
85
+        update_date,
86
+      </if>
87
+    </trim>
88
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
89
+      <if test="id != null" >
90
+        #{id,jdbcType=INTEGER},
91
+      </if>
92
+      <if test="communityId != null" >
93
+        #{communityId,jdbcType=INTEGER},
94
+      </if>
95
+      <if test="userName != null" >
96
+        #{userName,jdbcType=VARCHAR},
97
+      </if>
98
+      <if test="loginName != null" >
99
+        #{loginName,jdbcType=VARCHAR},
100
+      </if>
101
+      <if test="loginPassword != null" >
102
+        #{loginPassword,jdbcType=VARCHAR},
103
+      </if>
104
+      <if test="status != null" >
105
+        #{status,jdbcType=CHAR},
106
+      </if>
107
+      <if test="remark != null" >
108
+        #{remark,jdbcType=VARCHAR},
109
+      </if>
110
+      <if test="email != null" >
111
+        #{email,jdbcType=VARCHAR},
112
+      </if>
113
+      <if test="headPortrait != null" >
114
+        #{headPortrait,jdbcType=VARCHAR},
115
+      </if>
116
+      <if test="createUser != null" >
117
+        #{createUser,jdbcType=INTEGER},
118
+      </if>
119
+      <if test="createDate != null" >
120
+        #{createDate,jdbcType=TIMESTAMP},
121
+      </if>
122
+      <if test="updateUser != null" >
123
+        #{updateUser,jdbcType=INTEGER},
124
+      </if>
125
+      <if test="updateDate != null" >
126
+        #{updateDate,jdbcType=TIMESTAMP},
127
+      </if>
128
+    </trim>
129
+  </insert>
130
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpUser" >
131
+    update tp_user
132
+    <set >
133
+      <if test="communityId != null" >
134
+        community_id = #{communityId,jdbcType=INTEGER},
135
+      </if>
136
+      <if test="userName != null" >
137
+        user_name = #{userName,jdbcType=VARCHAR},
138
+      </if>
139
+      <if test="loginName != null" >
140
+        login_name = #{loginName,jdbcType=VARCHAR},
141
+      </if>
142
+      <if test="loginPassword != null" >
143
+        login_password = #{loginPassword,jdbcType=VARCHAR},
144
+      </if>
145
+      <if test="status != null" >
146
+        status = #{status,jdbcType=CHAR},
147
+      </if>
148
+      <if test="remark != null" >
149
+        remark = #{remark,jdbcType=VARCHAR},
150
+      </if>
151
+      <if test="email != null" >
152
+        email = #{email,jdbcType=VARCHAR},
153
+      </if>
154
+      <if test="headPortrait != null" >
155
+        head_portrait = #{headPortrait,jdbcType=VARCHAR},
156
+      </if>
157
+      <if test="createUser != null" >
158
+        create_user = #{createUser,jdbcType=INTEGER},
159
+      </if>
160
+      <if test="createDate != null" >
161
+        create_date = #{createDate,jdbcType=TIMESTAMP},
162
+      </if>
163
+      <if test="updateUser != null" >
164
+        update_user = #{updateUser,jdbcType=INTEGER},
165
+      </if>
166
+      <if test="updateDate != null" >
167
+        update_date = #{updateDate,jdbcType=TIMESTAMP},
168
+      </if>
169
+    </set>
170
+    where id = #{id,jdbcType=INTEGER}
171
+  </update>
172
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TpUser" >
173
+    update tp_user
174
+    set community_id = #{communityId,jdbcType=INTEGER},
175
+      user_name = #{userName,jdbcType=VARCHAR},
176
+      login_name = #{loginName,jdbcType=VARCHAR},
177
+      login_password = #{loginPassword,jdbcType=VARCHAR},
178
+      status = #{status,jdbcType=CHAR},
179
+      remark = #{remark,jdbcType=VARCHAR},
180
+      email = #{email,jdbcType=VARCHAR},
181
+      head_portrait = #{headPortrait,jdbcType=VARCHAR},
182
+      create_user = #{createUser,jdbcType=INTEGER},
183
+      create_date = #{createDate,jdbcType=TIMESTAMP},
184
+      update_user = #{updateUser,jdbcType=INTEGER},
185
+      update_date = #{updateDate,jdbcType=TIMESTAMP}
186
+    where id = #{id,jdbcType=INTEGER}
187
+  </update>
188
+</mapper>

+ 20
- 8
CODE/smart-community/community-common/pom.xml Visa fil

@@ -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 Visa fil

@@ -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
+}

+ 32
- 2
CODE/smart-community/community-common/src/main/java/com/community/commom/constant/Constant.java Visa fil

@@ -51,12 +51,15 @@ public class Constant {
51 51
     /** 住户APP端待办 **/
52 52
     public static final Integer MODEL_TYPE_UPCOMING = 2;
53 53
 
54
-    /** 社交公告类型**/
54
+    /** 社交/图片 公告类型**/
55 55
     public static final String ANNOUNCEMENT = "announcement";
56 56
 
57
-    /** 社交活动类型**/
57
+    /** 社交/图片 活动类型**/
58 58
     public static final String ACTIVITY = "activity";
59 59
 
60
+    /** 社交/图片 租贷类型**/
61
+    public static final String TRANSACTION = "transaction";
62
+
60 63
     /** 社交二手租赁类型**/
61 64
     public static final String LEASE = "lease";
62 65
 
@@ -87,4 +90,31 @@ public class Constant {
87 90
     /** banner的类型 文章 **/
88 91
     public static final String BANNER_TYPE_ARTICLE = "2";
89 92
 
93
+    /**图片社交类型**/
94
+    public static final String SOCIAL = "social";
95
+
96
+    /**图片服务类型**/
97
+    public static final String SERVICE = "service";
98
+
99
+    /**判断业主,家属的身份是否已停用的提示**/
100
+    public static final String STATE_DISCONTINUED = "您的身份已停用,请联系物业";
101
+
102
+    /**判断业主,家属的身份是否已停用的状态**/
103
+    public static final String STATE_HINT = "9996";
104
+
105
+    /**认证通过后的**/
106
+
107
+
108
+    /** 添加用户所对应的部门 住户 **/
109
+    public static final String DEPT_RESIDENTS = "测试";
110
+    
111
+    /**
112
+     * 报名状态 已报名
113
+     */
114
+    public static final String STATUS_SIGNED = "signed";
115
+    
116
+    /**
117
+     * 报名状态 未报名
118
+     */
119
+    public static final String STATUS_UNSIGN = "unsigned";
90 120
 }

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

@@ -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 Visa fil

@@ -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 Visa fil

@@ -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 Visa fil

@@ -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är
CODE/smart-community/community-common/target/classes/com/community/commom/constant/Constant.class Visa fil


+ 0
- 0
CODE/smart-community/community-common/target/classes/com/community/commom/mode/ResponseBean.class Visa fil


Vissa filer visades inte eftersom för många filer har ändrats