1
|
package com.sunyo.energy.location.controller;
|
1
|
package com.sunyo.energy.location.controller;
|
2
|
|
2
|
|
3
|
-import com.alibaba.fastjson.JSON;
|
|
|
4
|
import com.alibaba.fastjson.JSONObject;
|
3
|
import com.alibaba.fastjson.JSONObject;
|
5
|
import com.sunyo.energy.location.controller.response.ResultJson;
|
4
|
import com.sunyo.energy.location.controller.response.ResultJson;
|
6
|
import com.sunyo.energy.location.dao.PayRecordsMapper;
|
5
|
import com.sunyo.energy.location.dao.PayRecordsMapper;
|
7
|
import com.sunyo.energy.location.dao.PayResponseMapper;
|
6
|
import com.sunyo.energy.location.dao.PayResponseMapper;
|
|
|
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.PayOrderService;
|
|
|
10
|
import com.sunyo.energy.location.service.WaterMeterService;
|
9
|
import com.sunyo.energy.location.service.WaterMeterService;
|
11
|
-import com.sunyo.energy.location.service.imp.WaterMeterServiceImp;
|
|
|
12
|
import com.sunyo.energy.location.websocket.WebSocketServer;
|
10
|
import com.sunyo.energy.location.websocket.WebSocketServer;
|
13
|
import io.swagger.annotations.ApiOperation;
|
11
|
import io.swagger.annotations.ApiOperation;
|
14
|
import org.springframework.beans.factory.annotation.Autowired;
|
12
|
import org.springframework.beans.factory.annotation.Autowired;
|
15
|
import org.springframework.stereotype.Controller;
|
13
|
import org.springframework.stereotype.Controller;
|
16
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
17
|
import org.springframework.web.bind.annotation.RequestMapping;
|
14
|
import org.springframework.web.bind.annotation.RequestMapping;
|
18
|
import org.springframework.web.bind.annotation.RequestParam;
|
15
|
import org.springframework.web.bind.annotation.RequestParam;
|
19
|
import org.springframework.web.bind.annotation.ResponseBody;
|
16
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
@@ -21,8 +18,6 @@ import org.springframework.web.bind.annotation.ResponseBody; |
|
@@ -21,8 +18,6 @@ import org.springframework.web.bind.annotation.ResponseBody; |
21
|
import java.io.IOException;
|
18
|
import java.io.IOException;
|
22
|
import java.math.BigDecimal;
|
19
|
import java.math.BigDecimal;
|
23
|
import java.util.Date;
|
20
|
import java.util.Date;
|
24
|
-import java.util.HashMap;
|
|
|
25
|
-import java.util.Map;
|
|
|
26
|
import java.util.UUID;
|
21
|
import java.util.UUID;
|
27
|
|
22
|
|
28
|
@Controller
|
23
|
@Controller
|
|
@@ -103,26 +98,52 @@ public class PayRseponeController { |
|
@@ -103,26 +98,52 @@ public class PayRseponeController { |
103
|
int i = payResponseMapperl.insertSelective(payResponse);
|
98
|
int i = payResponseMapperl.insertSelective(payResponse);
|
104
|
if (i>0){
|
99
|
if (i>0){
|
105
|
msg =1;
|
100
|
msg =1;
|
106
|
- // 查询该订单设备编号
|
|
|
107
|
- String orderNumber = payRecordsMapper.findOrderNumber(ORDERID);
|
|
|
108
|
- // 通知充值水费
|
|
|
109
|
- if (!"".equals(orderNumber)){
|
|
|
110
|
- ResultJson resultJson = waterMeterService.payWater(PAYMENT, orderNumber);
|
|
|
111
|
- if ("200".equals(resultJson.getCode())){
|
|
|
112
|
- WebSocketServer webSocketServer = new WebSocketServer();
|
|
|
113
|
- JSONObject jsonObject = new JSONObject();
|
|
|
114
|
- jsonObject.put("orderNumber", ORDERID);
|
|
|
115
|
- jsonObject.put("success", "Y");
|
|
|
116
|
- webSocketServer.broadcast(jsonObject.toJSONString());
|
101
|
+ PayRecords payRecords = new PayRecords();
|
|
|
102
|
+ // 支付类型
|
|
|
103
|
+ if (!"".equals(ACC_TYPE)){
|
|
|
104
|
+ if ("WX".equals(ACC_TYPE)){
|
|
|
105
|
+ payRecords.setPayfesstype(false);
|
117
|
}else {
|
106
|
}else {
|
118
|
- WebSocketServer webSocketServer = new WebSocketServer();
|
|
|
119
|
- JSONObject jsonObject = new JSONObject();
|
|
|
120
|
- jsonObject.put("orderNumber", ORDERID);
|
|
|
121
|
- jsonObject.put("success", "N");
|
|
|
122
|
- webSocketServer.broadcast(jsonObject.toJSONString());
|
107
|
+ payRecords.setPayfesstype(true);
|
123
|
}
|
108
|
}
|
124
|
- }
|
|
|
125
|
|
109
|
|
|
|
110
|
+ }
|
|
|
111
|
+ if ("Y".equals(SUCCESS)){
|
|
|
112
|
+ payRecords.setOrdernumber(ORDERID);
|
|
|
113
|
+ payRecords.setReamke3("1");
|
|
|
114
|
+ }else {
|
|
|
115
|
+ payRecords.setOrdernumber(ORDERID);
|
|
|
116
|
+ payRecords.setReamke3("0");
|
|
|
117
|
+ }
|
|
|
118
|
+ // 修改订单状态
|
|
|
119
|
+ int i1 = payRecordsMapper.updateByPrimaryKey(payRecords);
|
|
|
120
|
+ if (i1>0){
|
|
|
121
|
+ // 查询该订单设备编号
|
|
|
122
|
+ String orderNumber = payRecordsMapper.findOrderNumber(ORDERID);
|
|
|
123
|
+ // 通知充值水费
|
|
|
124
|
+ if (!"".equals(orderNumber)){
|
|
|
125
|
+ ResultJson resultJson = waterMeterService.payWater(PAYMENT, orderNumber);
|
|
|
126
|
+ 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());
|
|
|
132
|
+ }else {
|
|
|
133
|
+ WebSocketServer webSocketServer = new WebSocketServer();
|
|
|
134
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
135
|
+ jsonObject.put("orderNumber", ORDERID);
|
|
|
136
|
+ jsonObject.put("success", "N");
|
|
|
137
|
+ webSocketServer.broadcast(jsonObject.toJSONString());
|
|
|
138
|
+ }
|
|
|
139
|
+ }
|
|
|
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
|
+ }
|
126
|
}
|
147
|
}
|
127
|
return i==1? new ResultJson("200","支付回执信息接受成功"):new ResultJson("500","支付回执信息接受失败");
|
148
|
return i==1? new ResultJson("200","支付回执信息接受成功"):new ResultJson("500","支付回执信息接受失败");
|
128
|
}
|
149
|
}
|