a30d7c24 张雷

奥体项目实时数据接口修改

1 个父辈 7a86522a
...@@ -39,6 +39,16 @@ public class OlympicCenterController { ...@@ -39,6 +39,16 @@ public class OlympicCenterController {
39 return result; 39 return result;
40 } 40 }
41 41
42 @ApiOperation(value="获取整体实时数据", notes="获取整体实时数据")
43 @GetMapping(value = "/getRealTimeDataNew")
44 public Result<Map<String,Object>> getRealTimeDataNew(String sourceType){
45 Result<Map<String,Object>> result = new Result<Map<String,Object>>();
46 Map<String,Object> map = olympicCenterService.getRealTimeDataNew(sourceType);
47 result.setResult(map);
48 result.setSuccess(true);
49 return result;
50 }
51
42 @ApiOperation(value="获取整体实时数据给UE", notes="获取整体实时数据给UE") 52 @ApiOperation(value="获取整体实时数据给UE", notes="获取整体实时数据给UE")
43 @GetMapping(value = "/getRealTimeDataToUE") 53 @GetMapping(value = "/getRealTimeDataToUE")
44 public Result<Map<String,Object>> getRealTimeDataToUE(){ 54 public Result<Map<String,Object>> getRealTimeDataToUE(){
...@@ -49,6 +59,16 @@ public class OlympicCenterController { ...@@ -49,6 +59,16 @@ public class OlympicCenterController {
49 return result; 59 return result;
50 } 60 }
51 61
62 @ApiOperation(value="获取整体实时数据给UE", notes="获取整体实时数据给UE")
63 @GetMapping(value = "/getRealTimeDataToUENew")
64 public Result<Map<String,Object>> getRealTimeDataToUENew(){
65 Result<Map<String,Object>> result = new Result<Map<String,Object>>();
66 Map<String,Object> map = olympicCenterService.getRealTimeDataToUENew();
67 result.setResult(map);
68 result.setSuccess(true);
69 return result;
70 }
71
52 /** 72 /**
53 * 获取泵站指标历史趋势曲线 73 * 获取泵站指标历史趋势曲线
54 * @param field ssll:瞬时流量 ljll:累计流量 rll:日流量 74 * @param field ssll:瞬时流量 ljll:累计流量 rll:日流量
...@@ -108,4 +128,15 @@ public class OlympicCenterController { ...@@ -108,4 +128,15 @@ public class OlympicCenterController {
108 return result; 128 return result;
109 } 129 }
110 130
131 @ApiOperation(value="获取趋势图", notes="获取趋势图")
132 @GetMapping(value = "/getPressureChartNew")
133 public Result<List<EchartResult>> getPressureChartNew(String equipId,String type){
134 Result<List<EchartResult>> result = new Result<List<EchartResult>>();
135 List<EchartResult> list = new ArrayList<EchartResult>();
136 list = olympicCenterService.getPressureChartNew(equipId,type);
137 result.setResult(list);
138 result.setSuccess(true);
139 return result;
140 }
141
111 } 142 }
......
...@@ -15,4 +15,10 @@ public interface WhatStructDataMapper { ...@@ -15,4 +15,10 @@ public interface WhatStructDataMapper {
15 List<WhatStructData> getListForUE(); 15 List<WhatStructData> getListForUE();
16 16
17 WhatStructData getOneById(@Param("id") String id); 17 WhatStructData getOneById(@Param("id") String id);
18
19 List<WhatStructData> getListByType(@Param("sourceType") String sourceType);
20
21 List<WhatStructData> getDataList(@Param("equipId") String equipId);
22
23 List<WhatStructData> getListForUENew();
18 } 24 }
......
...@@ -14,4 +14,23 @@ ...@@ -14,4 +14,23 @@
14 select * from what_struct_data where id = #{id} limit 1 14 select * from what_struct_data where id = #{id} limit 1
15 </select> 15 </select>
16 16
17 <select id="getListByType" resultType="com.skua.modules.business.entity.WhatStructData">
18 select * from what_struct_data_bak
19 where 1=1
20 <if test="sourceType!=null and sourceType!=''">
21 and system_code = #{sourceType}
22 </if>
23 order by monitor_sort
24 </select>
25
26 <select id="getDataList" resultType="com.skua.modules.business.entity.WhatStructData">
27 select * from what_struct_data_bak
28 where id LIKE CONCAT( #{equipId},'%')
29 order by monitor_sort
30 </select>
31
32 <select id="getListForUENew" resultType="com.skua.modules.business.entity.WhatStructData">
33 select * from what_struct_data_bak order by monitor_sort
34 </select>
35
17 </mapper> 36 </mapper>
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -21,4 +21,10 @@ public interface IOlympicCenterService { ...@@ -21,4 +21,10 @@ public interface IOlympicCenterService {
21 Map<String, Object> getBzRealTimeData(String sourceType); 21 Map<String, Object> getBzRealTimeData(String sourceType);
22 22
23 Map<String, Object> getRealTimeDataToUE(); 23 Map<String, Object> getRealTimeDataToUE();
24
25 Map<String, Object> getRealTimeDataNew(String sourceType);
26
27 List<EchartResult> getPressureChartNew(String equipId, String type);
28
29 Map<String, Object> getRealTimeDataToUENew();
24 } 30 }
......
1 package com.skua.modules.business.service.impl; 1 package com.skua.modules.business.service.impl;
2 2
3 import com.skua.core.service.IFactoryInfoService; 3 import com.skua.core.service.IFactoryInfoService;
4 import com.skua.core.service.IPgQueryService;
5 import com.skua.modules.business.entity.WhatStructData; 4 import com.skua.modules.business.entity.WhatStructData;
6 import com.skua.modules.business.mapper.WhatStructDataMapper; 5 import com.skua.modules.business.mapper.WhatStructDataMapper;
7 import com.skua.modules.business.service.IOlympicCenterService; 6 import com.skua.modules.business.service.IOlympicCenterService;
8 import com.skua.modules.business.vo.EchartResult; 7 import com.skua.modules.business.vo.EchartResult;
9 import com.skua.modules.business.vo.TextResult; 8 import com.skua.modules.business.vo.TextResult;
9 import com.skua.modules.monitor.service.IFmPgQueryService;
10 import lombok.extern.slf4j.Slf4j; 10 import lombok.extern.slf4j.Slf4j;
11 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.stereotype.Service; 12 import org.springframework.stereotype.Service;
...@@ -24,7 +24,7 @@ import java.util.*; ...@@ -24,7 +24,7 @@ import java.util.*;
24 public class OlympicCenterServiceImpl implements IOlympicCenterService { 24 public class OlympicCenterServiceImpl implements IOlympicCenterService {
25 25
26 @Autowired 26 @Autowired
27 private IPgQueryService pgQueryService; 27 private IFmPgQueryService fmPgQueryService;
28 @Autowired 28 @Autowired
29 private IFactoryInfoService factoryInfoService; 29 private IFactoryInfoService factoryInfoService;
30 //queryReportData 30 //queryReportData
...@@ -39,7 +39,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -39,7 +39,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
39 Map<String, Object> monitorMap = new HashMap<>(); 39 Map<String, Object> monitorMap = new HashMap<>();
40 List<WhatStructData> pybList = new ArrayList<>(); 40 List<WhatStructData> pybList = new ArrayList<>();
41 List<WhatStructData> fybList = new ArrayList<>(); 41 List<WhatStructData> fybList = new ArrayList<>();
42 List<WhatStructData> ljbList = new ArrayList<>(); 42 List<WhatStructData> ljList = new ArrayList<>();
43 List<WhatStructData> wybList = new ArrayList<>(); 43 List<WhatStructData> wybList = new ArrayList<>();
44 List<TextResult> pList = new ArrayList<>(); 44 List<TextResult> pList = new ArrayList<>();
45 List<TextResult> fList = new ArrayList<>(); 45 List<TextResult> fList = new ArrayList<>();
...@@ -57,7 +57,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -57,7 +57,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
57 }else if("flow".equals(whatStructData.getEquipType())){ 57 }else if("flow".equals(whatStructData.getEquipType())){
58 fybList.add(whatStructData); 58 fybList.add(whatStructData);
59 }else if("flow_ljll".equals(whatStructData.getEquipType())){ 59 }else if("flow_ljll".equals(whatStructData.getEquipType())){
60 ljbList.add(whatStructData); 60 ljList.add(whatStructData);
61 }else if("temperature".equals(whatStructData.getEquipType())){ 61 }else if("temperature".equals(whatStructData.getEquipType())){
62 wybList.add(whatStructData); 62 wybList.add(whatStructData);
63 }else{ } 63 }else{ }
...@@ -65,7 +65,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -65,7 +65,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
65 } 65 }
66 } 66 }
67 } 67 }
68 List<Map<String, Object>> monitorList = pgQueryService.queryFactoryMonitorFromRealTimeData(AT_ID,pgField); 68 List<Map<String, Object>> monitorList = fmPgQueryService.queryFactoryMonitorFromRealTimeData(AT_ID,pgField);
69 if(monitorList.size()==1){ 69 if(monitorList.size()==1){
70 monitorMap = monitorList.get(0); 70 monitorMap = monitorList.get(0);
71 if("feed".equals(sourceType)){//压力14流量8 71 if("feed".equals(sourceType)){//压力14流量8
...@@ -102,12 +102,12 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -102,12 +102,12 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
102 } 102 }
103 for (int k = 0; k < 8; k++) { 103 for (int k = 0; k < 8; k++) {
104 TextResult textResult = new TextResult(); 104 TextResult textResult = new TextResult();
105 if(k<ljbList.size()){ 105 if(k<ljList.size()){
106 textResult.setTitle(ljbList.get(k).getId()); 106 textResult.setTitle(ljList.get(k).getId());
107 if(monitorMap.get(ljbList.get(k).getMonitorId())==null){ 107 if(monitorMap.get(ljList.get(k).getMonitorId())==null){
108 textResult.setValue("--"); 108 textResult.setValue("--");
109 }else{ 109 }else{
110 textResult.setValue(monitorMap.get(ljbList.get(k).getMonitorId()).toString()); 110 textResult.setValue(monitorMap.get(ljList.get(k).getMonitorId()).toString());
111 } 111 }
112 }else{ 112 }else{
113 textResult.setTitle("flow_ljll"+(k+1)); 113 textResult.setTitle("flow_ljll"+(k+1));
...@@ -151,12 +151,12 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -151,12 +151,12 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
151 } 151 }
152 for (int h = 0; h < 4; h++) { 152 for (int h = 0; h < 4; h++) {
153 TextResult textResult = new TextResult(); 153 TextResult textResult = new TextResult();
154 if(h<ljbList.size()){ 154 if(h<ljList.size()){
155 textResult.setTitle(ljbList.get(h).getId()); 155 textResult.setTitle(ljList.get(h).getId());
156 if(monitorMap.get(ljbList.get(h).getMonitorId())==null){ 156 if(monitorMap.get(ljList.get(h).getMonitorId())==null){
157 textResult.setValue("--"); 157 textResult.setValue("--");
158 }else{ 158 }else{
159 textResult.setValue(monitorMap.get(ljbList.get(h).getMonitorId()).toString()); 159 textResult.setValue(monitorMap.get(ljList.get(h).getMonitorId()).toString());
160 } 160 }
161 }else{ 161 }else{
162 textResult.setTitle("flow_ljll"+(h+1)); 162 textResult.setTitle("flow_ljll"+(h+1));
...@@ -216,12 +216,12 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -216,12 +216,12 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
216 } 216 }
217 for (int k = 0; k < 2; k++) { 217 for (int k = 0; k < 2; k++) {
218 TextResult textResult = new TextResult(); 218 TextResult textResult = new TextResult();
219 if(k<ljbList.size()){ 219 if(k<ljList.size()){
220 textResult.setTitle(ljbList.get(k).getId()); 220 textResult.setTitle(ljList.get(k).getId());
221 if(monitorMap.get(ljbList.get(k).getMonitorId())==null){ 221 if(monitorMap.get(ljList.get(k).getMonitorId())==null){
222 textResult.setValue("--"); 222 textResult.setValue("--");
223 }else{ 223 }else{
224 textResult.setValue(monitorMap.get(ljbList.get(k).getMonitorId()).toString()); 224 textResult.setValue(monitorMap.get(ljList.get(k).getMonitorId()).toString());
225 } 225 }
226 }else{ 226 }else{
227 textResult.setTitle("flow_ljll"+(k+1)); 227 textResult.setTitle("flow_ljll"+(k+1));
...@@ -403,9 +403,9 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -403,9 +403,9 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
403 list.add(echartResult); 403 list.add(echartResult);
404 } 404 }
405 }else{ 405 }else{
406 for (int i = 0; i < 30; i++) { 406 for (int i = 0; i < 7; i++) {
407 Calendar date = Calendar.getInstance(); 407 Calendar date = Calendar.getInstance();
408 date.add(Calendar.DATE, i-30); 408 date.add(Calendar.DATE, i-7);
409 String newDate = new SimpleDateFormat("yyyy-MM-dd").format(date.getTime()).substring(5,10); 409 String newDate = new SimpleDateFormat("yyyy-MM-dd").format(date.getTime()).substring(5,10);
410 EchartResult echartResult = new EchartResult(); 410 EchartResult echartResult = new EchartResult();
411 echartResult.setName(newDate); 411 echartResult.setName(newDate);
...@@ -524,7 +524,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -524,7 +524,7 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
524 for (WhatStructData whatStructData:list) { 524 for (WhatStructData whatStructData:list) {
525 pgField = pgField +","+whatStructData.getMonitorId(); 525 pgField = pgField +","+whatStructData.getMonitorId();
526 } 526 }
527 List<Map<String, Object>> monitorList = pgQueryService.queryFactoryMonitorFromRealTimeData(AT_ID,pgField); 527 List<Map<String, Object>> monitorList = fmPgQueryService.queryFactoryMonitorFromRealTimeData(AT_ID,pgField);
528 if(monitorList.size()==1){ 528 if(monitorList.size()==1){
529 monitorMap = monitorList.get(0); 529 monitorMap = monitorList.get(0);
530 for (WhatStructData whatStructData:list) { 530 for (WhatStructData whatStructData:list) {
...@@ -547,6 +547,460 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService { ...@@ -547,6 +547,460 @@ public class OlympicCenterServiceImpl implements IOlympicCenterService {
547 return map; 547 return map;
548 } 548 }
549 549
550 @Override
551 public Map<String, Object> getRealTimeDataNew(String sourceType) {
552 Map<String,Object> map = new HashMap<>();
553 List<WhatStructData> list = whatStructDataMapper.getListByType(sourceType);
554 Map<String, Object> monitorMap = new HashMap<>();
555 List<WhatStructData> pybList = new ArrayList<>();
556 List<WhatStructData> fybList = new ArrayList<>();
557 List<WhatStructData> ljList = new ArrayList<>();
558 List<WhatStructData> wybList = new ArrayList<>();
559 List<TextResult> pList = new ArrayList<>();
560 List<Map<String,Object>> fList = new ArrayList<>();
561 List<TextResult> wList = new ArrayList<>();
562 String pgField = "";
563 if(sourceType==null){
564 for (WhatStructData whatStructData:list) {
565 pgField = pgField +","+whatStructData.getMonitorId();
566 }
567 }else{
568 for (WhatStructData whatStructData:list) {
569 if(sourceType.equals(whatStructData.getSystemCode())){
570 if("pressure".equals(whatStructData.getEquipType())){
571 pybList.add(whatStructData);
572 }else if("flow".equals(whatStructData.getEquipType())){
573 fybList.add(whatStructData);
574 }else if("flow_ljll".equals(whatStructData.getEquipType())||"flow_rljll".equals(whatStructData.getEquipType())){
575 ljList.add(whatStructData);
576 }else if("temperature".equals(whatStructData.getEquipType())){
577 wybList.add(whatStructData);
578 }else{ }
579 pgField = pgField +","+whatStructData.getMonitorId();
580 }
581 }
582 }
583 List<Map<String, Object>> monitorList = fmPgQueryService.queryFactoryMonitorFromRealTimeData(AT_ID,pgField);
584 if(monitorList.size()==1){
585 monitorMap = monitorList.get(0);
586 if("feed".equals(sourceType)){//压力14流量8
587 for (int i = 0; i < 14; i++) {
588 TextResult textResult = new TextResult();
589 if(i<pybList.size()){
590 textResult.setTitle(pybList.get(i).getId());
591 if(monitorMap.get(pybList.get(i).getMonitorId())==null){
592 textResult.setValue("--");
593 }else{
594 double pResult = formatDouble(Double.parseDouble(monitorMap.get(pybList.get(i).getMonitorId()).toString())/100);
595 textResult.setValue(String.valueOf(pResult));
596 }
597 }else{
598 textResult.setTitle("pressure"+(i+1));
599 textResult.setValue("--");
600 }
601 pList.add(i,textResult);
602 }
603 for (int j = 0; j < 8; j++) {
604 Map<String,Object> fMap = new HashMap<>();
605 List<TextResult> flowList = new ArrayList<>();
606 TextResult flow = new TextResult();
607 TextResult fFlow = new TextResult();
608 TextResult rFlow = new TextResult();
609 if(j<fybList.size()){
610 flow.setTitle(fybList.get(j).getEquipType());
611 if(fybList.get(j).getMonitorId()!=null){
612 flow.setValue(monitorMap.get(fybList.get(j).getMonitorId()).toString());
613 flowList.add(flow);
614 String equipCode = fybList.get(j).getEquipCode();
615 int fcount = 0;
616 for (WhatStructData whatStructData : ljList) {
617 if(fcount < 2){
618 if(equipCode.equals(whatStructData.getEquipCode())){
619 if("flow_ljll".equals(whatStructData.getEquipType())){
620 fFlow.setTitle(whatStructData.getEquipType());
621 fFlow.setValue(monitorMap.get(whatStructData.getMonitorId()).toString());
622 flowList.add(fFlow);
623 fcount++;
624 }else if("flow_rljll".equals(whatStructData.getEquipType())){
625 rFlow.setTitle(whatStructData.getEquipType());
626 rFlow.setValue(monitorMap.get(whatStructData.getMonitorId()).toString());
627 flowList.add(rFlow);
628 fcount++;
629 }else{}
630 }
631 }else{
632 break;
633 }
634 }
635 }else{
636 flow.setValue("--");
637 flowList.add(flow);
638 fFlow.setTitle("flow_ljll");
639 fFlow.setValue("--");
640 flowList.add(fFlow);
641 rFlow.setTitle("flow_rljll");
642 rFlow.setValue("--");
643 flowList.add(rFlow);
644 }
645 fMap.put(fybList.get(j).getId(),flowList);
646 }else{
647 flow.setTitle((j+1)+"flow");
648 flow.setValue("--");
649 flowList.add(flow);
650 fFlow.setTitle((j+1)+"flow_ljll");
651 fFlow.setValue("--");
652 flowList.add(fFlow);
653 rFlow.setTitle((j+1)+"flow_rljll");
654 rFlow.setValue("--");
655 flowList.add(rFlow);
656 fMap.put("flow"+(j+1),flowList);
657 }
658 fList.add(j,fMap);
659 }
660 map.put("pressure",pList);
661 map.put("flow",fList);
662 }else if("hot".equals(sourceType)){//压力10流量4温度4;
663 for (int i = 0; i < 10; i++) {
664 TextResult textResult = new TextResult();
665 if(i<pybList.size()){
666 textResult.setTitle(pybList.get(i).getId());
667 if(monitorMap.get(pybList.get(i).getMonitorId())==null){
668 textResult.setValue("--");
669 }else{
670 double pResult = formatDouble(Double.parseDouble(monitorMap.get(pybList.get(i).getMonitorId()).toString())/100);
671 textResult.setValue(String.valueOf(pResult));
672 }
673 }else{
674 textResult.setTitle("pressure"+(i+1));
675 textResult.setValue("--");
676 }
677 pList.add(i,textResult);
678 }
679 for (int j = 0; j < 4; j++) {
680 Map<String,Object> fMap = new HashMap<>();
681 List<TextResult> flowList = new ArrayList<>();
682 TextResult flow = new TextResult();
683 TextResult fFlow = new TextResult();
684 TextResult rFlow = new TextResult();
685 if(j<fybList.size()){
686 flow.setTitle(fybList.get(j).getEquipType());
687 if(fybList.get(j).getMonitorId()!=null){
688 flow.setValue(monitorMap.get(fybList.get(j).getMonitorId()).toString());
689 flowList.add(flow);
690 String equipCode = fybList.get(j).getEquipCode();
691 int fcount = 0;
692 for (WhatStructData whatStructData : ljList) {
693 if(fcount < 2){
694 if(equipCode.equals(whatStructData.getEquipCode())){
695 if("flow_ljll".equals(whatStructData.getEquipType())){
696 fFlow.setTitle(whatStructData.getEquipType());
697 fFlow.setValue(monitorMap.get(whatStructData.getMonitorId()).toString());
698 flowList.add(fFlow);
699 fcount++;
700 }else if("flow_rljll".equals(whatStructData.getEquipType())){
701 rFlow.setTitle(whatStructData.getEquipType());
702 rFlow.setValue(monitorMap.get(whatStructData.getMonitorId()).toString());
703 flowList.add(rFlow);
704 fcount++;
705 }else{}
706 }
707 }else{
708 break;
709 }
710 }
711 }else{
712 flow.setValue("--");
713 flowList.add(flow);
714 fFlow.setTitle("flow_ljll");
715 fFlow.setValue("--");
716 flowList.add(fFlow);
717 rFlow.setTitle("flow_rljll");
718 rFlow.setValue("--");
719 flowList.add(rFlow);
720 }
721 fMap.put(fybList.get(j).getId(),flowList);
722 }else{
723 flow.setTitle((j+1)+"flow");
724 flow.setValue("--");
725 flowList.add(flow);
726 fFlow.setTitle((j+1)+"flow_ljll");
727 fFlow.setValue("--");
728 flowList.add(fFlow);
729 rFlow.setTitle((j+1)+"flow_rljll");
730 rFlow.setValue("--");
731 flowList.add(rFlow);
732 fMap.put("flow"+(j+1),flowList);
733 }
734 fList.add(j,fMap);
735 }
736 for (int k = 0; k < 4; k++) {
737 TextResult textResult = new TextResult();
738 if(k<wybList.size()){
739 textResult.setTitle(wybList.get(k).getId());
740 if(monitorMap.get(wybList.get(k).getMonitorId())==null){
741 textResult.setValue("--");
742 }else{
743 textResult.setValue(monitorMap.get(wybList.get(k).getMonitorId()).toString());
744 }
745 }else{
746 textResult.setTitle("temperature"+(k+1));
747 textResult.setValue("--");
748 }
749 wList.add(k,textResult);
750 }
751 map.put("pressure",pList);
752 map.put("flow",fList);
753 map.put("temperature",wList);
754 }else if("fire".equals(sourceType)){//压力9流量2.
755 for (int i = 0; i < 9; i++) {
756 TextResult textResult = new TextResult();
757 if(i<pybList.size()){
758 textResult.setTitle(pybList.get(i).getId());
759 if(monitorMap.get(pybList.get(i).getMonitorId())==null){
760 textResult.setValue("--");
761 }else{
762 double pResult = formatDouble(Double.parseDouble(monitorMap.get(pybList.get(i).getMonitorId()).toString())/100);
763 textResult.setValue(String.valueOf(pResult));
764 }
765 }else{
766 textResult.setTitle("pressure"+(i+1));
767 textResult.setValue("--");
768 }
769 pList.add(i,textResult);
770 }
771 for (int j = 0; j < 2; j++) {
772 Map<String,Object> fMap = new HashMap<>();
773 List<TextResult> flowList = new ArrayList<>();
774 TextResult flow = new TextResult();
775 TextResult fFlow = new TextResult();
776 TextResult rFlow = new TextResult();
777 if(j<fybList.size()){
778 flow.setTitle(fybList.get(j).getEquipType());
779 if(fybList.get(j).getMonitorId()!=null){
780 flow.setValue(monitorMap.get(fybList.get(j).getMonitorId()).toString());
781 flowList.add(flow);
782 String equipCode = fybList.get(j).getEquipCode();
783 int fcount = 0;
784 for (WhatStructData whatStructData : ljList) {
785 if(fcount < 2){
786 if(equipCode.equals(whatStructData.getEquipCode())){
787 if("flow_ljll".equals(whatStructData.getEquipType())){
788 fFlow.setTitle(whatStructData.getEquipType());
789 fFlow.setValue(monitorMap.get(whatStructData.getMonitorId()).toString());
790 flowList.add(fFlow);
791 fcount++;
792 }else if("flow_rljll".equals(whatStructData.getEquipType())){
793 rFlow.setTitle(whatStructData.getEquipType());
794 rFlow.setValue(monitorMap.get(whatStructData.getMonitorId()).toString());
795 flowList.add(rFlow);
796 fcount++;
797 }else{}
798 }
799 }else{
800 break;
801 }
802 }
803 }else{
804 flow.setValue("--");
805 flowList.add(flow);
806 fFlow.setTitle("flow_ljll");
807 fFlow.setValue("--");
808 flowList.add(fFlow);
809 rFlow.setTitle("flow_rljll");
810 rFlow.setValue("--");
811 flowList.add(rFlow);
812 }
813 fMap.put(fybList.get(j).getId(),flowList);
814 }else{
815 flow.setTitle((j+1)+"flow");
816 flow.setValue("--");
817 flowList.add(flow);
818 fFlow.setTitle((j+1)+"flow_ljll");
819 fFlow.setValue("--");
820 flowList.add(fFlow);
821 rFlow.setTitle((j+1)+"flow_rljll");
822 rFlow.setValue("--");
823 flowList.add(rFlow);
824 fMap.put("flow"+(j+1),flowList);
825 }
826 fList.add(j,fMap);
827 }
828 map.put("pressure",pList);
829 map.put("flow",fList);
830 }else{
831 for (int i = 0; i < 33; i++) {
832 TextResult textResult = new TextResult();
833 textResult.setTitle("pressure"+(i+1));
834 textResult.setValue("0.00");
835 pList.add(i,textResult);
836 }
837 for (int j = 0; j < 14; j++) {
838 Map<String,Object> fMap = new HashMap<>();
839 List<TextResult> flowList = new ArrayList<>();
840 TextResult flow = new TextResult();
841 TextResult fFlow = new TextResult();
842 TextResult rFlow = new TextResult();
843 flow.setTitle("flow");
844 flow.setValue("--");
845 flowList.add(flow);
846 fFlow.setTitle("flow_ljll");
847 fFlow.setValue("--");
848 flowList.add(fFlow);
849 rFlow.setTitle("flow_rljll");
850 rFlow.setValue("--");
851 flowList.add(rFlow);
852 fMap.put("F0"+(j+1),flowList);
853 fList.add(fMap);
854 }
855 for (int k = 0; k < 4; k++) {
856 TextResult textResult = new TextResult();
857 textResult.setTitle("temperature"+(k+1));
858 textResult.setValue("--");
859 wList.add(k,textResult);
860 }
861 map.put("pressure",pList);
862 map.put("flow",fList);
863 map.put("temperature",wList);
864 }
865 }
866 return map;
867 }
868
869 @Override
870 public List<EchartResult> getPressureChartNew(String equipId, String type) {
871 List<EchartResult> list = new ArrayList<>();
872 List<WhatStructData> wList = whatStructDataMapper.getDataList(equipId);
873 String pgField = "";
874 if(wList.size() == 0){
875 return list;
876 }else{
877 for (WhatStructData whatStructData:wList) {
878 pgField = pgField +","+whatStructData.getMonitorId();
879 }
880 }
881 Calendar cal = Calendar.getInstance();
882 cal.add(Calendar.DATE, -7);
883 String startDate = new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime());
884 String start = startDate + " 00:00:00";
885 String endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
886 String end = endDate + " 23:59:59";
887 List<Map<String, Object>> dataList = factoryInfoService.queryReportData(AT_ID, pgField, start, end,"hour");
888 if(dataList.size()>0){
889 for (Map<String, Object> map:dataList) {
890 EchartResult echartResult = new EchartResult();
891 echartResult.setName(map.get("time").toString());
892 if("p".equals(type)){
893 double pResult = formatDouble(Double.parseDouble(map.get(wList.get(0).getMonitorId()).toString())/100);
894 echartResult.setValue(String.valueOf(pResult));
895 echartResult.setSeries("压力表");
896 list.add(echartResult);
897 }else if("f".equals(type)){
898 for (WhatStructData whatStructData:wList) {
899 EchartResult eResult = new EchartResult();
900 eResult.setName(map.get("time").toString());
901 eResult.setValue(map.get(whatStructData.getMonitorId()).toString());
902 eResult.setSeries(whatStructData.getEquipType());
903 list.add(eResult);
904 }
905 }else if("t".equals(type)){
906 echartResult.setValue(map.get(wList.get(0).getMonitorId()).toString());
907 echartResult.setSeries("温度计");
908 list.add(echartResult);
909 }else{
910 echartResult.setValue("--");
911 echartResult.setSeries("--");
912 list.add(echartResult);
913 }
914
915 }
916 }else{
917 for (int i = 0; i < 7; i++) {
918 Calendar date = Calendar.getInstance();
919 date.add(Calendar.DATE, i-7);
920 String newDate = new SimpleDateFormat("yyyy-MM-dd").format(date.getTime()).substring(5,10);
921 EchartResult echartResult = new EchartResult();
922 echartResult.setName(newDate);
923 echartResult.setValue("--");
924 if("p".equals(type)){
925 echartResult.setSeries("压力表");
926 }else if("f".equals(type)){
927 echartResult.setSeries("流量计");
928 }else if("t".equals(type)){
929 echartResult.setSeries("温度计");
930 }else{
931 echartResult.setSeries("--");
932 }
933 list.add(echartResult);
934 }
935 }
936 return list;
937 }
938
939 @Override
940 public Map<String, Object> getRealTimeDataToUENew() {
941 List<WhatStructData> list = whatStructDataMapper.getListForUENew();
942 List<WhatStructData> fList = new ArrayList<>();
943 List<WhatStructData> otherList = new ArrayList<>();
944 Map<String, Object> map = new HashMap<>();
945 Map<String, Object> monitorMap = new HashMap<>();
946 String pgField = "";
947 for (WhatStructData whatStructData:list) {
948 pgField = pgField +","+whatStructData.getMonitorId();
949 if("flow".equals(whatStructData.getEquipType())){
950 fList.add(whatStructData);
951 }
952 if(!whatStructData.getEquipType().contains("flow")){
953 otherList.add(whatStructData);
954 }
955 }
956 List<Map<String, Object>> monitorList = fmPgQueryService.queryFactoryMonitorFromRealTimeData(AT_ID,pgField);
957 if(monitorList.size()==1){
958 monitorMap = monitorList.get(0);
959 for (WhatStructData whatStructData:fList) {
960 if(whatStructData.getMonitorId()!=null){
961 String fId = whatStructData.getId();
962 Map<String, Object> beanMap = new HashMap<>();
963 for (WhatStructData bean : list) {
964 if(bean.getId().startsWith(fId)){
965 beanMap.put(bean.getEquipType(),monitorMap.get(bean.getMonitorId()));
966 }
967 }
968 map.put(fId,beanMap);
969 }else{
970 Map<String, Object> kMap = new HashMap<>();
971 kMap.put("flow","--");
972 kMap.put("flow_ljll","--");
973 kMap.put("flow_rljll","--");
974 map.put(whatStructData.getId(),kMap);
975 }
976 }
977 for (WhatStructData whatStructData:otherList) {
978 if(whatStructData.getMonitorId()!=null){
979 if("pressure".equals(whatStructData.getEquipType())){
980 double pResult = formatDouble(Double.parseDouble(monitorMap.get(whatStructData.getMonitorId()).toString())/100);
981 map.put(whatStructData.getId(),String.valueOf(pResult));
982 }else{
983 map.put(whatStructData.getId(),monitorMap.get(whatStructData.getMonitorId()));
984 }
985 }else{
986 map.put(whatStructData.getId(),"--");
987 }
988 }
989 }else{
990 for (WhatStructData whatStructData:fList) {
991 Map<String, Object> kMap = new HashMap<>();
992 kMap.put("flow","--");
993 kMap.put("flow_ljll","--");
994 kMap.put("flow_rljll","--");
995 map.put(whatStructData.getId(),kMap);
996 }
997 for (WhatStructData whatStructData:otherList) {
998 map.put(whatStructData.getId(),"--");
999 }
1000 }
1001 return map;
1002 }
1003
550 // public static void main(String[] args) { 1004 // public static void main(String[] args) {
551 // for (int i = 0; i < 24; i++) { 1005 // for (int i = 0; i < 24; i++) {
552 // Calendar date = Calendar.getInstance(); 1006 // Calendar date = Calendar.getInstance();
......
...@@ -6,6 +6,7 @@ import com.skua.modules.location.UserLocationFactory; ...@@ -6,6 +6,7 @@ import com.skua.modules.location.UserLocationFactory;
6 import com.skua.modules.location.entity.UserBaseInfo; 6 import com.skua.modules.location.entity.UserBaseInfo;
7 import com.skua.modules.location.entity.UserLocation; 7 import com.skua.modules.location.entity.UserLocation;
8 import com.skua.modules.location.service.ILocationService; 8 import com.skua.modules.location.service.ILocationService;
9 import com.skua.modules.location.vo.QueryParams;
9 import io.swagger.annotations.Api; 10 import io.swagger.annotations.Api;
10 import io.swagger.annotations.ApiOperation; 11 import io.swagger.annotations.ApiOperation;
11 import lombok.extern.slf4j.Slf4j; 12 import lombok.extern.slf4j.Slf4j;
...@@ -14,7 +15,9 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -14,7 +15,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
14 import org.springframework.web.bind.annotation.RestController; 15 import org.springframework.web.bind.annotation.RestController;
15 16
16 import java.util.ArrayList; 17 import java.util.ArrayList;
18 import java.util.HashMap;
17 import java.util.List; 19 import java.util.List;
20 import java.util.Map;
18 21
19 @Slf4j 22 @Slf4j
20 @Api(tags="人员定位系统对接") 23 @Api(tags="人员定位系统对接")
...@@ -26,12 +29,12 @@ public class UserLocationController { ...@@ -26,12 +29,12 @@ public class UserLocationController {
26 @AutoLog(value = "义乌人员定位-获取所有人员列表") 29 @AutoLog(value = "义乌人员定位-获取所有人员列表")
27 @ApiOperation(value="义乌人员定位-获取所有人员列表", notes="义乌人员定位-获取所有人员列表") 30 @ApiOperation(value="义乌人员定位-获取所有人员列表", notes="义乌人员定位-获取所有人员列表")
28 @GetMapping(value = "/yw/getAllUser") 31 @GetMapping(value = "/yw/getAllUser")
29 public Result<List<UserBaseInfo>> getAllUserYW(String userName) { 32 public Result<Map<String,Object>> getAllUserYW(QueryParams queryParams) {
30 Result<List<UserBaseInfo>> result = new Result<List<UserBaseInfo>>(); 33 Result<Map<String,Object>> result = new Result<Map<String,Object>>();
31 List<UserBaseInfo> list = new ArrayList<>(); 34 Map<String,Object> map = new HashMap<>();
32 ILocationService locationService = UserLocationFactory.getLocationService("YW"); 35 ILocationService locationService = UserLocationFactory.getLocationService("YW");
33 list = locationService.getAllUser(userName); 36 map = locationService.getAllUser(queryParams);
34 result.setResult(list); 37 result.setResult(map);
35 result.setSuccess(true); 38 result.setSuccess(true);
36 return result; 39 return result;
37 } 40 }
...@@ -66,12 +69,12 @@ public class UserLocationController { ...@@ -66,12 +69,12 @@ public class UserLocationController {
66 @AutoLog(value = "余杭人员定位-获取所有人员列表") 69 @AutoLog(value = "余杭人员定位-获取所有人员列表")
67 @ApiOperation(value="余杭人员定位-获取所有人员列表", notes="余杭人员定位-获取所有人员列表") 70 @ApiOperation(value="余杭人员定位-获取所有人员列表", notes="余杭人员定位-获取所有人员列表")
68 @GetMapping(value = "/yh/getAllUser") 71 @GetMapping(value = "/yh/getAllUser")
69 public Result<List<UserBaseInfo>> getAllUserBKYH(String userName) { 72 public Result<Map<String,Object>> getAllUserBKYH(QueryParams queryParams) {
70 Result<List<UserBaseInfo>> result = new Result<List<UserBaseInfo>>(); 73 Result<Map<String,Object>> result = new Result<Map<String,Object>>();
71 List<UserBaseInfo> list = new ArrayList<>(); 74 Map<String,Object> map = new HashMap<>();
72 ILocationService locationService = UserLocationFactory.getLocationService("BKYH"); 75 ILocationService locationService = UserLocationFactory.getLocationService("BKYH");
73 list = locationService.getAllUser(userName); 76 map = locationService.getAllUser(queryParams);
74 result.setResult(list); 77 result.setResult(map);
75 result.setSuccess(true); 78 result.setSuccess(true);
76 return result; 79 return result;
77 } 80 }
......
...@@ -2,8 +2,10 @@ package com.skua.modules.location.service; ...@@ -2,8 +2,10 @@ package com.skua.modules.location.service;
2 2
3 import com.skua.modules.location.entity.UserBaseInfo; 3 import com.skua.modules.location.entity.UserBaseInfo;
4 import com.skua.modules.location.entity.UserLocation; 4 import com.skua.modules.location.entity.UserLocation;
5 import com.skua.modules.location.vo.QueryParams;
5 6
6 import java.util.List; 7 import java.util.List;
8 import java.util.Map;
7 9
8 public interface ILocationService { 10 public interface ILocationService {
9 11
...@@ -11,7 +13,7 @@ public interface ILocationService { ...@@ -11,7 +13,7 @@ public interface ILocationService {
11 13
12 List<UserLocation> getUserHistory(String deviceCode, String startTime, String endTime); 14 List<UserLocation> getUserHistory(String deviceCode, String startTime, String endTime);
13 15
14 List<UserBaseInfo> getAllUser(String userName); 16 Map<String,Object> getAllUser(QueryParams queryParams);
15 17
16 18
17 } 19 }
......
...@@ -6,6 +6,7 @@ import com.skua.modules.location.entity.*; ...@@ -6,6 +6,7 @@ import com.skua.modules.location.entity.*;
6 import com.skua.modules.location.service.ILocationService; 6 import com.skua.modules.location.service.ILocationService;
7 import com.skua.modules.location.util.ChangeLocationUtils; 7 import com.skua.modules.location.util.ChangeLocationUtils;
8 import com.skua.modules.location.util.MD5Util; 8 import com.skua.modules.location.util.MD5Util;
9 import com.skua.modules.location.vo.QueryParams;
9 import org.apache.commons.lang.StringUtils; 10 import org.apache.commons.lang.StringUtils;
10 import org.springframework.stereotype.Service; 11 import org.springframework.stereotype.Service;
11 12
...@@ -108,8 +109,9 @@ public class BkyhLocationServiceImpl implements ILocationService { ...@@ -108,8 +109,9 @@ public class BkyhLocationServiceImpl implements ILocationService {
108 } 109 }
109 110
110 @Override 111 @Override
111 public List<UserBaseInfo> getAllUser(String userName) { 112 public Map<String,Object> getAllUser(QueryParams queryParams) {
112 List<UserBaseInfo> list = new ArrayList<>(); 113 List<UserBaseInfo> list = new ArrayList<>();
114 Map<String,Object> map = new HashMap<>();
113 String post = getBuildingAllInfo(); 115 String post = getBuildingAllInfo();
114 JSONObject json = JSONObject.parseObject(JSONObject.parseObject(post).get("data").toString()); 116 JSONObject json = JSONObject.parseObject(JSONObject.parseObject(post).get("data").toString());
115 List<UserBaseInfoBkyhResult> userList = JSONObject.parseArray(json.get("devices").toString(), UserBaseInfoBkyhResult.class); 117 List<UserBaseInfoBkyhResult> userList = JSONObject.parseArray(json.get("devices").toString(), UserBaseInfoBkyhResult.class);
...@@ -131,7 +133,8 @@ public class BkyhLocationServiceImpl implements ILocationService { ...@@ -131,7 +133,8 @@ public class BkyhLocationServiceImpl implements ILocationService {
131 userBaseInfo.setUserName(userBaseInfoBkyhResult.getName()); 133 userBaseInfo.setUserName(userBaseInfoBkyhResult.getName());
132 list.add(userBaseInfo); 134 list.add(userBaseInfo);
133 } 135 }
134 return list; 136 map.put("list",list);
137 return map;
135 } 138 }
136 139
137 } 140 }
......
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
5 import com.skua.modules.location.entity.*; 5 import com.skua.modules.location.entity.*;
6 import com.skua.modules.location.service.ILocationService; 6 import com.skua.modules.location.service.ILocationService;
7 import com.skua.modules.location.util.ChangeLocationUtils; 7 import com.skua.modules.location.util.ChangeLocationUtils;
8 import com.skua.modules.location.vo.QueryParams;
8 import org.springframework.stereotype.Service; 9 import org.springframework.stereotype.Service;
9 10
10 import java.util.ArrayList; 11 import java.util.ArrayList;
...@@ -94,17 +95,19 @@ public class YwLocationServiceImpl implements ILocationService { ...@@ -94,17 +95,19 @@ public class YwLocationServiceImpl implements ILocationService {
94 } 95 }
95 96
96 @Override 97 @Override
97 public List<UserBaseInfo> getAllUser(String userName) { 98 public Map<String,Object> getAllUser(QueryParams queryParams) {
98 List<UserBaseInfo> list = new ArrayList<>(); 99 List<UserBaseInfo> list = new ArrayList<>();
99 HashMap<String,Object> map = new HashMap<>(); 100 Map<String,Object> map = new HashMap<>();
100 map.put("username", username); 101 HashMap<String,Object> pmap = new HashMap<>();
101 map.put("password", password); 102 pmap.put("username", username);
102 map.put("page",1); 103 pmap.put("password", password);
103 map.put("rows",1000); 104 pmap.put("page",1);
104 map.put("emp",userName); 105 pmap.put("rows",1000);
105 String post = HttpUtil.get(url+"open/information/getEmp.do",map); 106 pmap.put("emp",queryParams.getUserName());
107 String post = HttpUtil.get(url+"open/information/getEmp.do",pmap);
106 JSONObject json = JSONObject.parseObject(JSONObject.parseObject(post).get("data").toString()); 108 JSONObject json = JSONObject.parseObject(JSONObject.parseObject(post).get("data").toString());
107 List<UserBaseInfoYwResult> userList = JSONObject.parseArray(json.get("rows").toString(), UserBaseInfoYwResult.class); 109 List<UserBaseInfoYwResult> userList = JSONObject.parseArray(json.get("rows").toString(), UserBaseInfoYwResult.class);
110 List<Map> onlineList = getOnLineList();
108 for (UserBaseInfoYwResult userBaseInfoYwResult : userList) { 111 for (UserBaseInfoYwResult userBaseInfoYwResult : userList) {
109 UserBaseInfo userBaseInfo = new UserBaseInfo(); 112 UserBaseInfo userBaseInfo = new UserBaseInfo();
110 userBaseInfo.setDeviceCode(userBaseInfoYwResult.getDeviceno()); 113 userBaseInfo.setDeviceCode(userBaseInfoYwResult.getDeviceno());
...@@ -114,6 +117,19 @@ public class YwLocationServiceImpl implements ILocationService { ...@@ -114,6 +117,19 @@ public class YwLocationServiceImpl implements ILocationService {
114 userBaseInfo.setUserStatus("0"); 117 userBaseInfo.setUserStatus("0");
115 list.add(userBaseInfo); 118 list.add(userBaseInfo);
116 } 119 }
120 map.put("list",list);
121 map.put("onlineCount",onlineList.size());
122 return map;
123 }
124
125 public List<Map> getOnLineList(){
126 List<Map> list = new ArrayList<>();
127 HashMap<String,Object> map = new HashMap<>();
128 map.put("username", username);
129 map.put("password", password);
130 String post = HttpUtil.get(url+"/open/information/getRealInformation.do",map);
131 JSONObject json = JSONObject.parseObject(JSONObject.parseObject(post).get("data").toString());
132 list = JSONObject.parseArray(json.get("list").toString(), Map.class);
117 return list; 133 return list;
118 } 134 }
119 } 135 }
......
1 package com.skua.modules.location.vo;
2
3 import lombok.Data;
4
5 @Data
6 public class QueryParams {
7
8 /**人员名称*/
9 private String userName;
10 /**在线状态*/
11 private String userStatus;
12
13 }
1 package com.skua.modules.monitor.service;
2
3 import java.util.List;
4 import java.util.Map;
5
6 /**
7 * PG实时数据查询接口
8 */
9 public interface IFmPgQueryService {
10
11 List<Map<String, Object>> queryFactoryMonitorFromRealTimeData(String factoryId, String fields);
12
13 }
1 package com.skua.modules.monitor.service.impl;
2
3 import com.skua.core.context.SpringContextUtils;
4 import org.apache.commons.lang.StringUtils;
5 import org.springframework.jdbc.core.JdbcTemplate;
6 import org.springframework.stereotype.Service;
7 import com.skua.modules.monitor.service.IFmPgQueryService;
8
9 import java.text.ParseException;
10 import java.text.SimpleDateFormat;
11 import java.util.*;
12
13 /**
14 * 数据指标信息表
15 */
16 @Service
17 public class FmPgQueryServiceImpl implements IFmPgQueryService {
18
19 @Override
20 public List<Map<String, Object>> queryFactoryMonitorFromRealTimeData(String factoryId, String fields) {
21 String[] factoryIdArray = factoryId.split(",");
22 String sqlPart = "";
23 for(String id : factoryIdArray) {
24 sqlPart = sqlPart +",'"+id+"'";
25 }
26 sqlPart = sqlPart.substring(1);
27 JdbcTemplate pgDb = (JdbcTemplate) SpringContextUtils.getBean("pg-db");
28 List<Map<String,Object>> result = new ArrayList<Map<String,Object>>();
29 JdbcTemplate masterDB = (JdbcTemplate)SpringContextUtils.getBean("master");
30 List<Map<String, Object>> factoryDesign = masterDB
31 .queryForList("select * from sys_factory_device where factory_id in ("+sqlPart+")");
32 if(factoryDesign==null||factoryDesign.size()==0) {
33 return result;
34 }
35 StringBuilder str = new StringBuilder();
36 String[] fieldsArr = fields.split(",");
37 for (int i = 0; i < fieldsArr.length; ++i){
38 if(!StringUtils.isEmpty(fieldsArr[i])&&!fieldsArr[i].equals("null")) {
39 str.append("'"+fieldsArr[i]+"'").append(",");
40 }
41 }
42 if(fieldsArr.length > 0){
43 str.append("''");
44 }else{
45 return result;
46 }
47 String deviceIds = "";
48 for(Map<String,Object> map: factoryDesign) {
49 deviceIds = deviceIds +",'"+map.get("device_id")+"'";
50 }
51 deviceIds = deviceIds.substring(1);
52
53 Date d=new Date();//获取时间
54 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
55 long todayTimeStemp = gettimeStemp(sdf.format(d)+" 00:00:00","yyyy-MM-dd");
56
57 //获取pg数据库时间,向前推采集频率的三倍时间,做数据容错
58 String sql = "select ts as time,nm as monitorId,v as monitorValue from realtimedata where nm in("+str.toString()+") and factoryname in ("+deviceIds+")";
59 List<Map<String, Object>> monitorList = pgDb.queryForList(sql);
60 Map<String,Object> map = new HashMap<>();
61 if(monitorList.size() > 0){
62 map.put("time",monitorList.get(0).get("time").toString());
63 for (int m = 0; m < monitorList.size(); m++) {
64 if(Long.parseLong(monitorList.get(m).get("time").toString()) > todayTimeStemp){
65 map.put(monitorList.get(m).get("monitorId").toString(),monitorList.get(m).get("monitorValue"));
66 }else{
67 map.put(monitorList.get(m).get("monitorId").toString(),0.00);
68 }
69 }
70 result.add(map);
71 }else{
72 return result;
73 }
74 return result;
75 }
76
77 public static void main(String[] args) {
78 Date d=new Date();//获取时间
79 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
80 System.out.println(gettimeStemp(sdf.format(d)+" 00:00:00","yyyy-MM-dd"));
81 }
82
83 public static long gettimeStemp(String time, String format) {
84 SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
85 if (!"".equals(format)) {
86 simpleDateFormat = new SimpleDateFormat(format);
87 }
88 long timeStemp = 0;
89 try {
90 Date date = simpleDateFormat.parse(time);
91 timeStemp = date.getTime();
92 } catch (ParseException e) {
93 e.printStackTrace();
94 }
95 return timeStemp/1000;
96 }
97 }
...@@ -57,7 +57,6 @@ ...@@ -57,7 +57,6 @@
57 </exclusion> 57 </exclusion>
58 </exclusions> 58 </exclusions>
59 </dependency> 59 </dependency>
60 <!-- online form -->
61 </dependencies> 60 </dependencies>
62 61
63 <build> 62 <build>
......
...@@ -185,3 +185,10 @@ skua : ...@@ -185,3 +185,10 @@ skua :
185 #cas单点登录 185 #cas单点登录
186 cas: 186 cas:
187 prefixUrl: http://cas.example.org:8443/cas 187 prefixUrl: http://cas.example.org:8443/cas
188
189 #微信相关
190 wx:
191 # 公众号
192 app-id: wxbdc5610cc59c1631
193 app-secret: xxxxxxxxxxxxxxxxxxxxxxx
194 redirect-url: https://passport.yhd.com/wechat/callback.do
......
...@@ -98,9 +98,9 @@ spring: ...@@ -98,9 +98,9 @@ spring:
98 driver-class-name: com.mysql.jdbc.Driver 98 driver-class-name: com.mysql.jdbc.Driver
99 # 多数据源配置 99 # 多数据源配置
100 pg-db: 100 pg-db:
101 url: jdbc:postgresql://120.24.205.69:10086/postgres?useUnicode=true&characterEncoding=UTF8 101 url: jdbc:postgresql://47.104.99.86:10086/postgres?useUnicode=true&characterEncoding=UTF8
102 username: postgres 102 username: postgres
103 password: server_2021_%Jksc 103 password: JKjnf9713xt
104 driver-class-name: org.postgresql.Driver 104 driver-class-name: org.postgresql.Driver
105 #redis 配置 105 #redis 配置
106 redis: 106 redis:
...@@ -186,3 +186,10 @@ skua : ...@@ -186,3 +186,10 @@ skua :
186 #cas单点登录 186 #cas单点登录
187 cas: 187 cas:
188 prefixUrl: http://cas.example.org:8443/cas 188 prefixUrl: http://cas.example.org:8443/cas
189
190 #微信相关
191 wx:
192 # 公众号
193 app-id: wxbdc5610cc59c1631
194 app-secret: xxxxxxxxxxxxxxxxxxxxxxx
195 redirect-url: https://passport.yhd.com/wechat/callback.do
......
...@@ -186,3 +186,10 @@ skua : ...@@ -186,3 +186,10 @@ skua :
186 #cas单点登录 186 #cas单点登录
187 cas: 187 cas:
188 prefixUrl: http://cas.example.org:8443/cas 188 prefixUrl: http://cas.example.org:8443/cas
189
190 #微信相关
191 wx:
192 # 公众号
193 app-id: wxbdc5610cc59c1631
194 app-secret: xxxxxxxxxxxxxxxxxxxxxxx
195 redirect-url: https://passport.yhd.com/wechat/callback.do
......
...@@ -186,3 +186,9 @@ skua : ...@@ -186,3 +186,9 @@ skua :
186 #cas单点登录 186 #cas单点登录
187 cas: 187 cas:
188 prefixUrl: http://cas.example.org:8443/cas 188 prefixUrl: http://cas.example.org:8443/cas
189 #微信相关
190 wx:
191 # 公众号
192 app-id: wxbdc5610cc59c1631
193 app-secret: xxxxxxxxxxxxxxxxxxxxxxx
194 redirect-url: https://passport.yhd.com/wechat/callback.do
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!