|
|
@@ -8,6 +8,7 @@ import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.web.controller.chenyanlogin.ChengYanAesUtil;
|
|
|
import com.ruoyi.web.controller.chenyanlogin.dto.*;
|
|
|
import com.ruoyi.web.controller.chenyanlogin.dto.HouseVillagerRelation;
|
|
|
@@ -83,9 +84,13 @@ public class HuiCunServiceImpl implements HuiCunService {
|
|
|
requestParam.put("timestamp", System.currentTimeMillis());
|
|
|
Map<String, Object> responseData = getMap(requestParam, BASIC_DATA);
|
|
|
if (responseData.get("code").equals(200)) {
|
|
|
- JSONObject dataStr = (JSONObject) responseData.get("data");
|
|
|
- BasicDataDto basicDataDto = JSONUtil.toBean(dataStr, BasicDataDto.class);
|
|
|
- return success(basicDataDto);
|
|
|
+ Object data = responseData.get("data");
|
|
|
+ if ( data instanceof JSONObject) {
|
|
|
+ JSONObject dataStr = (JSONObject) responseData.get("data");
|
|
|
+ BasicDataDto basicDataDto = JSONUtil.toBean(dataStr, BasicDataDto.class);
|
|
|
+ return success(basicDataDto);
|
|
|
+ }
|
|
|
+ return success(null);
|
|
|
} else {
|
|
|
return error("同步失败" + responseData.get("message"));
|
|
|
}
|
|
|
@@ -99,10 +104,21 @@ public class HuiCunServiceImpl implements HuiCunService {
|
|
|
requestParam.put("nonce", UUID.randomUUID().toString());
|
|
|
requestParam.put("timestamp", System.currentTimeMillis());
|
|
|
Map<String, Object> responseData = getMap(requestParam, CARE_PEOPLE_DATA);
|
|
|
- if (responseData.get("code").equals(200)) {
|
|
|
- JSONObject dataStr = (JSONObject) responseData.get("data");
|
|
|
- CarePeopleData carePeopleData = JSONUtil.toBean(dataStr, CarePeopleData.class);
|
|
|
- return success(carePeopleData);
|
|
|
+ System.out.println(responseData);
|
|
|
+
|
|
|
+
|
|
|
+// String data = (String)responseData.get("data");
|
|
|
+ Object data = responseData.get("data");
|
|
|
+ if (responseData.get("code").equals(200) ) {
|
|
|
+ if ( data instanceof JSONObject){
|
|
|
+ JSONObject dataStr = (JSONObject) responseData.get("data");
|
|
|
+ CarePeopleData carePeopleData = JSONUtil.toBean(dataStr, CarePeopleData.class);
|
|
|
+ return success(carePeopleData);
|
|
|
+ }else {
|
|
|
+ return success(null);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
} else {
|
|
|
return error("同步失败" + responseData.get("message"));
|
|
|
}
|
|
|
@@ -116,9 +132,13 @@ public class HuiCunServiceImpl implements HuiCunService {
|
|
|
requestParam.put("timestamp", System.currentTimeMillis());
|
|
|
Map<String, Object> responseData = getMap(requestParam, SNAPSHOT_REPORT_DATA);
|
|
|
if (responseData.get("code").equals(200)) {
|
|
|
- JSONObject dataStr = (JSONObject) responseData.get("data");
|
|
|
- SnapshotReportDto snapshotReportDto = JSONUtil.toBean(dataStr, SnapshotReportDto.class);
|
|
|
- return success(snapshotReportDto);
|
|
|
+ Object data = responseData.get("data");
|
|
|
+ if ( data instanceof JSONObject) {
|
|
|
+ JSONObject dataStr = (JSONObject) responseData.get("data");
|
|
|
+ SnapshotReportDto snapshotReportDto = JSONUtil.toBean(dataStr, SnapshotReportDto.class);
|
|
|
+ return success(snapshotReportDto);
|
|
|
+ }
|
|
|
+ return success(null);
|
|
|
} else {
|
|
|
return error("同步失败" + responseData.get("message"));
|
|
|
}
|
|
|
@@ -133,9 +153,13 @@ public class HuiCunServiceImpl implements HuiCunService {
|
|
|
requestParam.put("timestamp", System.currentTimeMillis());
|
|
|
Map<String, Object> responseData = getMap(requestParam, ZHWL_DEVICE_DATA);
|
|
|
if (responseData.get("code").equals(200)) {
|
|
|
- JSONObject dataStr = (JSONObject) responseData.get("data");
|
|
|
- ZhwlDeviceDataDto snapshotReportDto = JSONUtil.toBean(dataStr, ZhwlDeviceDataDto.class);
|
|
|
- return success(snapshotReportDto);
|
|
|
+ Object data = responseData.get("data");
|
|
|
+ if ( data instanceof JSONObject) {
|
|
|
+ JSONObject dataStr = (JSONObject) responseData.get("data");
|
|
|
+ ZhwlDeviceDataDto snapshotReportDto = JSONUtil.toBean(dataStr, ZhwlDeviceDataDto.class);
|
|
|
+ return success(snapshotReportDto);
|
|
|
+ }
|
|
|
+ return success(null);
|
|
|
} else {
|
|
|
return error("同步失败" + responseData.get("message"));
|
|
|
}
|
|
|
@@ -173,8 +197,12 @@ public class HuiCunServiceImpl implements HuiCunService {
|
|
|
requestParam.put("timestamp", System.currentTimeMillis());
|
|
|
Map<String, Object> responseData = getMap(requestParam, POINT_RANK_DATA);
|
|
|
if (responseData.get("code").equals(200)) {
|
|
|
- List<JSONObject> dataStr = (List<JSONObject>) responseData.get("data");
|
|
|
- return success(dataStr);
|
|
|
+ Object data = responseData.get("data");
|
|
|
+ if ( data instanceof JSONObject) {
|
|
|
+ List<JSONObject> dataStr = (List<JSONObject>) responseData.get("data");
|
|
|
+ return success(dataStr);
|
|
|
+ }
|
|
|
+ return success(null);
|
|
|
} else {
|
|
|
return error("同步失败" + responseData.get("message"));
|
|
|
}
|
|
|
@@ -189,9 +217,13 @@ public class HuiCunServiceImpl implements HuiCunService {
|
|
|
requestParam.put("timestamp", System.currentTimeMillis());
|
|
|
Map<String, Object> responseData = getMap(requestParam, CIVILIZED_DATA);
|
|
|
if (responseData.get("code").equals(200)) {
|
|
|
- JSONObject dataStr = (JSONObject) responseData.get("data");
|
|
|
- CivilizedDataDto civilizedDataDto = JSONUtil.toBean(dataStr, CivilizedDataDto.class);
|
|
|
- return success(civilizedDataDto);
|
|
|
+ Object data = responseData.get("data");
|
|
|
+ if ( data instanceof JSONObject) {
|
|
|
+ JSONObject dataStr = (JSONObject) responseData.get("data");
|
|
|
+ CivilizedDataDto civilizedDataDto = JSONUtil.toBean(dataStr, CivilizedDataDto.class);
|
|
|
+ return success(civilizedDataDto);
|
|
|
+ }
|
|
|
+ return success(null);
|
|
|
} else {
|
|
|
return error("同步失败" + responseData.get("message"));
|
|
|
}
|
|
|
@@ -205,11 +237,15 @@ public class HuiCunServiceImpl implements HuiCunService {
|
|
|
requestParam.put("timestamp", System.currentTimeMillis());
|
|
|
Map<String, Object> responseData = getMap(requestParam, VILLAGE_NEWS_DATA);
|
|
|
if (responseData.get("code").equals(200)) {
|
|
|
- System.out.println(responseData);
|
|
|
+ Object data = responseData.get("data");
|
|
|
+ if ( data instanceof JSONObject) {
|
|
|
+ System.out.println(responseData);
|
|
|
// List<VillageNewsDataDto> dataStr = (List<VillageNewsDataDto>) responseData.get("data");
|
|
|
- List<VillageNewsDataDto> dataStr = JSONUtil.toList( (JSONArray) responseData.get("data"), VillageNewsDataDto.class
|
|
|
- );
|
|
|
- return success(dataStr);
|
|
|
+ List<VillageNewsDataDto> dataStr = JSONUtil.toList((JSONArray) responseData.get("data"), VillageNewsDataDto.class
|
|
|
+ );
|
|
|
+ return success(dataStr);
|
|
|
+ }
|
|
|
+ return success(null);
|
|
|
} else {
|
|
|
return error("同步失败" + responseData.get("message"));
|
|
|
}
|