正在显示
17 个修改的文件
包含
494 行增加
和
155 行删除
| @@ -2,6 +2,7 @@ package com.sunyo.energy.location.controller; | @@ -2,6 +2,7 @@ package com.sunyo.energy.location.controller; | ||
| 2 | 2 | ||
| 3 | import com.sunyo.energy.location.controller.response.ResultJson; | 3 | import com.sunyo.energy.location.controller.response.ResultJson; |
| 4 | import com.sunyo.energy.location.model.ElectricityBalanceThree; | 4 | import com.sunyo.energy.location.model.ElectricityBalanceThree; |
| 5 | +import com.sunyo.energy.location.model.ElectricityMeter; | ||
| 5 | import com.sunyo.energy.location.model.WaterElectricityParameter; | 6 | import com.sunyo.energy.location.model.WaterElectricityParameter; |
| 6 | import com.sunyo.energy.location.service.ElectricityMeterService; | 7 | import com.sunyo.energy.location.service.ElectricityMeterService; |
| 7 | import com.sunyo.energy.location.service.WaterElectricityParameterService; | 8 | import com.sunyo.energy.location.service.WaterElectricityParameterService; |
| @@ -97,10 +98,10 @@ public class ElectricityParameterController { | @@ -97,10 +98,10 @@ public class ElectricityParameterController { | ||
| 97 | @ApiOperation(value = "电表实时信息查询") | 98 | @ApiOperation(value = "电表实时信息查询") |
| 98 | @RequestMapping(value = "/getEnergyInfoForRealTime") | 99 | @RequestMapping(value = "/getEnergyInfoForRealTime") |
| 99 | @ResponseBody | 100 | @ResponseBody |
| 100 | - public ElectricityBalanceThree getEnergyInfoForRealTime(@RequestParam(value = "eeId", required = false) String eeId){ | 101 | + public ElectricityMeter getEnergyInfoForRealTime(@RequestParam(value = "eeId", required = false) String eeId){ |
| 101 | 102 | ||
| 102 | try { | 103 | try { |
| 103 | - ElectricityBalanceThree energyInfoForRealTime = electricityMeterService.getEnergyInfoForRealTime(eeId); | 104 | + ElectricityMeter energyInfoForRealTime = electricityMeterService.getEnergyInfoForRealTime(eeId); |
| 104 | return energyInfoForRealTime; | 105 | return energyInfoForRealTime; |
| 105 | }catch (Exception e){ | 106 | }catch (Exception e){ |
| 106 | e.printStackTrace(); | 107 | e.printStackTrace(); |
| @@ -108,21 +109,4 @@ public class ElectricityParameterController { | @@ -108,21 +109,4 @@ public class ElectricityParameterController { | ||
| 108 | } | 109 | } |
| 109 | } | 110 | } |
| 110 | 111 | ||
| 111 | - /** | ||
| 112 | - * 电表充值 | ||
| 113 | - * @param eeId | ||
| 114 | - * @return | ||
| 115 | - */ | ||
| 116 | - @ApiOperation(value = "电表充值缴费") | ||
| 117 | - @RequestMapping(value = "/rechargeDevices") | ||
| 118 | - @ResponseBody | ||
| 119 | - public ResultJson rechargeDevices(@RequestParam(value = "eeId", required = false) String eeId, | ||
| 120 | - @RequestParam(value = "money", required = false) String money, | ||
| 121 | - @RequestParam(value = "actionType", required = false) String actionType){ | ||
| 122 | - | ||
| 123 | - int i = electricityMeterService.rechargeDevices(eeId, money, actionType); | ||
| 124 | - | ||
| 125 | - return i > 0 ? new ResultJson("200", "充值成功") : new ResultJson("500", "网络异常"); | ||
| 126 | - } | ||
| 127 | - | ||
| 128 | } | 112 | } |
| @@ -6,6 +6,7 @@ import com.sunyo.energy.location.dao.PayRecordsMapper; | @@ -6,6 +6,7 @@ import com.sunyo.energy.location.dao.PayRecordsMapper; | ||
| 6 | import com.sunyo.energy.location.dao.PayResponseMapper; | 6 | import com.sunyo.energy.location.dao.PayResponseMapper; |
| 7 | import com.sunyo.energy.location.model.PayRecords; | 7 | import com.sunyo.energy.location.model.PayRecords; |
| 8 | import com.sunyo.energy.location.model.PayResponse; | 8 | import com.sunyo.energy.location.model.PayResponse; |
| 9 | +import com.sunyo.energy.location.service.ElectricityMeterService; | ||
| 9 | import com.sunyo.energy.location.service.WaterMeterService; | 10 | import com.sunyo.energy.location.service.WaterMeterService; |
| 10 | import com.sunyo.energy.location.websocket.WebSocketServer; | 11 | import com.sunyo.energy.location.websocket.WebSocketServer; |
| 11 | import io.swagger.annotations.ApiOperation; | 12 | import io.swagger.annotations.ApiOperation; |
| @@ -34,6 +35,9 @@ public class PayRseponeController { | @@ -34,6 +35,9 @@ public class PayRseponeController { | ||
| 34 | @Autowired | 35 | @Autowired |
| 35 | private PayRecordsMapper payRecordsMapper; | 36 | private PayRecordsMapper payRecordsMapper; |
| 36 | 37 | ||
| 38 | + @Autowired | ||
| 39 | + ElectricityMeterService electricityMeterService; | ||
| 40 | + | ||
| 37 | /** | 41 | /** |
| 38 | * 接受字段 | 42 | * 接受字段 |
| 39 | * @param POSID 商户柜台代码 | 43 | * @param POSID 商户柜台代码 |
| @@ -115,20 +119,55 @@ public class PayRseponeController { | @@ -115,20 +119,55 @@ public class PayRseponeController { | ||
| 115 | payRecords.setOrdernumber(ORDERID); | 119 | payRecords.setOrdernumber(ORDERID); |
| 116 | payRecords.setReamke3("0"); | 120 | payRecords.setReamke3("0"); |
| 117 | } | 121 | } |
| 118 | - // 修改订单状态 | ||
| 119 | - int i1 = payRecordsMapper.updateByPrimaryKey(payRecords); | ||
| 120 | - if (i1>0){ | 122 | + |
| 123 | + // 查询是水还是电 | ||
| 124 | + boolean selectType = payRecordsMapper.selectType(ORDERID); | ||
| 125 | + if (selectType){ | ||
| 126 | + // 查询该订单设备编号 | ||
| 127 | + String eeId = payRecordsMapper.findOrderNumber(ORDERID); | ||
| 128 | + if (!"".equals(eeId)){ | ||
| 129 | + // 通知充值电费 | ||
| 130 | + int eeResult = electricityMeterService.rechargeDevices(eeId, PAYMENT, "0"); | ||
| 131 | + if (eeResult > 0){ | ||
| 132 | + // 修改订单状态 | ||
| 133 | + int i1 = payRecordsMapper.updateByPrimaryKey(payRecords); | ||
| 134 | + if (i1>0){ | ||
| 135 | + WebSocketServer webSocketServer = new WebSocketServer(); | ||
| 136 | + JSONObject jsonObject = new JSONObject(); | ||
| 137 | + jsonObject.put("orderNumber", ORDERID); | ||
| 138 | + jsonObject.put("success", "Y"); | ||
| 139 | + webSocketServer.broadcast(jsonObject.toJSONString()); | ||
| 140 | + }else { | ||
| 141 | + WebSocketServer webSocketServer = new WebSocketServer(); | ||
| 142 | + JSONObject jsonObject = new JSONObject(); | ||
| 143 | + jsonObject.put("orderNumber", ORDERID); | ||
| 144 | + jsonObject.put("success", "N"); | ||
| 145 | + webSocketServer.broadcast(jsonObject.toJSONString()); | ||
| 146 | + } | ||
| 147 | + } | ||
| 148 | + } | ||
| 149 | + }else { | ||
| 121 | // 查询该订单设备编号 | 150 | // 查询该订单设备编号 |
| 122 | - String orderNumber = payRecordsMapper.findOrderNumber(ORDERID); | 151 | + String wmId = payRecordsMapper.findOrderNumber(ORDERID); |
| 123 | // 通知充值水费 | 152 | // 通知充值水费 |
| 124 | - if (!"".equals(orderNumber)){ | ||
| 125 | - ResultJson resultJson = waterMeterService.payWater(PAYMENT, orderNumber); | 153 | + if (!"".equals(wmId)){ |
| 154 | + ResultJson resultJson = waterMeterService.payWater(PAYMENT, wmId); | ||
| 126 | if ("200".equals(resultJson.getCode())){ | 155 | if ("200".equals(resultJson.getCode())){ |
| 127 | - WebSocketServer webSocketServer = new WebSocketServer(); | ||
| 128 | - JSONObject jsonObject = new JSONObject(); | ||
| 129 | - jsonObject.put("orderNumber", ORDERID); | ||
| 130 | - jsonObject.put("success", "Y"); | ||
| 131 | - webSocketServer.broadcast(jsonObject.toJSONString()); | 156 | + // 修改订单状态 |
| 157 | + int i1 = payRecordsMapper.updateByPrimaryKey(payRecords); | ||
| 158 | + if (i1>0){ | ||
| 159 | + WebSocketServer webSocketServer = new WebSocketServer(); | ||
| 160 | + JSONObject jsonObject = new JSONObject(); | ||
| 161 | + jsonObject.put("orderNumber", ORDERID); | ||
| 162 | + jsonObject.put("success", "Y"); | ||
| 163 | + webSocketServer.broadcast(jsonObject.toJSONString()); | ||
| 164 | + }else { | ||
| 165 | + WebSocketServer webSocketServer = new WebSocketServer(); | ||
| 166 | + JSONObject jsonObject = new JSONObject(); | ||
| 167 | + jsonObject.put("orderNumber", ORDERID); | ||
| 168 | + jsonObject.put("success", "N"); | ||
| 169 | + webSocketServer.broadcast(jsonObject.toJSONString()); | ||
| 170 | + } | ||
| 132 | }else { | 171 | }else { |
| 133 | WebSocketServer webSocketServer = new WebSocketServer(); | 172 | WebSocketServer webSocketServer = new WebSocketServer(); |
| 134 | JSONObject jsonObject = new JSONObject(); | 173 | JSONObject jsonObject = new JSONObject(); |
| @@ -137,13 +176,8 @@ public class PayRseponeController { | @@ -137,13 +176,8 @@ public class PayRseponeController { | ||
| 137 | webSocketServer.broadcast(jsonObject.toJSONString()); | 176 | webSocketServer.broadcast(jsonObject.toJSONString()); |
| 138 | } | 177 | } |
| 139 | } | 178 | } |
| 140 | - }else { | ||
| 141 | - WebSocketServer webSocketServer = new WebSocketServer(); | ||
| 142 | - JSONObject jsonObject = new JSONObject(); | ||
| 143 | - jsonObject.put("orderNumber", ORDERID); | ||
| 144 | - jsonObject.put("success", "N"); | ||
| 145 | - webSocketServer.broadcast(jsonObject.toJSONString()); | ||
| 146 | } | 179 | } |
| 180 | + | ||
| 147 | } | 181 | } |
| 148 | return i==1? new ResultJson("200","支付回执信息接受成功"):new ResultJson("500","支付回执信息接受失败"); | 182 | return i==1? new ResultJson("200","支付回执信息接受成功"):new ResultJson("500","支付回执信息接受失败"); |
| 149 | } | 183 | } |
| @@ -50,9 +50,10 @@ public class UserPayController { | @@ -50,9 +50,10 @@ public class UserPayController { | ||
| 50 | public ResultJson qrCode(@RequestParam(value = "payFees", required = false) String payFees, | 50 | public ResultJson qrCode(@RequestParam(value = "payFees", required = false) String payFees, |
| 51 | @RequestParam(value = "wmId", required = false) String wmId, | 51 | @RequestParam(value = "wmId", required = false) String wmId, |
| 52 | @RequestParam(value = "userId", required = false) String userId, | 52 | @RequestParam(value = "userId", required = false) String userId, |
| 53 | - @RequestParam(value = "realName", required = false) String realName) throws UnsupportedEncodingException { | 53 | + @RequestParam(value = "realName", required = false) String realName, |
| 54 | + @RequestParam(value = "deviceId", required = false) String eeId) throws UnsupportedEncodingException { | ||
| 54 | 55 | ||
| 55 | - ResultJson resultJson = waterMeterService.qrCode(payFees, wmId, userId, realName); | 56 | + ResultJson resultJson = waterMeterService.qrCode(payFees, wmId, userId, realName, eeId); |
| 56 | return resultJson; | 57 | return resultJson; |
| 57 | } | 58 | } |
| 58 | 59 |
| 1 | +package com.sunyo.energy.location.dao; | ||
| 2 | + | ||
| 3 | +import com.sunyo.energy.location.model.ElectricityMeter; | ||
| 4 | + | ||
| 5 | +public interface ElectricityMeterMapper { | ||
| 6 | + int deleteByPrimaryKey(String deviceId); | ||
| 7 | + | ||
| 8 | + int insert(ElectricityMeter record); | ||
| 9 | + | ||
| 10 | + int insertSelective(ElectricityMeter record); | ||
| 11 | + | ||
| 12 | + ElectricityMeter selectByPrimaryKey(String deviceId); | ||
| 13 | + | ||
| 14 | + int updateByPrimaryKeySelective(ElectricityMeter record); | ||
| 15 | + | ||
| 16 | + int updateByPrimaryKey(ElectricityMeter record); | ||
| 17 | +} |
| @@ -28,10 +28,14 @@ public interface LocationMapper { | @@ -28,10 +28,14 @@ public interface LocationMapper { | ||
| 28 | 28 | ||
| 29 | String selectRoomNumber(String roomNumber); | 29 | String selectRoomNumber(String roomNumber); |
| 30 | 30 | ||
| 31 | + String selectRoomNumberElectricity(String roomNumber); | ||
| 32 | + | ||
| 31 | int countAdrName(Map<String, Object> map); | 33 | int countAdrName(Map<String, Object> map); |
| 32 | 34 | ||
| 33 | int countParent(Integer id); | 35 | int countParent(Integer id); |
| 34 | 36 | ||
| 35 | String findWmId(String roomNumber); | 37 | String findWmId(String roomNumber); |
| 36 | 38 | ||
| 39 | + String eeId(String roomNumber); | ||
| 40 | + | ||
| 37 | } | 41 | } |
| @@ -23,4 +23,6 @@ public interface PayRecordsMapper { | @@ -23,4 +23,6 @@ public interface PayRecordsMapper { | ||
| 23 | @Param(value = "endTime") String endTime); | 23 | @Param(value = "endTime") String endTime); |
| 24 | 24 | ||
| 25 | String findOrderNumber(String orderId); | 25 | String findOrderNumber(String orderId); |
| 26 | + | ||
| 27 | + boolean selectType(String orderId); | ||
| 26 | } | 28 | } |
| 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 | +} |
| @@ -2,6 +2,7 @@ package com.sunyo.energy.location.service; | @@ -2,6 +2,7 @@ package com.sunyo.energy.location.service; | ||
| 2 | 2 | ||
| 3 | import com.sunyo.energy.location.controller.response.ResultJson; | 3 | import com.sunyo.energy.location.controller.response.ResultJson; |
| 4 | import com.sunyo.energy.location.model.ElectricityBalanceThree; | 4 | import com.sunyo.energy.location.model.ElectricityBalanceThree; |
| 5 | +import com.sunyo.energy.location.model.ElectricityMeter; | ||
| 5 | 6 | ||
| 6 | import java.math.BigDecimal; | 7 | import java.math.BigDecimal; |
| 7 | import java.util.Map; | 8 | import java.util.Map; |
| @@ -18,8 +19,15 @@ public interface ElectricityMeterService { | @@ -18,8 +19,15 @@ public interface ElectricityMeterService { | ||
| 18 | * @param deviceId | 19 | * @param deviceId |
| 19 | * @return | 20 | * @return |
| 20 | */ | 21 | */ |
| 21 | - ElectricityBalanceThree getEnergyInfoForRealTime(String deviceId) throws Exception; | 22 | + ElectricityMeter getEnergyInfoForRealTime(String deviceId) throws Exception; |
| 22 | 23 | ||
| 24 | + /** | ||
| 25 | + * 电表充值接口 | ||
| 26 | + * @param deviceId | ||
| 27 | + * @param money | ||
| 28 | + * @param actionType | ||
| 29 | + * @return | ||
| 30 | + */ | ||
| 23 | int rechargeDevices(String deviceId, String money, String actionType); | 31 | int rechargeDevices(String deviceId, String money, String actionType); |
| 24 | 32 | ||
| 25 | } | 33 | } |
| @@ -19,7 +19,7 @@ public interface WaterMeterService { | @@ -19,7 +19,7 @@ public interface WaterMeterService { | ||
| 19 | /** | 19 | /** |
| 20 | * 请求返回二维码 | 20 | * 请求返回二维码 |
| 21 | */ | 21 | */ |
| 22 | - ResultJson qrCode(String payFees, String wmId, String userId, String realName) throws UnsupportedEncodingException; | 22 | + ResultJson qrCode(String payFees, String wmId, String userId, String realName, String eeId) throws UnsupportedEncodingException; |
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | } | 25 | } |
| @@ -2,12 +2,16 @@ package com.sunyo.energy.location.service.imp; | @@ -2,12 +2,16 @@ package com.sunyo.energy.location.service.imp; | ||
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | import com.alibaba.fastjson.JSONArray; | 4 | import com.alibaba.fastjson.JSONArray; |
| 5 | +import com.sun.deploy.net.HttpUtils; | ||
| 5 | import com.sunyo.energy.location.controller.response.ResultJson; | 6 | import com.sunyo.energy.location.controller.response.ResultJson; |
| 7 | +import com.sunyo.energy.location.dao.ElectricityMeterMapper; | ||
| 6 | import com.sunyo.energy.location.model.*; | 8 | import com.sunyo.energy.location.model.*; |
| 7 | import com.sunyo.energy.location.service.ElectricityMeterService; | 9 | import com.sunyo.energy.location.service.ElectricityMeterService; |
| 8 | import com.sunyo.energy.location.utils.HttpsUtils; | 10 | import com.sunyo.energy.location.utils.HttpsUtils; |
| 9 | import com.sunyo.energy.location.utils.Md5Utils; | 11 | import com.sunyo.energy.location.utils.Md5Utils; |
| 12 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | import org.springframework.beans.factory.annotation.Value; | 13 | import org.springframework.beans.factory.annotation.Value; |
| 14 | +import org.springframework.scheduling.annotation.Scheduled; | ||
| 11 | import org.springframework.stereotype.Service; | 15 | import org.springframework.stereotype.Service; |
| 12 | import sun.security.provider.MD5; | 16 | import sun.security.provider.MD5; |
| 13 | 17 | ||
| @@ -21,6 +25,9 @@ import java.util.Map; | @@ -21,6 +25,9 @@ import java.util.Map; | ||
| 21 | @Service | 25 | @Service |
| 22 | public class ElectricityMeterServiceImp implements ElectricityMeterService { | 26 | public class ElectricityMeterServiceImp implements ElectricityMeterService { |
| 23 | 27 | ||
| 28 | + @Autowired | ||
| 29 | + ElectricityMeterMapper electricityMeterMapper; | ||
| 30 | + | ||
| 24 | /** | 31 | /** |
| 25 | * 获取房间与设备信息 | 32 | * 获取房间与设备信息 |
| 26 | */ | 33 | */ |
| @@ -45,104 +52,35 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | @@ -45,104 +52,35 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | ||
| 45 | private final static String rechargeDevicesUrl = "http://192.168.1.2:18080/api/emcs/rechargeDevices"; | 52 | private final static String rechargeDevicesUrl = "http://192.168.1.2:18080/api/emcs/rechargeDevices"; |
| 46 | 53 | ||
| 47 | /** | 54 | /** |
| 48 | - * 电费查询 | 55 | + * 获取全部电表设备数据 定时查询 入临时电表 |
| 49 | */ | 56 | */ |
| 50 | - public Map<String, Object> electricityInfo(String roomNumber){ | ||
| 51 | - try { | 57 | + @Scheduled(cron = "0 0 03 * * ?" ) |
| 58 | + public void balanceList(){ | ||
| 52 | 59 | ||
| 53 | - Map<String, Object> map = new HashMap<>(); | ||
| 54 | - // 获取设备id | ||
| 55 | - String deviceId = deviceId(roomNumber); | ||
| 56 | - // 获取设备 通电状态 | ||
| 57 | - Number onAndOff = onAndOff(deviceId); | ||
| 58 | - // 获取设备余额 | ||
| 59 | - Number balance = balance(deviceId); | 60 | + try { |
| 60 | 61 | ||
| 61 | - map.put("deviceId", deviceId); | ||
| 62 | - map.put("onAndOff", onAndOff); | ||
| 63 | - map.put("balance", balance); | 62 | + Map<String, Object> stringObjectMap = eeInfo("all"); |
| 63 | + String infoForRealTime = HttpsUtils.sendPost(electricityBanlanceUrl, stringObjectMap); | ||
| 64 | + ElectricityBalanceOne electricityBalanceOne = JSON.parseObject(infoForRealTime, ElectricityBalanceOne.class); | ||
| 65 | + List<ElectricityMeter> electricityMeterList = electricityBalanceOne.getData().getDatas(); | ||
| 66 | + for (ElectricityMeter electricityMeter : electricityMeterList){ | ||
| 67 | + electricityMeterMapper.insertSelective(electricityMeter); | ||
| 68 | + } | ||
| 64 | 69 | ||
| 65 | - return map; | ||
| 66 | }catch (Exception e){ | 70 | }catch (Exception e){ |
| 67 | e.printStackTrace(); | 71 | e.printStackTrace(); |
| 68 | - return null; | ||
| 69 | } | 72 | } |
| 70 | - } | ||
| 71 | 73 | ||
| 72 | - /** | ||
| 73 | - * 获取设备id | ||
| 74 | - * @param roomNumber | ||
| 75 | - * @return | ||
| 76 | - */ | ||
| 77 | - public String deviceId(String roomNumber){ | ||
| 78 | - | ||
| 79 | - // 获取电表id | ||
| 80 | - String electricityInfo = HttpsUtils.sendPostHttpRequest(electricityUrl, roomNumber); | ||
| 81 | - // 所有电表房间与电表设备id | ||
| 82 | - ElectricityRoomDeviceOne electricityTemporary = JSON.parseObject(electricityInfo, ElectricityRoomDeviceOne.class); | ||
| 83 | - ElectricityRoomDeviceTwo electricityData = electricityTemporary.getData(); | ||
| 84 | - List<ElectricityRoomDeviceThree> electricityList = electricityData.getDatas(); | ||
| 85 | - for (ElectricityRoomDeviceThree electricity: electricityList){ | ||
| 86 | - if (roomNumber.equals(electricity.getRoomName())){ | ||
| 87 | - return electricity.getDeviceId(); | ||
| 88 | - } | ||
| 89 | - } | ||
| 90 | - return ""; | ||
| 91 | } | 74 | } |
| 92 | 75 | ||
| 93 | - /** | ||
| 94 | - * 获取电表实时通电状态 | ||
| 95 | - * @return | ||
| 96 | - */ | ||
| 97 | - public Number onAndOff(String deviceId){ | ||
| 98 | - // 获取电表通电状态 | ||
| 99 | - String s = HttpsUtils.sendPostHttpRequest(electricityStatus, ""); | ||
| 100 | - ElectricityDeviceOnAndOffOne electricityDevice = JSON.parseObject(s, ElectricityDeviceOnAndOffOne.class); | ||
| 101 | - ElectricityDeviceOnAndOffTwo data = electricityDevice.getData(); | ||
| 102 | - List<ElectricityDeviceOnAndOffThree> onAndOffStatus = data.getDatas(); | ||
| 103 | - for (ElectricityDeviceOnAndOffThree electricityOnAndOffStatus: onAndOffStatus){ | ||
| 104 | - if (deviceId.equals(electricityOnAndOffStatus.getDeviceId())){ | ||
| 105 | - return electricityOnAndOffStatus.getOnAndOff(); | ||
| 106 | - } | ||
| 107 | - } | ||
| 108 | - return 0; | ||
| 109 | - } | ||
| 110 | - | ||
| 111 | - /** | ||
| 112 | - * 获取设备余额 | ||
| 113 | - * @param deviceId | ||
| 114 | - * @return | ||
| 115 | - */ | ||
| 116 | - public Number balance(String deviceId){ | ||
| 117 | - | ||
| 118 | - // 获取电表余额 | ||
| 119 | - String s1 = HttpsUtils.sendPostHttpRequest(electricityBanlanceUrl, "1"); | ||
| 120 | - | ||
| 121 | - ElectricityBalanceOne electricityBalanceOne = JSON.parseObject(s1, ElectricityBalanceOne.class); | ||
| 122 | - | ||
| 123 | - ElectricityBalanceTwo data1 = electricityBalanceOne.getData(); | ||
| 124 | - | ||
| 125 | - List<ElectricityBalanceThree> electricityBalanceThreeList = data1.getDatas(); | ||
| 126 | - for (ElectricityBalanceThree electricityBalanceThree: electricityBalanceThreeList){ | ||
| 127 | - if (deviceId.equals(electricityBalanceThree.getDeviceId())){ | ||
| 128 | - return electricityBalanceThree.getBalance(); | ||
| 129 | - } | ||
| 130 | - } | ||
| 131 | - return 0; | ||
| 132 | - } | ||
| 133 | - | ||
| 134 | - | ||
| 135 | @Override | 76 | @Override |
| 136 | - public ElectricityBalanceThree getEnergyInfoForRealTime(String deviceId){ | ||
| 137 | - | ||
| 138 | - Map<String, Object> datas = new HashMap<>(); | ||
| 139 | - datas.put("deviceId", "1"); | 77 | + public ElectricityMeter getEnergyInfoForRealTime(String deviceId){ |
| 140 | try { | 78 | try { |
| 141 | - | ||
| 142 | - String infoForRealTime = HttpsUtils.sendPost(electricityBanlanceUrl, datas); | 79 | + Map<String, Object> stringObjectMap = eeInfo(deviceId); |
| 80 | + String infoForRealTime = HttpsUtils.sendPost(electricityBanlanceUrl, stringObjectMap); | ||
| 143 | ElectricityBalanceOne electricityBalanceOne = JSON.parseObject(infoForRealTime, ElectricityBalanceOne.class); | 81 | ElectricityBalanceOne electricityBalanceOne = JSON.parseObject(infoForRealTime, ElectricityBalanceOne.class); |
| 144 | - List<ElectricityBalanceThree> infoForRealTimeList = electricityBalanceOne.getData().getDatas(); | ||
| 145 | - for (ElectricityBalanceThree electricityBalanceThree: infoForRealTimeList){ | 82 | + List<ElectricityMeter> infoForRealTimeList = electricityBalanceOne.getData().getDatas(); |
| 83 | + for (ElectricityMeter electricityBalanceThree: infoForRealTimeList){ | ||
| 146 | if (electricityBalanceThree != null){ | 84 | if (electricityBalanceThree != null){ |
| 147 | return electricityBalanceThree; | 85 | return electricityBalanceThree; |
| 148 | } | 86 | } |
| @@ -182,4 +120,11 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | @@ -182,4 +120,11 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | ||
| 182 | } | 120 | } |
| 183 | return 0; | 121 | return 0; |
| 184 | } | 122 | } |
| 123 | + | ||
| 124 | + public Map<String, Object> eeInfo(String deviceId){ | ||
| 125 | + Map<String, Object> datas = new HashMap<>(); | ||
| 126 | + datas.put("deviceId", deviceId); | ||
| 127 | + | ||
| 128 | + return datas; | ||
| 129 | + } | ||
| 185 | } | 130 | } |
| 1 | package com.sunyo.energy.location.service.imp; | 1 | package com.sunyo.energy.location.service.imp; |
| 2 | 2 | ||
| 3 | +import com.sunyo.energy.location.dao.ElectricityMeterMapper; | ||
| 3 | import com.sunyo.energy.location.dao.LocationMapper; | 4 | import com.sunyo.energy.location.dao.LocationMapper; |
| 5 | +import com.sunyo.energy.location.model.ElectricityMeter; | ||
| 4 | import com.sunyo.energy.location.model.WaterMeter; | 6 | import com.sunyo.energy.location.model.WaterMeter; |
| 5 | import com.sunyo.energy.location.service.LocationService; | 7 | import com.sunyo.energy.location.service.LocationService; |
| 6 | import com.sunyo.energy.location.utils.AllUtils; | 8 | import com.sunyo.energy.location.utils.AllUtils; |
| @@ -17,7 +19,10 @@ import java.util.Map; | @@ -17,7 +19,10 @@ import java.util.Map; | ||
| 17 | public class LocationServiceImp implements LocationService { | 19 | public class LocationServiceImp implements LocationService { |
| 18 | 20 | ||
| 19 | @Autowired | 21 | @Autowired |
| 20 | - private LocationMapper locationMapper; | 22 | + LocationMapper locationMapper; |
| 23 | + | ||
| 24 | + @Autowired | ||
| 25 | + ElectricityMeterMapper electricityMeterMapper; | ||
| 21 | 26 | ||
| 22 | @Override | 27 | @Override |
| 23 | public List userPayList(String roomNumber) { | 28 | public List userPayList(String roomNumber) { |
| @@ -58,13 +63,18 @@ public class LocationServiceImp implements LocationService { | @@ -58,13 +63,18 @@ public class LocationServiceImp implements LocationService { | ||
| 58 | } | 63 | } |
| 59 | } | 64 | } |
| 60 | /** | 65 | /** |
| 61 | - * 电费查询 | 66 | + * 电费查询 通过房间号查询设备id |
| 62 | */ | 67 | */ |
| 63 | -// ElectricityMeterServiceImp electricityMeterServiceImp = new ElectricityMeterServiceImp(); | ||
| 64 | -// // 获取 设备id 通电状态 余额 | ||
| 65 | -// Map<String, Object> electricityMap = electricityMeterServiceImp.electricityInfo(roomNumber); | ||
| 66 | -// | ||
| 67 | -// list.add(electricityMap); | 68 | + String eeId = locationMapper.eeId(roomNumber); |
| 69 | + | ||
| 70 | + ElectricityMeter electricityMeter = electricityMeterMapper.selectByPrimaryKey(eeId); | ||
| 71 | + Map<String, Object> eeMap = new HashMap<>(); | ||
| 72 | + if (electricityMeter != null){ | ||
| 73 | + eeMap.put("deviceId", electricityMeter.getDeviceId()); | ||
| 74 | + eeMap.put("balance", electricityMeter.getBalance()); | ||
| 75 | + eeMap.put("wmId", ""); | ||
| 76 | + list.add(eeMap); | ||
| 77 | + } | ||
| 68 | return list; | 78 | return list; |
| 69 | } | 79 | } |
| 70 | return null; | 80 | return null; |
| @@ -159,25 +159,46 @@ public class WaterMeterServiceImp implements WaterMeterService { | @@ -159,25 +159,46 @@ public class WaterMeterServiceImp implements WaterMeterService { | ||
| 159 | 159 | ||
| 160 | // 请求返回二维码 | 160 | // 请求返回二维码 |
| 161 | @Override | 161 | @Override |
| 162 | - public ResultJson qrCode(String payFees, String wmId, String userId, String realName) throws UnsupportedEncodingException { | 162 | + public ResultJson qrCode(String payFees, String wmId, String userId, String realName, String eeId) throws UnsupportedEncodingException { |
| 163 | ResultJson<Object> resultJson = new ResultJson<>(); | 163 | ResultJson<Object> resultJson = new ResultJson<>(); |
| 164 | // 成功生成水费订单 | 164 | // 成功生成水费订单 |
| 165 | - PayRecords payRecords = payRecords(payFees, wmId, userId, realName); | ||
| 166 | - // 请求返回二维码lujing | ||
| 167 | - String url = QrDemo.orUrl(payRecords.getOrdernumber(), payFees); | ||
| 168 | - | ||
| 169 | - if(!"".equals(url)){ | ||
| 170 | - payRecords.setReamke2(url); | ||
| 171 | - // 返回map 包含订单号 二维码url | ||
| 172 | - Map<String, Object> map = new HashMap<>(); | ||
| 173 | - map.put("url",url); | ||
| 174 | - map.put("orderNumber", payRecords.getOrdernumber()); | ||
| 175 | - resultJson.setData(map); | ||
| 176 | - } | ||
| 177 | - int i = payRecordsMapper.insertSelective(payRecords); | ||
| 178 | - if(i>0){ | ||
| 179 | - resultJson.setCode("200"); | 165 | + if (!"".equals(wmId)){ |
| 166 | + PayRecords payRecords = payRecords(payFees, wmId, userId, realName, ""); | ||
| 167 | + // 请求返回二维码lujing | ||
| 168 | + String url = QrDemo.orUrl(payRecords.getOrdernumber(), payFees); | ||
| 169 | + | ||
| 170 | + if(!"".equals(url)){ | ||
| 171 | + payRecords.setReamke2(url); | ||
| 172 | + // 返回map 包含订单号 二维码url | ||
| 173 | + Map<String, Object> map = new HashMap<>(); | ||
| 174 | + map.put("url",url); | ||
| 175 | + map.put("orderNumber", payRecords.getOrdernumber()); | ||
| 176 | + resultJson.setData(map); | ||
| 177 | + } | ||
| 178 | + int i = payRecordsMapper.insertSelective(payRecords); | ||
| 179 | + if(i>0){ | ||
| 180 | + resultJson.setCode("200"); | ||
| 181 | + } | ||
| 182 | + }else { | ||
| 183 | + | ||
| 184 | + PayRecords payRecords = payRecords(payFees, "", userId, realName, eeId); | ||
| 185 | + // 请求返回二维码lujing | ||
| 186 | + String url = QrDemo.orUrl(payRecords.getOrdernumber(), payFees); | ||
| 187 | + | ||
| 188 | + if(!"".equals(url)){ | ||
| 189 | + payRecords.setReamke2(url); | ||
| 190 | + // 返回map 包含订单号 二维码url | ||
| 191 | + Map<String, Object> map = new HashMap<>(); | ||
| 192 | + map.put("url",url); | ||
| 193 | + map.put("orderNumber", payRecords.getOrdernumber()); | ||
| 194 | + resultJson.setData(map); | ||
| 195 | + } | ||
| 196 | + int i = payRecordsMapper.insertSelective(payRecords); | ||
| 197 | + if(i>0){ | ||
| 198 | + resultJson.setCode("200"); | ||
| 199 | + } | ||
| 180 | } | 200 | } |
| 201 | + | ||
| 181 | return resultJson; | 202 | return resultJson; |
| 182 | } | 203 | } |
| 183 | 204 | ||
| @@ -216,20 +237,28 @@ public class WaterMeterServiceImp implements WaterMeterService { | @@ -216,20 +237,28 @@ public class WaterMeterServiceImp implements WaterMeterService { | ||
| 216 | * @param realName | 237 | * @param realName |
| 217 | * @return | 238 | * @return |
| 218 | */ | 239 | */ |
| 219 | - public PayRecords payRecords(String payFees, String wmId, String userId, String realName){ | 240 | + public PayRecords payRecords(String payFees, String wmId, String userId, String realName, String eeId){ |
| 220 | 241 | ||
| 221 | PayRecords payRecords = new PayRecords(); | 242 | PayRecords payRecords = new PayRecords(); |
| 222 | payRecords.setOrdernumber(AllUtils.getOrderIdByTime()); | 243 | payRecords.setOrdernumber(AllUtils.getOrderIdByTime()); |
| 223 | payRecords.setPayfees(new BigDecimal(payFees)); | 244 | payRecords.setPayfees(new BigDecimal(payFees)); |
| 224 | payRecords.setPaystatus(false); | 245 | payRecords.setPaystatus(false); |
| 225 | - payRecords.setPaytype(false); | 246 | + if (!"".equals(wmId)){ |
| 247 | + payRecords.setPaytype(false); | ||
| 248 | + payRecords.setPaytypeaddress(wmId); | ||
| 249 | + String roomNumber = locationMapper.selectRoomNumber(wmId); | ||
| 250 | + payRecords.setPaylocationname(roomNumber); | ||
| 251 | + }else { | ||
| 252 | + payRecords.setPaytype(true); | ||
| 253 | + payRecords.setPaytypeaddress(eeId); | ||
| 254 | + String roomNumber = locationMapper.selectRoomNumberElectricity(eeId); | ||
| 255 | + payRecords.setPaylocationname(roomNumber); | ||
| 256 | + } | ||
| 226 | payRecords.setReamke1("0"); | 257 | payRecords.setReamke1("0"); |
| 227 | payRecords.setPayuserid(Integer.valueOf(userId)); | 258 | payRecords.setPayuserid(Integer.valueOf(userId)); |
| 228 | payRecords.setPaytime(new Date()); | 259 | payRecords.setPaytime(new Date()); |
| 229 | payRecords.setPayusername(realName); | 260 | payRecords.setPayusername(realName); |
| 230 | - payRecords.setPaytypeaddress(wmId); | ||
| 231 | - String roomNumber = locationMapper.selectRoomNumber(wmId); | ||
| 232 | - payRecords.setPaylocationname(roomNumber); | 261 | + |
| 233 | 262 | ||
| 234 | return payRecords; | 263 | return payRecords; |
| 235 | } | 264 | } |
| 1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
| 3 | +<mapper namespace="com.sunyo.energy.location.dao.ElectricityMeterMapper" > | ||
| 4 | + <resultMap id="BaseResultMap" type="com.sunyo.energy.location.model.ElectricityMeter" > | ||
| 5 | + <id column="device_id" property="deviceId" jdbcType="VARCHAR" /> | ||
| 6 | + <result column="total_energy" property="totalEnergy" jdbcType="DECIMAL" /> | ||
| 7 | + <result column="tip_energy" property="tipEnergy" jdbcType="DECIMAL" /> | ||
| 8 | + <result column="peak_energy" property="peakEnergy" jdbcType="DECIMAL" /> | ||
| 9 | + <result column="valley_energy" property="valleyEnergy" jdbcType="DECIMAL" /> | ||
| 10 | + <result column="flat_energy" property="flatEnergy" jdbcType="DECIMAL" /> | ||
| 11 | + <result column="balance" property="balance" jdbcType="DECIMAL" /> | ||
| 12 | + <result column="acTime" property="actime" jdbcType="TIMESTAMP" /> | ||
| 13 | + <result column="updateTime" property="updatetime" jdbcType="TIMESTAMP" /> | ||
| 14 | + <result column="reamke1" property="reamke1" jdbcType="VARCHAR" /> | ||
| 15 | + <result column="reamke2" property="reamke2" jdbcType="VARCHAR" /> | ||
| 16 | + </resultMap> | ||
| 17 | + <sql id="Base_Column_List" > | ||
| 18 | + device_id, total_energy, tip_energy, peak_energy, valley_energy, flat_energy, balance, | ||
| 19 | + acTime, updateTime, reamke1, reamke2 | ||
| 20 | + </sql> | ||
| 21 | + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > | ||
| 22 | + select | ||
| 23 | + <include refid="Base_Column_List" /> | ||
| 24 | + from electricity_meter | ||
| 25 | + where device_id = #{deviceId,jdbcType=VARCHAR} | ||
| 26 | + </select> | ||
| 27 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > | ||
| 28 | + delete from electricity_meter | ||
| 29 | + where device_id = #{deviceId,jdbcType=VARCHAR} | ||
| 30 | + </delete> | ||
| 31 | + <insert id="insert" parameterType="com.sunyo.energy.location.model.ElectricityMeter" > | ||
| 32 | + insert into electricity_meter (device_id, total_energy, tip_energy, | ||
| 33 | + peak_energy, valley_energy, flat_energy, | ||
| 34 | + balance, acTime, updateTime, | ||
| 35 | + reamke1, reamke2) | ||
| 36 | + values (#{deviceId,jdbcType=VARCHAR}, #{totalEnergy,jdbcType=DECIMAL}, #{tipEnergy,jdbcType=DECIMAL}, | ||
| 37 | + #{peakEnergy,jdbcType=DECIMAL}, #{valleyEnergy,jdbcType=DECIMAL}, #{flatEnergy,jdbcType=DECIMAL}, | ||
| 38 | + #{balance,jdbcType=DECIMAL}, #{actime,jdbcType=TIMESTAMP}, #{updatetime,jdbcType=TIMESTAMP}, | ||
| 39 | + #{reamke1,jdbcType=VARCHAR}, #{reamke2,jdbcType=VARCHAR}) | ||
| 40 | + </insert> | ||
| 41 | + <insert id="insertSelective" parameterType="com.sunyo.energy.location.model.ElectricityMeter" > | ||
| 42 | + insert into electricity_meter | ||
| 43 | + <trim prefix="(" suffix=")" suffixOverrides="," > | ||
| 44 | + <if test="deviceId != null" > | ||
| 45 | + device_id, | ||
| 46 | + </if> | ||
| 47 | + <if test="totalEnergy != null" > | ||
| 48 | + total_energy, | ||
| 49 | + </if> | ||
| 50 | + <if test="tipEnergy != null" > | ||
| 51 | + tip_energy, | ||
| 52 | + </if> | ||
| 53 | + <if test="peakEnergy != null" > | ||
| 54 | + peak_energy, | ||
| 55 | + </if> | ||
| 56 | + <if test="valleyEnergy != null" > | ||
| 57 | + valley_energy, | ||
| 58 | + </if> | ||
| 59 | + <if test="flatEnergy != null" > | ||
| 60 | + flat_energy, | ||
| 61 | + </if> | ||
| 62 | + <if test="balance != null" > | ||
| 63 | + balance, | ||
| 64 | + </if> | ||
| 65 | + <if test="actime != null" > | ||
| 66 | + acTime, | ||
| 67 | + </if> | ||
| 68 | + <if test="updatetime != null" > | ||
| 69 | + updateTime, | ||
| 70 | + </if> | ||
| 71 | + <if test="reamke1 != null" > | ||
| 72 | + reamke1, | ||
| 73 | + </if> | ||
| 74 | + <if test="reamke2 != null" > | ||
| 75 | + reamke2, | ||
| 76 | + </if> | ||
| 77 | + </trim> | ||
| 78 | + <trim prefix="values (" suffix=")" suffixOverrides="," > | ||
| 79 | + <if test="deviceId != null" > | ||
| 80 | + #{deviceId,jdbcType=VARCHAR}, | ||
| 81 | + </if> | ||
| 82 | + <if test="totalEnergy != null" > | ||
| 83 | + #{totalEnergy,jdbcType=DECIMAL}, | ||
| 84 | + </if> | ||
| 85 | + <if test="tipEnergy != null" > | ||
| 86 | + #{tipEnergy,jdbcType=DECIMAL}, | ||
| 87 | + </if> | ||
| 88 | + <if test="peakEnergy != null" > | ||
| 89 | + #{peakEnergy,jdbcType=DECIMAL}, | ||
| 90 | + </if> | ||
| 91 | + <if test="valleyEnergy != null" > | ||
| 92 | + #{valleyEnergy,jdbcType=DECIMAL}, | ||
| 93 | + </if> | ||
| 94 | + <if test="flatEnergy != null" > | ||
| 95 | + #{flatEnergy,jdbcType=DECIMAL}, | ||
| 96 | + </if> | ||
| 97 | + <if test="balance != null" > | ||
| 98 | + #{balance,jdbcType=DECIMAL}, | ||
| 99 | + </if> | ||
| 100 | + <if test="actime != null" > | ||
| 101 | + #{actime,jdbcType=TIMESTAMP}, | ||
| 102 | + </if> | ||
| 103 | + <if test="updatetime != null" > | ||
| 104 | + #{updatetime,jdbcType=TIMESTAMP}, | ||
| 105 | + </if> | ||
| 106 | + <if test="reamke1 != null" > | ||
| 107 | + #{reamke1,jdbcType=VARCHAR}, | ||
| 108 | + </if> | ||
| 109 | + <if test="reamke2 != null" > | ||
| 110 | + #{reamke2,jdbcType=VARCHAR}, | ||
| 111 | + </if> | ||
| 112 | + </trim> | ||
| 113 | + </insert> | ||
| 114 | + <update id="updateByPrimaryKeySelective" parameterType="com.sunyo.energy.location.model.ElectricityMeter" > | ||
| 115 | + update electricity_meter | ||
| 116 | + <set > | ||
| 117 | + <if test="totalEnergy != null" > | ||
| 118 | + total_energy = #{totalEnergy,jdbcType=DECIMAL}, | ||
| 119 | + </if> | ||
| 120 | + <if test="tipEnergy != null" > | ||
| 121 | + tip_energy = #{tipEnergy,jdbcType=DECIMAL}, | ||
| 122 | + </if> | ||
| 123 | + <if test="peakEnergy != null" > | ||
| 124 | + peak_energy = #{peakEnergy,jdbcType=DECIMAL}, | ||
| 125 | + </if> | ||
| 126 | + <if test="valleyEnergy != null" > | ||
| 127 | + valley_energy = #{valleyEnergy,jdbcType=DECIMAL}, | ||
| 128 | + </if> | ||
| 129 | + <if test="flatEnergy != null" > | ||
| 130 | + flat_energy = #{flatEnergy,jdbcType=DECIMAL}, | ||
| 131 | + </if> | ||
| 132 | + <if test="balance != null" > | ||
| 133 | + balance = #{balance,jdbcType=DECIMAL}, | ||
| 134 | + </if> | ||
| 135 | + <if test="actime != null" > | ||
| 136 | + acTime = #{actime,jdbcType=TIMESTAMP}, | ||
| 137 | + </if> | ||
| 138 | + <if test="updatetime != null" > | ||
| 139 | + updateTime = #{updatetime,jdbcType=TIMESTAMP}, | ||
| 140 | + </if> | ||
| 141 | + <if test="reamke1 != null" > | ||
| 142 | + reamke1 = #{reamke1,jdbcType=VARCHAR}, | ||
| 143 | + </if> | ||
| 144 | + <if test="reamke2 != null" > | ||
| 145 | + reamke2 = #{reamke2,jdbcType=VARCHAR}, | ||
| 146 | + </if> | ||
| 147 | + </set> | ||
| 148 | + where device_id = #{deviceId,jdbcType=VARCHAR} | ||
| 149 | + </update> | ||
| 150 | + <update id="updateByPrimaryKey" parameterType="com.sunyo.energy.location.model.ElectricityMeter" > | ||
| 151 | + update electricity_meter | ||
| 152 | + set total_energy = #{totalEnergy,jdbcType=DECIMAL}, | ||
| 153 | + tip_energy = #{tipEnergy,jdbcType=DECIMAL}, | ||
| 154 | + peak_energy = #{peakEnergy,jdbcType=DECIMAL}, | ||
| 155 | + valley_energy = #{valleyEnergy,jdbcType=DECIMAL}, | ||
| 156 | + flat_energy = #{flatEnergy,jdbcType=DECIMAL}, | ||
| 157 | + balance = #{balance,jdbcType=DECIMAL}, | ||
| 158 | + acTime = #{actime,jdbcType=TIMESTAMP}, | ||
| 159 | + updateTime = #{updatetime,jdbcType=TIMESTAMP}, | ||
| 160 | + reamke1 = #{reamke1,jdbcType=VARCHAR}, | ||
| 161 | + reamke2 = #{reamke2,jdbcType=VARCHAR} | ||
| 162 | + where device_id = #{deviceId,jdbcType=VARCHAR} | ||
| 163 | + </update> | ||
| 164 | +</mapper> |
| @@ -59,6 +59,15 @@ | @@ -59,6 +59,15 @@ | ||
| 59 | wm_id = #{value, jdbcType=VARCHAR} | 59 | wm_id = #{value, jdbcType=VARCHAR} |
| 60 | </select> | 60 | </select> |
| 61 | 61 | ||
| 62 | + <select id="selectRoomNumberElectricity" parameterType="java.lang.String" resultType="java.lang.String"> | ||
| 63 | + select | ||
| 64 | + adrName | ||
| 65 | + from | ||
| 66 | + location | ||
| 67 | + where | ||
| 68 | + ee_id = #{value, jdbcType=VARCHAR} | ||
| 69 | + </select> | ||
| 70 | + | ||
| 62 | <select id="countAdrName" resultType="int" parameterType="map"> | 71 | <select id="countAdrName" resultType="int" parameterType="map"> |
| 63 | select count(adrName) from location where adrName = #{adrName, jdbcType=VARCHAR} and parent = #{parent, jdbcType=VARCHAR} | 72 | select count(adrName) from location where adrName = #{adrName, jdbcType=VARCHAR} and parent = #{parent, jdbcType=VARCHAR} |
| 64 | </select> | 73 | </select> |
| @@ -71,6 +80,10 @@ | @@ -71,6 +80,10 @@ | ||
| 71 | select wm_id from location where adrname = #{value} | 80 | select wm_id from location where adrname = #{value} |
| 72 | </select> | 81 | </select> |
| 73 | 82 | ||
| 83 | + <select id="eeId" parameterType="string" resultType="string"> | ||
| 84 | + select ee_id from location where adrname = #{value} | ||
| 85 | + </select> | ||
| 86 | + | ||
| 74 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > | 87 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > |
| 75 | delete from location | 88 | delete from location |
| 76 | where id = #{id,jdbcType=INTEGER} | 89 | where id = #{id,jdbcType=INTEGER} |
| @@ -48,7 +48,11 @@ | @@ -48,7 +48,11 @@ | ||
| 48 | </select> | 48 | </select> |
| 49 | 49 | ||
| 50 | <select id="findOrderNumber" parameterType="string" resultType="string"> | 50 | <select id="findOrderNumber" parameterType="string" resultType="string"> |
| 51 | - select distinct payTypeAddress from pay_records where orderNumber = #{value} | 51 | + select distinct payTypeAddress from pay_records where orderNumber = #{value, jdbcType=VARCHAR} |
| 52 | + </select> | ||
| 53 | + | ||
| 54 | + <select id="selectType" parameterType="string" resultType="boolean"> | ||
| 55 | + select distinct payType from pay_records where orderNumber = #{value, jdbcType=VARCHAR} | ||
| 52 | </select> | 56 | </select> |
| 53 | 57 | ||
| 54 | <update id="deleteByPrimaryKey" parameterType="java.lang.Integer" > | 58 | <update id="deleteByPrimaryKey" parameterType="java.lang.Integer" > |
-
请 注册 或 登录 后发表评论