diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
index a83670615d..2887ed1adf 100644
--- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
+++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java
@@ -26,6 +26,7 @@ import java.util.Date;
* @since 1.0.0
*/
public class DateUtils {
+
/** 时间格式(yyyy-MM-dd) */
public final static String DATE_PATTERN = "yyyy-MM-dd";
/** 时间格式(yyyy-MM-dd HH:mm:ss) */
@@ -37,7 +38,9 @@ public class DateUtils {
public static final String DATE_PATTERN_YYYYMMDD = "yyyyMMdd";
public static final String DATE_NAME_PATTERN = "yyyy年MM月dd日";
+ public static final String MONTH_NAME_PATTERN = "yyyy年MM月";
public static final String DATE_PATTERN_YYYY = "yyyy";
+ public static final String DATE_PATTERN_YYYYMM = "yyyyMM";
public static final String WEEK_TYPE_ENGLISH = "english";
public static final String WEEK_TYPE_CHINESE = "chinese";
@@ -244,11 +247,41 @@ public class DateUtils {
return DateUtils.parse(DateUtils.format(targetDate, pattern), pattern);
}
+ /**
+ * 查询指定日期是几月
+ * @param date
+ * @return
+ */
+ public static int getMonthOfYear(Date date) {
+ LocalDate localDate = new LocalDate(date);
+ return localDate.getMonthOfYear();
+ }
+
+ /**
+ * 获取季度
+ * @param date
+ * @return
+ */
+ public static int getQuarterIndex(Date date) {
+ LocalDate localDate = new LocalDate(date);
+ int monthOfYear = localDate.getMonthOfYear();
+ if (monthOfYear == 1 || monthOfYear == 2 || monthOfYear == 3) {
+ return 1;
+ }
+ if (monthOfYear == 4 || monthOfYear == 5 || monthOfYear == 6) {
+ return 2;
+ }
+ if (monthOfYear == 7 || monthOfYear == 8 || monthOfYear == 9) {
+ return 3;
+ }
+ return 4;
+ }
+
public static void main(String[] args) {
//int weekOfYear = getWeekOfYear(new Date());
- String e = DateUtils.format(new Date(), "E");
+ int quarterIndex = DateUtils.getQuarterIndex(DateUtils.parse("20201001", DateUtils.DATE_PATTERN_YYYYMMDD));
- System.out.println(e);
+ System.out.println(666);
}
}
diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java
index 47a18e3a72..f79ab899cf 100644
--- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java
+++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java
@@ -7,5 +7,6 @@ public interface DataSourceConstant {
String GOV_ISSUE = "govIssue";
String GOV_PROJECT = "govProject";
String GOV_VOICE = "govVoice";
+ String OPER_CRM = "operCrm";
}
diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/DimDateDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/DimDateDTO.java
index 75c3bf51f8..e539cda274 100644
--- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/DimDateDTO.java
+++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/DimDateDTO.java
@@ -88,4 +88,6 @@ public class DimDateDTO implements Serializable {
*/
private Date updatedTime;
+ private String monthId;
+
}
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml
index a68e4b48d3..dcd55b9ad9 100644
--- a/epmet-module/data-statistical/data-statistical-server/pom.xml
+++ b/epmet-module/data-statistical/data-statistical-server/pom.xml
@@ -129,6 +129,12 @@
epmet_gov_voice_userEpmEt-db-UsEr
+
+
+
+ epmet_oper_crm_user
+ EpmEt-db-UsEr
+
0192.168.1.130
@@ -191,7 +197,13 @@
epmet
- elink@833066
+ elink@8473066
+
+
+
+
+ epmet
+ elink@84730660
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java
index d9439f5b67..c393a74bb3 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java
@@ -3,6 +3,7 @@ package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.service.StatsDimService;
import com.epmet.service.stats.DimDateService;
+import com.epmet.service.stats.DimMonthService;
import oracle.jdbc.proxy.annotation.Post;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@@ -16,6 +17,9 @@ public class DimController {
@Autowired
private DimDateService dimDateService;
+ @Autowired
+ private DimMonthService dimMonthService;
+
@Autowired
private StatsDimService statsDimService;
@@ -49,4 +53,34 @@ public class DimController {
return new Result();
}
+ /**
+ * 客户维度
+ * @return
+ */
+ @PostMapping("/customer/init")
+ public Result intiCustomerDim() {
+ statsDimService.initCustomerDim();
+ return new Result();
+ }
+
+ /**
+ * 部门维度
+ * @return
+ */
+ @PostMapping("/department/init")
+ public Result intiDepartmentDim() {
+ statsDimService.initDepartmentDim();
+ return new Result();
+ }
+
+ /**
+ * 月维度
+ * @return
+ */
+ @PostMapping("/month/init")
+ public Result initMonthDim() {
+ dimMonthService.initMonthDim();
+ return new Result();
+ }
+
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerDao.java
new file mode 100644
index 0000000000..bfe699c25e
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerDao.java
@@ -0,0 +1,46 @@
+/**
+ * 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.crm;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.entity.crm.CustomerEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 客户表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-03-11
+ */
+@Mapper
+public interface CustomerDao extends BaseDao {
+
+ /**
+ * 根据创建时间起止查询有效客户列表
+ * @param createTimeFrom
+ * @param createTimeTo
+ * @return
+ */
+ List listValidCustomersByCreateTime(
+ @Param("createTimeFrom") Date createTimeFrom,
+ @Param("createTimeTo") Date createTimeTo);
+}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java
new file mode 100644
index 0000000000..2b9b4705ab
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java
@@ -0,0 +1,41 @@
+/**
+ * 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.org;
+
+import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.entity.org.CustomerDepartmentEntity;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 客户部门表
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2020-04-20
+ */
+@Mapper
+public interface CustomerDepartmentDao extends BaseDao {
+
+ List listDepartmentsByCreatedTime(
+ @Param("createdTimeFrom") Date createdTimeFrom,
+ @Param("createdTimeTo") Date createdTimeTo);
+
+}
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/crm/CustomerEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/crm/CustomerEntity.java
new file mode 100644
index 0000000000..a2fa408a43
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/crm/CustomerEntity.java
@@ -0,0 +1,91 @@
+/**
+ * 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.
+ *
+ * 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.
+ *