| | |
| | | return new ApplicationRunner() { |
| | | @Override |
| | | public void run(ApplicationArguments args) throws Exception { |
| | | // taskController.run(); |
| | | taskController.run(); |
| | | } |
| | | }; |
| | | } |
| | |
| | | dustSiteStatusRep.select(listOf(DeviceStatus.ONLINE, DeviceStatus.STOP)).forEach { s -> |
| | | s?.let { |
| | | taskMonthly?.roundInit(s.mnCode, date) |
| | | val riskValueList = riskValueRep.select(s.mnCode, date) |
| | | val riskValueList = riskValueRep.select(s.mnCode, date, "day") |
| | | taskMonthly?.roundCal(riskValueList) |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | import com.flightfeather.monitor.domain.ds1.entity.RiskValue; |
| | | import com.flightfeather.monitor.pojo.AnalysisData; |
| | | import com.flightfeather.monitor.pojo.Result; |
| | | import com.flightfeather.monitor.service.AnalysisDataService; |
| | | import com.flightfeather.monitor.service.RiskAnalysisService; |
| | | import com.flightfeather.monitor.service.RiskValueService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.CrossOrigin; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | @CrossOrigin |
| | | public class RiskValueController { |
| | | @Autowired |
| | | private RiskAnalysisService riskAnalysisService; |
| | | private RiskValueService riskValueService; |
| | | |
| | | |
| | | /*æ ¹æ®ç«ç¹ååï¼å¯éå¼ï¼ï¼æä»½ï¼ç±»åæ¥è¿åé£é©å¼*/ |
| | | /** |
| | | * æ ¹æ®ç«ç¹ååï¼å¯éå¼ï¼ï¼æä»½ï¼ç±»åæ¥è¿åé£é©å¼ |
| | | * |
| | | * @param mnCode |
| | | * @param month |
| | | * @param type |
| | | * @return |
| | | */ |
| | | @GetMapping("/month") |
| | | public Result queryRiskDataByMonth(String siteName,String month,String type){ |
| | | List<RiskValue> list =riskAnalysisService.queryRiskDataByMonth(siteName,month,type); |
| | | public Result queryRiskDataByMonth( |
| | | @RequestParam String mnCode, |
| | | @RequestParam String month, |
| | | @RequestParam String type |
| | | ) { |
| | | List<RiskValue> list = riskValueService.queryRiskDataByMonth(mnCode, month, type); |
| | | return Result.success(list); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æå
¥å表 |
| | | * @param list |
| | | */ |
| | | fun insert(list: List<RiskValue>): Int { |
| | | return riskValueMapper.insertList(list) |
| | | } |
| | | |
| | | fun select(mnCode: String, date: LocalDate): List<RiskValue?> { |
| | | /** |
| | | * æ¥è¯¢ |
| | | * @param mnCode |
| | | * @param date |
| | | * @param type |
| | | */ |
| | | fun select(mnCode: String, date: LocalDate, type: String): List<RiskValue?> { |
| | | val s = date.withDayOfMonth(1).atStartOfDay() |
| | | val e = s.plusMonths(1).minusSeconds(1) |
| | | return riskValueMapper.selectByExample(Example(RiskValue::class.java).apply { |
| | | createCriteria().andEqualTo("mnCode", mnCode) |
| | | .andBetween("lst", s, e) |
| | | .andEqualTo("type", type) |
| | | }) |
| | | } |
| | | } |
| | |
| | | public static Result success(){ |
| | | return new Result(1,"success",null); |
| | | } |
| | | |
| | | //æ¥è¯¢ æåååº |
| | | public static Result success(Object data){ |
| | | return new Result(1,"success",data); |
| | | } |
| | | |
| | | //失败ååº |
| | | public static Result error(String msg){ |
| | | return new Result(0,msg,null); |
| | |
| | | taskDelay = isTaskDelay(localtime) |
| | | if (!taskDelay) { |
| | | log.info("æ¥é£é©åææ§è¡") |
| | | riskAnalysisController.init() |
| | | riskAnalysisController.autoRunDaily() |
| | | } |
| | | } |
| | |
| | | taskDelay = isTaskDelay(localtime) |
| | | if (!taskDelay) { |
| | | log.info("æé£é©åææ§è¡") |
| | | riskAnalysisController.init() |
| | | riskAnalysisController.autoRunMonthly() |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.monitor.service; |
| | | |
| | | import com.flightfeather.monitor.domain.ds1.entity.RiskValue; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface RiskValueService { |
| | | /** |
| | | * æ ¹æ®ç«ç¹ååï¼å¯éå¼ï¼ï¼æä»½ï¼ç±»åæ¥è¿åé£é©å¼ |
| | | * @param mnCode |
| | | * @param month |
| | | * @param type |
| | | * @return |
| | | */ |
| | | List<RiskValue> queryRiskDataByMonth(String mnCode, String month, String type); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.monitor.service.impl; |
| | | |
| | | import com.flightfeather.monitor.domain.ds1.entity.RiskValue; |
| | | import com.flightfeather.monitor.domain.ds1.mapper.RiskValueMapper; |
| | | import com.flightfeather.monitor.domain.ds1.repository.RiskValueRep; |
| | | import com.flightfeather.monitor.mapper.RiskAnalysisMapper; |
| | | import com.flightfeather.monitor.service.RiskValueService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class RiskValueServiceImpl implements RiskValueService { |
| | | @Autowired |
| | | private RiskValueMapper riskValueMapper; |
| | | @Autowired |
| | | private RiskValueRep riskValueRep; |
| | | |
| | | @Override |
| | | public List<RiskValue> queryRiskDataByMonth(String mnCode, String month, String type) { |
| | | LocalDate date = LocalDate.parse(month); |
| | | if (date != null) { |
| | | return riskValueRep.select(mnCode, date, type); |
| | | } else { |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | | } |
| | |
| | | return uid.toString() |
| | | } |
| | | |
| | | private fun toHex(value: Int, length: Int): String { |
| | | var value = value |
| | | private fun toHex(v: Int, length: Int): String { |
| | | var value = v |
| | | val hexDigits = charArrayOf('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F') |
| | | val buffer = StringBuffer(length) |
| | | val shift = length - 1 shl 2 |
| | |
| | | datasource: |
| | | ds1: |
| | | 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 |
| | | |
| | | # url: jdbc:mysql://localhost:3306/fume |
| | | # username: root |
| | |
| | | package com.flightfeather.monitor.analysis.dust |
| | | |
| | | import com.flightfeather.monitor.utils.DateUtil |
| | | import org.junit.Test |
| | | import org.junit.jupiter.api.extension.ExtendWith |
| | | import org.junit.runner.RunWith |
| | |
| | | import org.springframework.boot.test.context.SpringBootTest |
| | | import org.springframework.test.context.junit.jupiter.SpringExtension |
| | | import org.springframework.test.context.junit4.SpringRunner |
| | | import java.time.LocalDate |
| | | |
| | | @RunWith(SpringRunner::class) |
| | | @ExtendWith(SpringExtension::class) |