瀏覽代碼

ems架构整理

learshaw 6 月之前
父節點
當前提交
29e2e39c40
共有 65 個文件被更改,包括 1461 次插入5047 次删除
  1. 144 0
      common-application/ruoyi-common/src/main/java/com/ruoyi/common/exception/Assert.java
  2. 59 0
      common-application/ruoyi-common/src/main/java/com/ruoyi/common/exception/BusinessException.java
  3. 768 13
      common-application/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java
  4. 5 3
      common-application/ruoyi-common/src/main/java/com/ruoyi/common/utils/ListUtils.java
  5. 1 1
      common-application/ruoyi-common/src/main/java/com/ruoyi/common/utils/filter/ObjConverter.java
  6. 1 1
      common-application/ruoyi-common/src/main/java/com/ruoyi/common/utils/filter/ObjectFilter.java
  7. 1 1
      common-cloud/.gitignore
  8. 0 1
      common-cloud/pom.xml
  9. 0 189
      common-cloud/prod-common/pom.xml
  10. 0 85
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/bean/BaseConverter.java
  11. 0 104
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/bean/Contains.java
  12. 0 48
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/bean/PageParam.java
  13. 0 68
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/bean/Response.java
  14. 0 101
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/bean/poi/CellStyle.java
  15. 0 48
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/bean/poi/SheetFooter.java
  16. 0 220
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/bean/poi/SheetMain.java
  17. 0 100
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/bean/poi/WorkbookConfig.java
  18. 0 40
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/enums/Encoding.java
  19. 0 57
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/enums/HttpResultCode.java
  20. 0 74
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/exception/ErrorCode.java
  21. 0 96
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/task/DynamicTask.java
  22. 0 72
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/task/TaskConfiguration.java
  23. 0 49
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/task/TimingTask.java
  24. 0 162
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/ByteArrayConverterUtils.java
  25. 0 179
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/CloseUtils.java
  26. 0 130
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/CommonUtils.java
  27. 0 95
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/CompareUtils.java
  28. 0 119
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/CoordinateTransformUtil.java
  29. 0 68
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/DataSourceUtils.java
  30. 0 721
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/DateUtils.java
  31. 0 176
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/ExcelUtils.java
  32. 0 891
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/ExcelXlsUtils.java
  33. 0 381
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/ExcelXlsxUtils.java
  34. 0 90
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/FileUtils.java
  35. 0 110
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/GeoUtils.java
  36. 0 39
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/ResourceUtils.java
  37. 0 80
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/Sha256Utils.java
  38. 0 73
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/SpringUtils.java
  39. 0 53
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/SwaggerUtils.java
  40. 0 215
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/TestUtils.java
  41. 0 56
      common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/UnicodeUtils.java
  42. 186 0
      common-cloud/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/Assert.java
  43. 59 0
      common-cloud/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/BusinessException.java
  44. 141 0
      common-cloud/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/ListUtils.java
  45. 30 0
      common-cloud/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/filter/ObjConverter.java
  46. 28 0
      common-cloud/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/filter/ObjectFilter.java
  47. 1 1
      ems/.gitignore
  48. 0 6
      ems/ems-application/ems-admin/pom.xml
  49. 1 1
      ems/ems-application/ems-admin/src/main/java/com/ruoyi/web/controller/ems/ChargingBillController.java
  50. 1 1
      ems/ems-application/ems-admin/src/main/java/com/ruoyi/web/controller/ems/DeviceController.java
  51. 1 1
      ems/ems-application/ems-admin/src/main/java/com/ruoyi/web/controller/ems/EmsObjAttrController.java
  52. 3 3
      ems/ems-application/ems-admin/src/main/java/com/ruoyi/web/controller/ems/MeterReadingController.java
  53. 1 1
      ems/ems-application/ems-admin/src/main/java/com/ruoyi/web/controller/ems/OpEnergyStrategyController.java
  54. 0 6
      ems/ems-application/pom.xml
  55. 6 3
      ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/EmsApplication.java
  56. 1 1
      ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/AreaController.java
  57. 1 1
      ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/ChargingBillController.java
  58. 1 1
      ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/DeviceController.java
  59. 1 1
      ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/EmsObjAttrController.java
  60. 2 2
      ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/MeterReadingController.java
  61. 1 1
      ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/OpEnergyStrategyController.java
  62. 0 6
      ems/ems-core/pom.xml
  63. 2 1
      ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/AreaElectricityAttrServiceImpl.java
  64. 2 1
      ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/OpEnergyStrategyParamServiceImpl.java
  65. 13 0
      ems/sql/ems_init_data.sql

+ 144 - 0
common-application/ruoyi-common/src/main/java/com/ruoyi/common/exception/Assert.java

@@ -0,0 +1,144 @@
+/*
+ * 文 件 名:  Assert
+ * 版    权:  浩鲸云计算科技股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lv.wenbin@huashe.com
+ * 修改时间:  2019/4/21
+ */
+package com.ruoyi.common.exception;
+
+
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * 断言 <功能详细描述>
+ *
+ * @author lv.wenbin@huashe.com
+ * @version [版本号, 2019/4/21]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public abstract class Assert {
+    /**
+     * 真假断言 <功能详细描述>
+     *
+     * @param expression 真假
+     * @param errorCode  错误码
+     * @param message    错误消息
+     * @throws BusinessException 异常
+     * @see [类、类#方法、类#成员]
+     */
+    public static void isTrue(boolean expression, int errorCode, String message) throws BusinessException {
+        if (!expression) {
+            throw new BusinessException(errorCode, message);
+        }
+    }
+
+    /**
+     * 真假断言 <功能详细描述>
+     *
+     * @param expression 真假
+     * @param errorCode  错误码
+     * @param message    错误消息
+     * @param ext        扩展属性
+     * @throws BusinessException 异常
+     * @see [类、类#方法、类#成员]
+     */
+    public static void isTrue(boolean expression, int errorCode, String message, Object ext) throws BusinessException {
+        if (!expression) {
+            throw new BusinessException(errorCode, message, ext);
+        }
+    }
+
+    /**
+     * 空判断 <功能详细描述>
+     *
+     * @param object    对象
+     * @param errorCode 错误码
+     * @param message   错误消息
+     * @throws BusinessException 异常
+     * @see [类、类#方法、类#成员]
+     */
+    public static void isNull(Object object, int errorCode, String message) throws BusinessException {
+        if (object != null) {
+            throw new BusinessException(errorCode, message);
+        }
+    }
+
+    /**
+     * 非空判断 <功能详细描述>
+     *
+     * @param object    对象
+     * @param errorCode 错误码
+     * @param message   错误消息
+     * @throws BusinessException 异常
+     * @see [类、类#方法、类#成员]
+     */
+    public static void notNull(Object object, int errorCode, String message) throws BusinessException {
+        if (object == null) {
+            throw new BusinessException(errorCode, message);
+        }
+    }
+
+    /**
+     * 数组非空判断 <功能详细描述>
+     *
+     * @param array     数组
+     * @param errorCode 错误码
+     * @param message   错误消息
+     * @throws BusinessException 异常
+     * @see [类、类#方法、类#成员]
+     */
+    public static void notEmpty(Object[] array, int errorCode, String message) throws BusinessException {
+        if (array == null || array.length == 0) {
+            throw new BusinessException(errorCode, message);
+        }
+    }
+
+    /**
+     * 集合非空判断 <功能详细描述>
+     *
+     * @param collection 集合列表
+     * @param errorCode  错误码
+     * @param message    错误信息
+     * @throws BusinessException 异常
+     * @see [类、类#方法、类#成员]
+     */
+    public static <T> void notEmpty(Collection<T> collection, int errorCode, String message) throws BusinessException {
+        if (collection == null || collection.isEmpty()) {
+            throw new BusinessException(errorCode, message);
+        }
+    }
+
+    /**
+     * Map非空判断
+     *
+     * @param map       Map Map集合
+     * @param errorCode 错误码
+     * @param message   错误信息
+     * @throws BusinessException 异常
+     * @see [类、类#方法、类#成员]
+     */
+    public static <K, V> void notEmpty(Map<K, V> map, int errorCode, String message) throws BusinessException {
+        if (map == null || map.isEmpty()) {
+            throw new BusinessException(errorCode, message);
+        }
+    }
+
+    /**
+     * 字符串空判断 <功能详细描述>
+     *
+     * @param str       字符串
+     * @param errorCode 错误码
+     * @param message   错误信息
+     * @throws BusinessException 异常
+     * @see [类、类#方法、类#成员]
+     */
+    public static void notEmpty(String str, int errorCode, String message) throws BusinessException {
+        if (str == null || str.length() == 0) {
+            throw new BusinessException(errorCode, message);
+        }
+    }
+}

+ 59 - 0
common-application/ruoyi-common/src/main/java/com/ruoyi/common/exception/BusinessException.java

@@ -0,0 +1,59 @@
+package com.ruoyi.common.exception;
+
+/**
+ * 业务异常
+ *
+ * @author ruoyi
+ */
+public class BusinessException extends RuntimeException {
+    /**
+     * 错误码
+     */
+    protected int code;
+
+    protected final String message;
+
+    /**
+     * 扩展属性
+     */
+    private Object ext;
+
+    public BusinessException(String message) {
+        this.message = message;
+    }
+
+    public BusinessException(int code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public BusinessException(String message, Throwable e) {
+        super(message, e);
+        this.message = message;
+    }
+
+    public BusinessException(int code, String message, Throwable e) {
+        super(message, e);
+        this.code = code;
+        this.message = message;
+    }
+
+    public BusinessException(int code, String message, Object ext) {
+        this.code = code;
+        this.message = message;
+        this.ext = ext;
+    }
+
+    @Override
+    public String getMessage() {
+        return message;
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public Object getExt() {
+        return ext;
+    }
+}

+ 768 - 13
common-application/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java

@@ -1,5 +1,11 @@
 package com.ruoyi.common.utils;
 
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.exception.ExceptionUtils;
+import org.apache.commons.lang3.time.DateFormatUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import java.lang.management.ManagementFactory;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -8,12 +14,15 @@ import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.ZoneId;
 import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.Calendar;
 import java.util.Date;
-import org.apache.commons.lang3.time.DateFormatUtils;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
 
 /**
  * 时间工具类
- * 
+ *
  * @author ruoyi
  */
 public class DateUtils extends org.apache.commons.lang3.time.DateUtils
@@ -28,14 +37,16 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
 
     public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
 
+    private static final Logger log = LoggerFactory.getLogger(DateUtils.class);
+
     private static String[] parsePatterns = {
-            "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", 
+            "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
             "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
             "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
 
     /**
      * 获取当前Date型日期
-     * 
+     *
      * @return Date() 当前日期
      */
     public static Date getNowDate()
@@ -45,7 +56,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
 
     /**
      * 获取当前日期, 默认格式为yyyy-MM-dd
-     * 
+     *
      * @return String
      */
     public static String getDate()
@@ -137,14 +148,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
     }
 
     /**
-     * 计算相差天数
-     */
-    public static int differentDaysByMillisecond(Date date1, Date date2)
-    {
-        return Math.abs((int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24)));
-    }
-
-    /**
      * 计算时间差
      *
      * @param endDate 最后时间
@@ -188,4 +191,756 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
         return Date.from(zdt.toInstant());
     }
+
+    /**
+     * $ 时间年偏移 <功能详细描述>
+     *
+     * @param date 日期
+     * @param offset 偏移量
+     * @return date 日期
+     * @see [类、类#方法、类#成员]
+     */
+    public static Date adjustYear(Date date, int offset) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.add(Calendar.YEAR, offset);
+        Date newDate = calendar.getTime();
+        return newDate;
+    }
+
+    /**
+     * $时间年偏移 <功能详细描述>
+     *
+     * @param time yyyyMMddHHmmss
+     * @param offset 偏移量
+     * @return yyyyMMddHHmmss
+     * @see [类、类#方法、类#成员]
+     */
+    public static String adjustYear(String time, int offset) {
+        return adjustYear(time, offset, YYYYMMDDHHMMSS);
+    }
+
+    /**
+     * $时间年偏移 <功能详细描述>
+     *
+     * @param time yyyyMMddHHmmss
+     * @param offset 偏移量
+     * @param format 格式化
+     * @return yyyyMMddHHmmss
+     * @see [类、类#方法、类#成员]
+     */
+    public static String adjustYear(String time, int offset, String format) {
+        SimpleDateFormat formatter = new SimpleDateFormat(format);
+        String retTime = null;
+
+        try {
+            Date date = formatter.parse(time);
+            Date newDate = adjustYear(date, offset);
+            retTime = formatter.format(newDate);
+        }
+        catch (ParseException e) {
+            log.error("adjustYear fail!" + ExceptionUtils.getStackTrace(e));
+        }
+
+        return retTime;
+    }
+
+    /**
+     * 时间月偏移
+     * @param date 日期
+     * @param offset 偏移量
+     * @return date 日期
+     */
+    public static Date adjustMonth(Date date, int offset) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.add(Calendar.MONTH, offset);
+        Date newDate = calendar.getTime();
+        return newDate;
+    }
+
+    /**
+     * $时间月偏移 <功能详细描述>
+     *
+     * @param time yyyyMMddHHmmss
+     * @param offset 偏移量
+     * @return yyyyMMddHHmmss
+     * @see [类、类#方法、类#成员]
+     */
+    public static String adjustMonth(String time, int offset) {
+        return adjustMonth(time, offset, YYYYMMDDHHMMSS);
+    }
+
+    /**
+     * $时间月偏移 <功能详细描述>
+     *
+     * @param time yyyyMMddHHmmss
+     * @param offset 偏移量
+     * @param format 格式化时间
+     * @return yyyyMMddHHmmss
+     * @see [类、类#方法、类#成员]
+     */
+    public static String adjustMonth(String time, int offset, String format) {
+        SimpleDateFormat formatter = new SimpleDateFormat(format);
+        String retTime = null;
+
+        try {
+            Date date = formatter.parse(time);
+            Date newDate = adjustMonth(date, offset);
+            retTime = formatter.format(newDate);
+        }
+        catch (ParseException e) {
+            log.error("adjustMonth fail!" + ExceptionUtils.getStackTrace(e));
+        }
+
+        return retTime;
+    }
+
+    /**
+     * $时间周偏移 <功能详细描述>
+     *
+     * @param date 日期
+     * @param offset 偏移量
+     * @return date
+     * @see [类、类#方法、类#成员]
+     */
+    public static Date adjustWeek(Date date, int offset) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.add(Calendar.DATE, 7 * offset);
+        Date newDate = calendar.getTime();
+        return newDate;
+    }
+
+    /**
+     * $时间周偏移 <功能详细描述>
+     *
+     * @param time yyyyMMddHHmmss
+     * @param offset 偏移量
+     * @return yyyyMMddHHmmss
+     * @see [类、类#方法、类#成员]
+     */
+    public static String adjustWeek(String time, int offset) {
+        return adjustWeek(time, offset, YYYYMMDDHHMMSS);
+    }
+
+    /**
+     * $时间周偏移 <功能详细描述>
+     *
+     * @param time 字符串日期
+     * @param offset 偏移量
+     * @return yyyyMMddHHmmss
+     * @see [类、类#方法、类#成员]
+     */
+    public static String adjustWeek(String time, int offset, String format) {
+        SimpleDateFormat formatter = new SimpleDateFormat(format);
+        String retTime = null;
+
+        try {
+            Date date = formatter.parse(time);
+            Date newDate = adjustWeek(date, offset);
+            retTime = formatter.format(newDate);
+        }
+        catch (ParseException e) {
+            log.error("adjustWeek fail!" + ExceptionUtils.getStackTrace(e));
+        }
+
+        return retTime;
+    }
+
+    /**
+     * $时间日偏移 <功能详细描述>
+     *
+     * @param date 日期
+     * @param offset 偏移量
+     * @return yyyyMMddHHmmss
+     * @see [类、类#方法、类#成员]
+     */
+    public static Date adjustDay(Date date, int offset) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.add(Calendar.DATE, offset);
+        Date newDate = calendar.getTime();
+        return newDate;
+    }
+
+    /**
+     * $时间日偏移 <功能详细描述>
+     *
+     * @param time yyyyMMddHHmmss
+     * @param offset 偏移量
+     * @return yyyyMMddHHmmss
+     * @see [类、类#方法、类#成员]
+     */
+    public static String adjustDay(String time, int offset) {
+        return adjustDay(time, offset, YYYYMMDDHHMMSS);
+    }
+
+    /**
+     * $时间日偏移 <功能详细描述>
+     *
+     * @param time 字符串日期
+     * @param offset 偏移量
+     * @return yyyyMMddHHmmss
+     * @see [类、类#方法、类#成员]
+     */
+    public static String adjustDay(String time, int offset, String format) {
+        SimpleDateFormat formatter = new SimpleDateFormat(format);
+        String retTime = null;
+
+        try {
+            Date date = formatter.parse(time);
+            Date newDate = adjustDay(date, offset);
+            retTime = formatter.format(newDate);
+        }
+        catch (ParseException e) {
+            log.error("adjustDay fail!" + ExceptionUtils.getStackTrace(e));
+        }
+
+        return retTime;
+    }
+
+    /**
+     * $时间小时偏移 <功能详细描述>
+     *
+     * @param date 日期
+     * @param offset 偏移量
+     * @return yyyyMMddHHmmss
+     * @see [类、类#方法、类#成员]
+     */
+    public static Date adjustHour(Date date, int offset) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.add(Calendar.HOUR_OF_DAY, offset);
+        Date newDate = calendar.getTime();
+
+        return newDate;
+    }
+
+    /**
+     * $时间小时偏移 <功能详细描述>
+     *
+     * @param time yyyyMMddHHmmss
+     * @param offset 偏移量
+     * @return yyyyMMddHHmmss
+     * @see [类、类#方法、类#成员]
+     */
+    public static String adjustHour(String time, int offset) {
+        return adjustHour(time, offset, YYYYMMDDHHMMSS);
+    }
+
+    /**
+     * $时间小时偏移 <功能详细描述>
+     *
+     * @param time yyyyMMddHHmmss
+     * @param offset 偏移量
+     * @return yyyyMMddHHmmss
+     * @see [类、类#方法、类#成员]
+     */
+    public static String adjustHour(String time, int offset, String format) {
+        SimpleDateFormat formatter = new SimpleDateFormat(format);
+        String retTime = null;
+
+        try {
+            Date date = formatter.parse(time);
+            Date newDate = adjustHour(date, offset);
+            retTime = formatter.format(newDate);
+        }
+        catch (ParseException e) {
+            log.error("adjustHour fail!" + ExceptionUtils.getStackTrace(e));
+        }
+
+        return retTime;
+    }
+
+    /**
+     * $时间分钟偏移 <功能详细描述>
+     *
+     * @param date 日期
+     * @param offset 偏移量
+     * @return yyyyMMddHHmmss
+     * @see [类、类#方法、类#成员]
+     */
+    public static Date adjustMinute(Date date, int offset) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.add(Calendar.MINUTE, offset);
+        Date newDate = calendar.getTime();
+        return newDate;
+    }
+
+    /**
+     * $时间分钟偏移 <功能详细描述>
+     *
+     * @param time yyyyMMddHHmmss
+     * @param offset 偏移量
+     * @return yyyyMMddHHmmss
+     * @see [类、类#方法、类#成员]
+     */
+    public static String adjustMinute(String time, int offset) {
+        return adjustMinute(time, offset, YYYYMMDDHHMMSS);
+    }
+
+    /**
+     * $时间分钟偏移 <功能详细描述>
+     *
+     * @param time 字符串日期
+     * @param offset 偏移量
+     * @return yyyyMMddHHmmss
+     * @see [类、类#方法、类#成员]
+     */
+    public static String adjustMinute(String time, int offset, String format) {
+        SimpleDateFormat formatter = new SimpleDateFormat(format);
+        String retTime = null;
+
+        try {
+            Date date = formatter.parse(time);
+            Date newDate = adjustMinute(date, offset);
+            retTime = formatter.format(newDate);
+        }
+        catch (ParseException e) {
+            log.error("adjustMinute fail!" + ExceptionUtils.getStackTrace(e));
+        }
+
+        return retTime;
+    }
+
+    /**
+     * $时间秒偏移 <功能详细描述>
+     *
+     * @param date 字符串日期
+     * @param offset 偏移量
+     * @return yyyyMMddHHmmss
+     * @see [类、类#方法、类#成员]
+     */
+    public static Date adjustSecond(Date date, int offset) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.add(Calendar.SECOND, offset);
+        Date newDate = calendar.getTime();
+        return newDate;
+    }
+
+    /**
+     * $时间秒偏移 <功能详细描述>
+     *
+     * @param time yyyyMMddHHmmss
+     * @param offset 偏移量
+     * @return yyyyMMddHHmmss
+     * @see [类、类#方法、类#成员]
+     */
+    public static String adjustSecond(String time, int offset) {
+        return adjustSecond(time, offset, YYYYMMDDHHMMSS);
+    }
+
+    /**
+     * $时间秒偏移 <功能详细描述>
+     *
+     * @param time yyyyMMddHHmmss
+     * @param offset 偏移量
+     * @return yyyyMMddHHmmss
+     * @see [类、类#方法、类#成员]
+     */
+    public static String adjustSecond(String time, int offset, String format) {
+        SimpleDateFormat formatter = new SimpleDateFormat(format);
+        String retTime = null;
+
+        try {
+            Date date = formatter.parse(time);
+            Date newDate = adjustSecond(date, offset);
+            retTime = formatter.format(newDate);
+        }
+        catch (ParseException e) {
+            log.error("adjustSecond fail!" + ExceptionUtils.getStackTrace(e));
+        }
+
+        return retTime;
+    }
+
+    /**
+     * $获取两个间隔日期间的天数 <功能详细描述>
+     *
+     * @param timeBefore yyyyMMdd格式
+     * @param timeAfter yyyyMMdd格式
+     * @return 天数
+     * @see [类、类#方法、类#成员]
+     */
+    public static int getDayBetween(String timeBefore, String timeAfter) {
+        SimpleDateFormat sd = new SimpleDateFormat("yyyyMMdd");
+        long num = 0;
+
+        try {
+            long diff = sd.parse(timeAfter).getTime() - sd.parse(timeBefore).getTime();
+            num = diff / (1000 * 24 * 60 * 60);
+        }
+        catch (ParseException e) {
+            log.error("getDayBetween fail!", e);
+        }
+
+        return (int) num;
+    }
+
+    /**
+     * $获取一个月最后一天
+     *
+     * @param time yyyyMMdd格式
+     * @return 日期
+     * @see [类、类#方法、类#成员]
+     */
+    public static String getMaxDateOfMonth(String time, String format) {
+        SimpleDateFormat sd = new SimpleDateFormat(format);
+        Calendar cDay = Calendar.getInstance();
+
+        try {
+            Date date = sd.parse(time);
+            cDay.setTime(date);
+        }
+        catch (ParseException e) {
+            log.error("getMaxDateOfMonth fail!", e);
+        }
+
+        return String.valueOf(cDay.getActualMaximum(Calendar.DAY_OF_MONTH));
+    }
+
+    /**
+     * Date转String <br>
+     * 根据format格式转换时间为字符串
+     *
+     * @param date 时刻
+     * @param format 转换模板
+     * @return 字符串日期
+     * @see [类、类#方法、类#成员]
+     */
+    public static String dateToString(Date date, String format) {
+        if (date == null) {
+            date = new Date();
+        }
+
+        SimpleDateFormat formatter = new SimpleDateFormat(format);
+        String retTime = formatter.format(date);
+
+        return retTime;
+    }
+
+    /**
+     * $格式化取时间
+     *
+     * @param dateString yyyyMMddHHmmss时刻
+     * @param format 转换模板
+     * @return 字符串日期
+     * @see [类、类#方法、类#成员]
+     */
+    public static String formater(String dateString, String format) {
+        Date date = stringToDate(dateString);
+        SimpleDateFormat formatter = new SimpleDateFormat(format);
+        String retTime = formatter.format(date);
+
+        return retTime;
+    }
+
+    /**
+     * 格式化取时间
+     * @param dateString 字符串日期
+     * @param from 源格式
+     * @param to 目标格式
+     * @return String
+     */
+    public static String formater(String dateString, String from, String to) {
+        Date date = stringToDate(dateString, from);
+        SimpleDateFormat formatter = new SimpleDateFormat(to);
+        String retTime = formatter.format(date);
+
+        return retTime;
+    }
+
+    /**
+     * $时间转换 <功能详细描述>
+     *
+     * @param dateKey 天
+     * @param timeKey  时间
+     * @param format 格式
+     * @return String
+     * @see [类、类#方法、类#成员]
+     */
+    public static String formater(int dateKey, int timeKey, String format) {
+        int year = dateKey / 10000;
+        int month = (dateKey / 100) % 100;
+        int day = dateKey % 100;
+        int hour = timeKey / 10000;
+        int min = (timeKey / 100) % 100;
+        int second = timeKey % 100;
+
+        GregorianCalendar calender = new GregorianCalendar(year, month - 1, day, hour, min, second);
+        return dateToString(calender.getTime(), format);
+    }
+
+    /**
+     * Date转String <br>
+     * 根据format格式转换时间为字符串
+     *
+     * @param date 时刻
+     * @return 字符串日期
+     * @see [类、类#方法、类#成员]
+     */
+    public static String dateToString(Date date) {
+        return dateToString(date, YYYY_MM_DD_HH_MM_SS);
+    }
+
+    /**
+     * String转Date <br>
+     * 根据format格式转换时间为字符串
+     *
+     * @param dateString 时刻
+     * @return date
+     * @see [类、类#方法、类#成员]
+     */
+    public static Date stringToDate(String dateString) {
+        return stringToDate(dateString, YYYYMMDDHHMMSS);
+    }
+
+    /**
+     * String转Date
+     * @param dateString 字符串日期
+     * @param format 格式
+     * @return date
+     */
+    public static Date stringToDate(String dateString, String format) {
+        SimpleDateFormat sd = new SimpleDateFormat(format);
+        Date date = null;
+
+        try {
+            date = sd.parse(dateString);
+        }
+        catch (ParseException e) {
+            log.error("stringToDate fail!", e);
+        }
+
+        return date;
+    }
+
+    /**
+     * String转Calendar <br>
+     * 根据format格式转换时间为字符串
+     *
+     * @param dateString 时刻
+     * @return Calendar
+     * @see [类、类#方法、类#成员]
+     */
+    public static Calendar stringToCalendar(String dateString) {
+        if ((dateString == null) || (dateString.length() < 14)) {
+            throw new IllegalArgumentException(dateString);
+        }
+
+        Date date = stringToDate(dateString);
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+
+        return calendar;
+    }
+
+    /**
+     * String转Calendar <br>
+     * 根据format格式转换时间为字符串
+     *
+     * @param dateString 时间字符串
+     * @param format 格式
+     * @return Calendar
+     * @see [类、类#方法、类#成员]
+     */
+    public static Calendar stringToCalendar(String dateString, String format) {
+        Date date = stringToDate(dateString, format);
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        return calendar;
+    }
+
+    /**
+     * $获取当前时间 <功能详细描述>
+     *
+     * @return String yyyyMMddHHmmss
+     * @see [类、类#方法、类#成员]
+     */
+    public static String getCurrentTime() {
+        return dateToString(new Date(), YYYYMMDDHHMMSS);
+    }
+
+    /**
+     * $获取两个时间之间的间隔(毫秒) <功能详细描述>
+     *
+     * @param d1 日期1
+     * @param d2 日期2
+     * @return
+     * @see [类、类#方法、类#成员]
+     */
+    public static long getTimeBetween(Date d1, Date d2) {
+        return Math.abs(d2.getTime() - d1.getTime());
+    }
+
+    /**
+     * $获取星期几
+     *
+     * @param date 输入日期
+     * @return 星期几
+     */
+    public static int getWeekOfDate(Date date) {
+        Calendar cd = Calendar.getInstance();
+        cd.setTime(date);
+        int wd = cd.get(Calendar.DAY_OF_WEEK);
+
+        if (wd == 1) {
+            return 7;
+        }
+        else {
+            return wd - 1;
+        }
+    }
+
+    /**
+     * $早高峰区间
+     */
+    private static final String[] MORING_PEAK_INTERVAL = new String[] {
+        "070000", "090000"
+    };
+
+    /**
+     * $晚高峰区间
+     */
+    private static final String[] EVENING_PEAK_INTERVAL = new String[] {
+        "170000", "190000"
+    };
+
+    /**
+     * $平峰区间
+     */
+    private static final String[] FLAT_PEAK_INTERVAL = new String[] {
+        "090000", "170000"
+    };
+
+    /**
+     * $判断是否早高峰 <07:00~09:00>
+     *
+     * @param date 输入日期
+     * @return boolean
+     */
+    public static boolean checkMoringPeak(Date date) {
+        String time = StringUtils.substring(dateToString(date, YYYYMMDDHHMMSS), 8, 14);
+        return StringUtils.compare(time, MORING_PEAK_INTERVAL[0]) >= 0
+            && StringUtils.compare(time, MORING_PEAK_INTERVAL[1]) <= 0;
+    }
+
+    /**
+     * $判断是否晚高峰 <07:00~09:00>
+     *
+     * @param date 输入日期
+     * @return boolean
+     */
+    public static boolean checkEveningPeak(Date date) {
+        String time = StringUtils.substring(dateToString(date, YYYYMMDDHHMMSS), 8, 14);
+        return StringUtils.compare(time, EVENING_PEAK_INTERVAL[0]) >= 0
+            && StringUtils.compare(time, EVENING_PEAK_INTERVAL[1]) <= 0;
+    }
+
+    /**
+     * $判断是否平峰 <09:00~17:00>
+     *
+     * @param date 输入日期
+     * @return boolean
+     */
+    public static boolean checkFlatPeak(Date date) {
+        String time = StringUtils.substring(dateToString(date, YYYYMMDDHHMMSS), 8, 14);
+        return StringUtils.compare(time, FLAT_PEAK_INTERVAL[0]) >= 0
+            && StringUtils.compare(time, FLAT_PEAK_INTERVAL[1]) <= 0;
+    }
+
+    /**
+     * $判断是否工作日 <功能详细描述>
+     *
+     * @param date 日期
+     * @return
+     * @see [类、类#方法、类#成员]
+     */
+    public static boolean checkWorkDay(Date date) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        int wd = calendar.get(Calendar.DAY_OF_WEEK) - 1;
+        return wd >= 1 && wd <= 5;
+    }
+
+    /**
+     * $判断是否非工作日 <功能详细描述>
+     *
+     * @param date 日期
+     * @return
+     * @see [类、类#方法、类#成员]
+     */
+    public static boolean checkNoWorkDay(Date date) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        int wd = calendar.get(Calendar.DAY_OF_WEEK) - 1;
+        return wd == 6 || wd == 0;
+    }
+
+    public static Integer dateToStepIndex(String YmDHms, String tp) {
+        LocalDateTime localDateTime = LocalDateTime.parse(YmDHms, DateTimeFormatter.ofPattern(YYYY_MM_DD_HH_MM_SS));
+        int hour = localDateTime.getHour();
+        int minute = localDateTime.getMinute();
+        int stepIndex = 0;
+
+        if (tp.endsWith("mi")) {
+            int interval = Integer.parseInt(tp.split("mi")[0]);
+            Double floor = Math.floor((hour * 60 + minute) / (double) interval);
+            stepIndex = floor.intValue();
+        }
+        else if (tp.endsWith("h")) {
+            stepIndex = hour;
+        }
+        return stepIndex;
+    }
+
+    /**
+     * 计算时间序列 - 当前时刻是当天第N个时间片
+     * @param period 时间片间隔
+     * @param timeStr 当前时间yyyy-MM-dd HH:mm:ss
+     * @return 时间序列
+     */
+    public static int buildColTimeIndex(long period, String timeStr) {
+        long dataTp = period / 60;
+        return dateToStepIndex(timeStr, dataTp + "mi");
+    }
+
+    public static String dateToUtcString(Date date){
+        SimpleDateFormat sdfutc = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm'Z'");
+        sdfutc.setTimeZone(TimeZone.getTimeZone("UTC"));
+        String format = sdfutc.format(date);
+        return format;
+    }
+
+    public static Date stringUtcToDate(String date) {
+        SimpleDateFormat sdfutc = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+        sdfutc.setTimeZone(TimeZone.getTimeZone("UTC"));
+        Date parse = null;
+        try {
+            parse = sdfutc.parse(date);
+        } catch (ParseException e) {
+            log.error("mongoDbUtcToBjDate fail!" + ExceptionUtils.getStackTrace(e));
+        }
+
+        return parse;
+    }
+
+    public static Date currentDateZeroHours(Date date){
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date parse = null;
+        try {
+            parse = simpleDateFormat.parse(simpleDateFormat.format(date));
+        } catch (ParseException e) {
+            log.error("currentDateZeroHours fail!" + ExceptionUtils.getStackTrace(e));
+        }
+        return parse;
+    }
+
+    public static Integer secondDifferenceCount(Date start,Date end,Integer frequency){
+        Long count = (end.getTime()-start.getTime())/frequency;
+        return count.intValue();
+    }
 }

