Kaynağa Gözat

Merge branch 'develop' of http://git.ycjcjy.com/fuxingfan/smartCommunity into develop

傅行帆 6 yıl önce
ebeveyn
işleme
a4fa9d2a7e
25 değiştirilmiş dosya ile 1043 ekleme ve 77 silme
  1. 13
    22
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/ImageController.java
  2. 10
    10
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java
  3. 59
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TaFaceController.java
  4. 6
    7
      CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TicketController.java
  5. 26
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaFaceMapper.java
  6. 19
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TdImagesMapper.java
  7. 0
    7
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTicketMapper.java
  8. 1
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTransactionMapper.java
  9. 50
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaFace.java
  10. 65
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TdImages.java
  11. 15
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ImageServiceI.java
  12. 5
    3
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java
  13. 21
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/TaFaceServicel.java
  14. 43
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/ImageServiceimpl.java
  15. 50
    13
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java
  16. 169
    0
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaFaceServicelimpl.java
  17. 1
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaVistorServiceImpl.java
  18. 4
    1
      CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TicketServiceImpl.java
  19. 120
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TaFaceMapper.xml
  20. 106
    0
      CODE/smart-community/app-api/src/main/resources/mapper/TdImagesMapper.xml
  21. 0
    11
      CODE/smart-community/app-api/src/main/resources/mapper/TpTicketMapper.xml
  22. 1
    1
      CODE/smart-community/app-api/src/main/resources/mapper/TpTransactionMapper.xml
  23. 213
    0
      CODE/smart-community/community-common/src/main/java/com/community/commom/ailiyun/AESDecode.java
  24. BIN
      CODE/smart-community/community-common/target/classes/com/community/commom/ailiyun/AESDecode.class
  25. 46
    0
      CODE/smart-community/zuul/src/main/java/com/community/huiju/filter/DomainZuulPreFilter.java

+ 13
- 22
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/ImageController.java Dosyayı Görüntüle

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

+ 10
- 10
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/SocialController.java Dosyayı Görüntüle

@@ -8,15 +8,14 @@ import com.community.huiju.model.TpAnnouncement;
8 8
 import com.community.huiju.model.TpTicket;
9 9
 import com.community.huiju.model.TpTransaction;
10 10
 import com.community.huiju.service.SocialServiceI;
11
-import io.swagger.annotations.Api;
12
-import io.swagger.annotations.ApiImplicitParam;
13
-import io.swagger.annotations.ApiImplicitParams;
14
-import io.swagger.annotations.ApiOperation;
11
+import io.swagger.annotations.*;
15 12
 import org.springframework.beans.factory.annotation.Autowired;
16 13
 import org.springframework.cloud.context.config.annotation.RefreshScope;
17 14
 import org.springframework.web.bind.annotation.*;
15
+import org.springframework.web.multipart.MultipartFile;
18 16
 
19 17
 import javax.servlet.http.HttpSession;
18
+import java.io.IOException;
20 19
 import java.util.List;
21 20
 
