Browse Source

修改 海康数据接口

weiximei 6 years ago
parent
commit
a815a50b7b
61 changed files with 1273 additions and 346 deletions
  1. BIN
      CODE/smart-community/app-api/lib/Digests.jar
  2. BIN
      CODE/smart-community/app-api/lib/HttpClientSSLUtils.jar
  3. 2
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/HKConstant.java
  4. 137
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/HKDigests.java
  5. 1
    3
      CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/HKOpenApi.java
  6. 162
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/HttpClientSSLUtils.java
  7. 7
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/AssembleController.java
  8. 27
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/BaseController.java
  9. 13
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/BillController.java
  10. 7
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/MenuController.java
  11. 25
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/MessageController.java
  12. 8
    2
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/MonitoringController.java
  13. 64
    2
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java
  14. 38
    9
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TicketController.java
  15. 1
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/UserController.java
  16. 13
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/VistorController.java
  17. 1
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaAgreement.java
  18. 7
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/CommunityServiceI.java
  19. 5
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/CommunityServiceImpl.java
  20. 9
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaUserServiceImpl.java
  21. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/ailiyun/AESDecode.class
  22. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/mode/ResponseBean.class
  23. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/redis/FastJsonSerializer.class
  24. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/redis/RedisConfiguration.class
  25. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/redis/RedisJsonSerializer.class
  26. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/redis/RedisObjectSerializer.class
  27. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/redis/RedisSerializer.class
  28. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/redis/RedisTemplate.class
  29. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/redis/SerializationFailedException.class
  30. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/redis/SingleRedisTemplate.class
  31. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/session/UserElement.class
  32. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/AccountValidatorUtil.class
  33. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/BeanTools.class
  34. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/CommonUtils.class
  35. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/CookieUtil.class
  36. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/DESUtils.class
  37. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/DateUtils.class
  38. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/EnumUtils.class
  39. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/HttpClientUtils.class
  40. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/MD5Utils.class
  41. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/OssUtil.class
  42. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/QRCodeGeneratorUtils.class
  43. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/utils/StringConverter.class
  44. BIN
      CODE/smart-community/community-common/target/community-common-0.0.1.jar
  45. 4
    0
      CODE/smart-community/community-common/target/maven-archiver/pom.properties
  46. 24
    0
      CODE/smart-community/community-common/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
  47. 24
    0
      CODE/smart-community/community-common/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
  48. 1
    1
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/BannerController.java
  49. 17
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/TpCarouselSettingMapper.java
  50. 1
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToBanner.java
  51. 43
    0
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/TpCarouselSetting.java
  52. 6
    2
      CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/ToBannerServiceImpl.java
  53. 3
    3
      CODE/smart-community/operate-api/src/main/resources/mapper/ToBannerMapper.xml
  54. 82
    0
      CODE/smart-community/operate-api/src/main/resources/mapper/TpCarouselSettingMapper.xml
  55. 3
    3
      VUECODE/smart-operate-manage/src/api/banner.js
  56. 14
    0
      VUECODE/smart-operate-manage/src/router/index.js
  57. 1
    3
      VUECODE/smart-operate-manage/src/store/modules/banner.js
  58. 1
    1
      VUECODE/smart-operate-manage/src/utils/request.js
  59. 228
    0
      VUECODE/smart-operate-manage/src/views/banner/addBanner/index.vue
  60. 239
    0
      VUECODE/smart-operate-manage/src/views/banner/ediBanner/index.vue
  61. 55
    309
      VUECODE/smart-operate-manage/src/views/banner/index.vue

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


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


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

31
      * <p>请将地址配置正确.</p>
31
      * <p>请将地址配置正确.</p>
32
      * <p>默认情况下是127.0.0.1:80 ,如果地址不通请根据实际情况修改IP端口</p>
32
      * <p>默认情况下是127.0.0.1:80 ,如果地址不通请根据实际情况修改IP端口</p>
33
      */
33
      */
34
-    public static final String OPENAPI_IP_PORT_HTTP = "http://192.168.0.122";
34
+//    public static final String OPENAPI_IP_PORT_HTTP = "http://192.168.0.122";
35
+    public static final String OPENAPI_IP_PORT_HTTP = "http://6wnrrtr3.wkdl.ltd";
35
 
36
 