+ 5 - 3
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/ListUtils.java → common-application/ruoyi-common/src/main/java/com/ruoyi/common/utils/ListUtils.java

@@ -6,10 +6,12 @@
  * 修改时间:  2018年09月20日
  * 修改内容:  <修改内容>
  */
-package com.huashe.citybrain.commons.base.utils;
+package com.ruoyi.common.utils;
 
-import com.huashe.citybrain.commons.base.filter.ObjConverter;
-import com.huashe.citybrain.commons.base.filter.ObjectFilter;
+
+
+import com.ruoyi.common.utils.filter.ObjConverter;
+import com.ruoyi.common.utils.filter.ObjectFilter;
 import org.apache.commons.collections4.CollectionUtils;
 
 import java.util.ArrayList;

+ 1 - 1
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/filter/ObjConverter.java → common-application/ruoyi-common/src/main/java/com/ruoyi/common/utils/filter/ObjConverter.java

@@ -8,7 +8,7 @@
  * 修改单号:  <修改单号>
  * 修改内容:  <修改内容>
  */
-package com.huashe.citybrain.commons.base.filter;
+package com.ruoyi.common.utils.filter;
 
 /**
  * 对象转换器

+ 1 - 1
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/filter/ObjectFilter.java → common-application/ruoyi-common/src/main/java/com/ruoyi/common/utils/filter/ObjectFilter.java

@@ -6,7 +6,7 @@
  * 修改时间:  2018年9月20日
  * 修改内容:  <修改内容>
  */
-package com.huashe.citybrain.commons.base.filter;
+package com.ruoyi.common.utils.filter;
 
 /**
  * 对象过滤器 <功能详细描述>

+ 1 - 1
common-cloud/.gitignore

@@ -2,7 +2,7 @@
 *.iml
 *.ipr
 *.iws
-.idea/
+.idea/*
 
 # Compiled class file
 *.class

+ 0 - 1
common-cloud/pom.xml

@@ -245,7 +245,6 @@
         <module>ruoyi-api</module>
         <module>ruoyi-auth</module>
         <module>ruoyi-modules</module>
-        <module>prod-common</module>
     </modules>
 
     <packaging>pom</packaging>

+ 0 - 189
common-cloud/prod-common/pom.xml

@@ -1,189 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <groupId>com.huashe</groupId>
-    <artifactId>prod-common</artifactId>
-    <version>1.0-SNAPSHOT</version>
-
-    <description>
-        common通用工具
-    </description>
-
-    <properties>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
-        <java.version>1.8</java.version>
-    </properties>
-
-    <dependencies>
-
-        <!-- Spring框架基本的核心工具 -->
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-context-support</artifactId>
-            <version>5.3.33</version>
-        </dependency>
-
-        <!-- SpringWeb模块 -->
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-web</artifactId>
-            <version>5.3.33</version>
-        </dependency>
-
-        <!-- spring security 安全认证 -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-security</artifactId>
-            <version>2.7.18</version>
-        </dependency>
-
-        <!-- pagehelper 分页插件 -->
-        <dependency>
-            <groupId>com.github.pagehelper</groupId>
-            <artifactId>pagehelper-spring-boot-starter</artifactId>
-            <version>2.0.0</version>
-        </dependency>
-
-        <!-- 自定义验证注解 -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-validation</artifactId>
-            <version>2.7.18</version>
-        </dependency>
-
-        <!--常用工具类 -->
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-lang3</artifactId>
-            <version>3.12.0</version>
-        </dependency>
-  
-        <!-- JSON工具类 -->
-        <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-databind</artifactId>
-            <version>2.13.5</version>
-        </dependency>
-        
-        <!-- 阿里JSON解析器 -->
-        <dependency>
-            <groupId>com.alibaba.fastjson2</groupId>
-            <artifactId>fastjson2</artifactId>
-            <version>2.0.43</version>
-        </dependency>
-
-        <!-- io常用工具类 -->
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-            <version>2.13.0</version>
-        </dependency>
-
-        <!-- excel工具 -->
-        <dependency>
-            <groupId>org.apache.poi</groupId>
-            <artifactId>poi-ooxml</artifactId>
-            <version>4.1.2</version>
-        </dependency>
-
-        <!-- redis 缓存操作 -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-data-redis</artifactId>
-            <version>2.7.18</version>
-        </dependency>
-
-        <!-- pool 对象池 -->
-        <dependency>
-            <groupId>org.apache.commons</groupId>
-            <artifactId>commons-pool2</artifactId>
-            <version>2.11.1</version>
-        </dependency>
-
-        <dependency>
-            <groupId>io.springfox</groupId>
-            <artifactId>springfox-swagger2</artifactId>
-            <version>3.0.0</version>
-        </dependency>
-        <dependency>
-            <groupId>io.springfox</groupId>
-            <artifactId>springfox-swagger-ui</artifactId>
-            <version>3.0.0</version>
-        </dependency>
-
-        <!-- Druid 数据库连接池依赖 -->
-        <dependency>
-            <groupId>com.alibaba</groupId>
-            <artifactId>druid</artifactId>
-            <version>1.2.20</version>
-        </dependency>
-        <dependency>
-            <groupId>org.quartz-scheduler</groupId>
-            <artifactId>quartz</artifactId>
-            <version>2.3.2</version>
-        </dependency>
-
-        <!-- servlet包 -->
-        <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>javax.servlet-api</artifactId>
-            <version>4.0.1</version>
-        </dependency>
-
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.8.0</version>
-                <configuration>
-                    <source>${java.version}</source>
-                    <target>${java.version}</target>
-                    <encoding>${project.build.sourceEncoding}</encoding>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
-    <repositories>
-        <repository>
-            <id>nexus</id>
-            <name>Team Nexus Repository</name>
-            <url>http://maven.xt.wenhq.top:8083/repository/maven-public/</url>
-            <snapshots>
-                <enabled>true</enabled>
-                <updatePolicy>always</updatePolicy>
-                <checksumPolicy>warn</checksumPolicy>
-            </snapshots>
-            <releases>
-                <enabled>true</enabled>
-                <updatePolicy>always</updatePolicy>
-                <checksumPolicy>warn</checksumPolicy>
-            </releases>
-        </repository>
-    </repositories>
-
-    <distributionManagement>
-        <repository>
-            <id>hs-private-repo</id>
-            <url>http://maven.xt.wenhq.top:8083/repository/maven-releases/</url>
-        </repository>
-        <snapshotRepository>
-            <id>hs-private-snapshot-repo</id>
-            <url>http://maven.xt.wenhq.top:8083/repository/maven-snapshots/</url>
-        </snapshotRepository>
-    </distributionManagement>
-
-    <pluginRepositories>
-        <pluginRepository>
-            <id>nexus</id>
-            <name>Team Nexus Repository</name>
-            <url>http://maven.xt.wenhq.top:8083/repository/maven-public/</url>
-        </pluginRepository>
-    </pluginRepositories>
-</project>

+ 0 - 85
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/bean/BaseConverter.java

@@ -1,85 +0,0 @@
-/*
- * 文 件 名:  BaseConverter
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  learshaw
- * 修改时间:  2019/8/5
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.bean;
-
-import org.apache.commons.collections4.CollectionUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.BeanUtils;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * 对象转换工具
- * <功能详细描述>
- *
- * @author learshaw
- * @version [版本号, 2019/8/5]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public class BaseConverter<P, V> {
-    public static final Logger log = LoggerFactory.getLogger(BaseConverter.class);
-
-    /**
-     * 单个对象转换
-     *
-     * @param from  单个PO
-     * @param clazz 目标对象Class
-     * @return 目标对象VO
-     */
-    public V convert(P from, Class<V> clazz) {
-        if (from == null) {
-            return null;
-        }
-
-        V to = null;
-
-        try {
-            to = clazz.newInstance();
-        }
-        catch (Exception e) {
-            log.error("初始化{}对象失败。", clazz, e);
-        }
-
-        convert(from, to);
-        return to;
-    }
-
-    /**
-     * 对象列表转换
-     *
-     * @param fromList 待转换PO列表
-     * @param clazz    目标对象Class
-     * @return 目标对象列表
-     */
-    public List<V> convert(List<P> fromList, Class<V> clazz) {
-        if (CollectionUtils.isEmpty(fromList)) {
-            return new ArrayList<>();
-        }
-
-        List<V> toList = new ArrayList<>();
-
-        for (P from : fromList) {
-            toList.add(convert(from, clazz));
-        }
-
-        return toList;
-    }
-
-    /**
-     * 属性拷贝方法,有特殊需求时子类覆写此方法
-     */
-    protected void convert(P from, V to) {
-        BeanUtils.copyProperties(from, to);
-    }
-}

+ 0 - 104
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/bean/Contains.java

@@ -1,104 +0,0 @@
-/*
- * 文 件 名:  ChassisContains
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  learshaw
- * 修改时间:  2019/8/7
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.bean;
-
-/**
- * 常量类
- * <功能详细描述>
- *
- * @author learshaw
- * @version [版本号, 2019/8/7]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public final class Contains {
-    /**
-     * 私有构造防止类被无意义实例化
-     */
-    private Contains() {
-        throw new AssertionError();
-    }
-
-    /**
-     * -1
-     */
-    public static final int NEGATIVE_ONE = -1;
-
-    /**
-     * 数字0
-     */
-    public static final int ZERO = 0;
-
-    /**
-     * 数字1
-     */
-    public static final int ONE = 1;
-
-    /**
-     * 数字2
-     */
-    public static final int TWO = 2;
-
-    /**
-     * 数字3
-     */
-    public static final int THREE = 3;
-
-    /**
-     * 数字4
-     */
-    public static final int FOUR = 4;
-
-    /**
-     * 数字5
-     */
-    public static final int FIVE = 5;
-
-    /**
-     * 系统默认时间格式
-     */
-    public static final String DEFAULT_TIME_FORMAT = "yyyyMMddHHmmss";
-
-    /**
-     * 系统默认时间格式
-     */
-    public static final String DEFAULT_DATE_FORMAT = "yyyyMMdd";
-
-    /**
-     * 通用时间展示格式
-     */
-    public static final String COMMON_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
-
-    /**
-     * 通用日期展示格式
-     */
-    public static final String COMMON_DATE_FORMAT = "yyyy-MM-dd";
-
-    /**
-     * 时/分/秒初始
-     */
-    public static final String DAY_START_TIME = "000000";
-
-    /**
-     * 时/分/秒末尾
-     */
-    public static final String DAY_END_TIME = "235959";
-
-    /**
-     * 补秒位(最小)
-     */
-    public static final String SECOND_START_TIME = "00";
-
-    /**
-     * 补秒位(最大)
-     */
-    public static final String SECOND_END_TIME = "59";
-}

+ 0 - 48
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/bean/PageParam.java

@@ -1,48 +0,0 @@
-/*
- * 文 件 名:  PageParam
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  learshaw
- * 修改时间:  2019/8/12
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.bean;
-
-/**
- * 分页
- * <功能详细描述>
- *
- * @author learshaw
- * @version [版本号, 2019/8/12]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public class PageParam {
-    /**
-     * 页码
-     */
-    private int pageIndex;
-
-    /**
-     * 每页记录数
-     */
-    private int pageCount;
-
-    public int getPageIndex() {
-        return pageIndex;
-    }
-
-    public void setPageIndex(int pageIndex) {
-        this.pageIndex = pageIndex;
-    }
-
-    public int getPageCount() {
-        return pageCount;
-    }
-
-    public void setPageCount(int pageCount) {
-        this.pageCount = pageCount;
-    }
-}

+ 0 - 68
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/bean/Response.java

@@ -1,68 +0,0 @@
-/*
- * 文 件 名:  Response
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  lv.wenbin@huashe.com
- * 修改时间:  2019/2/15
- */
-package com.huashe.citybrain.commons.base.bean;
-
-/**
- * 公共响应 <功能详细描述>
- *
- * @author lv.wenbin@huashe.com
- * @version [版本号, 2019/2/15]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public class Response<T> {
-    /**
-     * 响应码
-     */
-    private int code;
-
-    /**
-     * 描述
-     */
-    private String message;
-
-    /**
-     * 携带载体
-     */
-    private T data;
-
-    /**
-     * 无参构造
-     */
-    public Response() {
-    }
-
-    public Response(int code, String message) {
-        this.code = code;
-        this.message = message;
-    }
-
-    public int getCode() {
-        return code;
-    }
-
-    public void setCode(int code) {
-        this.code = code;
-    }
-
-    public String getMessage() {
-        return message;
-    }
-
-    public void setMessage(String message) {
-        this.message = message;
-    }
-
-    public T getData() {
-        return data;
-    }
-
-    public void setData(T data) {
-        this.data = data;
-    }
-}

+ 0 - 101
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/bean/poi/CellStyle.java

@@ -1,101 +0,0 @@
-/*
- * 文 件 名:  CellStyle
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  learshaw
- * 修改时间:  2019/8/13
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.bean.poi;
-
-
-/**
- * 单元格样式
- * <功能详细描述>
- *
- * @author learshaw
- * @version [版本号, 2019/8/13]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public class CellStyle {
-    /**
-     * 字体大小
-     */
-    private short fontSize = 11;
-
-    /**
-     * 字体名称
-     */
-    private String fontName = "宋体";
-
-    /**
-     * 是否加粗
-     */
-    private boolean fontBold = false;
-
-    /**
-     * 是否有边框
-     */
-    private boolean borderFlag = false;
-
-    /**
-     * 是否水平居中
-     */
-    private boolean alignmentCenter = false;
-
-    /**
-     * 是否垂直居中
-     */
-    private boolean verticalAlignmentCenter = true;
-
-    public short getFontSize() {
-        return fontSize;
-    }
-
-    public void setFontSize(short fontSize) {
-        this.fontSize = fontSize;
-    }
-
-    public String getFontName() {
-        return fontName;
-    }
-
-    public void setFontName(String fontName) {
-        this.fontName = fontName;
-    }
-
-    public boolean isFontBold() {
-        return fontBold;
-    }
-
-    public void setFontBold(boolean fontBold) {
-        this.fontBold = fontBold;
-    }
-
-    public boolean isBorderFlag() {
-        return borderFlag;
-    }
-
-    public void setBorderFlag(boolean borderFlag) {
-        this.borderFlag = borderFlag;
-    }
-
-    public boolean isAlignmentCenter() {
-        return alignmentCenter;
-    }
-
-    public void setAlignmentCenter(boolean alignmentCenter) {
-        this.alignmentCenter = alignmentCenter;
-    }
-
-    public boolean isVerticalAlignmentCenter() {
-        return verticalAlignmentCenter;
-    }
-
-    public void setVerticalAlignmentCenter(boolean verticalAlignmentCenter) {
-        this.verticalAlignmentCenter = verticalAlignmentCenter;
-    }
-}

+ 0 - 48
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/bean/poi/SheetFooter.java

@@ -1,48 +0,0 @@
-/*
- * 文 件 名:  SheetFooter
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  learshaw
- * 修改时间:  2019/8/13
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.bean.poi;
-
-/**
- * 工作表页脚对象
- * <功能详细描述>
- *
- * @author learshaw
- * @version [版本号, 2019/8/13]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public class SheetFooter {
-    /**
-     * 名称
-     */
-    private String name;
-
-    /**
-     * 值
-     */
-    private String value;
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public void setValue(String value) {
-        this.value = value;
-    }
-}

+ 0 - 220
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/bean/poi/SheetMain.java

