| | |
| | | package com.job.zsc.controller; |
| | | |
| | | |
| | | import com.job.zsc.pojo.AnalysisDustData; |
| | | import com.job.zsc.pojo.DustSiteData; |
| | | import com.job.zsc.pojo.PageBean; |
| | | import com.job.zsc.pojo.Result; |
| | | import com.job.zsc.pojo.*; |
| | | import com.job.zsc.service.FugitiveDustService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | List<AnalysisDustData> list = fugitiveDustService.analysisdata(siteName,beginTime,endTime); |
| | | return Result.success(list); |
| | | } |
| | | |
| | | // æ ¹æ®ç«ç¹åååæ¶æ®µè¿è¡ç»è®¡åæ å端å页 |
| | | @GetMapping("/analysistime") |
| | | public Result analysisByTime( @RequestParam(defaultValue = "1") Integer page, |
| | | @RequestParam(defaultValue = "20")Integer pageSize,String siteName,String beginTime, String endTime){ |
| | | PageBean pageBean = fugitiveDustService.pageAnalysisTime(page,pageSize,siteName,beginTime,endTime); |
| | | return Result.success(pageBean); |
| | | } |
| | | |
| | | @GetMapping("/exceptiontype") |
| | | public Result getExceptionType( ){ |
| | | List<DustExceptionType> list = fugitiveDustService.getExceptionType(); |
| | | return Result.success(list); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | package com.job.zsc.mapper; |
| | | |
| | | import com.job.zsc.pojo.AnalysisDustData; |
| | | import com.job.zsc.pojo.DustExceptionType; |
| | | import com.job.zsc.pojo.DustSiteData; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | List<DustSiteData> allSiteName(); |
| | | |
| | | List<AnalysisDustData> analysisdata( String siteName,String beginTime, String endTime); |
| | | |
| | | List<AnalysisDustData> analysisByTime(String siteName, String beginTime, String endTime); |
| | | |
| | | @Select("select DISTINCT exception,exception_type from dust_exception_data") |
| | | List<DustExceptionType> getExceptionType(); |
| | | } |
| | |
| | | public class AnalysisDustData { |
| | | |
| | | private String mnCode; |
| | | private String name; |
| | | |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private LocalDate lst; |
| | |
| | | private String dayOnline; |
| | | private String dayValid; |
| | | private String dayExceeding; |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.job.zsc.pojo; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | //æ¬å°çå¼å¸¸ç±»åå®ä½ç±» |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class DustExceptionType { |
| | | private String exception; |
| | | private String exception_type; |
| | | |
| | | } |
| | |
| | | |
| | | private String mvStatCode; //设å¤ç¼å· |
| | | private String diName; //åºéºåç§° |
| | | private String diSupplier; //ä¾åºå |
| | | |
| | | // @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | // private LocalDateTime mvCreateTime; //䏿¥æ¶é´ |
| | |
| | | package com.job.zsc.service; |
| | | |
| | | import com.job.zsc.pojo.AnalysisDustData; |
| | | import com.job.zsc.pojo.DustExceptionType; |
| | | import com.job.zsc.pojo.DustSiteData; |
| | | import com.job.zsc.pojo.PageBean; |
| | | |
| | |
| | | List<DustSiteData> allSiteName(); |
| | | |
| | | List<AnalysisDustData> analysisdata( String siteName,String beginTime, String endTime); |
| | | |
| | | List<AnalysisDustData> analysisByTime(String siteName, String beginTime, String endTime); |
| | | |
| | | PageBean pageAnalysisTime(Integer page, Integer pageSize, String siteName, String beginTime, String endTime); |
| | | |
| | | List<DustExceptionType> getExceptionType(); |
| | | } |
| | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.job.zsc.mapper.FugitiveDustMapper; |
| | | import com.job.zsc.pojo.AnalysisDustData; |
| | | import com.job.zsc.pojo.DustExceptionType; |
| | | import com.job.zsc.pojo.DustSiteData; |
| | | import com.job.zsc.pojo.PageBean; |
| | | import com.job.zsc.service.FugitiveDustService; |
| | |
| | | List<AnalysisDustData> list = fugitiveDustMapper.analysisdata(siteName,beginTime,endTime); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<AnalysisDustData> analysisByTime(String siteName, String beginTime, String endTime) { |
| | | List<AnalysisDustData> list = fugitiveDustMapper.analysisByTime(siteName,beginTime,endTime); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public PageBean pageAnalysisTime(Integer page, Integer pageSize, String siteName, String beginTime, String endTime) { |
| | | //设置å页忰 |
| | | PageHelper.startPage(page,pageSize); |
| | | //æ§è¡æ¥è¯¢ |
| | | List<AnalysisDustData> infoList=fugitiveDustMapper.analysisByTime(siteName,beginTime,endTime); |
| | | //è·åæ¥è¯¢ç»æ |
| | | Page<AnalysisDustData> p=(Page<AnalysisDustData>)infoList; |
| | | |
| | | //å°è£
PageBean对象*/ |
| | | PageBean pageBean=new PageBean(p.getTotal(),p.getResult()); |
| | | return pageBean; |
| | | } |
| | | |
| | | @Override |
| | | public List<DustExceptionType> getExceptionType() { |
| | | List<DustExceptionType> list = fugitiveDustMapper.getExceptionType(); |
| | | return list; |
| | | } |
| | | } |
| | |
| | | spring: |
| | | datasource: |
| | | driver-class-name: com.mysql.cj.jdbc.Driver |
| | | url: jdbc:mysql://localhost:3306/fume |
| | | username: fume |
| | | password: fume_feiyu2023 |
| | | # url: jdbc:mysql://localhost:3306/fume |
| | | # username: fume |
| | | # password: fume_feiyu2023 |
| | | |
| | | # url: jdbc:mysql://localhost:3306/qianduan_sql |
| | | # username: root |
| | | # password: 1234 |
| | | url: jdbc:mysql://localhost:3306/qianduan_sql |
| | | username: root |
| | | password: 1234 |
| | | |
| | | mybatis: |
| | | configuration: |
| | |
| | | |
| | | <!--åææ°æ®--> |
| | | <select id="analysisdata" resultType="com.job.zsc.pojo.AnalysisDustData"> |
| | | select a.* from avg_dust_value as a join ja_t_dust_site_info as b on a.mn_code = b. mn_code |
| | | select a.* from dust_statistics_value as a join ja_t_dust_site_info as b on a.mn_code = b. mn_code |
| | | <where> |
| | | <if test="siteName !=null and siteName != ''"> |
| | | b.name = #{siteName} |
| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | |
| | | <!-- æ ¹æ®ç«ç¹åååæ¶æ®µè¿è¡ç»è®¡åæ--> |
| | | <!-- <select id="analysisByTime" resultType="com.job.zsc.pojo.AnalysisDustData">--> |
| | | <!-- select--> |
| | | <!-- a.mn_code as mn_code,--> |
| | | <!-- DATE(a.lst) as lst,--> |
| | | <!-- ROUND(AVG(a.dust_value),3) as day_avg,--> |
| | | <!-- CONCAT(ROUND(COUNT(*)/96*100, 2), '%') as day_online,--> |
| | | <!-- CONCAT(ROUND(SUM(CASE WHEN a.dust_value >0 THEN 1 ELSE 0 END)/COUNT(*) *100, 2), '%') as day_valid,--> |
| | | <!-- CONCAT(ROUND(SUM(CASE WHEN a.dust_value >= 1 THEN 1 ELSE 0 END)/96*100,2),'%') as day_exceeding--> |
| | | <!-- from ja_t_dust_site_data_info as a join ja_t_dust_site_info as b on a.mn_code = b.mn_code--> |
| | | <!-- <where>--> |
| | | <!-- <if test="siteName !=null and siteName != ''">--> |
| | | <!-- b.name = #{siteName}--> |
| | | <!-- </if>--> |
| | | |
| | | <!-- <if test="beginTime != null and endTime != null">--> |
| | | <!-- and a.lst between #{beginTime} and #{endTime}--> |
| | | <!-- </if>--> |
| | | <!-- </where>--> |
| | | <!-- group by a.mn_code,DATE(a.lst)--> |
| | | <!-- order by lst asc--> |
| | | <!-- </select>--> |
| | | <!-- æ ¹æ®ç«ç¹åååæ¶æ®µè¿è¡ç»è®¡åæ--> |
| | | <select id="analysisByTime" resultType="com.job.zsc.pojo.AnalysisDustData"> |
| | | select c.name,d.* |
| | | from ja_t_dust_site_info as c join |
| | | (select |
| | | a.mn_code as mn_code, |
| | | DATE(a.lst) as lst, |
| | | ROUND(AVG(a.dust_value),3) as day_avg, |
| | | CONCAT(ROUND(COUNT(*)/96*100, 2), '%') as day_online, |
| | | CONCAT(ROUND(SUM(CASE WHEN a.dust_value >0 THEN 1 ELSE 0 END)/COUNT(*) *100, 2), '%') as day_valid, |
| | | CONCAT(ROUND(SUM(CASE WHEN a.dust_value >= 1 THEN 1 ELSE 0 END)/96*100,2),'%') as day_exceeding |
| | | from ja_t_dust_site_data_info as a join ja_t_dust_site_info as b on a.mn_code = b.mn_code |
| | | <where> |
| | | <if test="siteName !=null and siteName != ''"> |
| | | b.name = #{siteName} |
| | | </if> |
| | | |
| | | <if test="beginTime != null and endTime != null"> |
| | | and a.lst between #{beginTime} and #{endTime} |
| | | </if> |
| | | </where> |
| | | GROUP BY a.mn_code,DATE(a.lst) |
| | | order by lst asc ) as d on c.mn_code = d.mn_code |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | <!-- å¤éåºéºå è¿åå¤éåºéºææ°ä¸æ¡æ°æ®--> |
| | | <select id="findLaststById" resultType="com.job.zsc.pojo.FumeHistoryData"> |
| | | SELECT a.MV_Stat_Code, b.DI_Name, a.MV_Data_Time,a.MV_Fan_Electricity,a.MV_Purifier_Electricity,a.MV_Fume_Concentration2 |
| | | SELECT a.MV_Stat_Code, b.DI_Name, b.DI_Supplier, a.MV_Data_Time,a.MV_Fan_Electricity,a.MV_Purifier_Electricity,a.MV_Fume_Concentration2 |
| | | FROM fd_t_minutevalue as a |
| | | JOIN ea_t_device_info as b ON a.MV_Stat_Code = b.DI_Code |
| | | JOIN ( |