36
     /**
37
     /**
37
      * <p>操作用户UUID,即用户UUID,首次使用操作用户UUID可以通过接口 [获取默认用户UUID]来获取</p>
38
      * <p>操作用户UUID,即用户UUID,首次使用操作用户UUID可以通过接口 [获取默认用户UUID]来获取</p>

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

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

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

2
 
2
 
3
 import com.alibaba.fastjson.JSON;
3
 import com.alibaba.fastjson.JSON;
4
 import com.google.common.collect.Maps;
4
 import com.google.common.collect.Maps;
5
-import com.hikvision.cms.api.common.util.Digests;
6
-import com.hikvision.cms.api.common.util.HttpClientSSLUtils;
7
 import lombok.extern.slf4j.Slf4j;
5
 import lombok.extern.slf4j.Slf4j;
8
 
6
 
9
 import java.util.Map;
7
 import java.util.Map;
37
         log.info("获取 监控列表 请求参数:{}", params);
35
         log.info("获取 监控列表 请求参数:{}", params);
38
         String data = null;
36
         String data = null;
39
         try {
37
         try {
40
-            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
38
+            data = HttpClientSSLUtils.doPost(url + "?token=" + HKDigests.buildToken(url + "?" + params, params, HKConstant.SECRET), params);
41
             log.info("获取 监控列表 请求返回结果:{}",data);
39
             log.info("获取 监控列表 请求返回结果:{}",data);
42
         } catch (Exception e) {
40
         } catch (Exception e) {
43
             e.printStackTrace();
41
             e.printStackTrace();

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

1
+package com.community.huiju.common.hk;
2
+
3
+import java.security.GeneralSecurityException;
4
+import java.security.KeyStore;
5
+import java.security.cert.CertificateException;
6
+import java.security.cert.X509Certificate;
7
+import java.util.HashMap;
8
+import java.util.Map;
9
+import javax.net.ssl.HostnameVerifier;
10
+import javax.net.ssl.SSLContext;
11
+import javax.net.ssl.SSLSession;
12
+
13
+import com.alibaba.fastjson.JSONObject;
14
+import org.apache.commons.io.IOUtils;
15
+import org.apache.http.HttpResponse;
16
+import org.apache.http.client.HttpClient;
17
+import org.apache.http.client.config.RequestConfig;
18
+import org.apache.http.client.config.RequestConfig.Builder;
19
+import org.apache.http.client.methods.HttpGet;
20
+import org.apache.http.client.methods.HttpPost;
21
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
22
+import org.apache.http.conn.ssl.TrustStrategy;
23
+import org.apache.http.entity.ContentType;
24
+import org.apache.http.entity.StringEntity;
25
+import org.apache.http.impl.client.CloseableHttpClient;
26
+import org.apache.http.impl.client.HttpClients;
27
+import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
28
+import org.apache.http.ssl.SSLContextBuilder;
29
+
30
+public class HttpClientSSLUtils {
31
+    private static HttpClient client = null;
32
+    protected static final Integer DEFAULT_CONNECTION_TIME_OUT = 100000;
33
+    protected static final Integer DEFAULT_SOCKET_TIME_OUT = 200000;
34
+    protected static final String DEFAULT_CHAR_SET = "UTF-8";
35
+
36
+    public HttpClientSSLUtils() {
37
+    }
38
+
39
+    public static String doPost(String url, String jsonText) throws Exception {
40
+        HttpClient client = null;
41
+        HttpPost post = new HttpPost(url);
42
+
43
+        String var6;
44
+        try {
45
+            if (jsonText != null && !jsonText.isEmpty()) {
46
+                StringEntity entity = new StringEntity(jsonText, ContentType.APPLICATION_JSON);
47
+                post.setEntity(entity);
48
+            }
49
+
50
+            Builder customReqConf = RequestConfig.custom();
51
+            customReqConf.setConnectTimeout(DEFAULT_CONNECTION_TIME_OUT);
52
+            customReqConf.setSocketTimeout(DEFAULT_CONNECTION_TIME_OUT);
53
+            post.setConfig(customReqConf.build());
54
+            HttpResponse res = null;
55
+            if (url.startsWith("https")) {
56
+                client = createSSLInsecureClient();
57
+                res = ((HttpClient)client).execute(post);
58
+            } else {
59
+                client = client;
60
+                res = ((HttpClient)client).execute(post);
61
+            }
62
+
63
+            var6 = IOUtils.toString(res.getEntity().getContent(), "UTF-8");
64
+        } finally {
65
+            post.releaseConnection();
66
+            if (url.startsWith("https") && client != null && client instanceof CloseableHttpClient) {
67
+                ((CloseableHttpClient)client).close();
68
+            }
69
+
70
+        }
71
+
72
+        return var6;
73
+    }
74
+
75
+    public static String doGet(String url) throws Exception {
76
+        HttpClient client = null;
77
+        HttpGet get = new HttpGet(url);
78
+        String result = "";
79
+
80
+        try {
81
+            Builder customReqConf = RequestConfig.custom();
82
+            customReqConf.setConnectTimeout(DEFAULT_CONNECTION_TIME_OUT);
83
+            customReqConf.setSocketTimeout(DEFAULT_CONNECTION_TIME_OUT);
84
+            get.setConfig(customReqConf.build());
85
+            HttpResponse res = null;
86
+            if (url.startsWith("https")) {
87
+                client = createSSLInsecureClient();
88
+                res = ((HttpClient)client).execute(get);
89
+            } else {
90
+                client = client;
91
+                res = ((HttpClient)client).execute(get);
92
+            }
93
+
94
+            result = IOUtils.toString(res.getEntity().getContent(), "UTF-8");
95
+        } finally {
96
+            get.releaseConnection();
97
+            if (url.startsWith("https") && client != null && client instanceof CloseableHttpClient) {
98
+                ((CloseableHttpClient)client).close();
99
+            }
100
+
101
+        }
102
+
103
+        return result;
104
+    }
105
+
106
+    private static CloseableHttpClient createSSLInsecureClient() throws GeneralSecurityException {
107
+        try {
108
+            SSLContext sslContext = (new SSLContextBuilder()).loadTrustMaterial((KeyStore)null, new TrustStrategy() {
109
+                @Override
110
+                public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException {
111
+                    return true;
112
+                }
113
+            }).build();
114
+            SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, new HostnameVerifier() {
115
+                @Override
116
+                public boolean verify(String hostname, SSLSession session) {
117
+                    return true;
118
+                }
119
+            });
120
+            return HttpClients.custom().setSSLSocketFactory(sslsf).build();
121
+        } catch (GeneralSecurityException var2) {
122
+            throw var2;
123
+        }
124
+    }
125
+
126
+    public static void main(String[] args) {
127
+        String url = "https://10.33.39.8/webapi/service/base/getPlatAuthSubSystemList";
128
+        String params = "appkey=f8524632&time=" + System.currentTimeMillis() + "&pageNo=1&pageSize=10";
129
+        String urlString = url + "?" + params + "&token=" + HKDigests.buildToken(url + "?" + params, (String)null, "0a5a6558a06546088da645b5f9248a3a");
130
+
131
+        try {
132
+            String output = new String(doGet(urlString));
133
+            System.out.println(output);
134
+        } catch (Exception var7) {
135
+            var7.printStackTrace();
136
+        }
137
+
138
+        url = "https://10.20.134.21/webapi/service/base/addPlatCard";
139
+        Map<String, Object> map = new HashMap();
140
+        map.put("appkey", "f8524632");
141
+        map.put("time", System.currentTimeMillis());
142
+        map.put("startCardNo", "16000");
143
+        map.put("endCardNo", "16010");
144
+        params = JSONObject.toJSONString(map);
145
+        url = url + "?token=" + HKDigests.buildToken(url + "?" + params, (String)null, "0a5a6558a06546088da645b5f9248a3a");
146
+
147
+        try {
148
+            System.out.println(doPost(url, params));
149
+        } catch (Exception var6) {
150
+            var6.printStackTrace();
151
+        }
152
+
153
+    }
154
+
155
+    static {
156
+        PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager();
157
+        cm.setMaxTotal(128);
158
+        cm.setDefaultMaxPerRoute(128);
159
+        client = HttpClients.custom().setConnectionManager(cm).build();
160
+    }
161
+}
162
+

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

32
 @RefreshScope
32
 @RefreshScope
33
 @RequestMapping("/")
33
 @RequestMapping("/")
34
 @Api(value = "首页聚合API", description = "首页聚合API")
34
 @Api(value = "首页聚合API", description = "首页聚合API")
35
-public class AssembleController {
35
+public class AssembleController extends BaseController {
36
 	
36
 	
37
 	@Autowired
37
 	@Autowired
38
 	private MenuServiceI menuService;
38
 	private MenuServiceI menuService;
51
 		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
51
 		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
52
 		Integer userId = userElement.getId();
52
 		Integer userId = userElement.getId();
53
 		ResponseBean responseBean = new ResponseBean();
53
 		ResponseBean responseBean = new ResponseBean();
54
+
55
+		if (!check(communityId)) {
56
+			responseBean.addError("小区不存在");
57
+			return responseBean;
58
+		}
59
+
54
 		Map<String,Object> indexMap = new HashMap<>();
60
 		Map<String,Object> indexMap = new HashMap<>();
55
 		//获取菜单数据
61
 		//获取菜单数据
56
 		List<TaSysMenu> menuList = menuService.getMenuList(communityId);
62
 		List<TaSysMenu> menuList = menuService.getMenuList(communityId);

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

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

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

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

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

28
 @RefreshScope
28
 @RefreshScope
29
 @RequestMapping("/")
29
 @RequestMapping("/")
30
 @Api(value = "菜单API", description = "菜单API")
30
 @Api(value = "菜单API", description = "菜单API")
31
-public class MenuController {
31
+public class MenuController extends BaseController {
32
 	
32
 	
33
 	@Autowired
33
 	@Autowired
34
 	private MenuServiceI menuService;
34
 	private MenuServiceI menuService;
38
 	@RequestMapping(value = "/menus/{communityId}",method = RequestMethod.GET)
38
 	@RequestMapping(value = "/menus/{communityId}",method = RequestMethod.GET)
39
 	public ResponseBean getMenuList(@PathVariable Integer communityId, HttpSession session){
39
 	public ResponseBean getMenuList(@PathVariable Integer communityId, HttpSession session){
40
 		ResponseBean responseBean = new ResponseBean();
40
 		ResponseBean responseBean = new ResponseBean();
41
+
42
+		if (!check(communityId)) {
43
+			responseBean.addError("小区不存在");
44
+			return responseBean;
45
+		}
46
+
41
 		List<TaSysMenu> list = menuService.getMenuList(communityId);
47
 		List<TaSysMenu> list = menuService.getMenuList(communityId);
42
 		responseBean.addSuccess(list);
48
 		responseBean.addSuccess(list);
43
 		return responseBean;
49
 		return responseBean;

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

30
 @RefreshScope
30
 @RefreshScope
31
 @RequestMapping("/")
31
 @RequestMapping("/")
32
 @Api(value = "消息相关的API",description = "消息相关的API")
32
 @Api(value = "消息相关的API",description = "消息相关的API")
33
-public class MessageController {
33
+public class MessageController extends BaseController {
34
 	
34
 	
35
 	@Autowired
35
 	@Autowired
36
 	private MessageServiceI messageService;
36
 	private MessageServiceI messageService;
43
 		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
43
 		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
44
 		Integer userId = userElement.getId();
44
 		Integer userId = userElement.getId();
45
 		ResponseBean responseBean = new ResponseBean();
45
 		ResponseBean responseBean = new ResponseBean();
46
+
47
+		if (!check(communityId)) {
48
+			responseBean.addError("小区不存在");
49
+			return responseBean;
50
+		}
51
+
46
 		Map<String,Object> totalMap = messageService.getMessageTotal(communityId, userId);
52
 		Map<String,Object> totalMap = messageService.getMessageTotal(communityId, userId);
47
 		responseBean.addSuccess(totalMap);
53
 		responseBean.addSuccess(totalMap);
48
 		return responseBean;
54
 		return responseBean;
60
 		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
66
 		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
61
 		Integer userId = userElement.getId();
67
 		Integer userId = userElement.getId();
62
 		ResponseBean responseBean = new ResponseBean();
68
 		ResponseBean responseBean = new ResponseBean();
69
+
70
+		if (!check(communityId)) {
71
+			responseBean.addError("小区不存在");
72
+			return responseBean;
73
+		}
74
+
63
 		List<TpMessage> newsList = messageService.getMessages(communityId,pageNum,pageSize, Constant.MODEL_TYPE_NEWS, userId);
75
 		List<TpMessage> newsList = messageService.getMessages(communityId,pageNum,pageSize, Constant.MODEL_TYPE_NEWS, userId);
64
 		responseBean.addSuccess(newsList);
76
 		responseBean.addSuccess(newsList);
65
 		return responseBean;
77
 		return responseBean;
77
 		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
89
 		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
78
 		Integer userId = userElement.getId();
90
 		Integer userId = userElement.getId();
79
 		ResponseBean responseBean = new ResponseBean();
91
 		ResponseBean responseBean = new ResponseBean();
92
+
93
+		if (!check(communityId)) {
94
+			responseBean.addError("小区不存在");
95
+			return responseBean;
96
+		}
97
+
80
 		List<TpMessage> upcomingList = messageService.getMessages(communityId,pageNum,pageSize,Constant.MODEL_TYPE_UPCOMING, userId);
98
 		List<TpMessage> upcomingList = messageService.getMessages(communityId,pageNum,pageSize,Constant.MODEL_TYPE_UPCOMING, userId);
81
 		responseBean.addSuccess(upcomingList);
99
 		responseBean.addSuccess(upcomingList);
82
 		return responseBean;
100
 		return responseBean;
90
 		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
108
 		UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
91
 		Integer userId = userElement.getId();
109
 		Integer userId = userElement.getId();
92
 		ResponseBean responseBean = new ResponseBean();
110
 		ResponseBean responseBean = new ResponseBean();
111
+
112
+		if (!check(communityId)) {
113
+			responseBean.addError("小区不存在");
114
+			return responseBean;
115
+		}
116
+
93
 		messageService.updateMessageReadStatus(communityId, userId);
117
 		messageService.updateMessageReadStatus(communityId, userId);
94
 		return responseBean;
118
 		return responseBean;
95
 	}
119
 	}

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

23
 @RefreshScope
23
 @RefreshScope
24
 @RequestMapping("/")
24
 @RequestMapping("/")
25
 @Api(value = "监控 控制器", description = "监控相关的数据")
25
 @Api(value = "监控 控制器", description = "监控相关的数据")
26
-public class MonitoringController {
26
+public class MonitoringController extends BaseController {
27
 
27
 
28
     @Autowired
28
     @Autowired
29
     private IMonitoringService iMonitoringService;
29
     private IMonitoringService iMonitoringService;
34
     })
34
     })
35
     @RequestMapping(value = "/monitoring/{communityId}",method = RequestMethod.POST)
35
     @RequestMapping(value = "/monitoring/{communityId}",method = RequestMethod.POST)
36
     public ResponseBean getList(@PathVariable("communityId") Integer communityId){
36
     public ResponseBean getList(@PathVariable("communityId") Integer communityId){
37
-        ResponseBean response = iMonitoringService.getByCommunityId(communityId);
37
+        ResponseBean response = new ResponseBean();
38
+        if (!check(communityId)) {
39
+            response.addError("小区不存在");
40
+            return response;
41
+        }
42
+
43
+        response = iMonitoringService.getByCommunityId(communityId);
38
         return response;
44
         return response;
39
     }
45
     }
40
 
46
 

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

27
 @RefreshScope
27
 @RefreshScope
28
 @RequestMapping("/")
28
 @RequestMapping("/")
29
 @Api(value = "app端论坛相关的API", description = "app端论坛相关的API")
29
 @Api(value = "app端论坛相关的API", description = "app端论坛相关的API")
30
-public class SocialController {
30
+public class SocialController extends BaseController {
31
 
31
 
32
     @Autowired
32
     @Autowired
33
     private SocialServiceI socialServiceI;
33
     private SocialServiceI socialServiceI;
41
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
41
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
42
         Integer userId = userElement.getId();
42
         Integer userId = userElement.getId();
43
         ResponseBean responseBean = new ResponseBean();
43
         ResponseBean responseBean = new ResponseBean();
44
+
45
+        if (!check(communityId)) {
46
+            responseBean.addError("小区不存在");
47
+            return responseBean;
48
+        }
49
+
44
         TpAnnouncement tpAnnouncement = socialServiceI.findAnnouncementDetail(id, communityId, userId);
50
         TpAnnouncement tpAnnouncement = socialServiceI.findAnnouncementDetail(id, communityId, userId);
45
         responseBean.addSuccess(tpAnnouncement);
51
         responseBean.addSuccess(tpAnnouncement);
46
         return responseBean;
52
         return responseBean;
54
     public ResponseBean SignActivity(@PathVariable(value = "communityId") Integer communityId, @RequestParam("activityId") Integer activityId, HttpSession session) {
60
     public ResponseBean SignActivity(@PathVariable(value = "communityId") Integer communityId, @RequestParam("activityId") Integer activityId, HttpSession session) {
55
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
61
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
56
         Integer userId = userElement.getId();
62
         Integer userId = userElement.getId();
57
-        ResponseBean responseBean = socialServiceI.findTaUserInfo(activityId, communityId, userId);
63
+
64
+        ResponseBean responseBean = new ResponseBean();
65
+
66
+        if (!check(communityId)) {
67
+            responseBean.addError("小区不存在");
68
+            return responseBean;
69
+        }
70
+
71
+        responseBean = socialServiceI.findTaUserInfo(activityId, communityId, userId);
58
         return responseBean;
72
         return responseBean;
59
     }
73
     }
60
 
74
 
68
                                          @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
82
                                          @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
69
                                          @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
83
                                          @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
70
         ResponseBean responseBean = new ResponseBean();
84
         ResponseBean responseBean = new ResponseBean();
85
+
86
+        if (!check(communityId)) {
87
+            responseBean.addError("小区不存在");
88
+            return responseBean;
89
+        }
90
+
71
         List<TpAnnouncement> announcementList = socialServiceI.getAnnouncements(communityId, title, pageNum, pageSize);
91
         List<TpAnnouncement> announcementList = socialServiceI.getAnnouncements(communityId, title, pageNum, pageSize);
72
         responseBean.addSuccess(announcementList);
92
         responseBean.addSuccess(announcementList);
73
         return responseBean;
93
         return responseBean;
80
     @RequestMapping(value = "/announcement/Img/{communityId}", method = RequestMethod.GET)
100
     @RequestMapping(value = "/announcement/Img/{communityId}", method = RequestMethod.GET)
81
     public ResponseBean getAnnouncement(@PathVariable(value = "communityId") Integer communityId) {
101
     public ResponseBean getAnnouncement(@PathVariable(value = "communityId") Integer communityId) {
82
         ResponseBean responseBean = new ResponseBean();
102
         ResponseBean responseBean = new ResponseBean();
103
+
104
+        if (!check(communityId)) {
105
+            responseBean.addError("小区不存在");
106
+            return responseBean;
107
+        }
108
+
83
         List<TpAnnouncement> agreement = socialServiceI.getAnnouncement(communityId);
109
         List<TpAnnouncement> agreement = socialServiceI.getAnnouncement(communityId);
84
         responseBean.addSuccess(agreement);
110
         responseBean.addSuccess(agreement);
85
         return responseBean;
111
         return responseBean;
92
     @RequestMapping(value = "/activity/Img/{communityId}", method = RequestMethod.GET)
118
     @RequestMapping(value = "/activity/Img/{communityId}", method = RequestMethod.GET)
93
     public ResponseBean getActivity(@PathVariable(value = "communityId") Integer communityId) {
119
     public ResponseBean getActivity(@PathVariable(value = "communityId") Integer communityId) {
94
         ResponseBean responseBean = new ResponseBean();
120
         ResponseBean responseBean = new ResponseBean();
121
+
122
+        if (!check(communityId)) {
123
+            responseBean.addError("小区不存在");
124
+            return responseBean;
125
+        }
126
+
95
         List<TpActivity> agreement = socialServiceI.getActivity(communityId);
127
         List<TpActivity> agreement = socialServiceI.getActivity(communityId);
96
         responseBean.addSuccess(agreement);
128
         responseBean.addSuccess(agreement);
97
         return responseBean;
129
         return responseBean;
108
                                      @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
140
                                      @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
109
                                      @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
141
                                      @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
110
         ResponseBean responseBean = new ResponseBean();
142
         ResponseBean responseBean = new ResponseBean();
143
+
144
+        if (!check(communityId)) {
145
+            responseBean.addError("小区不存在");
146
+            return responseBean;
147
+        }
148
+
111
         List<TpActivity> activityList = socialServiceI.getActivitys(communityId, title, pageNum, pageSize);
149
         List<TpActivity> activityList = socialServiceI.getActivitys(communityId, title, pageNum, pageSize);
112
         responseBean.addSuccess(activityList);
150
         responseBean.addSuccess(activityList);
113
         return responseBean;
151
         return responseBean;
122
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
160
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
123
         Integer userId = userElement.getId();
161
         Integer userId = userElement.getId();
124
         ResponseBean responseBean = new ResponseBean();
162
         ResponseBean responseBean = new ResponseBean();
163
+
164
+        if (!check(communityId)) {
165
+            responseBean.addError("小区不存在");
166
+            return responseBean;
167
+        }
168
+
125
         TpActivity activity = socialServiceI.findActivityDetail(activityId, communityId, userId);
169
         TpActivity activity = socialServiceI.findActivityDetail(activityId, communityId, userId);
126
         responseBean.addSuccess(activity);
170
         responseBean.addSuccess(activity);
127
         return responseBean;
171
         return responseBean;
136
         ResponseBean responseBean = new ResponseBean();
180
         ResponseBean responseBean = new ResponseBean();
137
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
181
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
138
         Integer userId = userElement.getId();
182
         Integer userId = userElement.getId();
183
+
184
+        if (!check(communityId)) {
185
+            responseBean.addError("小区不存在");
186
+            return responseBean;
187
+        }
188
+
139
         TpTransaction activity = socialServiceI.findUsedDetails(activityId, communityId, userId);
189
         TpTransaction activity = socialServiceI.findUsedDetails(activityId, communityId, userId);
140
         responseBean.addSuccess(activity);
190
         responseBean.addSuccess(activity);
141
         return responseBean;
191
         return responseBean;
151
                                     @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
201
                                     @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
152
                                     @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
202
                                     @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
153
         ResponseBean responseBean = new ResponseBean();
203
         ResponseBean responseBean = new ResponseBean();
204
+
205
+        if (!check(communityId)) {
206
+            responseBean.addError("小区不存在");
207
+            return responseBean;
208
+        }
209
+
154
         List<TpTransaction> tpTransactions = socialServiceI.findAllTransaction(communityId, type, pageNum, pageSize);
210
         List<TpTransaction> tpTransactions = socialServiceI.findAllTransaction(communityId, type, pageNum, pageSize);
155
         responseBean.addSuccess(tpTransactions);
211
         responseBean.addSuccess(tpTransactions);
156
         return responseBean;
212
         return responseBean;
216
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
272
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
217
         Integer userId = userElement.getId();
273
         Integer userId = userElement.getId();
218
         ResponseBean responseBean = new ResponseBean();
274
         ResponseBean responseBean = new ResponseBean();
275
+
276
+        if (!check(communityId)) {
277
+            responseBean.addError("小区不存在");
278
+            return responseBean;
279
+        }
280
+
219
         socialServiceI.accessTicket(communityId, tpTicket, ticketId, userId);
281
         socialServiceI.accessTicket(communityId, tpTicket, ticketId, userId);
220
         return responseBean;
282
         return responseBean;
221
     }
283
     }

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

28
 @RefreshScope
28
 @RefreshScope
29
 @RequestMapping("/")
29
 @RequestMapping("/")
30
 @Api(value = "工单相关的API",description = "工单相关的API")
30
 @Api(value = "工单相关的API",description = "工单相关的API")
31
-public class TicketController {
31
+public class TicketController extends BaseController {
32
 
32
 
33
     @Autowired
33
     @Autowired
34
     private ITicketService iTicketService;
34
     private ITicketService iTicketService;
39
     @RequestMapping(value = "/tickets/{communityId}", method = RequestMethod.GET)
39
     @RequestMapping(value = "/tickets/{communityId}", method = RequestMethod.GET)
40
     @ApiOperation(value = "获取 报修/投诉/联系单 各3条数据", notes = "根据 小区编号,第几页,一页多少行")
40
     @ApiOperation(value = "获取 报修/投诉/联系单 各3条数据", notes = "根据 小区编号,第几页,一页多少行")
41
     @ApiImplicitParams({
41
     @ApiImplicitParams({
42
-            @ApiImplicitParam(paramType = "path",dataType = "String",name = "communityId",value = "小区编号"),
42
+            @ApiImplicitParam(paramType = "path",dataType = "Integer",name = "communityId",value = "小区编号"),
43
             @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageNum",value = "第几页"),
43
             @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageNum",value = "第几页"),
44
             @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageSize",value = "一页多少数据"),
44
             @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageSize",value = "一页多少数据"),
45
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
45
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
46
     })
46
     })
47
     @Deprecated
47
     @Deprecated
48
-    public ResponseBean getService(@PathVariable(value = "communityId") String communityId,
48
+    public ResponseBean getService(@PathVariable(value = "communityId") Integer communityId,
49
                                    @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
49
                                    @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
50
                                    @RequestParam(value = "pageSize", defaultValue = "3") Integer pageSize,
50
                                    @RequestParam(value = "pageSize", defaultValue = "3") Integer pageSize,
51
                                    HttpSession session) {
51
                                    HttpSession session) {
52
         ResponseBean response = new ResponseBean();
52
         ResponseBean response = new ResponseBean();
53
 
53
 
54
+        if (!check(communityId)) {
55
+            response.addError("小区不存在");
56
+            return response;
57
+        }
58
+
54
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
59
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
55
 
60
 
56
         TpTicket tpTicket = new TpTicket();
61
         TpTicket tpTicket = new TpTicket();
63
 
68
 
64
     @ApiOperation(value = "获取报修/投诉/联系单进度详情数据", notes = "获取报修/投诉/联系单进度详情数据")
69
     @ApiOperation(value = "获取报修/投诉/联系单进度详情数据", notes = "获取报修/投诉/联系单进度详情数据")
65
     @ApiImplicitParams({
70
     @ApiImplicitParams({
66
-            @ApiImplicitParam(paramType = "path", dataType = "String", name = "communityId", value = "小区编号"),
71
+            @ApiImplicitParam(paramType = "path", dataType = "Integer", name = "communityId", value = "小区编号"),
67
             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "ticketId", value = "报修id")
72
             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "ticketId", value = "报修id")
68
     })
73
     })
69
     @RequestMapping(value = "/ticket/schedule/{communityId}", method = RequestMethod.GET)
74
     @RequestMapping(value = "/ticket/schedule/{communityId}", method = RequestMethod.GET)
70
-    public ResponseBean getTicketSchedule(@PathVariable(value = "communityId") String communityId, @RequestParam Integer ticketId) {
75
+    public ResponseBean getTicketSchedule(@PathVariable(value = "communityId") Integer communityId, @RequestParam Integer ticketId) {
71
         ResponseBean responseBean = new ResponseBean();
76
         ResponseBean responseBean = new ResponseBean();
72
-        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);
73
         responseBean.addSuccess(ticket);
84
         responseBean.addSuccess(ticket);
74
         return responseBean;
85
         return responseBean;
75
     }
86
     }
77
     @RequestMapping(value = "/tickets/list/{communityId}", method = RequestMethod.GET)
88
     @RequestMapping(value = "/tickets/list/{communityId}", method = RequestMethod.GET)
78
     @ApiOperation(value = "获取 报修/投诉/联系单 数据列表", notes = "根据 小区编号,工单类型,第几页,一页多少行")
89
     @ApiOperation(value = "获取 报修/投诉/联系单 数据列表", notes = "根据 小区编号,工单类型,第几页,一页多少行")
79
     @ApiImplicitParams({
90
     @ApiImplicitParams({
80
-            @ApiImplicitParam(paramType = "path",dataType = "String",name = "communityId", value = "小区编号"),
91
+            @ApiImplicitParam(paramType = "path",dataType = "Integer",name = "communityId", value = "小区编号"),
81
             @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageNum", value = "第几页"),
92
             @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageNum", value = "第几页"),
82
             @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageSize", value = "一页多少数据"),
93
             @ApiImplicitParam(paramType = "query",dataType = "Integer",name = "pageSize", value = "一页多少数据"),
83
             @ApiImplicitParam(paramType = "query",dataType = "String",name = "type", value = "工单类型 (0报修/1投诉/2联系单)"),
94
             @ApiImplicitParam(paramType = "query",dataType = "String",name = "type", value = "工单类型 (0报修/1投诉/2联系单)"),
84
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
95
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
85
 
96
 
86
     })
97
     })
87
-    public ResponseBean getServiceList(@PathVariable(value = "communityId") String communityId,
98
+    public ResponseBean getServiceList(@PathVariable(value = "communityId") Integer communityId,
88
                                        @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
99
                                        @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
89
                                        @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
100
                                        @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
90
                                        @RequestParam(value = "type") String type,
101
                                        @RequestParam(value = "type") String type,
91
                                        HttpSession session) {
102
                                        HttpSession session) {
92
         ResponseBean responseBean = new ResponseBean();
103
         ResponseBean responseBean = new ResponseBean();
93
 
104
 
105
+        if (!check(communityId)) {
106
+            responseBean.addError("小区不存在");
107
+            return responseBean;
108
+        }
109
+
94
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
110
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
95
 
111
 
96
         TpTicket tpTicket = new TpTicket();
112
         TpTicket tpTicket = new TpTicket();
113
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
129
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
114
         Integer userId = userElement.getId();
130
         Integer userId = userElement.getId();
115
         ResponseBean responseBean = new ResponseBean();
131
         ResponseBean responseBean = new ResponseBean();
132
+
133
+        if (!check(communityId)) {
134
+            responseBean.addError("小区不存在");
135
+            return responseBean;
136
+        }
137
+
116
         tpTicketRecordComment.setCommunityId(communityId);
138
         tpTicketRecordComment.setCommunityId(communityId);
117
         Integer size = iTicketService.updateTicketsReply(tpTicketRecordComment, userId);
139
         Integer size = iTicketService.updateTicketsReply(tpTicketRecordComment, userId);
118
         if (size > 0){
140
         if (size > 0){
167
     public ResponseBean stopTicket(@PathVariable("communityId") Integer communityId, @RequestParam("ticketId") Integer ticketId, HttpSession session) {
189
     public ResponseBean stopTicket(@PathVariable("communityId") Integer communityId, @RequestParam("ticketId") Integer ticketId, HttpSession session) {
168
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
190
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
169
         Integer userId = userElement.getId();
191
         Integer userId = userElement.getId();
170
-        ResponseBean responseBean = iTicketService.stopTpTicketRecord(communityId, ticketId, userId);
192
+
193
+        ResponseBean responseBean = new ResponseBean();
194
+        if (!check(communityId)) {
195
+            responseBean.addError("小区不存在");
196
+            return responseBean;
197
+        }
198
+
199
+        responseBean = iTicketService.stopTpTicketRecord(communityId, ticketId, userId);
171
         return responseBean;
200
         return responseBean;
172
     }
201
     }
173
 }
202
 }

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

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

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

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

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

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

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

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

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

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

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

125
             // TODO 这里目前定死为已录入, 后期根据人脸业务做判断
125
             // TODO 这里目前定死为已录入, 后期根据人脸业务做判断
126
             taUserVO.setFace("register");
126
             taUserVO.setFace("register");
127
 
127
 
128
+            ToCommunities communities = toCommunitiesMapper.selectByPrimaryKey(currentUser.getCommunityId());
129
+            taUserVO.setCommunityName(communities.getCommunityName());
130
+
128
             response.addSuccess(taUserVO);
131
             response.addSuccess(taUserVO);
129
             return response;
132
             return response;
130
         }else {
133
         }else {
131
             TaUser user = new TaUser();
134
             TaUser user = new TaUser();
132
             user.setLoginName(loginName);
135
             user.setLoginName(loginName);
133
             ResponseBean result = register(user);
136
             ResponseBean result = register(user);
137
+
138
+            ToCommunities communities = toCommunitiesMapper.selectByPrimaryKey(currentUser.getCommunityId());
139
+            TaUserVO taUserVO = (TaUserVO) result.getData();
140
+            taUserVO.setCommunityName(communities.getCommunityName());
141
+
134
             response.addSuccess(result.getData());
142
             response.addSuccess(result.getData());
135
         }
143
         }
144
+
136
         return response;
145
         return response;
137
     }
146
     }
138
 
147
 

BIN
CODE/smart-community/community-common/target/classes/com/community/commom/ailiyun/AESDecode.class View File


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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


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

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

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

1
+com\community\commom\redis\RedisTemplate.class
2
+com\community\commom\utils\DateUtils.class
3
+com\community\commom\utils\HttpClientUtils.class
4
+com\community\commom\constant\Constant.class
5
+com\community\commom\redis\RedisConfiguration.class
6
+com\community\commom\utils\OssUtil.class
7
+com\community\commom\redis\SingleRedisTemplate.class
8
+com\community\commom\utils\CookieUtil.class
9
+com\community\commom\ailiyun\AESDecode.class
10
+com\community\commom\utils\EnumUtils.class
11
+com\community\commom\redis\RedisJsonSerializer.class
12
+com\community\commom\utils\BeanTools.class
13
+com\community\commom\session\UserElement.class
14
+com\community\commom\utils\CommonUtils.class
15
+com\community\commom\redis\RedisSerializer.class
16
+com\community\commom\utils\StringConverter.class
17
+com\community\commom\utils\MD5Utils.class
18
+com\community\commom\mode\ResponseBean.class
19
+com\community\commom\redis\RedisObjectSerializer.class
20
+com\community\commom\utils\QRCodeGeneratorUtils.class
21
+com\community\commom\redis\SerializationFailedException.class
22
+com\community\commom\utils\DESUtils.class
23
+com\community\commom\utils\AccountValidatorUtil.class
24
+com\community\commom\redis\FastJsonSerializer.class

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

1
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\redis\RedisConfiguration.java
2
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\redis\SingleRedisTemplate.java
3
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\utils\HttpClientUtils.java
4
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\utils\DateUtils.java
5
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\utils\QRCodeGeneratorUtils.java
6
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\utils\BeanTools.java
7
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\utils\MD5Utils.java
8
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\utils\OssUtil.java
9
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\redis\RedisObjectSerializer.java
10
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\utils\CommonUtils.java
11
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\utils\StringConverter.java
12
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\session\UserElement.java
13
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\utils\CookieUtil.java
14
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\utils\AccountValidatorUtil.java
15
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\redis\SerializationFailedException.java
16
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\utils\EnumUtils.java
17
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\redis\RedisJsonSerializer.java
18
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\constant\Constant.java
19
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\redis\FastJsonSerializer.java
20
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\mode\ResponseBean.java
21
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\redis\RedisSerializer.java
22
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\redis\RedisTemplate.java
23
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\ailiyun\AESDecode.java
24
+E:\weiximei\git\smartCommunity\CODE\smart-community\community-common\src\main\java\com\community\commom\utils\DESUtils.java

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

34
             @ApiImplicitParam(paramType = "body",dataType = "ToBanner",name = "banner",value = "title(标题)," +
34
             @ApiImplicitParam(paramType = "body",dataType = "ToBanner",name = "banner",value = "title(标题)," +
35
                     "sort(权重),bannerCover(图片),bannerPosition(Banner位),communityId(小区)," +
35
                     "sort(权重),bannerCover(图片),bannerPosition(Banner位),communityId(小区)," +
36
                     "effTime(生效时间),expTime(失效时间),bannerType(Banner类型),externalLink(Banner的URL)," +
36
                     "effTime(生效时间),expTime(失效时间),bannerType(Banner类型),externalLink(Banner的URL)," +
37
-                    ",bannerTitle(内容标题),bannerContent(Banner内容)"),
37
+                    ",bannerTitle(内容标题),bannerContent(Banner内容),bannerDescription(跳转描述)"),
38
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
38
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
39
     })
39
     })
40
     @RequestMapping(value = "/banner",method = RequestMethod.POST)
40
     @RequestMapping(value = "/banner",method = RequestMethod.POST)

+ 17
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/TpCarouselSettingMapper.java View File

1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TpCarouselSetting;
4
+
5
+public interface TpCarouselSettingMapper {
6
+    int deleteByPrimaryKey(Integer id);
7
+
8
+    int insert(TpCarouselSetting record);
9
+
10
+    int insertSelective(TpCarouselSetting record);
11
+
12
+    TpCarouselSetting selectByPrimaryKey(Integer id);
13
+
14
+    int updateByPrimaryKeySelective(TpCarouselSetting record);
15
+
16
+    int updateByPrimaryKey(TpCarouselSetting record);
17
+}

+ 1
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToBanner.java View File

14
     @Min(value = 0,message = "小区不能为空!")
14
     @Min(value = 0,message = "小区不能为空!")
15
     private Integer communityId;
15
     private Integer communityId;
16
 
16
 
17
+    @NotBlank(message = "跳转描述不能为空!")
17
     private String bannerDescription;
18
     private String bannerDescription;
18
 
19
 
19
     private Integer sort;
20
     private Integer sort;

+ 43
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/TpCarouselSetting.java View File

1
+package com.community.huiju.model;
2
+
3
+public class TpCarouselSetting {
4
+    private Integer id;
5
+
6
+    private Integer communityId;
7
+
8
+    private String carouselType;
9
+
10
+    private Integer carouselNum;
11
+
12
+    public Integer getId() {
13
+        return id;
14
+    }
15
+
16
+    public void setId(Integer id) {
17
+        this.id = id;
18
+    }
19
+
20
+    public Integer getCommunityId() {
21
+        return communityId;
22
+    }
23
+
24
+    public void setCommunityId(Integer communityId) {
25
+        this.communityId = communityId;
26
+    }
27
+
28
+    public String getCarouselType() {
29
+        return carouselType;
30
+    }
31
+
32
+    public void setCarouselType(String carouselType) {
33
+        this.carouselType = carouselType == null ? null : carouselType.trim();
34
+    }
35
+
36
+    public Integer getCarouselNum() {
37
+        return carouselNum;
38
+    }
39
+
40
+    public void setCarouselNum(Integer carouselNum) {
41
+        this.carouselNum = carouselNum;
42
+    }
43
+}

+ 6
- 2
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/ToBannerServiceImpl.java View File

19
 import org.springframework.beans.BeanUtils;
19
 import org.springframework.beans.BeanUtils;
20
 import org.springframework.beans.factory.annotation.Autowired;
20
 import org.springframework.beans.factory.annotation.Autowired;
21
 import org.springframework.stereotype.Service;
21
 import org.springframework.stereotype.Service;
22
+import org.springframework.transaction.annotation.Transactional;
22
 
23
 
23
 import java.util.Date;
24
 import java.util.Date;
24
 import java.util.List;
25
 import java.util.List;
45
     private SysDictionaryMapper sysDictionaryMapper;
46
     private SysDictionaryMapper sysDictionaryMapper;
46
 
47
 
47
     @Override
48
     @Override
49
+    @Transactional(rollbackFor = Exception.class)
48
     public ResponseBean addBanner(ToBanner banner,Integer currentUserId) {
50
     public ResponseBean addBanner(ToBanner banner,Integer currentUserId) {
49
 
51
 
50
         ResponseBean response = new ResponseBean();
52
         ResponseBean response = new ResponseBean();
96
     }
98
     }
97
 
99
 
98
     @Override
100
     @Override
101
+    @Transactional(rollbackFor = Exception.class)
99
     public ResponseBean modifyBanner(ToBanner banner,Integer currentUserId) {
102
     public ResponseBean modifyBanner(ToBanner banner,Integer currentUserId) {
100
         ResponseBean response = new ResponseBean();
103
         ResponseBean response = new ResponseBean();
101
-        if (!Constant.BANNER_TYPE_ARTICLE.equals(banner.getBannerType())) {
104
+        if (Constant.BANNER_TYPE_ARTICLE.equals(banner.getBannerType())) {
102
             if (StringUtils.isBlank(banner.getBannerContent())) {
105
             if (StringUtils.isBlank(banner.getBannerContent())) {
103
                 response.addError("Banner内容不能为空");
106
                 response.addError("Banner内容不能为空");
104
                 return response;
107
                 return response;
150
             // TODO banner位置名称
153
             // TODO banner位置名称
151
             //SysDictionary sysDictionary = sysDictionaryMapper.selectByPrimaryKey(e.getBannerPosition());
154
             //SysDictionary sysDictionary = sysDictionaryMapper.selectByPrimaryKey(e.getBannerPosition());
152
             //toBannerVO.setBannerPositionName(sysDictionary.getName());
155
             //toBannerVO.setBannerPositionName(sysDictionary.getName());
153
-            toBannerVO.setBannerPositionName("首页banner");
156
+            toBannerVO.setBannerPositionName(e.getBannerPosition() == 1?"首页banner":"服务banner");
154
 
157
 
155
             ToUser toUser = toUserMapper.selectByPrimaryKey(e.getUpdateUser());
158
             ToUser toUser = toUserMapper.selectByPrimaryKey(e.getUpdateUser());
156
             toBannerVO.setUpdateUserName(toUser.getUserName());
159
             toBannerVO.setUpdateUserName(toUser.getUserName());
168
     }
171
     }
169
 
172
 
170
     @Override
173
     @Override
174
+    @Transactional(rollbackFor = Exception.class)
171
     public ResponseBean deleteBanner(Integer bannerId) {
175
     public ResponseBean deleteBanner(Integer bannerId) {
172
 
176
 
173
         ResponseBean response = new ResponseBean();
177
         ResponseBean response = new ResponseBean();

+ 3
- 3
CODE/smart-community/operate-api/src/main/resources/mapper/ToBannerMapper.xml View File

267
     from to_banner
267
     from to_banner
268
     <trim prefix="where" prefixOverrides="and">
268
     <trim prefix="where" prefixOverrides="and">
269
       <if test="title != null and title !=''">
269
       <if test="title != null and title !=''">
270
-       and title = #{title,jdbcType=VARCHAR}
270
+       and title like concat('%',#{title,jdbcType=VARCHAR},'%')
271
       </if>
271
       </if>
272
       <if test="bannerDescription != null and bannerDescription != ''">
272
       <if test="bannerDescription != null and bannerDescription != ''">
273
-       and banner_description = #{bannerDescription,jdbcType=VARCHAR}
273
+       and banner_description like concat('%',#{bannerDescription,jdbcType=VARCHAR},'%')
274
       </if>
274
       </if>
275
       <if test="bannerPosition != null and bannerPosition != ''">
275
       <if test="bannerPosition != null and bannerPosition != ''">
276
        and banner_position = #{bannerPosition,jdbcType=INTEGER}
276
        and banner_position = #{bannerPosition,jdbcType=INTEGER}
279
        and community_id = #{communityId,jdbcType=INTEGER}
279
        and community_id = #{communityId,jdbcType=INTEGER}
280
       </if>
280
       </if>
281
     </trim>
281
     </trim>
282
-    order by create_user DESC
282
+    order by create_date DESC
283
   </select>
283
   </select>
284
 </mapper>
284
 </mapper>

+ 82
- 0
CODE/smart-community/operate-api/src/main/resources/mapper/TpCarouselSettingMapper.xml View File

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.TpCarouselSettingMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.TpCarouselSetting" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
+    <result column="carousel_type" property="carouselType" jdbcType="VARCHAR" />
8
+    <result column="carousel_num" property="carouselNum" jdbcType="INTEGER" />
9
+  </resultMap>
10
+  <sql id="Base_Column_List" >
11
+    id, community_id, carousel_type, carousel_num
12
+  </sql>
13
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
14
+    select 
15
+    <include refid="Base_Column_List" />
16
+    from tp_carousel_setting
17
+    where id = #{id,jdbcType=INTEGER}
18
+  </select>
19
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
20
+    delete from tp_carousel_setting
21
+    where id = #{id,jdbcType=INTEGER}
22
+  </delete>
23
+  <insert id="insert" parameterType="com.community.huiju.model.TpCarouselSetting" >
24
+    insert into tp_carousel_setting (id, community_id, carousel_type, 
25
+      carousel_num)
26
+    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{carouselType,jdbcType=VARCHAR}, 
27
+      #{carouselNum,jdbcType=INTEGER})
28
+  </insert>
29
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TpCarouselSetting" >
30
+    insert into tp_carousel_setting
31
+    <trim prefix="(" suffix=")" suffixOverrides="," >
32
+      <if test="id != null" >
33
+        id,
34
+      </if>
35
+      <if test="communityId != null" >
36
+        community_id,
37
+      </if>
38
+      <if test="carouselType != null" >
39
+        carousel_type,
40
+      </if>
41
+      <if test="carouselNum != null" >
42
+        carousel_num,
43
+      </if>
44
+    </trim>
45
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
46
+      <if test="id != null" >
47
+        #{id,jdbcType=INTEGER},
48
+      </if>
49
+      <if test="communityId != null" >
50
+        #{communityId,jdbcType=INTEGER},
51
+      </if>
52
+      <if test="carouselType != null" >
53
+        #{carouselType,jdbcType=VARCHAR},
54
+      </if>
55
+      <if test="carouselNum != null" >
56
+        #{carouselNum,jdbcType=INTEGER},
57
+      </if>
58
+    </trim>
59
+  </insert>
60
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpCarouselSetting" >
61
+    update tp_carousel_setting
62
+    <set >
63
+      <if test="communityId != null" >
64
+        community_id = #{communityId,jdbcType=INTEGER},
65
+      </if>
66
+      <if test="carouselType != null" >
67
+        carousel_type = #{carouselType,jdbcType=VARCHAR},
68
+      </if>
69
+      <if test="carouselNum != null" >
70
+        carousel_num = #{carouselNum,jdbcType=INTEGER},
71
+      </if>
72
+    </set>
73
+    where id = #{id,jdbcType=INTEGER}
74
+  </update>
75
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TpCarouselSetting" >
76
+    update tp_carousel_setting
77
+    set community_id = #{communityId,jdbcType=INTEGER},
78
+      carousel_type = #{carouselType,jdbcType=VARCHAR},
79
+      carousel_num = #{carouselNum,jdbcType=INTEGER}
80
+    where id = #{id,jdbcType=INTEGER}
81
+  </update>
82
+</mapper>

+ 3
- 3
VUECODE/smart-operate-manage/src/api/banner.js View File

21
 // 修改 banner
21
 // 修改 banner
22
 export function updateBanner(banner) {
22
 export function updateBanner(banner) {
23
   return request({
23
   return request({
24
-    url: '/banner/list',
24
+    url: '/banner',
25
     method: 'put',
25
     method: 'put',
26
     data: banner
26
     data: banner
27
   })
27
   })
31
 export function deleteBanner(bannerId) {
31
 export function deleteBanner(bannerId) {
32
   return request({
32
   return request({
33
     url: '/banner/' + bannerId,
33
     url: '/banner/' + bannerId,
34
-    method: 'delete',
34
+    method: 'delete'
35
   })
35
   })
36
 }
36
 }
37
 
37
 
39
 export function getByBannerId(bannerId) {
39
 export function getByBannerId(bannerId) {
40
   return request({
40
   return request({
41
     url: '/banner/' + bannerId,
41
     url: '/banner/' + bannerId,
42
-    method: 'get',
42
+    method: 'get'
43
   })
43
   })
44
 }
44
 }
45
 
45
 

+ 14
- 0
VUECODE/smart-operate-manage/src/router/index.js View File

65
         component: () => import('@/views/banner/index'),
65
         component: () => import('@/views/banner/index'),
66
         name: 'banner-index',
66
         name: 'banner-index',
67
         meta: { title: 'banner运营', icon: 'table' }
67
         meta: { title: 'banner运营', icon: 'table' }
68
+      },
69
+      {
70
+        path: '/banner/addBanner',
71
+        component: () => import('@/views/banner/addBanner/index'),
72
+        name: 'banner-add',
73
+        hidden: true,
74
+        meta: { title: '添加banner', icon: 'table' }
75
+      },
76
+      {
77
+        path: '/banner/ediBanner',
78
+        component: () => import('@/views/banner/ediBanner/index'),
79
+        name: 'banner-edi',
80
+        hidden: true,
81
+        meta: { title: '修改banner', icon: 'table' }
68
       }
82
       }
69
     ]
83
     ]
70
   },
84
   },

+ 1
- 3
VUECODE/smart-operate-manage/src/store/modules/banner.js View File

28
     },
28
     },
29
 
29
 
30
     // 修改 banner
30
     // 修改 banner
31
-    UpdateBanner({ commit }, banner ) {
31
+    UpdateBanner({ commit }, banner) {
32
       return new Promise((resolve, reject) => {
32
       return new Promise((resolve, reject) => {
33
         updateBanner(banner).then(response => {
33
         updateBanner(banner).then(response => {
34
           resolve(response)
34
           resolve(response)
60
         })
60
         })
61
       })
61
       })
62
     }
62
     }
63
-
64
-
65
   }
63
   }
66
 }
64
 }
67
 
65
 

+ 1
- 1
VUECODE/smart-operate-manage/src/utils/request.js View File

6
 // 创建axios实例
6
 // 创建axios实例
7
 const service = axios.create({
7
 const service = axios.create({
8
   baseURL: process.env.BASE_API, // api 的 base_url
8
   baseURL: process.env.BASE_API, // api 的 base_url
9
-  timeout: 5000 // 请求超时时间
9
+  timeout: 10000 // 请求超时时间
10
 })
10
 })
11
 
11
 
12
 // request拦截器
12
 // request拦截器

+ 228
- 0
VUECODE/smart-operate-manage/src/views/banner/addBanner/index.vue View File

1
+<template>
2
+  <div class="app-container">
3
+    <el-form ref="addForm" :model="addForm">
4
+      <el-form-item :label-width="formLabelWidth" label="标题">
5
+        <el-input v-model="addForm.title"/>
6
+      </el-form-item>
7
+      <el-form-item :label-width="formLabelWidth" label="权重">
8
+        <el-input v-model="addForm.sort"/>
9
+      </el-form-item>
10
+      <el-form-item :label-width="formLabelWidth" label="banner图">
11
+        <el-input v-model="addForm.bannerCover"/>
12
+      </el-form-item>
13
+      <el-form-item :label-width="formLabelWidth" label="banner位">
14
+        <el-select v-model="addForm.bannerPosition" placeholder="请选择位置">
15
+          <!-- <el-option label="请选择位置" value="-1"/> -->
16
+          <el-option
17
+            v-for="item in bannerPositionArr"
18
+            :key="item.id"
19
+            :label="item.value"
20
+            :value="item.id"
21
+          />
22
+          <!-- <el-option v-for="item in bannerPositionArr" label="item.value" value="item.id"/> -->
23
+        </el-select>
24
+      </el-form-item>
25
+      <el-form-item :label-width="formLabelWidth" label="投放社区">
26
+        <el-select v-model="addForm.communityId" placeholder="请选择社区">
27
+          <!-- <el-option label="请选择社区" value="-1"/> -->
28
+          <el-option v-for="item in communityList" :key="item.id" :value="item.id" :label="item.communityName"/>
29
+          <!-- <el-option label="区域一" value="shanghai"/> -->
30
+        </el-select>
31
+      </el-form-item>
32
+      <el-form-item :label-width="formLabelWidth" label="生效时间">
33
+        <el-date-picker
34
+          v-model="addForm.effTime"
35
+          type="datetime"
36
+          placeholder="选择日期时间"/>
37
+      </el-form-item>
38
+      <el-form-item :label-width="formLabelWidth" label="失效时间">
39
+        <el-date-picker
40
+          v-model="addForm.expTime"
41
+          type="datetime"
42
+          placeholder="选择日期时间"/>
43
+      </el-form-item>
44
+      <el-form-item :label-width="formLabelWidth" label="跳转描述">
45
+        <el-input
46
+          v-model="addForm.bannerDescription"
47
+          :autosize="{ minRows: 2, maxRows: 4}"
48
+          type="textarea"
49
+          placeholder="请输入跳转描述"/>
50
+      </el-form-item>
51
+      <el-form-item :label-width="formLabelWidth" label="banner跳转">
52
+        <el-radio v-model="addForm.bannerType" label="1" @change="showContent">外部超链接</el-radio>
53
+        <el-radio v-model="addForm.bannerType" label="2" @change="showContent">自写文章</el-radio>
54
+      </el-form-item>
55
+      <el-form-item v-if="showURLVisible" :label-width="formLabelWidth" label="URL">
56
+        <el-input v-model="addForm.externalLink" placeholder="URL"/>
57
+      </el-form-item>
58
+      <div v-if="showContentVisible">
59
+        <el-form-item :label-width="formLabelWidth" label="内容标题">
60
+          <el-input v-model="addForm.bannerTitle" placeholder="内容标题"/>
61
+        </el-form-item>
62
+        <el-form-item :label-width="formLabelWidth" label="内容详情">
63
+          <el-input v-model="addForm.bannerContent" placeholder="内容详情"/>
64
+        </el-form-item>
65
+      </div>
66
+    </el-form>
67
+    <div slot="footer" class="dialog-footer">
68
+      <el-button @click="dialogForm('0')">取 消</el-button>
69
+      <el-button type="primary" @click="dialogForm('1')">确 定</el-button>
70
+    </div>
71
+  </div>
72
+</template>
1
 
73
 
74
+<script>
75
+// import { updateArticle, createBanner } from '@/api/banner' // getBanner
76
+import { mapState, mapActions } from 'vuex'
77
+import waves from '@/directive/waves' // Waves directive
78
+import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
79
+const calendarTypeOptions = [
80
+  { key: 'CN', display_name: 'China' },
81
+  { key: 'US', display_name: 'USA' },
82
+  { key: 'JP', display_name: 'Japan' },
83
+  { key: 'EU', display_name: 'Eurozone' }
84
+]
85
+// arr to obj ,such as { CN : "China", US : "USA" }
86
+const calendarTypeKeyValue = calendarTypeOptions.reduce((acc, cur) => {
87
+  acc[cur.key] = cur.display_name
88
+  return acc
89
+}, {})
90
+export default {
91
+  name: 'AddBanner',
92
+  components: { Pagination },
93
+  directives: { waves },
94
+  filters: {
95
+    statusFilter(status) {
96
+      const statusMap = {
97
+        published: 'success',
98
+        draft: 'info',
99
+        deleted: 'danger'
100
+      }
101
+      return statusMap[status]
102
+    },
103
+    typeFilter(type) {
104
+      return calendarTypeKeyValue[type]
105
+    }
106
+  },
107
+  data() {
108
+    return {
109
+      tableKey: 0,
110
+      list: null,
111
+      total: 0,
112
+      listLoading: true,
113
+      importanceOptions: [1, 2, 3],
114
+      calendarTypeOptions,
115
+      addForm: {
116
+        title: '',
117
+        sort: '1',
118
+        bannerCover: '',
119
+        bannerPosition: '',
120
+        communityId: '',
121
+        effTime: '',
122
+        expTime: '',
123
+        bannerType: '1',
124
+        externalLink: '',
125
+        bannerTitle: '',
126
+        bannerContent: '',
127
+        bannerDescription: ''
128
+      },
129
+      dialogStatus: '',
130
+      downloadLoading: false,
131
+      formLabelWidth: '120px',
132
+      showContentVisible: false,
133
+      showURLVisible: true,
134
+      bannerPositionArr: [
135
+        { id: 1, value: '首页banner' },
136
+        { id: 2, value: '服务banner' }
137
+      ],
138
+      communityArr: [
139
+        { id: 3, value: '智慧社区' },
140
+        { id: 2, value: '测试社区' }
141
+      ]
142
+    }
143
+  },
144
+  computed: {
145
+    ...mapState('community', {
146
+      communityList: s => s.list
147
+    })
148
+  },
149
+  methods: {
150
+    ...mapActions('community', [
151
+      'FetchCommunityList',
152
+      'CreateCommunity',
153
+      'UpdateCommunity'
154
+    ]),
155
+    dialogAddForm() {
156
+      this.dialogFormVisible = true
157
+      this.addForm.title = ''
158
+      this.addForm.sort = '1'
159
+      this.addForm.bannerCover = ''
160
+      this.addForm.bannerPosition = '-1'
161
+      this.addForm.communityId = '-1'
162
+      this.addForm.effTime = ''
163
+      this.addForm.expTime = ''
164
+      this.addForm.bannerType = '1'
165
+      this.addForm.externalLink = ''
166
+      this.addForm.bannerTitle = ''
167
+      this.addForm.bannerContent = ''
168
+      this.addForm.bannerDescription = ''
169
+    },
170
+    dialogForm(isVaule) {
171
+      if (isVaule === '0') {
172
+        this.$router.push({ name: 'banner-index' })
173
+      } else {
174
+        this.createData()
175
+        // console.log('添加banner的数据: ', this.addForm)
176
+      }
177
+    },
178
+    showContent() {
179
+      if (this.addForm.bannerType === '1') {
180
+        this.showContentVisible = false
181
+        this.showURLVisible = true
182
+      } else {
183
+        this.showContentVisible = true
184
+        this.showURLVisible = false
185
+      }
186
+    },
187
+    createData() {
188
+      this.$refs['addForm'].validate((valid) => {
189
+        if (valid) {
190
+          this.$store.dispatch('AddBanner', this.addForm).then((res) => {
191
+            if (res.code === '0') {
192
+              this.$notify({
193
+                title: '操作成功!',
194
+                message: res.message,
195
+                type: 'success'
196
+              })
197
+              this.$router.push({ name: 'banner-index' })
198
+            } else {
199
+              this.$notify({
200
+                title: '操作失败',
201
+                message: res.message,
202
+                type: 'warning'
203
+              })
204
+            }
205
+          })
206
+        }
207
+      })
208
+    },
209
+    getCommuniryList() {
210
+      this.listLoading = true
211
+      this.FetchCommunityList().then(() => {
212
+        this.listLoading = false
213
+      }).catch(() => {
214
+        this.loading = false
215
+        console.log('get list error')
216
+      })
217
+    }
218
+  }
219
+}
220
+</script>
2
 
221
 
222
+<style scoped>
223
+.app-container {
224
+  width: 50%;
225
+  margin: auto;
226
+}
227
+.dialog-footer {
228
+  text-align: center;
229
+}
230
+</style>
3
 
231
 

+ 239
- 0
VUECODE/smart-operate-manage/src/views/banner/ediBanner/index.vue View File

1
+<template>
2
+  <div class="app-container">
3
+    <el-form ref="form" :model="form">
4
+      <el-form-item :label-width="formLabelWidth" label="标题">
5
+        <el-input v-model="form.title"/>
6
+      </el-form-item>
7
+      <el-form-item :label-width="formLabelWidth" label="权重">
8
+        <el-input v-model="form.sort"/>
9
+      </el-form-item>
10
+      <el-form-item :label-width="formLabelWidth" label="banner图">
11
+        <el-input v-model="form.bannerCover"/>
12
+      </el-form-item>
13
+      <el-form-item :label-width="formLabelWidth" label="banner位">
14
+        <el-select v-model="form.bannerPosition" placeholder="请选择位置">
15
+          <el-option label="请选择位置" value="-1"/>
16
+          <el-option
17
+            v-for="item in bannerPositionArr"
18
+            :key="item.id"
19
+            :label="item.value"
20
+            :value="item.id"
21
+          />
22
+          <!-- <el-option v-for="item in bannerPositionArr" label="item.value" value="item.id"/> -->
23
+        </el-select>
24
+      </el-form-item>
25
+      <el-form-item :label-width="formLabelWidth" label="投放社区">
26
+        <el-select v-model="form.communityId" placeholder="请选择社区">
27
+          <!-- <el-option label="请选择社区" value="-1"/> -->
28
+          <el-option v-for="item in communityList" :key="item.id" :value="item.id" :label="item.communityName"/>
29
+          <!-- <el-option label="区域一" value="shanghai"/> -->
30
+        </el-select>
31
+      </el-form-item>
32
+      <el-form-item :label-width="formLabelWidth" label="生效时间">
33
+        <el-date-picker
34
+          v-model="form.effTime"
35
+          type="datetime"
36
+          placeholder="选择日期时间"/>
37
+      </el-form-item>
38
+      <el-form-item :label-width="formLabelWidth" label="失效时间">
39
+        <el-date-picker
40
+          v-model="form.expTime"
41
+          type="datetime"
42
+          placeholder="选择日期时间"/>
43
+      </el-form-item>
44
+      <el-form-item :label-width="formLabelWidth" label="跳转描述">
45
+        <el-input
46
+          v-model="form.bannerDescription"
47
+          :autosize="{ minRows: 2, maxRows: 4}"
48
+          type="textarea"
49
+          placeholder="请输入跳转描述"/>
50
+      </el-form-item>
51
+      <el-form-item :label-width="formLabelWidth" label="banner跳转">
52
+        <el-radio v-model="form.bannerType" label="1" @change="showContent">外部超链接</el-radio>
53
+        <el-radio v-model="form.bannerType" label="2" @change="showContent">自写文章</el-radio>
54
+      </el-form-item>
55
+      <el-form-item v-if="showURLVisible" :label-width="formLabelWidth" label="URL">
56
+        <el-input v-model="form.externalLink" placeholder="URL"/>
57
+      </el-form-item>
58
+      <div v-if="showContentVisible">
59
+        <el-form-item :label-width="formLabelWidth" label="内容标题">
60
+          <el-input v-model="form.bannerTitle" placeholder="内容标题"/>
61
+        </el-form-item>
62
+        <el-form-item :label-width="formLabelWidth" label="内容详情">
63
+          <el-input v-model="form.bannerContent" placeholder="内容详情"/>
64
+        </el-form-item>
65
+      </div>
66
+    </el-form>
67
+    <div slot="footer" class="dialog-footer">
68
+      <el-button @click="dialogForm('0')">取 消</el-button>
69
+      <el-button type="primary" @click="dialogForm('1')">确 定</el-button>
70
+    </div>
71
+  </div>
72
+</template>
73
+
74
+<script>
75
+// import { updateArticle, createBanner } from '@/api/banner' // getBanner
76
+import { mapState, mapActions } from 'vuex'
77
+import waves from '@/directive/waves' // Waves directive
78
+import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
79
+const calendarTypeOptions = [
80
+  { key: 'CN', display_name: 'China' },
81
+  { key: 'US', display_name: 'USA' },
82
+  { key: 'JP', display_name: 'Japan' },
83
+  { key: 'EU', display_name: 'Eurozone' }
84
+]
85
+// arr to obj ,such as { CN : "China", US : "USA" }
86
+const calendarTypeKeyValue = calendarTypeOptions.reduce((acc, cur) => {
87
+  acc[cur.key] = cur.display_name
88
+  return acc
89
+}, {})
90
+export default {
91
+  name: 'UpdateBanner',
92
+  components: { Pagination },
93
+  directives: { waves },
94
+  filters: {
95
+    statusFilter(status) {
96
+      const statusMap = {
97
+        published: 'success',
98
+        draft: 'info',
99
+        deleted: 'danger'
100
+      }
101
+      return statusMap[status]
102
+    },
103
+    typeFilter(type) {
104
+      return calendarTypeKeyValue[type]
105
+    }
106
+  },
107
+  data() {
108
+    return {
109
+      tableKey: 0,
110
+      list: null,
111
+      total: 0,
112
+      listLoading: true,
113
+      importanceOptions: [1, 2, 3],
114
+      calendarTypeOptions,
115
+      form: {
116
+        title: '',
117
+        sort: '1',
118
+        bannerCover: '',
119
+        bannerPosition: '',
120
+        communityId: '',
121
+        effTime: '',
122
+        expTime: '',
123
+        bannerType: '1',
124
+        externalLink: '',
125
+        bannerTitle: '',
126
+        bannerContent: '',
127
+        bannerDescription: ''
128
+      },
129
+      dialogStatus: '',
130
+      downloadLoading: false,
131
+      formLabelWidth: '120px',
132
+      showContentVisible: false,
133
+      showURLVisible: true,
134
+      bannerPositionArr: [
135
+        { id: 1, value: '首页banner' },
136
+        { id: 2, value: '服务banner' }
137
+      ],
138
+      communityArr: [
139
+        { id: 3, value: '智慧社区' },
140
+        { id: 2, value: '测试社区' }
141
+      ]
142
+    }
143
+  },
144
+  computed: {
145
+    ...mapState('community', {
146
+      communityList: s => s.list
147
+    })
148
+  },
149
+  created() {
150
+    this.getByBannerId(this.$route.params.id)
151
+  },
152
+  methods: {
153
+    ...mapActions('community', [
154
+      'FetchCommunityList',
155
+      'CreateCommunity',
156
+      'UpdateCommunity'
157
+    ]),
158
+    dialogAddForm() {
159
+      this.dialogFormVisible = true
160
+      this.form.title = ''
161
+      this.form.sort = '1'
162
+      this.form.bannerCover = ''
163
+      this.form.bannerPosition = '-1'
164
+      this.form.communityId = '-1'
165
+      this.form.effTime = ''
166
+      this.form.expTime = ''
167
+      this.form.bannerType = '1'
168
+      this.form.externalLink = ''
169
+      this.form.bannerTitle = ''
170
+      this.form.bannerContent = ''
171
+      this.form.bannerDescription = ''
172
+    },
173
+    dialogForm(isVaule) {
174
+      if (isVaule === '0') {
175
+        this.$router.push({ name: 'banner-index' })
176
+      } else {
177
+        this.updateData()
178
+      }
179
+    },
180
+    showContent() {
181
+      if (this.form.bannerType === '1') {
182
+        this.showContentVisible = false
183
+        this.showURLVisible = true
184
+      } else {
185
+        this.showContentVisible = true
186
+        this.showURLVisible = false
187
+      }
188
+    },
189
+    updateData() {
190
+      this.$refs['form'].validate((valid) => {
191
+        if (valid) {
192
+          this.$store.dispatch('UpdateBanner', this.form).then((res) => {
193
+            if (res.code === '0') {
194
+              this.$notify({
195
+                title: '操作成功!',
196
+                message: res.message,
197
+                type: 'success'
198
+              })
199
+              this.$router.push({ name: 'banner-index' })
200
+            } else {
201
+              this.$notify({
202
+                title: '操作失败',
203
+                message: res.message,
204
+                type: 'warning'
205
+              })
206
+            }
207
+          })
208
+        }
209
+      })
210
+    },
211
+    getByBannerId(bannerId) {
212
+      this.$store.dispatch('GetByBannerId', bannerId).then(res => {
213
+        this.form = res
214
+        this.showContent()
215
+      })
216
+    },
217
+    getCommuniryList() {
218
+      this.listLoading = true
219
+      this.FetchCommunityList().then(() => {
220
+        this.listLoading = false
221
+      }).catch(() => {
222
+        this.loading = false
223
+        console.log('get list error')
224
+      })
225
+    }
226
+  }
227
+}
228
+</script>
229
+
230
+<style scoped>
231
+.app-container {
232
+  width: 50%;
233
+  margin: auto;
234
+}
235
+.dialog-footer {
236
+  text-align: center;
237
+}
238
+</style>
239
+

+ 55
- 309
VUECODE/smart-operate-manage/src/views/banner/index.vue View File

7
       <el-input v-model="listQuery.bannerDescription" placeholder="请输入跳转概述" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter"/>
7
       <el-input v-model="listQuery.bannerDescription" placeholder="请输入跳转概述" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter"/>
8
       <label>选择小区</label>
8
       <label>选择小区</label>
9
       <el-select v-model="listQuery.communityId" placeholder="选择小区" clearable style="width: 200px" class="filter-item">
9
       <el-select v-model="listQuery.communityId" placeholder="选择小区" clearable style="width: 200px" class="filter-item">
10
-        <el-option v-for="item in importanceOptions" :key="item" :value="item" label="item"/>
10
+        <el-option v-for="item in communityList" :key="item.id" :value="item.id" :label="item.communityName"/>
11
       </el-select>
11
       </el-select>
12
       <label>位置</label>
12
       <label>位置</label>
13
       <el-select v-model="listQuery.bannerPosition" placeholder="banner位置" clearable class="filter-item" style="width: 200px">
13
       <el-select v-model="listQuery.bannerPosition" placeholder="banner位置" clearable class="filter-item" style="width: 200px">
14
-        <el-option v-for="item in calendarTypeOptions" :key="item.key" :value="item.key" label="item.display_name+'('+item.key+')'"/>
14
+        <el-option v-for="item in bannerPositionArr" :key="item.id" :value="item.id" :label="item.value"/>
15
       </el-select>
15
       </el-select>
16
       <el-button v-waves class="filter-item" type="info" icon="el-icon-warning" @click="handleFilter">清空</el-button>
16
       <el-button v-waves class="filter-item" type="info" icon="el-icon-warning" @click="handleFilter">清空</el-button>
17
       <el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button>
17
       <el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-search" @click="handleSearch">搜索</el-button>
99
       layout="total, sizes, prev, pager, next, jumper"
99
       layout="total, sizes, prev, pager, next, jumper"
100
       @size-change="handleSizeChange"
100
       @size-change="handleSizeChange"
101
       @current-change="handleCurrentChange"/>
101
       @current-change="handleCurrentChange"/>
102
-
103
-    <el-dialog :visible.sync="dialogFormVisible" title="添加">
104
-      <el-form ref="addForm" :model="addForm" :rules="addFormRules">
105
-        <el-form-item :label-width="formLabelWidth" label="标题">
106
-          <el-input v-model="addForm.title"/>
107
-        </el-form-item>
108
-        <el-form-item :label-width="formLabelWidth" label="权重">
109
-          <el-input v-model="addForm.sort"/>
110
-        </el-form-item>
111
-        <el-form-item :label-width="formLabelWidth" label="banner图">
112
-          <el-input v-model="addForm.bannerCover"/>
113
-        </el-form-item>
114
-        <el-form-item :label-width="formLabelWidth" label="banner位">
115
-          <el-select v-model="addForm.bannerPosition" placeholder="请选择位置">
116
-            <el-option label="请选择位置" value="-1"/>
117
-            <el-option
118
-              v-for="item in bannerPositionArr"
119
-              :key="item.id"
120
-              :label="item.value"
121
-              :value="item.id"
122
-            />
123
-            <!-- <el-option v-for="item in bannerPositionArr" label="item.value" value="item.id"/> -->
124
-          </el-select>
125
-        </el-form-item>
126
-        <el-form-item :label-width="formLabelWidth" label="投放社区">
127
-          <el-select v-model="addForm.communityId" placeholder="请选择社区">
128
-            <el-option label="请选择社区" value="-1"/>
129
-            <el-option
130
-              v-for="item in communityArr"
131
-              :key="item.id"
132
-              :label="item.value"
133
-              :value="item.id"
134
-            />
135
-            <!-- <el-option label="区域一" value="shanghai"/> -->
136
-          </el-select>
137
-        </el-form-item>
138
-        <el-form-item :label-width="formLabelWidth" label="生效时间">
139
-          <el-date-picker
140
-            v-model="addForm.effTime"
141
-            type="datetime"
142
-            placeholder="选择日期时间"/>
143
-        </el-form-item>
144
-        <el-form-item :label-width="formLabelWidth" label="失效时间">
145
-          <el-date-picker
146
-            v-model="addForm.expTime"
147
-            type="datetime"
148
-            placeholder="选择日期时间"/>
149
-        </el-form-item>
150
-        <el-form-item :label-width="formLabelWidth" label="banner跳转">
151
-          <el-radio v-model="addForm.bannerType" label="1" @change="showContent">外部超链接</el-radio>
152
-          <el-radio v-model="addForm.bannerType" label="2" @change="showContent">自写文章</el-radio>
153
-        </el-form-item>
154
-        <el-form-item v-if="showURLVisible" :label-width="formLabelWidth" label="URL">
155
-          <el-input v-model="addForm.externalLink" placeholder="URL"/>
156
-        </el-form-item>
157
-        <div v-if="showContentVisible">
158
-          <el-form-item :label-width="formLabelWidth" label="内容标题">
159
-            <el-input v-model="addForm.bannerTitle" placeholder="内容标题"/>
160
-          </el-form-item>
161
-          <el-form-item :label-width="formLabelWidth" label="内容详情">
162
-            <el-input v-model="addForm.bannerContent" placeholder="内容详情"/>
163
-          </el-form-item>
164
-        </div>
165
-      </el-form>
166
-      <div slot="footer" class="dialog-footer">
167
-        <el-button @click="dialogForm('0')">取 消</el-button>
168
-        <el-button type="primary" @click="dialogForm('1')">确 定</el-button>
169
-      </div>
170
-    </el-dialog>
171
-
172
-    <el-dialog :visible.sync="dialogPvVisible" title="Reading statistics"/>
173
-
174
   </div>
102
   </div>
175
 </template>
103
 </template>
176
 
104
 
177
 <script>
105
 <script>
178
 // import { updateArticle, createBanner } from '@/api/banner' // getBanner
106
 // import { updateArticle, createBanner } from '@/api/banner' // getBanner
107
+import { mapState, mapActions } from 'vuex'
179
 import waves from '@/directive/waves' // Waves directive
108
 import waves from '@/directive/waves' // Waves directive
180
-import { isNotValue } from '@/utils/validate'
181
 import { parseTime } from '@/utils/index'
109
 import { parseTime } from '@/utils/index'
182
 import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
110
 import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
183
 const calendarTypeOptions = [
111
 const calendarTypeOptions = [
209
     }
137
     }
210
   },
138
   },
211
   data() {
139
   data() {
212
-    const isTitle = (rule, value, callback) => {
213
-      if (!isNotValue(value)) {
214
-        callback(new Error('标题不能为空!'))
215
-      } else {
216
-        callback()
217
-      }
218
-    }
219
-    const isBannerCover = (rule, value, callback) => {
220
-      if (!isNotValue(value)) {
221
-        callback(new Error('banner图片不能为空!'))
222
-      } else {
223
-        callback()
224
-      }
225
-    }
226
-    const isBannerPosition = (rule, value, callback) => {
227
-      if (!isNotValue(value)) {
228
-        callback(new Error('banner位不能为空!'))
229
-      } else {
230
-        callback()
231
-      }
232
-    }
233
-    const isCommunityId = (rule, value, callback) => {
234
-      if (!isNotValue(value)) {
235
-        callback(new Error('小区不能为空!'))
236
-      } else {
237
-        callback()
238
-      }
239
-    }
240
-    const isEffTime = (rule, value, callback) => {
241
-      if (!isNotValue(value)) {
242
-        callback(new Error('生效时间不能为空'))
243
-      } else {
244
-        callback()
245
-      }
246
-    }
247
-    const isExpTime = (rule, value, callback) => {
248
-      if (!isNotValue(value)) {
249
-        callback(new Error('失效时间不能为空!'))
250
-      } else {
251
-        callback()
252
-      }
253
-    }
254
-    const isBannerType = (rule, value, callback) => {
255
-      if (!isNotValue(value)) {
256
-        callback(new Error('banner类型不能为空!'))
257
-      } else {
258
-        callback()
259
-      }
260
-    }
261
     return {
140
     return {
262
       tableKey: 0,
141
       tableKey: 0,
263
       list: null,
142
       list: null,
268
         pageSize: 5,
147
         pageSize: 5,
269
         bannerTitle: undefined,
148
         bannerTitle: undefined,
270
         bannerPosition: undefined,
149
         bannerPosition: undefined,
271
-        bannerDescription: undefined
150
+        bannerDescription: undefined,
151
+        communityId: undefined
272
       },
152
       },
273
       importanceOptions: [1, 2, 3],
153
       importanceOptions: [1, 2, 3],
274
       calendarTypeOptions,
154
       calendarTypeOptions,
285
         bannerTitle: '',
165
         bannerTitle: '',
286
         bannerContent: ''
166
         bannerContent: ''
287
       },
167
       },
288
-      addFormRules: {
289
-        title: [{ required: true, trigger: 'blur', validator: isTitle }],
290
-        bannerCover: [{ required: true, trigger: 'blur', validator: isBannerCover }],
291
-        bannerPosition: [{ required: true, trigger: 'blur', validator: isBannerPosition }],
292
-        communityId: [{ required: true, trigger: 'blur', validator: isCommunityId }],
293
-        effTime: [{ required: true, trigger: 'blur', validator: isEffTime }],
294
-        expTime: [{ required: true, trigger: 'blur', validator: isExpTime }],
295
-        bannerType: [{ required: true, trigger: 'blur', validator: isBannerType }]
296
-      },
297
-      dialogFormVisible: false,
298
-      dialogStatus: '',
299
-      dialogPvVisible: false,
300
-      downloadLoading: false,
301
       formLabelWidth: '120px',
168
       formLabelWidth: '120px',
302
-      showContentVisible: false,
303
-      showURLVisible: true,
304
       bannerPositionArr: [
169
       bannerPositionArr: [
305
         { id: 1, value: '首页banner' },
170
         { id: 1, value: '首页banner' },
306
         { id: 2, value: '服务banner' }
171
         { id: 2, value: '服务banner' }
307
       ],
172
       ],
308
-      communityArr: [
309
-        { id: 3, value: '智慧社区' },
310
-        { id: 2, value: '测试社区' }
311
-      ]
312
     }
173
     }
313
   },
174
   },
175
+  computed: {
176
+    ...mapState('community', {
177
+      communityList: s => s.list
178
+    })
179
+  },
314
   created() {
180
   created() {
315
     this.getList()
181
     this.getList()
182
+    this.getCommuniryList()
316
   },
183
   },
317
   methods: {
184
   methods: {
185
+    ...mapActions('community', [
186
+      'FetchCommunityList',
187
+      'CreateCommunity',
188
+      'UpdateCommunity'
189
+    ]),
318
     deleteBanner(bannerId) {
190
     deleteBanner(bannerId) {
319
       this.$confirm('您确定删除此banner吗?', '提示', {
191
       this.$confirm('您确定删除此banner吗?', '提示', {
320
-          confirmButtonText: '确定',
321
-          cancelButtonText: '取消',
322
-          type: 'warning'
323
-        }).then(() => {
324
-          this.$store.dispatch('DeleteBanner', bannerId).then((res) => {
325
-            console.log('删除操作: ' + res.code)
326
-            if (res.code === '0') {
327
-              this.$notify({
328
-                title: '操作成功!',
329
-                message: res.message,
330
-                type: 'success'
331
-              })
332
-              this.getList()
333
-            } else {
334
-              this.$notify({
335
-                title: '操作失败',
336
-                message: res.message,
337
-                type: 'warning'
338
-              })
339
-            }
340
-          })
341
-        }).catch(() => {
342
-          this.$message({
343
-            type: 'info',
344
-            message: '已取消删除'
345
-          });          
346
-        });
347
-      
192
+        confirmButtonText: '确定',
193
+        cancelButtonText: '取消',
194
+        type: 'warning'
195
+      }).then(() => {
196
+        this.$store.dispatch('DeleteBanner', bannerId).then((res) => {
197
+          console.log('删除操作: ' + res.code)
198
+          if (res.code === '0') {
199
+            this.$notify({
200
+              title: '操作成功!',
201
+              message: res.message,
202
+              type: 'success'
203
+            })
204
+            this.getList()
205
+          } else {
206
+            this.$notify({
207
+              title: '操作失败',
208
+              message: res.message,
209
+              type: 'warning'
210
+            })
211
+          }
212
+        })
213
+      }).catch(() => {
214
+        this.$message({
215
+          type: 'info',
216
+          message: '已取消删除'
217
+        })
218
+      })
348
     },
219
     },
349
     dialogAddForm() {
220
     dialogAddForm() {
350
-      this.dialogFormVisible = true
351
-      this.addForm.title = ''
352
-      this.addForm.sort = '1',
353
-      this.addForm.bannerCover = ''
354
-      this.addForm.bannerPosition = '-1'
355
-      this.addForm.communityId = '-1'
356
-      this.addForm.effTime = ''
357
-      this.addForm.expTime = ''
358
-      this.addForm.bannerType = '1'
359
-      this.addForm.externalLink = ''
360
-      this.addForm.bannerTitle = ''
361
-      this.addForm.bannerContent = ''
362
-    },
363
-    dialogForm(isVaule) {
364
-      if (isVaule === '0') {
365
-        this.dialogFormVisible = false
366
-      } else {
367
-        // 进行提交数据,成功后关闭dialog
368
-        this.createData()
369
-        this.dialogFormVisible = false
370
-        console.log('添加banner的数据: ', this.addForm)
371
-      }
221
+      this.$router.push({ name: 'banner-add' })
372
     },
222
     },
373
     updateBanner(bannerId) {
223
     updateBanner(bannerId) {
374
-      this.getByBannerId(bannerId)
375
-      this.dialogPvVisible = true
376
-    },
377
-    getByBannerId(bannerId) {
378
-      this.$store.dispatch('GetByBannerId', bannerId).then(res => {
379
-        this.addForm = res
380
-      })
381
-    },
382
-    showContent() {
383
-      if (this.addForm.bannerType === '1') {
384
-        this.showContentVisible = false
385
-        this.showURLVisible = true
386
-      } else {
387
-        this.showContentVisible = true
388
-        this.showURLVisible = false
389
-      }
224
+      this.$router.push({ name: 'banner-edi', params: { id: bannerId }})
390
     },
225
     },
391
     handleSizeChange(val) {
226
     handleSizeChange(val) {
392
       // console.log(`每页 ${val} 条`);
227
       // console.log(`每页 ${val} 条`);
423
         }, 1.5 * 1000)
258
         }, 1.5 * 1000)
424
       })
259
       })
425
     },
260
     },
261
+    getCommuniryList() {
262
+      this.listLoading = true
263
+      this.FetchCommunityList().then(() => {
264
+        this.listLoading = false
265
+      }).catch(() => {
266
+        this.loading = false
267
+        console.log('get list error')
268
+      })
269
+    },
426
     handleFilter() {
270
     handleFilter() {
427
       this.listQuery.pageNum = 1
271
       this.listQuery.pageNum = 1
428
       this.listQuery.pageSize = 5
272
       this.listQuery.pageSize = 5
429
       this.listQuery.bannerTitle = undefined
273
       this.listQuery.bannerTitle = undefined
430
       this.listQuery.bannerPosition = undefined
274
       this.listQuery.bannerPosition = undefined
431
       this.listQuery.bannerDescription = undefined
275
       this.listQuery.bannerDescription = undefined
276
+      this.listQuery.communityId = undefined
432
       this.getList()
277
       this.getList()
433
     },
278
     },
434
     handleModifyStatus(row, status) {
279
     handleModifyStatus(row, status) {
444
         this.sortByID(order)
289
         this.sortByID(order)
445
       }
290
       }
446
     },
291
     },
447
-    resetTemp() {
448
-      this.temp = {
449
-        id: undefined,
450
-        importance: 1,
451
-        remark: '',
452
-        timestamp: new Date(),
453
-        title: '',
454
-        status: 'published',
455
-        type: ''
456
-      }
457
-    },
458
     handleSearch() {
292
     handleSearch() {
459
       this.getList()
293
       this.getList()
460
-    },
461
-    createData() {
462
-      this.$refs['addForm'].validate((valid) => {
463
-        if (valid) {
464
-          this.$store.dispatch('AddBanner', this.addForm).then((res) => {
465
-            if (res.code === '0') {
466
-              this.$notify({
467
-                title: '操作成功!',
468
-                message: res.message,
469
-                type: 'success'
470
-              })
471
-              this.getList()
472
-            } else {
473
-              this.$notify({
474
-                title: '操作失败',
475
-                message: res.message,
476
-                type: 'warning'
477
-              })
478
-            }
479
-          })
480
-        }
481
-      })
482
-    },
483
-    handleUpdate(row) {
484
-      this.temp = Object.assign({}, row) // copy obj
485
-      this.temp.timestamp = new Date(this.temp.timestamp)
486
-      this.dialogStatus = 'update'
487
-      this.dialogFormVisible = true
488
-      this.$nextTick(() => {
489
-        this.$refs['dataForm'].clearValidate()
490
-      })
491
-    },
492
-    updateData() {
493
-      this.$refs['dataForm'].validate((valid) => {
494
-        if (valid) {
495
-          const tempData = Object.assign({}, this.temp)
496
-          tempData.timestamp = +new Date(tempData.timestamp) // change Thu Nov 30 2017 16:41:05 GMT+0800 (CST) to 1512031311464
497
-          // updateArticle(tempData).then(() => {
498
-          //   for (const v of this.list) {
499
-          //     if (v.id === this.temp.id) {
500
-          //       const index = this.list.indexOf(v)
501
-          //       this.list.splice(index, 1, this.temp)
502
-          //       break
503
-          //     }
504
-          //   }
505
-          //   this.dialogFormVisible = false
506
-          //   this.$notify({
507
-          //     title: '成功',
508
-          //     message: '更新成功',
509
-          //     type: 'success',
510
-          //     duration: 2000
511
-          //   })
512
-          // })
513
-        }
514
-      })
515
-    },
516
-    handleDelete(row) {
517
-      this.$notify({
518
-        title: '成功',
519
-        message: '删除成功',
520
-        type: 'success',
521
-        duration: 2000
522
-      })
523
-      const index = this.list.indexOf(row)
524
-      this.list.splice(index, 1)
525
-    },
526
-    handleDownload() {
527
-      this.downloadLoading = true
528
-      import('@/vendor/Export2Excel').then(excel => {
529
-        const tHeader = ['timestamp', 'title', 'type', 'importance', 'status']
530
-        const filterVal = ['timestamp', 'title', 'type', 'importance', 'status']
531
-        const data = this.formatJson(filterVal, this.list)
532
-        excel.export_json_to_excel({
533
-          header: tHeader,
534
-          data,
535
-          filename: 'table-list'
536
-        })
537
-        this.downloadLoading = false
538
-      })
539
-    },
540
-    formatJson(filterVal, jsonData) {
541
-      return jsonData.map(v => filterVal.map(j => {
542
-        if (j === 'timestamp') {
543
-          return parseTime(v[j])
544
-        } else {
545
-          return v[j]
546
-        }
547
-      }))
548
     }
294
     }
549
   }
295
   }
550
 }
296
 }