22 21
 /**
@@ -160,16 +159,16 @@ public class SocialController {
160 159
     @ApiOperation(value = "添加二手租赁帖子", notes = "添加二手租赁帖子")
161 160
     @ApiImplicitParams({
162 161
             @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
163
-                    "title:小区标题,content:小区类容, type"),
162
+                    "title:小区标题,content:小区内容, type:0二手,1求购,2租赁"),
164 163
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
165 164
     })
166
-    @RequestMapping(value = "/addTransaction", method = RequestMethod.POST)
165
+    @PostMapping(value = "/addTransaction", consumes = "multipart/*", headers = "content-type=multipart/form-data")
167 166
     @ResponseBody
168
-    public ResponseBean addTransaction(@RequestBody String paramets, HttpSession session) {
167
+    public ResponseBean addTransaction(@RequestBody String paramets, @ApiParam(value = "file" ,required = true) MultipartFile uploadFile, HttpSession session) throws IOException {
169 168
         ResponseBean responseBean = new ResponseBean();
170 169
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
171 170
         Integer userId = userElement.getId();
172
-        ResponseBean response = socialServiceI.addAllTransaction(userId, paramets);
171
+        ResponseBean response = socialServiceI.addAllTransaction(userId, paramets, uploadFile);
173 172
         return response;
174 173
     }
175 174
 
@@ -182,19 +181,20 @@ public class SocialController {
182 181
     })
183 182
     @RequestMapping(value = "/selectAllTransaction", method = RequestMethod.GET)
184 183
     public ResponseBean selectAllTransaction(HttpSession session,
184
+                                             @RequestParam("type") Integer type,
185 185
                                              @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
186 186
                                              @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
187 187
         ResponseBean responseBean = new ResponseBean();
188 188
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
189 189
         Integer userId = userElement.getId();
190
-        ResponseBean response = socialServiceI.selectAllTransaction(userId, pageNum, pageSize);
190
+        ResponseBean response = socialServiceI.selectAllTransaction(userId, pageNum, pageSize,type);
191 191
         return response;
192 192
     }
193 193
 
194 194
     @ApiOperation(value = "修改二手租赁帖子", notes = "修改二手租赁帖子")
195 195
     @ApiImplicitParams({
196 196
             @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
197
-                    "id:小区id,title:小区标题,content:小区容"),
197
+                    "id:小区id,title:小区标题,content:小区容"),
198 198
             @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
199 199
     })
200 200
     @RequestMapping(value = "/updateTransaction/{Id}", method = RequestMethod.PUT)

+ 59
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TaFaceController.java Dosyayı Görüntüle

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

+ 6
- 7
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/TicketController.java Dosyayı Görüntüle

@@ -124,18 +124,17 @@ public class TicketController {
124 124
 
125 125
     @ApiOperation(value = "添加报修", notes = "添加报修")
126 126
     @ApiImplicitParams({
127
-            @ApiImplicitParam(paramType = "query",dataType = "String",name = "ticketContent",value = "工单内容"),
128
-            @ApiImplicitParam(paramType = "query",dataType = "String",name = "ticketTitle",value = "工单标题"),
129
-            @ApiImplicitParam(paramType = "query",dataType = "String",name = "repairType",value = "报修房屋类型"),
130
-            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token"),
127
+            @ApiImplicitParam(paramType = "body", dataType = "String", name = "paramets", value =
128
+                    "ticketTitle:工单内容,ticketContent:小区标题,repairType:0:公共区域  1: 房屋质量  2:户内设施 "),
129
+            @ApiImplicitParam(paramType = "header",dataType = "String",name = "X-Auth-Token",value = "Token")
131 130
     })
132
-    @RequestMapping(value = "/addAlltpTicket", method = RequestMethod.POST)
131
+    @RequestMapping(value = "/addtpTicket", method = RequestMethod.POST)
133 132
     @ResponseBody
134
-    public ResponseBean addTransaction(@RequestBody String parameter, HttpSession session) {
133
+    public ResponseBean addTransaction(@RequestBody String paramets, HttpSession session) {
135 134
         ResponseBean responseBean = new ResponseBean();
136 135
         UserElement userElement = (UserElement) session.getAttribute(Constant.APP_USER_SESSION);
137 136
         Integer userId = userElement.getId();
138
-        ResponseBean response = iTicketService.addAiTicketService(userId, parameter);
137
+        ResponseBean response = iTicketService.addAiTicketService(userId, paramets);
139 138
         return response;
140 139
     }
141 140
 

+ 26
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TaFaceMapper.java Dosyayı Görüntüle

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

+ 19
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TdImagesMapper.java Dosyayı Görüntüle

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

+ 0
- 7
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTicketMapper.java Dosyayı Görüntüle

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

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpTransactionMapper.java Dosyayı Görüntüle

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

+ 50
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TaFace.java Dosyayı Görüntüle

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

+ 65
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TdImages.java Dosyayı Görüntüle

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

+ 15
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/ImageServiceI.java Dosyayı Görüntüle

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

+ 5
- 3
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/SocialServiceI.java Dosyayı Görüntüle

@@ -2,7 +2,9 @@ package com.community.huiju.service;
2 2
 
3 3
 import com.community.commom.mode.ResponseBean;
4 4
 import com.community.huiju.model.*;
5
+import org.springframework.web.multipart.MultipartFile;
5 6
 
7
+import java.io.IOException;
6 8
 import java.util.List;
7 9
 
8 10
 /**
@@ -69,14 +71,14 @@ public interface SocialServiceI {
69 71
 	/**
70 72
 	 * 添加二手租赁帖子
71 73
 	 */
