Commit 500e3c05 authored by tangwei's avatar tangwei

修改扫描问题

parent f0708648
...@@ -2677,7 +2677,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -2677,7 +2677,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
List<FormValue> dynamicFormAlert = orgPersonFormVo.getDynamicFormAlert(); List<FormValue> dynamicFormAlert = orgPersonFormVo.getDynamicFormAlert();
Map<String, String> collect = dynamicFormAlert.stream().collect(HashMap::new, Map<String, String> collect = dynamicFormAlert.stream().collect(HashMap::new,
(map, item) -> map.put(item.getKey(), item.getValue()), HashMap::putAll); (map, item) -> map.put(item.getKey(), item.getValue()), HashMap::putAll);
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(orgPersonFormVo)); JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(orgPersonFormVo));
jsonObject.put("map", collect); jsonObject.put("map", collect);
return jsonObject; return jsonObject;
} }
...@@ -2821,51 +2821,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -2821,51 +2821,13 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
wrapper.eq(OrgUsr::getBizOrgCode,reginParams.getPersonIdentity().getBizOrgCode()); wrapper.eq(OrgUsr::getBizOrgCode,reginParams.getPersonIdentity().getBizOrgCode());
wrapper.eq(BaseEntity::getIsDelete,false); wrapper.eq(BaseEntity::getIsDelete,false);
wrapper.isNull(OrgUsr::getParentId); wrapper.isNull(OrgUsr::getParentId);
OrgUsr orgUsr = baseMapper.selectOne(wrapper); baseMapper.selectOne(wrapper);
List<OrgUsr> list = new ArrayList<>();
if (ValidationUtil.isEmpty(orgUsr)){
list = orgUsrMapper.companyTreeByUser(reginParams.getPersonIdentity().getBizOrgCode());
}else {
LambdaQueryWrapper<OrgUsr> queryWrapper= new LambdaQueryWrapper<>();
wrapper.likeRight(OrgUsr::getBizOrgCode,reginParams.getPersonIdentity().getBizOrgCode());
wrapper.eq(BaseEntity::getIsDelete,false);
wrapper.eq(OrgUsr::getBizOrgType,"DEPARTMENT");
baseMapper.selectList(queryWrapper);
}
List<OrgUsr> list = null;
list = orgUsrMapper.companyTreeByUser(reginParams.getPersonIdentity().getBizOrgCode()); list = orgUsrMapper.companyTreeByUser(reginParams.getPersonIdentity().getBizOrgCode());
return buildTreeParallel(list); return buildTreeParallel(list);
} }
// /**
// * 同步单位信息到防火监督point表
// *
// * @param companyIdList
// */
// protected void syncCompany2Supervision(List<Long> companyIdList) {
// if (ValidationUtil.isEmpty(companyIdList)) {
// return;
// }
// String token = RequestContext.getToken();
// String appKey = RequestContext.getAppKey();
// String product = RequestContext.getProduct();
// new Thread(() -> companyIdList.forEach(id -> {
// try {
// RequestContext.setAppKey(appKey);
// RequestContext.setToken(token);
// RequestContext.setProduct(product);
// OrgUsrFormDto formDto = this.selectCompanyById(id);
// if (!ValidationUtil.isEmpty(formDto) && OrgPersonEnum.公司.getKey().equals(formDto.getBizOrgType())) {
// emqKeeper.getMqttClient().publish(airportAddTopic, JSON.toJSONString(formDto).getBytes(), 2, false);
// }
// } catch (Exception e) {
// logger.debug("syncCompany2Supervision error:", e.getMessage());
// e.printStackTrace();
// }
// })).start();
// }
public String getIdNumberByAmosId(String amosId) { public String getIdNumberByAmosId(String amosId) {
LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<>();
...@@ -2899,8 +2861,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -2899,8 +2861,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
public List<OrgUsr> getByAmosId(List<String> amosIds) { public List<OrgUsr> getByAmosId(List<String> amosIds) {
List<OrgUsr> da=null;
if (ValidationUtil.isEmpty(amosIds)) { if (ValidationUtil.isEmpty(amosIds)) {
return null; return da;
} }
LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<>();
wrapper.in(OrgUsr::getAmosOrgId, amosIds); wrapper.in(OrgUsr::getAmosOrgId, amosIds);
...@@ -2909,8 +2872,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -2909,8 +2872,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
} }
public List<OrgUsr> getByOrgCode(String bizOrgCode) { public List<OrgUsr> getByOrgCode(String bizOrgCode) {
List<OrgUsr> da=null;
if (StringUtils.isEmpty(bizOrgCode)) { if (StringUtils.isEmpty(bizOrgCode)) {
return null; return da;
} }
LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<>();
wrapper.likeRight(OrgUsr::getBizOrgCode,bizOrgCode); wrapper.likeRight(OrgUsr::getBizOrgCode,bizOrgCode);
...@@ -2922,8 +2886,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -2922,8 +2886,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
} }
private List<OrgUsr> getIdByOrgCode(String bizOrgCode, Long id) { private List<OrgUsr> getIdByOrgCode(String bizOrgCode, Long id) {
List<OrgUsr> da=null;
if (StringUtils.isEmpty(bizOrgCode)) { if (StringUtils.isEmpty(bizOrgCode)) {
return null; return da;
} }
LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<>();
wrapper.likeRight(OrgUsr::getBizOrgCode,bizOrgCode); wrapper.likeRight(OrgUsr::getBizOrgCode,bizOrgCode);
...@@ -3021,11 +2986,11 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -3021,11 +2986,11 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
FirefightersPost firefightersPost = peopleInfoDto.getPostEduDtoObj().getFirefightersPost(); FirefightersPost firefightersPost = peopleInfoDto.getPostEduDtoObj().getFirefightersPost();
PeopleBasicInfoDto firefighters = peopleInfoDto.getFirefighters(); PeopleBasicInfoDto firefighters = peopleInfoDto.getFirefighters();
String s2 = JSONObject.toJSONString(firefighters); String s2 = JSON.toJSONString(firefighters);
Map map2 = JSONObject.parseObject(s2, Map.class); Map map2 = JSON.parseObject(s2, Map.class);
String s = JSONObject.toJSONString(firefightersPost); String s = JSON.toJSONString(firefightersPost);
Map map1 = JSONObject.parseObject(s, Map.class); Map map1 = JSON.parseObject(s, Map.class);
map1.putAll(map2); map1.putAll(map2);
dynamicFormValue.forEach(dynamicFormInstanceDto -> { dynamicFormValue.forEach(dynamicFormInstanceDto -> {
...@@ -3100,10 +3065,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -3100,10 +3065,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
public void saveFirefighters(PeopleInfoDto peopleInfoDto){ public void saveFirefighters(PeopleInfoDto peopleInfoDto){
/*3184 消防人员,编辑页面岗位选择子分类保存成功后,概要中岗位未修改 chenzhao start 2021-10-19*/ /*3184 消防人员,编辑页面岗位选择子分类保存成功后,概要中岗位未修改 chenzhao start 2021-10-19*/
// if (peopleInfoDto.getFirefighters().getJobTitleCode() != null && !firefighters.getFirefighters().getJobTitleCode().equals("")) {
// DataDictionary gwmc = dataDictionaryService.getByCode(firefighters.getFirefighters().getJobTitleCode(), "GWMC");
// firefighters.getFirefighters().setJobTitle(gwmc.getName());
// }
PeopleBasicInfoDto firefighters = peopleInfoDto.getFirefighters(); PeopleBasicInfoDto firefighters = peopleInfoDto.getFirefighters();
Firefighters firefightersNew = new Firefighters(); Firefighters firefightersNew = new Firefighters();
BeanUtils.copyProperties(firefighters, firefightersNew); BeanUtils.copyProperties(firefighters, firefightersNew);
...@@ -3133,7 +3095,6 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -3133,7 +3095,6 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
public void saveFirefightersPost(FirefightersDataDto firefightersDataDto, Long id){ public void saveFirefightersPost(FirefightersDataDto firefightersDataDto, Long id){
QueryWrapper queryWrapper = new QueryWrapper<>(); QueryWrapper queryWrapper = new QueryWrapper<>();
//queryWrapper.eq("org_usr_id", firefightersDataDto.getFirefightersPost().getOrgUsrId());
queryWrapper.eq("org_usr_id", id); queryWrapper.eq("org_usr_id", id);
FirefightersPost firefightersPost = iFirefightersPostService.getOne(queryWrapper); FirefightersPost firefightersPost = iFirefightersPostService.getOne(queryWrapper);
...@@ -3197,12 +3158,10 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -3197,12 +3158,10 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
if (!ObjectUtils.isEmpty(value)) { if (!ObjectUtils.isEmpty(value)) {
Date date; Date date;
SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
date = ft.parse(value.toString()); date = ft.parse(value.toString());
field.set(peopleBasicInfoDto, date); field.set(peopleBasicInfoDto, date);
} catch (Exception e) {
logger.error("日期转换失败");
}
} }
} else { } else {
field.set(peopleBasicInfoDto, value); field.set(peopleBasicInfoDto, value);
...@@ -3323,6 +3282,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -3323,6 +3282,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
deleteFirefighters(id); deleteFirefighters(id);
} }
// 巡检站端与中心级数据同步 // 巡检站端与中心级数据同步
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override @Override
public void afterCommit() { public void afterCommit() {
...@@ -3330,6 +3291,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -3330,6 +3291,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
dataSyncService.OrgUsrSyncDtoDelDataSync(id); dataSyncService.OrgUsrSyncDtoDelDataSync(id);
} }
}); });
return "0"; return "0";
} }
......
...@@ -11,18 +11,13 @@ import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; ...@@ -11,18 +11,13 @@ import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils; import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils;
import com.yeejoin.amos.boot.biz.common.utils.Menu; import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.module.common.api.dto.*; import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResource; import com.yeejoin.amos.boot.module.common.api.entity.*;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceCrane;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceHydrant;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceIndex;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceNatural;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourcePool;
import com.yeejoin.amos.boot.module.common.api.enums.WaterResourceTypeEnum; import com.yeejoin.amos.boot.module.common.api.enums.WaterResourceTypeEnum;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient; import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.WaterResourceMapper; import com.yeejoin.amos.boot.module.common.api.mapper.WaterResourceMapper;
import com.yeejoin.amos.boot.module.common.api.service.IWaterResourceService; import com.yeejoin.amos.boot.module.common.api.service.IWaterResourceService;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -37,13 +32,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -37,13 +32,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/** /**
* 服务实现类 * 服务实现类
...@@ -74,6 +63,10 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -74,6 +63,10 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
@Autowired @Autowired
EquipFeignClient equipFeignClient; EquipFeignClient equipFeignClient;
private static final String RESOURCE_ID ="resource_id";
private static final String CHILDREN ="children";
private static final String NAMEKEY ="nameKey";
@Value("classpath:/json/equipmentWaterCode.json") @Value("classpath:/json/equipmentWaterCode.json")
private org.springframework.core.io.Resource equipmentWaterCode; private org.springframework.core.io.Resource equipmentWaterCode;
...@@ -135,9 +128,9 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -135,9 +128,9 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
String resourceType = model.getResourceType(); String resourceType = model.getResourceType();
Optional<WaterResourceTypeEnum> resourceTypeEnum = EnumsUtils.getEnumObject(WaterResourceTypeEnum.class, Optional<WaterResourceTypeEnum> resourceTypeEnum = EnumsUtils.getEnumObject(WaterResourceTypeEnum.class,
e -> e.getCode().equals(resourceType)); e -> e.getCode().equals(resourceType));
model.setResourceTypeName(resourceTypeEnum.get().getName()); model.setResourceTypeName(resourceTypeEnum.isPresent()?resourceTypeEnum.get().getName():null);
model.setRealityImg(JSONArray.toJSONString(model.getRealityImgList())); model.setRealityImg(JSON.toJSONString(model.getRealityImgList()));
model.setOrientationImg(JSONArray.toJSONString(model.getOrientationImgList())); model.setOrientationImg(JSON.toJSONString(model.getOrientationImgList()));
if (!StringUtils.isEmpty(resourceType)) { if (!StringUtils.isEmpty(resourceType)) {
switch (resourceType) { switch (resourceType) {
case "hydrant": case "hydrant":
...@@ -185,15 +178,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -185,15 +178,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
break; break;
} }
// 新增物联信息
// if (model.getIsIot()) {
// WaterResourceIotDto waterResourceIotDto = new WaterResourceIotDto();
// BeanUtils.copyProperties(model, waterResourceIotDto);
// waterResourceIotDto.setSequenceNbr(null);
// waterResourceIotDto.setResourceType(model.getResourceType());
// waterResourceIotDto.setResourceId(model.getSequenceNbr());
// waterResourceIotService.createWithModel(waterResourceIotDto);
// }
} else { } else {
createWithModel(model); createWithModel(model);
} }
...@@ -237,8 +222,8 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -237,8 +222,8 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
public WaterResourceDto selectBySequenceNbr(Long sequenceNbr) { public WaterResourceDto selectBySequenceNbr(Long sequenceNbr) {
// 查询基本信息 // 查询基本信息
WaterResourceDto waterResourceDto = this.queryBySeq(sequenceNbr); WaterResourceDto waterResourceDto = this.queryBySeq(sequenceNbr);
waterResourceDto.setRealityImgList(JSONArray.parseArray(waterResourceDto.getRealityImg(), Object.class)); waterResourceDto.setRealityImgList(JSON.parseArray(waterResourceDto.getRealityImg(), Object.class));
waterResourceDto.setOrientationImgList(JSONArray.parseArray(waterResourceDto.getOrientationImg())); waterResourceDto.setOrientationImgList(JSON.parseArray(waterResourceDto.getOrientationImg()));
if (ValidationUtil.isEmpty(waterResourceDto.getContactUser())) { if (ValidationUtil.isEmpty(waterResourceDto.getContactUser())) {
waterResourceDto.setContactUser(""); waterResourceDto.setContactUser("");
...@@ -269,7 +254,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -269,7 +254,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
case "hydrant": case "hydrant":
WaterResourceHydrant waterResourceHydrant = WaterResourceHydrant waterResourceHydrant =
waterResourceHydrantService.getOne(new QueryWrapper<WaterResourceHydrant>().eq( waterResourceHydrantService.getOne(new QueryWrapper<WaterResourceHydrant>().eq(
"resource_id", RESOURCE_ID,
sequenceNbr)); sequenceNbr));
if (null != waterResourceHydrant) { if (null != waterResourceHydrant) {
BeanUtils.copyProperties(waterResourceHydrant, waterResourceDto); BeanUtils.copyProperties(waterResourceHydrant, waterResourceDto);
...@@ -277,7 +262,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -277,7 +262,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
break; break;
case "crane": case "crane":
WaterResourceCrane waterResourceCrane = WaterResourceCrane waterResourceCrane =
waterResourceCraneService.getOne(new QueryWrapper<WaterResourceCrane>().eq("resource_id", waterResourceCraneService.getOne(new QueryWrapper<WaterResourceCrane>().eq(RESOURCE_ID,
sequenceNbr)); sequenceNbr));
if (null != waterResourceCrane) { if (null != waterResourceCrane) {
BeanUtils.copyProperties(waterResourceCrane, waterResourceDto); BeanUtils.copyProperties(waterResourceCrane, waterResourceDto);
...@@ -286,7 +271,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -286,7 +271,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
case "natural": case "natural":
WaterResourceNatural waterResourceNatural = WaterResourceNatural waterResourceNatural =
waterResourceNaturalService.getOne(new QueryWrapper<WaterResourceNatural>().eq( waterResourceNaturalService.getOne(new QueryWrapper<WaterResourceNatural>().eq(
"resource_id", RESOURCE_ID,
sequenceNbr)); sequenceNbr));
if (null != waterResourceNatural) { if (null != waterResourceNatural) {
BeanUtils.copyProperties(waterResourceNatural, waterResourceDto); BeanUtils.copyProperties(waterResourceNatural, waterResourceDto);
...@@ -295,7 +280,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -295,7 +280,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
break; break;
case "pool": case "pool":
WaterResourcePool waterResourcePool = WaterResourcePool waterResourcePool =
waterResourcePoolService.getOne(new QueryWrapper<WaterResourcePool>().eq("resource_id", waterResourcePoolService.getOne(new QueryWrapper<WaterResourcePool>().eq(RESOURCE_ID,
sequenceNbr)); sequenceNbr));
if (null != waterResourcePool) { if (null != waterResourcePool) {
BeanUtils.copyProperties(waterResourcePool, waterResourceDto); BeanUtils.copyProperties(waterResourcePool, waterResourceDto);
...@@ -356,30 +341,31 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -356,30 +341,31 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
} }
public List<Menu> getwaterResourceTypeTree(String bizOrgCode) throws Exception { public List<Menu> getwaterResourceTypeTree(String bizOrgCode) throws Exception {
List<Menu> da=null;
List<Menu> list = new ArrayList<>(); List<Menu> list = new ArrayList<>();
ResponseModel<Object> response = equipFeignClient.list(); ResponseModel<Object> response = equipFeignClient.list();
if (response.getStatus() != 200) { if (response.getStatus() != 200) {
return null; return da;
} }
Object resultObject = response.getResult(); Object resultObject = response.getResult();
JSONArray childrenArray = null; JSONArray childrenArray = null;
JSONArray waterTypeDetailArray = null; JSONArray waterTypeDetailArray = null;
JSONObject waterTypeDetailJson = null; JSONObject waterTypeDetailJson = null;
JSONArray resultArray = JSONArray.parseArray(JSONArray.toJSONString(resultObject)); JSONArray resultArray = JSON.parseArray(JSON.toJSONString(resultObject));
for (Object obj : resultArray) { for (Object obj : resultArray) {
JSONObject detailJsonObject = JSONObject.parseObject(JSONObject.toJSONString(obj)); JSONObject detailJsonObject = JSON.parseObject(JSON.toJSONString(obj));
String codeString = detailJsonObject.getString("code"); String codeString = detailJsonObject.getString("code");
if (codeString.equals("90000000")) { if (codeString.equals("90000000")) {
childrenArray = detailJsonObject.getJSONArray("children"); childrenArray = detailJsonObject.getJSONArray(CHILDREN);
break; break;
} }
} }
if (childrenArray != null && childrenArray.size() > 0) { if (childrenArray != null && childrenArray.size() > 0) {
for (Object childObject : childrenArray) { for (Object childObject : childrenArray) {
JSONObject detailChildJsonObject = JSONObject.parseObject(JSONObject.toJSONString(childObject)); JSONObject detailChildJsonObject = JSON.parseObject(JSON.toJSONString(childObject));
String codeStr = detailChildJsonObject.getString("code"); String codeStr = detailChildJsonObject.getString("code");
if (codeStr.equals("93000000")) { if (codeStr.equals("93000000")) {
waterTypeDetailArray = detailChildJsonObject.getJSONArray("children"); waterTypeDetailArray = detailChildJsonObject.getJSONArray(CHILDREN);
break; break;
} }
} }
...@@ -387,7 +373,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -387,7 +373,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
} }
if (waterTypeDetailArray != null && waterTypeDetailArray.size() > 0) { if (waterTypeDetailArray != null && waterTypeDetailArray.size() > 0) {
for (Object childObject : waterTypeDetailArray) { for (Object childObject : waterTypeDetailArray) {
JSONObject waterTypeDetail = JSONObject.parseObject(JSONObject.toJSONString(childObject)); JSONObject waterTypeDetail = JSON.parseObject(JSON.toJSONString(childObject));
String codeStr = waterTypeDetail.getString("code"); String codeStr = waterTypeDetail.getString("code");
if (codeStr.equals("93060000")) { if (codeStr.equals("93060000")) {
waterTypeDetailJson = waterTypeDetail; waterTypeDetailJson = waterTypeDetail;
...@@ -412,11 +398,10 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -412,11 +398,10 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
map.put(key,value); map.put(key,value);
} }
int num = 0; int num = 0;
JSONArray waterTypeDetailChildrenArray = waterTypeDetailJson.getJSONArray("children"); JSONArray waterTypeDetailChildrenArray = waterTypeDetailJson.getJSONArray(CHILDREN);
JSONArray array = new JSONArray();
for (Object childObject : waterTypeDetailChildrenArray) { for (Object childObject : waterTypeDetailChildrenArray) {
JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(childObject)); JSONObject detail = JSON.parseObject(JSON.toJSONString(childObject));
String codeStr = detail.getString("code"); String codeStr = detail.getString("code");
if(map!=null && map.containsKey(codeStr)) { if(map!=null && map.containsKey(codeStr)) {
num=num+Integer.parseInt( map.get(codeStr).toString()); num=num+Integer.parseInt( map.get(codeStr).toString());
...@@ -424,10 +409,10 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -424,10 +409,10 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
}else { }else {
detail.put("num", 0); detail.put("num", 0);
} }
if (ObjectUtils.isNotEmpty( detail.getJSONArray("children"))){ if (ObjectUtils.isNotEmpty( detail.getJSONArray(CHILDREN))){
JSONArray children = detail.getJSONArray("children"); JSONArray children = detail.getJSONArray(CHILDREN);
for (Object child : children) { for (Object child : children) {
JSONObject childDetail = JSONObject.parseObject(JSONObject.toJSONString(child)); JSONObject childDetail = JSON.parseObject(JSON.toJSONString(child));
String codeStrChild = childDetail.getString("code"); String codeStrChild = childDetail.getString("code");
if(map!=null && map.containsKey(codeStrChild)) { if(map!=null && map.containsKey(codeStrChild)) {
int parentNum = Integer.parseInt(detail.get("num").toString()); int parentNum = Integer.parseInt(detail.get("num").toString());
...@@ -436,48 +421,13 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -436,48 +421,13 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
} }
} }
} }
// if ("93060100".equals(codeStr) && map.containsKey("pool")
// ) {
// num = num + Integer.parseInt(map.get("pool").toString());
// detail.put("num", Integer.parseInt(map.get("pool").toString()));
// }
//
// if (
// "93060200".equals(codeStr) && map.containsKey("crane")
// ) {
// num = num + Integer.parseInt(map.get("crane").toString());
// detail.put("num", Integer.parseInt(map.get("crane").toString()));
// }
//
// if (
// "93060300".equals(codeStr) && map.containsKey("natural")
// ) {
// num = num + Integer.parseInt(map.get("natural").toString());
// detail.put("num", Integer.parseInt(map.get("natural").toString()));
// }
//
// if (
// "93060400".equals(codeStr) && map.containsKey("hydrant")
// ) {
// num = num + Integer.parseInt(map.get("hydrant").toString());
// detail.put("num", Integer.parseInt(map.get("hydrant").toString()));
// }
Menu menu = new Menu(Long.valueOf(detail.get("code").toString()), detail.get("name").toString(), null, Integer.parseInt(detail.containsKey("num") ? detail.get("num").toString() : "0" )); Menu menu = new Menu(Long.valueOf(detail.get("code").toString()), detail.get("name").toString(), null, Integer.parseInt(detail.containsKey("num") ? detail.get("num").toString() : "0" ));
list.add(menu); list.add(menu);
// if (detail.get("children").toString().length() == 2) {
// detail.put("children",null);
// }
// array.add(detail);
} }
// waterTypeDetailJson.remove("children");
// if(array.size() == 0) {
// waterTypeDetailJson.put("children", null);
// } else {
// waterTypeDetailJson.put("children", array);
// }
// waterTypeDetailJson.put("num", num);
} }
return list; return list;
} }
...@@ -492,21 +442,21 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -492,21 +442,21 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
JSONArray childrenArray = null; JSONArray childrenArray = null;
JSONArray waterTypeDetailArray = null; JSONArray waterTypeDetailArray = null;
JSONObject waterTypeDetailJson = null; JSONObject waterTypeDetailJson = null;
JSONArray resultArray = JSONArray.parseArray(JSONArray.toJSONString(resultObject)); JSONArray resultArray = JSON.parseArray(JSON.toJSONString(resultObject));
for (Object obj : resultArray) { for (Object obj : resultArray) {
JSONObject detailJsonObject = JSONObject.parseObject(JSONObject.toJSONString(obj)); JSONObject detailJsonObject = JSON.parseObject(JSON.toJSONString(obj));
String codeString = detailJsonObject.getString("code"); String codeString = detailJsonObject.getString("code");
if (codeString.equals("90000000")) { if (codeString.equals("90000000")) {
childrenArray = detailJsonObject.getJSONArray("children"); childrenArray = detailJsonObject.getJSONArray(CHILDREN);
break; break;
} }
} }
if (childrenArray != null && childrenArray.size() > 0) { if (childrenArray != null && childrenArray.size() > 0) {
for (Object childObject : childrenArray) { for (Object childObject : childrenArray) {
JSONObject detailChildJsonObject = JSONObject.parseObject(JSONObject.toJSONString(childObject)); JSONObject detailChildJsonObject = JSON.parseObject(JSON.toJSONString(childObject));
String codeStr = detailChildJsonObject.getString("code"); String codeStr = detailChildJsonObject.getString("code");
if (codeStr.equals("93000000")) { if (codeStr.equals("93000000")) {
waterTypeDetailArray = detailChildJsonObject.getJSONArray("children"); waterTypeDetailArray = detailChildJsonObject.getJSONArray(CHILDREN);
break; break;
} }
} }
...@@ -514,7 +464,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -514,7 +464,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
} }
if (waterTypeDetailArray != null && waterTypeDetailArray.size() > 0) { if (waterTypeDetailArray != null && waterTypeDetailArray.size() > 0) {
for (Object childObject : waterTypeDetailArray) { for (Object childObject : waterTypeDetailArray) {
JSONObject waterTypeDetail = JSONObject.parseObject(JSONObject.toJSONString(childObject)); JSONObject waterTypeDetail = JSON.parseObject(JSON.toJSONString(childObject));
String codeStr = waterTypeDetail.getString("code"); String codeStr = waterTypeDetail.getString("code");
if (codeStr.equals("93060000")) { if (codeStr.equals("93060000")) {
waterTypeDetailJson = waterTypeDetail; waterTypeDetailJson = waterTypeDetail;
...@@ -523,11 +473,11 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -523,11 +473,11 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
} }
} }
if (waterTypeDetailJson != null) { if (waterTypeDetailJson != null) {
JSONArray waterTypeDetailChildrenArray = waterTypeDetailJson.getJSONArray("children"); JSONArray waterTypeDetailChildrenArray = waterTypeDetailJson.getJSONArray(CHILDREN);
for (Object childObject : waterTypeDetailChildrenArray) { for (Object childObject : waterTypeDetailChildrenArray) {
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(childObject)); JSONObject detail = JSON.parseObject(JSON.toJSONString(childObject));
String codeStr = detail.getString("code"); String codeStr = detail.getString("code");
String name = detail.getString("name"); String name = detail.getString("name");
map.put("code", codeStr); map.put("code", codeStr);
...@@ -545,17 +495,17 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -545,17 +495,17 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
List<Map> mapList = JSONObject.parseArray(json, Map.class); List<Map> mapList = JSON.parseArray(json, Map.class);
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
mapList.forEach(x -> map.put(String.valueOf(x.get("nameKey")), x.get("type"))); mapList.forEach(x -> map.put(String.valueOf(x.get(NAMEKEY)), x.get("type")));
map.put("bizOrgCode", bizOrgCode); map.put("bizOrgCode", bizOrgCode);
Map<String, Object> result = waterResourceMapper.getWaterResourceInfoList(map); Map<String, Object> result = waterResourceMapper.getWaterResourceInfoList(map);
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
mapList.forEach(y -> { mapList.forEach(y -> {
Map<String, Object> tempMap = new HashMap<>(); Map<String, Object> tempMap = new HashMap<>();
tempMap.put("name", y.get("name")); tempMap.put("name", y.get("name"));
tempMap.put("code", y.get("nameKey")); tempMap.put("code", y.get(NAMEKEY));
tempMap.put("total", result.get(y.get("nameKey"))); tempMap.put("total", result.get(y.get(NAMEKEY)));
list.add(tempMap); list.add(tempMap);
}); });
return list; return list;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment