正在显示
7 个修改的文件
包含
234 行增加
和
5 行删除
@@ -159,11 +159,11 @@ eeUrl: | @@ -159,11 +159,11 @@ eeUrl: | ||
159 | #电表充值路径 | 159 | #电表充值路径 |
160 | # rechargeDevicesUrl: "http://10.5.10.102:8000/api/emcs/rechargeDevices" | 160 | # rechargeDevicesUrl: "http://10.5.10.102:8000/api/emcs/rechargeDevices" |
161 | rechargeDevicesUrl: "http://192.168.1.7:18080/api/emcs/rechargeDevices" | 161 | rechargeDevicesUrl: "http://192.168.1.7:18080/api/emcs/rechargeDevices" |
162 | + #电表送电 1送电 2断电 | ||
163 | +# remoteControlDevices: "http://10.5.10.102:8000/api/emcs/remoteControlDevices" | ||
164 | + remoteControlDevices: "http://192.168.1.199:18080/api/emcs/remoteControlDevices" | ||
162 | #获取电表实时数据/余额 | 165 | #获取电表实时数据/余额 |
163 | # electricityBanlanceUrl: "http://10.5.10.102:8000/api/emcs/getEnergyInfoForRealTime" | 166 | # electricityBanlanceUrl: "http://10.5.10.102:8000/api/emcs/getEnergyInfoForRealTime" |
164 | - electricityBanlanceUrl: "http://192.168.1.7:18080/api/emcs/getEnergyInfoForRealTime" | ||
165 | - #获取设备跟公寓信息 | ||
166 | - # getRoomAndDeviceUrl: "http://10.5.10.102:8000/api/emcs/getRoomAndDevice" | ||
167 | - getRoomAndDeviceUrl: "http://192.168.1.7:18080/api/emcs/getRoomAndDevice" | 167 | + electricityBanlanceUrl: "http://192.168.1.199:18080/api/emcs/getEnergyInfoForRealTime" |
168 | 168 | ||
169 | 169 |
1 | +package com.sunyo.energy.location.model; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | + | ||
5 | +/** | ||
6 | + * 获取电表余额/实时数据3 | ||
7 | + */ | ||
8 | +@Data | ||
9 | +public class ElectricityBalanceThree { | ||
10 | + | ||
11 | + private Integer deviceId; | ||
12 | + | ||
13 | + private Number totalEnergy; | ||
14 | + | ||
15 | + private Number tipEnergy; | ||
16 | + | ||
17 | + private Number peakEnergy; | ||
18 | + | ||
19 | + private Number valleyEnergy; | ||
20 | + | ||
21 | + private Number flatEnergy; | ||
22 | + | ||
23 | + private Number balance; | ||
24 | + | ||
25 | +} |
1 | +package com.sunyo.energy.location.model; | ||
2 | + | ||
3 | +import java.math.BigDecimal; | ||
4 | +import java.util.Date; | ||
5 | + | ||
6 | +public class ElectricityMeter { | ||
7 | + private String deviceId; | ||
8 | + | ||
9 | + private BigDecimal totalEnergy; | ||
10 | + | ||
11 | + private BigDecimal tipEnergy; | ||
12 | + | ||
13 | + private BigDecimal peakEnergy; | ||
14 | + | ||
15 | + private BigDecimal valleyEnergy; | ||
16 | + | ||
17 | + private BigDecimal flatEnergy; | ||
18 | + | ||
19 | + private BigDecimal balance; | ||
20 | + | ||
21 | + private Date actime; | ||
22 | + | ||
23 | + private Date updatetime; | ||
24 | + | ||
25 | + private String reamke1; | ||
26 | + | ||
27 | + private String reamke2; | ||
28 | + | ||
29 | + public String getDeviceId() { | ||
30 | + return deviceId; | ||
31 | + } | ||
32 | + | ||
33 | + public void setDeviceId(String deviceId) { | ||
34 | + this.deviceId = deviceId == null ? null : deviceId.trim(); | ||
35 | + } | ||
36 | + | ||
37 | + public BigDecimal getTotalEnergy() { | ||
38 | + return totalEnergy; | ||
39 | + } | ||
40 | + | ||
41 | + public void setTotalEnergy(BigDecimal totalEnergy) { | ||
42 | + this.totalEnergy = totalEnergy; | ||
43 | + } | ||
44 | + | ||
45 | + public BigDecimal getTipEnergy() { | ||
46 | + return tipEnergy; | ||
47 | + } | ||
48 | + | ||
49 | + public void setTipEnergy(BigDecimal tipEnergy) { | ||
50 | + this.tipEnergy = tipEnergy; | ||
51 | + } | ||
52 | + | ||
53 | + public BigDecimal getPeakEnergy() { | ||
54 | + return peakEnergy; | ||
55 | + } | ||
56 | + | ||
57 | + public void setPeakEnergy(BigDecimal peakEnergy) { | ||
58 | + this.peakEnergy = peakEnergy; | ||
59 | + } | ||
60 | + | ||
61 | + public BigDecimal getValleyEnergy() { | ||
62 | + return valleyEnergy; | ||
63 | + } | ||
64 | + | ||
65 | + public void setValleyEnergy(BigDecimal valleyEnergy) { | ||
66 | + this.valleyEnergy = valleyEnergy; | ||
67 | + } | ||
68 | + | ||
69 | + public BigDecimal getFlatEnergy() { | ||
70 | + return flatEnergy; | ||
71 | + } | ||
72 | + | ||
73 | + public void setFlatEnergy(BigDecimal flatEnergy) { | ||
74 | + this.flatEnergy = flatEnergy; | ||
75 | + } | ||
76 | + | ||
77 | + public BigDecimal getBalance() { | ||
78 | + return balance; | ||
79 | + } | ||
80 | + | ||
81 | + public void setBalance(BigDecimal balance) { | ||
82 | + this.balance = balance; | ||
83 | + } | ||
84 | + | ||
85 | + public Date getActime() { | ||
86 | + return actime; | ||
87 | + } | ||
88 | + | ||
89 | + public void setActime(Date actime) { | ||
90 | + this.actime = actime; | ||
91 | + } | ||
92 | + | ||
93 | + public Date getUpdatetime() { | ||
94 | + return updatetime; | ||
95 | + } | ||
96 | + | ||
97 | + public void setUpdatetime(Date updatetime) { | ||
98 | + this.updatetime = updatetime; | ||
99 | + } | ||
100 | + | ||
101 | + public String getReamke1() { | ||
102 | + return reamke1; | ||
103 | + } | ||
104 | + | ||
105 | + public void setReamke1(String reamke1) { | ||
106 | + this.reamke1 = reamke1 == null ? null : reamke1.trim(); | ||
107 | + } | ||
108 | + | ||
109 | + public String getReamke2() { | ||
110 | + return reamke2; | ||
111 | + } | ||
112 | + | ||
113 | + public void setReamke2(String reamke2) { | ||
114 | + this.reamke2 = reamke2 == null ? null : reamke2.trim(); | ||
115 | + } | ||
116 | +} |
1 | package com.sunyo.energy.location.service.imp; | 1 | package com.sunyo.energy.location.service.imp; |
2 | 2 | ||
3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
4 | +import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIGlobalBinding; | ||
4 | import com.sunyo.energy.location.dao.*; | 5 | import com.sunyo.energy.location.dao.*; |
5 | import com.sunyo.energy.location.model.*; | 6 | import com.sunyo.energy.location.model.*; |
6 | import com.sunyo.energy.location.service.ElectricityMeterService; | 7 | import com.sunyo.energy.location.service.ElectricityMeterService; |
@@ -10,6 +11,8 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -10,6 +11,8 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
10 | import org.springframework.beans.factory.annotation.Value; | 11 | import org.springframework.beans.factory.annotation.Value; |
11 | import org.springframework.scheduling.annotation.Scheduled; | 12 | import org.springframework.scheduling.annotation.Scheduled; |
12 | import org.springframework.stereotype.Service; | 13 | import org.springframework.stereotype.Service; |
14 | + | ||
15 | +import java.math.BigDecimal; | ||
13 | import java.util.HashMap; | 16 | import java.util.HashMap; |
14 | import java.util.List; | 17 | import java.util.List; |
15 | import java.util.Map; | 18 | import java.util.Map; |
@@ -30,6 +33,15 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | @@ -30,6 +33,15 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | ||
30 | @Value("${eeUrl.rechargeDevicesUrl}") | 33 | @Value("${eeUrl.rechargeDevicesUrl}") |
31 | private String rechargeDevicesUrl; | 34 | private String rechargeDevicesUrl; |
32 | 35 | ||
36 | + @Value("${eeUrl.remoteControlDevices}") | ||
37 | + private String remoteControlDevices; | ||
38 | + | ||
39 | + /** | ||
40 | + * 获取电表实时数据/余额 | ||
41 | + */ | ||
42 | + @Value("${eeUrl.electricityBanlanceUrl}") | ||
43 | + private String electricityBanlanceUrl; | ||
44 | + | ||
33 | /** | 45 | /** |
34 | * 定时读取电表临时表 发起充值 | 46 | * 定时读取电表临时表 发起充值 |
35 | */ | 47 | */ |
@@ -55,6 +67,17 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | @@ -55,6 +67,17 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | ||
55 | message = rechargeDevicesResultData.getSuccess(); | 67 | message = rechargeDevicesResultData.getSuccess(); |
56 | } | 68 | } |
57 | if ("0".equals(rechargeDevicesResult.getErrcode()) && message == true) { | 69 | if ("0".equals(rechargeDevicesResult.getErrcode()) && message == true) { |
70 | + ElectricityMeter energyInfoForRealTime = getEnergyInfoForRealTime(electricityInfo.getDeviceId()); | ||
71 | + if (energyInfoForRealTime.getBalance() != null){ | ||
72 | + int i = energyInfoForRealTime.getBalance().compareTo(BigDecimal.ZERO); | ||
73 | + if (i > 0){ | ||
74 | + Map<String, Object> map = new HashMap<>(); | ||
75 | + map.put("deviceId", electricityInfo.getDeviceId()); | ||
76 | + map.put("action", "1"); | ||
77 | + HttpsUtils.sendPost(remoteControlDevices, map); | ||
78 | + } | ||
79 | + } | ||
80 | + payRecordsMapper.updateStatus(electricityInfo.getOrderNumber()); | ||
58 | // 成功 删除该订单 | 81 | // 成功 删除该订单 |
59 | electricityInfoMapper.deleteByPrimaryKey(electricityInfo.getOrderNumber()); | 82 | electricityInfoMapper.deleteByPrimaryKey(electricityInfo.getOrderNumber()); |
60 | } | 83 | } |
@@ -76,4 +99,34 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | @@ -76,4 +99,34 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | ||
76 | return map; | 99 | return map; |
77 | } | 100 | } |
78 | 101 | ||
102 | + /** | ||
103 | + * 实施获取电表数据 | ||
104 | + */ | ||
105 | + public ElectricityMeter getEnergyInfoForRealTime(String deviceId) { | ||
106 | + try { | ||
107 | + if (!"".equals(deviceId)) { | ||
108 | + Map<String, Object> stringObjectMap = eeInfo(deviceId); | ||
109 | + String infoForRealTime = HttpsUtils.sendPost(electricityBanlanceUrl, stringObjectMap); | ||
110 | + ElectricityBalanceOne electricityBalanceOne = JSON.parseObject(infoForRealTime, ElectricityBalanceOne.class); | ||
111 | + List<ElectricityMeter> infoForRealTimeList = electricityBalanceOne.getData().getDatas(); | ||
112 | + for (ElectricityMeter electricityBalanceThree : infoForRealTimeList) { | ||
113 | + if (electricityBalanceThree != null) { | ||
114 | + return electricityBalanceThree; | ||
115 | + } | ||
116 | + } | ||
117 | + } | ||
118 | + return null; | ||
119 | + } catch (Exception e) { | ||
120 | + e.printStackTrace(); | ||
121 | + return null; | ||
122 | + } | ||
123 | + } | ||
124 | + | ||
125 | + public Map<String, Object> eeInfo(String deviceId) { | ||
126 | + Map<String, Object> datas = new HashMap<>(); | ||
127 | + datas.put("deviceId", deviceId); | ||
128 | + return datas; | ||
129 | + } | ||
130 | + | ||
131 | + | ||
79 | } | 132 | } |
@@ -69,7 +69,7 @@ | @@ -69,7 +69,7 @@ | ||
69 | 69 | ||
70 | <update id="updateStatus" parameterType="string"> | 70 | <update id="updateStatus" parameterType="string"> |
71 | update pay_records | 71 | update pay_records |
72 | - set payStatus = 1 | 72 | + set reamke3 = 1 |
73 | where orderNumber = #{value, jdbcType=VARCHAR} | 73 | where orderNumber = #{value, jdbcType=VARCHAR} |
74 | </update> | 74 | </update> |
75 | 75 |
-
请 注册 或 登录 后发表评论