Selaa lähdekoodia

海康推送完成

魏熙美 6 vuotta sitten
vanhempi
commit
530d58f765

+ 2
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/controller/HkController.java Näytä tiedosto

@@ -43,8 +43,8 @@ public class HkController {
43 43
 		return hkResponseBean;
44 44
 	}
45 45
 
46
-	@RequestMapping(value = "推送HK人员", method = RequestMethod.POST)
47
-	public ResponseBean pushHKPerson(@RequestParam("appUserId") String appUserId) {
46
+	@RequestMapping(value = "/pushHKPerson/{appUserId}", method = RequestMethod.POST)
47
+	public ResponseBean pushHKPerson(@PathVariable("appUserId") String appUserId) {
48 48
 		ResponseBean responseBean = new ResponseBean();
49 49
 		responseBean = ihkService.pushPerson(appUserId);
50 50
 		return responseBean;

+ 0
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/HKServiceImpl.java Näytä tiedosto

@@ -70,7 +70,6 @@ public class HKServiceImpl implements IHKService {
70 70
             return responseBean;
71 71
         }
72 72
         responseBean.addError("操作失败!");
73
-        responseBean.addError("操作失败!");
74 73
         return responseBean;
75 74
     }
76 75
 

+ 9
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/feign/TaUserFeignService.java Näytä tiedosto

@@ -3,6 +3,7 @@ package com.community.huiju.feign;
3 3
 import com.community.commom.mode.ResponseBean;
4 4
 import com.community.huiju.feign.impl.TaUserFeignFallBack;
5 5
 import org.springframework.cloud.openfeign.FeignClient;
6
+import org.springframework.web.bind.annotation.PathVariable;
6 7
 import org.springframework.web.bind.annotation.RequestBody;
7 8
 import org.springframework.web.bind.annotation.RequestMapping;
8 9
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -21,4 +22,12 @@ public interface TaUserFeignService {
21 22
     @RequestMapping(value = "/user/register",method = RequestMethod.POST)
22 23
     ResponseBean register(@RequestBody String parameter);
23 24
 
25
+    /**
26
+     * 推送海康人员添加
27
+     * @param appUserId
28
+     * @return
29
+     */
30
+    @RequestMapping(value = "/pushHKPerson/{appUserId}", method = RequestMethod.POST)
31
+    ResponseBean pushHKPerson(@PathVariable("appUserId") Integer appUserId);
32
+
24 33
 }

+ 9
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/feign/impl/TaUserFeignFallBack.java Näytä tiedosto

@@ -9,6 +9,15 @@ public class TaUserFeignFallBack implements TaUserFeignService {
9 9
 
10 10
     @Override
11 11
     public ResponseBean register(String parameter) {
12
+        return back();
13
+    }
14
+
15
+    @Override
16
+    public ResponseBean pushHKPerson(Integer appUserId) {
17
+        return back();
18
+    }
19
+
20
+    private ResponseBean back() {
12 21
         log.error("app-api 远端服务请求失败!");
13 22
         ResponseBean responseBean = new ResponseBean();
14 23
         responseBean.addError("app-api 远端服务请求失败!");

+ 8
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BuildingOwnerInfoServiceImpl.java Näytä tiedosto

@@ -107,6 +107,9 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
107 107
     @Autowired
108 108
     @Qualifier("phoneCodeImpl")
109 109
     private ICode iCode;
110
+
111
+    @Autowired
112
+    private TaUserFeignService taUserFeignService;
110 113
     
111 114
     public static final Logger logger = LoggerFactory.getLogger(BuildingOwnerInfoServiceImpl.class);
112 115
     
@@ -184,6 +187,11 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
184 187
             insertTpBuildingOwnerInfo(userVerify.getPhaseId(), userVerify.getBuildingId(), userVerify.getUnitId(),
185 188
                     userVerify.getLevelId(), userVerify.getRoomNoId(), userElement.getCommunityId(), userElement.getId(),
186 189
                     userVerify.getGender(), user.getUserName(), user.getLoginName());
190
+            // 推送海康
191
+            ResponseBean pushHKPerson = taUserFeignService.pushHKPerson(userVerify.getUserId());
192
+            if (!"0".equals(pushHKPerson.getCode())) {
193
+                throw new WisdomException("设备推送失败!");
194
+            }
187 195
         }
188 196
 
189 197
 

+ 10
- 0
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/TaUserVerifyServiceImpl.java Näytä tiedosto

@@ -8,6 +8,8 @@ import com.community.commom.constant.Constant;
8 8
 import com.community.commom.mode.ResponseBean;
9 9
 import com.community.commom.session.UserElement;
10 10
 import com.community.huiju.dao.*;
11
+import com.community.huiju.exception.WisdomException;
12
+import com.community.huiju.feign.TaUserFeignService;
11 13
 import com.community.huiju.model.*;
12 14
 import com.community.huiju.service.ITaUserVerifyService;
13 15
 import org.apache.commons.lang.StringUtils;
@@ -54,6 +56,9 @@ public class TaUserVerifyServiceImpl extends ServiceImpl<TaUserVerifyMapper, TaU
54 56
     @Autowired
55 57
     private TpRoomNoMapper tpRoomNoMapper;
56 58
 
59
+    @Autowired
60
+    private TaUserFeignService taUserFeignService;
61
+
57 62
     @Override
58 63
     public ResponseBean selectAll(String phone, String userName, String idCard, Integer pageNum, Integer pageSize) {
59 64
         ResponseBean responseBean = new ResponseBean();
@@ -173,6 +178,11 @@ public class TaUserVerifyServiceImpl extends ServiceImpl<TaUserVerifyMapper, TaU
173 178
                 // 添加楼栋数据
174 179
                 insertBuildingOwnerInfo(userVerify, user);
175 180
             }
181
+            // 推送海康
182
+            ResponseBean pushHKPerson = taUserFeignService.pushHKPerson(userVerify.getUserId());
183
+            if (!"0".equals(pushHKPerson.getCode())) {
184
+                throw new WisdomException("设备推送失败!");
185
+            }
176 186
         }
177 187
         taUserVerifyMapper.updateById(userVerify);
178 188