|
|
@@ -2,6 +2,8 @@ package com.java110.api.listener.community;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.java110.api.listener.AbstractServiceApiListener;
|
|
|
+import com.java110.core.smo.common.IAreaInnerServiceSMO;
|
|
|
+import com.java110.dto.area.AreaDto;
|
|
|
import com.java110.utils.constant.ServiceCodeConstant;
|
|
|
import com.java110.utils.util.BeanConvertUtil;
|
|
|
import com.java110.core.annotation.Java110Listener;
|
|
|
@@ -26,6 +28,9 @@ import java.util.List;
|
|
|
@Java110Listener("listCommunitysListener")
|
|
|
public class ListCommunitysListener extends AbstractServiceApiListener {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IAreaInnerServiceSMO areaInnerServiceSMOImpl;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ICommunityInnerServiceSMO communityInnerServiceSMOImpl;
|
|
|
|
|
|
@@ -70,10 +75,13 @@ public class ListCommunitysListener extends AbstractServiceApiListener {
|
|
|
|
|
|
if (count > 0) {
|
|
|
communitys = BeanConvertUtil.covertBeanList(communityInnerServiceSMOImpl.queryCommunitys(communityDto), ApiCommunityDataVo.class);
|
|
|
+
|
|
|
+ refreshCommunityCity(communitys);
|
|
|
} else {
|
|
|
communitys = new ArrayList<>();
|
|
|
}
|
|
|
|
|
|
+
|
|
|
ApiCommunityVo apiCommunityVo = new ApiCommunityVo();
|
|
|
|
|
|
apiCommunityVo.setTotal(count);
|
|
|
@@ -85,4 +93,39 @@ public class ListCommunitysListener extends AbstractServiceApiListener {
|
|
|
context.setResponseEntity(responseEntity);
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 刷新cityName
|
|
|
+ *
|
|
|
+ * @param communitys
|
|
|
+ */
|
|
|
+ private void refreshCommunityCity(List<ApiCommunityDataVo> communitys) {
|
|
|
+ List<String> areaCodes = new ArrayList<>();
|
|
|
+ for (ApiCommunityDataVo communityDataVo : communitys) {
|
|
|
+ areaCodes.add(communityDataVo.getCityCode());
|
|
|
+ }
|
|
|
+
|
|
|
+ AreaDto areaDto = new AreaDto();
|
|
|
+ areaDto.setAreaCodes(areaCodes.toArray(new String[areaCodes.size()]));
|
|
|
+
|
|
|
+ List<AreaDto> areaDtos = areaInnerServiceSMOImpl.getProvCityArea(areaDto);
|
|
|
+
|
|
|
+ for (ApiCommunityDataVo communityDataVo : communitys) {
|
|
|
+ for (AreaDto tmpAreaDto : areaDtos) {
|
|
|
+ if (communityDataVo.getCityCode().equals(tmpAreaDto.getAreaCode())) {
|
|
|
+ communityDataVo.setCityName(tmpAreaDto.getProvName() + tmpAreaDto.getCityName() + tmpAreaDto.getAreaName());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ communityDataVo.setCityName("未知");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public IAreaInnerServiceSMO getAreaInnerServiceSMOImpl() {
|
|
|
+ return areaInnerServiceSMOImpl;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setAreaInnerServiceSMOImpl(IAreaInnerServiceSMO areaInnerServiceSMOImpl) {
|
|
|
+ this.areaInnerServiceSMOImpl = areaInnerServiceSMOImpl;
|
|
|
+ }
|
|
|
}
|