@@ -1,220 +0,0 @@
-/*
- * 文 件 名:  SheetMain
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  learshaw
- * 修改时间:  2019/8/13
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.bean.poi;
-
-import java.util.List;
-
-/**
- * 创建Excel文件对象主体
- * <功能详细描述>
- *
- * @author learshaw
- * @version [版本号, 2019/8/13]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public class SheetMain<T> {
-    /**
-     * 开始行
-     */
-    private int startRow = 0;
-
-    /**
-     * 开始列
-     */
-    private int startCell = 0;
-
-    /**
-     * 工作表名称
-     */
-    private String sheetName;
-
-    /**
-     * 工作表标题
-     */
-    private String sheetTitle;
-
-    /**
-     * 工作表标题样式
-     */
-    private CellStyle titleCellStyle;
-
-    /**
-     * 工作表头标题
-     */
-    private List<String> sheetHeads;
-
-    /**
-     * 工作表列宽度
-     */
-    private List<Integer> cellWidths;
-
-    /**
-     * 工作表头标题样式
-     */
-    private CellStyle headCellStyle;
-
-    /**
-     * 工作表内容主体
-     */
-    private List<T> Ts;
-
-    /**
-     * 工作表内容主体样式
-     */
-    private CellStyle tCellStyle;
-
-    /**
-     * 工作表页面列表对象
-     */
-    private List<SheetFooter> sheetFooters;
-
-    /**
-     * 工作表脚标内容样式
-     */
-    private CellStyle footerCellStyle;
-
-    /**
-     * 初始化样式
-     *
-     * @param startRow        开始行
-     * @param startCell       开始列
-     * @param cellWidths      列宽
-     * @param titleCellStyle  总标题样式
-     * @param headCellStyle   列表标题样式
-     * @param tCellStyle      列表样式
-     * @param footerCellStyle 列表脚标样式
-     */
-    public void init(Integer startRow, Integer startCell, List<Integer> cellWidths, CellStyle titleCellStyle,
-        CellStyle headCellStyle, CellStyle tCellStyle, CellStyle footerCellStyle) {
-        if (null != startRow) {
-            this.startRow = startRow;
-        }
-
-        if (null != startCell) {
-            this.startCell = startCell;
-        }
-
-        this.cellWidths = cellWidths;
-
-        if (null != titleCellStyle) {
-            this.titleCellStyle = titleCellStyle;
-        }
-
-        if (null != headCellStyle) {
-            this.headCellStyle = headCellStyle;
-        }
-
-        if (null != tCellStyle) {
-            this.tCellStyle = tCellStyle;
-        }
-
-        if (null != footerCellStyle) {
-            this.footerCellStyle = footerCellStyle;
-        }
-    }
-
-    public int getStartRow() {
-        return startRow;
-    }
-
-    public void setStartRow(int startRow) {
-        this.startRow = startRow;
-    }
-
-    public int getStartCell() {
-        return startCell;
-    }
-
-    public void setStartCell(int startCell) {
-        this.startCell = startCell;
-    }
-
-    public String getSheetName() {
-        return sheetName;
-    }
-
-    public void setSheetName(String sheetName) {
-        this.sheetName = sheetName;
-    }
-
-    public String getSheetTitle() {
-        return sheetTitle;
-    }
-
-    public void setSheetTitle(String sheetTitle) {
-        this.sheetTitle = sheetTitle;
-    }
-
-    public CellStyle getTitleCellStyle() {
-        return titleCellStyle;
-    }
-
-    public void setTitleCellStyle(CellStyle titleCellStyle) {
-        this.titleCellStyle = titleCellStyle;
-    }
-
-    public List<String> getSheetHeads() {
-        return sheetHeads;
-    }
-
-    public void setSheetHeads(List<String> sheetHeads) {
-        this.sheetHeads = sheetHeads;
-    }
-
-    public List<Integer> getCellWidths() {
-        return cellWidths;
-    }
-
-    public void setCellWidths(List<Integer> cellWidths) {
-        this.cellWidths = cellWidths;
-    }
-
-    public CellStyle getHeadCellStyle() {
-        return headCellStyle;
-    }
-
-    public void setHeadCellStyle(CellStyle headCellStyle) {
-        this.headCellStyle = headCellStyle;
-    }
-
-    public List<T> getTs() {
-        return Ts;
-    }
-
-    public void setTs(List<T> ts) {
-        Ts = ts;
-    }
-
-    public CellStyle gettCellStyle() {
-        return tCellStyle;
-    }
-
-    public void settCellStyle(CellStyle tCellStyle) {
-        this.tCellStyle = tCellStyle;
-    }
-
-    public List<SheetFooter> getSheetFooters() {
-        return sheetFooters;
-    }
-
-    public void setSheetFooters(List<SheetFooter> sheetFooters) {
-        this.sheetFooters = sheetFooters;
-    }
-
-    public CellStyle getFooterCellStyle() {
-        return footerCellStyle;
-    }
-
-    public void setFooterCellStyle(CellStyle footerCellStyle) {
-        this.footerCellStyle = footerCellStyle;
-    }
-}

+ 0 - 100
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/bean/poi/WorkbookConfig.java

@@ -1,100 +0,0 @@
-/*
- * 文 件 名:  WorkbookStyle
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  learshaw
- * 修改时间:  2019/8/13
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.bean.poi;
-
-import org.apache.poi.hssf.usermodel.HSSFCellStyle;
-import org.apache.poi.ss.util.CellRangeAddress;
-
-/**
- * 工作簿配置
- * <功能详细描述>
- *
- * @author learshaw
- * @version [版本号, 2019/8/13]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public class WorkbookConfig {
-    private int headWidth;
-
-    /**
-     * 合并单元格对象
-     */
-    private CellRangeAddress callRangeAddress;
-
-    /**
-     * 头标题样式
-     */
-    private HSSFCellStyle headStyle;
-
-    /**
-     * 列标题样式
-     */
-    private HSSFCellStyle colHeadStyle;
-
-    /**
-     * 列样式
-     */
-    private HSSFCellStyle colStyle;
-
-    /**
-     * 脚标样式
-     */
-    private HSSFCellStyle colFooterStyle;
-
-    public int getHeadWidth() {
-        return headWidth;
-    }
-
-    public void setHeadWidth(int headWidth) {
-        this.headWidth = headWidth;
-    }
-
-    public CellRangeAddress getCallRangeAddress() {
-        return callRangeAddress;
-    }
-
-    public void setCallRangeAddress(CellRangeAddress callRangeAddress) {
-        this.callRangeAddress = callRangeAddress;
-    }
-
-    public HSSFCellStyle getHeadStyle() {
-        return headStyle;
-    }
-
-    public void setHeadStyle(HSSFCellStyle headStyle) {
-        this.headStyle = headStyle;
-    }
-
-    public HSSFCellStyle getColHeadStyle() {
-        return colHeadStyle;
-    }
-
-    public void setColHeadStyle(HSSFCellStyle colHeadStyle) {
-        this.colHeadStyle = colHeadStyle;
-    }
-
-    public HSSFCellStyle getColStyle() {
-        return colStyle;
-    }
-
-    public void setColStyle(HSSFCellStyle colStyle) {
-        this.colStyle = colStyle;
-    }
-
-    public HSSFCellStyle getColFooterStyle() {
-        return colFooterStyle;
-    }
-
-    public void setColFooterStyle(HSSFCellStyle colFooterStyle) {
-        this.colFooterStyle = colFooterStyle;
-    }
-}

+ 0 - 40
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/enums/Encoding.java

@@ -1,40 +0,0 @@
-/*
- * 文 件 名:  Encoding
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  lv.wenbin@huashe.com
- * 修改时间:  2019/2/19
- */
-package com.huashe.citybrain.commons.base.enums;
-
-/**
- * $字符集 <功能详细描述>
- *
- * @author lv.wenbin@huashe.com
- * @version [版本号, 2019/2/19]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public enum Encoding {
-    // UTF-8 编码
-    UTF_8("utf-8"),
-
-    // GBK 编码
-    GBK("gbk"),
-
-    // GB2312 编码
-    GB_2312("gb2312"),
-
-    // ISO-8859-1 编码V
-    IOS_8859_1("ISO-8859-1");
-
-    private String charset;
-
-    private Encoding(String charset) {
-        this.charset = charset;
-    }
-
-    public String getCharset() {
-        return charset;
-    }
-}

+ 0 - 57
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/enums/HttpResultCode.java

@@ -1,57 +0,0 @@
-package com.huashe.citybrain.commons.base.enums;
-
-/**
- * http请求返回状态码枚举类
- * 
- * @author chen.jinshu (青禾) 2018/10/15
- */
-public enum HttpResultCode {
-
-    /**
-     * $请求成功
-     */
-    SUCCESS(0, "请求成功"),
-
-    /**
-     * $服务不可用
-     */
-    SERVICE_UNAVAILABLE(-1, "服务不可用"),
-
-    /**
-     * $未知错误
-     */
-    UNKNOWN_ERROR(-2, "未知错误"),
-
-    /**
-     * $参数错误
-     */
-    PARAM_ERROR(1000, "参数错误");
-
-    private int code;
-
-    private String description;
-
-    public int getCode() {
-        return code;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    private HttpResultCode(int code, String description) {
-        this.code = code;
-        this.description = description;
-    }
-
-    public static HttpResultCode get(Long code) {
-        if (code != null) {
-            for (HttpResultCode element : HttpResultCode.values()) {
-                if (element.getCode() == code) {
-                    return element;
-                }
-            }
-        }
-        return null;
-    }
-}

+ 0 - 74
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/exception/ErrorCode.java

@@ -1,74 +0,0 @@
-/*
- * 文 件 名:  BusinessError
- * 版    权:  浩鲸云科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  lv.wenbin@huashe.com
- * 修改时间:  2018/12/10
- */
-package com.huashe.citybrain.commons.base.exception;
-
-/**
- * 异常枚举 <功能详细描述>
- *
- * @author lv.wenbin@huashe.com
- * @version [版本号, 2018/12/10]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public enum ErrorCode {
-    /**
-     * 成功
-     */
-    SUCCESS(0, "成功."),
-
-    /**
-     * 未知错误
-     */
-    UNKNOWN_ERROR(-1, "未知错误."),
-
-    /**
-     * 参数错误
-     */
-    PARAM_ERROR(1001, "参数错误."),
-
-    /**
-     * 参数错误
-     */
-    DB_ERROR(3001, "数据库异常."),
-
-    /**
-     * 服务不可用
-     */
-    SERVICE_UNAVAILABLE(9001, "服务不可用.");
-
-    /**
-     * 错误码分段: <br/>
-     * 0000 :业务正常 <br/>
-     * -001 :未知异常 <br/>
-     * 1xxx : 参数异常 <br/>
-     * 2xxx : 框架异常 <br/>
-     * 3xxx : DB异常 <br/>
-     * 4xxx : MQ异常 <br/>
-     * 5xxx : xx <br/>
-     * 6xxx : xx <br/>
-     * 7xxx : xx <br/>
-     * 8xxx : xx <br/>
-     * 9xxxxx : 业务异常
-     */
-    private int code;
-
-    private String message;
-
-    private ErrorCode(int code, String message) {
-        this.code = code;
-        this.message = message;
-    }
-
-    public int getCode() {
-        return code;
-    }
-
-    public String getMessage() {
-        return message;
-    }
-}

+ 0 - 96
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/task/DynamicTask.java

@@ -1,96 +0,0 @@
-/*
- * 文 件 名:  DynamicTask
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  0027008907/lv.wenbin
- * 修改时间:  2020/7/22
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.task;
-
-import com.huashe.citybrain.commons.base.exception.Assert;
-import com.huashe.citybrain.commons.base.exception.BusinessException;
-import org.apache.commons.lang3.StringUtils;
-import org.quartz.CronExpression;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.SchedulingConfigurer;
-import org.springframework.scheduling.config.CronTask;
-import org.springframework.scheduling.config.ScheduledTaskRegistrar;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ScheduledFuture;
-
-/**
- * 动态定时器管理
- * <功能详细描述>
- *
- * @author 0027008907/lv.wenbin
- * @version [版本号, 2020/7/22]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-@Configuration
-public class DynamicTask implements SchedulingConfigurer {
-    /**
-     * 日志
-     */
-    private static final Logger log = LoggerFactory.getLogger(DynamicTask.class);
-
-    private volatile ScheduledTaskRegistrar registrar;
-
-    private final ConcurrentHashMap<String, ScheduledFuture<?>> scheduledFutures = new ConcurrentHashMap<>();
-
-    private final ConcurrentHashMap<String, CronTask> cronTasks = new ConcurrentHashMap<>();
-
-    /**
-     * 添加定时任务
-     *
-     * @param timeTask 定时任务
-     */
-    public void add(TimingTask timeTask) {
-        try {
-            Assert.notNull(timeTask, -1, "任务对象为空");
-            Assert.notEmpty(timeTask.getExpression(), -1, "定时器 cron 表达式为空");
-            Assert.isTrue(CronExpression.isValidExpression(timeTask.getExpression()), -1,
-                "定时任务DynamicTask cron表达式不合法:" + timeTask.getExpression());
-
-            // 任务已存在
-            if (scheduledFutures.containsKey(timeTask.getTaskId())) {
-                CronTask old = cronTasks.get(timeTask.getTaskId());
-
-                // 如果配置一致,则不需要重新创建定时任务
-                if (StringUtils.equals(old.getExpression(), timeTask.getExpression())) {
-                    log.warn("定时任务 taskId:{}, cron:{} 已经存在,不重复添加.", timeTask.getTaskId(), timeTask.getExpression());
-                    return;
-                }
-                // 如果策略执行时间发生了变化,则取消当前策略的任务
-                else {
-                    log.info("定时任务 taskId:{}, cron:{} 表达式更新为 corn:{},重置任务.", timeTask.getTaskId(), old.getExpression(),
-                        timeTask.getExpression());
-                    scheduledFutures.remove(timeTask.getTaskId()).cancel(false);
-                    cronTasks.remove(timeTask.getTaskId());
-                }
-            }
-
-            CronTask task = new CronTask(timeTask, timeTask.getExpression());
-            ScheduledFuture<?> future = registrar.getScheduler().schedule(task.getRunnable(), task.getTrigger());
-
-            cronTasks.put(timeTask.getTaskId(), task);
-            scheduledFutures.put(timeTask.getTaskId(), future);
-            log.info("定时任务 taskId:{}, cron:{} 添加成功.", timeTask.getTaskId(), timeTask.getExpression());
-        }
-        catch (Exception e) {
-            log.error("add TimingTask fail!", e);
-            throw new BusinessException(-1, e.getMessage(), e);
-        }
-    }
-
-    @Override
-    public void configureTasks(ScheduledTaskRegistrar registrar) {
-        this.registrar = registrar;
-    }
-}

+ 0 - 72
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/task/TaskConfiguration.java

@@ -1,72 +0,0 @@
-/*
- * 文 件 名:  TaskConfiguration
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  0027008907/lv.wenbin
- * 修改时间:  2020/7/22
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.task;
-
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Role;
-import org.springframework.scheduling.annotation.EnableScheduling;
-
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * 定时任务配置
- * <功能详细描述>
- *
- * @author 0027008907/lv.wenbin
- * @version [版本号, 2020/7/22]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-@Configuration
-@EnableScheduling
-@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
-public class TaskConfiguration {
-    @Bean(name = "taskScheduler")
-    @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
-    public ScheduledExecutorService scheduledAnnotationProcessor() {
-        return new ScheduledThreadPoolExecutor(5, new DefaultThreadFactory());
-    }
-
-    private static class DefaultThreadFactory implements ThreadFactory {
-        private static final AtomicInteger poolNumber = new AtomicInteger(1);
-
-        private final ThreadGroup group;
-
-        private final AtomicInteger threadNumber = new AtomicInteger(1);
-
-        private final String namePrefix;
-
-        DefaultThreadFactory() {
-            SecurityManager s = System.getSecurityManager();
-            group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
-            namePrefix = "pool-" + poolNumber.getAndIncrement() + "-schedule-";
-        }
-
-        @Override
-        public Thread newThread(Runnable r) {
-            Thread t = new Thread(group, r, namePrefix + threadNumber.getAndIncrement(), 0);
-            if (t.isDaemon()) {
-                t.setDaemon(false);
-            }
-
-            if (t.getPriority() != Thread.NORM_PRIORITY) {
-                t.setPriority(Thread.NORM_PRIORITY);
-            }
-
-            return t;
-        }
-    }
-}

+ 0 - 49
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/task/TimingTask.java

@@ -1,49 +0,0 @@
-/*
- * 文 件 名:  TimingTask
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  0027008907/lv.wenbin
- * 修改时间:  2020/7/23
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.task;
-
-/**
- * 定时任务
- * <功能详细描述>
- *
- * @author 0027008907/lv.wenbin
- * @version [版本号, 2020/7/23]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public abstract class TimingTask implements Runnable {
-    /**
-     * cron表达式
-     * 时间规则
-     */
-    private String expression;
-
-    /**
-     * 任务编号
-     */
-    private String taskId;
-
-    public String getExpression() {
-        return expression;
-    }
-
-    public void setExpression(String expression) {
-        this.expression = expression;
-    }
-
-    public String getTaskId() {
-        return taskId;
-    }
-
-    public void setTaskId(String taskId) {
-        this.taskId = taskId;
-    }
-}

+ 0 - 162
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/ByteArrayConverterUtils.java

@@ -1,162 +0,0 @@
-package com.huashe.citybrain.commons.base.utils;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.ObjectOutputStream;
-
-/**
- * $字节数组转换工具
- *
- * @author chen.jinshu (青禾) 2019/03/01
- */
-public abstract class ByteArrayConverterUtils {
-    private static final Logger log = LoggerFactory.getLogger(ByteArrayConverterUtils.class);
-
-    private static final int BYTE_TYPE_BYTE_COUNT = 1;
-
-    private static final int SHORT_TYPE_BYTE_COUNT = 2;
-
-    private static final int INT_TYPE_BYTE_COUNT = 4;
-
-    private static final int LONG_TYPE_BYTE_COUNT = 8;
-
-    /**
-     * $把字节数组转为字符串
-     *
-     * @param data 字节数组
-     * @return String
-     */
-    public static String byteArrayToString(byte[] data) {
-        StringBuilder sb = new StringBuilder();
-        for (byte b : data) {
-            sb.append(String.format("%02X", b));
-        }
-        return sb.toString();
-    }
-
-    /**
-     * $把字节数组转换成double类型
-     *
-     * @param b 字节数组
-     * @return double
-     */
-    public static double byteArrayToDouble(byte[] b) {
-        long l;
-        l = b[0];
-        l &= 0xFFL;
-        l |= ((long) b[1] << 8);
-        l &= 0xFFFFL;
-        l |= ((long) b[2] << 16);
-        l &= 0xFFFFFFL;
-        l |= ((long) b[3] << 24);
-        l &= 0xFFFFFFFFL;
-        l |= ((long) b[4] << 32);
-        l &= 0xFFFFFFFFFFL;
-        l |= ((long) b[5] << 40);
-        l &= 0xFFFFFFFFFFFFL;
-        l |= ((long) b[6] << 48);
-        l &= 0xFFFFFFFFFFFFFFL;
-        l |= ((long) b[7] << 56);
-        return Double.longBitsToDouble(l);
-    }
-
-    /**
-     * $短整形数字转换成字节数组
-     *
-     * @param n 源数字
-     * @return byte[]
-     */
-    public static byte[] shortToByteArray(short n) {
-        byte[] b = new byte[2];
-        b[1] = (byte) (n & 0xff);
-        b[0] = (byte) ((n >> 8) & 0xff);
-        return b;
-    }
-
-    /**
-     * $把int型数字转换成字节数组
-     *
-     * @param n 源数字
-     * @return byte[]
-     */
-    public static byte[] intToByteArray(int n) {
-        byte[] b = new byte[4];
-        b[3] = (byte) (n & 0xff);
-        b[2] = (byte) (n >> 8 & 0xff);
-        b[1] = (byte) (n >> 16 & 0xff);
-        b[0] = (byte) (n >> 24 & 0xff);
-        return b;
-    }
-
-    /**
-     * $把字节数组转换成long类型
-     *
-     * @param bytes 字节数组
-     * @return long
-     */
-    public static long byteArrayToLong(byte[] bytes) {
-        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
-        DataInputStream dis = new DataInputStream(bais);
-        long result = 0;
-        try {
-            int len = dis.available();
-            if (len == BYTE_TYPE_BYTE_COUNT) {
-                result = dis.readByte();
-            }
-            else if (len == SHORT_TYPE_BYTE_COUNT) {
-                result = dis.readShort();
-            }
-            else if (len == INT_TYPE_BYTE_COUNT) {
-                result = dis.readInt();
-            }
-            else if (len == LONG_TYPE_BYTE_COUNT) {
-                result = dis.readLong();
-            }
-        }
-        catch (IOException e) {
-            log.error("fail!", e);
-        }
-        finally {
-            try {
-                dis.close();
-                bais.close();
-            }
-            catch (IOException e) {
-                log.error("fail!", e);
-            }
-        }
-        return result;
-    }
-
-    /**
-     * $把对象转化为字节数组
-     *
-     * @param obj 源对象
-     * @return byte[]
-     */
-    public static byte[] objectToByteArray(Object obj) {
-        byte[] bytes = null;
-        ByteArrayOutputStream bo = new ByteArrayOutputStream();
-        ObjectOutputStream oo = null;
-
-        try {
-            oo = new ObjectOutputStream(bo);
-            oo.writeObject(obj);
-            bytes = bo.toByteArray();
-        }
-        catch (Exception e) {
-            log.error("fail!", e);
-        }
-        finally {
-            CloseUtils.close(bo);
-            CloseUtils.close(oo);
-        }
-
-        return (bytes);
-    }
-}

+ 0 - 179
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/CloseUtils.java

@@ -1,179 +0,0 @@
-/*
- * 文 件 名:  CloseUtils.java
- * 版    权:  中兴通讯股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  0027008901/LvWenbin
- * 修改时间:  2016年4月26日
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.utils;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-/**
- * 关闭工具类 <功能详细描述>
- *
- * @author 0027008901/LvWenbin
- * @version [版本号, 2016年4月26日]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public abstract class CloseUtils {
-    private static final Logger log = LoggerFactory.getLogger(CloseUtils.class);
-
-    /**
-     * $关闭结果集
-     *
-     * @param rs 结果集
-     * @see [类、类#方法、类#成员]
-     */
-    public static void close(ResultSet rs) {
-        if (rs != null) {
-            try {
-                rs.close();
-            }
-            catch (SQLException e) {
-                log.error("close ResultSet failed.", e);
-            }
-        }
-    }
-
-    /**
-     * $关闭执行列表
-     *
-     * @param stmt 执行列表
-     * @see [类、类#方法、类#成员]
-     */
-    public static void close(Statement stmt) {
-        if (stmt != null) {
-            try {
-                stmt.close();
-            }
-            catch (SQLException e) {
-                log.error("close Statement failed.", e);
-            }
-        }
-    }
-
-    /**
-     * $关闭PreparedStatement
-     *
-     * @param stmt 预编译的SQL执行列表
-     * @see [类、类#方法、类#成员]
-     */
-    public static void close(PreparedStatement stmt) {
-        if (stmt != null) {
-            try {
-                stmt.close();
-            }
-            catch (SQLException e) {
-                log.error("close PreparedStatement failed.", e);
-            }
-        }
-    }
-
-    /**
-     * $关闭连接
-     *
-     * @param connection 连接
-     * @see [类、类#方法、类#成员]
-     */
-    public static void close(Connection connection) {
-        if (connection != null) {
-            try {
-                connection.close();
-            }
-            catch (SQLException e) {
-                log.error("close Connection failed.", e);
-            }
-        }
-    }
-
-    /**
-     * $关闭数据域或者目标 <功能详细描述>
-     *
-     * @param closes 数据源或者目标
-     * @see [类、类#方法、类#成员]
-     */
-    public static void close(AutoCloseable... closes) {
-        for (AutoCloseable closeable : closes) {
-            if (closeable != null) {
-                try {
-                    closeable.close();
-                }
-                catch (Exception e) {
-                    log.error("close closeable failed.", e);
-                }
-            }
-        }
-    }
-
-    /**
-     * $关闭套接字连接
-     *
-     * @param psocket 套接字连接
-     * @see [类、类#方法、类#成员]
-     */
-    public static void close(Socket psocket) {
-        if (psocket != null) {
-            try {
-                psocket.close();
-            }
-            catch (IOException e) {
-                log.error("close socket failed.", e);
-            }
-        }
-    }
-
-    /**
-     * $关闭服务器套接字
-     *
-     * @param psocket 服务器套接字连接
-     * @see [类、类#方法、类#成员]
-     */
-    public static void close(ServerSocket psocket) {
-        if (psocket != null) {
-            try {
-                psocket.close();
-            }
-            catch (IOException e) {
-                log.error("close socket failed.", e);
-            }
-        }
-    }
-
-    /**
-     * $万能关闭方法 <br>
-     * $关闭带close方法的对象
-     *
-     * @param objs 对象
-     * @see [类、类#方法、类#成员]
-     */
-    public static void close(Object... objs) {
-        for (Object obj : objs) {
-            if (obj != null) {
-                try {
-                    Class<?> objClass = obj.getClass();
-                    Method meyhod = objClass.getMethod("close", new Class[0]);
-                    meyhod.invoke(obj, new Object[0]);
-                }
-                catch (Exception e) {
-                    log.error("close Object failed.", e);
-                }
-            }
-        }
-    }
-}

+ 0 - 130
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/CommonUtils.java

@@ -1,130 +0,0 @@
-/*
- * 文 件 名:  CommonUtils
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  lv.wenbin@huashe.com
- * 修改时间:  2019/2/27
- */
-package com.huashe.citybrain.commons.base.utils;
-
-import com.huashe.citybrain.commons.base.bean.Response;
-import com.huashe.citybrain.commons.base.exception.Assert;
-import com.huashe.citybrain.commons.base.exception.BusinessException;
-import com.huashe.citybrain.commons.base.exception.ErrorCode;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.jdbc.UncategorizedSQLException;
-
-/**
- * 通用工具类想 <功能详细描述>
- *
- * @author lv.wenbin@huashe.com
- * @version [版本号, 2019/2/27]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public abstract class CommonUtils {
-    private static final Logger log = LoggerFactory.getLogger(CommonUtils.class);
-
-    /**
-     * 线程睡眠
-     *
-     * @param millis 毫秒
-     */
-    public static void threadSleep(long millis) {
-        try {
-            Thread.sleep(millis);
-        }
-        catch (InterruptedException e) {
-            log.error("Thread sleep fail!", e);
-        }
-    }
-
-    /**
-     * 响应载体内容提取
-     *
-     * @param response 响应
-     * @param <T>      载体泛型
-     * @return T
-     */
-    public static <T> T getData(Response<T> response) {
-        Assert.notNull(response, ErrorCode.UNKNOWN_ERROR.getCode(), "响应为空!");
-        boolean flag = (response.getCode() == ErrorCode.SUCCESS.getCode());
-        Assert.isTrue(flag, response.getCode(), response.getMessage());
-        return response.getData();
-    }
-
-    /**
-     * 响应载体内容提取
-     *
-     * @param response 响应
-     * @param <T>      载体泛型
-     * @return T
-     */
-    public static <T> T getDataNoException(Response<T> response, T defaultObj) {
-        T ret = null;
-
-        try {
-            Assert.notNull(response, ErrorCode.UNKNOWN_ERROR.getCode(), "响应为空!");
-            boolean flag = (response.getCode() == ErrorCode.SUCCESS.getCode());
-            Assert.isTrue(flag, response.getCode(), response.getMessage());
-            ret = response.getData();
-        }
-        catch (BusinessException e) {
-            ret = defaultObj;
-            log.warn("fail!", e);
-        }
-
-        return ret;
-    }
-
-    /**
-     * 封装业务异常设值
-     *
-     * @param response 响应
-     * @param e        异常堆栈
-     */
-    public static void businessExceptionRes(Response<?> response, BusinessException e) {
-        response.setCode(e.getCode());
-        response.setMessage(e.getMessage());
-    }
-
-    /**
-     * 未知业务异常设值
-     *
-     * @param response 响应
-     * @param e        异常堆栈
-     */
-    public static void unknownExceptionRes(Response<?> response, Exception e) {
-        response.setCode(ErrorCode.UNKNOWN_ERROR.getCode());
-        response.setMessage(ErrorCode.UNKNOWN_ERROR.getMessage());
-    }
-
-    /**
-     * Yml中文unicode解码
-     *
-     * @param tagName tagName
-     * @return
-     */
-    public static String tagToString(String tagName) {
-        String tmp = "-" + tagName;
-        tmp = StringUtils.replace(tmp, "-", "\\");
-        return UnicodeUtils.unicodeToString(tmp);
-    }
-
-    public static BusinessException convertException(UncategorizedSQLException e) {
-        BusinessException bException = null;
-        Throwable t = e.getCause();
-        String msg = t.getMessage();
-
-        if (StringUtils.contains(msg, "Memory left in process limi")) {
-            bException = new BusinessException(ErrorCode.DB_ERROR.getCode(), "Impala 内存超限!", e);
-        }
-        else {
-            bException = new BusinessException(ErrorCode.DB_ERROR.getCode(), "Sql 执行失败!", e);
-        }
-
-        return bException;
-    }
-}

