Browse Source

Merge remote-tracking branch 'remotes/origin/dev_resi_export' into dev

# Conflicts:
#	epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
master
jianjun 3 years ago
parent
commit
e88a9f13f1
  1. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/IcExportItemListFormDTO.java
  2. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java
  3. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/EasyPoiExcelExportStylerImpl.java
  4. 96
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/ColumnWidthStyleStrategy.java
  5. 11
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/ExcelFillCellMergeStrategy.java
  6. 3
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcBuildingDTO.java
  7. 6
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcHouseDTO.java
  8. 3
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/ImportGeneralDTO.java
  9. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBuildingListFormDTO.java
  10. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingAddFormDTO.java
  11. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseAddFormDTO.java
  12. 4
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseListFormDTO.java
  13. 32
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateSortFormDTO.java
  14. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBuildingListResultDTO.java
  15. 2
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcHouseListResultDTO.java
  16. 12
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java
  17. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcBuildingEntity.java
  18. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcHouseEntity.java
  19. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcBuildingExcel.java
  20. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/BuildingInfoModel.java
  21. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/HouseInfoModel.java
  22. 14
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportBuildingInfoListener.java
  23. 15
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java
  24. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java
  25. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java
  26. 20
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  27. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java
  28. 3
      epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.18__edit_building_and_house_sort.sql
  29. BIN
      epmet-module/gov-org/gov-org-server/src/main/resources/excel/building_export.xlsx
  30. BIN
      epmet-module/gov-org/gov-org-server/src/main/resources/excel/building_template.xlsx
  31. BIN
      epmet-module/gov-org/gov-org-server/src/main/resources/excel/house_template.xlsx
  32. 12
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml
  33. 14
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml
  34. 5
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FormItemBaseResult.java
  35. 4
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemDao.xml
  36. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CollectListFormDTO.java
  37. 3
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListResultDTO.java
  38. 18
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java
  39. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiCollectService.java
  40. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java
  41. 17
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java
  42. 84
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java
  43. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  44. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiCollectDao.xml
  45. 18
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

5
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/IcExportItemListFormDTO.java

@ -69,5 +69,10 @@ public class IcExportItemListFormDTO implements Serializable {
*/ */
private String optionSourceType; private String optionSourceType;
/**
* 是否支持添加即多对一eg需求列表
*/
private boolean supportAdd;
} }

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/result/OptionResultDTO.java

