From cdd85d9346a77bb0629d5409d12d490cc537c23b Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 8 Aug 2022 13:28:27 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9A=82=E6=8F=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/result/ReportResultDTO.java | 84 +++++++++++++++++++ .../IcCustomerReportController.java | 13 +++ .../com/epmet/dao/IcCustomerReportDao.java | 13 ++- .../service/IcCustomerReportService.java | 9 ++ .../impl/IcCustomerReportServiceImpl.java | 24 ++++++ .../resources/mapper/IcCustomerReportDao.xml | 11 +++ 6 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java new file mode 100644 index 0000000000..cbbc75acca --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java @@ -0,0 +1,84 @@ +package com.epmet.dto.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2022/8/8 10:29 + * @DESC + */ +@Data +public class ReportResultDTO implements Serializable { + + private static final long serialVersionUID = -5798816843431200300L; + + /** + * 报表名字 + */ + private String reportName; + + /** + * 报表ID + */ + private String reportId; + + /** + * 客户ID + */ + @JsonIgnore + private String customerId; + + /** + * 客户名字 + */ + @JsonIgnore + private String customerName; + + /** + * 分类名字 + */ + @JsonIgnore + private String categoryName; + + /** + * 分类key + */ + @JsonIgnore + private String categoryKey; + + /** + * 客户信息集合 + */ + private List customerList; + + + @Data + static class CustomerList implements Serializable{ + + private static final long serialVersionUID = 7146198312265513418L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户名字 + */ + private String customerName; + + /** + * 分类名字 + */ + private String categoryName; + + /** + * 分类key + */ + private String categoryKey; + } +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java index 59725b2cad..39b55f50af 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcCustomerReportController.java @@ -9,10 +9,12 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.IcCustomerReportDTO; +import com.epmet.dto.result.ReportResultDTO; import com.epmet.service.IcCustomerReportService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.List; import java.util.Map; @@ -67,4 +69,15 @@ public class IcCustomerReportController { return new Result(); } + /** + * Desc: 报表集合 + * @param + * @author zxc + * @date 2022/8/8 10:38 + */ + @PostMapping("list") + public Result> reportList(){ + return new Result>().ok(icCustomerReportService.reportList()); + } + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java index 32068db46a..52513402d2 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcCustomerReportDao.java @@ -1,9 +1,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.ReportResultDTO; import com.epmet.entity.IcCustomerReportEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 客户报表关系表 * @@ -12,5 +15,13 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface IcCustomerReportDao extends BaseDao { - + + /** + * Desc: 报表集合 + * @param + * @author zxc + * @date 2022/8/8 10:38 + */ + List reportList(); + } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java index 4f6f9af2cd..544aeb9a83 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcCustomerReportService.java @@ -3,6 +3,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.IcCustomerReportDTO; +import com.epmet.dto.result.ReportResultDTO; import com.epmet.entity.IcCustomerReportEntity; import java.util.List; @@ -75,4 +76,12 @@ public interface IcCustomerReportService extends BaseService reportList(); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index 9350625c0d..206e9c2d74 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -8,12 +8,17 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.IcCustomerReportDao; import com.epmet.dto.IcCustomerReportDTO; +import com.epmet.dto.result.ReportResultDTO; import com.epmet.entity.IcCustomerReportEntity; +import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.service.IcCustomerReportService; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -27,6 +32,9 @@ import java.util.Map; @Service public class IcCustomerReportServiceImpl extends BaseServiceImpl implements IcCustomerReportService { + @Autowired + private EpmetAdminOpenFeignClient adminOpenFeignClient; + @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -79,4 +87,20 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl reportList() { + List reportList = baseDao.reportList(); + if (CollectionUtils.isEmpty(reportList)){ + return new ArrayList<>(); + } + + return null; + } + } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml index 9e4b9347a2..2336b1dc3d 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcCustomerReportDao.xml @@ -3,4 +3,15 @@ + + \ No newline at end of file From 345c885daca9ce4a7d5bc6c76b43ee9eb0c237d2 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 8 Aug 2022 13:59:04 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feigns/JiMuReportOpenFeignClient.java | 14 +++++++ .../JiMuReportOpenFeignClientFallback.java | 11 ++++++ .../tools/constant/ServiceConstant.java | 5 +++ .../tools/dto/form/DictListFormDTO.java | 4 ++ .../com/epmet/dto/result/ReportResultDTO.java | 2 +- .../constant/CustomerFunctionConstant.java | 2 + .../impl/IcCustomerReportServiceImpl.java | 38 ++++++++++++++++++- 7 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java create mode 100644 epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java new file mode 100644 index 0000000000..69f1f84c70 --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java @@ -0,0 +1,14 @@ +package com.epmet.commons.feignclient.feigns; + +import com.epmet.commons.feignclient.feigns.fallback.JiMuReportOpenFeignClientFallback; +import com.epmet.commons.tools.constant.ServiceConstant; +import org.springframework.cloud.openfeign.FeignClient; + +/** + * @Author zxc + * @DateTime 2022/8/8 13:52 + * @DESC + */ +@FeignClient(name = ServiceConstant.JM_REPORT, fallbackFactory = JiMuReportOpenFeignClientFallback.class) +public interface JiMuReportOpenFeignClient { +} diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java new file mode 100644 index 0000000000..f1ca95d23d --- /dev/null +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/fallback/JiMuReportOpenFeignClientFallback.java @@ -0,0 +1,11 @@ +package com.epmet.commons.feignclient.feigns.fallback; + +import com.epmet.commons.feignclient.feigns.JiMuReportOpenFeignClient; + +/** + * @Author zxc + * @DateTime 2022/8/8 13:53 + * @DESC + */ +public class JiMuReportOpenFeignClientFallback implements JiMuReportOpenFeignClient { +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java index 221d7d3f69..b753a7d65b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java @@ -143,4 +143,9 @@ public interface ServiceConstant { * 聚合查询服务 */ String DATA_AGGREGATOR_SERVER = "data-aggregator-server"; + + /** + * + */ + String JM_REPORT = ""; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DictListFormDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DictListFormDTO.java index 1880debe42..88adefbd17 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DictListFormDTO.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DictListFormDTO.java @@ -1,6 +1,8 @@ package com.epmet.commons.tools.dto.form; +import lombok.AllArgsConstructor; import lombok.Data; +import lombok.NoArgsConstructor; import javax.validation.constraints.NotBlank; @@ -9,6 +11,8 @@ import javax.validation.constraints.NotBlank; * @Author sun */ @Data +@AllArgsConstructor +@NoArgsConstructor public class DictListFormDTO { /** diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java index cbbc75acca..0667a0c226 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ReportResultDTO.java @@ -57,7 +57,7 @@ public class ReportResultDTO implements Serializable { @Data - static class CustomerList implements Serializable{ + public static class CustomerList implements Serializable{ private static final long serialVersionUID = 7146198312265513418L; diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/constant/CustomerFunctionConstant.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/constant/CustomerFunctionConstant.java index dc347a7c53..5d41b4453c 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/constant/CustomerFunctionConstant.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/constant/CustomerFunctionConstant.java @@ -23,5 +23,7 @@ public interface CustomerFunctionConstant { */ String PARAMETER_EXCEPTION = "请至少勾选一条默认功能或定制功能数据"; + String REPORT_CATEGORY = "jmreport_category"; + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java index 206e9c2d74..5e8e770abe 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcCustomerReportServiceImpl.java @@ -4,13 +4,21 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.dto.form.DictListFormDTO; +import com.epmet.commons.tools.dto.result.DictListResultDTO; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.CustomerFunctionConstant; import com.epmet.dao.IcCustomerReportDao; +import com.epmet.dto.CustomerDTO; import com.epmet.dto.IcCustomerReportDTO; import com.epmet.dto.result.ReportResultDTO; import com.epmet.entity.IcCustomerReportEntity; import com.epmet.feign.EpmetAdminOpenFeignClient; +import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.service.IcCustomerReportService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -22,6 +30,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 客户报表关系表 @@ -34,6 +43,8 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl page(Map params) { @@ -99,8 +110,31 @@ public class IcCustomerReportServiceImpl extends BaseServiceImpl(); } - - return null; + Result> dictList = adminOpenFeignClient.dictList(new DictListFormDTO(CustomerFunctionConstant.REPORT_CATEGORY)); + if (!dictList.success()){ + throw new EpmetException("查询字典信息失败:" + CustomerFunctionConstant.REPORT_CATEGORY); + } + if (CollectionUtils.isNotEmpty(dictList.getData())){ + dictList.getData().forEach(d -> reportList.stream().filter(r -> d.getValue().equals(r.getCategoryKey())).forEach(r -> r.setCategoryName(d.getLabel()))); + } + Result> allCustomerList = operCrmOpenFeignClient.getAllCustomerList(); + if (!allCustomerList.success()){ + throw new EpmetException("获取客户信息失败..."); + } + if (CollectionUtils.isNotEmpty(allCustomerList.getData())){ + allCustomerList.getData().forEach(c -> reportList.stream().filter(r -> c.getId().equals(r.getCustomerId())).forEach(r -> r.setCustomerName(c.getCustomerName()))); + } + // todo 报表 + List result = new ArrayList<>(); + Map> groupByReport = reportList.stream().collect(Collectors.groupingBy(ReportResultDTO::getReportId)); + groupByReport.forEach((reportId,l) -> { + ReportResultDTO dto = new ReportResultDTO(); + dto.setReportId(reportId); + dto.setReportName(l.get(NumConstant.ZERO).getReportName()); + dto.setCustomerList(ConvertUtils.sourceToTarget(l, ReportResultDTO.CustomerList.class)); + result.add(dto); + }); + return result; } } \ No newline at end of file From dc83916024ee385eb3c8b30fe87f4d4ead45687e Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 8 Aug 2022 14:01:58 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=90=8D=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/feignclient/feigns/JiMuReportOpenFeignClient.java | 2 +- .../java/com/epmet/commons/tools/constant/ServiceConstant.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java index 69f1f84c70..0c5dfb97ef 100644 --- a/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java +++ b/epmet-commons/epmet-commons-feignclient/src/main/java/com/epmet/commons/feignclient/feigns/JiMuReportOpenFeignClient.java @@ -9,6 +9,6 @@ import org.springframework.cloud.openfeign.FeignClient; * @DateTime 2022/8/8 13:52 * @DESC */ -@FeignClient(name = ServiceConstant.JM_REPORT, fallbackFactory = JiMuReportOpenFeignClientFallback.class) +@FeignClient(name = ServiceConstant.EPMET_JM_REPORT, fallbackFactory = JiMuReportOpenFeignClientFallback.class) public interface JiMuReportOpenFeignClient { } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java index b753a7d65b..61a428a953 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java @@ -147,5 +147,5 @@ public interface ServiceConstant { /** * */ - String JM_REPORT = ""; + String EPMET_JM_REPORT = "epmet-jmreport-server"; }