+ 0 - 95
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/CompareUtils.java

@@ -1,95 +0,0 @@
-/*
- * 文 件 名:  CompareUtils.java
- * 版    权:  浩鲸云科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  LvWenbin
- * 修改时间:  2018/11/19 16:47
- */
-package com.huashe.citybrain.commons.base.utils;
-
-import java.util.Queue;
-import java.util.concurrent.ArrayBlockingQueue;
-
-/**
- * $比较工具
- *
- * @author LvWenbin
- * @version [版本号, 2018/11/19 16:47]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public abstract class CompareUtils {
-    /**
-     * $封装待比较参数 <功能详细描述>
-     *
-     * @return
-     * @see [类、类#方法、类#成员]
-     */
-    public static Queue<Object> buildQueue(Object... objs) {
-        Queue<Object> queue = new ArrayBlockingQueue<Object>(objs.length);
-
-        for (Object tmpObj : objs) {
-            queue.offer(tmpObj);
-        }
-
-        return queue;
-    }
-
-    /**
-     * $多条件递归比较 <功能详细描述>
-     *
-     * @param q1
-     * @param q2
-     * @return
-     * @see [类、类#方法、类#成员]
-     */
-    public static int compare(Queue<Object> q1, Queue<Object> q2) {
-        int cValue = 0;
-        Object obj1 = q1.poll();
-        Object obj2 = q2.poll();
-
-        if (obj1 != null && obj2 != null) {
-            cValue = getCValue(obj1, obj2);
-
-            if (cValue == 0) {
-                cValue = compare(q1, q2);
-            }
-        }
-
-        return cValue;
-    }
-
-    private static int getCValue(Object obj1, Object obj2) {
-        int cValue = 0;
-        if (obj1 instanceof Integer && obj2 instanceof Integer) {
-            cValue = intCompare((Integer) obj1, (Integer) obj2);
-        }
-        else if (obj1 instanceof String && obj2 instanceof String) {
-            cValue = stringCompare((String) obj1, (String) obj2);
-        }
-        else if (obj1 instanceof Long && obj2 instanceof Long) {
-            cValue = longCompare((Long) obj1, (Long) obj2);
-        }
-        else if (obj1 instanceof Double && obj2 instanceof Double) {
-            cValue = doubleCompare((Double) obj1, (Double) obj2);
-        }
-
-        return cValue;
-    }
-
-    private static int intCompare(Integer value1, Integer value2) {
-        return value1.compareTo(value2);
-    }
-
-    private static int stringCompare(String value1, String value2) {
-        return value1.compareTo(value2);
-    }
-
-    private static int longCompare(Long value1, Long value2) {
-        return value1.compareTo(value2);
-    }
-
-    private static int doubleCompare(Double value1, Double value2) {
-        return value1.compareTo(value2);
-    }
-}

+ 0 - 119
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/CoordinateTransformUtil.java

@@ -1,119 +0,0 @@
-package com.huashe.citybrain.commons.base.utils;
-
-import org.springframework.data.geo.Point;
-
-/**
- * 坐标系转换工具 <功能详细描述>
- *
- * @author 0027008901/LvWenbin
- * @version [版本号, 2020年5月15日]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public abstract class CoordinateTransformUtil {
-
-    public static final double xpi = 3.14159265358979324 * 3000.0 / 180.0;
-
-    public static final double pi = 3.1415926535897932384626;
-
-    public static final double eRadius = 6378245.0;
-
-    public static final double eValue = 0.00669342162296594323;
-
-    /**
-     * 百度坐标系 (BD-09) 与 火星坐标系 (GCJ-02)的转换
-     * 即 百度 转 谷歌、高德
-     *
-     * @param bd_lon
-     * @param bd_lat
-     * @returns {*[]}
-     */
-    public static Point bd09togcj02(double bd_lon, double bd_lat) {
-        double x = bd_lon - 0.0065;
-        double y = bd_lat - 0.006;
-        double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * xpi);
-        double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * xpi);
-        double gg_lng = z * Math.cos(theta);
-        double gg_lat = z * Math.sin(theta);
-        Point point = new Point(gg_lng, gg_lat);
-        return point;
-    }
-
-    /**
-     * 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换
-     * 即谷歌、高德 转 百度
-     *
-     * @param lng
-     * @param lat
-     * @returns {*[]}
-     */
-    public static Point gcj02tobd09(double lng, double lat) {
-        double z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * xpi);
-        double theta = Math.atan2(lat, lng) + 0.000003 * Math.cos(lng * xpi);
-        double bd_lng = z * Math.cos(theta) + 0.0065;
-        double bd_lat = z * Math.sin(theta) + 0.006;
-        Point point = new Point(bd_lng, bd_lat);
-        return point;
-    }
-
-    /**
-     * WGS84转GCj02
-     *
-     * @param lng
-     * @param lat
-     * @returns {*[]}
-     */
-    public static Point wgs84togcj02(double lng, double lat) {
-        double dlat = transformlat(lng - 105.0, lat - 35.0);
-        double dlng = transformlng(lng - 105.0, lat - 35.0);
-        double radlat = lat / 180.0 * pi;
-        double magic = Math.sin(radlat);
-        magic = 1 - eValue * magic * magic;
-        double sqrtmagic = Math.sqrt(magic);
-        dlat = (dlat * 180.0) / ((eRadius * (1 - eValue)) / (magic * sqrtmagic) * pi);
-        dlng = (dlng * 180.0) / (eRadius / sqrtmagic * Math.cos(radlat) * pi);
-        double mglat = lat + dlat;
-        double mglng = lng + dlng;
-        Point point = new Point(mglng, mglat);
-        return point;
-    }
-
-    /**
-     * GCJ02 转换为 WGS84
-     *
-     * @param lng
-     * @param lat
-     * @returns {*[]}
-     */
-    public static Point gcj02towgs84(double lng, double lat) {
-        double dlat = transformlat(lng - 105.0, lat - 35.0);
-        double dlng = transformlng(lng - 105.0, lat - 35.0);
-        double radlat = lat / 180.0 * pi;
-        double magic = Math.sin(radlat);
-        magic = 1 - eValue * magic * magic;
-        double sqrtmagic = Math.sqrt(magic);
-        dlat = (dlat * 180.0) / ((eRadius * (1 - eValue)) / (magic * sqrtmagic) * pi);
-        dlng = (dlng * 180.0) / (eRadius / sqrtmagic * Math.cos(radlat) * pi);
-        double mglat = lat + dlat;
-        double mglng = lng + dlng;
-        Point point = new Point(mglng, mglat);
-        return point;
-    }
-
-    private static double transformlat(double lng, double lat) {
-        double ret =
-            -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
-        ret += (20.0 * Math.sin(6.0 * lng * pi) + 20.0 * Math.sin(2.0 * lng * pi)) * 2.0 / 3.0;
-        ret += (20.0 * Math.sin(lat * pi) + 40.0 * Math.sin(lat / 3.0 * pi)) * 2.0 / 3.0;
-        ret += (160.0 * Math.sin(lat / 12.0 * pi) + 320 * Math.sin(lat * pi / 30.0)) * 2.0 / 3.0;
-        return ret;
-    }
-
-    private static double transformlng(double lng, double lat) {
-        double ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng));
-        ret += (20.0 * Math.sin(6.0 * lng * pi) + 20.0 * Math.sin(2.0 * lng * pi)) * 2.0 / 3.0;
-        ret += (20.0 * Math.sin(lng * pi) + 40.0 * Math.sin(lng / 3.0 * pi)) * 2.0 / 3.0;
-        ret += (150.0 * Math.sin(lng / 12.0 * pi) + 300.0 * Math.sin(lng / 30.0 * pi)) * 2.0 / 3.0;
-        return ret;
-    }
-}

+ 0 - 68
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/DataSourceUtils.java

@@ -1,68 +0,0 @@
-/*
- * 文 件 名:  DataSourceUtils
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  learshaw
- * 修改时间:  2019/7/16
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.utils;
-
-import com.alibaba.druid.pool.DruidDataSource;
-import org.apache.ibatis.session.SqlSessionFactory;
-import org.mybatis.spring.SqlSessionFactoryBean;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
-
-import javax.sql.DataSource;
-
-/**
- * DataSource工具类 <功能详细描述>
- *
- * @author learshaw
- * @version [版本号, 2019/7/16]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public abstract class DataSourceUtils {
-    private static final Logger log = LoggerFactory.getLogger(DataSourceUtils.class);
-
-    /**
-     * 数据源配置
-     *
-     * @param driverClass 驱动
-     * @param url         地址
-     * @param user        用户名
-     * @param password    密码
-     * @return 数据源
-     */
-    public static DruidDataSource buildDataSource(String driverClass, String url, String user, String password) {
-        DruidDataSource dataSource = new DruidDataSource();
-        dataSource.setDriverClassName(driverClass);
-        dataSource.setUrl(url);
-        dataSource.setUsername(user);
-        dataSource.setPassword(password);
-
-        return dataSource;
-    }
-
-    public static SqlSessionFactory buildSqlSessionFactory(DataSource dataSource, String mapperLocation,
-        String mybatisConfig) {
-        SqlSessionFactory factory = null;
-        try {
-            SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
-            sessionFactory.setDataSource(dataSource);
-            sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(mapperLocation));
-            sessionFactory.setConfigLocation(new PathMatchingResourcePatternResolver().getResource(mybatisConfig));
-            factory = sessionFactory.getObject();
-        }
-        catch (Exception e) {
-            log.error("buildSqlSessionFactory fail!", e);
-        }
-
-        return factory;
-    }
-}

+ 0 - 721
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/DateUtils.java

@@ -1,721 +0,0 @@
-/*
- * 文 件 名:  DateUtils.java
- * 版    权:  浩鲸云计算科技有限公司
- * 描    述:  日期工具类
- * 修 改 人:  lvwenbin
- * 修改时间:  2018年9月20日
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.utils;
-
-import com.huashe.citybrain.commons.base.bean.Contains;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.exception.ExceptionUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-
-/**
- * 日期工具类 <功能详细描述>
- * 
- * @author lvwenbin
- * @version [版本号, 2018年9月20日]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public abstract class DateUtils {
-    private static final Logger log = LoggerFactory.getLogger(DateUtils.class);
-
-    /**
-     * $ 时间年偏移 <功能详细描述>
-     * 
-     * @param date 日期
-     * @param offset 偏移量
-     * @return date 日期
-     * @see [类、类#方法、类#成员]
-     */
-    public static Date adjustYear(Date date, int offset) {
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(date);
-        calendar.add(Calendar.YEAR, offset);
-        Date newDate = calendar.getTime();
-        return newDate;
-    }
-
-    /**
-     * $时间年偏移 <功能详细描述>
-     * 
-     * @param time yyyyMMddHHmmss
-     * @param offset 偏移量
-     * @return yyyyMMddHHmmss
-     * @see [类、类#方法、类#成员]
-     */
-    public static String adjustYear(String time, int offset) {
-        return adjustYear(time, offset, Contains.DEFAULT_TIME_FORMAT);
-    }
-
-    /**
-     * $时间年偏移 <功能详细描述>
-     * 
-     * @param time yyyyMMddHHmmss
-     * @param offset 偏移量
-     * @param format 格式化
-     * @return yyyyMMddHHmmss
-     * @see [类、类#方法、类#成员]
-     */
-    public static String adjustYear(String time, int offset, String format) {
-        SimpleDateFormat formatter = new SimpleDateFormat(format);
-        String retTime = null;
-
-        try {
-            Date date = formatter.parse(time);
-            Date newDate = adjustYear(date, offset);
-            retTime = formatter.format(newDate);
-        }
-        catch (ParseException e) {
-            log.error("adjustYear fail!" + ExceptionUtils.getStackTrace(e));
-        }
-
-        return retTime;
-    }
-
-    /**
-     * 时间月偏移
-     * @param date 日期
-     * @param offset 偏移量
-     * @return date 日期
-     */
-    public static Date adjustMonth(Date date, int offset) {
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(date);
-        calendar.add(Calendar.MONTH, offset);
-        Date newDate = calendar.getTime();
-        return newDate;
-    }
-
-    /**
-     * $时间月偏移 <功能详细描述>
-     * 
-     * @param time yyyyMMddHHmmss
-     * @param offset 偏移量
-     * @return yyyyMMddHHmmss
-     * @see [类、类#方法、类#成员]
-     */
-    public static String adjustMonth(String time, int offset) {
-        return adjustMonth(time, offset, Contains.DEFAULT_TIME_FORMAT);
-    }
-
-    /**
-     * $时间月偏移 <功能详细描述>
-     * 
-     * @param time yyyyMMddHHmmss
-     * @param offset 偏移量
-     * @param format 格式化时间
-     * @return yyyyMMddHHmmss
-     * @see [类、类#方法、类#成员]
-     */
-    public static String adjustMonth(String time, int offset, String format) {
-        SimpleDateFormat formatter = new SimpleDateFormat(format);
-        String retTime = null;
-
-        try {
-            Date date = formatter.parse(time);
-            Date newDate = adjustMonth(date, offset);
-            retTime = formatter.format(newDate);
-        }
-        catch (ParseException e) {
-            log.error("adjustMonth fail!" + ExceptionUtils.getStackTrace(e));
-        }
-
-        return retTime;
-    }
-
-    /**
-     * $时间周偏移 <功能详细描述>
-     * 
-     * @param date 日期
-     * @param offset 偏移量
-     * @return date
-     * @see [类、类#方法、类#成员]
-     */
-    public static Date adjustWeek(Date date, int offset) {
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(date);
-        calendar.add(Calendar.DATE, 7 * offset);
-        Date newDate = calendar.getTime();
-        return newDate;
-    }
-
-    /**
-     * $时间周偏移 <功能详细描述>
-     * 
-     * @param time yyyyMMddHHmmss
-     * @param offset 偏移量
-     * @return yyyyMMddHHmmss
-     * @see [类、类#方法、类#成员]
-     */
-    public static String adjustWeek(String time, int offset) {
-        return adjustWeek(time, offset, Contains.DEFAULT_TIME_FORMAT);
-    }
-
-    /**
-     * $时间周偏移 <功能详细描述>
-     * 
-     * @param time 字符串日期
-     * @param offset 偏移量
-     * @return yyyyMMddHHmmss
-     * @see [类、类#方法、类#成员]
-     */
-    public static String adjustWeek(String time, int offset, String format) {
-        SimpleDateFormat formatter = new SimpleDateFormat(format);
-        String retTime = null;
-
-        try {
-            Date date = formatter.parse(time);
-            Date newDate = adjustWeek(date, offset);
-            retTime = formatter.format(newDate);
-        }
-        catch (ParseException e) {
-            log.error("adjustWeek fail!" + ExceptionUtils.getStackTrace(e));
-        }
-
-        return retTime;
-    }
-
-    /**
-     * $时间日偏移 <功能详细描述>
-     * 
-     * @param date 日期
-     * @param offset 偏移量
-     * @return yyyyMMddHHmmss
-     * @see [类、类#方法、类#成员]
-     */
-    public static Date adjustDay(Date date, int offset) {
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(date);
-        calendar.add(Calendar.DATE, offset);
-        Date newDate = calendar.getTime();
-        return newDate;
-    }
-
-    /**
-     * $时间日偏移 <功能详细描述>
-     * 
-     * @param time yyyyMMddHHmmss
-     * @param offset 偏移量
-     * @return yyyyMMddHHmmss
-     * @see [类、类#方法、类#成员]
-     */
-    public static String adjustDay(String time, int offset) {
-        return adjustDay(time, offset, Contains.DEFAULT_TIME_FORMAT);
-    }
-
-    /**
-     * $时间日偏移 <功能详细描述>
-     * 
-     * @param time 字符串日期
-     * @param offset 偏移量
-     * @return yyyyMMddHHmmss
-     * @see [类、类#方法、类#成员]
-     */
-    public static String adjustDay(String time, int offset, String format) {
-        SimpleDateFormat formatter = new SimpleDateFormat(format);
-        String retTime = null;
-
-        try {
-            Date date = formatter.parse(time);
-            Date newDate = adjustDay(date, offset);
-            retTime = formatter.format(newDate);
-        }
-        catch (ParseException e) {
-            log.error("adjustDay fail!" + ExceptionUtils.getStackTrace(e));
-        }
-
-        return retTime;
-    }
-
-    /**
-     * $时间小时偏移 <功能详细描述>
-     * 
-     * @param date 日期
-     * @param offset 偏移量
-     * @return yyyyMMddHHmmss
-     * @see [类、类#方法、类#成员]
-     */
-    public static Date adjustHour(Date date, int offset) {
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(date);
-        calendar.add(Calendar.HOUR_OF_DAY, offset);
-        Date newDate = calendar.getTime();
-
-        return newDate;
-    }
-
-    /**
-     * $时间小时偏移 <功能详细描述>
-     * 
-     * @param time yyyyMMddHHmmss
-     * @param offset 偏移量
-     * @return yyyyMMddHHmmss
-     * @see [类、类#方法、类#成员]
-     */
-    public static String adjustHour(String time, int offset) {
-        return adjustHour(time, offset, Contains.DEFAULT_TIME_FORMAT);
-    }
-
-    /**
-     * $时间小时偏移 <功能详细描述>
-     * 
-     * @param time yyyyMMddHHmmss
-     * @param offset 偏移量
-     * @return yyyyMMddHHmmss
-     * @see [类、类#方法、类#成员]
-     */
-    public static String adjustHour(String time, int offset, String format) {
-        SimpleDateFormat formatter = new SimpleDateFormat(format);
-        String retTime = null;
-
-        try {
-            Date date = formatter.parse(time);
-            Date newDate = adjustHour(date, offset);
-            retTime = formatter.format(newDate);
-        }
-        catch (ParseException e) {
-            log.error("adjustHour fail!" + ExceptionUtils.getStackTrace(e));
-        }
-
-        return retTime;
-    }
-
-    /**
-     * $时间分钟偏移 <功能详细描述>
-     * 
-     * @param date 日期
-     * @param offset 偏移量
-     * @return yyyyMMddHHmmss
-     * @see [类、类#方法、类#成员]
-     */
-    public static Date adjustMinute(Date date, int offset) {
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(date);
-        calendar.add(Calendar.MINUTE, offset);
-        Date newDate = calendar.getTime();
-        return newDate;
-    }
-
-    /**
-     * $时间分钟偏移 <功能详细描述>
-     * 
-     * @param time yyyyMMddHHmmss
-     * @param offset 偏移量
-     * @return yyyyMMddHHmmss
-     * @see [类、类#方法、类#成员]
-     */
-    public static String adjustMinute(String time, int offset) {
-        return adjustMinute(time, offset, Contains.DEFAULT_TIME_FORMAT);
-    }
-
-    /**
-     * $时间分钟偏移 <功能详细描述>
-     * 
-     * @param time 字符串日期
-     * @param offset 偏移量
-     * @return yyyyMMddHHmmss
-     * @see [类、类#方法、类#成员]
-     */
-    public static String adjustMinute(String time, int offset, String format) {
-        SimpleDateFormat formatter = new SimpleDateFormat(format);
-        String retTime = null;
-
-        try {
-            Date date = formatter.parse(time);
-            Date newDate = adjustMinute(date, offset);
-            retTime = formatter.format(newDate);
-        }
-        catch (ParseException e) {
-            log.error("adjustMinute fail!" + ExceptionUtils.getStackTrace(e));
-        }
-
-        return retTime;
-    }
-
-    /**
-     * $时间秒偏移 <功能详细描述>
-     * 
-     * @param date 字符串日期
-     * @param offset 偏移量
-     * @return yyyyMMddHHmmss
-     * @see [类、类#方法、类#成员]
-     */
-    public static Date adjustSecond(Date date, int offset) {
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(date);
-        calendar.add(Calendar.SECOND, offset);
-        Date newDate = calendar.getTime();
-        return newDate;
-    }
-
-    /**
-     * $时间秒偏移 <功能详细描述>
-     * 
-     * @param time yyyyMMddHHmmss
-     * @param offset 偏移量
-     * @return yyyyMMddHHmmss
-     * @see [类、类#方法、类#成员]
-     */
-    public static String adjustSecond(String time, int offset) {
-        return adjustSecond(time, offset, Contains.DEFAULT_TIME_FORMAT);
-    }
-
-    /**
-     * $时间秒偏移 <功能详细描述>
-     * 
-     * @param time yyyyMMddHHmmss
-     * @param offset 偏移量
-     * @return yyyyMMddHHmmss
-     * @see [类、类#方法、类#成员]
-     */
-    public static String adjustSecond(String time, int offset, String format) {
-        SimpleDateFormat formatter = new SimpleDateFormat(format);
-        String retTime = null;
-
-        try {
-            Date date = formatter.parse(time);
-            Date newDate = adjustSecond(date, offset);
-            retTime = formatter.format(newDate);
-        }
-        catch (ParseException e) {
-            log.error("adjustSecond fail!" + ExceptionUtils.getStackTrace(e));
-        }
-
-        return retTime;
-    }
-
-    /**
-     * $获取两个间隔日期间的天数 <功能详细描述>
-     * 
-     * @param timeBefore yyyyMMdd格式
-     * @param timeAfter yyyyMMdd格式
-     * @return 天数
-     * @see [类、类#方法、类#成员]
-     */
-    public static int getDayBetween(String timeBefore, String timeAfter) {
-        SimpleDateFormat sd = new SimpleDateFormat("yyyyMMdd");
-        long num = 0;
-
-        try {
-            long diff = sd.parse(timeAfter).getTime() - sd.parse(timeBefore).getTime();
-            num = diff / (1000 * 24 * 60 * 60);
-        }
-        catch (ParseException e) {
-            log.error("getDayBetween fail!", e);
-        }
-
-        return (int) num;
-    }
-
-    /**
-     * $获取一个月最后一天
-     * 
-     * @param time yyyyMMdd格式
-     * @return 日期
-     * @see [类、类#方法、类#成员]
-     */
-    public static String getMaxDateOfMonth(String time, String format) {
-        SimpleDateFormat sd = new SimpleDateFormat(format);
-        Calendar cDay = Calendar.getInstance();
-
-        try {
-            Date date = sd.parse(time);
-            cDay.setTime(date);
-        }
-        catch (ParseException e) {
-            log.error("getMaxDateOfMonth fail!", e);
-        }
-
-        return String.valueOf(cDay.getActualMaximum(Calendar.DAY_OF_MONTH));
-    }
-
-    /**
-     * Date转String <br>
-     * 根据format格式转换时间为字符串
-     * 
-     * @param date 时刻
-     * @param format 转换模板
-     * @return 字符串日期
-     * @see [类、类#方法、类#成员]
-     */
-    public static String dateToString(Date date, String format) {
-        if (date == null) {
-            date = new Date();
-        }
-
-        SimpleDateFormat formatter = new SimpleDateFormat(format);
-        String retTime = formatter.format(date);
-
-        return retTime;
-    }
-
-    /**
-     * $格式化取时间
-     * 
-     * @param dateString yyyyMMddHHmmss时刻
-     * @param format 转换模板
-     * @return 字符串日期
-     * @see [类、类#方法、类#成员]
-     */
-    public static String formater(String dateString, String format) {
-        Date date = stringToDate(dateString);
-        SimpleDateFormat formatter = new SimpleDateFormat(format);
-        String retTime = formatter.format(date);
-
-        return retTime;
-    }
-
-    /**
-     * 格式化取时间
-     * @param dateString 字符串日期
-     * @param from 源格式
-     * @param to 目标格式
-     * @return String
-     */
-    public static String formater(String dateString, String from, String to) {
-        Date date = stringToDate(dateString, from);
-        SimpleDateFormat formatter = new SimpleDateFormat(to);
-        String retTime = formatter.format(date);
-
-        return retTime;
-    }
-
-    /**
-     * $时间转换 <功能详细描述>
-     * 
-     * @param dateKey 天
-     * @param timeKey  时间
-     * @param format 格式
-     * @return String
-     * @see [类、类#方法、类#成员]
-     */
-    public static String formater(int dateKey, int timeKey, String format) {
-        int year = dateKey / 10000;
-        int month = (dateKey / 100) % 100;
-        int day = dateKey % 100;
-        int hour = timeKey / 10000;
-        int min = (timeKey / 100) % 100;
-        int second = timeKey % 100;
-
-        GregorianCalendar calender = new GregorianCalendar(year, month - 1, day, hour, min, second);
-        return dateToString(calender.getTime(), format);
-    }
-
-    /**
-     * Date转String <br>
-     * 根据format格式转换时间为字符串
-     * 
-     * @param date 时刻
-     * @return 字符串日期
-     * @see [类、类#方法、类#成员]
-     */
-    public static String dateToString(Date date) {
-        return dateToString(date, Contains.COMMON_TIME_FORMAT);
-    }
-
-    /**
-     * String转Date <br>
-     * 根据format格式转换时间为字符串
-     * 
-     * @param dateString 时刻
-     * @return date
-     * @see [类、类#方法、类#成员]
-     */
-    public static Date stringToDate(String dateString) {
-        return stringToDate(dateString, Contains.DEFAULT_TIME_FORMAT);
-    }
-
-    /**
-     * String转Date
-     * @param dateString 字符串日期
-     * @param format 格式
-     * @return date
-     */
-    public static Date stringToDate(String dateString, String format) {
-        SimpleDateFormat sd = new SimpleDateFormat(format);
-        Date date = null;
-
-        try {
-            date = sd.parse(dateString);
-        }
-        catch (ParseException e) {
-            log.error("stringToDate fail!", e);
-        }
-
-        return date;
-    }
-
-    /**
-     * String转Calendar <br>
-     * 根据format格式转换时间为字符串
-     * 
-     * @param dateString 时刻
-     * @return Calendar
-     * @see [类、类#方法、类#成员]
-     */
-    public static Calendar stringToCalendar(String dateString) {
-        if ((dateString == null) || (dateString.length() < 14)) {
-            throw new IllegalArgumentException(dateString);
-        }
-
-        Date date = stringToDate(dateString);
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(date);
-
-        return calendar;
-    }
-
-    /**
-     * String转Calendar <br>
-     * 根据format格式转换时间为字符串
-     * 
-     * @param dateString 时间字符串
-     * @param format 格式
-     * @return Calendar
-     * @see [类、类#方法、类#成员]
-     */
-    public static Calendar stringToCalendar(String dateString, String format) {
-        Date date = stringToDate(dateString, format);
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(date);
-        return calendar;
-    }
-
-    /**
-     * $获取当前时间 <功能详细描述>
-     * 
-     * @return String yyyyMMddHHmmss
-     * @see [类、类#方法、类#成员]
-     */
-    public static String getCurrentTime() {
-        return dateToString(new Date(), Contains.DEFAULT_TIME_FORMAT);
-    }
-
-    /**
-     * $获取两个时间之间的间隔(毫秒) <功能详细描述>
-     * 
-     * @param d1 日期1
-     * @param d2 日期2
-     * @return
-     * @see [类、类#方法、类#成员]
-     */
-    public static long getTimeBetween(Date d1, Date d2) {
-        return Math.abs(d2.getTime() - d1.getTime());
-    }
-
-    /**
-     * $获取星期几
-     * 
-     * @param date 输入日期
-     * @return 星期几
-     */
-    public static int getWeekOfDate(Date date) {
-        Calendar cd = Calendar.getInstance();
-        cd.setTime(date);
-        int wd = cd.get(Calendar.DAY_OF_WEEK);
-
-        if (wd == 1) {
-            return 7;
-        }
-        else {
-            return wd - 1;
-        }
-    }
-
-    /**
-     * $早高峰区间
-     */
-    private static final String[] MORING_PEAK_INTERVAL = new String[] {
-        "070000", "090000"
-    };
-
-    /**
-     * $晚高峰区间
-     */
-    private static final String[] EVENING_PEAK_INTERVAL = new String[] {
-        "170000", "190000"
-    };
-
-    /**
-     * $平峰区间
-     */
-    private static final String[] FLAT_PEAK_INTERVAL = new String[] {
-        "090000", "170000"
-    };
-
-    /**
-     * $判断是否早高峰 <07:00~09:00>
-     * 
-     * @param date 输入日期
-     * @return boolean
-     */
-    public static boolean checkMoringPeak(Date date) {
-        String time = StringUtils.substring(dateToString(date, Contains.DEFAULT_TIME_FORMAT), 8, 14);
-        return StringUtils.compare(time, MORING_PEAK_INTERVAL[0]) >= 0
-            && StringUtils.compare(time, MORING_PEAK_INTERVAL[1]) <= 0;
-    }
-
-    /**
-     * $判断是否晚高峰 <07:00~09:00>
-     * 
-     * @param date 输入日期
-     * @return boolean
-     */
-    public static boolean checkEveningPeak(Date date) {
-        String time = StringUtils.substring(dateToString(date, Contains.DEFAULT_TIME_FORMAT), 8, 14);
-        return StringUtils.compare(time, EVENING_PEAK_INTERVAL[0]) >= 0
-            && StringUtils.compare(time, EVENING_PEAK_INTERVAL[1]) <= 0;
-    }
-
-    /**
-     * $判断是否平峰 <09:00~17:00>
-     * 
-     * @param date 输入日期
-     * @return boolean
-     */
-    public static boolean checkFlatPeak(Date date) {
-        String time = StringUtils.substring(dateToString(date, Contains.DEFAULT_TIME_FORMAT), 8, 14);
-        return StringUtils.compare(time, FLAT_PEAK_INTERVAL[0]) >= 0
-            && StringUtils.compare(time, FLAT_PEAK_INTERVAL[1]) <= 0;
-    }
-
-    /**
-     * $判断是否工作日 <功能详细描述>
-     * 
-     * @param date 日期
-     * @return
-     * @see [类、类#方法、类#成员]
-     */
-    public static boolean checkWorkDay(Date date) {
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(date);
-        int wd = calendar.get(Calendar.DAY_OF_WEEK) - 1;
-        return wd >= 1 && wd <= 5;
-    }
-
-    /**
-     * $判断是否非工作日 <功能详细描述>
-     * 
-     * @param date 日期
-     * @return
-     * @see [类、类#方法、类#成员]
-     */
-    public static boolean checkNoWorkDay(Date date) {
-        Calendar calendar = Calendar.getInstance();
-        calendar.setTime(date);
-        int wd = calendar.get(Calendar.DAY_OF_WEEK) - 1;
-        return wd == 6 || wd == 0;
-    }
-}