72
-    ResponseBean addAllTransaction(Integer userId, String paramets);
74
+    ResponseBean addAllTransaction(Integer userId, String paramets, MultipartFile uploadFile) throws IOException;
73 75
 
74 76
 	/**
75
-	 * 获取当前用户所有的帖子
77
+	 * 获取当前用户发布所有的帖子
76 78
 	 * @param userId
77 79
 	 * @return
78 80
 	 */
79
-	ResponseBean selectAllTransaction(Integer userId,Integer pageNum,Integer pageSize);
81
+	ResponseBean selectAllTransaction(Integer userId,Integer pageNum,Integer pageSize,Integer type);
80 82
 
81 83
 	/**
82 84
 	 * 修改当前帖子

+ 21
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/TaFaceServicel.java Dosyayı Görüntüle

@@ -0,0 +1,21 @@
1
+package com.community.huiju.service;
2
+
3
+
4
+import com.community.commom.mode.ResponseBean;
5
+import org.springframework.web.multipart.MultipartFile;
6
+
7
+public interface TaFaceServicel {
8
+    /**
9
+     * 添加人脸
10
+     * @param userId
11
+     * @return
12
+     */
13
+    ResponseBean addFace(Integer userId ,MultipartFile uploadFile);
14
+
15
+    /**
16
+     * 更新当前人脸
17
+     * @param userId
18
+     * @return
19
+     */
20
+    ResponseBean upDateFace(Integer userId , MultipartFile uploadFile);
21
+}

+ 43
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/ImageServiceimpl.java Dosyayı Görüntüle

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

+ 50
- 13
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/SocialServiceImpl.java Dosyayı Görüntüle

@@ -5,14 +5,15 @@ import com.community.commom.constant.Constant;
5 5
 import com.community.commom.mode.ResponseBean;
6 6
 import com.community.huiju.dao.*;
7 7
 import com.community.huiju.model.*;
8
+import com.community.huiju.service.ImageServiceI;
8 9
 import com.community.huiju.service.SocialServiceI;
9 10
 import com.github.pagehelper.PageHelper;
10
-import com.netflix.discovery.converters.Auto;
11 11
 import org.springframework.beans.factory.annotation.Autowired;
12 12
 import org.springframework.stereotype.Service;
13 13
 import org.springframework.transaction.annotation.Transactional;
14
+import org.springframework.web.multipart.MultipartFile;
14 15
 
15
-import java.text.SimpleDateFormat;
16
+import java.io.IOException;
16 17
 import java.util.Date;
17 18
 import java.util.List;
18 19
 
