SaticScheduleCALTask.java 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. package com.gyee.generation.task;
  2. import com.gyee.generation.service.AnalysisNewService;
  3. import com.gyee.generation.service.Irradiationinput.IrradiationinputService;
  4. import com.gyee.generation.service.PVSystemEfficiencyCalculator;
  5. import com.gyee.generation.service.StationPower.StationPowerService;
  6. import com.gyee.generation.service.realtimelibrary.*;
  7. import com.xxl.job.core.context.XxlJobHelper;
  8. import com.xxl.job.core.handler.annotation.XxlJob;
  9. import org.slf4j.Logger;
  10. import org.slf4j.LoggerFactory;
  11. import org.springframework.stereotype.Component;
  12. import javax.annotation.Resource;
  13. /**
  14. * @ClassName : SaticScheduleTask
  15. * @Description : 调度
  16. */
  17. @Component
  18. public class SaticScheduleCALTask {
  19. private static Logger logger = LoggerFactory.getLogger(SaticScheduleCALTask.class);
  20. @Resource
  21. private AccessStatusService accessStatusService;
  22. @Resource
  23. private CalculationService calculationService;
  24. @Resource
  25. private CycleCalculationService cycleCalculationService;
  26. @Resource
  27. private ElectricityMeteringService electricityMeteringService;
  28. @Resource
  29. private RealtimeService realtimeService;
  30. @Resource
  31. private StatusService statusService;
  32. @Resource
  33. private TheoreticalPowerService theoreticalPowerService;
  34. @Resource
  35. private RegionCalreService regionCalreService;
  36. @Resource
  37. private RegionCalService regionCalService;
  38. @Resource
  39. private SafetyDayService safetyDayService;
  40. @Resource
  41. private StationPowerService powerService;
  42. @Resource
  43. private AnalysisNewService analysisNewService;
  44. @Resource
  45. private PVSystemEfficiencyCalculator calculator;
  46. @Resource
  47. private IrradiationinputService irradiationinputService;
  48. /**
  49. * 全场状态,接入状态,总预测功率
  50. * 每秒执行一次
  51. */
  52. @XxlJob("accessStatus_CAL")
  53. public void accessStatus_CAL() {
  54. XxlJobHelper.log("全场状态调度程序执行开始!........");
  55. try {
  56. //场站接入状态,总预测功率
  57. accessStatusService.accessStatus();
  58. //全场状态
  59. accessStatusService.fullFieldState();
  60. } catch (Exception e) {
  61. e.printStackTrace();
  62. }
  63. XxlJobHelper.log("全场状态调度任务处理完成!........");
  64. }
  65. /**
  66. * 后新增计算指标 节约煤,水,二氧化碳,二氧化硫,月利用小时,年利用小时,设备可利用率,等效可用系数,风能利用率
  67. * 每15分钟执行一次
  68. */
  69. @XxlJob("calculation_CAL")
  70. public void calculation_CAL() {
  71. XxlJobHelper.log("计算指标调度程序执行开始!........");
  72. try {
  73. calculationService.calWp();
  74. } catch (Exception e) {
  75. e.printStackTrace();
  76. }
  77. XxlJobHelper.log("计算指标调度任务处理完成!........");
  78. }
  79. /**
  80. * 日,月,年,15分钟计算指标
  81. * 每15分钟执行一次
  82. */
  83. @XxlJob("cycleCalculation_CAL")
  84. public void cycleCalculation_CAL() {
  85. XxlJobHelper.log("日月年计算指标调度程序执行开始!........");
  86. try {
  87. cycleCalculationService.saveCyle();
  88. } catch (Exception e) {
  89. e.printStackTrace();
  90. }
  91. XxlJobHelper.log("日月年计算指标调度任务处理完成!........");
  92. }
  93. /**
  94. * 日,月,年,15分钟计算指标
  95. * 每15分钟执行一次
  96. */
  97. @XxlJob("cycleCalculation_All_CAL")
  98. public void cycleCalculation_All_CAL() {
  99. XxlJobHelper.log("日月年计算指标调度程序执行开始!........");
  100. try {
  101. while(true)
  102. {
  103. cycleCalculationService.saveCyle();
  104. Thread.sleep(200);
  105. }
  106. } catch (Exception e) {
  107. e.printStackTrace();
  108. }
  109. XxlJobHelper.log("日月年计算指标调度任务处理完成!........");
  110. }
  111. /**
  112. * 电计量计算指标
  113. * 每15分钟执行一次
  114. */
  115. @XxlJob("electricityMetering_CAL")
  116. public void electricityMetering_CAL() {
  117. XxlJobHelper.log("电计量指标调度程序执行开始!........");
  118. try {
  119. electricityMeteringService.saveGenerationDatas();
  120. } catch (Exception e) {
  121. e.printStackTrace();
  122. }
  123. XxlJobHelper.log("电计量计算指标调度任务处理完成!........");
  124. }
  125. /**
  126. * 实时计算指标
  127. * 每秒执行一次
  128. */
  129. @XxlJob("realtime_CAL")
  130. public void realtime_CAL() {
  131. XxlJobHelper.log("实时指标调度程序执行开始!........");
  132. try {
  133. while(true)
  134. {
  135. realtimeService.savaRealtimeTarget();
  136. Thread.sleep(200);
  137. }
  138. } catch (Exception e) {
  139. e.printStackTrace();
  140. }
  141. XxlJobHelper.log("实时指标调度任务处理完成!........");
  142. }
  143. /**
  144. * 实时场站计算指标合计
  145. * 每秒执行一次
  146. */
  147. @XxlJob("realtime_Wp_CAL")
  148. public void realtime_Wp_CAL() {
  149. XxlJobHelper.log("实时指标调度程序执行开始!........");
  150. try {
  151. while(true)
  152. {
  153. realtimeService.savaRealtimeTargetWp();
  154. Thread.sleep(200);
  155. }
  156. } catch (Exception e) {
  157. e.printStackTrace();
  158. System.out.println( e.getMessage());
  159. }
  160. XxlJobHelper.log("实时指标调度任务处理完成!........");
  161. }
  162. /**
  163. * 中间状态计算
  164. * 执行一次
  165. */
  166. @XxlJob("status_middleStatusReal")
  167. public void status_powerRationing() {
  168. XxlJobHelper.log("中间状态计算调度程序执行开始!........");
  169. try {
  170. statusService.startMiddleStatusReal();
  171. } catch (Exception e) {
  172. e.printStackTrace();
  173. }
  174. XxlJobHelper.log("中间状态计算调度任务处理完成!........");
  175. }
  176. @XxlJob("status_statusReal")
  177. public void status_statusReal() {
  178. XxlJobHelper.log("状态调度程序执行开始!........");
  179. try {
  180. statusService.startStatusReal();
  181. } catch (Exception e) {
  182. e.printStackTrace();
  183. }
  184. XxlJobHelper.log("状态调度任务处理完成!........");
  185. }
  186. /**
  187. * 场站状态计算
  188. * 执行一次
  189. */
  190. /**
  191. * 状态计算
  192. * 执行一次
  193. */
  194. @XxlJob("calculate_powerRationing")
  195. public void calculate_powerRationing() {
  196. XxlJobHelper.log("场站状态计算调度程序执行开始!........");
  197. try {
  198. statusService.startPowerRationing();
  199. } catch (Exception e) {
  200. e.printStackTrace();
  201. }
  202. XxlJobHelper.log("场站状态计算调度任务处理完成!........");
  203. }
  204. /**
  205. * 状态数量计算
  206. * 执行一次
  207. */
  208. @XxlJob("calculate_StatusNumber")
  209. public void calculateStatusNumber() {
  210. XxlJobHelper.log("状态数量调度程序执行开始!........");
  211. try {
  212. statusService.startStatusNumber();
  213. } catch (Exception e) {
  214. e.printStackTrace();
  215. }
  216. XxlJobHelper.log("状态数量调度任务处理完成!........");
  217. }
  218. /**
  219. * 自算功率,最优功率更新缓存
  220. * 每月执行一次
  221. */
  222. @XxlJob("theoreticalPower_CAL")
  223. public void theoreticalPower_CAL() {
  224. XxlJobHelper.log("自算功率更新程序执行开始!........");
  225. try {
  226. theoreticalPowerService.updateCachePower();
  227. } catch (Exception e) {
  228. e.printStackTrace();
  229. }
  230. XxlJobHelper.log("自算功率更新调度任务处理完成!........");
  231. }
  232. /**
  233. * 安全天数
  234. * 每天执行一次
  235. */
  236. @XxlJob("safetyday_CAL")
  237. public void safetyday_CAL() {
  238. XxlJobHelper.log("安全天数程序执行开始!........");
  239. try {
  240. safetyDayService.saveSafetyday();
  241. } catch (Exception e) {
  242. e.printStackTrace();
  243. }
  244. XxlJobHelper.log("安全天数调度任务处理完成!........");
  245. }
  246. /**
  247. * 区域公司实时指标
  248. * 每秒执行一次
  249. */
  250. @XxlJob("regionCalre_CAL")
  251. public void regionCalre_CAL() {
  252. XxlJobHelper.log("区域公司实时程序执行开始!........");
  253. try {
  254. while(true)
  255. {
  256. regionCalreService.companyCal();
  257. regionCalreService.RegionCal();
  258. regionCalreService.groupCal();
  259. }
  260. } catch (Exception e) {
  261. e.printStackTrace();
  262. }
  263. XxlJobHelper.log("区域公司实时程序处理完成!........");
  264. }
  265. /**
  266. * 区域公司历史指标
  267. * 每5分钟执行一次
  268. * 59 14/15 * * * ?
  269. */
  270. @XxlJob("regionCal_CAL")
  271. public void regionCal_CAL() {
  272. XxlJobHelper.log("区域公司历史程序执行开始!........");
  273. try {
  274. while(true)
  275. {
  276. regionCalService.companyCal();
  277. regionCalService.RegionCal();
  278. regionCalService.groupCal();
  279. }
  280. } catch (Exception e) {
  281. e.printStackTrace();
  282. }
  283. XxlJobHelper.log("区域公司历史程序处理完成!........");
  284. }
  285. /**
  286. * 区域公司安全天数
  287. * 每天0点执行
  288. * 59 14/15 * * * ?
  289. */
  290. @XxlJob(value = "yourJobHandler")
  291. public void regionCal_aqts() {
  292. XxlJobHelper.log("区域公司安全天数程序执行开始!........");
  293. try {
  294. regionCalreService.aqts();
  295. } catch (Exception e) {
  296. e.printStackTrace();
  297. }
  298. XxlJobHelper.log("区域公司安全天数程序处理完成!........");
  299. }
  300. @XxlJob("PredictedPowerccuracy")
  301. public void Powerccuracy() {
  302. XxlJobHelper.log("预测功率准确率计算执行开始!........");
  303. try {
  304. powerService.predictedPower();
  305. } catch (Exception e) {
  306. e.printStackTrace();
  307. }
  308. XxlJobHelper.log("预测功率准确率计算执行开始!........");
  309. }
  310. @XxlJob("planvaluejs")
  311. public void planvalue() {
  312. XxlJobHelper.log("系统效率计算执行开始!........");
  313. try {
  314. calculator.planvalue();
  315. } catch (Exception e) {
  316. e.printStackTrace();
  317. }
  318. XxlJobHelper.log("系统效率计算执行开始!........");
  319. }
  320. @XxlJob("companysjs")
  321. public void companysjs() {
  322. XxlJobHelper.log("底码计算执行开始!........");
  323. try {
  324. analysisNewService.companys();
  325. } catch (Exception e) {
  326. e.printStackTrace();
  327. }
  328. XxlJobHelper.log("底码计算计算执行开始!........");
  329. }
  330. @XxlJob("saveWindProjectjs")
  331. public void saveWindProjectjs() {
  332. XxlJobHelper.log("底码电量计算执行开始!........");
  333. try {
  334. analysisNewService.saveWindProject();
  335. } catch (Exception e) {
  336. e.printStackTrace();
  337. }
  338. XxlJobHelper.log("底码电量计算执行开始!........");
  339. }
  340. @XxlJob("irradiationjs")
  341. public void irradiation() {
  342. XxlJobHelper.log("日照强度替换计算执行开始!........");
  343. try {
  344. irradiationinputService.getcockpit();
  345. } catch (Exception e) {
  346. e.printStackTrace();
  347. }
  348. XxlJobHelper.log("日照强度替换计算执行开始!........");
  349. }
  350. }