+ 0 - 176
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/ExcelUtils.java

@@ -1,176 +0,0 @@
-/*
- * 文 件 名:  ExcelUtils
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  learshaw
- * 修改时间:  2020/3/18
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.utils;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.exception.ExceptionUtils;
-import org.apache.poi.ss.usermodel.CellBase;
-import org.apache.poi.ss.usermodel.CellType;
-import org.apache.poi.ss.usermodel.Workbook;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-/**
- * Poi Excel工具
- * <功能详细描述>
- *
- * @author learshaw
- * @version [版本号, 2020/3/18]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public abstract class ExcelUtils {
-    private static final Logger log = LoggerFactory.getLogger(ExcelUtils.class);
-
-    /**
-     * 写Excel <功能详细描述>
-     *
-     * @param workbook excel文档对象
-     * @param path     存放路径
-     * @see [类、类#方法、类#成员]
-     */
-    public static void writeXls(Workbook workbook, String path) {
-        FileOutputStream outputStream = null;
-
-        try {
-            // 修改模板内容导出新模板
-            outputStream = FileUtils.openOutputStream(new File(path));
-
-            if (null != outputStream) {
-                workbook.write(outputStream);
-            }
-        }
-        catch (FileNotFoundException e) {
-            log.error("write excel fail!", e);
-        }
-        catch (Exception e) {
-            log.error("write excel fail!", e);
-        }
-        finally {
-            CloseUtils.close(outputStream);
-        }
-    }
-
-    /**
-     * 获取输入流
-     * <功能详细描述>
-     *
-     * @param workBook workBook
-     * @return InputStream
-     * @see [类、类#方法、类#成员]
-     */
-    public static InputStream getInputStream(Workbook workBook) {
-        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
-        InputStream inputStream = null;
-
-        try {
-            workBook.write(byteArrayOutputStream);
-            byte[] content = byteArrayOutputStream.toByteArray();
-            inputStream = new ByteArrayInputStream(content);
-        }
-        catch (IOException e) {
-            log.error("Write excel fail!" + ExceptionUtils.getStackTrace(e));
-        }
-        finally {
-            CloseUtils.close(inputStream);
-            CloseUtils.close(byteArrayOutputStream);
-        }
-
-        return inputStream;
-    }
-
-    /**
-     * 获取字节数组输出流
-     * <功能详细描述>
-     *
-     * @param workBook HSSFWorkbook
-     * @return ByteArrayOutputStream
-     * @see [类、类#方法、类#成员]
-     */
-    public static ByteArrayOutputStream getByteArrayOutputStream(Workbook workBook) {
-        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
-
-        try {
-            workBook.write(byteArrayOutputStream);
-        }
-        catch (IOException e) {
-            log.error("Write excel fail!" + ExceptionUtils.getStackTrace(e));
-        }
-        finally {
-            CloseUtils.close(byteArrayOutputStream);
-        }
-
-        return byteArrayOutputStream;
-    }
-
-    /**
-     * 读取单元格值
-     * <功能详细描述>
-     *
-     * @param cell 单元格
-     * @return 值
-     * @see [类、类#方法、类#成员]
-     */
-    public static String getCellStringValue(CellBase cell) {
-        String cellValue = "";
-
-        // 字符串类型
-        if (cell.getCellType() == CellType.STRING) {
-            cellValue = cell.getStringCellValue();
-        }
-        // 数值类型
-        else if (cell.getCellType() == CellType.NUMERIC) {
-            cellValue = String.valueOf(cell.getNumericCellValue());
-        }
-        // 公式
-        else if (cell.getCellType() == CellType.FORMULA) {
-            cellValue = String.valueOf(cell.getNumericCellValue());
-        }
-        else if (cell.getCellType() == CellType.BOOLEAN) {
-            cellValue = String.valueOf(cell.getBooleanCellValue());
-        }
-
-        return cellValue;
-    }
-
-    /**
-     * 填充单元格值 <功能详细描述>
-     *
-     * @param cell     单元格
-     * @param value    填充值
-     * @param cellType 单元格类型
-     * @see [类、类#方法、类#成员]
-     */
-    public static void setCellValue(CellBase cell, String value, CellType cellType) {
-        cell.setCellType(cellType);
-
-        if (CellType.STRING == cellType) {
-            cell.setCellValue(value);
-        }
-        else if (CellType.NUMERIC == cellType) {
-            cell.setCellValue(Integer.parseInt(value));
-        }
-        else if (CellType.FORMULA == cellType) {
-            cell.setCellFormula(value);
-        }
-        else {
-            cell.setCellValue(value);
-        }
-    }
-}

+ 0 - 891
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/ExcelXlsUtils.java