@@ -57,6 +58,12 @@ public class SocialServiceImpl implements SocialServiceI {
57 58
     @Autowired
58 59
     private TpTicketMapper tpTicketMapper;
59 60
 
61
+    @Autowired
62
+    private TdImagesMapper tdImagesMapper;
63
+
64
+    @Autowired
65
+    private ImageServiceI imageServiceI;
66
+
60 67
     @Override
61 68
     @Transactional
62 69
     public TpAnnouncement findAnnouncementDetail(Integer id, Integer communityId, Integer userId) {
@@ -221,7 +228,7 @@ public class SocialServiceImpl implements SocialServiceI {
221 228
 
222 229
     @Transactional
223 230
     @Override
224
-    public ResponseBean addAllTransaction(Integer userId, String paramets) {
231
+    public ResponseBean addAllTransaction(Integer userId, String paramets, MultipartFile uploadFile) throws IOException {
225 232
 
226 233
         ResponseBean response = new ResponseBean();
227 234
 
@@ -231,7 +238,7 @@ public class SocialServiceImpl implements SocialServiceI {
231 238
         String  type= (String) jsonObject.get("type");
232 239
 
233 240
         TaUser user=taUserMapper.selectByPrimaryKey(userId);
234
-        TpTransaction tpTransaction=new TpTransaction();
241
+        TpTransaction tpTransaction = new TpTransaction();
235 242
         tpTransaction.setTransactionTitle(transactionTitle);
236 243
         tpTransaction.setTransactionContent(transactionContent);
237 244
         tpTransaction.setType(type);
@@ -261,29 +268,59 @@ public class SocialServiceImpl implements SocialServiceI {
261 268
             return response;
262 269
         }
263 270
 
264
-        if (Constant.EFFECTIVE.equals(taUser.getStatus())
265
-                && (Constant.RELATION.equals(sysRole.getRoleName()))
266
-                || Constant.TENANT.equals(sysRole.getRoleName())
267
-                || Constant.OWNER.equals(sysRole.getRoleName())){
271
+        if (Constant.EFFECTIVE.equals(taUser.getStatus()) && (Constant.RELATION.equals(sysRole.getRoleName()) || Constant.TENANT.equals(sysRole.getRoleName()) || Constant.OWNER.equals(sysRole.getRoleName()))){
268 272
             tpTransactionMapper.insertSelective(tpTransaction);
273
+            insertTdImage(tpTransaction, uploadFile, type, userId);
274
+
269 275
             TpTransaction tpTransaction1=tpTransactionMapper.getById(tpTransaction.getId());
270 276
             response.addSuccess(tpTransaction1);
277
+            return response;
271 278
         }
272 279
         response.addError("9995", "无法确认您的身份,请联系物业");
273 280
         return response;
274
-
275 281
     }
276 282
 
283
+    private void insertTdImage(TpTransaction tpTransaction, MultipartFile uploadFile, String type, Integer userId) throws IOException {
284
+        TdImages tdImages = new TdImages();
285
+        Integer uuId = tpTransaction.getId();
286
+        String imageUrl = imageServiceI.getImageUrl(uploadFile);
287
+        tdImages.setImageUrl(imageUrl);
288
+        tdImages.setType(type);
289
+        tdImages.setUuid(uuId);
290
+        tdImages.setCreateUser(userId);
291
+        tdImages.setCreateTime(new Date());
292
+        tdImagesMapper.insertSelective(tdImages);
293
+    }
277 294
     @Override
278
-    public ResponseBean selectAllTransaction(Integer userId,Integer pageNum,Integer paeSize) {
295
+    public ResponseBean selectAllTransaction(Integer userId,Integer pageNum,Integer paeSize,Integer type) {
279 296
         ResponseBean responseBean = new ResponseBean();
280 297
         TaUser user=taUserMapper.selectByPrimaryKey(userId);
281 298
          Integer communityId=user.getCommunityId();
282 299
 
283
-        PageHelper.startPage(pageNum, paeSize);
284
-        List<TpTransaction> tpTransactions=tpTransactionMapper.selectTransaction(userId,communityId);
300
+        //判断身份是否为业主且状态为已停用
301
+        TaSysRole sysRole = taSysRoleMapper.findRoleByUserId(userId);
302
+        TaUser taUser = taUserMapper.selectByPrimaryKey(userId);
303
+        if (Constant.INVALID.equals(taUser.getStatus())
304
+                && Constant.OWNER.equals(sysRole.getRoleName())){
285 305
 
286
-        responseBean.addSuccess(tpTransactions);
306
+            responseBean.addError("9996", "您的身份已停用,请联系物业");
307
+            return responseBean;
308
+        }
309
+
310
+        //身份为家属租客,状态为已停用
311
+        if (Constant.INVALID.equals(taUser.getStatus())
312
+                && (Constant.RELATION.equals(sysRole.getRoleName())) || Constant.TENANT.equals(sysRole.getRoleName())){
313
+
314
+            responseBean.addError("9996", "您的身份已停用,请联系物业");
315
+            return responseBean;
316
+        }
317
+
318
+        if (Constant.EFFECTIVE.equals(taUser.getStatus()) && (Constant.RELATION.equals(sysRole.getRoleName()) || Constant.TENANT.equals(sysRole.getRoleName()) || Constant.OWNER.equals(sysRole.getRoleName()))){
319
+            PageHelper.startPage(pageNum, paeSize);
320
+            List<TpTransaction> tpTransactions=tpTransactionMapper.selectTransaction(userId,communityId,type);
321
+            responseBean.addSuccess(tpTransactions);
322
+        }
323
+        responseBean.addError("9995", "无法确认您的身份,请联系物业");
287 324
         return responseBean;
288 325
     }
289 326
 

+ 169
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaFaceServicelimpl.java Dosyayı Görüntüle

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

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TaVistorServiceImpl.java Dosyayı Görüntüle

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

+ 4
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/TicketServiceImpl.java Dosyayı Görüntüle

@@ -183,7 +183,9 @@ public class TicketServiceImpl implements ITicketService {
183 183
         String ticketContent = (String) jsonObject.get("ticketContent");
184 184
         String ticketTitle = (String) jsonObject.get("ticketTitle");
185 185
         String repairType = (String) jsonObject.get("repairType");
186
+
186 187
         TaUser user = taUserMapper.selectByPrimaryKey(userId);
188
+
187 189
         TpTicket tpTicket=new TpTicket();
188 190
         tpTicket.setCommunityId(user.getCommunityId());
189 191
         tpTicket.setTaUserId(userId);
@@ -195,6 +197,7 @@ public class TicketServiceImpl implements ITicketService {
195 197
         tpTicket.setCreateDate(new Date());
196 198
         tpTicket.setUpdateUser(userId);
197 199
         tpTicket.setUpdateDate(new Date());
200
+
198 201
         tpTicketMapper.insertSelective(tpTicket);
199 202
         Integer id=tpTicket.getId();
200 203
         TpTicketRecord tpTicketRecord = new TpTicketRecord();
@@ -207,7 +210,7 @@ public class TicketServiceImpl implements ITicketService {
207 210
         tpTicketRecord.setCreateDate(new Date());
208 211
 
209 212
         tpTicketRecordMapper.insertSelective(tpTicketRecord);
210
-        response.addSuccess("新增成功");
213
+        response.addSuccess(tpTicketReco);
211 214
         return response;
212 215
     }
213 216
     /**

+ 120
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TaFaceMapper.xml Dosyayı Görüntüle

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

+ 106
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TdImagesMapper.xml Dosyayı Görüntüle

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

+ 0
- 11
CODE/smart-community/app-api/src/main/resources/mapper/TpTicketMapper.xml Dosyayı Görüntüle

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

+ 1
- 1
CODE/smart-community/app-api/src/main/resources/mapper/TpTransactionMapper.xml Dosyayı Görüntüle

@@ -186,7 +186,7 @@
186 186
     select
187 187
     <include refid="Base_Column_List" />
188 188
     from tp_transaction
189
-    where community_id = #{communityId,jdbcType=INTEGER} and ta_user_id = #{userId,jdbcType=INTEGER}
189
+    where community_id = #{communityId,jdbcType=INTEGER} and ta_user_id = #{userId,jdbcType=INTEGER} and type = #{type,jdbcType=INTEGER}
190 190
   </select>
191 191
 
192 192
   <update id="updateTransaction" parameterType="com.community.huiju.model.TpTransaction" >

+ 213
- 0
CODE/smart-community/community-common/src/main/java/com/community/commom/ailiyun/AESDecode.java Dosyayı Görüntüle

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

BIN
CODE/smart-community/community-common/target/classes/com/community/commom/ailiyun/AESDecode.class Dosyayı Görüntüle


+ 46
- 0
CODE/smart-community/zuul/src/main/java/com/community/huiju/filter/DomainZuulPreFilter.java Dosyayı Görüntüle

@@ -0,0 +1,46 @@
1
+package com.community.huiju.filter;
2
+
3
+import com.netflix.zuul.ZuulFilter;
4
+import com.netflix.zuul.context.RequestContext;
5
+import com.netflix.zuul.exception.ZuulException;
6
+import org.springframework.http.MediaType;
7
+import org.springframework.stereotype.Component;
8
+
9
+import javax.servlet.http.HttpServletResponse;
10
+
11
+/**
12
+ * 跨域
13
+ * @author weiximei
14
+ */
15
+@Component
16
+public class DomainZuulPreFilter extends ZuulFilter {
17
+
18
+    @Override
19
+    public String filterType() {
20
+        return "post";
21
+    }
22
+
23
+    @Override
24
+    public int filterOrder() {
25
+        return 0;
26
+    }
27
+
28
+    @Override
29
+    public boolean shouldFilter() {
30
+        return true;
31
+    }
32
+
33
+    @Override
34
+    public Object run() throws ZuulException {
35
+
36
+        RequestContext ctx = RequestContext.getCurrentContext();
37
+        HttpServletResponse response = ctx.getResponse();
38
+        response.setHeader("Access-Control-Allow-Origin", "*");
39
+        response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, HEADER");
40
+        response.setHeader("Access-Control-Max-Age", "3600");
41
+        response.setHeader("Access-Control-Allow-Headers", "X-Requested-With, user-token, Content-Type, Accept, version, type, platform");
42
+        response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
43
+
44
+        return null;
45
+    }
46
+}