@ -33,7 +33,7 @@ public class OptionResultDTO implements Serializable {
*/ */
public void getCurrenNodeAllChild(OptionResultDTO option, Map<String, OptionResultDTO> resultMap) { public void getCurrenNodeAllChild(OptionResultDTO option, Map<String, OptionResultDTO> resultMap) {
resultMap.put(option.getValue(), option); resultMap.put(option.getValue(), option);
if (CollectionUtils.isNotEmpty(option.getChildren())) { if (CollectionUtils.isEmpty(option.getChildren())) {
return; return;
} }
option.getChildren().forEach(o -> { option.getChildren().forEach(o -> {

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/EasyPoiExcelExportStylerImpl.java

@ -50,7 +50,7 @@ public class EasyPoiExcelExportStylerImpl extends AbstractExcelExportStyler
titleStyle.setFont(font); titleStyle.setFont(font);
titleStyle.setAlignment(HorizontalAlignment.CENTER); titleStyle.setAlignment(HorizontalAlignment.CENTER);
titleStyle.setVerticalAlignment(VerticalAlignment.CENTER); titleStyle.setVerticalAlignment(VerticalAlignment.CENTER);
return null; return titleStyle;
} }
/** /**

96
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/ColumnWidthStyleStrategy.java

@ -0,0 +1,96 @@
package com.epmet.commons.tools.utils.poi.excel.handler;
/**
* desc:设置columnWith宽度
*
* @author: LiuJanJun
* @date: 2022/4/28 5:05 下午
* @version: 1.0
*/
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.util.MapUtils;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.style.column.AbstractColumnWidthStyleStrategy;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.ss.usermodel.Cell;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Take the width of the longest column as the width.
* <p>
* This is not very useful at the moment, for example if you have Numbers it will cause a newline.And the length is not
* exactly the same as the actual length.
*
* @author Jiaju Zhuang
*/
public class ColumnWidthStyleStrategy extends AbstractColumnWidthStyleStrategy {
private static final int MAX_COLUMN_WIDTH = 255;
/**
* 是否 根据内容设置宽度
*/
private boolean isSetContentWidth = false;
private final Map<Integer, Map<Integer, Integer>> cache = MapUtils.newHashMapWithExpectedSize(8);
@Override
protected void setColumnWidth(WriteSheetHolder writeSheetHolder, List<WriteCellData<?>> cellDataList, Cell cell,
Head head,
Integer relativeRowIndex, Boolean isHead) {
boolean needSetWidth = (isHead || isSetContentWidth) && CollectionUtils.isNotEmpty(cellDataList);
if (!needSetWidth) {
return;
}
Map<Integer, Integer> maxColumnWidthMap = cache.computeIfAbsent(writeSheetHolder.getSheetNo(), k -> new HashMap<>(16));
Integer columnWidth = dataLength(cellDataList, cell, isHead);
if (columnWidth < 0) {
return;
}
if (columnWidth > MAX_COLUMN_WIDTH) {
columnWidth = MAX_COLUMN_WIDTH;
}
Integer maxColumnWidth = maxColumnWidthMap.get(cell.getColumnIndex());
if (maxColumnWidth == null || columnWidth > maxColumnWidth) {
maxColumnWidthMap.put(cell.getColumnIndex(), columnWidth);
writeSheetHolder.getSheet().setColumnWidth(cell.getColumnIndex(), columnWidth * 256);
}
}
private Integer dataLength(List<WriteCellData<?>> cellDataList, Cell cell, Boolean isHead) {
if (isHead) {
return cell.getStringCellValue().getBytes().length+3;
}
WriteCellData<?> cellData = cellDataList.get(0);
CellDataTypeEnum type = cellData.getType();
if (type == null) {
return -1;
}
switch (type) {
case STRING:
return cellData.getStringValue().getBytes().length;
case BOOLEAN:
return cellData.getBooleanValue().toString().getBytes().length;
case NUMBER:
return cellData.getNumberValue().toString().getBytes().length;
default:
return -1;
}
}
public ColumnWidthStyleStrategy() {
}
public ColumnWidthStyleStrategy(boolean isSetContentWidth) {
this.isSetContentWidth = isSetContentWidth;
}
}

11
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/ExcelFillCellMergeStrategy.java

@ -23,7 +23,7 @@ public class ExcelFillCellMergeStrategy implements CellWriteHandler {
/** /**
* 需要合并的列 下标 * 需要合并的列 下标
*/ */
private int[] mergeColumnIndex; private int[] mergeColumnIndexArr;
/** /**
* 从下标n行开始合并 * 从下标n行开始合并
*/ */
@ -32,9 +32,9 @@ public class ExcelFillCellMergeStrategy implements CellWriteHandler {
public ExcelFillCellMergeStrategy() { public ExcelFillCellMergeStrategy() {
} }
public ExcelFillCellMergeStrategy(int mergeRowIndex, int[] mergeColumnIndex) { public ExcelFillCellMergeStrategy(int mergeRowIndex, int[] mergeColumnIndexArr) {
this.mergeRowIndex = mergeRowIndex; this.mergeRowIndex = mergeRowIndex;
this.mergeColumnIndex = mergeColumnIndex; this.mergeColumnIndexArr = mergeColumnIndexArr;
} }
@Override @Override
@ -56,14 +56,13 @@ public class ExcelFillCellMergeStrategy implements CellWriteHandler {
return; return;
} }
//如果不指定 合并的列则全部列进行 合并判断 //如果不指定 合并的列则全部列进行 合并判断
if (mergeColumnIndex == null) { if (mergeColumnIndexArr == null) {
mergeWithPrevRow(writeSheetHolder, cell, curRowIndex, curColIndex); mergeWithPrevRow(writeSheetHolder, cell, curRowIndex, curColIndex);
} else { } else {
//合并指定的列号 //合并指定的列号
for (int columnIndex : mergeColumnIndex) { for (int columnIndex : mergeColumnIndexArr) {
if (curColIndex == columnIndex) { if (curColIndex == columnIndex) {
mergeWithPrevRow(writeSheetHolder, cell, curRowIndex, curColIndex); mergeWithPrevRow(writeSheetHolder, cell, curRowIndex, curColIndex);
break;
} }
} }
} }

3
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcBuildingDTO.java

@ -20,6 +20,7 @@ package com.epmet.dto;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@ -68,7 +69,7 @@ public class IcBuildingDTO implements Serializable {
/** /**
* 排序 * 排序
*/ */
private Integer sort; private BigDecimal sort;
/** /**
* 总单元数 * 总单元数

6
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcHouseDTO.java

@ -20,6 +20,7 @@ package com.epmet.dto;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@ -105,6 +106,11 @@ public class IcHouseDTO implements Serializable {
*/ */
private String ownerIdCard; private String ownerIdCard;
/**
* 排序
*/
private BigDecimal sort;
/** /**
* 删除标识 0未删除1已删除 * 删除标识 0未删除1已删除
*/ */

3
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/ImportGeneralDTO.java

@ -4,6 +4,7 @@ import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
/** /**
* @Author zxc * @Author zxc
@ -171,5 +172,5 @@ public class ImportGeneralDTO implements Serializable {
/** /**
* 排序 * 排序
*/ */
private Integer sort; private BigDecimal sort;
} }

5
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBuildingListFormDTO.java

@ -26,4 +26,9 @@ public class IcBuildingListFormDTO extends PageFormDTO {
* 房主电话 * 房主电话
*/ */
private String ownerPhone; private String ownerPhone;
/**
* asc正序desc倒序
*/
private String sortType;
} }

4
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingAddFormDTO.java

@ -17,6 +17,7 @@
package com.epmet.dto.form; package com.epmet.dto.form;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
@ -24,6 +25,7 @@ import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
@Data @Data
@ -85,7 +87,7 @@ public class IcBulidingAddFormDTO implements Serializable {
* 排序 * 排序
*/ */
@NotNull(message = "排序不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class}) @NotNull(message = "排序不能为空", groups = {AddShowGroup.class, UpdateShowGroup.class})
private Integer sort = 0; private BigDecimal sort = NumConstant.ZERO_DECIMAL;
/** /**
* 总单元数 * 总单元数

4
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseAddFormDTO.java

@ -17,12 +17,14 @@
package com.epmet.dto.form; package com.epmet.dto.form;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
@Data @Data
@ -99,4 +101,6 @@ public class IcHouseAddFormDTO implements Serializable {
*/ */
private String ownerIdCard; private String ownerIdCard;
private BigDecimal sort = NumConstant.ZERO_DECIMAL;
} }

4
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcHouseListFormDTO.java

@ -65,5 +65,9 @@ public class IcHouseListFormDTO extends PageFormDTO {
*/ */
private String keyword; private String keyword;
/**
* asc正序desc倒序
*/
private String sortType;
} }

32
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateSortFormDTO.java

@ -0,0 +1,32 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Author zxc
* @DateTime 2022/5/5 17:40
* @DESC
*/
@Data
public class UpdateSortFormDTO implements Serializable {
private static final long serialVersionUID = 2348273552712227952L;
public interface UpdateSortForm{}
@NotBlank(message = "id不能为空",groups = UpdateSortForm.class)
private String id;
@NotNull(message = "sort不能为空",groups = UpdateSortForm.class)
private BigDecimal sort;
/**
* house房屋building楼栋
*/
@NotBlank(message = "type不能为空",groups = UpdateSortForm.class)
private String type;
}

2
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBuildingListResultDTO.java

@ -29,7 +29,7 @@ public class IcBuildingListResultDTO extends PageFormDTO {
private Integer realTotalHouseNum; private Integer realTotalHouseNum;
private String latitude; private String latitude;
private String agencyId; private String agencyId;
private Integer sort; private Double sort;
private String agencyName; private String agencyName;
private String buildingId; private String buildingId;
private String buildingName; private String buildingName;

2
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcHouseListResultDTO.java

@ -79,7 +79,7 @@ public class IcHouseListResultDTO implements Serializable {
*/ */
private String ownerIdCard; private String ownerIdCard;
private Double sort;
} }

12
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java

@ -294,4 +294,16 @@ public class HouseController implements ResultDataResolver {
return new Result<List<SubUserHouseListResultDTO>>().ok(houseService.subUserHouseList(formDTO)); return new Result<List<SubUserHouseListResultDTO>>().ok(houseService.subUserHouseList(formDTO));
} }
/**
* Desc: 根据类型更新排序
* @param formDTO
* @author zxc
* @date 2022/5/6 08:50
*/
@PostMapping("update-sort")
public Result updateSort(@RequestBody UpdateSortFormDTO formDTO){
houseService.updateSort(formDTO);
return new Result();
}
} }

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcBuildingEntity.java

@ -22,6 +22,8 @@ import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
/** /**
* 楼栋信息 * 楼栋信息
* *
@ -63,7 +65,7 @@ public class IcBuildingEntity extends BaseEpmetEntity {
/** /**
* 排序 * 排序
*/ */
private Integer sort; private BigDecimal sort;
/** /**
* 总单元数 * 总单元数

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcHouseEntity.java

@ -23,6 +23,7 @@ import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
/** /**
@ -103,4 +104,9 @@ public class IcHouseEntity extends BaseEpmetEntity {
*/ */
private String ownerIdCard; private String ownerIdCard;
/**
* 排序
*/
private BigDecimal sort;
} }

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcBuildingExcel.java

