Browse Source

增加用水量查询

hym 4 years ago
parent
commit
6aab9c93eb

+ 16 - 3
water_query_api/pom.xml

@@ -17,6 +17,9 @@
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
         <java.version>1.8</java.version>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <maven.build.timestamp.format>yyyy-MM-dd_HH_mm</maven.build.timestamp.format>
+
         <!-- 跳过打包检测 -->
         <skipTests>true</skipTests>
     </properties>
@@ -118,16 +121,26 @@
         </dependency>
     </dependencies>
 
+
     <build>
         <plugins>
+            <!--编译插件-->
             <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
                 <configuration>
-                    <fork>true</fork>
+                    <source>8</source>
+                    <target>8</target>
+                    <encoding>utf-8</encoding>
                 </configuration>
             </plugin>
+            <!--打包插件-->
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
         </plugins>
+        <finalName>${project.artifactId}-${maven.build.timestamp}</finalName>
     </build>
 
 </project>

+ 17 - 0
water_query_api/src/main/java/com/zcxk/controller/WaterApiController.java

@@ -149,5 +149,22 @@ public class WaterApiController {
         List<WarningRule>result=warningRuleService.getList(meterNo,customerNo);
         return new AjaxMessage<>(ResultStatus.OK, result);
     }
+    /**
+     * 规则列表
+     *
+     * @param meterNo 水表档案号
+     *
+     * @return Response对象
+     */
+    @RequestMapping(value = "getDeviceVolume", method = RequestMethod.POST)
+    @ApiOperation(value = "用水量")
+    public AjaxMessage< Double> getDeviceVolume(
+            @ApiParam(value = "客户id", required = true) @RequestParam String customerNo,
+            @ApiParam(value = "开始时间", required = true) @RequestParam Integer startDate,
+            @ApiParam(value = "结束时间", required = true) @RequestParam Integer endDate,
+            @ApiParam(value = "水表档案号", required = true)@RequestParam  String meterNo) {
+        Double deviceVolume = meterReadRecordService.getDeviceVolume(meterNo, customerNo, startDate, endDate);
+        return new AjaxMessage<>(ResultStatus.OK, deviceVolume);
+    }
 
 }

+ 1 - 0
water_query_api/src/main/java/com/zcxk/service/MeterReadRecordService.java

@@ -11,4 +11,5 @@ public interface MeterReadRecordService {
     UseWaterAnalyze getThirtyDaysUseWater(String meterNo, String customerNo);
 
     UseWaterAnalyze getUseWaterAnalyze(String meterNo, String customerNo);
+    Double getDeviceVolume(String meterNo, String customerNo, Integer startDate, Integer endDate);
 }

+ 6 - 0
water_query_api/src/main/java/com/zcxk/service/impl/MeterReadRecordServiceImpl.java

@@ -109,4 +109,10 @@ public class MeterReadRecordServiceImpl implements MeterReadRecordService {
         statisticsOnWaterUsage(useWaterAnalyze,list);
         return useWaterAnalyze;
     }
+
+    @Override
+    public Double getDeviceVolume(String meterNo, String customerNo, Integer startDate, Integer endDate) {
+        Long deviceId=warningRuleService.getDeviceId(meterNo,customerNo);
+        return meterReadRecordMapper.getDeviceVolume(deviceId, startDate, endDate);
+    }
 }

+ 55 - 0
water_query_api/src/main/resources/application-sit.properties

@@ -0,0 +1,55 @@
+server.port=8091
+server.servlet.context-path=/api
+logging.file.path=/opt/sit/water-query/logs
+spring.thymeleaf.prefix=classpath:/templates/
+spring.datasource.driver-class-name=com.mysql.jdbc.Driver
+#spring.datasource.url=jdbc:mysql://10.0.0.161:3306/smart_city_sit_6_10?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
+spring.datasource.url=jdbc:mysql://114.135.61.188:33306/smart_city_sit_6_10?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
+#spring.datasource.url=jdbc:mysql://47.112.217.10:3306/smart_city?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
+spring.datasource.username=root
+spring.datasource.password=100Zone@123
+spring.datasource.hikari.max-lifetime=30000
+# mybatis_config
+mybatis.mapper-locations=classpath*:mapper/*.xml
+mybatis.type-aliases-package=com.zcxk.entity
+mybatis.configuration.map-underscore-to-camel-case=true
+mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
+mybatis.configuration.use-column-label=true
+
+spring.jackson.time-zone=GMT+8
+
+
+
+
+spring.servlet.multipart.max-file-size=100MB
+spring.servlet.multipart.max-request-size=100MB
+spring.servlet.multipart.location=e:/test/files
+
+#spring.redis.password=123456
+spring.redis.sentinel.master=mymaster
+spring.redis.sentinel.nodes=10.0.0.71:26379,10.0.0.72:26379,10.0.0.73:26379
+#连接超时时间
+spring.redis.timeout=6000ms
+##Redis数据库索引(默认为0)
+spring.redis.database=0
+## 连接池配置,springboot2.0中直接使用jedis或者lettuce配置连接池,默认为lettuce连接池
+##连接池最大连接数(使用负值表示没有限制)
+spring.redis.jedis.pool.max-active=8
+##连接池最大阻塞等待时间(使用负值表示没有限制)
+spring.redis.jedis.pool.max-wait=-1s
+##连接池中的最大空闲连接
+spring.redis.jedis.pool.max-idle=8
+##接池中的最小空闲连接
+spring.redis.jedis.pool.min-idle=0
+
+
+
+
+
+
+
+
+
+
+
+

+ 23 - 0
water_query_api/src/main/resources/logback-spring.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+    <springProperty scope="context" name="LOG_PATH" source="logging.file.path" defaultValue="/tmp" />
+    <include resource="org/springframework/boot/logging/logback/defaults.xml" />
+    <include resource="org/springframework/boot/logging/logback/console-appender.xml" />
+    <appender name="TIME_FILE"
+              class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <encoder>
+            <pattern>${FILE_LOG_PATTERN}</pattern>
+        </encoder>
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>${LOG_PATH}/water-query-api.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <maxHistory>365</maxHistory>
+            <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+                <maxFileSize>100MB</maxFileSize>
+            </timeBasedFileNamingAndTriggeringPolicy>
+        </rollingPolicy>
+    </appender>
+    <root level="INFO">
+        <appender-ref ref="CONSOLE" />
+        <appender-ref ref="TIME_FILE" />
+    </root>
+</configuration>