Browse Source

修改:

导入居民基本信息完善
master
wangxianzhang 4 years ago
parent
commit
d2deb8cbf5
  1. 51
      epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/EpmetAdminOpenFeignClient.java
  2. 26
      epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/fallback/EpmetAdminOpenFeignClientFallback.java
  3. 60
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  4. 35
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  5. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  6. 6
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  7. 5
      epmet-user/epmet-user-server/pom.xml
  8. 22
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  9. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  10. 239
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

51
epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/EpmetAdminOpenFeignClient.java

@ -1,6 +1,7 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.CorsConfigResultDTO;
import com.epmet.feign.fallback.EpmetAdminOpenFeignClientFallbackFactory;
@ -21,4 +22,54 @@ public interface EpmetAdminOpenFeignClient {
*/
@PostMapping("/sys/cors-config/list")
Result<List<CorsConfigResultDTO>> list();
/**
* @Description 文化程度
* @Param
* @Return {@link Result<List< OptionResultDTO >>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:27
*/
@PostMapping("/sys/dict/data/education")
Result<List<OptionResultDTO>> getEducationOption();
/**
* @Description 住房性质
* @Param
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:27
*/
@PostMapping("/sys/dict/data/house")
Result<List<OptionResultDTO>> getHouseOption();
/**
* @Description 民族
* @Param
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:27
*/
@PostMapping("/sys/dict/data/nation")
Result<List<OptionResultDTO>> getNationOption();
/**
* @Description 九小场所
* @Param
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:27
*/
@PostMapping("/sys/dict/data/ninesmallplaces")
Result<List<OptionResultDTO>> getNineSmallPlacesOption();
/**
* @Description 人员关系
* @Param
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 17:27
*/
@PostMapping("/sys/dict/data/relationship")
Result<List<OptionResultDTO>> getRelationshipOption();
}

26
epmet-admin/epmet-admin-client/src/main/java/com/epmet/feign/fallback/EpmetAdminOpenFeignClientFallback.java

@ -1,6 +1,7 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.CorsConfigResultDTO;
@ -15,4 +16,29 @@ public class EpmetAdminOpenFeignClientFallback implements EpmetAdminOpenFeignCli
public Result<List<CorsConfigResultDTO>> list() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "list", null);
}
@Override
public Result<List<OptionResultDTO>> getEducationOption() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getEducationOption", null);
}
@Override
public Result<List<OptionResultDTO>> getHouseOption() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getHouseOption", null);
}
@Override
public Result<List<OptionResultDTO>> getNationOption() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getNationOption", null);
}
@Override
public Result<List<OptionResultDTO>> getNineSmallPlacesOption() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getNineSmallPlacesOption", null);
}
@Override
public Result<List<OptionResultDTO>> getRelationshipOption() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getRelationshipOption", null);
}
}

60
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java

@ -1,10 +1,9 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.CustomerPartyBranchDTO;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.feign.fallback.GovOrgOpenFeignClientFallbackFactory;
@ -453,4 +452,59 @@ public interface GovOrgOpenFeignClient {
@PostMapping(value = "/gov/org/house/queryListHouseInfo",consumes = MediaType.APPLICATION_JSON_VALUE)
Result<List<HouseInfoDTO>> queryListHouseInfo(@RequestBody Set<String> houseIds);
/**
* @Description 获取组织下网格选项
* @Param formDTO
* @Return {@link Result<List< OptionResultDTO >>}
* @Author zhaoqifeng
* @Date 2021/10/26 14:02
*/
@PostMapping("/gov/org/customergrid/gridoption")
Result<List<OptionResultDTO>> getGridOption(@RequestBody AgencyIdFormDTO formDTO);
/**
* 获取网格下支部小组
* @Param formDTO
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/27 9:58
*/
@PostMapping("/gov/org/customerpartybranch/branchoption")
Result<List<OptionResultDTO>> getBranchOption(@RequestBody CustomerPartyBranchDTO formDTO);
/**
* @Description 获取小区内的楼栋
* @Param dto
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 14:46
*/
@PostMapping("/gov/org/icbuilding/buildingoption")
Result<List<OptionResultDTO>> getBuildingOptions(IcBuildingDTO dto);
/**
* @Description 获取楼栋内单元
* @Param dto
* @Return {@link Result<List<OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 14:46
*/
@PostMapping("/gov/org/icbuildingunit/unitoption")
Result<List<OptionResultDTO>> getUnitOptions(IcBuildingUnitDTO dto);
@PostMapping("/gov/org/ichouse/houseoption")
Result<List<OptionResultDTO>> getHouseOption(@RequestBody HouseFormDTO formDTO);
/**
* @Description 获取网格下小区列表
* @Param dto
* @Return {@link Result< List< OptionResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/10/26 14:38
*/
@PostMapping("/gov/org/icneighborhood/neighborhoodoption")
Result<List<OptionResultDTO>> getNeighborHoodOptions(IcNeighborHoodDTO dto);
}