@@ -1,891 +0,0 @@
-/*
- * 文 件 名:  ExcelUtil.java
- * 版    权:  江苏智通交通科技
- * 描    述:  <描述>
- * 修 改 人:  wblv
- * 修改时间:  2014年8月12日
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.utils;
-
-import com.huashe.citybrain.commons.base.bean.poi.CellStyle;
-import com.huashe.citybrain.commons.base.bean.poi.SheetFooter;
-import com.huashe.citybrain.commons.base.bean.poi.SheetMain;
-import com.huashe.citybrain.commons.base.bean.poi.WorkbookConfig;
-import com.huashe.citybrain.commons.base.exception.Assert;
-import com.huashe.citybrain.commons.base.exception.BusinessException;
-import com.huashe.citybrain.commons.base.exception.ErrorCode;
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.hssf.usermodel.HSSFCell;
-import org.apache.poi.hssf.usermodel.HSSFCellStyle;
-import org.apache.poi.hssf.usermodel.HSSFFont;
-import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator;
-import org.apache.poi.hssf.usermodel.HSSFRow;
-import org.apache.poi.hssf.usermodel.HSSFSheet;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.apache.poi.hssf.util.HSSFColor;
-import org.apache.poi.ss.usermodel.BorderStyle;
-import org.apache.poi.ss.usermodel.CellBase;
-import org.apache.poi.ss.usermodel.CellType;
-import org.apache.poi.ss.usermodel.CellValue;
-import org.apache.poi.ss.usermodel.HorizontalAlignment;
-import org.apache.poi.ss.usermodel.VerticalAlignment;
-import org.apache.poi.ss.util.CellRangeAddress;
-import org.apache.poi.ss.util.RegionUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Excel操作工具
- *
- * @author wblv
- * @version [版本号, 2014年8月12日]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public abstract class ExcelXlsUtils {
-    private static final Logger log = LoggerFactory.getLogger(ExcelXlsUtils.class);
-
-    /**
-     * 读取excel <功能详细描述>
-     *
-     * @param filePath 文件路径
-     * @return HSSFWorkbook
-     * @see [类、类#方法、类#成员]
-     */
-    public static HSSFWorkbook readXls(String filePath) {
-        InputStream inputStream = null;
-        HSSFWorkbook workBook = null;
-
-        try {
-            inputStream = new FileInputStream(filePath);
-            workBook = new HSSFWorkbook(inputStream);
-        }
-        catch (FileNotFoundException e) {
-            log.error("readXls fail!", e);
-        }
-        catch (Exception e) {
-            log.error("readXls fail!", e);
-        }
-        finally {
-            CloseUtils.close(inputStream);
-        }
-
-        return workBook;
-    }
-
-    /**
-     * 写Excel <功能详细描述>
-     *
-     * @param hssfWorkBook excel文档对象
-     * @param path         存放路径
-     * @see [类、类#方法、类#成员]
-     */
-    public static void writeXls(HSSFWorkbook hssfWorkBook, String path) {
-        ExcelUtils.writeXls(hssfWorkBook, path);
-    }
-
-    /**
-     * 获取输入流
-     * <功能详细描述>
-     *
-     * @param hssfWorkbook workBook
-     * @return InputStream
-     * @see [类、类#方法、类#成员]
-     */
-    public static InputStream getInputStream(HSSFWorkbook hssfWorkbook) {
-        return ExcelUtils.getInputStream(hssfWorkbook);
-    }
-
-    /**
-     * 获取字节数组输出流
-     * <功能详细描述>
-     *
-     * @param hssfWorkbook HSSFWorkbook
-     * @return ByteArrayOutputStream
-     * @see [类、类#方法、类#成员]
-     */
-    public static ByteArrayOutputStream getByteArrayOutputStream(HSSFWorkbook hssfWorkbook) {
-        return ExcelUtils.getByteArrayOutputStream(hssfWorkbook);
-    }
-
-    /**
-     * 获取sheet <功能详细描述>
-     *
-     * @param workBook  Excel工作薄
-     * @param sheetName Sheet名称
-     * @return HSSFSheet
-     * @see [类、类#方法、类#成员]
-     */
-    public static HSSFSheet getSheet(HSSFWorkbook workBook, String sheetName) {
-        HSSFSheet sheet = workBook.getSheet(sheetName);
-
-        if (null == sheet) {
-            sheet = workBook.createSheet(sheetName);
-        }
-
-        return sheet;
-    }
-
-    /**
-     * 获取行
-     * <功能详细描述>
-     *
-     * @param rowIndex 行号
-     * @return HSSFRow
-     * @see [类、类#方法、类#成员]
-     */
-    public static HSSFRow getRow(HSSFSheet sheet, int rowIndex) {
-        HSSFRow row = sheet.getRow(rowIndex);
-
-        if (row == null) {
-            row = sheet.createRow(rowIndex);
-        }
-
-        return row;
-    }
-
-    /**
-     * 获取单元格
-     * <功能详细描述>
-     *
-     * @param row      行对象
-     * @param colIndex 列编号
-     * @return HSSFCell
-     * @see [类、类#方法、类#成员]
-     */
-    public static HSSFCell getCell(HSSFRow row, int colIndex) {
-        HSSFCell cell = row.getCell(colIndex);
-
-        if (cell == null) {
-            cell = row.createCell(colIndex);
-        }
-
-        return cell;
-    }
-
-    /**
-     * 获取单元格
-     * <功能详细描述>
-     *
-     * @param sheet    sheet页对象
-     * @param rowIndex 行编号
-     * @param colIndex 列编号
-     * @return HSSFCell
-     * @see [类、类#方法、类#成员]
-     */
-    public static HSSFCell getCell(HSSFSheet sheet, int rowIndex, int colIndex) {
-        HSSFRow row = getRow(sheet, rowIndex);
-        return getCell(row, colIndex);
-    }
-
-    /**
-     * 填充单元格值 <功能详细描述>
-     *
-     * @param sheet    Sheet名称
-     * @param rowIndex 行坐标
-     * @param colIndex 列坐标
-     * @param value    填充值
-     * @param cellType 单元格参数类型
-     * @see [类、类#方法、类#成员]
-     */
-    public static void setSheetCellValue(HSSFSheet sheet, int rowIndex, int colIndex, String value, CellType cellType) {
-        HSSFCell cell = getCell(sheet, rowIndex, colIndex);
-        setCellValue(cell, value, cellType);
-    }
-
-    /**
-     * 填充单元格值 <功能详细描述>
-     *
-     * @param sheet    Sheet名称
-     * @param rowIndex 行坐标
-     * @param colIndex 列坐标
-     * @param value    填充值
-     * @see [类、类#方法、类#成员]
-     */
-    public static void setSheetCellValue(HSSFSheet sheet, int rowIndex, int colIndex, int value) {
-        HSSFCell cell = getCell(sheet, rowIndex, colIndex);
-        setCellValue(cell, value);
-    }
-
-    /**
-     * 填充单元格值 <功能详细描述>
-     *
-     * @param sheet    Sheet名称
-     * @param rowIndex 行坐标
-     * @param colIndex 列坐标
-     * @param value    填充值
-     * @see [类、类#方法、类#成员]
-     */
-    public static void setSheetCellValue(HSSFSheet sheet, int rowIndex, int colIndex, long value) {
-        HSSFCell cell = getCell(sheet, rowIndex, colIndex);
-        setCellValue(cell, value);
-    }
-
-    /**
-     * 填充单元格值 <功能详细描述>
-     *
-     * @param sheet    Sheet名称
-     * @param rowIndex 行坐标
-     * @param colIndex 列坐标
-     * @param value    填充值
-     * @see [类、类#方法、类#成员]
-     */
-    public static void setSheetCellValue(HSSFSheet sheet, int rowIndex, int colIndex, String value) {
-        HSSFCell cell = getCell(sheet, rowIndex, colIndex);
-        setCellValue(cell, value);
-    }
-
-    /**
-     * 填充单元格值 <功能详细描述>
-     *
-     * @param cell     单元格
-     * @param value    填充值
-     * @param cellType 单元格类型
-     * @see [类、类#方法、类#成员]
-     */
-    public static void setCellValue(CellBase cell, String value, CellType cellType) {
-        ExcelUtils.setCellValue(cell, value, cellType);
-    }
-
-    /**
-     * 填充单元格值 <功能详细描述>
-     *
-     * @param cell  单元格
-     * @param value 填充值
-     * @see [类、类#方法、类#成员]
-     */
-    public static void setCellValue(HSSFCell cell, int value) {
-        cell.setCellType(CellType.NUMERIC);
-        cell.setCellValue(value);
-    }
-
-    /**
-     * 填充单元格值 <功能详细描述>
-     *
-     * @param cell  单元格
-     * @param value 填充值
-     * @see [类、类#方法、类#成员]
-     */
-    public static void setCellValue(HSSFCell cell, long value) {
-        cell.setCellType(CellType.NUMERIC);
-        cell.setCellValue(value);
-    }
-
-    /**
-     * 填充单元格值 <功能详细描述>
-     *
-     * @param cell  单元格
-     * @param value 填充值
-     * @see [类、类#方法、类#成员]
-     */
-    public static void setCellValue(HSSFCell cell, String value) {
-        cell.setCellType(CellType.STRING);
-        cell.setCellValue(value);
-    }
-
-    public static String getSheetCellValue(HSSFSheet sheet, int rowIndex, int colIndex) {
-        HSSFCell cell = getCell(sheet, rowIndex, colIndex);
-        return getCellStringValue(cell);
-    }
-
-    /**
-     * 读取单元格值
-     * <功能详细描述>
-     *
-     * @param hssfCell 单元格
-     * @return 值
-     * @see [类、类#方法、类#成员]
-     */
-    public static String getCellStringValue(HSSFCell hssfCell) {
-        return ExcelUtils.getCellStringValue(hssfCell);
-    }
-
-    /**
-     * 合并单元格
-     * <功能详细描述>
-     *
-     * @param sheet      sheet页
-     * @param rowFrom    开始行
-     * @param rowTo      结束行
-     * @param columnFrom 开始列
-     * @param columnTo   结束列
-     * @see [类、类#方法、类#成员]
-     */
-    public static void mergeCell(HSSFSheet sheet, int rowFrom, int rowTo, int columnFrom, int columnTo) {
-        CellRangeAddress crAddress = new CellRangeAddress(rowFrom, rowTo, columnFrom, columnTo);
-        sheet.addMergedRegion(crAddress);
-    }
-
-    /**
-     * 设置单元格格式
-     * <功能详细描述>
-     *
-     * @see [类、类#方法、类#成员]
-     */
-    public static void setCellStyle(HSSFWorkbook workBook, HSSFCell cell, HorizontalAlignment styleType) {
-        HSSFCellStyle cellStyle = workBook.createCellStyle();
-        cellStyle.setAlignment(styleType);
-        cell.setCellStyle(cellStyle);
-    }
-
-    /**
-     * 计算出单元格中公式的值
-     * <功能详细描述>
-     *
-     * @param workBook 工作部
-     * @param cell     单元格
-     * @see [类、类#方法、类#成员]
-     */
-    public static double calculateFormulaValue(HSSFWorkbook workBook, HSSFCell cell) {
-        double retValue = 0.0;
-
-        if (cell.getCellType() == CellType.FORMULA) {
-            HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(workBook);
-            CellValue cellValue = evaluator.evaluate(cell);
-            retValue = cellValue.getNumberValue();
-        }
-
-        return retValue;
-    }
-
-    /**
-     * 重设公式单元格值
-     * <功能详细描述>
-     *
-     * @param sheet    sheet
-     * @param rowIndex rowIndex
-     * @Param colIndex colIndex
-     * @see [类、类#方法、类#成员]
-     */
-    public static void resetFormulaCell(HSSFSheet sheet, int rowIndex, int colIndex) {
-        HSSFCell hssfCell = getCell(sheet, rowIndex, colIndex);
-
-        if (CellType.FORMULA == hssfCell.getCellType()) {
-            //取得公式单元格的公式,重新设置
-            hssfCell.setCellFormula(hssfCell.getCellFormula());
-        }
-    }
-
-    /**
-     * 重设公式单元格值
-     * <功能详细描述>
-     *
-     * @param hssfCell hssfCell
-     * @see [类、类#方法、类#成员]
-     */
-    public static void resetFormulaCell(HSSFCell hssfCell) {
-        if (CellType.FORMULA == hssfCell.getCellType()) {
-            //取得公式单元格的公式,重新设置
-            hssfCell.setCellFormula(hssfCell.getCellFormula());
-        }
-    }
-
-    /**
-     * 字母列名转换为矩阵列坐标
-     * <pre>
-     * A -> [0]
-     * B -> [1]
-     * C -> [2]
-     *  ......
-     * IV -> [255]
-     * </pre>
-     *
-     * @param letterName 字母坐标
-     * @return
-     * @see [类、类#方法、类#成员]
-     */
-    public static int convertToColumnIndex(String letterName) {
-        int column = -1;
-        letterName = StringUtils.upperCase(letterName);
-
-        for (int i = 0; i < letterName.length(); ++i) {
-            int c = letterName.charAt(i);
-            column = (column + 1) * 26 + c - 'A';
-        }
-
-        return column;
-    }
-
-    /**
-     * 列座标转换为字母列名
-     * <pre>
-     * [0] -> A
-     * [1] -> B
-     * [2] -> C
-     *  ......
-     * [255] -> IV
-     * </pre>
-     *
-     * @param columnIndex 矩阵坐标
-     * @return
-     * @see [类、类#方法、类#成员]
-     */
-    public static String convertToLetterName(int columnIndex) {
-        columnIndex += 1;
-        String strResult = "";
-        int intRound = columnIndex / 26;
-        int intMod = columnIndex % 26;
-
-        if (intRound != 0) {
-            strResult = String.valueOf(((char) (intRound + 64)));
-        }
-
-        strResult += String.valueOf(((char) (intMod + 64)));
-
-        return strResult;
-    }
-
-    /**
-     * 矩阵坐标转换为单元格编号
-     * <pre>
-     * [0][0] -> A1
-     * [0][1] -> A2
-     * ......
-     * [255][65535] -> IV65536
-     * </pre>
-     *
-     * @param columnIndex 列坐标
-     * @param rowIndex    行坐标
-     * @return String
-     * @see [类、类#方法、类#成员]
-     */
-    public static String convertToCellId(int columnIndex, int rowIndex) {
-        return convertToLetterName(columnIndex) + (rowIndex + 1);
-    }
-
-    /**
-     * 删除sheet
-     * <功能详细描述>
-     *
-     * @param workBook  workBook
-     * @param sheetName sheetName
-     * @see [类、类#方法、类#成员]
-     */
-    public static void delSheet(HSSFWorkbook workBook, String sheetName) {
-        int sheetIndex = workBook.getSheetIndex(sheetName);
-        workBook.removeSheetAt(sheetIndex);
-    }
-
-    /**
-     * 默认字体
-     */
-    private static final String DEFAULT_FONT = "宋体";
-
-    /**
-     * 创建Excel文件
-     *
-     * @param file      文件
-     * @param sheetMain sheet
-     * @throws Exception 异常
-     */
-    public static void createExcelFile(File file, SheetMain sheetMain) throws IllegalAccessException, IOException {
-        OutputStream outputStream = new FileOutputStream(file);
-        checkSheet(sheetMain);
-
-        // 1.创建工作簿
-        HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
-        WorkbookConfig workbookConfig = buildWorkbookCfg(hssfWorkbook, sheetMain);
-
-        // 2.创建工作表
-        HSSFSheet sheet = hssfWorkbook.createSheet(sheetMain.getSheetName());
-        buildSheet(sheetMain, sheet, workbookConfig);
-
-        // 3.创建行
-        // 3.1创建头标题行;并且设置头标题
-        int currentRow = writeHeadRow(sheetMain, sheet, workbookConfig);
-        // 3.2创建列标题;并且设置列标题
-        writeHeadRow2(sheetMain, sheet, workbookConfig, currentRow);
-
-        // 4.创建列表内容
-        List<?> ts = sheetMain.getTs();
-        currentRow = writeBodyRow(ts, sheetMain, sheet, workbookConfig, currentRow);
-
-        // 5创建脚标内容
-        writeSheetFoot(sheetMain, sheet, workbookConfig, currentRow);
-
-        // 写入文件
-        hssfWorkbook.write(outputStream);
-    }
-
-    private static void checkSheet(SheetMain sheetMain) {
-        try {
-            if (null != sheetMain) {
-                Assert.notNull(sheetMain.getSheetTitle(), ErrorCode.PARAM_ERROR.getCode(), "创建EXCEL文件-主标题为空");
-                Assert.notNull(sheetMain.getSheetHeads(), ErrorCode.PARAM_ERROR.getCode(), "创建EXCEL文件-列标题为空");
-                Assert
-                    .isTrue(sheetMain.getSheetHeads().size() != 0, ErrorCode.PARAM_ERROR.getCode(), "创建EXCEL文件-列标题为空");
-                Assert.notNull(sheetMain.getTs(), ErrorCode.PARAM_ERROR.getCode(), "创建EXCEL文件-列内容为空");
-                Assert.isTrue(sheetMain.getTs().size() != 0, ErrorCode.PARAM_ERROR.getCode(), "创建EXCEL文件-列内容为空");
-            }
-            else {
-                throw new BusinessException(-1, "创建EXCEL文件-主对象为空");
-            }
-        }
-        catch (BusinessException e) {
-            log.warn("checkSheet", e);
-        }
-    }
-
-    private static WorkbookConfig buildWorkbookCfg(HSSFWorkbook hssfWorkbook, SheetMain sheetMain) {
-        WorkbookConfig config = new WorkbookConfig();
-        int headWidth = sheetMain.getSheetHeads().size();
-        config.setHeadWidth(headWidth);
-
-        // 1.1创建合并单元格对象
-        config.setCallRangeAddress(buildCallRangeAddress(sheetMain, headWidth));
-        // 1.2头标题样式
-        config.setHeadStyle(createHSSFCellStyle(hssfWorkbook, DEFAULT_FONT, sheetMain.getTitleCellStyle().getFontSize(),
-            sheetMain.getTitleCellStyle().isFontBold(), sheetMain.getTitleCellStyle().isBorderFlag(),
-            sheetMain.getTitleCellStyle().isAlignmentCenter(),
-            sheetMain.getTitleCellStyle().isVerticalAlignmentCenter()));
-        // 1.3列标题样式
-        config.setColHeadStyle(
-            createHSSFCellStyle(hssfWorkbook, DEFAULT_FONT, sheetMain.getHeadCellStyle().getFontSize(),
-                sheetMain.getHeadCellStyle().isFontBold(), sheetMain.getHeadCellStyle().isBorderFlag(),
-                sheetMain.getHeadCellStyle().isAlignmentCenter(),
-                sheetMain.getHeadCellStyle().isVerticalAlignmentCenter()));
-        // 1.4列样式
-        config.setColStyle(createHSSFCellStyle(hssfWorkbook, DEFAULT_FONT, sheetMain.getTitleCellStyle().getFontSize(),
-            sheetMain.getTitleCellStyle().isFontBold(), sheetMain.getTitleCellStyle().isBorderFlag(),
-            sheetMain.getTitleCellStyle().isAlignmentCenter(),
-            sheetMain.getTitleCellStyle().isVerticalAlignmentCenter()));
-        // 1.5脚标样式
-        config.setColFooterStyle(
-            createHSSFCellStyle(hssfWorkbook, DEFAULT_FONT, sheetMain.getFooterCellStyle().getFontSize(),
-                sheetMain.getFooterCellStyle().isFontBold(), sheetMain.getFooterCellStyle().isBorderFlag(),
-                sheetMain.getFooterCellStyle().isAlignmentCenter(),
-                sheetMain.getFooterCellStyle().isVerticalAlignmentCenter()));
-
-        return config;
-    }
-
-    /**
-     * 初始化行样式
-     *
-     * @param workbook                工作薄对象
-     * @param fontName                字体名称:宋体
-     * @param fontSize                字号大小:11
-     * @param fontBold                是否加粗:true/false
-     * @param borderFlag              是否边框:true/false
-     * @param alignmentCenter         水平居中:true/false
-     * @param verticalAlignmentCenter 垂直居中:true/false
-     * @return HSSFCellStyle
-     */
-    private static HSSFCellStyle createHSSFCellStyle(HSSFWorkbook workbook, String fontName, short fontSize,
-        boolean fontBold, boolean borderFlag, boolean alignmentCenter, boolean verticalAlignmentCenter) {
-        HSSFCellStyle hssfCellStyle = workbook.createCellStyle();
-
-        // 设置位置
-        setAbsolutePosition(hssfCellStyle, alignmentCenter, verticalAlignmentCenter);
-        // 设置边框
-        setBorder(hssfCellStyle, borderFlag);
-        // 设置字体
-        setFont(workbook, hssfCellStyle, fontName, fontSize, fontBold);
-
-        return hssfCellStyle;
-    }
-
-    private static void buildSheet(SheetMain sheetMain, HSSFSheet sheet, WorkbookConfig workbookConfig) {
-        // 2.1加载合并单元格对象
-        if (workbookConfig.getHeadWidth() != 0 && null != sheetMain.getSheetTitle()) {
-            sheet.addMergedRegion(workbookConfig.getCallRangeAddress());
-        }
-
-        // 设置默认列宽
-        if (null != sheetMain.getCellWidths() && sheetMain.getCellWidths().size() != 0) {
-            for (int i = 0; i < sheetMain.getCellWidths().size(); i++) {
-                sheet.setColumnWidth(i, ((int) sheetMain.getCellWidths().get(i)) * 256);
-            }
-        }
-        else {
-            sheet.setDefaultColumnWidth(15);
-        }
-
-        if (sheetMain.getTitleCellStyle().isBorderFlag()) {
-            // 下边框
-            RegionUtil.setBorderBottom(BorderStyle.THIN, workbookConfig.getCallRangeAddress(), sheet);
-            // 左边框
-            RegionUtil.setBorderLeft(BorderStyle.THIN, workbookConfig.getCallRangeAddress(), sheet);
-            // 有边框
-            RegionUtil.setBorderRight(BorderStyle.THIN, workbookConfig.getCallRangeAddress(), sheet);
-            // 上边框
-            RegionUtil.setBorderTop(BorderStyle.THIN, workbookConfig.getCallRangeAddress(), sheet);
-        }
-    }
-
-    private static int writeHeadRow(SheetMain sheetMain, HSSFSheet sheet, WorkbookConfig workbookConfig) {
-        int currentRow = 0;
-
-        HSSFRow row = sheet.createRow(sheetMain.getStartRow());
-        HSSFCell cell = row.createCell(sheetMain.getStartCell());
-        // 加载单元格样式
-        cell.setCellStyle(workbookConfig.getHeadStyle());
-
-        if (null != sheetMain.getSheetTitle()) {
-            cell.setCellValue(sheetMain.getSheetTitle());
-            currentRow += 1;
-        }
-
-        return currentRow;
-    }
-
-    private static void writeHeadRow2(SheetMain sheetMain, HSSFSheet sheet, WorkbookConfig workbookConfig,
-        int currentRow) {
-        if (null != sheetMain.getSheetHeads() && sheetMain.getSheetHeads().size() != 0) {
-            HSSFRow row2 = sheet.createRow(currentRow);
-
-            List<String> titles = sheetMain.getSheetHeads();
-            int len = titles.size();
-
-            for (int i = 0; i < len; i++) {
-                HSSFCell cell2 = row2.createCell(sheetMain.getStartCell() + i);
-                // 加载单元格样式
-                cell2.setCellStyle(workbookConfig.getColHeadStyle());
-                cell2.setCellValue(titles.get(i));
-            }
-        }
-    }
-
-    private static int writeBodyRow(List<?> ts, SheetMain sheetMain, HSSFSheet sheet, WorkbookConfig workbookConfig,
-        int currentRow) throws IllegalAccessException {
-        int tmpRow = currentRow;
-
-        if (CollectionUtils.isNotEmpty(ts)) {
-            if (ts.get(0) instanceof Map) {
-                tmpRow = writeBodyFromMap(ts, sheetMain, sheet, workbookConfig, currentRow);
-            }
-            else {
-                tmpRow = writeBodyFromList(ts, sheetMain, sheet, workbookConfig, currentRow);
-            }
-        }
-
-        return tmpRow;
-    }
-
-    private static int writeBodyFromMap(List<?> ts, SheetMain sheetMain, HSSFSheet sheet, WorkbookConfig workbookConfig,
-        int currentRow) {
-        int tmpRow = currentRow;
-
-        for (Object obj : ts) {
-            tmpRow += 1;
-            int i = 0;
-            HSSFRow row3 = sheet.createRow(sheetMain.getStartRow() + tmpRow);
-            Map<String, Object> map = (Map<String, Object>) obj;
-            Set<Map.Entry<String, Object>> set = map.entrySet();
-            Iterator<Map.Entry<String, Object>> iterator = set.iterator();
-
-            while (iterator.hasNext()) {
-                Map.Entry entry = iterator.next();
-                HSSFCell cell1 = row3.createCell(sheetMain.getStartCell() + i);
-                cell1.setCellStyle(workbookConfig.getColStyle());
-                cell1.setCellValue(String.valueOf(entry.getValue()));
-                i++;
-            }
-        }
-
-        return tmpRow;
-    }
-
-    private static int writeBodyFromList(List<?> ts, SheetMain sheetMain, HSSFSheet sheet,
-        WorkbookConfig workbookConfig, int currentRow) throws IllegalAccessException {
-        int tmpRow = currentRow;
-
-        for (int j = 0; j < ts.size(); j++) {
-            tmpRow += 1;
-            HSSFRow row3 = sheet.createRow(sheetMain.getStartRow() + tmpRow);
-            // 得到类对象
-            Class shellContentCla = (Class) ts.get(j).getClass();
-            /* 得到类中的所有属性集合 */
-            Field[] shellContentField = shellContentCla.getDeclaredFields();
-            List<Field> fields = new ArrayList<>();
-
-            for (int i = 0; i < shellContentField.length; i++) {
-                Field field = shellContentField[i];
-                if (!StringUtils.equals(field.getName(), "serialVersionUID")) {
-                    fields.add(field);
-                }
-            }
-
-            for (int i = 0; i < fields.size(); i++) {
-                Field field = fields.get(i);
-                field.setAccessible(true);
-                Object val = field.get(ts.get(j));
-
-                // 创建数据行,前面有两行,头标题行和列标题行
-                HSSFCell cell1 = row3.createCell(sheetMain.getStartCell() + i);
-                cell1.setCellStyle(workbookConfig.getColStyle());
-                cell1.setCellValue("");
-
-                if (null != val) {
-                    cell1.setCellValue(val.toString());
-                }
-            }
-        }
-
-        return tmpRow;
-    }
-
-    private static void writeSheetFoot(SheetMain sheetMain, HSSFSheet sheet, WorkbookConfig workbookConfig,
-        int currentRow) {
-        int tmpRow = currentRow + 1;
-        List<SheetFooter> sheetFooters = sheetMain.getSheetFooters();
-
-        if (null != sheetFooters) {
-            HSSFRow row4 = sheet.createRow(tmpRow);
-            for (int i = 0; i < sheetFooters.size(); i++) {
-                SheetFooter sheetFooter = sheetFooters.get(i);
-                HSSFCell cell1 = row4.createCell(sheetMain.getStartCell() + 2 * i);
-                cell1.setCellStyle(workbookConfig.getColHeadStyle());
-                cell1.setCellValue(sheetFooter.getName());
-
-                HSSFCell cell2 = row4.createCell(sheetMain.getStartCell() + 2 * i + 1);
-                cell2.setCellStyle(workbookConfig.getColFooterStyle());
-                cell2.setCellValue(sheetFooter.getValue());
-            }
-        }
-    }
-
-    private static CellRangeAddress buildCallRangeAddress(SheetMain sheetMain, int headWidth) {
-        CellRangeAddress callRangeAddress = null;
-
-        if (null != sheetMain.getSheetTitle()) {
-            // 起始行,结束行,起始列,结束列
-            int lastCol = (headWidth + sheetMain.getStartCell()) - (headWidth == 0 ? 0 : 1);
-            callRangeAddress = new CellRangeAddress(sheetMain.getStartRow(), sheetMain.getStartRow(),
-                sheetMain.getStartCell(), lastCol);
-        }
-
-        return callRangeAddress;
-    }
-
-    private static void setFont(HSSFWorkbook workbook, HSSFCellStyle hssfCellStyle, String fontName, short fontSize,
-        boolean fontBold) {
-        // --创建字体
-        HSSFFont font = workbook.createFont();
-        font.setFontHeightInPoints(fontSize);
-        // --设置字体名称
-        font.setFontName(StringUtils.isBlank(fontName) ? fontName : "宋体");
-        // --设置是否加粗
-        font.setBold(fontBold);
-        // 加载字体
-        hssfCellStyle.setFont(font);
-    }
-
-    /**
-     * 绝对位置设定
-     *
-     * @param hssfCellStyle           hssfCellStyle
-     * @param alignmentCenter         alignmentCenter
-     * @param verticalAlignmentCenter verticalAlignmentCenter
-     */
-    private static void setAbsolutePosition(HSSFCellStyle hssfCellStyle, boolean alignmentCenter,
-        boolean verticalAlignmentCenter) {
-        // --水平居中
-        if (alignmentCenter) {
-            hssfCellStyle.setAlignment(HorizontalAlignment.CENTER);
-        }
-
-        // --垂直居中
-        if (verticalAlignmentCenter) {
-            hssfCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
-        }
-    }
-
-    /**
-     * 设置边框
-     *
-     * @param hssfCellStyle hssfCellStyle
-     * @param borderFlag    borderFlag
-     */
-    private static void setBorder(HSSFCellStyle hssfCellStyle, boolean borderFlag) {
-        // --创建边框
-        if (borderFlag) {
-            hssfCellStyle.setBorderTop(BorderStyle.THIN);
-            hssfCellStyle.setBorderRight(BorderStyle.THIN);
-            hssfCellStyle.setBorderBottom(BorderStyle.THIN);
-            hssfCellStyle.setBorderLeft(BorderStyle.THIN);
-            hssfCellStyle.setTopBorderColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex());
-            hssfCellStyle.setLeftBorderColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex());
-        }
-    }
-
-    /**
-     * 创建样式对象
-     *
-     * @param fontSize                fontSize
-     * @param fontBold                fontBold
-     * @param borderFlag              borderFlag
-     * @param alignmentCenter         alignmentCenter
-     * @param verticalAlignmentCenter verticalAlignmentCenter
-     * @return CellStyle
-     */
-    public static CellStyle createCellStyle(Short fontSize, Boolean fontBold, Boolean borderFlag,
-        Boolean alignmentCenter, Boolean verticalAlignmentCenter) {
-        CellStyle cellStyle = new CellStyle();
-
-        if (null != fontSize) {
-            cellStyle.setFontSize(fontSize);
-        }
-
-        if (null != fontBold) {
-            cellStyle.setFontBold(fontBold);
-        }
-
-        if (null != borderFlag) {
-            cellStyle.setBorderFlag(borderFlag);
-        }
-
-        if (null != alignmentCenter) {
-            cellStyle.setAlignmentCenter(alignmentCenter);
-        }
-
-        if (null != verticalAlignmentCenter) {
-            cellStyle.setVerticalAlignmentCenter(verticalAlignmentCenter);
-        }
-
-        return cellStyle;
-    }
-
-    public static <T> File export(String fileName, String sheetName, String sheetTitle, List<String> headers,
-        List<T> data) throws IllegalAccessException, IOException {
-        if (data.isEmpty()) {
-            log.warn("需要导出的数据为空");
-            return null;
-        }
-        else {
-            File file = new File(System.getProperty("java.io.tmpdir") + "/" + fileName + ".xls");
-            SheetMain<T> sheetMain = new SheetMain<>();
-            sheetMain
-                .init(0, 0, Arrays.asList(15, 25, 15, 15, 10, 25), createCellStyle((short) 16, true, true, true, true),
-                    createCellStyle((short) 11, true, true, false, true),
-                    createCellStyle((short) 11, false, true, false, true),
-                    createCellStyle((short) 11, false, true, false, true));
-            sheetMain.setSheetName(sheetName);
-            sheetMain.setSheetTitle(sheetTitle);
-            sheetMain.setSheetHeads(headers);
-            sheetMain.setTs(data);
-            createExcelFile(file, sheetMain);
-            return file;
-        }
-    }
-}

+ 0 - 381
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/ExcelXlsxUtils.java

@@ -1,381 +0,0 @@
-/*
- * 文 件 名:  XlsxExcelUtils
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  learshaw
- * 修改时间:  2020/3/17
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.utils;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.poi.ss.usermodel.CellType;
-import org.apache.poi.ss.usermodel.CellValue;
-import org.apache.poi.ss.usermodel.HorizontalAlignment;
-import org.apache.poi.ss.util.CellRangeAddress;
-import org.apache.poi.xssf.usermodel.XSSFCell;
-import org.apache.poi.xssf.usermodel.XSSFCellStyle;
-import org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator;
-import org.apache.poi.xssf.usermodel.XSSFRow;
-import org.apache.poi.xssf.usermodel.XSSFSheet;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-
-import java.io.ByteArrayOutputStream;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-
-/**
- * XSSFWorkbook主要用于解析xlsx
- * 依赖poi-ooxml
- * <功能详细描述>
- *
- * @author learshaw
- * @version [版本号, 2020/3/17]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public abstract class ExcelXlsxUtils {
-    /**
-     * 日志记录
-     */
-    private static final Log logger = LogFactory.getLog(ExcelXlsUtils.class);
-
-    /**
-     * 读取excel <功能详细描述>
-     *
-     * @param filePath 文件路径
-     * @return
-     * @see [类、类#方法、类#成员]
-     */
-    public static XSSFWorkbook readXls(String filePath) {
-        InputStream inputStream = null;
-        XSSFWorkbook workBook = null;
-
-        try {
-            inputStream = new FileInputStream(filePath);
-            workBook = new XSSFWorkbook(inputStream);
-        }
-        catch (FileNotFoundException e) {
-            logger.error("readXlsx fail!", e);
-        }
-        catch (Exception e) {
-            logger.error("readXlsx fail!", e);
-        }
-        finally {
-            CloseUtils.close(inputStream);
-        }
-
-        return workBook;
-    }
-
-    /**
-     * 写Excel <功能详细描述>
-     *
-     * @param xssfWorkbook excel文档对象
-     * @param path         存放路径
-     * @see [类、类#方法、类#成员]
-     */
-    public static void writeXls(XSSFWorkbook xssfWorkbook, String path) {
-        ExcelUtils.writeXls(xssfWorkbook, path);
-    }
-
-    /**
-     * 获取输入流
-     * <功能详细描述>
-     *
-     * @param xssfWorkBook xssfWorkBook
-     * @return
-     * @see [类、类#方法、类#成员]
-     */
-    public static InputStream getInputStream(XSSFWorkbook xssfWorkBook) {
-        return ExcelUtils.getInputStream(xssfWorkBook);
-    }
-
-    /**
-     * 获取字节数组输出流
-     * <功能详细描述>
-     *
-     * @param xssfWorkBook
-     * @return
-     * @see [类、类#方法、类#成员]
-     */
-    public static ByteArrayOutputStream getByteArrayOutputStream(XSSFWorkbook xssfWorkBook) {
-        return ExcelUtils.getByteArrayOutputStream(xssfWorkBook);
-    }
-
-    /**
-     * 获取sheet <功能详细描述>
-     *
-     * @param workBook  Excel工作薄
-     * @param sheetName Sheet名称
-     * @return
-     * @see [类、类#方法、类#成员]
-     */
-    public static XSSFSheet getSheet(XSSFWorkbook workBook, String sheetName) {
-        XSSFSheet sheet = workBook.getSheet(sheetName);
-
-        if (null == sheet) {
-            sheet = workBook.createSheet(sheetName);
-        }
-
-        return sheet;
-    }
-
-    /**
-     * 获取行
-     * <功能详细描述>
-     *
-     * @param rowIndex 行号
-     * @return
-     * @see [类、类#方法、类#成员]
-     */
-    public static XSSFRow getRow(XSSFSheet sheet, int rowIndex) {
-        XSSFRow row = sheet.getRow(rowIndex);
-
-        if (row == null) {
-            row = sheet.createRow(rowIndex);
-        }
-
-        return row;
-    }
-
-    /**
-     * 获取单元格
-     * <功能详细描述>
-     *
-     * @param row      行对象
-     * @param colIndex 列编号
-     * @return
-     * @see [类、类#方法、类#成员]
-     */
-    public static XSSFCell getCell(XSSFRow row, int colIndex) {
-        XSSFCell cell = row.getCell(colIndex);
-
-        if (cell == null) {
-            cell = row.createCell(colIndex);
-        }
-
-        return cell;
-    }
-
-    /**
-     * 获取单元格
-     * <功能详细描述>
-     *
-     * @param sheet    sheet页对象
-     * @param rowIndex 行编号
-     * @param colIndex 列编号
-     * @return
-     * @see [类、类#方法、类#成员]
-     */
-    public static XSSFCell getCell(XSSFSheet sheet, int rowIndex, int colIndex) {
-        XSSFRow row = getRow(sheet, rowIndex);
-        return getCell(row, colIndex);
-    }
-
-    /**
-     * 填充单元格值 <功能详细描述>
-     *
-     * @param sheet    Sheet名称
-     * @param rowIndex 行坐标
-     * @param colIndex 列坐标
-     * @param value    填充值
-     * @param cellType 单元格参数类型
-     * @see [类、类#方法、类#成员]
-     */
-    public static void setSheetCellValue(XSSFSheet sheet, int rowIndex, int colIndex, String value, CellType cellType) {
-        XSSFCell cell = getCell(sheet, rowIndex, colIndex);
-        setCellValue(cell, value, cellType);
-    }
-
-    /**
-     * 填充单元格值 <功能详细描述>
-     *
-     * @param sheet    Sheet名称
-     * @param rowIndex 行坐标
-     * @param colIndex 列坐标
-     * @param value    填充值
-     * @see [类、类#方法、类#成员]
-     */
-    public static void setSheetCellValue(XSSFSheet sheet, int rowIndex, int colIndex, int value) {
-        XSSFCell cell = getCell(sheet, rowIndex, colIndex);
-        setCellValue(cell, value);
-    }
-
-    /**
-     * 填充单元格值 <功能详细描述>
-     *
-     * @param sheet    Sheet名称
-     * @param rowIndex 行坐标
-     * @param colIndex 列坐标
-     * @param value    填充值
-     * @see [类、类#方法、类#成员]
-     */
-    public static void setSheetCellValue(XSSFSheet sheet, int rowIndex, int colIndex, long value) {
-        XSSFCell cell = getCell(sheet, rowIndex, colIndex);
-        setCellValue(cell, value);
-    }
-
-    /**
-     * 填充单元格值 <功能详细描述>
-     *
-     * @param sheet    Sheet名称
-     * @param rowIndex 行坐标
-     * @param colIndex 列坐标
-     * @param value    填充值
-     * @see [类、类#方法、类#成员]
-     */
-    public static void setSheetCellValue(XSSFSheet sheet, int rowIndex, int colIndex, String value) {
-        XSSFCell cell = getCell(sheet, rowIndex, colIndex);
-        setCellValue(cell, value);
-    }
-
-    /**
-     * 填充单元格值 <功能详细描述>
-     *
-     * @param xssfCell 单元格
-     * @param value    填充值
-     * @param cellType 单元格类型
-     * @see [类、类#方法、类#成员]
-     */
-    public static void setCellValue(XSSFCell xssfCell, String value, CellType cellType) {
-        ExcelUtils.setCellValue(xssfCell, value, cellType);
-    }
-
-    /**
-     * 填充单元格值 <功能详细描述>
-     *
-     * @param cell  单元格
-     * @param value 填充值
-     * @see [类、类#方法、类#成员]
-     */
-    public static void setCellValue(XSSFCell cell, int value) {
-        cell.setCellType(CellType.NUMERIC);
-        cell.setCellValue(value);
-    }
-
-    /**
-     * 填充单元格值 <功能详细描述>
-     *
-     * @param cell  单元格
-     * @param value 填充值
-     * @see [类、类#方法、类#成员]
-     */
-    public static void setCellValue(XSSFCell cell, long value) {
-        cell.setCellType(CellType.NUMERIC);
-        cell.setCellValue(value);
-    }
-
-    /**
-     * 填充单元格值 <功能详细描述>
-     *
-     * @param cell  单元格
-     * @param value 填充值
-     * @see [类、类#方法、类#成员]
-     */
-    public static void setCellValue(XSSFCell cell, String value) {
-        cell.setCellType(CellType.STRING);
-        cell.setCellValue(value);
-    }
-
-    public static String getSheetCellValue(XSSFSheet sheet, int rowIndex, int colIndex) {
-        XSSFCell cell = getCell(sheet, rowIndex, colIndex);
-        return getCellStringValue(cell);
-    }
-
-    /**
-     * 读取单元格值
-     * <功能详细描述>
-     *
-     * @param xssfCell 单元格
-     * @return String
-     * @see [类、类#方法、类#成员]
-     */
-    public static String getCellStringValue(XSSFCell xssfCell) {
-        return ExcelUtils.getCellStringValue(xssfCell);
-    }
-
-    /**
-     * 合并单元格
-     * <功能详细描述>
-     *
-     * @param sheet      sheet页
-     * @param rowFrom    开始行
-     * @param rowTo      结束行
-     * @param columnFrom 开始列
-     * @param columnTo   结束列
-     * @see [类、类#方法、类#成员]
-     */
-    public static void mergeCell(XSSFSheet sheet, int rowFrom, int rowTo, int columnFrom, int columnTo) {
-        CellRangeAddress crAddress = new CellRangeAddress(rowFrom, rowTo, columnFrom, columnTo);
-        sheet.addMergedRegion(crAddress);
-    }
-
-    /**
-     * 设置单元格格式
-     * <功能详细描述>
-     *
-     * @see [类、类#方法、类#成员]
-     */
-    public static void setCellStyle(XSSFWorkbook workBook, XSSFCell cell, HorizontalAlignment styleType) {
-        XSSFCellStyle cellStyle = workBook.createCellStyle();
-        cellStyle.setAlignment(styleType);
-        cell.setCellStyle(cellStyle);
-    }
-
-    /**
-     * 计算出单元格中公式的值
-     * <功能详细描述>
-     *
-     * @param workBook 工作部
-     * @param cell     单元格
-     * @see [类、类#方法、类#成员]
-     */
-    public static double calculateFormulaValue(XSSFWorkbook workBook, XSSFCell cell) {
-        double retValue = 0.0;
-
-        if (cell.getCellType() == CellType.FORMULA) {
-            XSSFFormulaEvaluator evaluator = new XSSFFormulaEvaluator(workBook);
-            CellValue cellValue = evaluator.evaluate(cell);
-            retValue = cellValue.getNumberValue();
-        }
-
-        return retValue;
-    }
-
-    /**
-     * 重设公式单元格值
-     * <功能详细描述>
-     *
-     * @param sheet    sheet
-     * @param rowIndex rowIndex
-     * @Param colIndex colIndex
-     * @see [类、类#方法、类#成员]
-     */
-    public static void resetFormulaCell(XSSFSheet sheet, int rowIndex, int colIndex) {
-        XSSFCell hssfCell = getCell(sheet, rowIndex, colIndex);
-
-        if (CellType.FORMULA == hssfCell.getCellType()) {
-            //取得公式单元格的公式,重新设置
-            hssfCell.setCellFormula(hssfCell.getCellFormula());
-        }
-    }
-
-    /**
-     * 重设公式单元格值
-     * <功能详细描述>
-     *
-     * @param hssfCell hssfCell
-     * @see [类、类#方法、类#成员]
-     */
-    public static void resetFormulaCell(XSSFCell hssfCell) {
-        if (CellType.FORMULA == hssfCell.getCellType()) {
-            //取得公式单元格的公式,重新设置
-            hssfCell.setCellFormula(hssfCell.getCellFormula());
-        }
-    }
-}

