正在显示
11 个修改的文件
包含
444 行增加
和
28 行删除
@@ -127,7 +127,7 @@ public class PayRseponeController { | @@ -127,7 +127,7 @@ public class PayRseponeController { | ||
127 | String eeId = payRecordsMapper.findOrderNumber(ORDERID); | 127 | String eeId = payRecordsMapper.findOrderNumber(ORDERID); |
128 | if (!"".equals(eeId)){ | 128 | if (!"".equals(eeId)){ |
129 | // 通知充值电费 | 129 | // 通知充值电费 |
130 | - int eeResult = electricityMeterService.rechargeDevices(eeId, PAYMENT, "0"); | 130 | + int eeResult = electricityMeterService.rechargeDevices(eeId, PAYMENT, "0", ORDERID); |
131 | if (eeResult > 0){ | 131 | if (eeResult > 0){ |
132 | // 修改订单状态 | 132 | // 修改订单状态 |
133 | int i1 = payRecordsMapper.updateByPrimaryKey(payRecords); | 133 | int i1 = payRecordsMapper.updateByPrimaryKey(payRecords); |
@@ -144,6 +144,12 @@ public class PayRseponeController { | @@ -144,6 +144,12 @@ public class PayRseponeController { | ||
144 | jsonObject.put("success", "N"); | 144 | jsonObject.put("success", "N"); |
145 | webSocketServer.broadcast(jsonObject.toJSONString()); | 145 | webSocketServer.broadcast(jsonObject.toJSONString()); |
146 | } | 146 | } |
147 | + }else { | ||
148 | + WebSocketServer webSocketServer = new WebSocketServer(); | ||
149 | + JSONObject jsonObject = new JSONObject(); | ||
150 | + jsonObject.put("orderNumber", ORDERID); | ||
151 | + jsonObject.put("success", "S"); | ||
152 | + webSocketServer.broadcast(jsonObject.toJSONString()); | ||
147 | } | 153 | } |
148 | } | 154 | } |
149 | }else { | 155 | }else { |
1 | +package com.sunyo.energy.location.dao; | ||
2 | + | ||
3 | +import com.sunyo.energy.location.model.ElectricityInfo; | ||
4 | + | ||
5 | +import java.util.List; | ||
6 | + | ||
7 | +public interface ElectricityInfoMapper { | ||
8 | + int deleteByPrimaryKey(String orderNumber); | ||
9 | + | ||
10 | + int insert(ElectricityInfo record); | ||
11 | + | ||
12 | + int insertSelective(ElectricityInfo record); | ||
13 | + | ||
14 | + ElectricityInfo selectByPrimaryKey(String orderNumber); | ||
15 | + | ||
16 | + List<ElectricityInfo> selectAll(); | ||
17 | + | ||
18 | + int updateByPrimaryKeySelective(ElectricityInfo record); | ||
19 | + | ||
20 | + int updateByPrimaryKey(ElectricityInfo record); | ||
21 | +} |
@@ -25,4 +25,6 @@ public interface PayRecordsMapper { | @@ -25,4 +25,6 @@ public interface PayRecordsMapper { | ||
25 | String findOrderNumber(String orderId); | 25 | String findOrderNumber(String orderId); |
26 | 26 | ||
27 | boolean selectType(String orderId); | 27 | boolean selectType(String orderId); |
28 | + | ||
29 | + int updateStatus(String orderNumber); | ||
28 | } | 30 | } |
1 | +package com.sunyo.energy.location.model; | ||
2 | + | ||
3 | +import java.math.BigDecimal; | ||
4 | +import java.util.Date; | ||
5 | + | ||
6 | +public class ElectricityInfo { | ||
7 | + private String orderNumber; | ||
8 | + | ||
9 | + private String actionType; | ||
10 | + | ||
11 | + private String deviceId; | ||
12 | + | ||
13 | + private BigDecimal money; | ||
14 | + | ||
15 | + private String ipAddress; | ||
16 | + | ||
17 | + private String secret; | ||
18 | + | ||
19 | + private String status; | ||
20 | + | ||
21 | + private Date opertTime; | ||
22 | + | ||
23 | + private Date editTime; | ||
24 | + | ||
25 | + private String infoStatus; | ||
26 | + | ||
27 | + public String getOrderNumber() { | ||
28 | + return orderNumber; | ||
29 | + } | ||
30 | + | ||
31 | + public void setOrderNumber(String orderNumber) { | ||
32 | + this.orderNumber = orderNumber == null ? null : orderNumber.trim(); | ||
33 | + } | ||
34 | + | ||
35 | + public String getActionType() { | ||
36 | + return actionType; | ||
37 | + } | ||
38 | + | ||
39 | + public void setActionType(String actionType) { | ||
40 | + this.actionType = actionType == null ? null : actionType.trim(); | ||
41 | + } | ||
42 | + | ||
43 | + public String getDeviceId() { | ||
44 | + return deviceId; | ||
45 | + } | ||
46 | + | ||
47 | + public void setDeviceId(String deviceId) { | ||
48 | + this.deviceId = deviceId == null ? null : deviceId.trim(); | ||
49 | + } | ||
50 | + | ||
51 | + public BigDecimal getMoney() { | ||
52 | + return money; | ||
53 | + } | ||
54 | + | ||
55 | + public void setMoney(BigDecimal money) { | ||
56 | + this.money = money; | ||
57 | + } | ||
58 | + | ||
59 | + public String getIpAddress() { | ||
60 | + return ipAddress; | ||
61 | + } | ||
62 | + | ||
63 | + public void setIpAddress(String ipAddress) { | ||
64 | + this.ipAddress = ipAddress == null ? null : ipAddress.trim(); | ||
65 | + } | ||
66 | + | ||
67 | + public String getSecret() { | ||
68 | + return secret; | ||
69 | + } | ||
70 | + | ||
71 | + public void setSecret(String secret) { | ||
72 | + this.secret = secret == null ? null : secret.trim(); | ||
73 | + } | ||
74 | + | ||
75 | + public String getStatus() { | ||
76 | + return status; | ||
77 | + } | ||
78 | + | ||
79 | + public void setStatus(String status) { | ||
80 | + this.status = status == null ? null : status.trim(); | ||
81 | + } | ||
82 | + | ||
83 | + public Date getOpertTime() { | ||
84 | + return opertTime; | ||
85 | + } | ||
86 | + | ||
87 | + public void setOpertTime(Date opertTime) { | ||
88 | + this.opertTime = opertTime; | ||
89 | + } | ||
90 | + | ||
91 | + public Date getEditTime() { | ||
92 | + return editTime; | ||
93 | + } | ||
94 | + | ||
95 | + public void setEditTime(Date editTime) { | ||
96 | + this.editTime = editTime; | ||
97 | + } | ||
98 | + | ||
99 | + public String getInfoStatus() { | ||
100 | + return infoStatus; | ||
101 | + } | ||
102 | + | ||
103 | + public void setInfoStatus(String infoStatus) { | ||
104 | + this.infoStatus = infoStatus == null ? null : infoStatus.trim(); | ||
105 | + } | ||
106 | + | ||
107 | + @Override | ||
108 | + public String toString() { | ||
109 | + return "ElectricityInfo{" + | ||
110 | + "orderNumber='" + orderNumber + '\'' + | ||
111 | + ", actionType='" + actionType + '\'' + | ||
112 | + ", deviceId='" + deviceId + '\'' + | ||
113 | + ", money=" + money + | ||
114 | + ", ipAddress='" + ipAddress + '\'' + | ||
115 | + ", secret='" + secret + '\'' + | ||
116 | + ", status='" + status + '\'' + | ||
117 | + ", opertTime=" + opertTime + | ||
118 | + ", editTime=" + editTime + | ||
119 | + ", infoStatus='" + infoStatus + '\'' + | ||
120 | + '}'; | ||
121 | + } | ||
122 | +} |
1 | +package com.sunyo.energy.location.model; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | + | ||
5 | +/** | ||
6 | + * @author shenhailong | ||
7 | + * <p> | ||
8 | + * 2020/6/4/14:32 | ||
9 | + */ | ||
10 | +@Data | ||
11 | +public class RechargeDevicesResultData { | ||
12 | + | ||
13 | + /** | ||
14 | + * 设备id | ||
15 | + */ | ||
16 | + private String deviceId; | ||
17 | + /** | ||
18 | + * 充值金额 | ||
19 | + */ | ||
20 | + private Number money; | ||
21 | + /** | ||
22 | + * 充值状态 | ||
23 | + */ | ||
24 | + private Boolean success; | ||
25 | + | ||
26 | +} |
1 | +package com.sunyo.energy.location.model; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | + | ||
5 | +import java.util.List; | ||
6 | + | ||
7 | +/** | ||
8 | + * @author shenhailong | ||
9 | + * <p> | ||
10 | + * 2020/6/4/14:29 | ||
11 | + */ | ||
12 | +@Data | ||
13 | +public class RechargeDevicesResultDatas { | ||
14 | + | ||
15 | + private List<RechargeDevicesResultData> datas; | ||
16 | + | ||
17 | +} |
@@ -28,6 +28,6 @@ public interface ElectricityMeterService { | @@ -28,6 +28,6 @@ public interface ElectricityMeterService { | ||
28 | * @param actionType | 28 | * @param actionType |
29 | * @return | 29 | * @return |
30 | */ | 30 | */ |
31 | - int rechargeDevices(String deviceId, String money, String actionType); | 31 | + int rechargeDevices(String deviceId, String money, String actionType, String orderNumber); |
32 | 32 | ||
33 | } | 33 | } |
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.alibaba.fastjson.JSONArray; | ||
5 | -import com.sun.deploy.net.HttpUtils; | ||
6 | -import com.sunyo.energy.location.controller.response.ResultJson; | 4 | +import com.sunyo.energy.location.dao.ElectricityInfoMapper; |
7 | import com.sunyo.energy.location.dao.ElectricityMeterMapper; | 5 | import com.sunyo.energy.location.dao.ElectricityMeterMapper; |
6 | +import com.sunyo.energy.location.dao.PayRecordsMapper; | ||
8 | import com.sunyo.energy.location.model.*; | 7 | import com.sunyo.energy.location.model.*; |
9 | import com.sunyo.energy.location.service.ElectricityMeterService; | 8 | import com.sunyo.energy.location.service.ElectricityMeterService; |
10 | import com.sunyo.energy.location.utils.HttpsUtils; | 9 | import com.sunyo.energy.location.utils.HttpsUtils; |
11 | import com.sunyo.energy.location.utils.Md5Utils; | 10 | import com.sunyo.energy.location.utils.Md5Utils; |
11 | +import lombok.extern.slf4j.Slf4j; | ||
12 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
13 | import org.springframework.beans.factory.annotation.Value; | 13 | import org.springframework.beans.factory.annotation.Value; |
14 | import org.springframework.scheduling.annotation.Scheduled; | 14 | import org.springframework.scheduling.annotation.Scheduled; |
15 | import org.springframework.stereotype.Service; | 15 | import org.springframework.stereotype.Service; |
16 | -import sun.security.provider.MD5; | ||
17 | 16 | ||
18 | -import java.awt.*; | ||
19 | import java.math.BigDecimal; | 17 | import java.math.BigDecimal; |
20 | import java.math.RoundingMode; | 18 | import java.math.RoundingMode; |
21 | import java.util.HashMap; | 19 | import java.util.HashMap; |
22 | import java.util.List; | 20 | import java.util.List; |
23 | import java.util.Map; | 21 | import java.util.Map; |
24 | 22 | ||
23 | +@Slf4j | ||
25 | @Service | 24 | @Service |
26 | public class ElectricityMeterServiceImp implements ElectricityMeterService { | 25 | public class ElectricityMeterServiceImp implements ElectricityMeterService { |
27 | 26 | ||
28 | @Autowired | 27 | @Autowired |
29 | ElectricityMeterMapper electricityMeterMapper; | 28 | ElectricityMeterMapper electricityMeterMapper; |
30 | 29 | ||
31 | - /** | ||
32 | - * 获取房间与设备信息 | ||
33 | - */ | ||
34 | - private final static String electricityUrl = "/api/emcs/getRoomAndDevice"; | ||
35 | - /** | ||
36 | - * 获取所有电表实时通断电状态 | ||
37 | - */ | ||
38 | - private final static String electricityStatus = "/api/emcs/getAllDeviceControlStatus"; | 30 | + @Autowired |
31 | + ElectricityInfoMapper electricityInfoMapper; | ||
32 | + | ||
33 | + @Autowired | ||
34 | + PayRecordsMapper payRecordsMapper; | ||
35 | + | ||
39 | /** | 36 | /** |
40 | * 获取电表实时数据/余额 | 37 | * 获取电表实时数据/余额 |
41 | */ | 38 | */ |
@@ -93,38 +90,94 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | @@ -93,38 +90,94 @@ public class ElectricityMeterServiceImp implements ElectricityMeterService { | ||
93 | } | 90 | } |
94 | 91 | ||
95 | @Override | 92 | @Override |
96 | - public int rechargeDevices(String deviceId, String money, String actionType) { | 93 | + public int rechargeDevices(String deviceId, String money, String actionType, String orderNumber) { |
97 | 94 | ||
98 | - Map<String, Object> map = new HashMap<>(); | ||
99 | - map.put("actionType", actionType); | ||
100 | - map.put("deviceId", deviceId); | ||
101 | - map.put("money", money); | ||
102 | - map.put("ipAddress", ipAddress); | 95 | + Map<String, Object> stringObjectMap = mapCommon(actionType, deviceId, money, ipAddress); |
103 | // 设置secret值 设备id 跟金额 盐 需要进行加密 | 96 | // 设置secret值 设备id 跟金额 盐 需要进行加密 |
104 | BigDecimal bigDecimal = new BigDecimal(money).setScale(2, RoundingMode.HALF_UP); | 97 | BigDecimal bigDecimal = new BigDecimal(money).setScale(2, RoundingMode.HALF_UP); |
105 | String moneyString = String.valueOf(bigDecimal); | 98 | String moneyString = String.valueOf(bigDecimal); |
106 | String secret = Md5Utils.getMD5(deviceId + moneyString + "tiansu", true, 32); | 99 | String secret = Md5Utils.getMD5(deviceId + moneyString + "tiansu", true, 32); |
107 | - map.put("secret", secret); | 100 | + stringObjectMap.put("secret", secret); |
101 | + log.info("电表充值信息{}",stringObjectMap.toString()); | ||
108 | try { | 102 | try { |
109 | - | ||
110 | - String result = HttpsUtils.sendPost(rechargeDevicesUrl, map); | 103 | + String result = HttpsUtils.sendPost(rechargeDevicesUrl, stringObjectMap); |
104 | + log.info("电表充值反馈结果:{}",result); | ||
111 | RechargeDevicesResult rechargeDevicesResult = JSON.parseObject(result, RechargeDevicesResult.class); | 105 | RechargeDevicesResult rechargeDevicesResult = JSON.parseObject(result, RechargeDevicesResult.class); |
112 | - | ||
113 | - if ("0".equals(rechargeDevicesResult.getErrcode())){ | 106 | + List<RechargeDevicesResultData> data = rechargeDevicesResult.getData().getDatas(); |
107 | + Boolean message = null; | ||
108 | + for (RechargeDevicesResultData rechargeDevicesResultData : data){ | ||
109 | + message = rechargeDevicesResultData.getSuccess(); | ||
110 | + } | ||
111 | + if ("0".equals(rechargeDevicesResult.getErrcode()) && message == true){ | ||
112 | + log.info("电表充值成功,充值额度:{}",money); | ||
114 | return 1; | 113 | return 1; |
114 | + }else { | ||
115 | + log.info("电表充值失败,充值额度:{}", money); | ||
116 | + /** | ||
117 | + * 插入临时表 电表接口充值因为硬件问题可能失败 | ||
118 | + */ | ||
119 | + ElectricityInfo electricityInfo = new ElectricityInfo(); | ||
120 | + electricityInfo.setOrderNumber(orderNumber); | ||
121 | + electricityInfo.setActionType(actionType); | ||
122 | + electricityInfo.setDeviceId(deviceId); | ||
123 | + electricityInfo.setMoney(new BigDecimal(money).setScale(2, RoundingMode.HALF_UP)); | ||
124 | + electricityInfo.setIpAddress(ipAddress); | ||
125 | + electricityInfo.setSecret(secret); | ||
126 | + int i = electricityInfoMapper.insertSelective(electricityInfo); | ||
127 | + log.info("插入电表临时表成功:{},插入数据{}", i, electricityInfo); | ||
128 | + return 0; | ||
115 | } | 129 | } |
116 | 130 | ||
117 | }catch (Exception e){ | 131 | }catch (Exception e){ |
118 | e.printStackTrace(); | 132 | e.printStackTrace(); |
133 | + log.error("电表充值失败,充值额度:{}",money); | ||
119 | return 0; | 134 | return 0; |
120 | } | 135 | } |
121 | - return 0; | ||
122 | } | 136 | } |
123 | 137 | ||
124 | public Map<String, Object> eeInfo(String deviceId){ | 138 | public Map<String, Object> eeInfo(String deviceId){ |
125 | Map<String, Object> datas = new HashMap<>(); | 139 | Map<String, Object> datas = new HashMap<>(); |
126 | datas.put("deviceId", deviceId); | 140 | datas.put("deviceId", deviceId); |
127 | - | ||
128 | return datas; | 141 | return datas; |
129 | } | 142 | } |
143 | + | ||
144 | + /** | ||
145 | + * 定时读取电表临时表 发起充值 | ||
146 | + */ | ||
147 | + @Scheduled(fixedDelay = 5000) | ||
148 | + public void electricityInfo(){ | ||
149 | + List<ElectricityInfo> electricityInfos = electricityInfoMapper.selectAll(); | ||
150 | + if (electricityInfos.size() > 0){ | ||
151 | + for (ElectricityInfo electricityInfo: electricityInfos){ | ||
152 | + Map<String, Object> stringObjectMap = mapCommon(electricityInfo.getActionType(), | ||
153 | + electricityInfo.getDeviceId(), | ||
154 | + String.valueOf(electricityInfo.getMoney()), | ||
155 | + electricityInfo.getIpAddress()); | ||
156 | + stringObjectMap.put("secret", electricityInfo.getSecret()); | ||
157 | + String result = HttpsUtils.sendPost(rechargeDevicesUrl, stringObjectMap); | ||
158 | + log.info("电表临时表充值请求信息:{}", electricityInfo.toString()); | ||
159 | + log.info("电表临时表充值返回信息:{}", result); | ||
160 | + RechargeDevicesResult rechargeDevicesResult = JSON.parseObject(result, RechargeDevicesResult.class); | ||
161 | + List<RechargeDevicesResultData> data = rechargeDevicesResult.getData().getDatas(); | ||
162 | + Boolean message = null; | ||
163 | + for (RechargeDevicesResultData rechargeDevicesResultData : data){ | ||
164 | + message = rechargeDevicesResultData.getSuccess(); | ||
165 | + } | ||
166 | + if ("0".equals(rechargeDevicesResult.getErrcode()) && message == true){ | ||
167 | + payRecordsMapper.updateStatus(electricityInfo.getOrderNumber()); | ||
168 | + electricityInfo.setStatus("0"); | ||
169 | + electricityInfoMapper.updateByPrimaryKeySelective(electricityInfo); | ||
170 | + } | ||
171 | + } | ||
172 | + } | ||
173 | + } | ||
174 | + | ||
175 | + public Map<String, Object> mapCommon( String actionType, String deviceId, String money, String ip_address){ | ||
176 | + Map<String, Object> map = new HashMap<>(); | ||
177 | + map.put("actionType", actionType); | ||
178 | + map.put("deviceId", deviceId); | ||
179 | + map.put("money", money); | ||
180 | + map.put("ipAddress", ip_address); | ||
181 | + return map; | ||
182 | + } | ||
130 | } | 183 | } |
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.ElectricityInfoMapper" > | ||
4 | + <resultMap id="BaseResultMap" type="com.sunyo.energy.location.model.ElectricityInfo" > | ||
5 | + <id column="order_number" property="orderNumber" jdbcType="VARCHAR" /> | ||
6 | + <result column="action_type" property="actionType" jdbcType="VARCHAR" /> | ||
7 | + <result column="device_id" property="deviceId" jdbcType="VARCHAR" /> | ||
8 | + <result column="money" property="money" jdbcType="DECIMAL" /> | ||
9 | + <result column="ip_address" property="ipAddress" jdbcType="VARCHAR" /> | ||
10 | + <result column="secret" property="secret" jdbcType="VARCHAR" /> | ||
11 | + <result column="status" property="status" jdbcType="VARCHAR" /> | ||
12 | + <result column="opert_time" property="opertTime" jdbcType="TIMESTAMP" /> | ||
13 | + <result column="edit_time" property="editTime" jdbcType="TIMESTAMP" /> | ||
14 | + <result column="info_status" property="infoStatus" jdbcType="VARCHAR" /> | ||
15 | + </resultMap> | ||
16 | + <sql id="Base_Column_List" > | ||
17 | + order_number, action_type, device_id, money, ip_address, secret, status, opert_time, | ||
18 | + edit_time, info_status | ||
19 | + </sql> | ||
20 | + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" > | ||
21 | + select | ||
22 | + <include refid="Base_Column_List" /> | ||
23 | + from electricity_info | ||
24 | + where order_number = #{orderNumber,jdbcType=VARCHAR} | ||
25 | + </select> | ||
26 | + | ||
27 | + <select id="selectAll" resultMap="BaseResultMap"> | ||
28 | + select | ||
29 | + <include refid="Base_Column_List" /> | ||
30 | + from electricity_info | ||
31 | + where status = '1' | ||
32 | + </select> | ||
33 | + | ||
34 | + <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > | ||
35 | + delete from electricity_info | ||
36 | + where order_number = #{orderNumber,jdbcType=VARCHAR} | ||
37 | + </delete> | ||
38 | + <insert id="insert" parameterType="com.sunyo.energy.location.model.ElectricityInfo" > | ||
39 | + insert into electricity_info (order_number, action_type, device_id, | ||
40 | + money, ip_address, secret, | ||
41 | + status, opert_time, edit_time, | ||
42 | + info_status) | ||
43 | + values (#{orderNumber,jdbcType=VARCHAR}, #{actionType,jdbcType=VARCHAR}, #{deviceId,jdbcType=VARCHAR}, | ||
44 | + #{money,jdbcType=DECIMAL}, #{ipAddress,jdbcType=VARCHAR}, #{secret,jdbcType=VARCHAR}, | ||
45 | + #{status,jdbcType=VARCHAR}, #{opertTime,jdbcType=TIMESTAMP}, #{editTime,jdbcType=TIMESTAMP}, | ||
46 | + #{infoStatus,jdbcType=VARCHAR}) | ||
47 | + </insert> | ||
48 | + <insert id="insertSelective" parameterType="com.sunyo.energy.location.model.ElectricityInfo" > | ||
49 | + insert into electricity_info | ||
50 | + <trim prefix="(" suffix=")" suffixOverrides="," > | ||
51 | + <if test="orderNumber != null" > | ||
52 | + order_number, | ||
53 | + </if> | ||
54 | + <if test="actionType != null" > | ||
55 | + action_type, | ||
56 | + </if> | ||
57 | + <if test="deviceId != null" > | ||
58 | + device_id, | ||
59 | + </if> | ||
60 | + <if test="money != null" > | ||
61 | + money, | ||
62 | + </if> | ||
63 | + <if test="ipAddress != null" > | ||
64 | + ip_address, | ||
65 | + </if> | ||
66 | + <if test="secret != null" > | ||
67 | + secret, | ||
68 | + </if> | ||
69 | + <if test="status != null" > | ||
70 | + status, | ||
71 | + </if> | ||
72 | + <if test="opertTime != null" > | ||
73 | + opert_time, | ||
74 | + </if> | ||
75 | + <if test="editTime != null" > | ||
76 | + edit_time, | ||
77 | + </if> | ||
78 | + <if test="infoStatus != null" > | ||
79 | + info_status, | ||
80 | + </if> | ||
81 | + </trim> | ||
82 | + <trim prefix="values (" suffix=")" suffixOverrides="," > | ||
83 | + <if test="orderNumber != null" > | ||
84 | + #{orderNumber,jdbcType=VARCHAR}, | ||
85 | + </if> | ||
86 | + <if test="actionType != null" > | ||
87 | + #{actionType,jdbcType=VARCHAR}, | ||
88 | + </if> | ||
89 | + <if test="deviceId != null" > | ||
90 | + #{deviceId,jdbcType=VARCHAR}, | ||
91 | + </if> | ||
92 | + <if test="money != null" > | ||
93 | + #{money,jdbcType=DECIMAL}, | ||
94 | + </if> | ||
95 | + <if test="ipAddress != null" > | ||
96 | + #{ipAddress,jdbcType=VARCHAR}, | ||
97 | + </if> | ||
98 | + <if test="secret != null" > | ||
99 | + #{secret,jdbcType=VARCHAR}, | ||
100 | + </if> | ||
101 | + <if test="status != null" > | ||
102 | + #{status,jdbcType=VARCHAR}, | ||
103 | + </if> | ||
104 | + <if test="opertTime != null" > | ||
105 | + #{opertTime,jdbcType=TIMESTAMP}, | ||
106 | + </if> | ||
107 | + <if test="editTime != null" > | ||
108 | + #{editTime,jdbcType=TIMESTAMP}, | ||
109 | + </if> | ||
110 | + <if test="infoStatus != null" > | ||
111 | + #{infoStatus,jdbcType=VARCHAR}, | ||
112 | + </if> | ||
113 | + </trim> | ||
114 | + </insert> | ||
115 | + <update id="updateByPrimaryKeySelective" parameterType="com.sunyo.energy.location.model.ElectricityInfo" > | ||
116 | + update electricity_info | ||
117 | + <set > | ||
118 | + <if test="actionType != null" > | ||
119 | + action_type = #{actionType,jdbcType=VARCHAR}, | ||
120 | + </if> | ||
121 | + <if test="deviceId != null" > | ||
122 | + device_id = #{deviceId,jdbcType=VARCHAR}, | ||
123 | + </if> | ||
124 | + <if test="money != null" > | ||
125 | + money = #{money,jdbcType=DECIMAL}, | ||
126 | + </if> | ||
127 | + <if test="ipAddress != null" > | ||
128 | + ip_address = #{ipAddress,jdbcType=VARCHAR}, | ||
129 | + </if> | ||
130 | + <if test="secret != null" > | ||
131 | + secret = #{secret,jdbcType=VARCHAR}, | ||
132 | + </if> | ||
133 | + <if test="status != null" > | ||
134 | + status = #{status,jdbcType=VARCHAR}, | ||
135 | + </if> | ||
136 | + <if test="opertTime != null" > | ||
137 | + opert_time = #{opertTime,jdbcType=TIMESTAMP}, | ||
138 | + </if> | ||
139 | + <if test="editTime != null" > | ||
140 | + edit_time = #{editTime,jdbcType=TIMESTAMP}, | ||
141 | + </if> | ||
142 | + <if test="infoStatus != null" > | ||
143 | + info_status = #{infoStatus,jdbcType=VARCHAR}, | ||
144 | + </if> | ||
145 | + </set> | ||
146 | + where order_number = #{orderNumber,jdbcType=VARCHAR} | ||
147 | + </update> | ||
148 | + <update id="updateByPrimaryKey" parameterType="com.sunyo.energy.location.model.ElectricityInfo" > | ||
149 | + update electricity_info | ||
150 | + set action_type = #{actionType,jdbcType=VARCHAR}, | ||
151 | + device_id = #{deviceId,jdbcType=VARCHAR}, | ||
152 | + money = #{money,jdbcType=DECIMAL}, | ||
153 | + ip_address = #{ipAddress,jdbcType=VARCHAR}, | ||
154 | + secret = #{secret,jdbcType=VARCHAR}, | ||
155 | + status = #{status,jdbcType=VARCHAR}, | ||
156 | + opert_time = #{opertTime,jdbcType=TIMESTAMP}, | ||
157 | + edit_time = #{editTime,jdbcType=TIMESTAMP}, | ||
158 | + info_status = #{infoStatus,jdbcType=VARCHAR} | ||
159 | + where order_number = #{orderNumber,jdbcType=VARCHAR} | ||
160 | + </update> | ||
161 | +</mapper> |
@@ -61,6 +61,12 @@ | @@ -61,6 +61,12 @@ | ||
61 | where id = #{id,jdbcType=INTEGER} | 61 | where id = #{id,jdbcType=INTEGER} |
62 | </update> | 62 | </update> |
63 | 63 | ||
64 | + <update id="updateStatus" parameterType="string"> | ||
65 | + update pay_records | ||
66 | + set payStatus = 1 | ||
67 | + where orderNumber = #{value, jdbcType=VARCHAR} | ||
68 | + </update> | ||
69 | + | ||
64 | <insert id="insert" parameterType="com.sunyo.energy.location.model.PayRecords" > | 70 | <insert id="insert" parameterType="com.sunyo.energy.location.model.PayRecords" > |
65 | insert into pay_records (id, payFees, payUserId, | 71 | insert into pay_records (id, payFees, payUserId, |
66 | payTime, payLocationId, payStatus, | 72 | payTime, payLocationId, payStatus, |
-
请 注册 或 登录 后发表评论