35
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java

@ -1,11 +1,10 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.CustomerPartyBranchDTO;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.feign.GovOrgOpenFeignClient;
@ -276,6 +275,36 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "queryListHouseInfo", houseIds);
}
@Override
public Result<List<OptionResultDTO>> getGridOption(AgencyIdFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridOption", formDTO);
}
@Override
public Result<List<OptionResultDTO>> getBranchOption(CustomerPartyBranchDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getBranchOption", formDTO);
}
@Override
public Result<List<OptionResultDTO>> getBuildingOptions(IcBuildingDTO dto) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getBuildingOptions", dto);
}
@Override
public Result<List<OptionResultDTO>> getUnitOptions(IcBuildingUnitDTO dto) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getUnitOptions", dto);
}
@Override
public Result<List<OptionResultDTO>> getHouseOption(HouseFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getHouseOption", formDTO);
}
@Override
public Result<List<OptionResultDTO>> getNeighborHoodOptions(IcNeighborHoodDTO dto) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getNeighborHoodOptions", dto);
}
@Override
public Result<String> selectPidsByGridId(String gridId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectPidsByGridId", gridId);

4
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -2,6 +2,7 @@ package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.*;
@ -646,4 +647,7 @@ public interface EpmetUserOpenFeignClient {
*/
@GetMapping(value = "/epmetuser/user/queryUserClient/{userId}")
Result<UserDTO> queryUserClient(@PathVariable("userId") String userId);
@PostMapping("/epmetuser/icresidemanddict/demandoption/demandoption")
Result<List<OptionResultDTO>> getDemandOptions();
}

6
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -1,6 +1,7 @@
package com.epmet.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
@ -463,4 +464,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
public Result<UserDTO> queryUserClient(String userId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "queryUserClient", userId);
}
@Override
public Result<List<OptionResultDTO>> getDemandOptions() {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getDemandOptions", null);
}
}

5
epmet-user/epmet-user-server/pom.xml

@ -13,6 +13,11 @@
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-admin-client</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>

22
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java

