|
@ -27,6 +27,7 @@ import com.epmet.commons.tools.constant.FieldConstant; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.ServiceConstant; |
|
|
import com.epmet.commons.tools.constant.ServiceConstant; |
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
|
|
import com.epmet.commons.tools.dto.result.OptionResultDTO; |
|
|
import com.epmet.commons.tools.enums.GenderEnum; |
|
|
import com.epmet.commons.tools.enums.GenderEnum; |
|
|
import com.epmet.commons.tools.enums.HouseTypeEnum; |
|
|
import com.epmet.commons.tools.enums.HouseTypeEnum; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
@ -38,12 +39,13 @@ import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.constant.UserConstant; |
|
|
import com.epmet.constant.UserConstant; |
|
|
import com.epmet.dao.IcResiUserDao; |
|
|
import com.epmet.dao.IcResiUserDao; |
|
|
import com.epmet.dto.CustomerAgencyDTO; |
|
|
import com.epmet.dto.*; |
|
|
import com.epmet.dto.IcResiUserDTO; |
|
|
|
|
|
import com.epmet.dto.form.*; |
|
|
import com.epmet.dto.form.*; |
|
|
import com.epmet.dto.result.*; |
|
|
import com.epmet.dto.result.*; |
|
|
import com.epmet.entity.IcResiUserEntity; |
|
|
import com.epmet.entity.IcResiUserEntity; |
|
|
import com.epmet.excel.handler.DynamicEasyExcelListener; |
|
|
import com.epmet.excel.handler.DynamicEasyExcelListener; |
|
|
|
|
|
import com.epmet.feign.EpmetAdminOpenFeignClient; |
|
|
|
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
import com.epmet.feign.OperCustomizeOpenFeignClient; |
|
|
import com.epmet.feign.OperCustomizeOpenFeignClient; |
|
|
import com.epmet.redis.IcResiUserRedis; |
|
|
import com.epmet.redis.IcResiUserRedis; |
|
@ -82,7 +84,11 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
@Autowired |
|
|
@Autowired |
|
|
private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient; |
|
|
private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private EpmetAdminOpenFeignClient adminOpenFeignClient; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageData<IcResiUserDTO> page(Map<String, Object> params) { |
|
|
public PageData<IcResiUserDTO> page(Map<String, Object> params) { |
|
@ -322,8 +328,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
if (map.containsKey(UserConstant.GRID_ID) && null != map.get(UserConstant.GRID_ID) && StringUtils.isNotBlank(map.get(UserConstant.GRID_ID).toString())) { |
|
|
if (map.containsKey(UserConstant.GRID_ID) && null != map.get(UserConstant.GRID_ID) && StringUtils.isNotBlank(map.get(UserConstant.GRID_ID).toString())) { |
|
|
gridIds.add(map.get(UserConstant.GRID_ID).toString()); |
|
|
gridIds.add(map.get(UserConstant.GRID_ID).toString()); |
|
|
} |
|
|
} |
|
|
if (map.containsKey("HOME_ID") && null != map.get("HOME_ID") && StringUtils.isNotBlank(map.get("HOME_ID").toString())) { |
|
|
if (map.containsKey(UserConstant.HOME_ID) && null != map.get(UserConstant.HOME_ID) && StringUtils.isNotBlank(map.get(UserConstant.HOME_ID).toString())) { |
|
|
houseIds.add(map.get("HOME_ID").toString()); |
|
|
houseIds.add(map.get(UserConstant.HOME_ID).toString()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
Result<List<AllGridsByUserIdResultDTO>> gridInfoRes=govOrgOpenFeignClient.getGridListByGridIds(gridIds); |
|
|
Result<List<AllGridsByUserIdResultDTO>> gridInfoRes=govOrgOpenFeignClient.getGridListByGridIds(gridIds); |
|
@ -342,7 +348,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
resultMap.put(UserConstant.GRID_ID, gridInfoMap.get(gridIdValue).getGridName()); |
|
|
resultMap.put(UserConstant.GRID_ID, gridInfoMap.get(gridIdValue).getGridName()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
String homeId = null != resultMap.get("HOME_ID") ? resultMap.get("HOME_ID").toString() : StrConstant.EPMETY_STR; |
|
|
String homeId = null != resultMap.get(UserConstant.HOME_ID) ? resultMap.get(UserConstant.HOME_ID).toString() : StrConstant.EPMETY_STR; |
|
|
resultMap.put("HOME_ID_VALUE", homeId); |
|
|
resultMap.put("HOME_ID_VALUE", homeId); |
|
|
if (null != houseInfoMap && houseInfoMap.containsKey(homeId) && null != houseInfoMap.get(homeId)) { |
|
|
if (null != houseInfoMap && houseInfoMap.containsKey(homeId) && null != houseInfoMap.get(homeId)) { |
|
|
HouseInfoDTO houseInfoDTO = houseInfoMap.get(homeId); |
|
|
HouseInfoDTO houseInfoDTO = houseInfoMap.get(homeId); |
|
@ -369,7 +375,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
resultMap.put(UserConstant.HOUSE_TYPE_KEY, HouseTypeEnum.BIESHU.getName()); |
|
|
resultMap.put(UserConstant.HOUSE_TYPE_KEY, HouseTypeEnum.BIESHU.getName()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
resultMap.put("HOME_ID", neighBorName.concat(buildName).concat(unitName).concat(doorName)); |
|
|
resultMap.put(UserConstant.HOME_ID, neighBorName.concat(buildName).concat(unitName).concat(doorName)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (resultMap.containsKey(UserConstant.GENDER)) { |
|
|
if (resultMap.containsKey(UserConstant.GENDER)) { |
|
@ -422,9 +428,21 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Object importExcel() { |
|
|
public Object importIcResiInfoFromExcel(String currUserAgencyId) { |
|
|
|
|
|
return importIcResiInfoFromExcel(0, 3, currUserAgencyId); |
|
|
|
|
|
// imporExcel(1, 1);
|
|
|
|
|
|
// imporExcel(2, 1);
|
|
|
|
|
|
// imporExcel(3, 1);
|
|
|
|
|
|
// imporExcel(4, 1);
|
|
|
|
|
|
// imporExcel(5, 1);
|
|
|
|
|
|
// imporExcel(6, 2);
|
|
|
|
|
|
// imporExcel(7, 1);
|
|
|
|
|
|
// imporExcel(8, 1);
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Object importIcResiInfoFromExcel(int sheetNo, int headRowNumber, String currUserAgencyId) { |
|
|
DynamicEasyExcelListener readListener = new DynamicEasyExcelListener(); |
|
|
DynamicEasyExcelListener readListener = new DynamicEasyExcelListener(); |
|
|
EasyExcelFactory.read(new File("/opt/test/基础信息表/resi_info.xls")).registerReadListener(readListener).headRowNumber(3).sheet(0).doRead(); |
|
|
EasyExcelFactory.read(new File("/opt/test/基础信息表/resi_info.xls")).registerReadListener(readListener).headRowNumber(3).sheet(sheetNo).doRead(); |
|
|
|
|
|
|
|
|
List<Map<Integer, String>> headList = readListener.getHeadList(); |
|
|
List<Map<Integer, String>> headList = readListener.getHeadList(); |
|
|
List<Map<Integer, String>> dataList = readListener.getDataList(); |
|
|
List<Map<Integer, String>> dataList = readListener.getDataList(); |
|
@ -455,11 +473,72 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
} |
|
|
} |
|
|
}, formItem -> formItem) |
|
|
}, formItem -> formItem) |
|
|
); |
|
|
); |
|
|
HashMap<String, List<ColumnWrapper>> headerColumnWrapper = integrate(formItemMap, combinedHeaders, dataList, abandonedHeaders); |
|
|
Map<String, ColumnWrapper> headerColumnWrapper = integrate(formItemMap, combinedHeaders, dataList, abandonedHeaders); |
|
|
|
|
|
|
|
|
|
|
|
// 持久化
|
|
|
|
|
|
persist(headerColumnWrapper, dataList, currUserAgencyId, abandonedHeaders, customerItems.get(0).getTableName()); |
|
|
|
|
|
|
|
|
return headerColumnWrapper; |
|
|
return headerColumnWrapper; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 持久化 |
|
|
|
|
|
* @param headerColumnWrapper 数据库列包装信息 |
|
|
|
|
|
* @param dataRows 数据行集合 |
|
|
|
|
|
* @param currUserAgencyId 当前用户的组织id |
|
|
|
|
|
* @param checkBoxOptionColumnIdxAndLabel 复选框的列号&label中文 |
|
|
|
|
|
*/ |
|
|
|
|
|
private void persist(Map<String, ColumnWrapper> headerColumnWrapper, List<Map<Integer, String>> dataRows, |
|
|
|
|
|
String currUserAgencyId, Map<Integer, String> checkBoxOptionColumnIdxAndLabel, String tableName) { |
|
|
|
|
|
for (Map<Integer, String> row : dataRows) { |
|
|
|
|
|
|
|
|
|
|
|
// 当前行的列们
|
|
|
|
|
|
// List<ColumnWrapper> columnsOfCurrRow = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
List<String> columnNames = new ArrayList<>(); |
|
|
|
|
|
List<String> columnValues = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
for (Map.Entry<String, ColumnWrapper> columnWrapperEntry : headerColumnWrapper.entrySet()) { |
|
|
|
|
|
|
|
|
|
|
|
ColumnWrapper columnWrapper = columnWrapperEntry.getValue(); |
|
|
|
|
|
if ("input".equals(columnWrapper.getItemType()) |
|
|
|
|
|
|| "textarea".equals(columnWrapper.getItemType()) |
|
|
|
|
|
|| "datepicker".equals(columnWrapper.getItemType()) |
|
|
|
|
|
|| "timerange".equals(columnWrapper.getItemType()) |
|
|
|
|
|
) { |
|
|
|
|
|
|
|
|
|
|
|
String cellContent = row.get(columnWrapper.getColIndexs().get(0)); |
|
|
|
|
|
columnWrapper.setCellContent(cellContent); |
|
|
|
|
|
columnWrapper.setColValue(cellContent); |
|
|
|
|
|
|
|
|
|
|
|
} else if ("select".equals(columnWrapper.getItemType()) |
|
|
|
|
|
|| "radio".equals(columnWrapper.getItemType())){ |
|
|
|
|
|
|
|
|
|
|
|
String optionSourceType = columnWrapper.getOptionSourceType(); |
|
|
|
|
|
// 取单元格的内容
|
|
|
|
|
|
String cellContent = row.get(columnWrapper.getColIndexs().get(0)); |
|
|
|
|
|
columnWrapper.setCellContent(cellContent); |
|
|
|
|
|
|
|
|
|
|
|
if ("local".equals(optionSourceType)) { |
|
|
|
|
|
// 根据单元格内容,取到指定的option
|
|
|
|
|
|
Map<String, String> options = columnWrapper.getOptions(); |
|
|
|
|
|
String colValue = options.get(cellContent); |
|
|
|
|
|
columnWrapper.setColValue(colValue); |
|
|
|
|
|
} else { |
|
|
|
|
|
// remote类型
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> options = listRemoteOptions(headerColumnWrapper, columnWrapper.getOptionSourceValue(), currUserAgencyId); |
|
|
|
|
|
String colValue = options.get(cellContent); |
|
|
|
|
|
columnWrapper.setColValue(colValue); |
|
|
|
|
|
} |
|
|
|
|
|
} else if ("checkbox".equals(columnWrapper.getItemType())) { |
|
|
|
|
|
String checkBoxColValue = getCheckBoxColValue(columnWrapper, row, checkBoxOptionColumnIdxAndLabel); |
|
|
|
|
|
columnWrapper.setColValue(checkBoxColValue); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @description 合并头 |
|
|
* @description 合并头 |
|
|
* |
|
|
* |
|
@ -469,7 +548,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
* @date 2021.10.28 21:27:18 |
|
|
* @date 2021.10.28 21:27:18 |
|
|
*/ |
|
|
*/ |
|
|
private HashMap<String, List<Integer>> combineHeaders(Map<Integer, List<String>> headers) { |
|
|
private HashMap<String, List<Integer>> combineHeaders(Map<Integer, List<String>> headers) { |
|
|
HashMap<String, List<Integer>> itemAndColIndexs = new HashMap<>(); |
|
|
HashMap<String, List<Integer>> itemAndColIndexs = new LinkedHashMap<>(); |
|
|
|
|
|
|
|
|
headers.forEach((k, v) -> { |
|
|
headers.forEach((k, v) -> { |
|
|
String tempKey = String.join(":", v); |
|
|
String tempKey = String.join(":", v); |
|
@ -485,7 +564,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @description 清洗headers |
|
|
* @description 洗头 |
|
|
* |
|
|
* |
|
|
* @param headers |
|
|
* @param headers |
|
|
* @param items |
|
|
* @param items |
|
@ -501,7 +580,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
List<String> v = entry.getValue(); |
|
|
List<String> v = entry.getValue(); |
|
|
int lastPartIndex = v.size() - 1; |
|
|
int lastPartIndex = v.size() - 1; |
|
|
String lastValuePart = v.get(lastPartIndex); |
|
|
String lastValuePart = v.get(lastPartIndex); |
|
|
if (itemLabels.indexOf(lastValuePart) == -1) { |
|
|
if (!itemLabels.contains(lastValuePart)) { |
|
|
// 该部分为options,它的上一级是item,那么去掉options这一级
|
|
|
// 该部分为options,它的上一级是item,那么去掉options这一级
|
|
|
v.remove(lastPartIndex); |
|
|
v.remove(lastPartIndex); |
|
|
abandonedHeaders.put(colIdx, lastValuePart); |
|
|
abandonedHeaders.put(colIdx, lastValuePart); |
|
@ -509,9 +588,6 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return abandonedHeaders; |
|
|
return abandonedHeaders; |
|
|
//headers.forEach((k, v) -> {
|
|
|
|
|
|
//
|
|
|
|
|
|
//});
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -521,9 +597,11 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
* @author wxz |
|
|
* @author wxz |
|
|
* @date 2021.10.28 17:08:51 |
|
|
* @date 2021.10.28 17:08:51 |
|
|
*/ |
|
|
*/ |
|
|
private HashMap<String, List<ColumnWrapper>> integrate(Map<String, FormItem> formItemMap, Map<String, List<Integer>> combinedHeaders, |
|
|
private Map<String, ColumnWrapper> integrate(Map<String, FormItem> formItemMap, Map<String, List<Integer>> combinedHeaders, |
|
|
List<Map<Integer, String>> datas, Map<Integer, String> abandonedHeaders) { |
|
|
List<Map<Integer, String>> datas, Map<Integer, String> abandonedHeaders) { |
|
|
HashMap<String, List<ColumnWrapper>> data = new HashMap<>(); |
|
|
|
|
|
|
|
|
// HashMap<String, List<ColumnWrapper>> tables = new HashMap<>();
|
|
|
|
|
|
Map<String, ColumnWrapper> columns = new LinkedHashMap<>(combinedHeaders.size()); |
|
|
|
|
|
|
|
|
for (Map.Entry<String, List<Integer>> entry : combinedHeaders.entrySet()) { |
|
|
for (Map.Entry<String, List<Integer>> entry : combinedHeaders.entrySet()) { |
|
|
String combinedHeader = entry.getKey(); |
|
|
String combinedHeader = entry.getKey(); |
|
@ -539,49 +617,41 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
|
|
|
|
|
// 填充options
|
|
|
// 填充options
|
|
|
columnWrapper.setItemType(item.getItemType()); |
|
|
columnWrapper.setItemType(item.getItemType()); |
|
|
|
|
|
columnWrapper.setItemId(item.getItemId()); |
|
|
String groupLabel = item.getGroupLabel(); |
|
|
String groupLabel = item.getGroupLabel(); |
|
|
String combinedLabel = StringUtils.isBlank(groupLabel) ? item.getLabel() : groupLabel.concat(":").concat(item.getLabel()); |
|
|
String combinedLabel = StringUtils.isBlank(groupLabel) ? item.getLabel() : groupLabel.concat(":").concat(item.getLabel()); |
|
|
columnWrapper.setCombinedLabel(combinedLabel); |
|
|
columnWrapper.setCombinedLabel(combinedLabel); |
|
|
columnWrapper.setColumnName(item.getColumnName()); |
|
|
columnWrapper.setColumnName(item.getColumnName()); |
|
|
columnWrapper.setColIndexs(entry.getValue()); |
|
|
columnWrapper.setColIndexs(entry.getValue()); |
|
|
|
|
|
|
|
|
if ("remote".equals(item.getOptionSourceType())) { |
|
|
columnWrapper.setOptionSourceType(item.getOptionSourceType()); |
|
|
Map<String, String> options = listRemoteOptions(item.getOptionSourceValue()); |
|
|
columnWrapper.setOptionSourceValue(item.getOptionSourceValue()); |
|
|
columnWrapper.setOptions(options); |
|
|
columnWrapper.setOptions(item.getOptions().stream().collect(Collectors.toMap(OptionDTO::getLabel, OptionDTO::getValue))); |
|
|
} else { |
|
|
|
|
|
Map<String, String> options = item.getOptions().stream().collect(Collectors.toMap(OptionDTO::getLabel, OptionDTO::getValue)); |
|
|
|
|
|
columnWrapper.setOptions(options); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*switch (item.getItemType()) { |
|
|
|
|
|
case "input": |
|
|
|
|
|
case "textarea": |
|
|
|
|
|
case "datepicker": |
|
|
|
|
|
case "timerange": |
|
|
|
|
|
//输入性的
|
|
|
|
|
|
break; |
|
|
|
|
|
case "checkbox": |
|
|
|
|
|
break; |
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
columns.put(item.getItemId(), columnWrapper); |
|
|
} |
|
|
} |
|
|
return data; |
|
|
return columns; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 获取checkbox列值 |
|
|
* 获取checkbox列值 |
|
|
* @param options |
|
|
* @param columnWrapper 数据库列包装信息,每一列跳数据对应数据库的一个列 |
|
|
* @param writedColIdxs |
|
|
* @param dataRow 数据行,每一条都是一行中的一个单元格 |
|
|
* @param abandonedHeaders |
|
|
* @param checkboxOptions 复选框的选项。k: 列号, value: checkboxlabel中文 |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
private String getCheckBoxColValue(List<OptionDTO> options, List<Integer> writedColIdxs, Map<Integer, String> abandonedHeaders) { |
|
|
private String getCheckBoxColValue(ColumnWrapper columnWrapper, Map<Integer, String> dataRow, Map<Integer, String> checkboxOptions) { |
|
|
|
|
|
|
|
|
Map<String, String> optionMap = options.stream().collect(Collectors.toMap(OptionDTO::getLabel, OptionDTO::getValue)); |
|
|
Map<String, String> options = columnWrapper.getOptions(); |
|
|
|
|
|
List<Integer> colIndexs = columnWrapper.getColIndexs(); |
|
|
List<String> optionValues = writedColIdxs.stream().map(i -> { |
|
|
|
|
|
String optionName = abandonedHeaders.get(i); |
|
|
List<String> optionValues = colIndexs.stream().filter(i -> { |
|
|
return optionMap.get(optionName); |
|
|
String cellContent = dataRow.get(i); |
|
|
|
|
|
if (StringUtils.isNotBlank(cellContent) && cellContent.equals("是")) return true; |
|
|
|
|
|
return false; |
|
|
|
|
|
}).map(i -> { |
|
|
|
|
|
String checkboxOptionLabel = checkboxOptions.get(i); |
|
|
|
|
|
return options.get(checkboxOptionLabel); |
|
|
}).collect(Collectors.toList()); |
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
return String.join(",", optionValues); |
|
|
return String.join(",", optionValues); |
|
@ -589,12 +659,85 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 远程获取options |
|
|
* 远程获取options |
|
|
* @param uri |
|
|
* @param fullUri |
|
|
* @return |
|
|
* @return |
|
|
*/ |
|
|
*/ |
|
|
private Map<String, String> listRemoteOptions(String uri) { |
|
|
private Map<String, String> listRemoteOptions(Map<String, ColumnWrapper> columnWrappers, String fullUri, String currUserAgencyId) { |
|
|
|
|
|
String pureUri = null; |
|
|
|
|
|
String cascadeItemId = null; |
|
|
|
|
|
ColumnWrapper cascadeItemColumnWrapper = null; |
|
|
|
|
|
|
|
|
|
|
|
if (fullUri.indexOf("?") != -1) { |
|
|
|
|
|
String[] uriParts = fullUri.split("\\?"); |
|
|
|
|
|
pureUri = uriParts[0]; |
|
|
|
|
|
cascadeItemId = uriParts[1]; |
|
|
|
|
|
|
|
|
|
|
|
// 根据uri上的id,找到关联的itemid,从而找到关联的item的值
|
|
|
|
|
|
cascadeItemColumnWrapper = columnWrappers.get(cascadeItemId); |
|
|
|
|
|
} else { |
|
|
|
|
|
pureUri = fullUri; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return null; |
|
|
List<OptionResultDTO> options = null; |
|
|
|
|
|
|
|
|
|
|
|
switch (pureUri) { |
|
|
|
|
|
case "/epmetuser/icresidemanddict/demandoption": |
|
|
|
|
|
options = getResultDataOrThrowsException(epmetUserOpenFeignClient.getDemandOptions(), ServiceConstant.EPMET_USER_SERVER, |
|
|
|
|
|
EpmetErrorCode.SERVER_ERROR.getCode(), null); |
|
|
|
|
|
break; |
|
|
|
|
|
case "/gov/org/customergrid/gridoption": |
|
|
|
|
|
AgencyIdFormDTO form = new AgencyIdFormDTO(); |
|
|
|
|
|
form.setAgencyId(currUserAgencyId); |
|
|
|
|
|
options = getResultDataOrThrowsException(govOrgOpenFeignClient.getGridOption(form), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null); |
|
|
|
|
|
break; |
|
|
|
|
|
case "/gov/org/customerpartybranch/branchoption": |
|
|
|
|
|
|
|
|
|
|
|
CustomerPartyBranchDTO bform = new CustomerPartyBranchDTO(); |
|
|
|
|
|
bform.setGridId(cascadeItemColumnWrapper.getColValue()); |
|
|
|
|
|
options = getResultDataOrThrowsException(govOrgOpenFeignClient.getBranchOption(bform), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null); |
|
|
|
|
|
break; |
|
|
|
|
|
case "/gov/org/icbuilding/buildingoption": |
|
|
|
|
|
IcBuildingDTO buildingform = new IcBuildingDTO(); |
|
|
|
|
|
buildingform.setNeighborHoodId(cascadeItemColumnWrapper.getColValue()); |
|
|
|
|
|
options = getResultDataOrThrowsException(govOrgOpenFeignClient.getBuildingOptions(buildingform), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null); |
|
|
|
|
|
break; |
|
|
|
|
|
case "/gov/org/icbuildingunit/unitoption": |
|
|
|
|
|
IcBuildingUnitDTO buForm = new IcBuildingUnitDTO(); |
|
|
|
|
|
buForm.setBuildingId(cascadeItemColumnWrapper.getColValue()); |
|
|
|
|
|
options = getResultDataOrThrowsException(govOrgOpenFeignClient.getUnitOptions(buForm), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null); |
|
|
|
|
|
break; |
|
|
|
|
|
case "/gov/org/ichouse/houseoption": |
|
|
|
|
|
HouseFormDTO hform = new HouseFormDTO(); |
|
|
|
|
|
hform.setUnitId(cascadeItemColumnWrapper.getColValue()); |
|
|
|
|
|
options = getResultDataOrThrowsException(govOrgOpenFeignClient.getHouseOption(hform), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null); |
|
|
|
|
|
break; |
|
|
|
|
|
case "/gov/org/icneighborhood/neighborhoodoption": |
|
|
|
|
|
IcNeighborHoodDTO nform = new IcNeighborHoodDTO(); |
|
|
|
|
|
nform.setAgencyId(currUserAgencyId); |
|
|
|
|
|
nform.setGridId(cascadeItemColumnWrapper.getColValue()); |
|
|
|
|
|
options = getResultDataOrThrowsException(govOrgOpenFeignClient.getNeighborHoodOptions(nform), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null); |
|
|
|
|
|
break; |
|
|
|
|
|
case "/sys/dict/data/education": |
|
|
|
|
|
options = getResultDataOrThrowsException(adminOpenFeignClient.getEducationOption(), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null); |
|
|
|
|
|
break; |
|
|
|
|
|
case "/sys/dict/data/house": |
|
|
|
|
|
options = getResultDataOrThrowsException(adminOpenFeignClient.getHouseOption(), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null); |
|
|
|
|
|
break; |
|
|
|
|
|
case "/sys/dict/data/nation": |
|
|
|
|
|
options = getResultDataOrThrowsException(adminOpenFeignClient.getNationOption(), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null); |
|
|
|
|
|
break; |
|
|
|
|
|
case "/sys/dict/data/ninesmallplaces": |
|
|
|
|
|
options = getResultDataOrThrowsException(adminOpenFeignClient.getNineSmallPlacesOption(), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null); |
|
|
|
|
|
break; |
|
|
|
|
|
case "/sys/dict/data/relationship": |
|
|
|
|
|
options = getResultDataOrThrowsException(adminOpenFeignClient.getRelationshipOption(), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null); |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (options == null) return null; |
|
|
|
|
|
|
|
|
|
|
|
return options.stream().collect(Collectors.toMap(OptionResultDTO::getLabel, OptionResultDTO::getValue)); |
|
|
|
|
|
|
|
|
// 通用api调用,无法实现
|
|
|
// 通用api调用,无法实现
|
|
|
/*if (!uri.startsWith("/api")) uri = "/api".concat(uri); |
|
|
/*if (!uri.startsWith("/api")) uri = "/api".concat(uri); |
|
@ -711,13 +854,37 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
private String combinedLabel; |
|
|
private String combinedLabel; |
|
|
private String columnName; |
|
|
private String columnName; |
|
|
private String itemType; |
|
|
private String itemType; |
|
|
|
|
|
private String itemId; |
|
|
private List<Integer> colIndexs; |
|
|
private List<Integer> colIndexs; |
|
|
//private List<String> colContents;
|
|
|
//private List<String> colContents;
|
|
|
|
|
|
// 单元格内容
|
|
|
|
|
|
private String cellContent; |
|
|
|
|
|
// 数据库中列的值
|
|
|
private String colValue; |
|
|
private String colValue; |
|
|
|
|
|
|
|
|
// key:label,value:value
|
|
|
// key:label,value:value
|
|
|
private Map<String, String> options; |
|
|
private Map<String, String> options; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 选项来源,REMOTE;LOCAL;如果是动态加载的下拉框或者CHECKBOX等的情况下使用。URL:接口获取(LABEL,VALUE);JSON:直接从JSON中取 |
|
|
|
|
|
*/ |
|
|
|
|
|
private String optionSourceType; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 来源地址,REMOTE才有,固定格式;如果OPTIONS_SOURCE是URL,则此处填写要调用的接口的URL相对路径,例如:/API/GOV/ORG/XXXX。此处不应设置参数,若需要参数应当完全由后端,通过TOKEN信息来获取 |
|
|
|
|
|
*/ |
|
|
|
|
|
private String optionSourceValue; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* desc:动态查询 某表的所有字段值 |
|
|
|
|
|
* @param customerId |
|
|
|
|
|
* @param formCode |
|
|
|
|
|
* @param resultTableName |
|
|
|
|
|
* @param conditions |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
public List<Map<String,Object>> dynamicQuery(String customerId, |
|
|
public List<Map<String,Object>> dynamicQuery(String customerId, |
|
|
String formCode, |
|
|
String formCode, |
|
|
String resultTableName, |
|
|
String resultTableName, |
|
@ -732,4 +899,42 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
} |
|
|
} |
|
|
return baseDao.dynamicQuery(customerId,resultTableName,conditions,subTables); |
|
|
return baseDao.dynamicQuery(customerId,resultTableName,conditions,subTables); |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* desc:条件导出 |
|
|
|
|
|
* |
|
|
|
|
|
* @param customerId |
|
|
|
|
|
* @param formCode |
|
|
|
|
|
* @param baseTableName |
|
|
|
|
|
* @param conditions |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public List<Map<String, Object>> getDataForExport(String customerId, String formCode, String baseTableName, List<ResiUserQueryValueDTO> conditions) { |
|
|
|
|
|
List<Map<String, Object>> mapList = this.dynamicQuery(customerId, formCode, baseTableName, conditions); |
|
|
|
|
|
mapList.parallelStream().forEach(map -> { |
|
|
|
|
|
Object gridId = map.get(UserConstant.GRID_ID); |
|
|
|
|
|
if (gridId != null) { |
|
|
|
|
|
CustomerGridFormDTO formDTO = new CustomerGridFormDTO(); |
|
|
|
|
|
formDTO.setGridId(gridId.toString()); |
|
|
|
|
|
Result<CustomerGridDTO> gridInfoRes = govOrgOpenFeignClient.getGridBaseInfoByGridId(formDTO); |
|
|
|
|
|
if (gridInfoRes != null && gridInfoRes.success() && gridInfoRes.getData() != null) { |
|
|
|
|
|
map.put(UserConstant.GRID_ID, gridInfoRes.getData().getGridName()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
Object homeId = map.get(UserConstant.HOME_ID); |
|
|
|
|
|
if (homeId != null) { |
|
|
|
|
|
HashSet<String> houseIds = new HashSet<>(); |
|
|
|
|
|
houseIds.add(homeId.toString()); |
|
|
|
|
|
Result<List<HouseInfoDTO>> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(houseIds); |
|
|
|
|
|
if (houseInfoRes != null && houseInfoRes.success() && CollectionUtils.isNotEmpty(houseInfoRes.getData())){ |
|
|
|
|
|
HouseInfoDTO houseInfoDTO = houseInfoRes.getData().get(NumConstant.ZERO); |
|
|
|
|
|
map.put("VILLAGE_NAME", houseInfoDTO.getNeighborHoodName()); |
|
|
|
|
|
map.put("BUILD_NAME", houseInfoDTO.getBuildingName()); |
|
|
|
|
|
map.put("HOME_ID", houseInfoDTO.getDoorName()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
return mapList; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|