+ 0 - 90
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/FileUtils.java

@@ -1,90 +0,0 @@
-/*
- * 文 件 名:  FileUtils
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  0027008907/lv.wenbin
- * 修改时间:  2020/10/20
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.utils;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
-
-import javax.imageio.ImageIO;
-import java.awt.image.BufferedImage;
-import java.io.InputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-/**
- * 文件工具
- * <功能详细描述>
- *
- * @author 0027008907/lv.wenbin
- * @version [版本号, 2020/10/20]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public abstract class FileUtils {
-    private static final Log logger = LogFactory.getLog(FileUtils.class);
-
-    /**
-     * 从网络取图片
-     * @param strUrl
-     * @return
-     */
-    public static BufferedImage getImageFromNetByUrl(String strUrl) {
-        HttpURLConnection conn = null;
-        InputStream inStream = null;
-        BufferedImage image = null;
-
-        try {
-            URL url = new URL(strUrl);
-            conn = (HttpURLConnection) url.openConnection();
-            conn.setRequestMethod("GET");
-            conn.setConnectTimeout(15 * 1000);
-            // 通过输入流获取图片数据
-            inStream = conn.getInputStream();
-            image = ImageIO.read(inStream);
-        }
-        catch (Exception e) {
-            logger.error("获取过车图片出现异常", e);
-        }
-        finally {
-            CloseUtils.close(inStream);
-
-            if (null != conn) {
-                conn.disconnect();
-            }
-        }
-
-        return image;
-    }
-
-    /**
-     * 从本地取图片
-     * @param file
-     * @return
-     */
-    public static BufferedImage getImageFromPath(String file) {
-        BufferedImage image = null;
-
-        try {
-            Resource resource = new ClassPathResource(file);
-            image = ImageIO.read(resource.getInputStream());
-        }
-        catch (Exception e) {
-            logger.error("获取默认图片出现异常:", e);
-        }
-        finally {
-            CloseUtils.close(image);
-        }
-
-        return image;
-    }
-}

+ 0 - 110
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/GeoUtils.java

@@ -1,110 +0,0 @@
-/*
- * 文 件 名:  DistanceUtils.java
- * 版    权:  浩鲸云科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  LvWenbin
- * 修改时间:  2018/11/06 18:51
- */
-package com.huashe.citybrain.commons.base.utils;
-
-import org.springframework.data.geo.Point;
-
-import java.util.List;
-
-/**
- * $距离工具 <功能详细描述>
- *
- * @author LvWenbin
- * @version [版本号, 2018/11/06 18:51]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public abstract class GeoUtils {
-    /**
-     * $地球半径
-     */
-    private static final double EARTH_RADIUS = 6378.137;
-
-    /**
-     * $取两点之间距离 coordinate1 坐标1 coordinate2 坐标2
-     *
-     * @return 两个经纬度的距离
-     */
-    public static double getDistance(Point coordinate1, Point coordinate2) {
-        double firstRadLng = rad(coordinate1.getX());
-        double firstRadLat = rad(coordinate1.getY());
-        double secondRadLng = rad(coordinate2.getX());
-        double secondRadLat = rad(coordinate2.getY());
-
-        double a = firstRadLat - secondRadLat;
-        double b = firstRadLng - secondRadLng;
-        double cal = 2 * Math.asin(Math.sqrt(
-            Math.pow(Math.sin(a / 2), 2) + Math.cos(firstRadLat) * Math.cos(secondRadLat) * Math
-                .pow(Math.sin(b / 2), 2))) * EARTH_RADIUS;
-        double result = Math.round(cal * 10000d) / 10000d;
-        return result * 1000;
-    }
-
-    private static double rad(double d) {
-        return d * Math.PI / 180.0;
-    }
-
-    /**
-     * $根据输入的地点坐标计算中心点 <适用于400KM以上场景>
-     *
-     * @param geoCoordinateList
-     * @return
-     */
-    public static Point getCenterPoint(List<Point> geoCoordinateList) {
-        int total = geoCoordinateList.size();
-        double X = 0;
-        double Y = 0;
-        double Z = 0;
-
-        for (Point g : geoCoordinateList) {
-            double lat;
-            double lon;
-            double x;
-            double y;
-            double z;
-            lon = g.getX() * Math.PI / 180;
-            lat = g.getY() * Math.PI / 180;
-            x = Math.cos(lat) * Math.cos(lon);
-            y = Math.cos(lat) * Math.sin(lon);
-            z = Math.sin(lat);
-            X += x;
-            Y += y;
-            Z += z;
-        }
-
-        X = X / total;
-        Y = Y / total;
-        Z = Z / total;
-        double Lon = Math.atan2(Y, X);
-        double Hyp = Math.sqrt(X * X + Y * Y);
-        double Lat = Math.atan2(Z, Hyp);
-        return new Point(Lon * 180 / Math.PI, Lat * 180 / Math.PI);
-    }
-
-    /**
-     * $根据输入的地点坐标计算中心点 <适用于400KM以下场景>
-     *
-     * @param geoCoordinateList
-     * @return
-     */
-    public static Point getCenterPoint400(List<Point> geoCoordinateList) {
-        // 以下为简化方法(400km以内)
-        int total = geoCoordinateList.size();
-        double lat = 0;
-        double lon = 0;
-
-        for (Point g : geoCoordinateList) {
-            lon += g.getX() * Math.PI / 180;
-            lat += g.getY() * Math.PI / 180;
-
-        }
-        lat /= total;
-        lon /= total;
-        return new Point(lon * 180 / Math.PI, lat * 180 / Math.PI);
-    }
-}

+ 0 - 39
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/ResourceUtils.java

@@ -1,39 +0,0 @@
-package com.huashe.citybrain.commons.base.utils;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
-import org.springframework.core.io.support.ResourcePatternResolver;
-
-import java.io.IOException;
-
-/**
- * @author yineg
- */
-public abstract class ResourceUtils {
-    private static final Logger log = LoggerFactory.getLogger(ResourceUtils.class);
-
-    public static Resource[] getResources(String locationPattern) throws IOException {
-        ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
-        Resource[] resources = resolver.getResources(locationPattern);
-        if (resources != null) {
-            return resources;
-        }
-        return new Resource[0];
-    }
-
-    public static Resource getResource(String locationPattern) throws IOException {
-        Resource[] resources = getResources(locationPattern);
-
-        if (resources.length == 0) {
-            return null;
-        }
-
-        if (resources.length > 1) {
-            log.error("find file gt 1 for:" + locationPattern);
-        }
-
-        return resources[0];
-    }
-}

+ 0 - 80
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/Sha256Utils.java

@@ -1,80 +0,0 @@
-/*
- * 文 件 名:  Sha256Utils
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  0027008907/lv.wenbin
- * 修改时间:  2020/10/28
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.utils;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.nio.charset.StandardCharsets;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-/**
- * Sha256Utils
- * <功能详细描述>
- *
- * @author 0027008907/lv.wenbin
- * @version [版本号, 2020/10/28]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public abstract class Sha256Utils {
-    /**
-     * 日志
-     */
-    public static final Logger log = LoggerFactory.getLogger(Sha256Utils.class);
-
-    /**
-     * 利用java原生的类实现SHA256加密
-     *
-     * @param str 加密后的报文
-     * @return
-     */
-    public static String getSHA256(String str) {
-        MessageDigest messageDigest;
-        String encodestr = "";
-
-        try {
-            messageDigest = MessageDigest.getInstance("SHA-256");
-            messageDigest.update(str.getBytes(StandardCharsets.UTF_8));
-            encodestr = byte2Hex(messageDigest.digest());
-        }
-        catch (NoSuchAlgorithmException e) {
-            log.error("getSHA256 fail!", e);
-        }
-
-        return encodestr;
-    }
-
-    /**
-     * 将byte转为16进制
-     *
-     * @param bytes 字节
-     * @return 结果
-     */
-    private static String byte2Hex(byte[] bytes) {
-        StringBuilder stringBuilder = new StringBuilder();
-        String temp = null;
-
-        for (int i = 0; i < bytes.length; i++) {
-            temp = Integer.toHexString(bytes[i] & 0xFF);
-
-            if (temp.length() == 1) {
-                // 1得到一位的进行补0操作
-                stringBuilder.append("0");
-            }
-
-            stringBuilder.append(temp);
-        }
-
-        return stringBuilder.toString();
-    }
-}

+ 0 - 73
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/SpringUtils.java

@@ -1,73 +0,0 @@
-/*
- * 文 件 名:  SpringUtils
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  lv.wenbin@huashe.com
- * 修改时间:  2019/3/11
- */
-package com.huashe.citybrain.commons.base.utils;
-
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.stereotype.Component;
-
-/**
- * SpringUtils <功能详细描述>
- *
- * @author lv.wenbin@huashe.com
- * @version [版本号, 2019/3/11]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-@Component
-public class SpringUtils implements ApplicationContextAware {
-    private static ApplicationContext applicationContext;
-
-    @Override
-    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
-        if (SpringUtils.applicationContext == null) {
-            SpringUtils.applicationContext = applicationContext;
-        }
-    }
-
-    /**
-     * 获取applicationContext
-     *
-     * @return ApplicationContext
-     */
-    public static ApplicationContext getApplicationContext() {
-        return applicationContext;
-    }
-
-    /**
-     * 通过name获取 Bean.
-     *
-     * @param name beanName
-     * @return Bean
-     */
-    public static Object getBean(String name) {
-        return getApplicationContext().getBean(name);
-    }
-
-    /**
-     * 通过class获取Bean.
-     *
-     * @param clazz 类
-     * @return Bean
-     */
-    public static <T> T getBean(Class<T> clazz) {
-        return getApplicationContext().getBean(clazz);
-    }
-
-    /**
-     * 通过name,以及Clazz返回指定的Bean
-     *
-     * @param name  名称
-     * @param clazz 类
-     * @return Bean
-     */
-    public static <T> T getBean(String name, Class<T> clazz) {
-        return getApplicationContext().getBean(name, clazz);
-    }
-}

+ 0 - 53
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/SwaggerUtils.java

@@ -1,53 +0,0 @@
-/*
- * 文 件 名:  SwaggerUtils
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  learshaw
- * 修改时间:  2019/7/17
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.utils;
-
-import springfox.documentation.builders.ApiInfoBuilder;
-import springfox.documentation.builders.ParameterBuilder;
-import springfox.documentation.builders.PathSelectors;
-import springfox.documentation.builders.RequestHandlerSelectors;
-import springfox.documentation.schema.ModelRef;
-import springfox.documentation.service.ApiInfo;
-import springfox.documentation.service.Parameter;
-import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spring.web.plugins.Docket;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Swagger工具类 <功能详细描述>
- *
- * @author learshaw
- * @version [版本号, 2019/7/17]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public abstract class SwaggerUtils {
-    public static Docket buildDocket(String tpName, String tpDesc, String tpClassType, String tpTransferType,
-        boolean tpRequired, String basePackage, ApiInfo apiInfo) {
-
-        ParameterBuilder pb = new ParameterBuilder();
-        pb.name(tpName).description(tpDesc).modelRef(new ModelRef(tpClassType)).parameterType(tpTransferType)
-            .required(tpRequired).build();
-
-        List<Parameter> parameters = new ArrayList<>();
-        parameters.add(pb.build());
-
-        return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo).select()
-            .apis(RequestHandlerSelectors.basePackage(basePackage)).paths(PathSelectors.any()).build()
-            .globalOperationParameters(parameters);
-    }
-
-    public static ApiInfo buildApiInfo(String title, String desc, String tosUrl, String version) {
-        return new ApiInfoBuilder().title(title).description(desc).termsOfServiceUrl(tosUrl).version(version).build();
-    }
-}

+ 0 - 215
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/TestUtils.java

@@ -1,215 +0,0 @@
-/*
- * 文 件 名:  ResponseUtils
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  learshaw
- * 修改时间:  2019/8/27
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.utils;
-
-import com.alibaba.fastjson2.JSON;
-import com.alibaba.fastjson2.JSONObject;
-import com.huashe.citybrain.commons.base.bean.Response;
-import com.huashe.citybrain.commons.base.exception.Assert;
-import com.huashe.citybrain.commons.base.exception.BusinessException;
-import com.huashe.citybrain.commons.base.exception.ErrorCode;
-import org.apache.commons.io.FileUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.util.ClassUtils;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * 测试响应工具类
- * <功能详细描述>
- *
- * @author learshaw
- * @version [版本号, 2019/8/27]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public abstract class TestUtils {
-    private static Logger log = LoggerFactory.getLogger(TestUtils.class);
-
-    /**
-     * 获取对象列表
-     *
-     * @param t     对象
-     * @param cType 类型
-     * @param <T>   响应
-     * @return Response
-     */
-    public static <T> Response<T> getResponse(T t, Class<T> cType) {
-        Response<T> response = new Response<>();
-
-        response.setCode(0);
-        response.setMessage("成功!");
-        response.setData(t);
-
-        return response;
-    }
-
-    public static File getTestFile(String filePath) {
-        String path = ClassUtils.getDefaultClassLoader().getResource("").getPath() + filePath;
-        return new File(path);
-    }
-
-    /**
-     * 获取对象列表
-     *
-     * @param file  测试文件
-     * @param cType 类型
-     * @param <T>   响应
-     * @return Response
-     */
-    public static <T> Response<T> getResponseObj(File file, Class<T> cType) {
-        Response<T> response = new Response<>();
-
-        try {
-            T obj = readObj(file, cType);
-            response.setData(obj);
-        }
-        catch (BusinessException e) {
-            CommonUtils.businessExceptionRes(response, e);
-            log.error("getResponseList fail!", e);
-        }
-        catch (Exception e) {
-            log.error("getResponseList fail!", e);
-            CommonUtils.unknownExceptionRes(response, e);
-        }
-
-        return response;
-    }
-
-    /**
-     * 获取对象列表
-     *
-     * @param file  测试文件
-     * @param cType 类型
-     * @param <T>   响应
-     * @return Response
-     */
-    public static <T> Response<List<T>> getResponseList(File file, Class<T> cType) {
-        Response<List<T>> response = new Response<>();
-
-        try {
-            List<T> list = readList(file, cType);
-            response.setData(list);
-        }
-        catch (BusinessException e) {
-            CommonUtils.businessExceptionRes(response, e);
-            log.error("getResponseList fail!", e);
-        }
-        catch (Exception e) {
-            log.error("getResponseList fail!", e);
-            CommonUtils.unknownExceptionRes(response, e);
-        }
-
-        return response;
-    }
-
-    /**
-     * 获取Map响应
-     *
-     * @param file file
-     * @return Map
-     */
-    public static JSONObject readJSON(File file) {
-        Assert.notNull(file, ErrorCode.UNKNOWN_ERROR);
-        Assert.isTrue(file.exists(), ErrorCode.UNKNOWN_ERROR.getCode(), "测试参数文件不存在!");
-        return readObj(file, JSONObject.class);
-    }
-
-    /**
-     * Map转换
-     *
-     * @return 响应
-     */
-    public static Map<String, Long> convertLongMap(Map source) {
-        Map<String, Long> dataMap = new HashMap<>();
-        Set<Map.Entry<String, Object>> tmpSet = source.entrySet();
-        Iterator<Map.Entry<String, Object>> iterator = tmpSet.iterator();
-
-        while (iterator.hasNext()) {
-            Map.Entry<String, Object> entry = iterator.next();
-            String key = entry.getKey();
-            Object value = entry.getValue();
-            dataMap.put(key, Long.valueOf(value.toString()));
-        }
-
-        return dataMap;
-    }
-
-    /**
-     * Map转换
-     *
-     * @return 响应
-     */
-    public static Map<String, String> convertStringMap(Map<String, Object> source) {
-        Map<String, String> dataMap = new HashMap<>();
-        Set<Map.Entry<String, Object>> tmpSet = source.entrySet();
-        Iterator<Map.Entry<String, Object>> iterator = tmpSet.iterator();
-
-        while (iterator.hasNext()) {
-            Map.Entry<String, Object> entry = iterator.next();
-            String key = entry.getKey();
-            Object value = entry.getValue();
-            dataMap.put(key, value.toString());
-        }
-
-        return dataMap;
-    }
-
-    /**
-     * 获取对象
-     *
-     * @param file  文件
-     * @param cType 类型
-     * @param <T>
-     * @return 对象
-     */
-    public static <T> T readObj(File file, Class<T> cType) {
-        T t = null;
-
-        try {
-            String dataStr = FileUtils.readFileToString(file, "UTF-8");
-            t = JSON.parseObject(dataStr, cType);
-        }
-        catch (Exception e) {
-            log.error("readFileTo Obj fail!", e);
-        }
-
-        return t;
-    }
-
-    /**
-     * 获取对象列表
-     *
-     * @param file  文件
-     * @param cType 类型
-     * @param <T>   对象列表
-     * @return List
-     */
-    public static <T> List<T> readList(File file, Class<T> cType) {
-        List<T> list = null;
-
-        try {
-            String dataStr = FileUtils.readFileToString(file, "UTF-8");
-            list = JSON.parseArray(dataStr, cType);
-        }
-        catch (Exception e) {
-            log.error("readFileTo Obj fail!", e);
-        }
-
-        return list;
-    }
-}

+ 0 - 56
common-cloud/prod-common/src/main/java/com/huashe/citybrain/commons/base/utils/UnicodeUtils.java

@@ -1,56 +0,0 @@
-/*
- * 文 件 名:  UnicodeUtils
- * 版    权:  浩鲸云计算科技股份有限公司
- * 描    述:  <描述>
- * 修 改 人:  learshaw
- * 修改时间:  2019/8/20
- * 跟踪单号:  <跟踪单号>
- * 修改单号:  <修改单号>
- * 修改内容:  <修改内容>
- */
-package com.huashe.citybrain.commons.base.utils;
-
-/**
- * 字符编码转换
- * <功能详细描述>
- *
- * @author learshaw
- * @version [版本号, 2019/8/20]
- * @see [相关类/方法]
- * @since [产品/模块版本]
- */
-public abstract class UnicodeUtils {
-    /**
-     * 字符串转换unicode
-     */
-    public static String stringToUnicode(String string) {
-        StringBuffer unicode = new StringBuffer();
-
-        for (int i = 0; i < string.length(); i++) {
-            // 取出每一个字符
-            char c = string.charAt(i);
-
-            // 转换为unicode
-            unicode.append(String.format("\\u%04x", Integer.valueOf(c)));
-        }
-
-        return unicode.toString();
-    }
-
-    /**
-     * unicode 转字符串
-     */
-    public static String unicodeToString(String unicode) {
-        StringBuffer string = new StringBuffer();
-        String[] hex = unicode.split("\\\\u");
-
-        for (int i = 1; i < hex.length; i++) {
-            // 转换出每一个代码点
-            int data = Integer.parseInt(hex[i], 16);
-            // 追加成string
-            string.append((char) data);
-        }
-
-        return string.toString();
-    }
-}

+ 186 - 0
common-cloud/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/Assert.java

