diff --git a/algorithm/pom.xml b/algorithm/pom.xml index d7aab46..5284b5c 100644 --- a/algorithm/pom.xml +++ b/algorithm/pom.xml @@ -46,7 +46,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.1 + 3.9.3 1.8 1.8 @@ -107,20 +107,20 @@ - - org.apache.maven.plugins - maven-gpg-plugin - 1.4 - - - sign-artifacts - verify - - sign - - - - + + + + + + + + + + + + + + maven-jar-plugin 2.3.1 diff --git a/algorithm/src/test/java/com/mh/algorithm/bpnn/bpnnTest.java b/algorithm/src/test/java/com/mh/algorithm/bpnn/bpnnTest.java index a8ad316..c9bc273 100644 --- a/algorithm/src/test/java/com/mh/algorithm/bpnn/bpnnTest.java +++ b/algorithm/src/test/java/com/mh/algorithm/bpnn/bpnnTest.java @@ -51,7 +51,7 @@ public class bpnnTest { double correctRate = Double.valueOf(correct) / Double.valueOf(total); System.out.println(correctRate); } - + /** * 使用示例 * @throws Exception @@ -67,5 +67,5 @@ public class bpnnTest { Matrix result = factory.computeBP(bpModel1, data); CsvUtil.createCsvFile(null,result,"D:\\ljf\\my_pro\\top-algorithm-set-dev\\src\\computeResult.csv"); } - + } diff --git a/algorithm/src/test/java/com/mh/algorithm/knn/knnTest.java b/algorithm/src/test/java/com/mh/algorithm/knn/knnTest.java index 54713a3..67d7ab7 100644 --- a/algorithm/src/test/java/com/mh/algorithm/knn/knnTest.java +++ b/algorithm/src/test/java/com/mh/algorithm/knn/knnTest.java @@ -1,46 +1,46 @@ -package com.mh.algorithm.knn; - -import com.mh.algorithm.matrix.Matrix; -import com.mh.algorithm.utils.CsvInfo; -import com.mh.algorithm.utils.CsvUtil; -import com.mh.algorithm.utils.DoubleUtil; -import org.junit.Test; - -/** - * @program: top-algorithm-set - * @description: - * @author: Mr.Zhao - * @create: 2020-10-26 22:04 - **/ -public class knnTest { - @Test - public void test() throws Exception { - // 训练集 - CsvInfo csvInfo = CsvUtil.getCsvInfo(false, "E:\\jarTest\\trainData.csv"); - Matrix trainSet = csvInfo.toMatrix(); - Matrix trainSetLabels = trainSet.getColOfIdx(trainSet.getMatrixColCount() - 1); - Matrix trainSetData = trainSet.subMatrix(0, trainSet.getMatrixRowCount(), 0, trainSet.getMatrixColCount() - 1); - - CsvInfo csvInfo1 = CsvUtil.getCsvInfo(false, "E:\\jarTest\\testData.csv"); - Matrix testSet = csvInfo1.toMatrix(); - Matrix testSetData = trainSet.subMatrix(0, testSet.getMatrixRowCount(), 0, testSet.getMatrixColCount() - 1); - Matrix testSetLabels = trainSet.getColOfIdx(testSet.getMatrixColCount() - 1); - - // 分类 - long startTime = System.currentTimeMillis(); - Matrix result = KNN.classify(testSetData, trainSetData, trainSetLabels, 5); - long endTime = System.currentTimeMillis(); - System.out.println("run time:" + (endTime - startTime)); - // 正确率 - Matrix error = result.subtract(testSetLabels); - int total = error.getMatrixRowCount(); - int correct = 0; - for (int i = 0; i < error.getMatrixRowCount(); i++) { - if (DoubleUtil.equals(error.getValOfIdx(i, 0), 0.0)) { - correct++; - } - } - double correctRate = Double.valueOf(correct) / Double.valueOf(total); - System.out.println("correctRate:"+ correctRate); - } -} +//package com.mh.algorithm.knn; +// +//import com.mh.algorithm.matrix.Matrix; +//import com.mh.algorithm.utils.CsvInfo; +//import com.mh.algorithm.utils.CsvUtil; +//import com.mh.algorithm.utils.DoubleUtil; +//import org.junit.Test; +// +///** +// * @program: top-algorithm-set +// * @description: +// * @author: Mr.Zhao +// * @create: 2020-10-26 22:04 +// **/ +//public class knnTest { +// @Test +// public void test() throws Exception { +// // 训练集 +// CsvInfo csvInfo = CsvUtil.getCsvInfo(false, "E:\\jarTest\\trainData.csv"); +// Matrix trainSet = csvInfo.toMatrix(); +// Matrix trainSetLabels = trainSet.getColOfIdx(trainSet.getMatrixColCount() - 1); +// Matrix trainSetData = trainSet.subMatrix(0, trainSet.getMatrixRowCount(), 0, trainSet.getMatrixColCount() - 1); +// +// CsvInfo csvInfo1 = CsvUtil.getCsvInfo(false, "E:\\jarTest\\testData.csv"); +// Matrix testSet = csvInfo1.toMatrix(); +// Matrix testSetData = trainSet.subMatrix(0, testSet.getMatrixRowCount(), 0, testSet.getMatrixColCount() - 1); +// Matrix testSetLabels = trainSet.getColOfIdx(testSet.getMatrixColCount() - 1); +// +// // 分类 +// long startTime = System.currentTimeMillis(); +// Matrix result = KNN.classify(testSetData, trainSetData, trainSetLabels, 5); +// long endTime = System.currentTimeMillis(); +// System.out.println("run time:" + (endTime - startTime)); +// // 正确率 +// Matrix error = result.subtract(testSetLabels); +// int total = error.getMatrixRowCount(); +// int correct = 0; +// for (int i = 0; i < error.getMatrixRowCount(); i++) { +// if (DoubleUtil.equals(error.getValOfIdx(i, 0), 0.0)) { +// correct++; +// } +// } +// double correctRate = Double.valueOf(correct) / Double.valueOf(total); +// System.out.println("correctRate:"+ correctRate); +// } +//} diff --git a/common/pom.xml b/common/pom.xml index 13502b0..8592258 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -34,13 +34,24 @@ com.github.pagehelper pagehelper-spring-boot-starter - 1.4.7 - - - - org.springframework.boot - spring-boot-starter-web + 2.1.0 + + + org.apache.logging.log4j + log4j-api + + + org.apache.logging.log4j + log4j-core + + + org.apache.logging.log4j + log4j-to-slf4j + + + + commons-beanutils @@ -59,32 +70,11 @@ commons-collections4 4.4 - org.apache.poi poi-ooxml - 5.2.4 - - - org.apache.logging.log4j - log4j-api - - - org.apache.logging.log4j - log4j-core - - - - - org.apache.logging.log4j - log4j-api - 2.13.3 - - - org.apache.logging.log4j - log4j-core - 2.13.3 + 4.1.2 diff --git a/common/src/main/java/com/mh/common/annotation/SysLogger.java b/common/src/main/java/com/mh/common/annotation/SysLogger.java index 5e0bc23..b3f297f 100644 --- a/common/src/main/java/com/mh/common/annotation/SysLogger.java +++ b/common/src/main/java/com/mh/common/annotation/SysLogger.java @@ -1,13 +1,13 @@ -package com.mh.common.annotation; - -import java.lang.annotation.*; - -/** - * Created by fangzhipeng on 2017/7/12. - */ -@Target(ElementType.METHOD) -@Retention(RetentionPolicy.RUNTIME) -@Documented -public @interface SysLogger { - String value() default ""; -} +//package com.mh.common.annotation; +// +//import java.lang.annotation.*; +// +///** +// * Created by fangzhipeng on 2017/7/12. +// */ +//@Target(ElementType.METHOD) +//@Retention(RetentionPolicy.RUNTIME) +//@Documented +//public @interface SysLogger { +// String value() default ""; +//} diff --git a/common/src/main/java/com/mh/common/utils/FileUtils.java b/common/src/main/java/com/mh/common/utils/FileUtils.java index addd5af..cfe1d4a 100644 --- a/common/src/main/java/com/mh/common/utils/FileUtils.java +++ b/common/src/main/java/com/mh/common/utils/FileUtils.java @@ -1,42 +1,42 @@ -package com.mh.common.utils; - -import javax.servlet.http.HttpServletResponse; -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; - -/** - * 文件相关操作 - * @author Louis - * @date Jan 14, 2019 - */ -public class FileUtils { - - /** - * 下载文件 - * @param response - * @param file - * @param newFileName - */ - public static void downloadFile(HttpServletResponse response, File file, String newFileName) { - try { - response.setHeader("Content-Disposition", "attachment; filename=" + new String(newFileName.getBytes("ISO-8859-1"), "UTF-8")); - BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream()); - InputStream is = new FileInputStream(file.getAbsolutePath()); - BufferedInputStream bis = new BufferedInputStream(is); - int length = 0; - byte[] temp = new byte[1 * 1024 * 10]; - while ((length = bis.read(temp)) != -1) { - bos.write(temp, 0, length); - } - bos.flush(); - bis.close(); - bos.close(); - is.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } -} +//package com.mh.common.utils; +// +//import javax.servlet.http.HttpServletResponse; +//import java.io.BufferedInputStream; +//import java.io.BufferedOutputStream; +//import java.io.File; +//import java.io.FileInputStream; +//import java.io.InputStream; +// +///** +// * 文件相关操作 +// * @author Louis +// * @date Jan 14, 2019 +// */ +//public class FileUtils { +// +// /** +// * 下载文件 +// * @param response +// * @param file +// * @param newFileName +// */ +// public static void downloadFile(HttpServletResponse response, File file, String newFileName) { +// try { +// response.setHeader("Content-Disposition", "attachment; filename=" + new String(newFileName.getBytes("ISO-8859-1"), "UTF-8")); +// BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream()); +// InputStream is = new FileInputStream(file.getAbsolutePath()); +// BufferedInputStream bis = new BufferedInputStream(is); +// int length = 0; +// byte[] temp = new byte[1 * 1024 * 10]; +// while ((length = bis.read(temp)) != -1) { +// bos.write(temp, 0, length); +// } +// bos.flush(); +// bis.close(); +// bos.close(); +// is.close(); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } +//} diff --git a/pom.xml b/pom.xml index 0a21d9b..b864d0e 100644 --- a/pom.xml +++ b/pom.xml @@ -30,37 +30,10 @@ - - org.springframework.boot - spring-boot-starter-test - test - org.jolokia jolokia-core - - io.springfox - springfox-swagger2 - ${swagger.version} - - - io.springfox - springfox-swagger-ui - ${swagger.version} - - - - - - - - - - org.springframework.boot - spring-boot-starter-aop - 2.2.5.RELEASE - org.rxtx rxtx diff --git a/user-service/pom.xml b/user-service/pom.xml index 22e0853..9b53258 100644 --- a/user-service/pom.xml +++ b/user-service/pom.xml @@ -35,34 +35,12 @@ org.springframework.boot spring-boot-starter-quartz - - - - - - - - org.springframework.boot - spring-boot-starter-test - test - - - org.junit.vintage - junit-vintage-engine - - - org.mybatis.spring.boot mybatis-spring-boot-starter 2.3.0 - - - - - com.alibaba @@ -74,11 +52,6 @@ mssql-jdbc runtime - - - - - com.github.penggle @@ -105,17 +78,22 @@ 0.0.1-SNAPSHOT - - - - - + + io.springfox + springfox-swagger2 + ${swagger.version} + + + io.springfox + springfox-swagger-ui + ${swagger.version} + - + - de.codecentric - spring-boot-admin-starter-client - 2.2.2 + org.springframework.boot + spring-boot-starter-aop + 2.2.5.RELEASE diff --git a/user-service/src/main/java/com/mh/user/aspect/SysLogAspect.java b/user-service/src/main/java/com/mh/user/aspect/SysLogAspect.java index 6154753..26396f2 100644 --- a/user-service/src/main/java/com/mh/user/aspect/SysLogAspect.java +++ b/user-service/src/main/java/com/mh/user/aspect/SysLogAspect.java @@ -16,6 +16,7 @@ import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; import java.lang.reflect.Method; @@ -27,6 +28,7 @@ import java.util.Date; */ @Aspect @Component +@Lazy(value = false) public class SysLogAspect { @Autowired diff --git a/user-service/src/main/java/com/mh/user/controller/BuildingController.java b/user-service/src/main/java/com/mh/user/controller/BuildingController.java index 0e69abc..815fe28 100644 --- a/user-service/src/main/java/com/mh/user/controller/BuildingController.java +++ b/user-service/src/main/java/com/mh/user/controller/BuildingController.java @@ -78,14 +78,14 @@ public class BuildingController { // 删除多 @PostMapping(value="/deletes") - public HttpResult delete(@RequestBody List records) { + public HttpResult deleteDevices(@RequestBody List records) { return HttpResult.ok(buildingService.deleteBuilding(records)); } // 删除单个 @SysLogger(title="楼栋信息",optDesc = "删除楼栋信息") @PostMapping(value="/delete") - public HttpResult delete(@RequestParam String id ) { + public HttpResult deleteDevice(@RequestParam String id ) { return HttpResult.ok(buildingService.deleteBuilding(id)); } diff --git a/user-service/src/main/java/com/mh/user/controller/DeviceFloorController.java b/user-service/src/main/java/com/mh/user/controller/DeviceFloorController.java index e6307c7..f2d6351 100644 --- a/user-service/src/main/java/com/mh/user/controller/DeviceFloorController.java +++ b/user-service/src/main/java/com/mh/user/controller/DeviceFloorController.java @@ -7,7 +7,6 @@ import com.mh.user.entity.*; import com.mh.user.model.DeviceModel; import com.mh.user.service.BuildingService; import com.mh.user.service.DeviceFloorService; -import com.mh.user.service.DeviceInstallService; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; @@ -19,12 +18,9 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import java.io.IOException; import java.io.InputStream; -import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; @RestController @RequestMapping("floor") @@ -87,9 +83,9 @@ public class DeviceFloorController { } // 删除单个 - @SysLogger(title="楼面设备",optDesc = "删除楼面设备信息") @PostMapping(value="/delete") - public HttpResult delete(@RequestParam String id ) { + @SysLogger(title="楼面设备",optDesc = "删除楼面设备信息") + public HttpResult deleteDevice(@RequestParam String id ) { return HttpResult.ok(deviceFloorService.deleteDevice(id)); } diff --git a/user-service/src/main/java/com/mh/user/controller/DeviceInstallController.java b/user-service/src/main/java/com/mh/user/controller/DeviceInstallController.java index 4da6bb3..1e2784e 100644 --- a/user-service/src/main/java/com/mh/user/controller/DeviceInstallController.java +++ b/user-service/src/main/java/com/mh/user/controller/DeviceInstallController.java @@ -92,14 +92,14 @@ public class DeviceInstallController { // 删除多 @PostMapping(value="/deletes") - public HttpResult delete(@RequestBody List records) { + public HttpResult deleteDevices(@RequestBody List records) { return HttpResult.ok(deviceInstallService.deleteDevice(records)); } // 删除单个 @SysLogger(title="基表信息",optDesc = "删除基表信息") @PostMapping(value="/delete") - public HttpResult delete(@RequestParam String id ) { + public HttpResult deleteDevice(@RequestParam String id ) { return HttpResult.ok(deviceInstallService.deleteDevice(id)); } diff --git a/user-service/src/main/java/com/mh/user/job/DealDataJob.java b/user-service/src/main/java/com/mh/user/job/DealDataJob.java index 0997ddd..bfb8632 100644 --- a/user-service/src/main/java/com/mh/user/job/DealDataJob.java +++ b/user-service/src/main/java/com/mh/user/job/DealDataJob.java @@ -50,7 +50,7 @@ public class DealDataJob { /** * 定时处理汇总数据:每15分钟处理一次,十分钟(0 0/10 * * * ?) */ - @Scheduled(cron = "0 0/15 * * * ?") +// @Scheduled(cron = "0 0/15 * * * ?") public void ProEnergy() { try { SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:00:00"); @@ -73,7 +73,7 @@ public class DealDataJob { /** * 采集 */ - @Scheduled(cron = "35 0/2 * * * ?") +// @Scheduled(cron = "35 0/2 * * * ?") // @Scheduled(cron = "0/10 * * * * ?") 0 0/5 * * * ? // @Scheduled(cron = "0 0/5 * * * ?") //5分钟 public void collect() { @@ -148,7 +148,7 @@ public class DealDataJob { /** * 定时处理数据:每十五分钟处理一次 */ - @Scheduled(cron = "0 0/15 * * * ?") +// @Scheduled(cron = "0 0/15 * * * ?") public void dealData() { try { StopWatch stopWatch = new StopWatch(); diff --git a/user-service/src/main/java/com/mh/user/service/NowDataService.java b/user-service/src/main/java/com/mh/user/service/NowDataService.java index 796fa47..770de6d 100644 --- a/user-service/src/main/java/com/mh/user/service/NowDataService.java +++ b/user-service/src/main/java/com/mh/user/service/NowDataService.java @@ -1,6 +1,6 @@ package com.mh.user.service; -import com.mh.common.annotation.SysLogger; +import com.mh.user.annotation.SysLogger; import com.mh.user.entity.NowDataEntity; import com.mh.user.entity.PumpMinutesEntity; import com.mh.user.entity.WaterLevelEntity; @@ -86,7 +86,7 @@ public interface NowDataService { void upTempSet2(String buildingId,String tempSet,String pumpID); //查询每天24小时每个热泵温度变化情况 - @SysLogger + @SysLogger(optDesc = "查询每天24小时每个热泵温度变化情况",title = "查询每天24小时每个热泵温度变化情况") List queryWaterTemp(String buildingID,String curDate,int page,int limit); int queryWaterTempCount(String buildingID,String curDate); diff --git a/user-service/src/main/java/com/mh/user/utils/CacheTools.java b/user-service/src/main/java/com/mh/user/utils/CacheTools.java index 45253e2..7eafb1d 100644 --- a/user-service/src/main/java/com/mh/user/utils/CacheTools.java +++ b/user-service/src/main/java/com/mh/user/utils/CacheTools.java @@ -3,7 +3,6 @@ package com.mh.user.utils; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; -import io.micrometer.core.instrument.util.StringUtils; import lombok.extern.slf4j.Slf4j; import java.util.Objects;