@ -124,4 +124,10 @@ public class IcBuildingExcel extends ExcelVerifyInfo implements Serializable {
@Excel(name = "户数") @Excel(name = "户数")
@NotNull(message = "不能为空") @NotNull(message = "不能为空")
private Integer totalHouseNum; private Integer totalHouseNum;
@Excel(name = "楼长姓名")
private String buildingLeaderName;
@Excel(name = "楼长电话")
private String buildingLeaderMobile;
} }

5
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/BuildingInfoModel.java

@ -4,6 +4,8 @@ import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
import java.math.BigDecimal;
/** /**
* @Author zxc * @Author zxc
* @DateTime 2022/2/15 10:07 上午 * @DateTime 2022/2/15 10:07 上午
@ -42,6 +44,9 @@ public class BuildingInfoModel {
@ExcelProperty(value = "楼长电话") @ExcelProperty(value = "楼长电话")
private String buildingLeaderMobile; private String buildingLeaderMobile;
@ExcelProperty(value = "排序")
private BigDecimal sort;
@ExcelIgnore @ExcelIgnore
private Integer num; private Integer num;

5
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/HouseInfoModel.java

@ -5,6 +5,8 @@ import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data; import lombok.Data;
import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.Length;
import java.math.BigDecimal;
/** /**
* @Author zxc * @Author zxc
* @DateTime 2022/2/13 1:26 下午 * @DateTime 2022/2/13 1:26 下午
@ -50,6 +52,9 @@ public class HouseInfoModel {
@ExcelProperty(value = "房主身份证") @ExcelProperty(value = "房主身份证")
private String ownerIdCard; private String ownerIdCard;
@ExcelProperty(value = "排序")
private BigDecimal sort;
@ExcelIgnore @ExcelIgnore
private Integer num; private Integer num;

14
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportBuildingInfoListener.java

@ -24,6 +24,8 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -117,6 +119,11 @@ public class ImportBuildingInfoListener extends AnalysisEventListener<BuildingIn
disposeErrorMsg(info,"单元数的值未填写"); disposeErrorMsg(info,"单元数的值未填写");
return; return;
} }
if (null == data.getSort()){
data.setSort(NumConstant.ZERO_DECIMAL);
}else {
data.setSort(getBigDecimal(data.getSort()));
}
// 应产品要求添加 // 应产品要求添加
if (StringUtils.isNotBlank(dto.getType()) && (!dto.getType().equals("商品房") && !dto.getType().equals("自建房")) && !dto.getType().equals("别墅")){ if (StringUtils.isNotBlank(dto.getType()) && (!dto.getType().equals("商品房") && !dto.getType().equals("自建房")) && !dto.getType().equals("别墅")){
nums.add(num); nums.add(num);
@ -137,6 +144,13 @@ public class ImportBuildingInfoListener extends AnalysisEventListener<BuildingIn
} }
} }
public BigDecimal getBigDecimal(BigDecimal d){
if (null == d){
return NumConstant.ZERO_DECIMAL;
}
return d.setScale(NumConstant.TWO,BigDecimal.ROUND_HALF_UP);
}
public void finalDispose(){ public void finalDispose(){
if (CollectionUtils.isEmpty(needDisposeList)){ if (CollectionUtils.isEmpty(needDisposeList)){
return; return;

15
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java

@ -30,6 +30,8 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -172,7 +174,11 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
} }
} }
dto.setHouseType(HouseTypeEnums.getKeyByValue(dto.getHouseType())); dto.setHouseType(HouseTypeEnums.getKeyByValue(dto.getHouseType()));
if (null == data.getSort()){
data.setSort(NumConstant.ZERO_DECIMAL);
}else {
data.setSort(getBigDecimal(data.getSort()));
}
if (StringUtils.isNotBlank(dto.getPurpose()) && (!dto.getPurpose().equals("住宅") && if (StringUtils.isNotBlank(dto.getPurpose()) && (!dto.getPurpose().equals("住宅") &&
!dto.getPurpose().equals("商业") && !dto.getPurpose().equals("商业") &&
!dto.getPurpose().equals("办公") && !dto.getPurpose().equals("办公") &&
@ -207,6 +213,13 @@ public class ImportHouseInfoListener extends AnalysisEventListener<HouseInfoMode
} }
} }
public BigDecimal getBigDecimal(BigDecimal d){
if (null == d){
return NumConstant.ZERO_DECIMAL;
}
return d.setScale(NumConstant.TWO,BigDecimal.ROUND_HALF_UP);
}
public void disposeErrorMsg(HouseInfoModel data,String msg){ public void disposeErrorMsg(HouseInfoModel data,String msg){
HouseErrorInfoModel err = ConvertUtils.sourceToTarget(data, HouseErrorInfoModel.class); HouseErrorInfoModel err = ConvertUtils.sourceToTarget(data, HouseErrorInfoModel.class);
err.setErrorMsg(msg); err.setErrorMsg(msg);

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java

@ -86,4 +86,12 @@ public interface HouseService {
* @Description 人房下级人房概览列表 * @Description 人房下级人房概览列表
**/ **/
List<SubUserHouseListResultDTO> subUserHouseList(HouseChartFormDTO formDTO); List<SubUserHouseListResultDTO> subUserHouseList(HouseChartFormDTO formDTO);
/**
* Desc: 根据类型更新排序
* @param formDTO
* @author zxc
* @date 2022/5/6 08:50
*/
void updateSort(UpdateSortFormDTO formDTO);
} }

9
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java

