|
@@ -10,7 +10,9 @@ import com.sunyo.energy.location.service.ElectricityMeterService; |
|
@@ -10,7 +10,9 @@ 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;
|
|
|
15
|
+import org.springframework.stereotype.Controller;
|
14
|
import org.springframework.web.bind.annotation.RequestMapping;
|
16
|
import org.springframework.web.bind.annotation.RequestMapping;
|
15
|
import org.springframework.web.bind.annotation.RequestParam;
|
17
|
import org.springframework.web.bind.annotation.RequestParam;
|
16
|
import org.springframework.web.bind.annotation.ResponseBody;
|
18
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
@@ -21,7 +23,9 @@ import java.util.Date; |
|
@@ -21,7 +23,9 @@ import java.util.Date; |
21
|
import java.util.UUID;
|
23
|
import java.util.UUID;
|
22
|
|
24
|
|
23
|
|
25
|
|
|
|
26
|
+@Slf4j
|
24
|
@RequestMapping("/payCode")
|
27
|
@RequestMapping("/payCode")
|
|
|
28
|
+@Controller
|
25
|
public class PayRseponeController {
|
29
|
public class PayRseponeController {
|
26
|
|
30
|
|
27
|
|
31
|
|
|
@@ -79,6 +83,7 @@ public class PayRseponeController { |
|
@@ -79,6 +83,7 @@ public class PayRseponeController { |
79
|
@RequestParam(value = "PAYTYPE", required = false) String PAYTYPE,
|
83
|
@RequestParam(value = "PAYTYPE", required = false) String PAYTYPE,
|
80
|
@RequestParam(value = "SIGN", required = false) String SIGN) throws IOException {
|
84
|
@RequestParam(value = "SIGN", required = false) String SIGN) throws IOException {
|
81
|
|
85
|
|
|
|
86
|
+ log.info("接受建行返回信息");
|
82
|
PayResponse payResponse = new PayResponse();
|
87
|
PayResponse payResponse = new PayResponse();
|
83
|
payResponse.setId(UUID.randomUUID().toString());
|
88
|
payResponse.setId(UUID.randomUUID().toString());
|
84
|
payResponse.setPosid(POSID);
|
89
|
payResponse.setPosid(POSID);
|
|
@@ -98,8 +103,10 @@ public class PayRseponeController { |
|
@@ -98,8 +103,10 @@ public class PayRseponeController { |
98
|
payResponse.setUsrinfo(USRINFO);
|
103
|
payResponse.setUsrinfo(USRINFO);
|
99
|
payResponse.setPaytype(PAYTYPE);
|
104
|
payResponse.setPaytype(PAYTYPE);
|
100
|
payResponse.setSign(SIGN);
|
105
|
payResponse.setSign(SIGN);
|
|
|
106
|
+ try {
|
101
|
int msg = 0;
|
107
|
int msg = 0;
|
102
|
int i = payResponseMapperl.insertSelective(payResponse);
|
108
|
int i = payResponseMapperl.insertSelective(payResponse);
|
|
|
109
|
+ log.info("插入数据库{},信息{}",i, payResponse);
|
103
|
if (i > 0) {
|
110
|
if (i > 0) {
|
104
|
msg = 1;
|
111
|
msg = 1;
|
105
|
PayRecords payRecords = new PayRecords();
|
112
|
PayRecords payRecords = new PayRecords();
|
|
@@ -119,6 +126,10 @@ public class PayRseponeController { |
|
@@ -119,6 +126,10 @@ public class PayRseponeController { |
119
|
payRecords.setOrdernumber(ORDERID);
|
126
|
payRecords.setOrdernumber(ORDERID);
|
120
|
payRecords.setReamke3("0");
|
127
|
payRecords.setReamke3("0");
|
121
|
}
|
128
|
}
|
|
|
129
|
+ /**
|
|
|
130
|
+ * 修改订单支付状态
|
|
|
131
|
+ */
|
|
|
132
|
+ payRecordsMapper.updateOrderStatus(payRecords);
|
122
|
|
133
|
|
123
|
// 查询是水还是电
|
134
|
// 查询是水还是电
|
124
|
boolean selectType = payRecordsMapper.selectType(ORDERID);
|
135
|
boolean selectType = payRecordsMapper.selectType(ORDERID);
|
|
@@ -129,14 +140,19 @@ public class PayRseponeController { |
|
@@ -129,14 +140,19 @@ public class PayRseponeController { |
129
|
// 通知充值电费
|
140
|
// 通知充值电费
|
130
|
int eeResult = electricityMeterService.rechargeDevices(eeId, PAYMENT, "0", ORDERID);
|
141
|
int eeResult = electricityMeterService.rechargeDevices(eeId, PAYMENT, "0", ORDERID);
|
131
|
if (eeResult > 0) {
|
142
|
if (eeResult > 0) {
|
132
|
- // 修改订单状态
|
143
|
+ log.info("电表信息充值成功{}",eeResult);
|
|
|
144
|
+ /**
|
|
|
145
|
+ * 修改电表充值状态
|
|
|
146
|
+ */
|
133
|
int i1 = payRecordsMapper.updateByPrimaryKey(payRecords);
|
147
|
int i1 = payRecordsMapper.updateByPrimaryKey(payRecords);
|
|
|
148
|
+ log.info("修改电表订单状态{}, 修改信息{}", i1, payRecords);
|
134
|
if (i1 > 0) {
|
149
|
if (i1 > 0) {
|
135
|
WebSocketServer webSocketServer = new WebSocketServer();
|
150
|
WebSocketServer webSocketServer = new WebSocketServer();
|
136
|
JSONObject jsonObject = new JSONObject();
|
151
|
JSONObject jsonObject = new JSONObject();
|
137
|
jsonObject.put("orderNumber", ORDERID);
|
152
|
jsonObject.put("orderNumber", ORDERID);
|
138
|
jsonObject.put("success", "Y");
|
153
|
jsonObject.put("success", "Y");
|
139
|
webSocketServer.broadcast(jsonObject.toJSONString());
|
154
|
webSocketServer.broadcast(jsonObject.toJSONString());
|
|
|
155
|
+ log.info("通知前端消息结果");
|
140
|
} else {
|
156
|
} else {
|
141
|
WebSocketServer webSocketServer = new WebSocketServer();
|
157
|
WebSocketServer webSocketServer = new WebSocketServer();
|
142
|
JSONObject jsonObject = new JSONObject();
|
158
|
JSONObject jsonObject = new JSONObject();
|
|
@@ -159,14 +175,20 @@ public class PayRseponeController { |
|
@@ -159,14 +175,20 @@ public class PayRseponeController { |
159
|
if (!"".equals(wmId)) {
|
175
|
if (!"".equals(wmId)) {
|
160
|
ResultJson resultJson = waterMeterService.payWater(PAYMENT, wmId);
|
176
|
ResultJson resultJson = waterMeterService.payWater(PAYMENT, wmId);
|
161
|
if ("200".equals(resultJson.getCode())) {
|
177
|
if ("200".equals(resultJson.getCode())) {
|
162
|
- // 修改订单状态
|
178
|
+ log.info("水表信息充值成功{}",resultJson.getCode());
|
|
|
179
|
+ /**
|
|
|
180
|
+ * 修改订单充值状态
|
|
|
181
|
+ */
|
163
|
int i1 = payRecordsMapper.updateByPrimaryKey(payRecords);
|
182
|
int i1 = payRecordsMapper.updateByPrimaryKey(payRecords);
|
|
|
183
|
+ log.info("修改水表订单状态{}, 修改信息{}", i1, payRecords);
|
164
|
if (i1 > 0) {
|
184
|
if (i1 > 0) {
|
|
|
185
|
+
|
165
|
WebSocketServer webSocketServer = new WebSocketServer();
|
186
|
WebSocketServer webSocketServer = new WebSocketServer();
|
166
|
JSONObject jsonObject = new JSONObject();
|
187
|
JSONObject jsonObject = new JSONObject();
|
167
|
jsonObject.put("orderNumber", ORDERID);
|
188
|
jsonObject.put("orderNumber", ORDERID);
|
168
|
jsonObject.put("success", "Y");
|
189
|
jsonObject.put("success", "Y");
|
169
|
webSocketServer.broadcast(jsonObject.toJSONString());
|
190
|
webSocketServer.broadcast(jsonObject.toJSONString());
|
|
|
191
|
+ log.info("通知前端消息结果");
|
170
|
} else {
|
192
|
} else {
|
171
|
WebSocketServer webSocketServer = new WebSocketServer();
|
193
|
WebSocketServer webSocketServer = new WebSocketServer();
|
172
|
JSONObject jsonObject = new JSONObject();
|
194
|
JSONObject jsonObject = new JSONObject();
|
|
@@ -186,6 +208,11 @@ public class PayRseponeController { |
|
@@ -186,6 +208,11 @@ public class PayRseponeController { |
186
|
|
208
|
|
187
|
}
|
209
|
}
|
188
|
return i == 1 ? new ResultJson("200", "支付回执信息接受成功") : new ResultJson("500", "支付回执信息接受失败");
|
210
|
return i == 1 ? new ResultJson("200", "支付回执信息接受成功") : new ResultJson("500", "支付回执信息接受失败");
|
|
|
211
|
+ }catch (Exception e){
|
|
|
212
|
+ e.printStackTrace();
|
|
|
213
|
+ log.info("系统异常-----------");
|
|
|
214
|
+ return null;
|
|
|
215
|
+ }
|
189
|
}
|
216
|
}
|
190
|
|
217
|
|
191
|
} |
218
|
} |