diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.37__ic_report_fun.sql b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.37__ic_report_fun.sql new file mode 100644 index 0000000000..57e0fe6602 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.37__ic_report_fun.sql @@ -0,0 +1,12 @@ +CREATE TABLE `ic_report_fun` ( + `ID` varchar(64) NOT NULL, + `CUSTOMER_REPORT_ID` varchar(64) NOT NULL COMMENT 'ic_customer_report.id', + `FUN_CATEGORY_KEY` varchar(255) NOT NULL COMMENT '功能类别来源于字典表key;eg:resi_info,house_info', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除;', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间=绑定时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='报表所属功能表'; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java index cb6f89eb76..c6727abd24 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java @@ -11,12 +11,9 @@ import java.io.Serializable; * @Date 2021/10/27 2:06 下午 */ @Data -public class ExportResiUserFormDTO implements Serializable { +public class ExportResiUserFormDTO extends ReportDataFormDTO implements Serializable { private static final long serialVersionUID = 8777535966834678256L; - /** - * 客户Id - */ - private String customerId; + /** * 表单查询条件 */ @@ -31,11 +28,6 @@ public class ExportResiUserFormDTO implements Serializable { */ private IcExportTemplateSaveFormDTO exportConfig; - /** - * pageNo 报表用的 - */ - private Integer pageNo = 1; - private Integer pageSize = 1000; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ReportDataFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ReportDataFormDTO.java new file mode 100644 index 0000000000..6ef39cb1f4 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ReportDataFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.form; + +import lombok.Data; + +/** + * @Description + * @Author yzm + * @Date 2022/8/17 11:13 + */ +@Data +public class ReportDataFormDTO { + /** + * 客户Id + */ + private String customerId; + /** + * pageNo 报表用的 + */ + private Integer pageNo = 1; + private Integer pageSize = 1000; + private String id; +} + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java index f22a744046..8157ac1ccf 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java @@ -31,6 +31,7 @@ import com.epmet.constant.IcResiUserConstant; import com.epmet.dto.form.ExportResiUserFormDTO; import com.epmet.dto.form.IcExportTemplateQueryFormDTO; import com.epmet.dto.form.IcResiUserPageFormDTO; +import com.epmet.dto.form.ResiUserQueryValueDTO; import com.epmet.dto.result.FormItemResult; import com.epmet.dto.result.IcCustomExportResultDTO; import com.epmet.dto.result.OptionDTO; @@ -45,6 +46,7 @@ import com.google.common.base.Joiner; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.ss.usermodel.VerticalAlignment; @@ -103,8 +105,9 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { ExcelWriter excelWriter = null; WriteSheet writeSheet = null; try { + String dynamicCustomerId=StringUtils.isNotBlank(exportResiUserFormDTO.getCustomerId()) ? exportResiUserFormDTO.getCustomerId() : tokenDto.getCustomerId(); //获取用户配置的导出条件 - Result exportConfigResult = this.getIcCustomExportConfig(exportResiUserFormDTO.getCustomerId(), templateId, exportResiUserFormDTO.getExportConfig()); + Result exportConfigResult = this.getIcCustomExportConfig(dynamicCustomerId, templateId, exportResiUserFormDTO.getExportConfig()); Map itemOriginMap = getItemMap(searchForm.getCustomerId()); IcCustomExportResultDTO exportConfigData = exportConfigResult.getData(); @@ -163,6 +166,21 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { allShowColumns.addAll(exportConfigData.getHiddenSqlColumns()); do { + if(StringUtils.isNotBlank(exportResiUserFormDTO.getId())){ + ResiUserQueryValueDTO idCondition=new ResiUserQueryValueDTO(); + idCondition.setTableName("ic_resi_user"); + idCondition.setQueryType("equal"); + idCondition.setColumnName("ID"); + idCondition.setColumnValue(Arrays.asList(exportResiUserFormDTO.getId())); + + if(CollectionUtils.isNotEmpty(searchForm.getConditions())){ + searchForm.getConditions().add(idCondition); + }else{ + List conditions=new ArrayList<>(); + conditions.add(idCondition); + searchForm.setConditions(conditions); + } + } String finalStaffOrgPath = staffOrgPath; mapListPage = PageHelper.startPage(searchForm.getPageNo(), searchForm.getPageSize(), searchForm.getIsPage()).doSelectPage(() -> { icResiUserService.dynamicQuery(searchForm.getCustomerId(), searchForm.getFormCode(), IcResiUserConstant.IC_RESI_USER, allShowColumns, searchForm.getConditions(), staffInfoCacheResult.getAgencyId(), finalStaffOrgPath); @@ -227,10 +245,10 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService { } else if (Constant.OPITON_SOURCE_LOCAL.equals(sqlColumn.getOptionSourceType())) { newValue = putOptionValue(formItemResult, vauleStr); } + o.put(key,newValue); if (FieldConstant.ID.equals(key)) { newValue = Md5Util.md5(vauleStr); } - o.put(key,newValue); singleRowData.add(newValue); }); resultData.add(singleRowData);