@ -157,7 +157,10 @@ public class BuildingServiceImpl implements BuildingService {
//2.获取组织所在网格 //2.获取组织所在网格
List<String> agencyIdList = customerAgencyList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList()); List<String> agencyIdList = customerAgencyList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList());
// agencyIdList.add(customerAgency.getId()); // agencyIdList.add(customerAgency.getId());
List<CustomerGridEntity> customerGridList = customerGridDao.selectList(new QueryWrapper<CustomerGridEntity>().lambda().in(CustomerGridEntity::getPid, agencyIdList)); LambdaQueryWrapper<CustomerGridEntity> gridWrapper = new LambdaQueryWrapper<>();
gridWrapper.in(CustomerGridEntity::getPid, agencyIdList);
gridWrapper.last("ORDER BY CAST(GRID_NAME AS SIGNED),CONVERT(GRID_NAME using gbk)");
List<CustomerGridEntity> customerGridList = customerGridDao.selectList(gridWrapper);
if (CollectionUtils.isEmpty(customerGridList)) { if (CollectionUtils.isEmpty(customerGridList)) {
return covertToTree(customerAgency, agencyList); return covertToTree(customerAgency, agencyList);
@ -182,7 +185,7 @@ public class BuildingServiceImpl implements BuildingService {
List<String> gridIdList = customerGridList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList()); List<String> gridIdList = customerGridList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList());
LambdaQueryWrapper<IcNeighborHoodEntity> queryWrapper = new QueryWrapper<IcNeighborHoodEntity>().lambda() LambdaQueryWrapper<IcNeighborHoodEntity> queryWrapper = new QueryWrapper<IcNeighborHoodEntity>().lambda()
.in(IcNeighborHoodEntity::getGridId, gridIdList) .in(IcNeighborHoodEntity::getGridId, gridIdList)
.orderByAsc(IcNeighborHoodEntity::getCreatedTime); .last("ORDER BY CAST(NEIGHBOR_HOOD_NAME AS SIGNED),CONVERT(NEIGHBOR_HOOD_NAME using gbk)");
List<IcNeighborHoodEntity> icNeighborHoodList = icNeighborHoodDao.selectList(queryWrapper); List<IcNeighborHoodEntity> icNeighborHoodList = icNeighborHoodDao.selectList(queryWrapper);
if (CollectionUtils.isEmpty(icNeighborHoodList)) { if (CollectionUtils.isEmpty(icNeighborHoodList)) {
agencyList.addAll(gridList); agencyList.addAll(gridList);
@ -206,7 +209,7 @@ public class BuildingServiceImpl implements BuildingService {
List<String> neighborHoodIdList = icNeighborHoodList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList()); List<String> neighborHoodIdList = icNeighborHoodList.stream().map(BaseEpmetEntity::getId).collect(Collectors.toList());
LambdaQueryWrapper<IcBuildingEntity> buildingQueryWrapper = new QueryWrapper<IcBuildingEntity>().lambda() LambdaQueryWrapper<IcBuildingEntity> buildingQueryWrapper = new QueryWrapper<IcBuildingEntity>().lambda()
.in(IcBuildingEntity::getNeighborHoodId, neighborHoodIdList) .in(IcBuildingEntity::getNeighborHoodId, neighborHoodIdList)
.orderByAsc(IcBuildingEntity::getCreatedTime, IcBuildingEntity::getBuildingName); .last("ORDER BY SORT, CAST(BUILDING_NAME AS SIGNED),CONVERT(BUILDING_NAME USING gbk)");
List<IcBuildingEntity> icBuildingList = icBuildingDao.selectList(buildingQueryWrapper); List<IcBuildingEntity> icBuildingList = icBuildingDao.selectList(buildingQueryWrapper);
if (CollectionUtils.isEmpty(neighborHoodIdList)) { if (CollectionUtils.isEmpty(neighborHoodIdList)) {

20
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java

@ -137,6 +137,8 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
//设置 //设置
icHouseDTO.setHouseName(getHouseName(formDTO)); icHouseDTO.setHouseName(getHouseName(formDTO));
icHouseService.update(icHouseDTO); icHouseService.update(icHouseDTO);
//删除房屋缓存
icHouseRedis.delHouseInfo(formDTO.getHouseId(),customerId);
} }
@Override @Override
@ -455,6 +457,24 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
return resultList; return resultList;
} }
/**
* Desc: 根据类型更新排序
* @param formDTO
* @author zxc
* @date 2022/5/6 08:50
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateSort(UpdateSortFormDTO formDTO) {
if (formDTO.getType().equals(CustomerGridConstant.HOUSE)){
IcHouseDTO icHouseDTO = ConvertUtils.sourceToTarget(formDTO, IcHouseDTO.class);
icHouseService.update(icHouseDTO);
}else if(formDTO.getType().equals(CustomerGridConstant.BUILDING)){
IcBuildingDTO icBuildingDTO = ConvertUtils.sourceToTarget(formDTO, IcBuildingDTO.class);
icBuildingService.update(icBuildingDTO);
}
}
/** /**
* @Author sun * @Author sun
* @Description 人房房屋居民统计列表数据 * @Description 人房房屋居民统计列表数据

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java

@ -625,7 +625,7 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
buildingEntity.setNeighborHoodId(info.getNeighborHoodId()); buildingEntity.setNeighborHoodId(info.getNeighborHoodId());
buildingEntity.setBuildingName(info.getBuildingName()); buildingEntity.setBuildingName(info.getBuildingName());
buildingEntity.setType(null == info.getType()?NumConstant.ONE_STR:info.getType()); buildingEntity.setType(null == info.getType()?NumConstant.ONE_STR:info.getType());
buildingEntity.setSort(NumConstant.ZERO); buildingEntity.setSort(info.getSort());
buildingEntity.setTotalUnitNum(info.getTotalUnitNum()); buildingEntity.setTotalUnitNum(info.getTotalUnitNum());
buildingEntity.setTotalFloorNum(info.getTotalFloorNum()); buildingEntity.setTotalFloorNum(info.getTotalFloorNum());
buildingEntity.setTotalHouseNum(info.getTotalHouseNum()); buildingEntity.setTotalHouseNum(info.getTotalHouseNum());

3
epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.18__edit_building_and_house_sort.sql

@ -0,0 +1,3 @@
ALTER TABLE ic_building DROP SORT;
alter table ic_building add COLUMN SORT DECIMAL(6,2) comment '排序' DEFAULT 0.00 AFTER BUILDING_LEADER_NAME;
alter table ic_house add COLUMN SORT DECIMAL(6,2) comment '排序' DEFAULT 0.00 AFTER OWNER_ID_CARD;

BIN
epmet-module/gov-org/gov-org-server/src/main/resources/excel/building_export.xlsx

Binary file not shown.

BIN
epmet-module/gov-org/gov-org-server/src/main/resources/excel/building_template.xlsx

Binary file not shown.

BIN
epmet-module/gov-org/gov-org-server/src/main/resources/excel/house_template.xlsx

Binary file not shown.

12
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml

@ -50,6 +50,7 @@
TOTAL_HOUSE_NUM = #{totalHouseNum}, TOTAL_HOUSE_NUM = #{totalHouseNum},
BUILDING_LEADER_NAME = #{buildingLeaderName}, BUILDING_LEADER_NAME = #{buildingLeaderName},
BUILDING_LEADER_MOBILE = #{buildingLeaderMobile}, BUILDING_LEADER_MOBILE = #{buildingLeaderMobile},
SORT = #{sort},
UPDATED_TIME = NOW() UPDATED_TIME = NOW()
WHERE ID = #{buildingId} WHERE ID = #{buildingId}
</update> </update>
@ -120,7 +121,11 @@
</if> </if>
AND a.DEL_FLAG = '0' AND a.DEL_FLAG = '0'
</where> </where>
ORDER BY CAST(b.NEIGHBOR_HOOD_NAME AS SIGNED),CONVERT(b.NEIGHBOR_HOOD_NAME using gbk), ORDER BY
<if test='sortType == null '>a.sort,</if>
<if test='sortType != null and sortType == "asc" '>a.sort,</if>
<if test='sortType != null and sortType == "desc" '>a.sort DESC,</if>
CAST(b.NEIGHBOR_HOOD_NAME AS SIGNED),CONVERT(b.NEIGHBOR_HOOD_NAME using gbk),
CAST(a.BUILDING_NAME AS SIGNED),CONVERT(a.BUILDING_NAME USING gbk) CAST(a.BUILDING_NAME AS SIGNED),CONVERT(a.BUILDING_NAME USING gbk)
</select> </select>
<select id="searchAllBuilding" resultType="com.epmet.excel.IcBuildingExcel"> <select id="searchAllBuilding" resultType="com.epmet.excel.IcBuildingExcel">
@ -133,7 +138,9 @@
a.TYPE as type, a.TYPE as type,
b.NEIGHBOR_HOOD_NAME as neighborHoodName, b.NEIGHBOR_HOOD_NAME as neighborHoodName,
c.ORGANIZATION_NAME as agencyName, c.ORGANIZATION_NAME as agencyName,
d.GRID_NAME as gridName d.GRID_NAME as gridName,
a.BUILDING_LEADER_NAME AS buildingLeaderName,
a.BUILDING_LEADER_MOBILE AS buildingLeaderMobile
from ic_building a from ic_building a
LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID and b.DEL_FLAG='0' LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID and b.DEL_FLAG='0'
@ -179,6 +186,7 @@
ca.del_flag = '0' ca.del_flag = '0'
and and
CONCAT(':',ca.pids, ':') like CONCAT('%:',#{agencyId},':%') CONCAT(':',ca.pids, ':') like CONCAT('%:',#{agencyId},':%')
ORDER BY CAST(organization_name AS SIGNED),CONVERT(organization_name using gbk)
</select> </select>
<select id="selectListByName" resultType="map"> <select id="selectListByName" resultType="map">

14
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml

@ -60,6 +60,11 @@
when id = #{h.houseId} then #{h.ownerIdCard} when id = #{h.houseId} then #{h.ownerIdCard}
</foreach> </foreach>
</trim> </trim>
<trim prefix="SORT =(case" suffix="end),">
<foreach collection="houses" item="h">
when id = #{h.houseId} then #{h.sort}
</foreach>
</trim>
UPDATED_TIME = NOW() UPDATED_TIME = NOW()
</trim> </trim>
WHERE DEL_FLAG = '0' WHERE DEL_FLAG = '0'
@ -106,7 +111,8 @@
c.AGENCY_ID as agencyId, c.AGENCY_ID as agencyId,
ag.ORGANIZATION_NAME agencyName, ag.ORGANIZATION_NAME agencyName,
c.GRID_ID as gridId, c.GRID_ID as gridId,
gr.GRID_NAME gr.GRID_NAME,
a.sort
from ic_house a from ic_house a
LEFT JOIN ic_building b on a.BUILDING_ID = b.ID and b.DEL_FLAG = '0' LEFT JOIN ic_building b on a.BUILDING_ID = b.ID and b.DEL_FLAG = '0'
LEFT JOIN ic_neighbor_hood c on a.NEIGHBOR_HOOD_ID = c.ID and c.DEL_FLAG = '0' LEFT JOIN ic_neighbor_hood c on a.NEIGHBOR_HOOD_ID = c.ID and c.DEL_FLAG = '0'
@ -152,7 +158,11 @@
and a.del_flag = '0' and a.del_flag = '0'
</where> </where>
#排序规则:根据小区、楼栋、单元、门牌号(分别按照数字和中文)分别升序排序 #排序规则:根据小区、楼栋、单元、门牌号(分别按照数字和中文)分别升序排序
ORDER BY CONVERT(c.NEIGHBOR_HOOD_NAME using gbk), ORDER BY
<if test='sortType == null '>a.sort,</if>
<if test='sortType != null and sortType == "asc" '>a.sort,</if>
<if test='sortType != null and sortType == "desc" '>a.sort DESC,</if>
CONVERT(c.NEIGHBOR_HOOD_NAME using gbk),
CONVERT(b.BUILDING_NAME USING gbk), CONVERT(b.BUILDING_NAME USING gbk),
CONVERT(d.UNIT_NAME USING gbk), CONVERT(d.UNIT_NAME USING gbk),
CAST(a.DOOR_NAME AS SIGNED), CAST(a.DOOR_NAME AS SIGNED),

5
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FormItemBaseResult.java

@ -55,5 +55,10 @@ public class FormItemBaseResult implements Serializable {
*/ */
private String optionSourceValue; private String optionSourceValue;
/**
* 是否支持添加即多对一eg需求列表
*/
private boolean supportAdd;
} }

