正在显示
9 个修改的文件
包含
224 行增加
和
105 行删除
| @@ -5,7 +5,7 @@ docker: | @@ -5,7 +5,7 @@ docker: | ||
| 5 | server: | 5 | server: |
| 6 | ip: 192.168.1.63 | 6 | ip: 192.168.1.63 |
| 7 | server: | 7 | server: |
| 8 | - port: 10003 | 8 | + port: 10004 |
| 9 | # servlet: | 9 | # servlet: |
| 10 | # context-path: ${SERVER_CONTEXTPATH:} | 10 | # context-path: ${SERVER_CONTEXTPATH:} |
| 11 | spring: | 11 | spring: |
| @@ -182,4 +182,26 @@ eeUrl: | @@ -182,4 +182,26 @@ eeUrl: | ||
| 182 | #获取设备跟公寓信息 | 182 | #获取设备跟公寓信息 |
| 183 | # getRoomAndDeviceUrl: "http://10.5.10.102:8000/api/emcs/getRoomAndDevice" | 183 | # getRoomAndDeviceUrl: "http://10.5.10.102:8000/api/emcs/getRoomAndDevice" |
| 184 | getRoomAndDeviceUrl: "http://192.168.1.7:18080/api/emcs/getRoomAndDevice" | 184 | getRoomAndDeviceUrl: "http://192.168.1.7:18080/api/emcs/getRoomAndDevice" |
| 185 | +payInfo: | ||
| 186 | + #商户代码 | ||
| 187 | + merchantid: "105001453995827" | ||
| 188 | + #商户柜台代码 | ||
| 189 | + posid: "031575220" | ||
| 190 | + #分行代码 | ||
| 191 | + branchid: "410000000" | ||
| 192 | + #交易码 | ||
| 193 | + txcode: "530550" | ||
| 194 | + #应柜台的公钥后30位 | ||
| 195 | + pub32tr2: "8578d1cd9340dba556126a71020111" | ||
| 196 | + | ||
| 197 | +# #商户代码 | ||
| 198 | +# merchantid: "105000045820502" | ||
| 199 | +# #商户柜台代码 | ||
| 200 | +# posid: "049347762" | ||
| 201 | +# #分行代码 | ||
| 202 | +# branchid: "410000000" | ||
| 203 | +# #交易码 | ||
| 204 | +# txcode: "530550" | ||
| 205 | +# #应柜台的公钥后30位 | ||
| 206 | +# pub32tr2: "1c99bca545a2baf6bed0637b020111" | ||
| 185 | 207 |
| 1 | package com.sunyo.energy.location.controller; | 1 | package com.sunyo.energy.location.controller; |
| 2 | 2 | ||
| 3 | import com.github.pagehelper.PageInfo; | 3 | import com.github.pagehelper.PageInfo; |
| 4 | +import com.google.gson.internal.$Gson$Preconditions; | ||
| 4 | import com.sunyo.energy.location.controller.response.ResultJson; | 5 | import com.sunyo.energy.location.controller.response.ResultJson; |
| 6 | +import com.sunyo.energy.location.dao.LocationMapper; | ||
| 7 | +import com.sunyo.energy.location.dao.PayRecordsMapper; | ||
| 8 | +import com.sunyo.energy.location.model.Location; | ||
| 5 | import com.sunyo.energy.location.model.PayRecords; | 9 | import com.sunyo.energy.location.model.PayRecords; |
| 10 | +import com.sunyo.energy.location.service.ElectricityMeterService; | ||
| 6 | import com.sunyo.energy.location.service.PayOrderService; | 11 | import com.sunyo.energy.location.service.PayOrderService; |
| 12 | +import com.sunyo.energy.location.service.WaterMeterService; | ||
| 7 | import io.swagger.annotations.Api; | 13 | import io.swagger.annotations.Api; |
| 8 | import io.swagger.annotations.ApiOperation; | 14 | import io.swagger.annotations.ApiOperation; |
| 9 | import io.swagger.models.auth.In; | 15 | import io.swagger.models.auth.In; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 17 | +import org.springframework.util.StringUtils; | ||
| 11 | import org.springframework.web.bind.annotation.*; | 18 | import org.springframework.web.bind.annotation.*; |
| 12 | 19 | ||
| 13 | /** | 20 | /** |
| @@ -18,9 +25,21 @@ import org.springframework.web.bind.annotation.*; | @@ -18,9 +25,21 @@ import org.springframework.web.bind.annotation.*; | ||
| 18 | @RestController | 25 | @RestController |
| 19 | @RequestMapping("/order") | 26 | @RequestMapping("/order") |
| 20 | public class PayOrderController { | 27 | public class PayOrderController { |
| 28 | + | ||
| 21 | @Autowired | 29 | @Autowired |
| 22 | PayOrderService payOrderService; | 30 | PayOrderService payOrderService; |
| 23 | 31 | ||
| 32 | + @Autowired | ||
| 33 | + PayRecordsMapper payRecordsMapper; | ||
| 34 | + | ||
| 35 | + @Autowired | ||
| 36 | + ElectricityMeterService electricityMeterService; | ||
| 37 | + | ||
| 38 | + @Autowired | ||
| 39 | + private WaterMeterService waterMeterService; | ||
| 40 | + | ||
| 41 | + @Autowired | ||
| 42 | + private LocationMapper locationMapper; | ||
| 24 | 43 | ||
| 25 | @ApiOperation(value = "查询缴费订单") | 44 | @ApiOperation(value = "查询缴费订单") |
| 26 | @RequestMapping("/list") | 45 | @RequestMapping("/list") |
| @@ -69,4 +88,39 @@ public class PayOrderController { | @@ -69,4 +88,39 @@ public class PayOrderController { | ||
| 69 | return mgs == 1 ? new ResultJson("200", "订单信息移出成功") : new ResultJson("500", "订单信息删除失败"); | 88 | return mgs == 1 ? new ResultJson("200", "订单信息移出成功") : new ResultJson("500", "订单信息删除失败"); |
| 70 | } | 89 | } |
| 71 | 90 | ||
| 91 | + @ApiOperation(value = "处理失败订单充值信息") | ||
| 92 | + @PostMapping("/defeatedOrder") | ||
| 93 | + public ResultJson defeatedOrder(@RequestBody PayRecords payRecords){ | ||
| 94 | + | ||
| 95 | + /** | ||
| 96 | + * 查询水电表编号 | ||
| 97 | + */ | ||
| 98 | + Location location = locationMapper.waterId_eleId(payRecords.getPaylocationname()); | ||
| 99 | + /** | ||
| 100 | + * true 为电 false 为水 | ||
| 101 | + */ | ||
| 102 | + if (payRecords.getPaytype()){ | ||
| 103 | + int i = electricityMeterService.rechargeDevices(location.getEeid(), String.valueOf(payRecords.getPayfees()), | ||
| 104 | + "0", payRecords.getOrdernumber()); | ||
| 105 | + if (i == 1){ | ||
| 106 | + payRecords.setReamke3("1"); | ||
| 107 | + int i1 = payRecordsMapper.updateByPrimaryKey(payRecords); | ||
| 108 | + return i1 == 1? new ResultJson("200", "电费充值成功"): new ResultJson("201", "电费充值失败"); | ||
| 109 | + }else { | ||
| 110 | + return new ResultJson("201", "电费充值失败"); | ||
| 111 | + } | ||
| 112 | + }else { | ||
| 113 | + ResultJson resultJson = waterMeterService.payWater(String.valueOf(payRecords.getPayfees()), location.getWmid()); | ||
| 114 | + | ||
| 115 | + if ("200".equals(resultJson.getCode())){ | ||
| 116 | + payRecords.setReamke3("1"); | ||
| 117 | + int i1 = payRecordsMapper.updateByPrimaryKey(payRecords); | ||
| 118 | + return i1 == 1? new ResultJson("200", "水费充值成功"): new ResultJson("201", "水费充值失败"); | ||
| 119 | + }else { | ||
| 120 | + resultJson.setCode("201"); | ||
| 121 | + return resultJson; | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | + | ||
| 72 | } | 126 | } |
| @@ -10,6 +10,7 @@ import com.sunyo.energy.location.service.ElectricityMeterService; | @@ -10,6 +10,7 @@ import com.sunyo.energy.location.service.ElectricityMeterService; | ||
| 10 | import com.sunyo.energy.location.service.WaterMeterService; | 10 | import com.sunyo.energy.location.service.WaterMeterService; |
| 11 | import com.sunyo.energy.location.websocket.WebSocketServer; | 11 | import com.sunyo.energy.location.websocket.WebSocketServer; |
| 12 | import io.swagger.annotations.ApiOperation; | 12 | import io.swagger.annotations.ApiOperation; |
| 13 | +import lombok.extern.slf4j.Slf4j; | ||
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | import org.springframework.stereotype.Controller; | 15 | import org.springframework.stereotype.Controller; |
| 15 | import org.springframework.web.bind.annotation.RequestMapping; | 16 | import org.springframework.web.bind.annotation.RequestMapping; |
| @@ -21,7 +22,7 @@ import java.math.BigDecimal; | @@ -21,7 +22,7 @@ import java.math.BigDecimal; | ||
| 21 | import java.util.Date; | 22 | import java.util.Date; |
| 22 | import java.util.UUID; | 23 | import java.util.UUID; |
| 23 | 24 | ||
| 24 | - | 25 | +@Slf4j |
| 25 | @RequestMapping("/payCode") | 26 | @RequestMapping("/payCode") |
| 26 | public class PayRseponeController { | 27 | public class PayRseponeController { |
| 27 | 28 | ||
| @@ -78,7 +79,7 @@ public class PayRseponeController { | @@ -78,7 +79,7 @@ public class PayRseponeController { | ||
| 78 | @RequestParam(value = "USRMSG", required = false) String USRMSG, | 79 | @RequestParam(value = "USRMSG", required = false) String USRMSG, |
| 79 | @RequestParam(value = "USRINFO", required = false) String USRINFO, | 80 | @RequestParam(value = "USRINFO", required = false) String USRINFO, |
| 80 | @RequestParam(value = "PAYTYPE", required = false) String PAYTYPE, | 81 | @RequestParam(value = "PAYTYPE", required = false) String PAYTYPE, |
| 81 | - @RequestParam(value = "SIGN", required = false) String SIGN) throws IOException { | 82 | + @RequestParam(value = "SIGN", required = false) String SIGN){ |
| 82 | 83 | ||
| 83 | PayResponse payResponse = new PayResponse(); | 84 | PayResponse payResponse = new PayResponse(); |
| 84 | payResponse.setId(UUID.randomUUID().toString()); | 85 | payResponse.setId(UUID.randomUUID().toString()); |
| @@ -99,75 +100,83 @@ public class PayRseponeController { | @@ -99,75 +100,83 @@ public class PayRseponeController { | ||
| 99 | payResponse.setUsrinfo(USRINFO); | 100 | payResponse.setUsrinfo(USRINFO); |
| 100 | payResponse.setPaytype(PAYTYPE); | 101 | payResponse.setPaytype(PAYTYPE); |
| 101 | payResponse.setSign(SIGN); | 102 | payResponse.setSign(SIGN); |
| 102 | - int msg = 0; | ||
| 103 | - int i = payResponseMapperl.insertSelective(payResponse); | ||
| 104 | - if (i > 0) { | ||
| 105 | - msg = 1; | ||
| 106 | - PayRecords payRecords = new PayRecords(); | ||
| 107 | - // 支付类型 | ||
| 108 | - if (!"".equals(ACC_TYPE)) { | ||
| 109 | - if ("WX".equals(ACC_TYPE)) { | ||
| 110 | - payRecords.setPayfesstype(false); | 103 | + try { |
| 104 | + int msg = 0; | ||
| 105 | + int i = payResponseMapperl.insertSelective(payResponse); | ||
| 106 | + if (i > 0) { | ||
| 107 | + msg = 1; | ||
| 108 | + PayRecords payRecords = new PayRecords(); | ||
| 109 | + // 支付类型 | ||
| 110 | + if (!"".equals(ACC_TYPE)) { | ||
| 111 | + if ("WX".equals(ACC_TYPE)) { | ||
| 112 | + payRecords.setPayfesstype(false); | ||
| 113 | + } else { | ||
| 114 | + payRecords.setPayfesstype(true); | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + } | ||
| 118 | + if ("Y".equals(SUCCESS)) { | ||
| 119 | + payRecords.setOrdernumber(ORDERID); | ||
| 120 | + payRecords.setReamke3("1"); | ||
| 111 | } else { | 121 | } else { |
| 112 | - payRecords.setPayfesstype(true); | 122 | + payRecords.setOrdernumber(ORDERID); |
| 123 | + payRecords.setReamke3("0"); | ||
| 113 | } | 124 | } |
| 114 | 125 | ||
| 115 | - } | ||
| 116 | - if ("Y".equals(SUCCESS)) { | ||
| 117 | - payRecords.setOrdernumber(ORDERID); | ||
| 118 | - payRecords.setReamke3("1"); | ||
| 119 | - } else { | ||
| 120 | - payRecords.setOrdernumber(ORDERID); | ||
| 121 | - payRecords.setReamke3("0"); | ||
| 122 | - } | ||
| 123 | - | ||
| 124 | - // 查询是水还是电 | ||
| 125 | - boolean selectType = payRecordsMapper.selectType(ORDERID); | ||
| 126 | - if (selectType) { | ||
| 127 | - // 查询该订单设备编号 | ||
| 128 | - String eeId = payRecordsMapper.findOrderNumber(ORDERID); | ||
| 129 | - if (!"".equals(eeId)) { | ||
| 130 | - // 通知充值电费 | ||
| 131 | - int eeResult = electricityMeterService.rechargeDevices(eeId, PAYMENT, "0", ORDERID); | ||
| 132 | - if (eeResult > 0) { | ||
| 133 | - // 修改订单状态 | ||
| 134 | - int i1 = payRecordsMapper.updateByPrimaryKey(payRecords); | ||
| 135 | - if (i1 > 0) { | ||
| 136 | - WebSocketServer webSocketServer = new WebSocketServer(); | ||
| 137 | - JSONObject jsonObject = new JSONObject(); | ||
| 138 | - jsonObject.put("orderNumber", ORDERID); | ||
| 139 | - jsonObject.put("success", "Y"); | ||
| 140 | - webSocketServer.broadcast(jsonObject.toJSONString()); | 126 | + // 查询是水还是电 |
| 127 | + boolean selectType = payRecordsMapper.selectType(ORDERID); | ||
| 128 | + if (selectType) { | ||
| 129 | + // 查询该订单设备编号 | ||
| 130 | + String eeId = payRecordsMapper.findOrderNumber(ORDERID); | ||
| 131 | + if (!"".equals(eeId)) { | ||
| 132 | + // 通知充值电费 | ||
| 133 | + int eeResult = electricityMeterService.rechargeDevices(eeId, PAYMENT, "0", ORDERID); | ||
| 134 | + if (eeResult > 0) { | ||
| 135 | + // 修改订单状态 | ||
| 136 | + int i1 = payRecordsMapper.updateByPrimaryKey(payRecords); | ||
| 137 | + if (i1 > 0) { | ||
| 138 | + WebSocketServer webSocketServer = new WebSocketServer(); | ||
| 139 | + JSONObject jsonObject = new JSONObject(); | ||
| 140 | + jsonObject.put("orderNumber", ORDERID); | ||
| 141 | + jsonObject.put("success", "Y"); | ||
| 142 | + webSocketServer.broadcast(jsonObject.toJSONString()); | ||
| 143 | + } else { | ||
| 144 | + WebSocketServer webSocketServer = new WebSocketServer(); | ||
| 145 | + JSONObject jsonObject = new JSONObject(); | ||
| 146 | + jsonObject.put("orderNumber", ORDERID); | ||
| 147 | + jsonObject.put("success", "N"); | ||
| 148 | + webSocketServer.broadcast(jsonObject.toJSONString()); | ||
| 149 | + } | ||
| 141 | } else { | 150 | } else { |
| 142 | WebSocketServer webSocketServer = new WebSocketServer(); | 151 | WebSocketServer webSocketServer = new WebSocketServer(); |
| 143 | JSONObject jsonObject = new JSONObject(); | 152 | JSONObject jsonObject = new JSONObject(); |
| 144 | jsonObject.put("orderNumber", ORDERID); | 153 | jsonObject.put("orderNumber", ORDERID); |
| 145 | - jsonObject.put("success", "N"); | 154 | + jsonObject.put("success", "S"); |
| 146 | webSocketServer.broadcast(jsonObject.toJSONString()); | 155 | webSocketServer.broadcast(jsonObject.toJSONString()); |
| 147 | } | 156 | } |
| 148 | - } else { | ||
| 149 | - WebSocketServer webSocketServer = new WebSocketServer(); | ||
| 150 | - JSONObject jsonObject = new JSONObject(); | ||
| 151 | - jsonObject.put("orderNumber", ORDERID); | ||
| 152 | - jsonObject.put("success", "S"); | ||
| 153 | - webSocketServer.broadcast(jsonObject.toJSONString()); | ||
| 154 | } | 157 | } |
| 155 | - } | ||
| 156 | - } else { | ||
| 157 | - // 查询该订单设备编号 | ||
| 158 | - String wmId = payRecordsMapper.findOrderNumber(ORDERID); | ||
| 159 | - // 通知充值水费 | ||
| 160 | - if (!"".equals(wmId)) { | ||
| 161 | - ResultJson resultJson = waterMeterService.payWater(PAYMENT, wmId); | ||
| 162 | - if ("200".equals(resultJson.getCode())) { | ||
| 163 | - // 修改订单状态 | ||
| 164 | - int i1 = payRecordsMapper.updateByPrimaryKey(payRecords); | ||
| 165 | - if (i1 > 0) { | ||
| 166 | - WebSocketServer webSocketServer = new WebSocketServer(); | ||
| 167 | - JSONObject jsonObject = new JSONObject(); | ||
| 168 | - jsonObject.put("orderNumber", ORDERID); | ||
| 169 | - jsonObject.put("success", "Y"); | ||
| 170 | - webSocketServer.broadcast(jsonObject.toJSONString()); | 158 | + } else { |
| 159 | + // 查询该订单设备编号 | ||
| 160 | + String wmId = payRecordsMapper.findOrderNumber(ORDERID); | ||
| 161 | + // 通知充值水费 | ||
| 162 | + if (!"".equals(wmId)) { | ||
| 163 | + ResultJson resultJson = waterMeterService.payWater(PAYMENT, wmId); | ||
| 164 | + if ("200".equals(resultJson.getCode())) { | ||
| 165 | + // 修改订单状态 | ||
| 166 | + int i1 = payRecordsMapper.updateByPrimaryKey(payRecords); | ||
| 167 | + if (i1 > 0) { | ||
| 168 | + WebSocketServer webSocketServer = new WebSocketServer(); | ||
| 169 | + JSONObject jsonObject = new JSONObject(); | ||
| 170 | + jsonObject.put("orderNumber", ORDERID); | ||
| 171 | + jsonObject.put("success", "Y"); | ||
| 172 | + webSocketServer.broadcast(jsonObject.toJSONString()); | ||
| 173 | + } else { | ||
| 174 | + WebSocketServer webSocketServer = new WebSocketServer(); | ||
| 175 | + JSONObject jsonObject = new JSONObject(); | ||
| 176 | + jsonObject.put("orderNumber", ORDERID); | ||
| 177 | + jsonObject.put("success", "N"); | ||
| 178 | + webSocketServer.broadcast(jsonObject.toJSONString()); | ||
| 179 | + } | ||
| 171 | } else { | 180 | } else { |
| 172 | WebSocketServer webSocketServer = new WebSocketServer(); | 181 | WebSocketServer webSocketServer = new WebSocketServer(); |
| 173 | JSONObject jsonObject = new JSONObject(); | 182 | JSONObject jsonObject = new JSONObject(); |
| @@ -175,18 +184,17 @@ public class PayRseponeController { | @@ -175,18 +184,17 @@ public class PayRseponeController { | ||
| 175 | jsonObject.put("success", "N"); | 184 | jsonObject.put("success", "N"); |
| 176 | webSocketServer.broadcast(jsonObject.toJSONString()); | 185 | webSocketServer.broadcast(jsonObject.toJSONString()); |
| 177 | } | 186 | } |
| 178 | - } else { | ||
| 179 | - WebSocketServer webSocketServer = new WebSocketServer(); | ||
| 180 | - JSONObject jsonObject = new JSONObject(); | ||
| 181 | - jsonObject.put("orderNumber", ORDERID); | ||
| 182 | - jsonObject.put("success", "N"); | ||
| 183 | - webSocketServer.broadcast(jsonObject.toJSONString()); | ||
| 184 | } | 187 | } |
| 185 | } | 188 | } |
| 186 | - } | ||
| 187 | 189 | ||
| 190 | + } | ||
| 191 | + return i == 1 ? new ResultJson("200", "支付回执信息接受成功") : new ResultJson("500", "支付回执信息接受失败"); | ||
| 192 | + }catch (Exception e){ | ||
| 193 | + e.printStackTrace(); | ||
| 194 | + log.info("系统异常--------------------"); | ||
| 195 | + return null; | ||
| 188 | } | 196 | } |
| 189 | - return i == 1 ? new ResultJson("200", "支付回执信息接受成功") : new ResultJson("500", "支付回执信息接受失败"); | 197 | + |
| 190 | } | 198 | } |
| 191 | 199 | ||
| 192 | } | 200 | } |
| @@ -20,6 +20,8 @@ public interface LocationMapper { | @@ -20,6 +20,8 @@ public interface LocationMapper { | ||
| 20 | 20 | ||
| 21 | List<Location> selectAllAdrName(String adrName); | 21 | List<Location> selectAllAdrName(String adrName); |
| 22 | 22 | ||
| 23 | + Location waterId_eleId(String adrName); | ||
| 24 | + | ||
| 23 | int updateByPrimaryKeySelective(Location record); | 25 | int updateByPrimaryKeySelective(Location record); |
| 24 | 26 | ||
| 25 | int updateByPrimaryKey(Location record); | 27 | int updateByPrimaryKey(Location record); |
| @@ -6,33 +6,48 @@ import java.util.HashMap; | @@ -6,33 +6,48 @@ import java.util.HashMap; | ||
| 6 | import java.util.Map; | 6 | import java.util.Map; |
| 7 | 7 | ||
| 8 | import com.google.gson.Gson; | 8 | import com.google.gson.Gson; |
| 9 | -import com.google.gson.JsonArray; | ||
| 10 | -import com.google.gson.JsonObject; | ||
| 11 | -import com.sunyo.energy.location.model.WaterMeter; | ||
| 12 | import net.sf.json.JSONObject; | 9 | import net.sf.json.JSONObject; |
| 13 | -import net.sf.json.util.JSONUtils; | ||
| 14 | -import springfox.documentation.spring.web.json.Json; | 10 | +import org.springframework.beans.factory.annotation.Value; |
| 11 | +import org.springframework.stereotype.Controller; | ||
| 15 | 12 | ||
| 16 | public class QrDemo { | 13 | public class QrDemo { |
| 17 | 14 | ||
| 18 | 15 | ||
| 19 | - public static String orUrl(String orderId, String payMent) throws UnsupportedEncodingException { | 16 | + private String MERCHANTIDS; |
| 17 | + | ||
| 18 | + private String POSIDS; | ||
| 19 | + | ||
| 20 | + private String BRANCHIDS; | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + private String TXCODES; | ||
| 24 | + | ||
| 25 | + | ||
| 26 | + private String PUB32TR2S; | ||
| 27 | + | ||
| 28 | + public QrDemo(String MERCHANTIDS, String POSIDS, String BRANCHIDS, String TXCODES, String PUB32TR2S) { | ||
| 29 | + this.MERCHANTIDS = MERCHANTIDS; | ||
| 30 | + this.POSIDS = POSIDS; | ||
| 31 | + this.BRANCHIDS = BRANCHIDS; | ||
| 32 | + this.TXCODES = TXCODES; | ||
| 33 | + this.PUB32TR2S = PUB32TR2S; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + | ||
| 37 | + public String orUrl(String orderId, String payMent) throws UnsupportedEncodingException { | ||
| 20 | String bankURL = "https://ibsbjstar.ccb.com.cn/CCBIS/ccbMain"; | 38 | String bankURL = "https://ibsbjstar.ccb.com.cn/CCBIS/ccbMain"; |
| 21 | /** | 39 | /** |
| 22 | * 商户代码 | 40 | * 商户代码 |
| 23 | */ | 41 | */ |
| 24 | - String MERCHANTID = "105000045820502"; | ||
| 25 | -// String MERCHANTID = "105001453995827"; | 42 | + String MERCHANTID = MERCHANTIDS; |
| 26 | /** | 43 | /** |
| 27 | * 商户柜台代码 | 44 | * 商户柜台代码 |
| 28 | */ | 45 | */ |
| 29 | - String POSID = "049347762"; | ||
| 30 | -// String POSID = "031575220"; | 46 | + String POSID = POSIDS; |
| 31 | /** | 47 | /** |
| 32 | * 分行代码 | 48 | * 分行代码 |
| 33 | */ | 49 | */ |
| 34 | -// String BRANCHID = "410803805"; | ||
| 35 | - String BRANCHID = "410000000"; | 50 | + String BRANCHID = BRANCHIDS; |
| 36 | /** | 51 | /** |
| 37 | * 货币种类 01 人民币 只支持人民币 | 52 | * 货币种类 01 人民币 只支持人民币 |
| 38 | */ | 53 | */ |
| @@ -40,7 +55,7 @@ public class QrDemo { | @@ -40,7 +55,7 @@ public class QrDemo { | ||
| 40 | /** | 55 | /** |
| 41 | * 交易码 | 56 | * 交易码 |
| 42 | */ | 57 | */ |
| 43 | - String TXCODE = "530550"; | 58 | + String TXCODE = TXCODES; |
| 44 | String REMARK1 = ""; | 59 | String REMARK1 = ""; |
| 45 | String REMARK2 = ""; | 60 | String REMARK2 = ""; |
| 46 | /** | 61 | /** |
| @@ -51,10 +66,9 @@ public class QrDemo { | @@ -51,10 +66,9 @@ public class QrDemo { | ||
| 51 | /** | 66 | /** |
| 52 | * 应柜台的公钥后30位 | 67 | * 应柜台的公钥后30位 |
| 53 | */ | 68 | */ |
| 54 | - String PUB32TR2 = "57b3055539f4925efaf9dacb020111"; | ||
| 55 | -// String PUB32TR2= "8578d1cd9340dba556126a71020111"; | 69 | + String PUB32TR2 = PUB32TR2S; |
| 56 | 70 | ||
| 57 | - StringBuffer tmp = new StringBuffer(); //ÑéÇ©×Ö¶Î | 71 | + StringBuffer tmp = new StringBuffer(); |
| 58 | tmp.append("MERCHANTID="); | 72 | tmp.append("MERCHANTID="); |
| 59 | tmp.append(MERCHANTID); | 73 | tmp.append(MERCHANTID); |
| 60 | tmp.append("&POSID="); | 74 | tmp.append("&POSID="); |
| @@ -81,7 +95,7 @@ public class QrDemo { | @@ -81,7 +95,7 @@ public class QrDemo { | ||
| 81 | tmp.append(PUB32TR2); | 95 | tmp.append(PUB32TR2); |
| 82 | 96 | ||
| 83 | Map map = new HashMap(); | 97 | Map map = new HashMap(); |
| 84 | - map.put("CCB_IBSVersion", "V6"); //±ØÊäÏî | 98 | + map.put("CCB_IBSVersion", "V6"); |
| 85 | map.put("MERCHANTID", MERCHANTID); | 99 | map.put("MERCHANTID", MERCHANTID); |
| 86 | map.put("BRANCHID", BRANCHID); | 100 | map.put("BRANCHID", BRANCHID); |
| 87 | map.put("POSID", POSID); | 101 | map.put("POSID", POSID); |
| @@ -39,18 +39,18 @@ public class LocationServiceImp implements LocationService { | @@ -39,18 +39,18 @@ public class LocationServiceImp implements LocationService { | ||
| 39 | Map<String, Object> thisLocalityWaterMap = locationMapper.userPayList(roomNumber); | 39 | Map<String, Object> thisLocalityWaterMap = locationMapper.userPayList(roomNumber); |
| 40 | Map<String, Object> distanceWaterMap = new HashMap<>(); | 40 | Map<String, Object> distanceWaterMap = new HashMap<>(); |
| 41 | // 是否为null 为null则去线上查询 | 41 | // 是否为null 为null则去线上查询 |
| 42 | - if (thisLocalityWaterMap != null) { | ||
| 43 | - if (!StringUtils.isEmpty(thisLocalityWaterMap.get("wmSacc").toString()) && !StringUtils.isEmpty(thisLocalityWaterMap.get("wmLacc").toString())) { | ||
| 44 | - // 计算剩余量 充值量 减去 消费量 参数1 减去 参数2 | ||
| 45 | - String subtraction = AllUtils.nubmerSubtraction(thisLocalityWaterMap.get("wmSacc").toString(), thisLocalityWaterMap.get("wmLacc").toString()); | ||
| 46 | - // 余量 | ||
| 47 | - thisLocalityWaterMap.put("subtraction", subtraction); | ||
| 48 | - } | ||
| 49 | - list.add(thisLocalityWaterMap); | ||
| 50 | - } else { | 42 | +// if (thisLocalityWaterMap != null) { |
| 43 | +// if (!StringUtils.isEmpty(thisLocalityWaterMap.get("wmSacc").toString()) && !StringUtils.isEmpty(thisLocalityWaterMap.get("wmLacc").toString())) { | ||
| 44 | +// // 计算剩余量 充值量 减去 消费量 参数1 减去 参数2 | ||
| 45 | +// String subtraction = AllUtils.nubmerSubtraction(thisLocalityWaterMap.get("wmSacc").toString(), thisLocalityWaterMap.get("wmLacc").toString()); | ||
| 46 | +// // 余量 | ||
| 47 | +// thisLocalityWaterMap.put("subtraction", subtraction); | ||
| 48 | +// } | ||
| 49 | +// list.add(thisLocalityWaterMap); | ||
| 50 | +// } else { | ||
| 51 | // 查询该房间号的水表编号 | 51 | // 查询该房间号的水表编号 |
| 52 | String wmId = locationMapper.findWmId(roomNumber); | 52 | String wmId = locationMapper.findWmId(roomNumber); |
| 53 | - if (!"".equals(wmId) && "" != wmId) { | 53 | + if (!"".equals(wmId)) { |
| 54 | Map<String, Object> waterMaps = new HashMap<>(); | 54 | Map<String, Object> waterMaps = new HashMap<>(); |
| 55 | WaterMeterServiceImp waterMeterServiceImp = new WaterMeterServiceImp(); | 55 | WaterMeterServiceImp waterMeterServiceImp = new WaterMeterServiceImp(); |
| 56 | WaterMeter realTime = waterMeterServiceImp.findRealTime(wmId); | 56 | WaterMeter realTime = waterMeterServiceImp.findRealTime(wmId); |
| @@ -62,7 +62,7 @@ public class LocationServiceImp implements LocationService { | @@ -62,7 +62,7 @@ public class LocationServiceImp implements LocationService { | ||
| 62 | distanceWaterMap.put("wmId", wmId); | 62 | distanceWaterMap.put("wmId", wmId); |
| 63 | list.add(distanceWaterMap); | 63 | list.add(distanceWaterMap); |
| 64 | } | 64 | } |
| 65 | - } | 65 | +// } |
| 66 | /** | 66 | /** |
| 67 | * 电费查询 通过房间号查询设备id | 67 | * 电费查询 通过房间号查询设备id |
| 68 | */ | 68 | */ |
| @@ -13,6 +13,7 @@ import com.sunyo.energy.location.service.WaterMeterService; | @@ -13,6 +13,7 @@ import com.sunyo.energy.location.service.WaterMeterService; | ||
| 13 | import com.sunyo.energy.location.utils.AllUtils; | 13 | import com.sunyo.energy.location.utils.AllUtils; |
| 14 | import com.sunyo.energy.location.utils.HttpsUtils; | 14 | import com.sunyo.energy.location.utils.HttpsUtils; |
| 15 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| 16 | +import org.springframework.beans.factory.annotation.Value; | ||
| 16 | import org.springframework.scheduling.annotation.Scheduled; | 17 | import org.springframework.scheduling.annotation.Scheduled; |
| 17 | import org.springframework.stereotype.Service; | 18 | import org.springframework.stereotype.Service; |
| 18 | 19 | ||
| @@ -35,6 +36,21 @@ public class WaterMeterServiceImp implements WaterMeterService { | @@ -35,6 +36,21 @@ public class WaterMeterServiceImp implements WaterMeterService { | ||
| 35 | 36 | ||
| 36 | @Autowired | 37 | @Autowired |
| 37 | private LocationMapper locationMapper; | 38 | private LocationMapper locationMapper; |
| 39 | + | ||
| 40 | + @Value("${payInfo.merchantid}") | ||
| 41 | + private String MERCHANTIDS; | ||
| 42 | + | ||
| 43 | + @Value("${payInfo.posid}") | ||
| 44 | + private String POSIDS; | ||
| 45 | + | ||
| 46 | + @Value("${payInfo.branchid}") | ||
| 47 | + private String BRANCHIDS; | ||
| 48 | + | ||
| 49 | + @Value("${payInfo.txcode}") | ||
| 50 | + private String TXCODES; | ||
| 51 | + | ||
| 52 | + @Value("${payInfo.pub32tr2}") | ||
| 53 | + private String PUB32TR2S; | ||
| 38 | /** | 54 | /** |
| 39 | * 查询所有水表 | 55 | * 查询所有水表 |
| 40 | */ | 56 | */ |
| @@ -163,11 +179,12 @@ public class WaterMeterServiceImp implements WaterMeterService { | @@ -163,11 +179,12 @@ public class WaterMeterServiceImp implements WaterMeterService { | ||
| 163 | @Override | 179 | @Override |
| 164 | public ResultJson qrCode(String payFees, String wmId, String userId, String realName, String eeId) throws UnsupportedEncodingException { | 180 | public ResultJson qrCode(String payFees, String wmId, String userId, String realName, String eeId) throws UnsupportedEncodingException { |
| 165 | ResultJson<Object> resultJson = new ResultJson<>(); | 181 | ResultJson<Object> resultJson = new ResultJson<>(); |
| 182 | + QrDemo qrDemo = new QrDemo(MERCHANTIDS,POSIDS,BRANCHIDS,TXCODES,PUB32TR2S); | ||
| 166 | // 成功生成水费订单 | 183 | // 成功生成水费订单 |
| 167 | if (!"".equals(wmId)) { | 184 | if (!"".equals(wmId)) { |
| 168 | PayRecords payRecords = payRecords(payFees, wmId, userId, realName, ""); | 185 | PayRecords payRecords = payRecords(payFees, wmId, userId, realName, ""); |
| 169 | // 请求返回二维码lujing | 186 | // 请求返回二维码lujing |
| 170 | - String url = QrDemo.orUrl(payRecords.getOrdernumber(), payFees); | 187 | + String url = qrDemo.orUrl(payRecords.getOrdernumber(), payFees); |
| 171 | 188 | ||
| 172 | if (!"".equals(url)) { | 189 | if (!"".equals(url)) { |
| 173 | payRecords.setReamke2(url); | 190 | payRecords.setReamke2(url); |
| @@ -185,7 +202,7 @@ public class WaterMeterServiceImp implements WaterMeterService { | @@ -185,7 +202,7 @@ public class WaterMeterServiceImp implements WaterMeterService { | ||
| 185 | 202 | ||
| 186 | PayRecords payRecords = payRecords(payFees, "", userId, realName, eeId); | 203 | PayRecords payRecords = payRecords(payFees, "", userId, realName, eeId); |
| 187 | // 请求返回二维码lujing | 204 | // 请求返回二维码lujing |
| 188 | - String url = QrDemo.orUrl(payRecords.getOrdernumber(), payFees); | 205 | + String url = qrDemo.orUrl(payRecords.getOrdernumber(), payFees); |
| 189 | 206 | ||
| 190 | if (!"".equals(url)) { | 207 | if (!"".equals(url)) { |
| 191 | payRecords.setReamke2(url); | 208 | payRecords.setReamke2(url); |
| @@ -217,9 +234,8 @@ public class WaterMeterServiceImp implements WaterMeterService { | @@ -217,9 +234,8 @@ public class WaterMeterServiceImp implements WaterMeterService { | ||
| 217 | // 充值最后立方水数值 | 234 | // 充值最后立方水数值 |
| 218 | String s = AllUtils.nubmerDivision(payFees); | 235 | String s = AllUtils.nubmerDivision(payFees); |
| 219 | // 查询累计充值量 | 236 | // 查询累计充值量 |
| 220 | - String oneWmSacc = waterMeterMapper.findOneWmSacc(wmId); | ||
| 221 | - | ||
| 222 | - String allSacc = AllUtils.nubmerAdd(s, oneWmSacc); | 237 | + WaterMeter realTime = findRealTime(wmId); |
| 238 | + String allSacc = AllUtils.nubmerAdd(s, realTime.getWmSacc()); | ||
| 223 | Map<String, Object> datas = new HashMap<>(); | 239 | Map<String, Object> datas = new HashMap<>(); |
| 224 | datas.put("MtId", wmId); | 240 | datas.put("MtId", wmId); |
| 225 | datas.put("Add_sacc", allSacc); | 241 | datas.put("Add_sacc", allSacc); |
| @@ -38,6 +38,10 @@ | @@ -38,6 +38,10 @@ | ||
| 38 | adrName = #{adrname, jdbcType=VARCHAR} | 38 | adrName = #{adrname, jdbcType=VARCHAR} |
| 39 | </select> | 39 | </select> |
| 40 | 40 | ||
| 41 | + <select id="waterId_eleId" resultMap="BaseResultMap" parameterType="string"> | ||
| 42 | + select * from location where adrName = #{adrname, jdbcType=VARCHAR} | ||
| 43 | + </select> | ||
| 44 | + | ||
| 41 | <select id="userPayList" resultType="java.util.HashMap"> | 45 | <select id="userPayList" resultType="java.util.HashMap"> |
| 42 | select | 46 | select |
| 43 | wm.wm_id as wmId, wm.wm_fmstate as wmFmstate, | 47 | wm.wm_id as wmId, wm.wm_fmstate as wmFmstate, |
| @@ -45,7 +45,7 @@ | @@ -45,7 +45,7 @@ | ||
| 45 | and payTime < #{endTime,jdbcType=VARCHAR} | 45 | and payTime < #{endTime,jdbcType=VARCHAR} |
| 46 | </if> | 46 | </if> |
| 47 | <if test="username != '' and username != null"> | 47 | <if test="username != '' and username != null"> |
| 48 | - and payUserName = #{username,jdbcType=VARCHAR} | 48 | + and payLocationName = #{username,jdbcType=VARCHAR} |
| 49 | </if> | 49 | </if> |
| 50 | order by payTime desc | 50 | order by payTime desc |
| 51 | </select> | 51 | </select> |
| @@ -260,7 +260,6 @@ | @@ -260,7 +260,6 @@ | ||
| 260 | <update id="updateByPrimaryKey" parameterType="com.sunyo.energy.location.model.PayRecords"> | 260 | <update id="updateByPrimaryKey" parameterType="com.sunyo.energy.location.model.PayRecords"> |
| 261 | update pay_records | 261 | update pay_records |
| 262 | set | 262 | set |
| 263 | - payStatus = 1, | ||
| 264 | reamke3 = #{reamke3,jdbcType=VARCHAR}, | 263 | reamke3 = #{reamke3,jdbcType=VARCHAR}, |
| 265 | payFessType = #{payfesstype,jdbcType=BIT} | 264 | payFessType = #{payfesstype,jdbcType=BIT} |
| 266 | where orderNumber = #{ordernumber,jdbcType=VARCHAR} | 265 | where orderNumber = #{ordernumber,jdbcType=VARCHAR} |
-
请 注册 或 登录 后发表评论