@ -37,11 +37,9 @@ import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.CustomerFormResultDTO;
import com.epmet.dto.result.FormGroupDTO;
import com.epmet.dto.result.FormItem;
import com.epmet.dto.result.HomeUserResultDTO;
import com.epmet.dto.result.*;
import com.epmet.excel.IcResiUserExcel;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.service.IcResiUserService;
import lombok.extern.slf4j.Slf4j;
@ -75,6 +73,8 @@ public class IcResiUserController {
private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient;
@Autowired
private IcResiUserService icResiUserService;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@GetMapping("page")
public Result<PageData<IcResiUserDTO>> page(@RequestParam Map<String, Object> params){
@ -357,9 +357,17 @@ public class IcResiUserController {
}
@PostMapping("import/excel")
public Result importExcelByEasyExcel() {
Object header = icResiUserService.importExcel();
return new Result().ok(header);
public Result importExcelByEasyExcel(@LoginUser TokenDto loginUser) {
LoginUserDetailsFormDTO userForm = new LoginUserDetailsFormDTO();
userForm.setApp(loginUser.getApp());
userForm.setClient(loginUser.getClient());
userForm.setUserId(loginUser.getUserId());
Result<LoginUserDetailsResultDTO> loginUserDetails = epmetUserOpenFeignClient.getLoginUserDetails(userForm);
Object result = icResiUserService.importExcel(loginUserDetails.getData().getAgencyId());
return new Result().ok(result);
}
}

3
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java

@ -27,6 +27,7 @@ import com.epmet.dto.form.IcResiUserFormDTO;
import com.epmet.dto.form.IcResiUserPageFormDTO;
import com.epmet.dto.result.HomeUserResultDTO;
import com.epmet.entity.IcResiUserEntity;
import com.epmet.service.impl.IcResiUserServiceImpl;
import java.util.List;
import java.util.Map;
@ -130,5 +131,5 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
*/
Map queryIcResiDetail(IcResiDetailFormDTO pageFormDTO);
Object importExcel();
Object importExcel(String currUserAgencyId);
}

239
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -27,6 +27,7 @@ import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.ServiceConstant;
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.HouseTypeEnum;
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.constant.UserConstant;
import com.epmet.dao.IcResiUserDao;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.IcResiUserEntity;
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.OperCustomizeOpenFeignClient;
import com.epmet.redis.IcResiUserRedis;
@ -82,7 +84,11 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
@Autowired
private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private EpmetAdminOpenFeignClient adminOpenFeignClient;
@Override
public PageData<IcResiUserDTO> page(Map<String, Object> params) {
@ -422,9 +428,21 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
}
@Override
public Object importExcel() {
public Object importExcel(String currUserAgencyId) {
return imporExcel(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 imporExcel(int sheetNo, int headRowNumber, String currUserAgencyId) {
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>> dataList = readListener.getDataList();
@ -455,11 +473,69 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
}
}, 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);
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) {
for (Map<Integer, String> row : dataRows) {
for (Map.Entry<String, ColumnWrapper> columnWrapperEntry : headerColumnWrapper.entrySet()) {
String itemId = columnWrapperEntry.getKey();
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 合并头
*
@ -509,9 +585,6 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
}
return abandonedHeaders;
//headers.forEach((k, v) -> {
//
//});
}
/**
@ -521,9 +594,11 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
* @author wxz
* @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) {
HashMap<String, List<ColumnWrapper>> data = new HashMap<>();
// HashMap<String, List<ColumnWrapper>> tables = new HashMap<>();
Map<String, ColumnWrapper> columns = new HashMap<>(combinedHeaders.size());
for (Map.Entry<String, List<Integer>> entry : combinedHeaders.entrySet()) {
String combinedHeader = entry.getKey();
@ -539,49 +614,41 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
// 填充options
columnWrapper.setItemType(item.getItemType());
columnWrapper.setItemId(item.getItemId());
String groupLabel = item.getGroupLabel();
String combinedLabel = StringUtils.isBlank(groupLabel) ? item.getLabel() : groupLabel.concat(":").concat(item.getLabel());
columnWrapper.setCombinedLabel(combinedLabel);
columnWrapper.setColumnName(item.getColumnName());
columnWrapper.setColIndexs(entry.getValue());
if ("remote".equals(item.getOptionSourceType())) {
Map<String, String> options = listRemoteOptions(item.getOptionSourceValue());
columnWrapper.setOptions(options);
} 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;
}*/
columnWrapper.setOptionSourceType(item.getOptionSourceType());
columnWrapper.setOptionSourceValue(item.getOptionSourceValue());
columnWrapper.setOptions(item.getOptions().stream().collect(Collectors.toMap(OptionDTO::getLabel, OptionDTO::getValue)));
columns.put(item.getItemId(), columnWrapper);
}
return data;
return columns;
}
/**
* 获取checkbox列值
* @param options
* @param writedColIdxs
* @param abandonedHeaders
* @param columnWrapper 数据库列包装信息每一列跳数据对应数据库的一个列
* @param dataRow 数据行每一条都是一行中的一个单元格
* @param checkboxOptions 复选框的选项k: 列号, value: checkboxlabel中文
* @return
*/
private String getCheckBoxColValue(List<OptionDTO> options, List<Integer> writedColIdxs, Map<Integer, String> abandonedHeaders) {
Map<String, String> optionMap = options.stream().collect(Collectors.toMap(OptionDTO::getLabel, OptionDTO::getValue));
List<String> optionValues = writedColIdxs.stream().map(i -> {
String optionName = abandonedHeaders.get(i);
return optionMap.get(optionName);
private String getCheckBoxColValue(ColumnWrapper columnWrapper, Map<Integer, String> dataRow, Map<Integer, String> checkboxOptions) {
Map<String, String> options = columnWrapper.getOptions();
List<Integer> colIndexs = columnWrapper.getColIndexs();
List<String> optionValues = colIndexs.stream().filter(i -> {
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());
return String.join(",", optionValues);
@ -589,12 +656,86 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
/**
* 远程获取options
* @param uri
* @param fullUri
* @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;
String cascadeItemColumnValue = null;
if (fullUri.indexOf("?") != -1) {
String[] uriParts = fullUri.split("\\?");
pureUri = uriParts[0];
cascadeItemId = uriParts[1];
// 根据uri上的id,找到关联的itemid,从而找到关联的item的值
ColumnWrapper cascadeItemColumnWrapper = columnWrappers.get(cascadeItemId);
cascadeItemColumnValue = cascadeItemColumnWrapper.getColValue();
} else {
pureUri = fullUri;
}
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(cascadeItemColumnValue);
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(cascadeItemColumnValue);
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(cascadeItemColumnValue);
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(cascadeItemColumnValue);
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(cascadeItemId);
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;
return null;
}
if (options == null) return null;
return options.stream().collect(Collectors.toMap(OptionResultDTO::getLabel, OptionResultDTO::getValue));
// 通用api调用,无法实现
/*if (!uri.startsWith("/api")) uri = "/api".concat(uri);
@ -711,11 +852,25 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
private String combinedLabel;
private String columnName;
private String itemType;
private String itemId;
private List<Integer> colIndexs;
//private List<String> colContents;
// 单元格内容
private String cellContent;
// 数据库中列的值
private String colValue;
// key:label,value:value
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;
}
}
Loading…
Cancel
Save