4
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemDao.xml

@ -232,7 +232,8 @@
ifig.TABLE_NAME, ifig.TABLE_NAME,
CONCAT(ifi.COLUMN_NAME, if(ifi.COLUMN_NUM = 0, '', ifi.COLUMN_NUM)) columnName, CONCAT(ifi.COLUMN_NAME, if(ifi.COLUMN_NUM = 0, '', ifi.COLUMN_NUM)) columnName,
ifi.OPTION_SOURCE_TYPE, ifi.OPTION_SOURCE_TYPE,
ifi.OPTION_SOURCE_VALUE ifi.OPTION_SOURCE_VALUE,
ifig.SUPPORT_ADD
FROM FROM
ic_form_item ifi ic_form_item ifi
LEFT JOIN ic_form_item_group ifig ON ifi.ITEM_GROUP_ID = ifig.ID LEFT JOIN ic_form_item_group ifig ON ifi.ITEM_GROUP_ID = ifig.ID
@ -251,6 +252,7 @@
ifi.OPTION_SOURCE_VALUE, ifi.OPTION_SOURCE_VALUE,
ifi.OPTION_SOURCE_TYPE, ifi.OPTION_SOURCE_TYPE,
ifig.TABLE_NAME, ifig.TABLE_NAME,
ifig.SUPPORT_ADD,
CONCAT(ifi.COLUMN_NAME, if(ifi.COLUMN_NUM = 0, '', ifi.COLUMN_NUM)) columnName CONCAT(ifi.COLUMN_NAME, if(ifi.COLUMN_NUM = 0, '', ifi.COLUMN_NUM)) columnName
FROM FROM
ic_form_item ifi ic_form_item ifi

4
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CollectListFormDTO.java

