diff --git a/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/annotation/DataSource.java b/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/annotation/DataSource.java index 3a8ac1ae8f..e0675092c8 100644 --- a/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/annotation/DataSource.java +++ b/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/annotation/DataSource.java @@ -21,5 +21,15 @@ import java.lang.annotation.*; @Documented @Inherited public @interface DataSource { + /** + * 直接指定数据源名称 + * @return + */ String value() default ""; + + /** + * 是否从参数中获取数据源名称,优先级高于value + * @return + */ + boolean datasourceNameFromArg() default false; } diff --git a/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/aspect/DataSourceAspect.java b/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/aspect/DataSourceAspect.java index d636568425..45113847c6 100644 --- a/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/aspect/DataSourceAspect.java +++ b/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/aspect/DataSourceAspect.java @@ -9,7 +9,9 @@ package com.epmet.commons.dynamic.datasource.aspect; import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.dynamic.datasource.bean.DataSourceParam; import com.epmet.commons.dynamic.datasource.config.DynamicContextHolder; +import org.apache.commons.lang3.StringUtils; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; @@ -22,6 +24,7 @@ import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import java.lang.reflect.Method; +import java.lang.reflect.Parameter; /** * 多数据源,切面处理类 @@ -52,9 +55,9 @@ public class DataSourceAspect { if(targetDataSource != null || methodDataSource != null){ String value; if(methodDataSource != null){ - value = methodDataSource.value(); + value = getDatasourceName(methodDataSource, signature.getMethod().getParameters(), point.getArgs()); }else { - value = targetDataSource.value(); + value = getDatasourceName(targetDataSource, signature.getMethod().getParameters(), point.getArgs()); } DynamicContextHolder.push(value); @@ -68,4 +71,39 @@ public class DataSourceAspect { logger.debug("clean datasource"); } } + + /** + * 获取要用到的数据源名称 + * @param dataSource + * @return + */ + public String getDatasourceName(DataSource dataSource, Parameter[] methodParameters, Object[] methodArgValues) { + if (dataSource.datasourceNameFromArg()) { + // 1.从参数中动态获取数据源名称 + String datasourceNameFromParam = getDatasourceNameFromArg(methodParameters, methodArgValues); + if (StringUtils.isNotBlank(datasourceNameFromParam)) { + // 如果有DatasourceParam类型的参数并且设置了datasourceName值,那么返回这个值,否则使用硬编码的 + return datasourceNameFromParam; + } + } + // 2.硬编码指定数据源名称 + return dataSource.value(); + } + + /** + * 从参数中取数据源名称 + * @param parameters + * @param argsObject + * @return + */ + public String getDatasourceNameFromArg(Parameter[] parameters, Object[] argsObject) { + for (int i = 0; i < parameters.length; i++) { + if (parameters[i].getType() == DataSourceParam.class) { + DataSourceParam param = (DataSourceParam) argsObject[i]; + return param.getDatasourceName(); + } + } + + return null; + } } diff --git a/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/bean/DataSourceParam.java b/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/bean/DataSourceParam.java new file mode 100644 index 0000000000..19b5905588 --- /dev/null +++ b/epmet-commons/epmet-commons-dynamic-datasource/src/main/java/com/epmet/commons/dynamic/datasource/bean/DataSourceParam.java @@ -0,0 +1,12 @@ +package com.epmet.commons.dynamic.datasource.bean; + +import lombok.AllArgsConstructor; +import lombok.Data; + +@Data +@AllArgsConstructor +public class DataSourceParam { + + private String datasourceName; + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index e86296856e..24e795fd1a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -100,6 +100,8 @@ public enum EpmetErrorCode { OPER_UPLOAD_FILE_OVER_SIZE(8707, "文件体积过大"), OPER_UPLOAD_FILE_TYPE_ERROR(8708, "文件类型错误"), OPER_EXTERNAL_APP_AUTH_ERROR(8709, "外部应用认证失败"), + OPER_EXTERNAL_CUSTOMER_NOT_EXISTS(8710, "该客户不存在"), + OPER_EXTERNAL_APP_EXISTS(8711, "应用已存在"), // 党建声音 前端提示 88段 DRAFT_CONTENT_IS_NULL(8801, "至少需要添加一个段落"), diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/UniqueIdGenerator.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/UniqueIdGenerator.java new file mode 100644 index 0000000000..fcefbdf2ca --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/UniqueIdGenerator.java @@ -0,0 +1,81 @@ +package com.epmet.commons.tools.utils; + + +import org.apache.commons.lang3.StringUtils; + +import java.util.Date; +import java.util.Random; +import java.util.concurrent.atomic.AtomicLong; + +/** + * 唯一ID生成器 + */ +public class UniqueIdGenerator { + + private static UniqueValue uniqueValue = new UniqueValue(); + private static String middle; + static { + String threadCode = StringUtils.right(String.valueOf(Math.abs(System.nanoTime()+"".hashCode())), 2); + middle = StringUtils.leftPad(threadCode, 2, "0"); + } + + /** + * 唯一时间值 + */ + private static class UniqueValue { + + private AtomicLong uniqueValue = new AtomicLong(0L); + private volatile String currentTime = DateUtils.format(new Date(), DateUtils.DATE_TIME_NO_SPLIT); + private volatile String lastTime = currentTime; + + /** + * 获取当前时间:yyyyMMddHHmmSS + * 如果到了下一秒,则唯一值从0开始 + * + * @return + */ + public String getCurrentTime() { + currentTime = DateUtils.format(new Date(), DateUtils.DATE_TIME_NO_SPLIT); + if (!currentTime.equals(lastTime)) { + lastTime = currentTime; + Random random = new Random(); + uniqueValue.set(Long.valueOf(random.nextInt(10))); + } + return currentTime; + } + + public String getCurrentValue() { + return StringUtils.leftPad(String.valueOf(uniqueValue.incrementAndGet()), 5, "0"); + } + } + + /** + * 生成一个24位唯一ID + * 15位时间+2位中间值(防止多服务冲突)+2个线程code+5位秒级递增值 + * + * @return + */ + public static String generate() { + StringBuilder builder = new StringBuilder(32); + builder.append(uniqueValue.getCurrentTime()) + .append(middle) + .append(getUniqueThreadCode()) + .append(uniqueValue.getCurrentValue()); + + return builder.toString(); + } + + public static String getUniqueThreadCode() { + String threadCode = StringUtils.left(String.valueOf(Thread.currentThread().hashCode()), 2); + return StringUtils.leftPad(threadCode, 2, "0"); + } + + public static void main(String[] args) throws InterruptedException { + + System.out.println(UniqueIdGenerator.uniqueValue.currentTime); + System.out.println(UniqueIdGenerator.middle); + System.out.println(UniqueIdGenerator.getUniqueThreadCode()); + System.out.println(uniqueValue.getCurrentValue()); + + } +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/constant/ScreenConstant.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/constant/ScreenConstant.java index fcbbfd7b35..b03dbe6466 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/constant/ScreenConstant.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/constant/ScreenConstant.java @@ -8,4 +8,8 @@ public interface ScreenConstant { String COMMUNITY = "community"; + String MONTH = "月"; + + String RATIO = "%"; + } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/form/SubAgencyIndexRankFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/form/SubAgencyIndexRankFormDTO.java index 0ff2012301..3410d0638f 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/form/SubAgencyIndexRankFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/form/SubAgencyIndexRankFormDTO.java @@ -29,5 +29,5 @@ public class SubAgencyIndexRankFormDTO implements Serializable { @NotNull(message = "默认查询名次不能为空",groups = {SubAgencyIndexRank.class}) private Integer topNum; - private String monthId; + private String yearId; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/CompartmentResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/CompartmentResultDTO.java index aa55fe420e..2bf8ffd3d6 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/CompartmentResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/CompartmentResultDTO.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -18,17 +19,17 @@ public class CompartmentResultDTO implements Serializable { /** * 当前所选组织 */ - private String agencyId; + private String agencyId = ""; /** * 当前所选组织名称 */ - private String name; + private String name = ""; /** * 当前所选组织的坐标区域 */ - private String areaMarks; + private String areaMarks = ""; /** * 机关级别 @@ -44,5 +45,5 @@ public class CompartmentResultDTO implements Serializable { /** * 子级用户分布 */ - private List agencyDistribution; + private List agencyDistribution = new ArrayList<>(); } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/FineExampleResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/FineExampleResultDTO.java index bd05a4b317..a81f45fc05 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/FineExampleResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/FineExampleResultDTO.java @@ -1,5 +1,6 @@ package com.epmet.screen.dto.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -14,42 +15,67 @@ public class FineExampleResultDTO implements Serializable { private static final long serialVersionUID = -2754696449087950719L; /** - * 党员参与议题数 + * 党员参与议事 */ - private Integer issueTotal; + private Integer issueTotal = 0; + + @JsonIgnore + private Double issueRatioA; /** - * 党员参与议题书占平台议题数的占比 + * 党员参与议事占比 */ - private String issueRatio; + private String issueRatio = "0.00%"; /** * 党员发布话题总数 */ - private Integer topicTotal; + private Integer topicTotal = 0; + + @JsonIgnore + private Double topicRatioA; /** - * 占平台总话题百分比 + * 党员发布话题占比 */ - private String topicRatio; + private String topicRatio = "0.00%"; /** * 议题转项目 */ - private Integer shiftProjectTotal; + private Integer shiftProjectTotal = 0; + + @JsonIgnore + private Double shiftProjectRatioA; /** - * 议题转项目占平台总项目数的比率 + * 议题转项目占比 */ - private String shiftProjectRatio; + private String shiftProjectRatio = "0.00%"; /** * 解决项目 */ - private Integer resolvedProjectTotal; + private Integer resolvedProjectTotal = 0; + + @JsonIgnore + private Double resolvedProjectRatioA; + + /** + * 解决项目占比 + */ + private String resolvedProjectRatio = "0.00%"; + + /** + * 党员发布议题数 + */ + private Integer publishIssueTotal = 0; + + @JsonIgnore + private Double publishIssueRatioA; /** - * 占总解决项目的百分比 + * 党员发布议题数占比 */ - private String resolvedProjectRatio; + private String publishIssueRatio = "0.00%"; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ParymemberResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ParymemberResultDTO.java index b655f5fad5..18bc33df48 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ParymemberResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ParymemberResultDTO.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -44,5 +45,5 @@ public class ParymemberResultDTO implements Serializable { /** * 子级用户分布 */ - private List userDistribution; + private List userDistribution = new ArrayList<>(); } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ProjectDetailResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ProjectDetailResultDTO.java index b560620d9a..234fe38034 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ProjectDetailResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/ProjectDetailResultDTO.java @@ -3,6 +3,7 @@ package com.epmet.screen.dto.result; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -42,5 +43,5 @@ public class ProjectDetailResultDTO implements Serializable { /** * 图片列表 */ - private List imgList; + private List imgList = new ArrayList<>(); } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/TreeResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/TreeResultDTO.java index 72fd6a0dd9..b12a8f46f5 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/TreeResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/TreeResultDTO.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -18,12 +19,12 @@ public class TreeResultDTO implements Serializable { /** * 显示名称 */ - private String label; + private String label = ""; /** * agencyId下拉框value */ - private String value; + private String value = ""; @JsonIgnore private String pids; @@ -31,6 +32,6 @@ public class TreeResultDTO implements Serializable { /** * 子目录 */ - private List children; + private List children = new ArrayList<>(); } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/UserResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/UserResultDTO.java index 102faca70d..179aa5bec2 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/UserResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/UserResultDTO.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -18,17 +19,17 @@ public class UserResultDTO implements Serializable { /** * 当前所选组织 */ - private String agencyId; + private String agencyId = ""; /** * 当前所选组织名称 */ - private String name; + private String name = ""; /** * 当前所选组织的坐标区域 */ - private String areaMarks; + private String areaMarks = ""; /** * 机关级别 @@ -44,5 +45,5 @@ public class UserResultDTO implements Serializable { /** * 子级用户分布 */ - private List userDistribution; + private List userDistribution = new ArrayList<>(); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerGridDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerGridDao.java index 9dff41e9ff..4e57c2f71d 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerGridDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerGridDao.java @@ -27,7 +27,7 @@ import org.apache.ibatis.annotations.Param; import java.util.List; /** - * 网格信息 + * 网格(党支部)信息 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-08-18 diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenDifficultyDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenDifficultyDataDao.java index 8e5ccd5d1b..17d2e7a420 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenDifficultyDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenDifficultyDataDao.java @@ -24,7 +24,7 @@ import org.apache.ibatis.annotations.Param; import java.util.List; /** - * 基层治理-难点堵点 + * 基层治理-难点堵点(耗时最长|设计部门最多|处理次数) * * @author generator generator@elink-cn.com * @since v1.0.0 2020-08-18 diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenPioneerDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenPioneerDataDao.java index e2c01f7f9f..4b477689c3 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenPioneerDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenPioneerDataDao.java @@ -17,7 +17,9 @@ package com.epmet.datareport.dao.screen; +import com.epmet.screen.dto.result.FineExampleResultDTO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 党建引领-先锋模范数据 @@ -27,5 +29,13 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ScreenPioneerDataDao{ - + + /** + * @Description 查询先锋模范 + * @param agencyId + * @author zxc + * @date 2020/8/20 5:22 下午 + */ + FineExampleResultDTO selectFineExample(@Param("agencyId")String agencyId); + } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenUserTotalDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenUserTotalDataDao.java index 543cd50e42..a03353e825 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenUserTotalDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenUserTotalDataDao.java @@ -26,7 +26,7 @@ import org.apache.ibatis.annotations.Param; import java.util.List; /** - * 中央区-各类用户总数 + * 中央区-各类(用户|党员|党群|话题|议题|项目|注册人数|参与人数)总数 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-08-18 diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java index 3512ed5324..941cba3477 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java @@ -75,7 +75,7 @@ public class AgencyServiceImpl implements AgencyService { public CompartmentResultDTO compartment(CompartmentFormDTO compartmentFormDTO) { CompartmentResultDTO agencyAreaInfo = screenCustomerAgencyDao.getAgencyAreaInfo(compartmentFormDTO.getAgencyId()); if (null == agencyAreaInfo){ - return agencyAreaInfo; + return new CompartmentResultDTO(); } if (agencyAreaInfo.getLevel().equals(ScreenConstant.COMMUNITY)){ // 当level为"community"时,查询screen_customer_grid表 diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/IndexServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/IndexServiceImpl.java index 7ad1c645b4..4b3bb3b350 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/IndexServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/IndexServiceImpl.java @@ -34,7 +34,7 @@ public class IndexServiceImpl implements IndexService { @Autowired private ScreenIndexDataMonthlyDao screenIndexDataMonthlyDao; @Autowired - private GrassrootsPartyDevServiceImpl grassrootsPartyDevServiceImpl; + private PartyMemberLeadServiceImpl partyMemberLeadServiceImpl; /** * @Description 1、年度平均指数 @@ -60,7 +60,7 @@ public class IndexServiceImpl implements IndexService { @Override public MonthPieChartResultDTO monthPieChart(MonthPieChartFormDTO monthPieChartFormDTO) { MonthPieChartResultDTO monthPieChartResultDTO = screenIndexDataMonthlyDao.selectMonthPieChart(monthPieChartFormDTO.getAgencyId()); - if (null == monthPieChartFormDTO){ + if (null == monthPieChartResultDTO){ return new MonthPieChartResultDTO(); } return monthPieChartResultDTO; @@ -81,8 +81,7 @@ public class IndexServiceImpl implements IndexService { List governAbilityData = new ArrayList<>(); List totalIndexData = new ArrayList<>(); // 1. x轴 - Map x = grassrootsPartyDevServiceImpl.getX(); - result.setXAxis(x.values().stream().collect(Collectors.toList())); + result.setXAxis(partyMemberLeadServiceImpl.getXPro()); // 2. 查询近一年的指数值【不包括本月】 List monthBarchartResults = screenIndexDataMonthlyDao.selectMonthBarchart(customerId, monthBarchartFormDTO.getAgencyId()); if (monthBarchartResults.size() == NumConstant.ZERO){ @@ -121,8 +120,8 @@ public class IndexServiceImpl implements IndexService { @Override public List subAgencyIndexRank(SubAgencyIndexRankFormDTO subAgencyIndexRankFormDTO) { LocalDate now = LocalDate.now().minusMonths(NumConstant.ONE); - String monthId = now.toString().substring(NumConstant.ZERO,NumConstant.FOUR).concat(now.toString().substring(NumConstant.FIVE,NumConstant.SEVEN)); - subAgencyIndexRankFormDTO.setMonthId(monthId); + int yearId = now.getYear(); + subAgencyIndexRankFormDTO.setYearId(String.valueOf(yearId)); List subAgencyIndexRankResultDTOS = screenIndexDataMonthlyDao.selectSubAgencyIndexRank(subAgencyIndexRankFormDTO); if (subAgencyIndexRankResultDTOS.size() == NumConstant.ZERO){ return new ArrayList<>(); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/PartyMemberLeadServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/PartyMemberLeadServiceImpl.java index f9a451bd6b..f5d2704990 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/PartyMemberLeadServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/PartyMemberLeadServiceImpl.java @@ -3,14 +3,18 @@ package com.epmet.datareport.service.screen.impl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.datareport.dao.screen.ScreenPartyBranchDataDao; import com.epmet.datareport.dao.screen.ScreenPartyLinkMassesDataDao; +import com.epmet.datareport.dao.screen.ScreenPioneerDataDao; import com.epmet.datareport.service.screen.PartyMemberLeadService; import com.epmet.screen.dto.form.ContactMassLineChartFormDTO; import com.epmet.screen.dto.form.FineExampleFormDTO; import com.epmet.screen.dto.form.VolunteerServiceFormDTO; import com.epmet.screen.dto.result.*; +import com.epmet.screen.constant.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.math.BigDecimal; +import java.time.LocalDate; import java.util.ArrayList; import java.util.Comparator; import java.util.List; @@ -29,9 +33,9 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService { @Autowired private ScreenPartyLinkMassesDataDao screenPartyLinkMassesDataDao; @Autowired - private GrassrootsPartyDevServiceImpl grassrootsPartyDevServiceImpl; - @Autowired private ScreenPartyBranchDataDao screenPartyBranchDataDao; + @Autowired + private ScreenPioneerDataDao screenPioneerDataDao; /** * @Description 1、先锋模范 @@ -41,8 +45,27 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService { */ @Override public FineExampleResultDTO fineExample(FineExampleFormDTO fineExampleFormDTO) { + FineExampleResultDTO fineExampleResultDTO = screenPioneerDataDao.selectFineExample(fineExampleFormDTO.getAgencyId()); + if (null == fineExampleResultDTO){ + return new FineExampleResultDTO(); + } + fineExampleResultDTO.setIssueRatio(this.getRatio(fineExampleResultDTO.getIssueRatioA())); + fineExampleResultDTO.setPublishIssueRatio(this.getRatio(fineExampleResultDTO.getPublishIssueRatioA())); + fineExampleResultDTO.setResolvedProjectRatio(this.getRatio(fineExampleResultDTO.getResolvedProjectRatioA())); + fineExampleResultDTO.setTopicRatio(this.getRatio(fineExampleResultDTO.getTopicRatioA())); + fineExampleResultDTO.setShiftProjectRatio(this.getRatio(fineExampleResultDTO.getShiftProjectRatioA())); + return fineExampleResultDTO; + } - return null; + /** + * @Description 小数转换百分比 + * @param d + * @author zxc + * @date 2020/8/20 6:06 下午 + */ + public String getRatio(Double d){ + BigDecimal bigDecimal = new BigDecimal(d * NumConstant.ONE_HUNDRED); + return bigDecimal.setScale(NumConstant.TWO, BigDecimal.ROUND_HALF_UP).toPlainString().concat(ScreenConstant.RATIO); } /** @@ -87,8 +110,7 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService { List organizeData = new ArrayList<>(); List joinData = new ArrayList<>(); List averageJoinUserData = new ArrayList<>(); - Map x = grassrootsPartyDevServiceImpl.getX(); - result.setXAxis(x.values().stream().collect(Collectors.toList())); + result.setXAxis(this.getXPro()); List volunteerServiceResults = screenPartyBranchDataDao.selectVolunteerServiceResult(volunteerServiceFormDTO.getAgencyId()); if (volunteerServiceResults.size() == NumConstant.ZERO){ for (int i = NumConstant.ZERO; i <= NumConstant.TWELVE; i++) { @@ -112,4 +134,20 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService { result.setAverageJoinUserData(averageJoinUserData); return result; } + + /** + * @Description 获取之前的12个月份【不包括当前月】 + * @author zxc + * @date 2020/8/21 10:19 上午 + */ + public List getXPro(){ + List xAxis = new ArrayList<>(); + LocalDate today = LocalDate.now(); + for(int i = NumConstant.TWELVE;i >= NumConstant.ONE; i--){ + LocalDate localDate = today.minusMonths(i); + String s = localDate.getMonth().getValue() + ScreenConstant.MONTH; + xAxis.add(s); + } + return xAxis; + } } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml index 78d6ced4c1..21293ad4c6 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml @@ -45,11 +45,11 @@ party_dev_ablity AS partyDevAbility, service_ablity AS serviceAbility FROM - screen_index_data_monthly + screen_index_data_yearly WHERE del_flag = '0' AND parent_id = #{agencyId} - AND month_id = #{monthId} + AND year_id = #{yearId} ORDER BY index_total DESC LIMIT #{topNum} diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml index b59d02f321..58247ff1e3 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml @@ -3,5 +3,23 @@ - + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/GridGovrnAbilityFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/GridGovrnAbilityFormDTO.java index e289e15a02..ef4efd6a24 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/GridGovrnAbilityFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/GridGovrnAbilityFormDTO.java @@ -55,15 +55,10 @@ public class GridGovrnAbilityFormDTO implements Serializable { */ private Integer projectTotal; - /** - * 网格自治项目数 - */ - private Integer selfSolveProjectRatio; - /** * 网格办结项目数 */ - private Integer resolveProjectTotal; + private Integer resolveProjectCount; /** * 网格吹哨部门准确率 @@ -79,4 +74,9 @@ public class GridGovrnAbilityFormDTO implements Serializable { * 网格议题转项目率 */ private BigDecimal avgShiftProjectRatio; + + /** + * 网格自治项目数 统计期网格自身内办结的项目数目 + */ + private Integer selfSolveProjectCount; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/GridPartyMemberDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/GridPartyMemberDataFormDTO.java index 20c6e0c0a6..7993cb2355 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/GridPartyMemberDataFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/GridPartyMemberDataFormDTO.java @@ -86,4 +86,13 @@ public class GridPartyMemberDataFormDTO implements Serializable { */ private Integer issueToProjectCount; + /** + * 用户id + */ + private String userId; + + /** + * 上级组织Id + */ + private String parentId; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/OrgServiceAbilityFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/OrgServiceAbilityFormDTO.java index 9b95c02bda..6ef48c6fa4 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/OrgServiceAbilityFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/OrgServiceAbilityFormDTO.java @@ -43,7 +43,7 @@ public class OrgServiceAbilityFormDTO implements Serializable { /** * allRegion:全区;community:社区;street:街道 */ - private Integer dataType; + private String dataType; /** * 社区/街道活动组织次数 爱心活动 diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/IndexDictDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/IndexDictDTO.java new file mode 100644 index 0000000000..7ca7e42117 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/IndexDictDTO.java @@ -0,0 +1,97 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.screen; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 评价指标字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +@Data +public class IndexDictDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + private String id; + + /** + * 指标编码(唯一) + */ + private String indexCode; + + /** + * 指标名 + */ + private String indexName; + + /** + * 指标描述 + */ + private String indexDesc; + + /** + * 父级指标id,如果是一级指标,PID=0 + */ + private String pid; + + /** + * 指标级别(1,2,3,4,5) + */ + private String level; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/IndexGroupDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/IndexGroupDTO.java new file mode 100644 index 0000000000..19ee948d15 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/IndexGroupDTO.java @@ -0,0 +1,92 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.screen; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 客户指标分组 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +@Data +public class IndexGroupDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 指标id + */ + private String indexCode; + + /** + * 是否启用:启用:enable 禁用:disabled + */ + private String status; + + /** + * 当前指标关联的上一级指标分组,如果没有上一级,则为0 + */ + private String parentIndexGroupId; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/IndexGroupDetailDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/IndexGroupDetailDTO.java new file mode 100644 index 0000000000..e6335250eb --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/IndexGroupDetailDTO.java @@ -0,0 +1,92 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.screen; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 客户指标详情 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +@Data +public class IndexGroupDetailDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + private String id; + + /** + * index_group.id + */ + private String indexGroupId; + + /** + * 指标id + */ + private String indexCode; + + /** + * 权重(同一组权重总和=1) + */ + private BigDecimal weight; + + /** + * 是否启用:启用:enable 禁用:disabled + */ + private String status; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/IndexGroupDetailTemplateDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/IndexGroupDetailTemplateDTO.java new file mode 100644 index 0000000000..e82b7b4588 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/IndexGroupDetailTemplateDTO.java @@ -0,0 +1,92 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.screen; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * 客户指标详情 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +@Data +public class IndexGroupDetailTemplateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + private String id; + + /** + * index_group.id + */ + private String indexGroupId; + + /** + * 指标id + */ + private String indexCode; + + /** + * 权重(同一组权重总和=1) + */ + private BigDecimal weight; + + /** + * 是否启用:启用:enable 禁用:disabled + */ + private String status; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PioneerDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PioneerDataFormDTO.java index cdad61be67..0efe2ff448 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PioneerDataFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/PioneerDataFormDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.screencoll.form; import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; /** * 10、党建引领-先锋模范数据 @@ -35,9 +36,9 @@ public class PioneerDataFormDTO implements Serializable { private String orgName; /** - * 用户总数 + * 党员发布议题 */ - private Integer userTotal; + private Integer publishIssueTotal; /** * 议事数 @@ -58,4 +59,30 @@ public class PioneerDataFormDTO implements Serializable { * 解决项目总数 */ private Integer resolvedProjectTotal; + + + /** + * 议事占比 + */ + private BigDecimal issueRatio; + + /** + * 话题占比 + */ + private BigDecimal topicRatio; + + /** + * 议题转项目占比 + */ + private BigDecimal shiftProjectRatio; + + /** + * 解决项目占比 + */ + private BigDecimal resolvedProjectRatio; + + /** + * 党员发布议题占比 + */ + private BigDecimal publishIssueRatio; } diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index cf116c4fb7..95c74f75d1 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -74,6 +74,25 @@ 2.0.0 compile + + + + + org.apache.poi + poi + 3.17 + + + + org.apache.poi + poi-ooxml + 3.17 + + + com.alibaba + easyexcel + 2.2.6 + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexDictController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexDictController.java new file mode 100644 index 0000000000..217867ea32 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexDictController.java @@ -0,0 +1,68 @@ +package com.epmet.controller; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelReader; +import com.alibaba.excel.read.metadata.ReadSheet; +import com.epmet.commons.tools.utils.Result; +import com.epmet.model.IndexExcelDataListener; +import com.epmet.model.IndexModel; +import com.epmet.service.screen.IndexDictService; +import com.epmet.service.screen.IndexGroupDetailTemplateService; +import com.epmet.service.screen.IndexGroupTemplateService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; +import java.io.InputStream; + +/** + * @author liujianjun + */ +@RequestMapping("indexdict") +@RestController +@Slf4j +public class IndexDictController { + + @Autowired + private IndexDictService indexDictService; + @Autowired + private IndexGroupTemplateService indexGroupTemplateService; + @Autowired + private IndexGroupDetailTemplateService indexGroupDetailTemplateService; + + /** + * url:http://localhost:8108/data/stats/indexdict/initFromExcel + * desc:从excel初始化指标,分组,权重 + * + * @param file + * @return + */ + @PostMapping("initFromExcel") + public Result testTx(@RequestPart("file") MultipartFile file) { + ExcelReader excelReader = null; + try { + InputStream inputStream = null; + try { + inputStream = file.getInputStream(); + } catch (IOException e) { + return new Result().error("读取文件失败"); + } + excelReader = EasyExcel.read(inputStream).build(); + // 这里为了简单 所以注册了 同样的head 和Listener 自己使用功能必须不同的Listener + ReadSheet readSheet = EasyExcel.readSheet(1).head(IndexModel.class) + .registerReadListener(new IndexExcelDataListener(indexDictService, indexGroupTemplateService, indexGroupDetailTemplateService)) + .build(); + excelReader.read(readSheet); + } finally { + if (excelReader != null) { + excelReader.finish(); + } + } + return new Result<>(); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.java index f3725d5811..f56638a3f6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.java @@ -36,12 +36,22 @@ public interface FactIndexGovrnAblityDeptMonthlyDao extends BaseDao list, @Param("customerId")String customerId); + void batchInsertFactIndexPartyAblityCpcMonthly(@Param("list") List list, + @Param("customerId")String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityGridMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityGridMonthlyDao.java index 7ffb311067..b5cb8d2c5e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityGridMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityGridMonthlyDao.java @@ -38,12 +38,21 @@ public interface FactIndexPartyAblityGridMonthlyDao extends BaseDao + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.screen; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.screen.IndexDictEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 评价指标字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +@Mapper +public interface IndexDictDao extends BaseDao { + + int deleteAll(); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexGroupDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexGroupDao.java new file mode 100644 index 0000000000..10033b7456 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexGroupDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.screen; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.screen.IndexGroupEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 客户指标分组 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +@Mapper +public interface IndexGroupDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexGroupDetailDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexGroupDetailDao.java new file mode 100644 index 0000000000..1a7dd4a0a8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexGroupDetailDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.screen; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.screen.IndexGroupDetailEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 客户指标详情 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +@Mapper +public interface IndexGroupDetailDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexGroupDetailTemplateDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexGroupDetailTemplateDao.java new file mode 100644 index 0000000000..cfe5270615 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexGroupDetailTemplateDao.java @@ -0,0 +1,35 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.screen; + + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.screen.IndexGroupDetailTemplateEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 客户指标详情 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +@Mapper +public interface IndexGroupDetailTemplateDao extends BaseDao { + + int deleteAll(); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexGroupTemplateDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexGroupTemplateDao.java new file mode 100644 index 0000000000..6f64a61349 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexGroupTemplateDao.java @@ -0,0 +1,34 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao.screen; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.screen.IndexGroupTemplateEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 默认指标分组 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +@Mapper +public interface IndexGroupTemplateDao extends BaseDao { + + int deleteAll(); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenCustomerGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenCustomerGridDao.java index 3925d0ad6e..c9fa856582 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenCustomerGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenCustomerGridDao.java @@ -26,7 +26,7 @@ import org.apache.ibatis.annotations.Param; import java.util.List; /** - * 网格信息 + * 网格(党支部)信息 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-08-18 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenDifficultyDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenDifficultyDataDao.java index 5379eeb893..1a9b991bac 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenDifficultyDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenDifficultyDataDao.java @@ -26,7 +26,7 @@ import org.apache.ibatis.annotations.Param; import java.util.List; /** - * 基层治理-难点堵点 + * 基层治理-难点堵点(耗时最长|设计部门最多|处理次数) * * @author generator generator@elink-cn.com * @since v1.0.0 2020-08-18 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenUserTotalDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenUserTotalDataDao.java index ec449f1352..e0712dee50 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenUserTotalDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/ScreenUserTotalDataDao.java @@ -26,7 +26,7 @@ import org.apache.ibatis.annotations.Param; import java.util.List; /** - * 中央区-各类用户总数 + * 中央区-各类(用户|党员|党群|话题|议题|项目|注册人数|参与人数)总数 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-08-18 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexcoll/FactIndexGovrnAblityOrgMonthlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexcoll/FactIndexGovrnAblityOrgMonthlyEntity.java index bf38ebbbda..94eec97d6f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexcoll/FactIndexGovrnAblityOrgMonthlyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexcoll/FactIndexGovrnAblityOrgMonthlyEntity.java @@ -27,7 +27,7 @@ import java.math.BigDecimal; import java.util.Date; /** - * 治理能力-街道及社区相关数据 + * 治理能力-街道及社区相关数据 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-08-20 @@ -72,7 +72,7 @@ public class FactIndexGovrnAblityOrgMonthlyEntity extends BaseEpmetEntity { /** * 数据类型 allRegion:全区;street:街道;community:社区;grid:网格 */ - private Integer dataType; + private String dataType; /** * 被吹哨次数 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexcoll/FactIndexPartyAblityOrgMonthlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexcoll/FactIndexPartyAblityOrgMonthlyEntity.java index 14ea565482..1bf023f055 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexcoll/FactIndexPartyAblityOrgMonthlyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexcoll/FactIndexPartyAblityOrgMonthlyEntity.java @@ -26,7 +26,7 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 党建能力-街道及社区相关事实表 + * 党建能力-街道及社区相关事实表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-08-20 @@ -76,6 +76,6 @@ public class FactIndexPartyAblityOrgMonthlyEntity extends BaseEpmetEntity { /** * 数据类型 allRegion:全区;community:社区;street:街道 */ - private Integer dataType; + private String dataType; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexcoll/FactIndexServiceAblityOrgMonthlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexcoll/FactIndexServiceAblityOrgMonthlyEntity.java index 9e590690fa..8abeb1c172 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexcoll/FactIndexServiceAblityOrgMonthlyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/indexcoll/FactIndexServiceAblityOrgMonthlyEntity.java @@ -26,7 +26,7 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 服务能力-组织(街道|社区|全区)相关事实表 + * 服务能力-组织(街道|社区|全区)相关事实表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-08-20 @@ -76,6 +76,6 @@ public class FactIndexServiceAblityOrgMonthlyEntity extends BaseEpmetEntity { /** * 数据类型 allRegion:全区;street:街道;community:社区;grid:网格 */ - private Integer dataType; + private String dataType; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexDictEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexDictEntity.java new file mode 100644 index 0000000000..2ea5745dba --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexDictEntity.java @@ -0,0 +1,53 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.screen; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 评价指标字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("index_dict") +public class IndexDictEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 指标名 + */ + private String indexName; + + /** + * 指标描述 + */ + private String indexDesc; + + /** + * 指标级别(1,2,3,4,5) + */ + private String level; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupDetailEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupDetailEntity.java new file mode 100644 index 0000000000..e17ba9b2b2 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupDetailEntity.java @@ -0,0 +1,60 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.screen; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 客户指标详情 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("index_group_detail") +public class IndexGroupDetailEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * index_group.id + */ + private String indexGroupId; + + /** + * 指标id + */ + private String indexId; + + /** + * 权重(同一组权重总和=1) + */ + private BigDecimal weight; + + /** + * 是否启用:启用:enable 禁用:disabled + */ + private String status; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupDetailTemplateEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupDetailTemplateEntity.java new file mode 100644 index 0000000000..569cda48d9 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupDetailTemplateEntity.java @@ -0,0 +1,65 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.screen; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; + +/** + * 客户指标详情 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("index_group_detail_template") +public class IndexGroupDetailTemplateEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * index_group.id + */ + private String indexGroupId; + + /** + * 指标id + */ + private String indexId; + + /** + * 权重(同一组权重总和=1) + */ + private BigDecimal weight; + + /** + * 是否启用:启用:enable 禁用:disabled + */ + private String status; + + /** + * 阈值 如果是百分比 则为除以100以后的值 + */ + private BigDecimal threshold; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupEntity.java new file mode 100644 index 0000000000..24df1ef18a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupEntity.java @@ -0,0 +1,58 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.screen; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 客户指标分组 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("index_group") +public class IndexGroupEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 指标id + */ + private String indexId; + + /** + * 是否启用:启用:enable 禁用:disabled + */ + private String status; + + /** + * 当前指标关联的上一级指标分组,如果没有上一级,则为0 + */ + private String parentIndexGroupId; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupTemplateEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupTemplateEntity.java new file mode 100644 index 0000000000..3348ebdeda --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupTemplateEntity.java @@ -0,0 +1,53 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity.screen; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 客户指标分组 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("index_group_template") +public class IndexGroupTemplateEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 指标id + */ + private String indexId; + + /** + * 是否启用:启用:enable 禁用:disabled + */ + private String status; + + /** + * 当前指标关联的上一级指标分组,如果没有上一级,则为0 + */ + private String parentIndexGroupId; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCpcBaseDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCpcBaseDataEntity.java index 18eaf5d6e3..e649e5e89f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCpcBaseDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCpcBaseDataEntity.java @@ -29,7 +29,7 @@ import java.util.Date; * 基层党建-党员基本情况 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-08-18 + * @since v1.0.0 2020-08-21 */ @Data @EqualsAndHashCode(callSuper=false) @@ -63,6 +63,11 @@ public class ScreenCpcBaseDataEntity extends BaseEpmetEntity { */ private String orgName; + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; + /** * 注册用户数 */ @@ -79,32 +84,32 @@ public class ScreenCpcBaseDataEntity extends BaseEpmetEntity { private Integer partyMemberCount; /** - * 小于20岁 + * 小于20岁的党员总人数 */ private Integer ageLevel1; /** - * 20-30岁 + * 20-30岁的党员总人数 */ private Integer ageLevel2; /** - * 31-40岁 + * 31-40岁的党员总人数 */ private Integer ageLevel3; /** - * 41-50岁 + * 41-50岁的党员总人数 */ private Integer ageLevel4; /** - * 51-60岁 + * 51-60岁的党员总人数 */ private Integer ageLevel5; /** - * 60+岁 + * 60+岁的党员总人数 */ private Integer ageLevel6; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCustomerAgencyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCustomerAgencyEntity.java index 91f37c37c1..96b2e23dfe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCustomerAgencyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCustomerAgencyEntity.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package com.epmet.entity.screen; import com.baomidou.mybatisplus.annotation.TableName; @@ -29,7 +28,7 @@ import java.util.Date; * 组织机构信息 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-08-18 + * @since v1.0.0 2020-08-21 */ @Data @EqualsAndHashCode(callSuper=false) @@ -59,7 +58,7 @@ public class ScreenCustomerAgencyEntity extends BaseEpmetEntity { private String pid; /** - * 所有上级ID,用逗号分开 + * 所有上级ID,用逗号(英文)分开 */ private String pids; @@ -97,4 +96,9 @@ public class ScreenCustomerAgencyEntity extends BaseEpmetEntity { */ private String areaCode; + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCustomerDeptEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCustomerDeptEntity.java index 2dc5f09cc4..f020e44cd8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCustomerDeptEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCustomerDeptEntity.java @@ -29,7 +29,7 @@ import java.util.Date; * 部门信息 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-08-18 + * @since v1.0.0 2020-08-21 */ @Data @EqualsAndHashCode(callSuper=false) @@ -73,4 +73,9 @@ public class ScreenCustomerDeptEntity extends BaseEpmetEntity { */ private String deptMark; + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCustomerGridEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCustomerGridEntity.java index 646fd8af24..99b6c99553 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCustomerGridEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenCustomerGridEntity.java @@ -26,10 +26,10 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 网格信息 + * 网格(党支部)信息 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-08-18 + * @since v1.0.0 2020-08-21 */ @Data @EqualsAndHashCode(callSuper=false) @@ -73,4 +73,9 @@ public class ScreenCustomerGridEntity extends BaseEpmetEntity { */ private String partyMark; + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenDifficultyDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenDifficultyDataEntity.java index 3a49498dca..845bbb7db0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenDifficultyDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenDifficultyDataEntity.java @@ -26,10 +26,10 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 基层治理-难点堵点 + * 基层治理-难点堵点(耗时最长|设计部门最多|处理次数) * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-08-18 + * @since v1.0.0 2020-08-21 */ @Data @EqualsAndHashCode(callSuper=false) @@ -93,6 +93,10 @@ public class ScreenDifficultyDataEntity extends BaseEpmetEntity { */ private Integer eventReOrg; + /** + * 事件被处理次数(08-21新增) + */ + private Integer eventHandledCount; /** * 事件类别编码 */ @@ -113,8 +117,14 @@ public class ScreenDifficultyDataEntity extends BaseEpmetEntity { */ private String eventStatusDesc; - /** - * 最近一次操作说明 - */ + /** + * 最近一次操作说明 + */ private String latestOperateDesc; + + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenEventDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenEventDataEntity.java index a007794682..e666f852b0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenEventDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenEventDataEntity.java @@ -30,7 +30,7 @@ import java.util.Date; * 中央区-事件数据 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-08-18 + * @since v1.0.0 2020-08-21 */ @Data @EqualsAndHashCode(callSuper=false) @@ -124,18 +124,24 @@ public class ScreenEventDataEntity extends BaseEpmetEntity { */ private Date lastProcessDate; - /** - * 事件状态key - */ + /** + * 事件状态key + */ private String eventStatusCode; - /** - * 事件状态描述 - */ + /** + * 事件状态描述 + */ private String eventStatusDesc; - /** - * 最近一次操作说明 - */ + /** + * 最近一次操作说明 + */ private String latestOperateDesc; + + /** + * 数据更新至: yyyy|yyyMM|yyyyMMdd + */ + private String dataEndTime; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenEventImgDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenEventImgDataEntity.java index 9babf7e18f..fb0e81290b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenEventImgDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenEventImgDataEntity.java @@ -29,7 +29,7 @@ import java.util.Date; * 中央区-事件数据图片数据 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-08-18 + * @since v1.0.0 2020-08-21 */ @Data @EqualsAndHashCode(callSuper=false) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenGovernRankDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenGovernRankDataEntity.java index 804ad16f07..d280785a6c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenGovernRankDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenGovernRankDataEntity.java @@ -27,10 +27,10 @@ import java.math.BigDecimal; import java.util.Date; /** - * 基层治理-治理能力排行数据 + * 基层治理-治理能力排行数据(按月统计) * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-08-18 + * @since v1.0.0 2020-08-21 */ @Data @EqualsAndHashCode(callSuper=false) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenIndexDataMonthlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenIndexDataMonthlyEntity.java index f0f3ef1fed..fbeb83ba9a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenIndexDataMonthlyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenIndexDataMonthlyEntity.java @@ -27,10 +27,10 @@ import java.math.BigDecimal; import java.util.Date; /** - * 指数-指数数据 + * 指数-指数数据(每月数值) * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-08-18 + * @since v1.0.0 2020-08-21 */ @Data @EqualsAndHashCode(callSuper=false) @@ -45,12 +45,12 @@ public class ScreenIndexDataMonthlyEntity extends BaseEpmetEntity { private String customerId; /** - * 年Id + * 年Id: yyyy */ private String yearId; /** - * 月份Id + * 月份Id yyyyMM */ private String monthId; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenIndexDataYearlyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenIndexDataYearlyEntity.java index 8f8063c0db..259947010d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenIndexDataYearlyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenIndexDataYearlyEntity.java @@ -30,7 +30,7 @@ import java.util.Date; * 指数-指数数据(按年统计) * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-08-19 + * @since v1.0.0 2020-08-21 */ @Data @EqualsAndHashCode(callSuper=false) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenOrgRankDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenOrgRankDataEntity.java index e5a33a235e..a732eda4b9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenOrgRankDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenOrgRankDataEntity.java @@ -27,10 +27,10 @@ import java.math.BigDecimal; import java.util.Date; /** - * 党建引领-组织排行榜 + * 党建引领-组织先进排行榜 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-08-18 + * @since v1.0.0 2020-08-21 */ @Data @EqualsAndHashCode(callSuper=false) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPartyBranchDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPartyBranchDataEntity.java index 8717291a31..cb870d2de7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPartyBranchDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPartyBranchDataEntity.java @@ -14,7 +14,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - package com.epmet.entity.screen; import com.baomidou.mybatisplus.annotation.TableName; @@ -26,10 +25,10 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 基层党建-建设情况数据(支部,联建,志愿服务) + * 基层党建-建设情况数据(支部,联建,志愿服务)按月 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-08-18 + * @since v1.0.0 2020-08-21 */ @Data @EqualsAndHashCode(callSuper=false) @@ -54,7 +53,7 @@ public class ScreenPartyBranchDataEntity extends BaseEpmetEntity { private String monthId; /** - * 数据类别 party:支部建设;union:联合建设党员志愿服务:voluntaryservice + * 数据类别 :party:支部建设; union:联合建设;党员志愿服务:voluntaryservice */ private String type; @@ -84,7 +83,7 @@ public class ScreenPartyBranchDataEntity extends BaseEpmetEntity { private String meetCategoryId; /** - * 会议分类名称 + * 会议分类名称(三会党课、主题党日.....等等) */ private String meetCategoryName; @@ -98,9 +97,9 @@ public class ScreenPartyBranchDataEntity extends BaseEpmetEntity { */ private Integer joinUserCount; - /** - * 平均参加人数 - */ + /** + * 平均参加人数 + */ private Integer averageJoinUserCount; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPartyLinkMassesDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPartyLinkMassesDataEntity.java index 4931575b55..c663fc770b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPartyLinkMassesDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPartyLinkMassesDataEntity.java @@ -29,7 +29,7 @@ import java.util.Date; * 党建引领-党员联系群众数据 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-08-18 + * @since v1.0.0 2020-08-21 */ @Data @EqualsAndHashCode(callSuper=false) @@ -64,7 +64,7 @@ public class ScreenPartyLinkMassesDataEntity extends BaseEpmetEntity { private String orgName; /** - * 建群总数 + * 党员建群总数 */ private Integer createGroupTotal; @@ -73,4 +73,9 @@ public class ScreenPartyLinkMassesDataEntity extends BaseEpmetEntity { */ private Integer groupUserTotal; + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPartyUserRankDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPartyUserRankDataEntity.java index a313b55cc7..702e184439 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPartyUserRankDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPartyUserRankDataEntity.java @@ -29,7 +29,7 @@ import java.util.Date; * 党建引领|基层治理-市民(党员)积分排行榜 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-08-18 + * @since v1.0.0 2020-08-21 */ @Data @EqualsAndHashCode(callSuper=false) @@ -44,47 +44,47 @@ public class ScreenPartyUserRankDataEntity extends BaseEpmetEntity { private String customerId; /** - * 年Id + * 网格id */ - private String yearId; + private String gridId; /** - * 月份Id + * 组织名称 */ - private String monthId; + private String gridName; /** - * 组织类别 agency:组织;部门:department;网格:grid + * 网格所属的组织id */ - private String orgType; + private String orgId; /** - * 组织Id 可以为网格,机关id + * 网格所属的组织名称 */ - private String orgId; + private String orgName; /** - * 上级组织Id + * 是否是党员标志:1是。0不是党员 */ - private String parentId; + private Integer partyFlag; /** - * 组织名称 + * 用户Id */ - private String orgName; + private String userId; /** - * 用户身份 party:党员;resi:居民 + * 姓 */ - private String userType; + private String surname; /** - * 用户Id + * 名 */ - private String userId; + private String name; /** - * 用户名称 + * 姓名 */ private String userName; @@ -93,4 +93,9 @@ public class ScreenPartyUserRankDataEntity extends BaseEpmetEntity { */ private Integer pointTotal; + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPioneerDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPioneerDataEntity.java index ab192e7161..b53561b229 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPioneerDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenPioneerDataEntity.java @@ -23,13 +23,14 @@ import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; +import java.math.BigDecimal; import java.util.Date; /** * 党建引领-先锋模范数据 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-08-18 + * @since v1.0.0 2020-08-21 */ @Data @EqualsAndHashCode(callSuper=false) @@ -64,28 +65,58 @@ public class ScreenPioneerDataEntity extends BaseEpmetEntity { private String orgName; /** - * 用户总数 + * 党员参与议事 */ - private Integer userTotal; + private Integer issueTotal; /** - * 议事数 + * 党员参与议事占比 */ - private Integer issueTotal; + private BigDecimal issueRatio; /** - * 话题总数 + * 党员发布话题 */ private Integer topicTotal; + /** + * 党员发布话题占比 + */ + private BigDecimal topicRatio; + + /** + * 党员发布议题 + */ + private Integer publishIssueTotal; + + /** + * 党员发布议题占比 + */ + private BigDecimal publishIssueRatio; + /** * 议题转项目数 */ private Integer shiftProjectTotal; + /** + * 议题转项目占比 + */ + private BigDecimal shiftProjectRatio; + /** * 解决项目总数 */ private Integer resolvedProjectTotal; + /** + * 解决项目总数占比 + */ + private BigDecimal resolvedProjectRatio; + + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenUserJoinEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenUserJoinEntity.java index d7ff0d4860..d67593a2f4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenUserJoinEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenUserJoinEntity.java @@ -30,7 +30,7 @@ import java.util.Date; * 基层治理-公众参与 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-08-18 + * @since v1.0.0 2020-08-21 */ @Data @EqualsAndHashCode(callSuper=false) @@ -44,16 +44,6 @@ public class ScreenUserJoinEntity extends BaseEpmetEntity { */ private String customerId; - /** - * 年Id - */ - private String yearId; - - /** - * 月份Id - */ - private String monthId; - /** * 组织类别 agency:组织;部门:department;网格:grid */ @@ -75,19 +65,58 @@ public class ScreenUserJoinEntity extends BaseEpmetEntity { private String orgName; /** - * 组织次数 + * 数据更新至 年Id: yyyy + */ + private String yearId; + + /** + * 数据更新至 :月份Id :yyyyMM */ - private Integer organizeTotal; + private String monthId; + + /** + * 总的参与次数 + */ + private String joinTotal; - /** - * 参与次数 - */ - private Integer joinTotal; + /** + * 总的参与次数较上月增长率(采集的时候后台自己计算) + */ + private BigDecimal joinTotalUpRate; /** - * 平均参与人数 + * 增长:incr;下降:decr; 相等 :eq */ - private Integer avgJoinUser; + private String joinTotalUpFlag; + /** + * 人均议题 + */ + private Integer avgIssue; + + /** + * 人均议题较上月增长率(采集的时候后台自己计算) + */ + private BigDecimal avgIssueUpRate; + + /** + * 增长:incr;下降:decr; 相等 :eq + */ + private String avgIssueUpFlag; + + /** + * 平均参与度 + */ + private Integer avgJoin; + + /** + * 平均参与度较上月增长率(采集的时候后台自己计算) + */ + private BigDecimal agvgJoinUpRate; + + /** + * 增长:incr;下降:decr; 相等 :eq + */ + private String agvgJoinUpFlag; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenUserTotalDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenUserTotalDataEntity.java index 80187ba014..a58f257cc6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenUserTotalDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/ScreenUserTotalDataEntity.java @@ -26,10 +26,10 @@ import lombok.EqualsAndHashCode; import java.util.Date; /** - * 中央区-各类用户总数 + * 中央区-各类(用户|党员|党群|话题|议题|项目|注册人数|参与人数)总数 * * @author generator generator@elink-cn.com - * @since v1.0.0 2020-08-18 + * @since v1.0.0 2020-08-21 */ @Data @EqualsAndHashCode(callSuper=false) @@ -44,7 +44,7 @@ public class ScreenUserTotalDataEntity extends BaseEpmetEntity { private String customerId; /** - * 组织类别 agency:组织;部门:department;网格:grid + * 组织类别 agency:组织;网格:grid;部门:department; */ private String orgType; @@ -59,10 +59,15 @@ public class ScreenUserTotalDataEntity extends BaseEpmetEntity { private String parentId; /** - * 组织名称 + * 组织名称,也可能是网格名称 */ private String orgName; + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; + /** * 用户总数 */ @@ -93,4 +98,14 @@ public class ScreenUserTotalDataEntity extends BaseEpmetEntity { */ private Integer projectTotal; + /** + * 注册人数(08-21新增) + */ + private Integer regUserTotal; + + /** + * 参与人数(08-21新增) + */ + private Integer joinUserTotal; + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java new file mode 100644 index 0000000000..76f0897890 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java @@ -0,0 +1,272 @@ +package com.epmet.model; + +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.event.AnalysisEventListener; +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.utils.UniqueIdGenerator; +import com.epmet.entity.screen.IndexDictEntity; +import com.epmet.entity.screen.IndexGroupDetailTemplateEntity; +import com.epmet.entity.screen.IndexGroupTemplateEntity; +import com.epmet.service.screen.IndexDictService; +import com.epmet.service.screen.IndexGroupDetailTemplateService; +import com.epmet.service.screen.IndexGroupTemplateService; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +/** + * 读取转换异常 + * + * @author Jiaju Zhuang + */ +public class IndexExcelDataListener extends AnalysisEventListener { + private static final Logger LOGGER = LoggerFactory.getLogger(IndexExcelDataListener.class); + /** + * 每隔5条存储数据库,实际使用中可以3000条,然后清理list ,方便内存回收 + */ + private static volatile boolean isGroup = false; + ; + AtomicInteger total = new AtomicInteger(0); + Map indexDicMap = new HashMap<>(); + Map indexGroupMap = new HashMap<>(); + Map indexGroupDetailMap = new HashMap<>(); + List indexModelList = new ArrayList<>(); + private String preWheight; + + private Integer wheightSum = 0; + /** + * 假设这个是一个DAO,当然有业务逻辑这个也可以是一个service。当然如果不用存储这个对象没用。 + */ + private IndexDictService indexDictService; + + private IndexGroupTemplateService indexGroupTemplateService; + + private IndexGroupDetailTemplateService indexGroupDetailTemplateService; + + + /** + * 如果使用了spring,请使用这个构造方法。每次创建Listener的时候需要把spring管理的类传进来 + * + * @param indexDictService + */ + public IndexExcelDataListener(IndexDictService indexDictService, IndexGroupTemplateService indexGroupTemplateService, IndexGroupDetailTemplateService indexGroupDetailTemplateService) { + this.indexDictService = indexDictService; + this.indexGroupTemplateService = indexGroupTemplateService; + this.indexGroupDetailTemplateService = indexGroupDetailTemplateService; + } + + /** + * 这个每一条数据解析都会来调用 + * + * @param data one row value. Is is same as {@link AnalysisContext#readRowHolder()} + * @param context + */ + @Override + public void invoke(IndexModel data, AnalysisContext context) { + if (data == null || data.getIsUsed() == null || data.getIsUsed() != 1) { + return; + } + + //合并单元格的 权重 处理 + String weight = data.getWeight(); + if (StringUtils.isNotBlank(weight)) { + weight = weight.replace("%", ""); + data.setWeight(weight); + preWheight = data.getWeight(); + } else { + data.setWeight(preWheight); + } + LOGGER.info("解析到一条数据:{}", JSON.toJSONString(data)); + + IndexDictEntity entity = new IndexDictEntity(); + IndexDictEntity entity2 = new IndexDictEntity(); + IndexDictEntity entity3 = new IndexDictEntity(); + IndexDictEntity entity4 = new IndexDictEntity(); + IndexDictEntity entity5 = new IndexDictEntity(); + + indexModelList.add(data); + buildIndexDicEntity(data, entity, entity2, entity3, entity4, entity5); + + buildIndexGroupEntity(); + + total.addAndGet(1); + + + // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM + /*if (isGroup) { + saveData(); + // 存储完成清理 list + list.clear(); + }*/ + } + + private void buildIndexGroupEntity() { + List collect = indexModelList.stream().sorted(Comparator.comparing(IndexModel::getLevel1Index)).collect(Collectors.toList()); + collect.forEach(index -> { + if (index.getLevel1Index().equals("党员相关")) { + IndexDictEntity indexDictEntity = indexDicMap.get(index.getLevel1Index()); + String level1GroupId = UniqueIdGenerator.generate(); + IndexGroupTemplateEntity group1 = indexGroupMap.get(index.getLevel1Index()); + if (group1 == null) { + group1 = new IndexGroupTemplateEntity(); + group1.setIndexId(indexDictEntity.getId()); + group1.setParentIndexGroupId("0"); + group1.setId(level1GroupId); + indexGroupMap.put(index.getLevel1Index(), group1); + } + + String level4Index = index.getLevel4Index(); + indexDictEntity = indexDicMap.get(level4Index); + String level2GroupId = UniqueIdGenerator.generate(); + + IndexGroupTemplateEntity group2 = indexGroupMap.get(level4Index); + IndexGroupDetailTemplateEntity templateEntity = null; + if (group2 == null) { + group2 = new IndexGroupTemplateEntity(); + group2.setIndexId(indexDictEntity.getId()); + group2.setParentIndexGroupId(level1GroupId); + group2.setId(level2GroupId); + indexGroupMap.put(level4Index, group2); + //构建 分组明细 + templateEntity = indexGroupDetailMap.get(level4Index); + if (templateEntity == null) { + buildIndexGroupDetail(indexDictEntity, index, group1.getId(), 2); + } + } + indexDictEntity = indexDicMap.get(index.getLevel5Index()); + + templateEntity = indexGroupDetailMap.get(index.getLevel5Index()); + if (templateEntity == null) { + buildIndexGroupDetail(indexDictEntity, index, group2.getId(), 5); + } + } else { + //todo 测试完去掉 + //if ("街道相关".equals(index.getLevel1Index())) { + IndexDictEntity indexDictEntity = indexDicMap.get(index.getLevel1Index()); + String level1GroupId = UniqueIdGenerator.generate(); + IndexGroupTemplateEntity group1 = indexGroupMap.get(index.getLevel1Index()); + if (group1 == null) { + group1 = new IndexGroupTemplateEntity(); + group1.setIndexId(indexDictEntity.getId()); + group1.setParentIndexGroupId("0"); + group1.setId(level1GroupId); + indexGroupMap.put(index.getLevel1Index(), group1); + } + + String level2Index = index.getLevel2Index(); + indexDictEntity = indexDicMap.get(level2Index); + String level2GroupId = UniqueIdGenerator.generate(); + + IndexGroupTemplateEntity group2 = indexGroupMap.get(level2Index); + IndexGroupDetailTemplateEntity templateEntity = null; + if (group2 == null) { + group2 = new IndexGroupTemplateEntity(); + group2.setIndexId(indexDictEntity.getId()); + group2.setParentIndexGroupId(level1GroupId); + group2.setId(level2GroupId); + indexGroupMap.put(level2Index, group2); + //构建 分组明细 + templateEntity = indexGroupDetailMap.get(level2Index); + if (templateEntity == null) { + buildIndexGroupDetail(indexDictEntity, index, group1.getId(), 2); + } + } + indexDictEntity = indexDicMap.get(index.getLevel5Index()); + + templateEntity = indexGroupDetailMap.get(index.getLevel5Index()); + if (templateEntity == null) { + buildIndexGroupDetail(indexDictEntity, index, group2.getId(), 5); + } + } + //} + }); + LOGGER.info("所有指标分组数据解析完成:{}", JSON.toJSONString(indexGroupMap.values())); + LOGGER.info("所有指标分组明细数据解析完成:{}", JSON.toJSONString(indexGroupDetailMap.values())); + } + + private void buildIndexGroupDetail(IndexDictEntity indexDictEntity, IndexModel index, String groupId, Integer level) { + IndexGroupDetailTemplateEntity templateEntity; + templateEntity = new IndexGroupDetailTemplateEntity(); + templateEntity.setIndexGroupId(groupId); + templateEntity.setIndexId(indexDictEntity.getId()); + + if (level == 5) { + String level5WeightStr = index.getLevel5Weight().replace("%", ""); + templateEntity.setWeight(new BigDecimal(level5WeightStr).divide(new BigDecimal(100), 4, RoundingMode.HALF_UP)); + indexGroupDetailMap.put(index.getLevel5Index(), templateEntity); + } else { + indexGroupDetailMap.put(indexDictEntity.getIndexName(), templateEntity); + templateEntity.setWeight(new BigDecimal(index.getWeight()).divide(new BigDecimal(100), 4, RoundingMode.HALF_UP)); + } + templateEntity.setId(UniqueIdGenerator.generate()); + if (StringUtils.isNotBlank(index.getThreshold())) { + String thresholdStr = index.getThreshold().replace("%", ""); + templateEntity.setThreshold(new BigDecimal(thresholdStr).divide(new BigDecimal(100), 4, RoundingMode.HALF_UP)); + } + } + + private void buildIndexDicEntity(IndexModel data, IndexDictEntity entity, IndexDictEntity entity2, IndexDictEntity entity3, IndexDictEntity entity4, IndexDictEntity entity5) { + if (!indexDicMap.containsKey(data.getLevel1Index())) { + entity.setId(UniqueIdGenerator.generate()); + entity.setIndexName(data.getLevel1Index()); + entity.setLevel("1"); + indexDicMap.put(data.getLevel1Index(), entity); + } + if (!indexDicMap.containsKey(data.getLevel2Index())) { + entity2.setId(UniqueIdGenerator.generate()); + entity2.setIndexName(data.getLevel2Index()); + entity2.setLevel("2"); + indexDicMap.put(data.getLevel2Index(), entity2); + } + if (!indexDicMap.containsKey(data.getLevel3Index())) { + entity3.setId(UniqueIdGenerator.generate()); + entity3.setIndexName(data.getLevel3Index()); + entity3.setLevel("3"); + indexDicMap.put(data.getLevel3Index(), entity3); + } + if (!indexDicMap.containsKey(data.getLevel4Index())) { + entity4.setId(UniqueIdGenerator.generate()); + entity4.setIndexName(data.getLevel4Index()); + entity4.setLevel("4"); + indexDicMap.put(data.getLevel4Index(), entity4); + } + if (!indexDicMap.containsKey(data.getLevel5Index())) { + entity5.setId(UniqueIdGenerator.generate()); + entity5.setIndexName(data.getLevel5Index()); + entity5.setLevel("5"); + indexDicMap.put(data.getLevel5Index(), entity5); + } + } + + /** + * 所有数据解析完成了 都会来调用 + * + * @param context + */ + @Override + public void doAfterAllAnalysed(AnalysisContext context) { + // 这里也要保存数据,确保最后遗留的数据也存储到数据库 + saveData(); + LOGGER.info("所有数据解析完成!total:{}", total.intValue()); + } + + /** + * 加上存储数据库 + */ + private void saveData() { + LOGGER.info("{}条数据,开始存储数据库!", indexDicMap.size()); + indexDictService.deleteAndInsertBatch(indexDicMap.values()); + + buildIndexGroupEntity(); + + indexGroupTemplateService.deleteAndInsertBatch(indexGroupMap.values()); + indexGroupDetailTemplateService.deleteAndInsertBatch(indexGroupDetailMap.values()); + LOGGER.info("存储数据库成功!指标:{}个,分组:{}个,详情:{}个", indexDicMap.values().size(), indexGroupMap.values().size(), indexGroupDetailMap.values().size()); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexModel.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexModel.java new file mode 100644 index 0000000000..f264a2c39e --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexModel.java @@ -0,0 +1,26 @@ +package com.epmet.model; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +@Data +public class IndexModel { + @ExcelProperty(value = "一级指标") + private String level1Index; + @ExcelProperty(value = "二级指标") + private String level2Index; + @ExcelProperty(value = "三级指标") + private String level3Index; + @ExcelProperty(value = "四级指标") + private String level4Index; + @ExcelProperty(value = "五级指标") + private String level5Index; + @ExcelProperty(value = "是否采用") + private Integer isUsed; + @ExcelProperty(value = "权重") + private String weight; + @ExcelProperty(value = "五级权重") + private String level5Weight; + @ExcelProperty(value = "阈值") + private String threshold; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/ParseIndexExcelResult.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/ParseIndexExcelResult.java new file mode 100644 index 0000000000..17b4fa0634 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/ParseIndexExcelResult.java @@ -0,0 +1,54 @@ +package com.epmet.model; + +import lombok.Data; + +import java.io.Serializable; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; + +@Data +public class ParseIndexExcelResult implements Serializable { + private String id; + private String groupId; + /** + * 当前指标关联的上一级指标分组,如果没有上一级,则为0 + */ + private String parentIndexGroupId; + /** + * 指标编码(唯一) + */ + private String indexCode; + + /** + * 指标名 + */ + private String indexName; + + /** + * 指标描述 + */ + private String indexDesc; + + /** + * 指标级别(1,2,3,4,5) + */ + private String level; + + private Set children = new HashSet<>(); + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ParseIndexExcelResult that = (ParseIndexExcelResult) o; + return indexCode.equals(that.indexCode) && + indexName.equals(that.indexName) && + level.equals(that.level); + } + + @Override + public int hashCode() { + return Objects.hash(indexCode, indexName, indexDesc, level); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcollect/impl/FactIndexCollectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcollect/impl/FactIndexCollectServiceImpl.java index 0a747c1e74..ced6e555e2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcollect/impl/FactIndexCollectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/indexcollect/impl/FactIndexCollectServiceImpl.java @@ -39,7 +39,9 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { public void insertGridPartyMemberData(List formDTO, String customerId) { if (null != formDTO && formDTO.size() > NumConstant.ZERO){ for (int i = NumConstant.ZERO; i < formDTO.size(); i++){ - factIndexPartyAblityCpcMonthlyDao.deleteFactIndexPartyAblityCpcMonthly(formDTO.get(i), customerId); + factIndexPartyAblityCpcMonthlyDao.deleteFactIndexPartyAblityCpcMonthly(customerId, + formDTO.get(i).getAgencyId(), formDTO.get(i).getGridId(), formDTO.get(i).getUserId(), + formDTO.get(i).getYearId(), formDTO.get(i).getMonthId(), formDTO.get(i).getQuarterId()); } factIndexPartyAblityCpcMonthlyDao.batchInsertFactIndexPartyAblityCpcMonthly(formDTO, customerId); } @@ -50,7 +52,9 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { public void insertGridPartyAbility(List formDTO, String customerId) { if (null != formDTO && formDTO.size() > NumConstant.ZERO){ for (int i = NumConstant.ZERO; i < formDTO.size(); i++){ - factIndexPartyAblityGridMonthlyDao.deleteFactIndexPartyAblityGridMonthly(formDTO.get(i), customerId); + factIndexPartyAblityGridMonthlyDao.deleteFactIndexPartyAblityGridMonthly(customerId, + formDTO.get(i).getAgencyId(), formDTO.get(i).getGridId(), formDTO.get(i).getYearId(), + formDTO.get(i).getMonthId(), formDTO.get(i).getQuarterId()); } factIndexPartyAblityGridMonthlyDao.batchInsertFactIndexPartyAblityGridMonthly(formDTO, customerId); } @@ -78,7 +82,9 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { public void insertGridServiceAbility(List formDTO, String customerId) { if (null != formDTO && formDTO.size() > NumConstant.ZERO){ for (int i = NumConstant.ZERO; i < formDTO.size(); i++){ - factIndexServiceAblityGridMonthlyDao.deleteFactIndexServiceAblityGridMonthly(formDTO.get(i), customerId); + factIndexServiceAblityGridMonthlyDao.deleteFactIndexServiceAblityGridMonthly(customerId, + formDTO.get(i).getAgencyId(), formDTO.get(i).getGridId(), formDTO.get(i).getYearId(), + formDTO.get(i).getMonthId(), formDTO.get(i).getQuarterId()); } factIndexServiceAblityGridMonthlyDao.batchInsertFactIndexServiceAblityGridMonthly(formDTO, customerId); } @@ -106,7 +112,9 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { public void insertGridGovrnAbility(List formDTO, String customerId) { if (null != formDTO && formDTO.size() > NumConstant.ZERO){ for (int i = NumConstant.ZERO; i < formDTO.size(); i++){ - factIndexGovrnAblityGridMonthlyDao.deleteFactIndexGovrnAblityGridMonthly(formDTO.get(i), customerId); + factIndexGovrnAblityGridMonthlyDao.deleteFactIndexGovrnAblityGridMonthly(customerId, + formDTO.get(i).getAgencyId(), formDTO.get(i).getGridId(), formDTO.get(i).getYearId(), + formDTO.get(i).getMonthId(), formDTO.get(i).getQuarterId()); } factIndexGovrnAblityGridMonthlyDao.batchInsertFactIndexGovrnAblityGridMonthly(formDTO, customerId); } @@ -134,7 +142,9 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { public void insertDeptGovrnAbility(List formDTO, String customerId) { if (null != formDTO && formDTO.size() > NumConstant.ZERO){ for (int i = NumConstant.ZERO; i < formDTO.size(); i++){ - factIndexGovrnAblityDeptMonthlyDao.deleteFactIndexGovrnAblityDeptMonthly(formDTO.get(i), customerId); + factIndexGovrnAblityDeptMonthlyDao.deleteFactIndexGovrnAblityDeptMonthly(customerId, + formDTO.get(i).getAgencyId(), formDTO.get(i).getDeptId(), formDTO.get(i).getYearId(), + formDTO.get(i).getMonthId(), formDTO.get(i).getQuarterId()); } factIndexGovrnAblityDeptMonthlyDao.batchInsertFactIndexGovrnAblityDeptMonthly(formDTO, customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexDictService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexDictService.java new file mode 100644 index 0000000000..9e3b4f83ed --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexDictService.java @@ -0,0 +1,34 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.screen; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.screen.IndexDictEntity; + +import java.util.Collection; + +/** + * 评价指标字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +public interface IndexDictService extends BaseService { + + Boolean deleteAndInsertBatch(Collection values); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexGroupDetailService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexGroupDetailService.java new file mode 100644 index 0000000000..ea03e298a1 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexGroupDetailService.java @@ -0,0 +1,31 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.screen; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.screen.IndexGroupDetailEntity; + +/** + * 客户指标详情 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +public interface IndexGroupDetailService extends BaseService { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexGroupDetailTemplateService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexGroupDetailTemplateService.java new file mode 100644 index 0000000000..3b0c48f7f9 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexGroupDetailTemplateService.java @@ -0,0 +1,34 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.screen; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.screen.IndexGroupDetailTemplateEntity; + +import java.util.Collection; + +/** + * 客户指标详情 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +public interface IndexGroupDetailTemplateService extends BaseService { + + Boolean deleteAndInsertBatch(Collection values); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexGroupService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexGroupService.java new file mode 100644 index 0000000000..f2ee989bea --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexGroupService.java @@ -0,0 +1,31 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.screen; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.screen.IndexGroupEntity; + +/** + * 客户指标分组 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +public interface IndexGroupService extends BaseService { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexGroupTemplateService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexGroupTemplateService.java new file mode 100644 index 0000000000..1f23716176 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/IndexGroupTemplateService.java @@ -0,0 +1,34 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.screen; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.screen.IndexGroupTemplateEntity; + +import java.util.Collection; + +/** + * 默认指标分组 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +public interface IndexGroupTemplateService extends BaseService { + + Boolean deleteAndInsertBatch(Collection values); +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexDictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexDictServiceImpl.java new file mode 100644 index 0000000000..16e4815226 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexDictServiceImpl.java @@ -0,0 +1,43 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.screen.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.screen.IndexDictDao; +import com.epmet.entity.screen.IndexDictEntity; +import com.epmet.service.screen.IndexDictService; +import org.springframework.stereotype.Service; + +import java.util.Collection; + +/** + * 评价指标字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +@Service +public class IndexDictServiceImpl extends BaseServiceImpl implements IndexDictService { + + + @Override + public Boolean deleteAndInsertBatch(Collection values) { + int n = baseDao.deleteAll(); + return this.insertBatch(values,10); + } +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexGroupDetailServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexGroupDetailServiceImpl.java new file mode 100644 index 0000000000..db9fe1f411 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexGroupDetailServiceImpl.java @@ -0,0 +1,36 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.screen.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.screen.IndexGroupDetailDao; +import com.epmet.entity.screen.IndexGroupDetailEntity; +import com.epmet.service.screen.IndexGroupDetailService; +import org.springframework.stereotype.Service; + +/** + * 客户指标详情 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +@Service +public class IndexGroupDetailServiceImpl extends BaseServiceImpl implements IndexGroupDetailService { + + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexGroupDetailTemplateServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexGroupDetailTemplateServiceImpl.java new file mode 100644 index 0000000000..081f94ef3c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexGroupDetailTemplateServiceImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.screen.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.screen.IndexGroupDetailTemplateDao; +import com.epmet.entity.screen.IndexGroupDetailTemplateEntity; +import com.epmet.service.screen.IndexGroupDetailTemplateService; +import org.springframework.stereotype.Service; + +import java.util.Collection; + +/** + * 客户指标详情 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +@Service +public class IndexGroupDetailTemplateServiceImpl extends BaseServiceImpl implements IndexGroupDetailTemplateService { + + @Override + public Boolean deleteAndInsertBatch(Collection values) { + baseDao.deleteAll(); + return this.insertBatch(values, 10); + } +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexGroupServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexGroupServiceImpl.java new file mode 100644 index 0000000000..5d12ec33d1 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexGroupServiceImpl.java @@ -0,0 +1,35 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.screen.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.screen.IndexGroupDao; +import com.epmet.entity.screen.IndexGroupEntity; +import com.epmet.service.screen.IndexGroupService; +import org.springframework.stereotype.Service; + +/** + * 客户指标分组 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +@Service +public class IndexGroupServiceImpl extends BaseServiceImpl implements IndexGroupService { + +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexGroupTemplateServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexGroupTemplateServiceImpl.java new file mode 100644 index 0000000000..058cf911eb --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/IndexGroupTemplateServiceImpl.java @@ -0,0 +1,43 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.screen.impl; + +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.screen.IndexGroupTemplateDao; +import com.epmet.entity.screen.IndexGroupTemplateEntity; +import com.epmet.service.screen.IndexGroupTemplateService; +import org.springframework.stereotype.Service; + +import java.util.Collection; + +/** + * 客户指标分组 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-08-19 + */ +@Service +public class IndexGroupTemplateServiceImpl extends BaseServiceImpl implements IndexGroupTemplateService { + + @Override + public Boolean deleteAndInsertBatch(Collection values) { + + baseDao.deleteAll(); + return this.insertBatch(values, 10); + } +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/ExcelListener.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/ExcelListener.java new file mode 100644 index 0000000000..e8ad7cbe66 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/ExcelListener.java @@ -0,0 +1,17 @@ +package com.epmet.util; + +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.event.AnalysisEventListener; +import org.apache.poi.ss.formula.functions.T; + +public class ExcelListener extends AnalysisEventListener { + @Override + public void invoke(T t, AnalysisContext analysisContext) { + + } + + @Override + public void doAfterAllAnalysed(AnalysisContext analysisContext) { + System.out.println(analysisContext); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/TestFileUtil.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/TestFileUtil.java new file mode 100644 index 0000000000..865e691e80 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/util/TestFileUtil.java @@ -0,0 +1,35 @@ +package com.epmet.util; + +import java.io.File; +import java.io.InputStream; + +public class TestFileUtil { + + public static InputStream getResourcesFileInputStream(String fileName) { + return Thread.currentThread().getContextClassLoader().getResourceAsStream("" + fileName); + } + + public static String getPath() { + return TestFileUtil.class.getResource("/").getPath(); + } + + public static File createNewFile(String pathName) { + File file = new File(getPath() + pathName); + if (file.exists()) { + file.delete(); + } else { + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + } + return file; + } + + public static File readFile(String pathName) { + return new File(getPath() + pathName); + } + + public static File readUserHomeFile(String pathName) { + return new File(System.getProperty("user.home") + File.separator + pathName); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.3__update_col_data_type.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.3__update_col_data_type.sql new file mode 100644 index 0000000000..05b34b4833 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.3__update_col_data_type.sql @@ -0,0 +1,3 @@ +alter table fact_index_party_ablity_org_monthly MODIFY column DATA_TYPE VARCHAR(100) DEFAULT '' COMMENT '数据类型 allRegion:全区;community:社区;street:街道'; +alter table fact_index_service_ablity_org_monthly MODIFY column DATA_TYPE VARCHAR(100) DEFAULT '' COMMENT '数据类型 allRegion:全区;community:社区;street:街道'; +alter table fact_index_govrn_ablity_org_monthly MODIFY column DATA_TYPE VARCHAR(100) DEFAULT '' COMMENT '数据类型 allRegion:全区;community:社区;street:街道'; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml index 6200f537aa..ed0f65cc79 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml @@ -29,7 +29,7 @@ delete from fact_index_govrn_ablity_grid_monthly - where CUSTOMER_ID = #{customerId} AND AGENCY_ID = #{agencyId} AND GRID_ID = #{gridId} AND USER_ID = #{userId} + where CUSTOMER_ID = #{customerId} AND AGENCY_ID = #{agencyId} AND GRID_ID = #{gridId} AND YEAR_ID = #{yearId} AND MONTH_ID = #{monthId} AND QUARTER_ID = #{quarterId} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexDictDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexDictDao.xml new file mode 100644 index 0000000000..a91513e1d5 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexDictDao.xml @@ -0,0 +1,8 @@ + + + + + + delete from index_dict + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexGroupDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexGroupDao.xml new file mode 100644 index 0000000000..06f0cf0198 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexGroupDao.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexGroupDetailDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexGroupDetailDao.xml new file mode 100644 index 0000000000..b7854f3338 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexGroupDetailDao.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexGroupDetailTemplateDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexGroupDetailTemplateDao.xml new file mode 100644 index 0000000000..ddb138771e --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexGroupDetailTemplateDao.xml @@ -0,0 +1,9 @@ + + + + + + + delete from index_group_detail_template + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexGroupTemplateDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexGroupTemplateDao.xml new file mode 100644 index 0000000000..d527876c4d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexGroupTemplateDao.xml @@ -0,0 +1,8 @@ + + + + + + delete from index_group_template + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml index 73e703ae25..c140b7d3f3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml @@ -21,11 +21,16 @@ ORG_ID, PARENT_ID, ORG_NAME, - USER_TOTAL, + PUBLISH_ISSUE_TOTAL, ISSUE_TOTAL, TOPIC_TOTAL, SHIFT_PROJECT_TOTAL, RESOLVED_PROJECT_TOTAL, + PUBLISH_ISSUE_RATIO, + ISSUE_RATIO, + TOPIC_RATIO, + SHIFT_PROJECT_RATIO, + RESOLVED_PROJECT_TOTAL_RATIO, DEL_FLAG, REVISION, CREATED_BY, @@ -41,11 +46,17 @@ #{item.orgId}, #{item.parentId}, #{item.orgName}, - #{item.userTotal}, + #{item.publishIssueTotal}, #{item.issueTotal}, #{item.topicTotal}, #{item.shiftProjectTotal}, #{item.resolvedProjectTotal}, + + #{item.issueRatio}, + #{item.topicRatio}, + #{item.shiftProjectRatio}, + #{item.resolvedProjectRatio}, + #{item.publishIssueRatio}, 0, 0, 'APP_USER', diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/model/DemoData.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/model/DemoData.java new file mode 100644 index 0000000000..234e66cb58 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/model/DemoData.java @@ -0,0 +1,17 @@ +package com.epmet.stats.test.model; + +import lombok.Data; + +import java.util.Date; + +/** + * 基础数据类.这里的排序和excel里面的排序一致 + * + * @author Jiaju Zhuang + **/ +@Data +public class DemoData { + private String string; + private Date date; + private Double doubleData; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/model/DemoDataListener.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/model/DemoDataListener.java new file mode 100644 index 0000000000..d218327ad1 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/model/DemoDataListener.java @@ -0,0 +1,84 @@ +package com.epmet.stats.test.model; + +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.event.AnalysisEventListener; +import com.alibaba.fastjson.JSON; +import com.epmet.dao.screen.ScreenCustomerAgencyDao; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; + +/** + * 模板的读取类 + * + * @author Jiaju Zhuang + */ +// 有个很重要的点 DemoDataListener 不能被spring管理,要每次读取excel都要new,然后里面用到spring可以构造方法传进去 +public class DemoDataListener extends AnalysisEventListener { + private static final Logger LOGGER = LoggerFactory.getLogger(DemoDataListener.class); + /** + * 每隔5条存储数据库,实际使用中可以3000条,然后清理list ,方便内存回收 + */ + private static final int BATCH_COUNT = 5; + List list = new ArrayList(); + /** + * 假设这个是一个DAO,当然有业务逻辑这个也可以是一个service。当然如果不用存储这个对象没用。 + */ + private ScreenCustomerAgencyDao demoDAO; + + public DemoDataListener() { + // 这里是demo,所以随便new一个。实际使用如果到了spring,请使用下面的有参构造函数 + demoDAO = null; + } + + /** + * 如果使用了spring,请使用这个构造方法。每次创建Listener的时候需要把spring管理的类传进来 + * + * @param demoDAO + */ + public DemoDataListener(ScreenCustomerAgencyDao demoDAO) { + this.demoDAO = demoDAO; + } + + /** + * 这个每一条数据解析都会来调用 + * + * @param data + * one row value. Is is same as {@link AnalysisContext#readRowHolder()} + * @param context + */ + @Override + public void invoke(DemoData data, AnalysisContext context) { + LOGGER.info("解析到一条数据:{}", JSON.toJSONString(data)); + list.add(data); + // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM + if (list.size() >= BATCH_COUNT) { + saveData(); + // 存储完成清理 list + list.clear(); + } + } + + /** + * 所有数据解析完成了 都会来调用 + * + * @param context + */ + @Override + public void doAfterAllAnalysed(AnalysisContext context) { + // 这里也要保存数据,确保最后遗留的数据也存储到数据库 + saveData(); + LOGGER.info("所有数据解析完成!"); + } + + /** + * 加上存储数据库 + */ + private void saveData() { + LOGGER.info("{}条数据,开始存储数据库!", list.size()); + //demoDAO.save(list); + LOGGER.info("存储数据库成功!"); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/ConverterData.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/ConverterData.java new file mode 100644 index 0000000000..9a9be1642d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/ConverterData.java @@ -0,0 +1,30 @@ +package com.epmet.stats.test.read; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.format.DateTimeFormat; +import com.alibaba.excel.annotation.format.NumberFormat; +import lombok.Data; + +/** + * 基础数据类.这里的排序和excel里面的排序一致 + * + * @author Jiaju Zhuang + **/ +@Data +public class ConverterData { + /** + * 我自定义 转换器,不管数据库传过来什么 。我给他加上“自定义:” + */ + @ExcelProperty(converter = CustomStringStringConverter.class) + private String string; + /** + * 这里用string 去接日期才能格式化。我想接收年月日格式 + */ + @DateTimeFormat("yyyy年MM月dd日HH时mm分ss秒") + private String date; + /** + * 我想接收百分比的数字 + */ + @NumberFormat("#.##%") + private String doubleData; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/ConverterDataListener.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/ConverterDataListener.java new file mode 100644 index 0000000000..7c28d41fe8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/ConverterDataListener.java @@ -0,0 +1,48 @@ +package com.epmet.stats.test.read; + +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.event.AnalysisEventListener; +import com.alibaba.fastjson.JSON; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; + +/** + * 模板的读取类 + * + * @author Jiaju Zhuang + */ +public class ConverterDataListener extends AnalysisEventListener { + private static final Logger LOGGER = LoggerFactory.getLogger(ConverterDataListener.class); + /** + * 每隔5条存储数据库,实际使用中可以3000条,然后清理list ,方便内存回收 + */ + private static final int BATCH_COUNT = 5; + List list = new ArrayList(); + + @Override + public void invoke(ConverterData data, AnalysisContext context) { + LOGGER.info("解析到一条数据:{}", JSON.toJSONString(data)); + list.add(data); + if (list.size() >= BATCH_COUNT) { + saveData(); + list.clear(); + } + } + + @Override + public void doAfterAllAnalysed(AnalysisContext context) { + saveData(); + LOGGER.info("所有数据解析完成!"); + } + + /** + * 加上存储数据库 + */ + private void saveData() { + LOGGER.info("{}条数据,开始存储数据库!", list.size()); + LOGGER.info("存储数据库成功!"); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/CustomStringStringConverter.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/CustomStringStringConverter.java new file mode 100644 index 0000000000..584e563a77 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/CustomStringStringConverter.java @@ -0,0 +1,59 @@ +package com.epmet.stats.test.read; + +import com.alibaba.excel.converters.Converter; +import com.alibaba.excel.enums.CellDataTypeEnum; +import com.alibaba.excel.metadata.CellData; +import com.alibaba.excel.metadata.GlobalConfiguration; +import com.alibaba.excel.metadata.property.ExcelContentProperty; + +/** + * String and string converter + * + * @author Jiaju Zhuang + */ +public class CustomStringStringConverter implements Converter { + @Override + public Class supportJavaTypeKey() { + return String.class; + } + + @Override + public CellDataTypeEnum supportExcelTypeKey() { + return CellDataTypeEnum.STRING; + } + + /** + * 这里读的时候会调用 + * + * @param cellData + * NotNull + * @param contentProperty + * Nullable + * @param globalConfiguration + * NotNull + * @return + */ + @Override + public String convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, + GlobalConfiguration globalConfiguration) { + return "自定义:" + cellData.getStringValue(); + } + + /** + * 这里是写的时候会调用 不用管 + * + * @param value + * NotNull + * @param contentProperty + * Nullable + * @param globalConfiguration + * NotNull + * @return + */ + @Override + public CellData convertToExcelData(String value, ExcelContentProperty contentProperty, + GlobalConfiguration globalConfiguration) { + return new CellData(value); + } + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/DemoDAO.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/DemoDAO.java new file mode 100644 index 0000000000..bf09288f59 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/DemoDAO.java @@ -0,0 +1,15 @@ +package com.epmet.stats.test.read; + +import java.util.List; + +/** + * 假设这个是你的DAO存储。当然还要这个类让spring管理,当然你不用需要存储,也不需要这个类。 + * + * @author Jiaju Zhuang + **/ +public class DemoDAO { + + public void save(List list) { + // 如果是mybatis,尽量别直接调用多次insert,自己写一个mapper里面新增一个方法batchInsert,所有数据一次性插入 + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/DemoData.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/DemoData.java new file mode 100644 index 0000000000..ceb3dd37ca --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/DemoData.java @@ -0,0 +1,17 @@ +package com.epmet.stats.test.read; + +import lombok.Data; + +import java.util.Date; + +/** + * 基础数据类.这里的排序和excel里面的排序一致 + * + * @author Jiaju Zhuang + **/ +@Data +public class DemoData { + private String string; + private Date date; + private Double doubleData; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/DemoDataListener.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/DemoDataListener.java new file mode 100644 index 0000000000..539f1903b0 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/DemoDataListener.java @@ -0,0 +1,97 @@ +package com.epmet.stats.test.read; + +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.event.AnalysisEventListener; +import com.alibaba.fastjson.JSON; +import com.epmet.model.IndexModel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * 模板的读取类 + * + * @author Jiaju Zhuang + */ +// 有个很重要的点 DemoDataListener 不能被spring管理,要每次读取excel都要new,然后里面用到spring可以构造方法传进去 +public class DemoDataListener extends AnalysisEventListener { + private static final Logger LOGGER = LoggerFactory.getLogger(DemoDataListener.class); + /** + * 每隔5条存储数据库,实际使用中可以3000条,然后清理list ,方便内存回收 + */ + private static final int BATCH_COUNT = 5; + List list = new ArrayList(); + AtomicInteger total = new AtomicInteger(0); + + private String preWheight; + /** + * 假设这个是一个DAO,当然有业务逻辑这个也可以是一个service。当然如果不用存储这个对象没用。 + */ + private DemoDAO demoDAO; + + public DemoDataListener() { + // 这里是demo,所以随便new一个。实际使用如果到了spring,请使用下面的有参构造函数 + demoDAO = new DemoDAO(); + } + + /** + * 如果使用了spring,请使用这个构造方法。每次创建Listener的时候需要把spring管理的类传进来 + * + * @param demoDAO + */ + public DemoDataListener(DemoDAO demoDAO) { + this.demoDAO = demoDAO; + } + + /** + * 这个每一条数据解析都会来调用 + * + * @param data + * one row value. Is is same as {@link AnalysisContext#readRowHolder()} + * @param context + */ + @Override + public void invoke(IndexModel data, AnalysisContext context) { + if (data == null || data.getIsUsed() == null || data.getIsUsed() != 1){ + return; + } + if ( data.getWeight() != null){ + preWheight = data.getWeight(); + }else{ + data.setWeight(preWheight); + } + LOGGER.info("解析到一条数据:{}", JSON.toJSONString(data)); + list.add(data); + total.addAndGet(1); + // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM + if (list.size() >= BATCH_COUNT) { + saveData(); + // 存储完成清理 list + list.clear(); + } + } + + /** + * 所有数据解析完成了 都会来调用 + * + * @param context + */ + @Override + public void doAfterAllAnalysed(AnalysisContext context) { + // 这里也要保存数据,确保最后遗留的数据也存储到数据库 + saveData(); + LOGGER.info("所有数据解析完成!total:{}",total.intValue()); + } + + /** + * 加上存储数据库 + */ + private void saveData() { + LOGGER.info("{}条数据,开始存储数据库!", list.size()); + //demoDAO.save(list); + LOGGER.info("存储数据库成功!"); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/ReadTest.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/ReadTest.java new file mode 100644 index 0000000000..85ee1e7806 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/read/ReadTest.java @@ -0,0 +1,70 @@ +package com.epmet.stats.test.read; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelReader; +import com.alibaba.excel.read.metadata.ReadSheet; +import com.epmet.model.IndexModel; +import com.epmet.util.TestFileUtil; +import org.junit.Ignore; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.FileNotFoundException; + + +/** + * 读的常见写法 + * + * @author Jiaju Zhuang + */ +@Ignore +public class ReadTest { + + private static final Logger LOGGER = LoggerFactory.getLogger(ReadTest.class); + + + + /** + * 读多个或者全部sheet,这里注意一个sheet不能读取多次,多次读取需要重新读取文件 + *

+ * 1. 创建excel对应的实体对象 参照{@link DemoData} + *

+ * 2. 由于默认一行行的读取excel,所以需要创建excel一行一行的回调监听器,参照{@link DemoDataListener} + *

+ * 3. 直接读即可 + */ + @Test + public void repeatedRead() throws FileNotFoundException { + String fileName = ""; + /* String fileName = TestFileUtil.getPath() + File.separator + "评价指标体系算法需求-备注.xlsx"; + // 读取全部sheet + // 这里需要注意 DemoDataListener的doAfterAllAnalysed 会在每个sheet读取完毕后调用一次。然后所有sheet都会往同一个DemoDataListener里面写 + EasyExcel.read(fileName, IndexModel.class, new DemoDataListener()).doReadAll(); +*/ + // 读取部分sheet + String excelName = "评价指标体系算法需求-备注.xlsx"; + fileName = TestFileUtil.getPath() + File.separator + excelName; + //fileName = this.getClass().getResource(File.separator).getPath().concat(excelName); + ExcelReader excelReader = null; + try { + //ExcelImportUtil.importExcel(null); + + //EasyExcel.read(new FileInputStream(new File(fileName)),IndexModel.class); + excelReader = EasyExcel.read(fileName).build(); + // 这里为了简单 所以注册了 同样的head 和Listener 自己使用功能必须不同的Listener + ReadSheet readSheet1 = + EasyExcel.readSheet(0).head(IndexModel.class).registerReadListener(new DemoDataListener()).build(); + ReadSheet readSheet2 = + EasyExcel.readSheet(1).head(IndexModel.class).registerReadListener(new DemoDataListener()).build(); + // 这里注意 一定要把sheet1 sheet2 一起传进去,不然有个问题就是03版的excel 会读取多次,浪费性能 + excelReader.read(readSheet2); + } finally { + if (excelReader != null) { + // 这里千万别忘记关闭,读的时候会创建临时文件,到时磁盘会崩的 + excelReader.finish(); + } + } + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/util/TestFileUtil.java b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/util/TestFileUtil.java new file mode 100644 index 0000000000..5035e52046 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/com/epmet/stats/test/util/TestFileUtil.java @@ -0,0 +1,35 @@ +package com.epmet.stats.test.util; + +import java.io.File; +import java.io.InputStream; + +public class TestFileUtil { + + public static InputStream getResourcesFileInputStream(String fileName) { + return Thread.currentThread().getContextClassLoader().getResourceAsStream("" + fileName); + } + + public static String getPath() { + return TestFileUtil.class.getResource("/").getPath(); + } + + public static File createNewFile(String pathName) { + File file = new File(getPath() + pathName); + if (file.exists()) { + file.delete(); + } else { + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + } + return file; + } + + public static File readFile(String pathName) { + return new File(getPath() + pathName); + } + + public static File readUserHomeFile(String pathName) { + return new File(System.getProperty("user.home") + File.separator + pathName); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/评价指标体系算法需求-备注.xlsx b/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/评价指标体系算法需求-备注.xlsx new file mode 100644 index 0000000000..592e740466 Binary files /dev/null and b/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/评价指标体系算法需求-备注.xlsx differ diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalAppFormDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalAppFormDTO.java new file mode 100644 index 0000000000..36a504a135 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalAppFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class ExternalAppFormDTO { + + public interface AddExternalApp {} + public interface UpdateExternalApp {} + + @NotBlank(message = "缺少应用ID", groups = { UpdateExternalApp.class }) + private String appId; + + @NotBlank(message = "缺少应用名称", groups = { AddExternalApp.class, UpdateExternalApp.class }) + private String appName; + + @NotBlank(message = "缺少所属客户ID", groups = { AddExternalApp.class, UpdateExternalApp.class }) + private String customerId; + + private Integer pageNo = 1; + private Integer pageSize = 10; + +} diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalCustomerFormDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalCustomerFormDTO.java index da8c394aea..3ec9ccecac 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalCustomerFormDTO.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalCustomerFormDTO.java @@ -3,13 +3,28 @@ package com.epmet.dto.form; import lombok.Data; import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; @Data public class ExternalCustomerFormDTO { - @Min(0) - private Integer pageNo; + public interface ListExternalCustomerGroup {} + public interface AddExternalCustomerGroup {} + public interface UpdateExternalCustomerGroup {} - @Min(0) - private Integer pageSize; + + @NotBlank(message = "缺少客户ID参数", groups = { UpdateExternalCustomerGroup.class }) + private String customerId; + + /** + * 客户名称 + */ + @NotBlank(message = "请填写客户名称", groups = { AddExternalCustomerGroup.class, UpdateExternalCustomerGroup.class }) + private String customerName; + + @Min(value = 0, groups = { ListExternalCustomerGroup.class }) + private Integer pageNo = 1; + + @Min(value = 0, groups = { ListExternalCustomerGroup.class }) + private Integer pageSize = 10; } diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ExternalAppResultDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ExternalAppResultDTO.java new file mode 100644 index 0000000000..e4cf3fedb6 --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/ExternalAppResultDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.result; + +import lombok.Data; + +@Data +public class ExternalAppResultDTO { + + public String appId; + /** + * APP名字 + */ + private String appName; + + /** + * 客户ID + */ + private String customerId; + + /** + * 客户名称 + */ + private String customerName; + + /** + * 秘钥 + */ + private String secret; + +} diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalAppController.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalAppController.java index 1e627e5de8..976c4e4ef0 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalAppController.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalAppController.java @@ -1,10 +1,15 @@ package com.epmet.controller; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.ExternalAppAuthFormDTO; +import com.epmet.dto.form.ExternalAppFormDTO; import com.epmet.dto.result.ExternalAppAuthResultDTO; +import com.epmet.dto.result.ExternalAppResultDTO; import com.epmet.service.ExternalAppAuthService; +import com.epmet.service.ExternalAppService; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -23,6 +28,9 @@ public class ExternalAppController { @Autowired private ExternalAppAuthService externalAppAuthService; + @Autowired + private ExternalAppService externalAppService; + /** * 外部请求认证 * @param formDTO @@ -41,4 +49,50 @@ public class ExternalAppController { return new Result().ok(auth); } + /** + * 添加应用 + * @param formDTO + * @return + */ + @PostMapping("/add") + public Result add(@RequestBody ExternalAppFormDTO formDTO) { + + ValidatorUtils.validateEntity(formDTO, ExternalAppFormDTO.AddExternalApp.class); + + String appName = formDTO.getAppName(); + String customerId = formDTO.getCustomerId(); + + ExternalAppResultDTO dto = externalAppService.add(appName, customerId); + return new Result().ok(dto); + } + + /** + * 修改应用 + * @param formDTO + * @return + */ + @PostMapping("/update") + public Result update(@RequestBody ExternalAppFormDTO formDTO) { + + ValidatorUtils.validateEntity(formDTO, ExternalAppFormDTO.UpdateExternalApp.class); + + String appId = formDTO.getAppId(); + String appName = formDTO.getAppName(); + String customerId = formDTO.getCustomerId(); + + ExternalAppResultDTO dto = externalAppService.updateById(appId, appName, customerId); + return new Result().ok(dto); + } + + /** + * 查询列表 + * @param formDTO + * @return + */ + @PostMapping("/list") + public Result> list(@RequestBody ExternalAppFormDTO formDTO) { + PageData page = externalAppService.listPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getCustomerId()); + return new Result>().ok(page); + } + } diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalCustomerController.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalCustomerController.java index e5ae0ae464..2817a2fae5 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalCustomerController.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalCustomerController.java @@ -1,13 +1,12 @@ package com.epmet.controller; -import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.ExternalAppAuthFormDTO; import com.epmet.dto.form.ExternalCustomerFormDTO; -import com.epmet.dto.result.ExternalAppAuthResultDTO; -import com.epmet.service.ExternalAppAuthService; -import org.apache.commons.lang3.StringUtils; +import com.epmet.dto.result.ExternalCustomerResultDTO; +import com.epmet.entity.ExternalCustomerEntity; +import com.epmet.service.ExternalCustomerService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -16,7 +15,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; /** * 外部客户管理 @@ -28,20 +27,46 @@ public class ExternalCustomerController { private static Logger logger = LoggerFactory.getLogger(ExternalCustomerController.class); @Autowired - private ExternalAppAuthService externalAppAuthService; + private ExternalCustomerService externalCustomerService; /** * 外部客户管理 * @return */ @PostMapping("/list") - public Result list(@RequestBody ExternalCustomerFormDTO form) { - ValidatorUtils.validateEntity(form); + public Result> list(@RequestBody ExternalCustomerFormDTO form) { + ValidatorUtils.validateEntity(form, ExternalCustomerFormDTO.ListExternalCustomerGroup.class); Integer pageNo = form.getPageNo(); Integer pageSize = form.getPageSize(); + PageData page = externalCustomerService.listPage(pageNo, pageSize); + return new Result>().ok(page); + } + /** + * 添加外部客户 + * @param formDTO + * @return + */ + @PostMapping("add") + public Result add(@RequestBody ExternalCustomerFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, ExternalCustomerFormDTO.AddExternalCustomerGroup.class); + String customerName = formDTO.getCustomerName(); + ExternalCustomerEntity result = externalCustomerService.add(customerName); + return new Result().ok(result); + } - return null; + /** + * 更新客户信息 + * @param formDTO + * @return + */ + @PostMapping("update") + public Result update(@RequestBody ExternalCustomerFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, ExternalCustomerFormDTO.UpdateExternalCustomerGroup.class); + String customerId = formDTO.getCustomerId(); + String customerName = formDTO.getCustomerName(); + ExternalCustomerEntity result = externalCustomerService.update(customerId, customerName); + return new Result().ok(result); } } diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppDao.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppDao.java index f07f428cfd..73f6bd3407 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppDao.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppDao.java @@ -18,8 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.ExternalAppResultDTO; import com.epmet.entity.ExternalAppEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 外部应用列表 @@ -29,5 +33,10 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ExternalAppDao extends BaseDao { - + + Integer countByAppNameAndCustomerId(@Param("appName") String appName, @Param("customerId") String customerId); + + ExternalAppResultDTO getByNameAndCustomerId(@Param("appName") String appName, @Param("customerId") String customerId); + + List list(@Param("customerId") String customerId); } \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalCustomerDao.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalCustomerDao.java index b22be4caf9..e8d67410ac 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalCustomerDao.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalCustomerDao.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.result.ExternalCustomerResultDTO; import com.epmet.entity.ExternalCustomerEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -38,4 +39,18 @@ public interface ExternalCustomerDao extends BaseDao { * @return */ List listBaseInfo(); + + /** + * 根据名称查询客户 + * @param customerName + * @return + */ + ExternalCustomerResultDTO getByCustomerName(@Param("customerName") String customerName); + + /** + * 根据客户名称计数 + * @param customerName + * @return + */ + Integer countByCustomerName(@Param("customerName") String customerName); } \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppAuthService.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppAuthService.java index aff79d5f72..e1158c592c 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppAuthService.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppAuthService.java @@ -1,6 +1,7 @@ package com.epmet.service; import com.epmet.dto.result.ExternalAppAuthResultDTO; +import com.epmet.dto.result.ExternalAppResultDTO; public interface ExternalAppAuthService { diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppService.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppService.java index 5799ea0abb..dff718695f 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppService.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppService.java @@ -17,6 +17,9 @@ package com.epmet.service; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.result.ExternalAppResultDTO; + /** * 外部应用列表 * @@ -24,4 +27,9 @@ package com.epmet.service; * @since v1.0.0 2020-08-18 */ public interface ExternalAppService { + ExternalAppResultDTO add(String appName, String customerId); + + ExternalAppResultDTO updateById(String appId, String appName, String customerId); + + PageData listPage(Integer pageNo, Integer pageSize, String customerId); } \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalCustomerService.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalCustomerService.java index bcc8d10cc6..6af116be98 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalCustomerService.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalCustomerService.java @@ -1,11 +1,14 @@ package com.epmet.service; +import com.epmet.commons.tools.page.PageData; import com.epmet.dto.result.ExternalCustomerResultDTO; - -import java.util.List; +import com.epmet.entity.ExternalCustomerEntity; public interface ExternalCustomerService { - public List list(Integer pageNo, Integer pageSize); + PageData listPage(Integer pageNo, Integer pageSize); + + ExternalCustomerEntity add(String customerName); + ExternalCustomerEntity update(String customerId, String customerName); } diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppAuthServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppAuthServiceImpl.java index 822e654cbb..e87a4c6f46 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppAuthServiceImpl.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppAuthServiceImpl.java @@ -1,10 +1,15 @@ package com.epmet.service.impl; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.dao.ExternalAppDao; import com.epmet.dao.ExternalAppSecretDao; import com.epmet.dto.result.ExternalAppAuthResultDTO; +import com.epmet.dto.result.ExternalAppResultDTO; +import com.epmet.entity.ExternalAppEntity; import com.epmet.entity.ExternalAppSecretEntity; import com.epmet.service.ExternalAppAuthService; import com.epmet.utils.externalapp.ExtAppJwtTokenUtils; @@ -29,6 +34,9 @@ public class ExternalAppAuthServiceImpl implements ExternalAppAuthService { @Autowired private ExternalAppSecretDao externalAppSecretDao; + @Autowired + private ExternalAppDao externalAppDao; + private int diffMillins = 1000 * 60 * 5; @Override diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppServiceImpl.java index 1621e74e2d..5f92de268e 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppServiceImpl.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppServiceImpl.java @@ -17,8 +17,24 @@ package com.epmet.service.impl; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dao.ExternalAppDao; +import com.epmet.dao.ExternalAppSecretDao; +import com.epmet.dao.ExternalCustomerDao; +import com.epmet.dto.result.ExternalAppResultDTO; +import com.epmet.entity.ExternalAppEntity; +import com.epmet.entity.ExternalAppSecretEntity; import com.epmet.service.ExternalAppService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.UUID; /** * 外部应用列表 @@ -29,5 +45,89 @@ import org.springframework.stereotype.Service; @Service public class ExternalAppServiceImpl implements ExternalAppService { + @Autowired + private ExternalAppDao externalAppDao; + + @Autowired + private ExternalAppSecretDao externalAppSecretDao; + + @Autowired + private ExternalCustomerDao externalCustomerDao; + + @Transactional + @Override + public ExternalAppResultDTO add(String appName, String customerId) { + Integer count = externalAppDao.countByAppNameAndCustomerId(appName, customerId); + if (count > 0) { + throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_EXISTS.getCode(), + EpmetErrorCode.OPER_EXTERNAL_APP_EXISTS.getMsg()); + } + + if (externalCustomerDao.selectById(customerId) == null) { + throw new RenException(EpmetErrorCode.OPER_EXTERNAL_CUSTOMER_NOT_EXISTS.getCode(), + EpmetErrorCode.OPER_EXTERNAL_CUSTOMER_NOT_EXISTS.getMsg()); + } + + // 应用表插入 + ExternalAppEntity appEntity = new ExternalAppEntity(); + appEntity.setAppName(appName); + appEntity.setCustomerId(customerId); + externalAppDao.insert(appEntity); + + // 秘钥表插入 + ExternalAppSecretEntity secretEntity = new ExternalAppSecretEntity(); + secretEntity.setAppId(appEntity.getId()); + secretEntity.setSecret(genSecret()); + externalAppSecretDao.insert(secretEntity); + + ExternalAppResultDTO dto = new ExternalAppResultDTO(); + dto.setAppName(appName); + dto.setCustomerId(customerId); + dto.setAppId(appEntity.getId()); + return dto; + } + + /** + * 生成秘钥 + * @return + */ + private String genSecret() { + String part1 = UUID.randomUUID().toString(); + String part2 = UUID.randomUUID().toString(); + return part1.concat(part2).replace("-", ""); + } + + @Override + public ExternalAppResultDTO updateById(String appId, String appName, String customerId) { + ExternalAppEntity exists = externalAppDao.selectById(appId); + if (exists == null) { + throw new RenException(EpmetErrorCode.OPER_EXTERNAL_CUSTOMER_NOT_EXISTS.getCode(), + EpmetErrorCode.OPER_EXTERNAL_CUSTOMER_NOT_EXISTS.getMsg()); + } + + ExternalAppResultDTO byName = externalAppDao.getByNameAndCustomerId(appName, customerId); + if (byName != null && !byName.getAppId().equals(appId)) { + // 说明改了之后的名字跟当前客户内的其他应用重复 + throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_EXISTS.getCode(), "应用名称重复"); + } + + exists.setAppName(appName); + exists.setCustomerId(customerId); + externalAppDao.updateById(exists); + + ExternalAppResultDTO resultDTO = new ExternalAppResultDTO(); + resultDTO.setAppId(appId); + resultDTO.setCustomerId(customerId); + resultDTO.setAppName(appName); + return resultDTO; + } + + @Override + public PageData listPage(Integer pageNo, Integer pageSize, String customerId) { + PageHelper.startPage(pageNo, pageSize); + List list = externalAppDao.list(customerId); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } } \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalCustomerServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalCustomerServiceImpl.java index 9925841b0f..8cfe32cf96 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalCustomerServiceImpl.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalCustomerServiceImpl.java @@ -1,7 +1,11 @@ package com.epmet.service.impl; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.page.PageData; import com.epmet.dao.ExternalCustomerDao; import com.epmet.dto.result.ExternalCustomerResultDTO; +import com.epmet.entity.ExternalCustomerEntity; import com.epmet.service.ExternalCustomerService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -17,10 +21,36 @@ public class ExternalCustomerServiceImpl implements ExternalCustomerService { private ExternalCustomerDao externalCustomerDao; @Override - public List list(Integer pageNo, Integer pageSize) { + public PageData listPage(Integer pageNo, Integer pageSize) { PageHelper.startPage(pageNo, pageSize); List customers = externalCustomerDao.listBaseInfo(); - PageInfo pageInfo = new PageInfo<>(customers); - return null; + long total = new PageInfo<>(customers).getTotal(); + + PageData pageData = new PageData<>(customers, (int) total); + return pageData; + } + + @Override + public ExternalCustomerEntity add(String customerName) { + Integer exitsCustomerCount = externalCustomerDao.countByCustomerName(customerName); + if (exitsCustomerCount > 0) { + throw new RenException(EpmetErrorCode.OPER_CUSTOMER_EXISTS.getCode(), "客户已存在"); + } + ExternalCustomerEntity entity = new ExternalCustomerEntity(); + entity.setCustomerName(customerName); + externalCustomerDao.insert(entity); + return entity; + } + + @Override + public ExternalCustomerEntity update(String customerId, String customerName) { + ExternalCustomerEntity existsCustomer = externalCustomerDao.selectById(customerId); + if (existsCustomer == null) { + throw new RenException(EpmetErrorCode.OPER_EXTERNAL_CUSTOMER_NOT_EXISTS.getCode(), + EpmetErrorCode.OPER_EXTERNAL_CUSTOMER_NOT_EXISTS.getMsg()); + } + existsCustomer.setCustomerName(customerName); + externalCustomerDao.updateById(existsCustomer); + return existsCustomer; } } diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppDao.xml b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppDao.xml index 8662bc5f97..588f735da7 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppDao.xml +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppDao.xml @@ -15,5 +15,50 @@ + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalCustomerDao.xml b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalCustomerDao.xml index 9d59a01224..0e4d03d0cc 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalCustomerDao.xml +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalCustomerDao.xml @@ -25,5 +25,21 @@ DEL_FLAG = 0 + + + + \ No newline at end of file