@@ -0,0 +1,186 @@
+/*
+ * 文 件 名:  Assert
+ * 版    权:  浩鲸云计算科技股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lv.wenbin@huashe.com
+ * 修改时间:  2019/4/21
+ */
+package com.ruoyi.common.core.exception;
+
+
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * 断言 <功能详细描述>
+ *
+ * @author lv.wenbin@huashe.com
+ * @version [版本号, 2019/4/21]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public abstract class Assert {
+    /**
+     * 真假断言 <功能详细描述>
+     *
+     * @param expression 真假
+     * @param errorCode  错误码
+     * @param message    错误消息
+     * @throws BusinessException 异常
+     * @see [类、类#方法、类#成员]
+     */
+    public static void isTrue(boolean expression, int errorCode, String message) throws BusinessException {
+        if (!expression) {
+            throw new BusinessException(errorCode, message);
+        }
+    }
+
+    /**
+     * 真假断言 <功能详细描述>
+     *
+     * @param expression 真假
+     * @param errorCode  错误码
+     * @throws BusinessException 异常
+     * @see [类、类#方法、类#成员]
+     */
+    public static void isTrue(boolean expression, ErrorCode errorCode) throws BusinessException {
+        if (!expression) {
+            throw new BusinessException(errorCode.getCode(), errorCode.getMessage());
+        }
+    }
+
+    /**
+     * 真假断言 <功能详细描述>
+     *
+     * @param expression 真假
+     * @param errorCode  错误码
+     * @param message    错误消息
+     * @param ext        扩展属性
+     * @throws BusinessException 异常
+     * @see [类、类#方法、类#成员]
+     */
+    public static void isTrue(boolean expression, int errorCode, String message, Object ext) throws BusinessException {
+        if (!expression) {
+            throw new BusinessException(errorCode, message, ext);
+        }
+    }
+
+    /**
+     * 空判断 <功能详细描述>
+     *
+     * @param object    对象
+     * @param errorCode 错误码
+     * @param message   错误消息
+     * @throws BusinessException 异常
+     * @see [类、类#方法、类#成员]
+     */
+    public static void isNull(Object object, int errorCode, String message) throws BusinessException {
+        if (object != null) {
+            throw new BusinessException(errorCode, message);
+        }
+    }
+
+    /**
+     * 空判断 <功能详细描述>
+     *
+     * @param object    对象
+     * @param errorCode 错误
+     * @throws BusinessException 异常
+     * @see [类、类#方法、类#成员]
+     */
+    public static void isNull(Object object, ErrorCode errorCode) throws BusinessException {
+        if (object != null) {
+            throw new BusinessException(errorCode.getCode(), errorCode.getMessage());
+        }
+    }
+
+    /**
+     * 非空判断 <功能详细描述>
+     *
+     * @param object    对象
+     * @param errorCode 错误码
+     * @param message   错误消息
+     * @throws BusinessException 异常
+     * @see [类、类#方法、类#成员]
+     */
+    public static void notNull(Object object, int errorCode, String message) throws BusinessException {
+        if (object == null) {
+            throw new BusinessException(errorCode, message);
+        }
+    }
+
+    /**
+     * 非空判断 <功能详细描述>
+     *
+     * @param object    对象
+     * @param errorCode 错误
+     * @throws BusinessException 异常
+     * @see [类、类#方法、类#成员]
+     */
+    public static void notNull(Object object, ErrorCode errorCode) throws BusinessException {
+        if (object == null) {
+            throw new BusinessException(errorCode.getCode(), errorCode.getMessage());
+        }
+    }
+
+    /**
+     * 数组非空判断 <功能详细描述>
+     *
+     * @param array     数组
+     * @param errorCode 错误码
+     * @param message   错误消息
+     * @throws BusinessException 异常
+     * @see [类、类#方法、类#成员]
+     */
+    public static void notEmpty(Object[] array, int errorCode, String message) throws BusinessException {
+        if (array == null || array.length == 0) {
+            throw new BusinessException(errorCode, message);
+        }
+    }
+
+    /**
+     * 集合非空判断 <功能详细描述>
+     *
+     * @param collection 集合列表
+     * @param errorCode  错误码
+     * @param message    错误信息
+     * @throws BusinessException 异常
+     * @see [类、类#方法、类#成员]
+     */
+    public static <T> void notEmpty(Collection<T> collection, int errorCode, String message) throws BusinessException {
+        if (collection == null || collection.isEmpty()) {
+            throw new BusinessException(errorCode, message);
+        }
+    }
+
+    /**
+     * Map非空判断
+     *
+     * @param map       Map Map集合
+     * @param errorCode 错误码
+     * @param message   错误信息
+     * @throws BusinessException 异常
+     * @see [类、类#方法、类#成员]
+     */
+    public static <K, V> void notEmpty(Map<K, V> map, int errorCode, String message) throws BusinessException {
+        if (map == null || map.isEmpty()) {
+            throw new BusinessException(errorCode, message);
+        }
+    }
+
+    /**
+     * 字符串空判断 <功能详细描述>
+     *
+     * @param str       字符串
+     * @param errorCode 错误码
+     * @param message   错误信息
+     * @throws BusinessException 异常
+     * @see [类、类#方法、类#成员]
+     */
+    public static void notEmpty(String str, int errorCode, String message) throws BusinessException {
+        if (str == null || str.length() == 0) {
+            throw new BusinessException(errorCode, message);
+        }
+    }
+}

+ 59 - 0
common-cloud/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/BusinessException.java

@@ -0,0 +1,59 @@
+package com.ruoyi.common.core.exception;
+
+/**
+ * 业务异常
+ *
+ * @author ruoyi
+ */
+public class BusinessException extends RuntimeException {
+    /**
+     * 错误码
+     */
+    protected int code;
+
+    protected final String message;
+
+    /**
+     * 扩展属性
+     */
+    private Object ext;
+
+    public BusinessException(String message) {
+        this.message = message;
+    }
+
+    public BusinessException(int code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+    public BusinessException(String message, Throwable e) {
+        super(message, e);
+        this.message = message;
+    }
+
+    public BusinessException(int code, String message, Throwable e) {
+        super(message, e);
+        this.code = code;
+        this.message = message;
+    }
+
+    public BusinessException(int code, String message, Object ext) {
+        this.code = code;
+        this.message = message;
+        this.ext = ext;
+    }
+
+    @Override
+    public String getMessage() {
+        return message;
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public Object getExt() {
+        return ext;
+    }
+}

+ 141 - 0
common-cloud/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/ListUtils.java

@@ -0,0 +1,141 @@
+/*
+ * 文 件 名:  ListUtils.java
+ * 版    权:  浩鲸云计算科技有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lvwenbin
+ * 修改时间:  2018年09月20日
+ * 修改内容:  <修改内容>
+ */
+package com.ruoyi.common.core.utils;
+
+
+import com.ruoyi.common.core.utils.filter.ObjConverter;
+import com.ruoyi.common.core.utils.filter.ObjectFilter;
+import org.apache.commons.collections4.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * List相关工具 <功能详细描述>
+ *
+ * @author lvwenbin
+ * @version [版本号, 2013年10月31日]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public abstract class ListUtils {
+    /**
+     * 非空过滤
+     */
+    public static final ObjectFilter<Object> NON_NULL = new ObjectFilter<Object>() {
+        @Override
+        public boolean accept(Object object) {
+            return object != null;
+        }
+    };
+
+    /**
+     * 按Filter过滤 <功能详细描述>
+     *
+     * @param source 源List
+     * @param filter 过滤器
+     * @return
+     * @see [类、类#方法、类#成员]
+     */
+    public static <T> List<T> filterList(List<T> source, ObjectFilter<T> filter) {
+        return filterList(source, filter, new ArrayList<T>());
+    }
+
+    /**
+     * 按Filter过滤后融合 <功能详细描述>
+     *
+     * @param source 源List
+     * @param filter 过滤器
+     * @param target 目标list
+     * @return
+     * @see [类、类#方法、类#成员]
+     */
+    public static <T> List<T> filterList(List<T> source, ObjectFilter<T> filter, List<T> target) {
+        if (target == null) {
+            return filterList(source, filter);
+        }
+
+        if (CollectionUtils.isNotEmpty(source)) {
+            if (filter == null) {
+                target.addAll(source);
+            }
+            else {
+                for (T t : source) {
+                    if (!filter.accept(t)) {
+                        continue;
+                    }
+
+                    target.add(t);
+                }
+            }
+        }
+        return target;
+    }
+
+    /**
+     * 从0下标开始截取List <功能详细描述>
+     *
+     * @param source   源list
+     * @param endIndex 结束下标
+     * @return
+     * @see [类、类#方法、类#成员]
+     */
+    public static <T> List<T> subList(List<T> source, int endIndex) {
+        return subList(source, 0, endIndex);
+    }
+
+    /**
+     * 截取List <功能详细描述>
+     *
+     * @param source     源list
+     * @param beginIndex 开始下标
+     * @param endIndex   结束下标
+     * @return
+     * @see [类、类#方法、类#成员]
+     */
+    public static <T> List<T> subList(List<T> source, int beginIndex, int endIndex) {
+        List<T> retList = new ArrayList<T>();
+
+        if (CollectionUtils.isEmpty(source)) {
+            return retList;
+        }
+
+        for (int i = beginIndex; i <= (source.size() - 1); i++) {
+            retList.add(source.get(i));
+
+            if (i == endIndex) {
+                break;
+            }
+        }
+
+        return retList;
+    }
+
+    /**
+     * 对象转换器
+     *
+     * @param sourceList 源列表
+     * @param converter  转换器
+     * @param <S>        源对象类型
+     * @param <T>        目标对象类型
+     * @return 输出列表
+     */
+    public static <S, T> List<T> convert(List<S> sourceList, ObjConverter<S, T> converter) {
+        List<T> targetList = new ArrayList<>();
+
+        if (CollectionUtils.isNotEmpty(sourceList)) {
+            for (S source : sourceList) {
+                T target = converter.convert(source);
+                targetList.add(target);
+            }
+        }
+
+        return targetList;
+    }
+}

+ 30 - 0
common-cloud/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/filter/ObjConverter.java

@@ -0,0 +1,30 @@
+/*
+ * 文 件 名:  ObjConverter
+ * 版    权:  浩鲸云计算科技股份有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  0027008907/lv.wenbin
+ * 修改时间:  2020/8/6
+ * 跟踪单号:  <跟踪单号>
+ * 修改单号:  <修改单号>
+ * 修改内容:  <修改内容>
+ */
+package com.ruoyi.common.core.utils.filter;
+
+/**
+ * 对象转换器
+ * <功能详细描述>
+ *
+ * @author 0027008907/lv.wenbin
+ * @version [版本号, 2020/8/6]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public abstract interface ObjConverter<S, T> {
+    /**
+     * 转换器
+     *
+     * @param source 源对象
+     * @return 输出对象
+     */
+    T convert(S source);
+}

+ 28 - 0
common-cloud/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/filter/ObjectFilter.java

@@ -0,0 +1,28 @@
+/*
+ * 文 件 名:  ObjectFilter.java
+ * 版    权:  浩鲸云计算科技有限公司
+ * 描    述:  <描述>
+ * 修 改 人:  lvwenbin
+ * 修改时间:  2018年9月20日
+ * 修改内容:  <修改内容>
+ */
+package com.ruoyi.common.core.utils.filter;
+
+/**
+ * 对象过滤器 <功能详细描述>
+ *
+ * @author lvwenbin
+ * @version [版本号, 2018年9月20日]
+ * @see [相关类/方法]
+ * @since [产品/模块版本]
+ */
+public abstract interface ObjectFilter<T> {
+    /**
+     * 通过函数 <功能详细描述>
+     *
+     * @param paramT
+     * @return
+     * @see [类、类#方法、类#成员]
+     */
+    boolean accept(T paramT);
+}

+ 1 - 1
ems/.gitignore

@@ -2,7 +2,7 @@
 *.iml
 *.ipr
 *.iws
-.idea/
+.idea/*
 
 # Compiled class file
 *.class

+ 0 - 6
ems/ems-application/ems-admin/pom.xml

@@ -73,12 +73,6 @@
         </dependency>
 
         <dependency>
-            <groupId>com.huashe</groupId>
-            <artifactId>prod-common</artifactId>
-            <version>1.0-SNAPSHOT</version>
-        </dependency>
-
-        <dependency>
             <groupId>com.huashe.ems</groupId>
             <artifactId>ems-core</artifactId>
             <version>1.0-SNAPSHOT</version>

+ 1 - 1
ems/ems-application/ems-admin/src/main/java/com/ruoyi/web/controller/ems/ChargingBillController.java

@@ -20,9 +20,9 @@ package com.ruoyi.web.controller.ems;
  * @since [产品/模块版本]
  */
 
-import com.huashe.citybrain.commons.base.exception.BusinessException;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.exception.BusinessException;
 import com.ruoyi.ems.domain.ChargingBill;
 import com.ruoyi.ems.model.QueryChargingBill;
 import com.ruoyi.ems.service.IChargingBillService;

+ 1 - 1
ems/ems-application/ems-admin/src/main/java/com/ruoyi/web/controller/ems/DeviceController.java

@@ -1,12 +1,12 @@
 package com.ruoyi.web.controller.ems;
 
 
-import com.huashe.citybrain.commons.base.exception.BusinessException;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.exception.BusinessException;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.ems.domain.Area;
 import com.ruoyi.ems.domain.EmsDevice;

+ 1 - 1
ems/ems-application/ems-admin/src/main/java/com/ruoyi/web/controller/ems/EmsObjAttrController.java

@@ -1,12 +1,12 @@
 package com.ruoyi.web.controller.ems;
 
 import com.alibaba.fastjson2.JSONObject;
-import com.huashe.citybrain.commons.base.exception.Assert;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.exception.Assert;
 import com.ruoyi.ems.domain.EmsDevice;
 import com.ruoyi.ems.domain.EmsDeviceComponent;
 import com.ruoyi.ems.domain.EmsFacs;

+ 3 - 3
ems/ems-application/ems-admin/src/main/java/com/ruoyi/web/controller/ems/MeterReadingController.java

@@ -1,12 +1,12 @@
 package com.ruoyi.web.controller.ems;
 
-import com.huashe.citybrain.commons.base.exception.Assert;
-import com.huashe.citybrain.commons.base.exception.BusinessException;
-import com.huashe.citybrain.commons.base.utils.DateUtils;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.exception.Assert;
+import com.ruoyi.common.exception.BusinessException;
+import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.ems.domain.MeterDevice;
 import com.ruoyi.ems.domain.MeterReading;
 import com.ruoyi.ems.model.QueryMeter;

+ 1 - 1
ems/ems-application/ems-admin/src/main/java/com/ruoyi/web/controller/ems/OpEnergyStrategyController.java

@@ -1,12 +1,12 @@
 package com.ruoyi.web.controller.ems;
 
 import com.alibaba.fastjson2.JSONObject;
-import com.huashe.citybrain.commons.base.exception.BusinessException;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.exception.BusinessException;
 import com.ruoyi.ems.domain.OpEnergyStrategy;
 import com.ruoyi.ems.domain.OpEnergyStrategyParam;
 import com.ruoyi.ems.domain.OpEnergyStrategyStep;

+ 0 - 6
ems/ems-application/pom.xml

@@ -221,12 +221,6 @@
                 <artifactId>ruoyi-common</artifactId>
                 <version>${ruoyi.version}</version>
             </dependency>
-
-            <dependency>
-                <groupId>com.huashe.cloud</groupId>
-                <artifactId>prod-common</artifactId>
-                <version>${prod.version}</version>
-            </dependency>
         </dependencies>
     </dependencyManagement>
 

+ 6 - 3
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/EmsApplication.java

@@ -21,9 +21,12 @@ public class EmsApplication {
     public static void main(String[] args) {
         // System.setProperty(GrpcConstants.NACOS_SERVER_GRPC_PORT_OFFSET_KEY,"1");
         SpringApplication.run(EmsApplication.class, args);
-        System.out.println("(♥◠‿◠)ノ゙  能源管理服务启动成功   ლ(´ڡ`ლ)゙  \n" + "  _    _                   _          \n"
-            + " | |  | |                 | |         \n" + " | |__| |_   _  __ _   ___| |__   ___ \n"
-            + " |  __  | | | |/ _` | / __| '_ \\ / _ \\\n" + " | |  | | |_| | (_| | \\__ \\ | | |  __/\n"
+        System.out.println("(♥◠‿◠)ノ゙  能源管理服务启动成功   ლ(´ڡ`ლ)゙  \n"
+            + "  _    _                   _          \n"
+            + " | |  | |                 | |         \n"
+            + " | |__| |_   _  __ _   ___| |__   ___ \n"
+            + " |  __  | | | |/ _` | / __| '_ \\ / _ \\\n"
+            + " | |  | | |_| | (_| | \\__ \\ | | |  __/\n"
             + " |_|  |_|\\__,_|\\__,_| |___/_| |_|\\___|\n");
     }
 }

+ 1 - 1
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/AreaController.java

@@ -54,7 +54,7 @@ public class AreaController extends BaseController {
     /**
      * 查询区域对象列表
      */
-    @RequiresPermissions("ems:area:list")
+    //@RequiresPermissions("ems:area:list")
     @GetMapping("/list")
     public AjaxResult list(Area area) {
         List<Area> list = areaService.selectArea(area);

+ 1 - 1
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/ChargingBillController.java

@@ -20,7 +20,7 @@ package com.ruoyi.ems.controller;
  * @since [产品/模块版本]
  */
 
-import com.huashe.citybrain.commons.base.exception.BusinessException;
+import com.ruoyi.common.core.exception.BusinessException;
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.ems.domain.ChargingBill;

+ 1 - 1
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/DeviceController.java

@@ -1,7 +1,7 @@
 package com.ruoyi.ems.controller;
 
 
-import com.huashe.citybrain.commons.base.exception.BusinessException;
+import com.ruoyi.common.core.exception.BusinessException;
 import com.ruoyi.common.core.utils.poi.ExcelUtil;
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.domain.AjaxResult;

+ 1 - 1
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/EmsObjAttrController.java

@@ -1,7 +1,7 @@
 package com.ruoyi.ems.controller;
 
 import com.alibaba.fastjson2.JSONObject;
-import com.huashe.citybrain.commons.base.exception.Assert;
+import com.ruoyi.common.core.exception.Assert;
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.core.web.page.TableDataInfo;

+ 2 - 2
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/MeterReadingController.java

@@ -1,7 +1,7 @@
 package com.ruoyi.ems.controller;
 
-import com.huashe.citybrain.commons.base.exception.Assert;
-import com.huashe.citybrain.commons.base.exception.BusinessException;
+import com.ruoyi.common.core.exception.Assert;
+import com.ruoyi.common.core.exception.BusinessException;
 import com.ruoyi.common.core.utils.DateUtils;
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.domain.AjaxResult;

+ 1 - 1
ems/ems-cloud/ems-server/src/main/java/com/ruoyi/ems/controller/OpEnergyStrategyController.java

@@ -1,7 +1,7 @@
 package com.ruoyi.ems.controller;
 
 import com.alibaba.fastjson2.JSONObject;
-import com.huashe.citybrain.commons.base.exception.BusinessException;
+import com.ruoyi.common.core.exception.BusinessException;
 import com.ruoyi.common.core.web.controller.BaseController;
 import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.core.web.page.TableDataInfo;

+ 0 - 6
ems/ems-core/pom.xml

@@ -55,12 +55,6 @@
             <artifactId>ruoyi-common-quartz</artifactId>
             <version>${ruoyi.version}</version>
         </dependency>
-
-        <dependency>
-            <groupId>com.huashe</groupId>
-            <artifactId>prod-common</artifactId>
-            <version>1.0-SNAPSHOT</version>
-        </dependency>
     </dependencies>
     <build>
         <plugins>

+ 2 - 1
ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/AreaElectricityAttrServiceImpl.java

@@ -1,7 +1,8 @@
 package com.ruoyi.ems.service.impl;
 
 
-import com.huashe.citybrain.commons.base.exception.Assert;
+
+import com.ruoyi.common.core.exception.Assert;
 import com.ruoyi.ems.domain.Area;
 import com.ruoyi.ems.domain.ElecAttr;
 import com.ruoyi.ems.mapper.ElecAttrMapper;

+ 2 - 1
ems/ems-core/src/main/java/com/ruoyi/ems/service/impl/OpEnergyStrategyParamServiceImpl.java

@@ -1,7 +1,8 @@
 package com.ruoyi.ems.service.impl;
 
 
-import com.huashe.citybrain.commons.base.exception.Assert;
+
+import com.ruoyi.common.core.exception.Assert;
 import com.ruoyi.ems.domain.OpEnergyStrategyParam;
 import com.ruoyi.ems.mapper.OpEnergyStrategyParamMapper;
 import com.ruoyi.ems.service.IOpEnergyStrategyParamService;

+ 13 - 0
ems/sql/ems_init_data.sql

@@ -600,6 +600,7 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-101', '321283124S3001', '2024', '202409', 1464, '2024-08-31', 1797, '2024-09-30', 333, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-101', '321283124S3001', '2024', '202410', 1797, '2024-09-30', 2045, '2024-10-31', 248, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-101', '321283124S3001', '2024', '202411', 2045, '2024-10-31', 2345, '2024-11-30', 300, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-101', '321283124S3001', '2024', '202412', 2345, '2024-11-30', 2570, '2024-12-31', 225, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202401', 0, '2024-02-29', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202402', 100, '2024-02-29', 238, '2024-02-28', 138, NULL, NULL);
@@ -612,6 +613,7 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202409', 1464, '2024-08-31', 1797, '2024-09-30', 333, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202410', 1797, '2024-09-30', 2045, '2024-10-31', 248, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202411', 2045, '2024-10-31', 2345, '2024-11-30', 300, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-102', '321283124S3001', '2024', '202412', 2345, '2024-11-30', 2620, '2024-12-31', 275, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2024', '202401', 0, '2024-02-29', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2024', '202402', 100, '2024-02-29', 250, '2024-02-28', 150, NULL, NULL);
@@ -624,6 +626,7 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2024', '202409', 860, '2024-08-31', 1030, '2024-09-30', 170, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2024', '202410', 1030, '2024-09-30', 1213, '2024-10-31', 183, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2024', '202411', 1213, '2024-10-31', 1413, '2024-11-30', 200, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-103', '321283124S3001', '2024', '202412', 1413, '2024-11-30', 1690, '2024-12-31', 277, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2024', '202401', 0, '2024-02-29', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2024', '202402', 100, '2024-02-29', 200, '2024-02-28', 100, NULL, NULL);
@@ -636,6 +639,7 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2024', '202409', 800, '2024-08-31', 900, '2024-09-30', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2024', '202410', 900, '2024-09-30', 1000, '2024-10-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2024', '202411', 1000, '2024-10-31', 1100, '2024-11-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-104', '321283124S3001', '2024', '202412', 1100, '2024-11-30', 1200, '2024-12-31', 100, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2024', '202401', 0, '2024-02-29', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2024', '202402', 100, '2024-02-29', 200, '2024-02-28', 100, NULL, NULL);
@@ -648,6 +652,7 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2024', '202409', 800, '2024-08-31', 900, '2024-09-30', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2024', '202410', 900, '2024-09-30', 1000, '2024-10-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2024', '202411', 1000, '2024-10-31', 1100, '2024-11-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-105', '321283124S3001', '2024', '202412', 1100, '2024-11-30', 1200, '2024-12-31', 100, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2024', '202401', 0, '2024-02-29', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2024', '202402', 100, '2024-02-29', 200, '2024-02-28', 100, NULL, NULL);
@@ -660,6 +665,7 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2024', '202409', 800, '2024-08-31', 900, '2024-09-30', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2024', '202410', 900, '2024-09-30', 1000, '2024-10-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2024', '202411', 1000, '2024-10-31', 1100, '2024-11-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-106', '321283124S3001', '2024', '202412', 1100, '2024-11-30', 1200, '2024-12-31', 100, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2024', '202401', 0, '2024-02-29', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2024', '202402', 100, '2024-02-29', 200, '2024-02-28', 100, NULL, NULL);
@@ -672,6 +678,7 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2024', '202409', 800, '2024-08-31', 900, '2024-09-30', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2024', '202410', 900, '2024-09-30', 1000, '2024-10-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2024', '202411', 1000, '2024-10-31', 1100, '2024-11-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-107', '321283124S3001', '2024', '202412', 1100, '2024-11-30', 1200, '2024-12-31', 100, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2024', '202401', 0, '2024-02-29', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2024', '202402', 100, '2024-02-29', 200, '2024-02-28', 100, NULL, NULL);
@@ -684,6 +691,7 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2024', '202409', 700, '2024-08-31', 900, '2024-09-30', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2024', '202410', 900, '2024-09-30', 1000, '2024-10-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2024', '202411', 1000, '2024-10-31', 1100, '2024-11-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-108', '321283124S3001', '2024', '202412', 1100, '2024-11-30', 1200, '2024-12-31', 100, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2024', '202401', 0, '2024-02-29', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2024', '202402', 100, '2024-02-29', 200, '2024-02-28', 100, NULL, NULL);
@@ -696,6 +704,7 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2024', '202409', 800, '2024-08-31', 900, '2024-09-30', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2024', '202410', 900, '2024-09-30', 1000, '2024-10-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2024', '202411', 1000, '2024-10-31', 1100, '2024-11-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-109', '321283124S3001', '2024', '202412', 1100, '2024-11-30', 1200, '2024-12-31', 100, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2024', '202401', 0, '2024-02-29', 100, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2024', '202402', 100, '2024-02-29', 200, '2024-02-28', 100, NULL, NULL);
@@ -708,6 +717,7 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2024', '202409', 800, '2024-08-31', 900, '2024-09-30', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2024', '202410', 900, '2024-09-30', 1000, '2024-10-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2024', '202411', 1000, '2024-10-31', 1100, '2024-11-30', 100, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-110', '321283124S3001', '2024', '202412', 1100, '2024-11-30', 1200, '2024-12-31', 100, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202401', 0, '2024-02-29', 1000, '2024-01-31', 100, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202402', 1000, '2024-02-29', 2120, '2024-02-28', 1120, NULL, NULL);
@@ -720,6 +730,7 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202409', 8947, '2024-08-31', 10158, '2024-09-30', 1211, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202410', 10158, '2024-09-30', 11700, '2024-10-31', 1542, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202411', 11700, '2024-10-31', 13520, '2024-11-30', 1820, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z101', '321283124S3001', '2024', '202412', 1100, '2024-11-30', 1200, '2024-12-31', 100, NULL, NULL);
 
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2024', '202401', 0, '2024-02-29', 25, '2024-01-31', 1250, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2024', '202402', 25, '2024-02-29', 73, '2024-02-28', 2400, NULL, NULL);
@@ -732,6 +743,8 @@ INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2024', '202409', 465, '2024-08-31', 612, '2024-09-30', 7350, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2024', '202410', 612, '2024-08-31', 758, '2024-09-30', 7300, NULL, NULL);
 INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2024', '202411', 758, '2024-10-31', 948, '2024-11-30', 9500, NULL, NULL);
+INSERT INTO adm_meter_reading (`device_code`, `area_code`, `year`, `meter_month`, `last_reading`, `last_time`, `meter_reading`, `meter_time`, `increase`, `create_time`, `update_time`) VALUES ('J-D-B-Z120', '321283124S3001', '2024', '202411', 758, '2024-10-31', 948, '2024-11-30', 9500, NULL, NULL);
+
 
 -- 自动抄表数据
 -- 广场照明自动抄表脚本