@ -28,4 +28,8 @@ public class CollectListFormDTO extends PageFormDTO {
private String userId; private String userId;
private String customerId; private String customerId;
/**
* 查看详情入参
*/
private String id;
} }

3
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/CollectListResultDTO.java

@ -1,6 +1,5 @@
package com.epmet.dto.result; package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -21,7 +20,7 @@ public class CollectListResultDTO implements Serializable {
*/ */
private String houseHolderName; private String houseHolderName;
@JsonIgnore // @JsonIgnore
private String id; private String id;
/** /**

18
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java

@ -20,10 +20,7 @@ import com.epmet.dto.result.CollectListResultDTO;
import com.epmet.dto.result.LatestCollectResDTO; import com.epmet.dto.result.LatestCollectResDTO;
import com.epmet.service.IcResiCollectService; import com.epmet.service.IcResiCollectService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList; import java.util.ArrayList;
@ -81,6 +78,19 @@ public class IcResiCollectController {
return new Result<PageData<CollectListResultDTO>>().ok(icResiCollectService.getCollectList(formDTO)); return new Result<PageData<CollectListResultDTO>>().ok(icResiCollectService.getCollectList(formDTO));
} }
/**
* 信息采集-详情
* @param formDTO
* @param tokenDto
* @return
*/
@PostMapping("detail")
public Result<CollectListResultDTO> detail(@RequestBody CollectListFormDTO formDTO, @LoginUser TokenDto tokenDto) {
formDTO.setUserId(tokenDto.getUserId());
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<CollectListResultDTO>().ok(icResiCollectService.detail(formDTO));
}
/** /**
* Desc: 查询采集居民信息 * Desc: 查询采集居民信息
* @param formDTO * @param formDTO

7
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiCollectService.java

@ -49,4 +49,11 @@ public interface IcResiCollectService extends BaseService<IcResiCollectEntity> {
* @return * @return
*/ */
LatestCollectResDTO latestSubmit(LatestSubmitCollectFormDTO formDTO); LatestCollectResDTO latestSubmit(LatestSubmitCollectFormDTO formDTO);
/**
* 信息采集详情
* @param formDTO
* @return
*/
CollectListResultDTO detail(CollectListFormDTO formDTO);
} }

14
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiCollectServiceImpl.java

@ -115,6 +115,20 @@ public class IcResiCollectServiceImpl extends BaseServiceImpl<IcResiCollectDao,
return result; return result;
} }
/**
* 信息采集详情
*
* @param formDTO
* @return
*/
@Override
public CollectListResultDTO detail(CollectListFormDTO formDTO) {
List<CollectListResultDTO> list = baseDao.getCollectList(formDTO);
if (CollectionUtils.isNotEmpty(list)) {
return list.get(NumConstant.ZERO);
}
return null;
}
private IcNeighborHoodDTO queryIcNeighborHood(String villageId) { private IcNeighborHoodDTO queryIcNeighborHood(String villageId) {
Result<IcNeighborHoodDTO> res = govOrgOpenFeignClient.getIcNeighbordhoodById(villageId); Result<IcNeighborHoodDTO> res = govOrgOpenFeignClient.getIcNeighbordhoodById(villageId);

17
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java

@ -8,6 +8,7 @@ import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.Constant;
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.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.form.IcExportTemplateSaveFormDTO; import com.epmet.commons.tools.dto.form.IcExportTemplateSaveFormDTO;
@ -20,6 +21,7 @@ import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Md5Util;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter;
@ -190,18 +192,21 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService {
FormItemResult formItemResult = exportResiUserItemDTO.getItemMap().get(columnName); FormItemResult formItemResult = exportResiUserItemDTO.getItemMap().get(columnName);
String newValue = vauleStr; String newValue = vauleStr;
if (Constant.OPITON_SOURCE_REMOTE.equals(sqlColumn.getOptionSourceType()) && StringUtils.isNotBlank(vauleStr)) { if (Constant.OPITON_SOURCE_REMOTE.equals(sqlColumn.getOptionSourceType()) && StringUtils.isNotBlank(vauleStr)) {
putRemoteValue(exportResiUserItemDTO.getRemoteItemConditionMap().get(itemId), staffInfoCacheResult.getAgencyId(), o, originalConditionMap, formItemResult, columnName, vauleStr); putRemoteValue(exportResiUserItemDTO.getRemoteItemConditionMap().get(itemId), staffInfoCacheResult.getAgencyId(), o, originalConditionMap, formItemResult, columnName, vauleStr);
newValue = String.valueOf(o.get(columnName)); newValue = String.valueOf(o.get(columnName));
} else if (Constant.OPITON_SOURCE_LOCAL.equals(sqlColumn.getOptionSourceType())) { } else if (Constant.OPITON_SOURCE_LOCAL.equals(sqlColumn.getOptionSourceType())) {
newValue = putOptionValue(formItemResult, vauleStr); newValue = putOptionValue(formItemResult, vauleStr);
} }
if (FieldConstant.ID.equals(key)) {
newValue = Md5Util.md5(vauleStr);
}
singleRowData.add(newValue); singleRowData.add(newValue);
}); });
resultData.add(singleRowData); resultData.add(singleRowData);
}); });
excelWriter.write(resultData, writeSheet); excelWriter.write(resultData, writeSheet);
break;
} while (mapListPage.getResult().size() == searchForm.getPageSize()); } while (mapListPage.getResult().size() == searchForm.getPageSize());
} catch (IOException e) { } catch (IOException e) {
log.error("exportIcResiUser exception", e); log.error("exportIcResiUser exception", e);
@ -242,10 +247,10 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService {
} }
IcCustomExportResultDTO data = exportConfigResult.getData(); IcCustomExportResultDTO data = exportConfigResult.getData();
//添加一个虚拟列Id 用于分组 //添加一个虚拟列Id 用于分组 合并单元格
data.getShowSqlColumns().add(0, new IcCustomExportResultDTO.SqlColumn(null, "ic_resi_user", false, "ID", "local")); data.getShowSqlColumns().add(0, new IcCustomExportResultDTO.SqlColumn(null, "ic_resi_user", false, FieldConstant.ID, "local"));
List<String> id = new ArrayList<>(); List<String> id = new ArrayList<>();
id.add("ID"); id.add(FieldConstant.ID);
data.getHeaders().add(0, id); data.getHeaders().add(0, id);
return exportConfigResult; return exportConfigResult;
} }
@ -278,7 +283,6 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService {
List<String> listOptions = new ArrayList<>(); List<String> listOptions = new ArrayList<>();
String[] split = vauleStr.split(StrConstant.COMMA); String[] split = vauleStr.split(StrConstant.COMMA);
Arrays.stream(split).forEach((value) -> { Arrays.stream(split).forEach((value) -> {
//todo 看看怎么更好的利用本地缓存
OptionResultDTO optionResultDTO = remoteOptionMap.get(value); OptionResultDTO optionResultDTO = remoteOptionMap.get(value);
if (optionResultDTO != null) { if (optionResultDTO != null) {
listOptions.add(optionResultDTO.getLabel()); listOptions.add(optionResultDTO.getLabel());
@ -318,7 +322,7 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService {
//如果是多选 则返回顿号隔开 //如果是多选 则返回顿号隔开
if (e.getMultiSelect()) { if (e.getMultiSelect()) {
List<String> valueList = new ArrayList<>(); List<String> valueList = new ArrayList<>();
e.getOptions().stream().forEach(option -> { e.getOptions().forEach(option -> {
if (valueStr.contains(option.getValue())) { if (valueStr.contains(option.getValue())) {
valueList.add(option.getLabel()); valueList.add(option.getLabel());
} }
@ -338,6 +342,7 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService {
} }
break; break;
default: default:
return valueStr;
} }
return valueStr; return valueStr;
} }

84
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java

@ -85,10 +85,24 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
public static final List<String> controlGroup1 = Arrays.asList("input", "textarea", "datepicker", "daterange"); public static final List<String> controlGroup1 = Arrays.asList("input", "textarea", "datepicker", "daterange");
public static final List<String> controlGroup2 = Arrays.asList("select", "radio"); public static final List<String> controlGroup2 = Arrays.asList("select", "radio");
// 身份证号的正则表达式 /**
* 15位身份证号的正则表达式
*/
private final Pattern PATTERN_15_ID = Pattern.compile("^\\d{6}(?<year>\\d{2})(?<month>0[1-9]|1[0-2])(?<day>[0-2][0-9]|3[0-1])\\d{2}(?<sex>\\d)$"); private final Pattern PATTERN_15_ID = Pattern.compile("^\\d{6}(?<year>\\d{2})(?<month>0[1-9]|1[0-2])(?<day>[0-2][0-9]|3[0-1])\\d{2}(?<sex>\\d)$");
/**
* 18位身份证号的正则表达式
*/
private final Pattern PATTERN_18_ID = Pattern.compile("^\\d{6}(?<year>\\d{4})(?<month>0[1-9]|1[0-2])(?<day>[0-2][0-9]|3[0-1])\\d{2}(?<sex>\\d)[0-9a-xA-X]$"); private final Pattern PATTERN_18_ID = Pattern.compile("^\\d{6}(?<year>\\d{4})(?<month>0[1-9]|1[0-2])(?<day>[0-2][0-9]|3[0-1])\\d{2}(?<sex>\\d)[0-9a-xA-X]$");
/**
* 日期解析不含时间
*/
private final Pattern PATTERN_DATE_PICKER = Pattern.compile("^(\\d{4})[-/](0?[1-9]|1[0-2])[-/](3[0-1]|[0-2]?\\d).*$");
/**
* daterange的解析1992-01-20,1992-01-30
*/
private final Pattern PATTERN_DATE_RANGE = Pattern.compile("^(\\d{4})[-/](0?[1-9]|1[0-2])[-/](3[0-1]|[0-2]?\\d).*,(\\d{4})[-/](0?[1-9]|1[0-2])[-/](3[0-1]|[0-2]?\\d).*$");
/** /**
* 身份证号列序号 * 身份证号列序号
*/ */
@ -149,7 +163,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
private OssFeignClient ossFeignClient; private OssFeignClient ossFeignClient;
/** /**
* 字表中不需要的 * 子表中不需要的列因为主表中需要身份证号网格等信息但子表中不需要这些列必填只要有身份证号即可因此字表判断的时候需要排除这些
*/ */
private List<String> subTableNeedlessColumns = Arrays.asList("GRID_ID", "VILLAGE_ID", "BUILD_ID", "UNIT_ID", "HOME_ID", private List<String> subTableNeedlessColumns = Arrays.asList("GRID_ID", "VILLAGE_ID", "BUILD_ID", "UNIT_ID", "HOME_ID",
"IS_BDHJ", "NAME", "MOBILE", "GENDER", "ID_CARD", "IS_BDHJ", "NAME", "MOBILE", "GENDER", "ID_CARD",
@ -620,8 +634,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
Boolean isMale = (Integer.parseInt(sex) % 2) == 1; Boolean isMale = (Integer.parseInt(sex) % 2) == 1;
columnAndValues.put("BIRTHDAY", String.join("-", Arrays.asList(year, month,day))); columnAndValues.put("BIRTHDAY", String.join("-", Arrays.asList(year, month,day)));
columnAndValues.put("GENDER", isMale ? "1" : "2"); columnAndValues.put("GENDER", isMale ? "1" : "2");
columnAndValues.put("IS_OLD_PEOPLE", age > 60 ? "1" : "0"); columnAndValues.put("IS_OLD_PEOPLE", age >= 60 ? "1" : "0");
System.out.println(6);
} }
/** /**
@ -695,7 +708,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
} catch (Exception e) { } catch (Exception e) {
String errorMsg; String errorMsg;
if (e instanceof RenException) { if (e instanceof RenException || e instanceof EpmetException) {
errorMsg = e.getMessage(); errorMsg = e.getMessage();
} else { } else {
errorMsg = "未知系统错误"; errorMsg = "未知系统错误";
@ -792,6 +805,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
String notFoundColumnName = null; String notFoundColumnName = null;
List<String> emptyColumnNames = new ArrayList<>(); List<String> emptyColumnNames = new ArrayList<>();
List<String> patternErrorColumnNames = new ArrayList<>();
// 这两列要提前放进去,因为有的列未填写的话,会抛异常出去,需要用这两列来做描述 // 这两列要提前放进去,因为有的列未填写的话,会抛异常出去,需要用这两列来做描述
target2Insert.put("ID_CARD", row.get(ID_CARD_COLUMN_NO)); target2Insert.put("ID_CARD", row.get(ID_CARD_COLUMN_NO));
@ -823,6 +837,13 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
continue; continue;
} }
// 日期控件的数据校验和清晰
boolean dateError = dateTypeCheckAndWash(columnWrapper, patternErrorColumnNames);
if (dateError) {
hasError = dateError;
continue;
}
// "select", "radio" // "select", "radio"
} else if (controlGroup2.contains(columnWrapper.getItemType())){ } else if (controlGroup2.contains(columnWrapper.getItemType())){
@ -916,10 +937,63 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
sb.append(notFoundColumnName).append("填写的值在系统中未找到"); sb.append(notFoundColumnName).append("填写的值在系统中未找到");
} }
if (CollectionUtils.isNotEmpty(patternErrorColumnNames)) {
sb.append(String.join(",", patternErrorColumnNames)).append("的值格式错误");
}
throw new EpmetException(sb.toString()); throw new EpmetException(sb.toString());
} }
} }
/**
* 处理一下日期类型的数据
* @param columnWrapper
* @param patternErrorColumnNames
* @return true:有错误false没错误
*/
private boolean dateTypeCheckAndWash(ColumnWrapper columnWrapper, List<String> patternErrorColumnNames) {
// 日期格式不对的检查
String cellContent = columnWrapper.getCellContent();
if (StringUtils.isBlank(cellContent)) {
return false;
}
if ("datepicker".equals(columnWrapper.getItemType())) {
Matcher matcher = PATTERN_DATE_PICKER.matcher(cellContent);
if (matcher.matches()) {
String year = matcher.group(1);
String month = matcher.group(2);
String day = matcher.group(3);
cellContent = String.format("%s-%02d-%02d", year, Integer.parseInt(month), Integer.parseInt(day));
columnWrapper.setCellContent(cellContent);
columnWrapper.setColValue(cellContent);
} else {
patternErrorColumnNames.add(columnWrapper.getCombinedLabel());
return true;
}
} else if ("daterange".equals(columnWrapper.getItemType())) {
Matcher matcher = PATTERN_DATE_RANGE.matcher(cellContent);
if (matcher.matches()) {
String year = matcher.group(1);
String month = matcher.group(2);
String day = matcher.group(3);
String yearEnd = matcher.group(4);
String monthEnd = matcher.group(5);
String dayEnd = matcher.group(6);
cellContent = String.format("%s-%02d-%02d,%s-%02d-%02d", year, Integer.parseInt(month), Integer.parseInt(day), yearEnd, Integer.parseInt(monthEnd), Integer.parseInt(dayEnd));
columnWrapper.setCellContent(cellContent);
columnWrapper.setColValue(cellContent);
} else {
patternErrorColumnNames.add(columnWrapper.getCombinedLabel());
return true;
}
}
return false;
}
/** /**
* 必填但是用户没填的放到list中 * 必填但是用户没填的放到list中
* @param isPrimaryTable 是否是主表true是主表false从表 * @param isPrimaryTable 是否是主表true是主表false从表

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

@ -1002,11 +1002,13 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
//获取用户信息 //获取用户信息
IcResiUserEntity user = baseDao.selectById(userId); IcResiUserEntity user = baseDao.selectById(userId);
result.setOwnerName(""); result.setOwnerName("");
if (null != user) {
//获取用户所在家庭里所有人员信息 //获取用户所在家庭里所有人员信息
LambdaQueryWrapper<IcResiUserEntity> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IcResiUserEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcResiUserEntity::getHomeId, user.getHomeId()); wrapper.eq(IcResiUserEntity::getHomeId, user.getHomeId());
wrapper.orderByAsc(IcResiUserEntity::getYhzgx); wrapper.orderByAsc(IcResiUserEntity::getYhzgx);
List<IcResiUserEntity> resiUserList = baseDao.selectList(wrapper); List<IcResiUserEntity> resiUserList = baseDao.selectList(wrapper);
if (CollectionUtils.isNotEmpty(resiUserList)) {
List<OwnerRelationResultDTO.UserListBean> userList = resiUserList.stream().map(item -> { List<OwnerRelationResultDTO.UserListBean> userList = resiUserList.stream().map(item -> {
OwnerRelationResultDTO.UserListBean bean = new OwnerRelationResultDTO.UserListBean(); OwnerRelationResultDTO.UserListBean bean = new OwnerRelationResultDTO.UserListBean();
bean.setUserId(item.getId()); bean.setUserId(item.getId());
@ -1022,6 +1024,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
return bean; return bean;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
result.setUserList(userList); result.setUserList(userList);
}
}
return result; return result;
} }

3
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiCollectDao.xml

@ -39,6 +39,9 @@
<if test='endDate != null and endDate != "" '> <if test='endDate != null and endDate != "" '>
AND DATE_FORMAT(c.CREATED_TIME,'%Y-%m-%d') <![CDATA[ <= ]]> #{endDate} AND DATE_FORMAT(c.CREATED_TIME,'%Y-%m-%d') <![CDATA[ <= ]]> #{endDate}
</if> </if>
<if test='id != null and id != "" '>
AND c.id=#{id}
</if>
ORDER BY c.CREATED_TIME DESC ORDER BY c.CREATED_TIME DESC
</select> </select>
<select id="selectMemberList" resultType="com.epmet.dto.result.CollectListResultDTO$CollectListMemberResultDTO"> <select id="selectMemberList" resultType="com.epmet.dto.result.CollectListResultDTO$CollectListMemberResultDTO">

18
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -165,7 +165,13 @@
${groupTableName}.ID ${groupTableName}.ID
</foreach> </foreach>
</if> </if>
order by ic_resi_user.CREATED_TIME desc ORDER BY
IC_RESI_USER.GRID_ID ASC,
IC_RESI_USER.VILLAGE_ID ASC,
IC_RESI_USER.BUILD_ID ASC,
IC_RESI_USER.UNIT_ID ASC,
IC_RESI_USER.HOME_ID ASC,
IC_RESI_USER.ID ASC
</select> </select>
<update id="updateToDel" parameterType="java.lang.String"> <update id="updateToDel" parameterType="java.lang.String">
@ -203,7 +209,12 @@
${groupTableName}.ID ${groupTableName}.ID
</foreach> </foreach>
</if> </if>
order by ic_resi_user.CREATED_TIME desc order by IC_RESI_USER.GRID_ID ASC,
IC_RESI_USER.VILLAGE_ID ASC,
IC_RESI_USER.BUILD_ID ASC,
IC_RESI_USER.UNIT_ID ASC,
IC_RESI_USER.HOME_ID ASC,
IC_RESI_USER.ID ASC
</select> </select>
<!-- 查询个人信息 --> <!-- 查询个人信息 -->
@ -800,6 +811,7 @@
<if test="idCard != null and idCard != ''"> <if test="idCard != null and idCard != ''">
AND a.ID_CARD LIKE concat( '%', #{idCard}, '%' ) AND a.ID_CARD LIKE concat( '%', #{idCard}, '%' )
</if> </if>
ORDER BY GRID_ID,VILLAGE_ID,BUILD_ID,UNIT_ID,HOME_ID, convert(NAME using gbk)
) t ) t
WHERE WHERE
1=1 1=1
@ -809,7 +821,7 @@
<if test="natCount != null"> <if test="natCount != null">
AND natCount = #{natCount} AND natCount = #{natCount}
</if> </if>
ORDER BY `NAME`
</select> </select>
<select id="natList" resultType="com.epmet.dto.result.EpidemicPreventionResultDTO"> <select id="natList" resultType="com.epmet.dto.result.EpidemicPreventionResultDTO">
SELECT * FROM SELECT * FROM

Loading…
Cancel
Save