作者 shenhailong

短信服务 电表余额通知

正在显示 33 个修改的文件 包含 880 行增加1095 行删除
@@ -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: 10005 8 + port: 10006
9 # servlet: 9 # servlet:
10 # context-path: ${SERVER_CONTEXTPATH:} 10 # context-path: ${SERVER_CONTEXTPATH:}
11 spring: 11 spring:
@@ -37,7 +37,7 @@ spring: @@ -37,7 +37,7 @@ spring:
37 static-locations: classpath:/META-INF/resources/,classpath:/static,classpath:/resources/,classpath:/public/,file:${web.upload-path} 37 static-locations: classpath:/META-INF/resources/,classpath:/static,classpath:/resources/,classpath:/public/,file:${web.upload-path}
38 38
39 application: 39 application:
40 - name: EMPT-LOCATION-TIMED-TASK 40 + name: EMPT-LOCATION-NOTE-INFORM
41 41
42 jackson: 42 jackson:
43 serialization: 43 serialization:
@@ -151,19 +151,9 @@ logging: @@ -151,19 +151,9 @@ logging:
151 jwt: 151 jwt:
152 max-alive: 300 152 max-alive: 300
153 153
154 -#10079  
155 -eeid:  
156 - ipAddress: 192.168.50.23  
157 #电表所需要接口 154 #电表所需要接口
158 eeUrl: 155 eeUrl:
159 - #电表充值路径  
160 - # rechargeDevicesUrl: "http://10.5.10.102:8000/api/emcs/rechargeDevices"  
161 - rechargeDevicesUrl: "http://192.168.1.7:18080/api/emcs/rechargeDevices"  
162 - #电表送电 1送电 2断电  
163 -# remoteControlDevices: "http://10.5.10.102:8000/api/emcs/remoteControlDevices"  
164 - remoteControlDevices: "http://192.168.1.199:18080/api/emcs/remoteControlDevices"  
165 #获取电表实时数据/余额 156 #获取电表实时数据/余额
166 # electricityBanlanceUrl: "http://10.5.10.102:8000/api/emcs/getEnergyInfoForRealTime" 157 # electricityBanlanceUrl: "http://10.5.10.102:8000/api/emcs/getEnergyInfoForRealTime"
167 electricityBanlanceUrl: "http://192.168.1.199:18080/api/emcs/getEnergyInfoForRealTime" 158 electricityBanlanceUrl: "http://192.168.1.199:18080/api/emcs/getEnergyInfoForRealTime"
168 -  
169 - 159 + informMoney: "50"
@@ -33,6 +33,38 @@ @@ -33,6 +33,38 @@
33 <version>4.5.12</version> 33 <version>4.5.12</version>
34 </dependency> 34 </dependency>
35 35
  36 + <!--webservice-->
  37 + <!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2-adb -->
  38 + <dependency>
  39 + <groupId>org.apache.axis2</groupId>
  40 + <artifactId>axis2-adb</artifactId>
  41 + <version>1.7.8</version>
  42 + <exclusions>
  43 + <exclusion>
  44 + <groupId>javax.servlet</groupId>
  45 + <artifactId>servlet-api</artifactId>
  46 + </exclusion>
  47 + </exclusions>
  48 + </dependency>
  49 + <!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2-transport-local -->
  50 + <dependency>
  51 + <groupId>org.apache.axis2</groupId>
  52 + <artifactId>axis2-transport-local</artifactId>
  53 + <version>1.7.8</version>
  54 + <exclusions>
  55 + <exclusion>
  56 + <groupId>javax.servlet</groupId>
  57 + <artifactId>servlet-api</artifactId>
  58 + </exclusion>
  59 + </exclusions>
  60 + </dependency>
  61 + <!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2-transport-http -->
  62 + <dependency>
  63 + <groupId>org.apache.axis2</groupId>
  64 + <artifactId>axis2-transport-http</artifactId>
  65 + <version>1.7.8</version>
  66 + </dependency>
  67 +
36 <!-- https://mvnrepository.com/artifact/org.json/json --> 68 <!-- https://mvnrepository.com/artifact/org.json/json -->
37 <dependency> 69 <dependency>
38 <groupId>org.json</groupId> 70 <groupId>org.json</groupId>
  1 +package com.sunyo.energy.location.controller;
  2 +
  3 +
  4 +import com.sunyo.energy.location.model.ElectricityMeter;
  5 +import com.sunyo.energy.location.model.InformElectricity;
  6 +import com.sunyo.energy.location.model.NoteInform;
  7 +import com.sunyo.energy.location.service.InformElectricityService;
  8 +import com.sunyo.energy.location.service.NoteInformService;
  9 +import com.sunyo.energy.location.utils.CallWebServiceUtils;
  10 +import com.sunyo.energy.location.utils.WaterEleUtils;
  11 +import lombok.extern.slf4j.Slf4j;
  12 +import org.springframework.beans.factory.annotation.Autowired;
  13 +import org.springframework.scheduling.annotation.Scheduled;
  14 +import org.springframework.web.bind.annotation.RequestMapping;
  15 +import org.springframework.web.bind.annotation.RestController;
  16 +
  17 +import java.util.List;
  18 +
  19 +/**
  20 + * @author shenhailong
  21 + * <p>
  22 + * 2020/7/20/10:32
  23 + */
  24 +@Slf4j
  25 +@RestController
  26 +@RequestMapping(value = "/noteInform")
  27 +public class NoteInformController {
  28 +
  29 + @Autowired
  30 + InformElectricityService informElectricityService;
  31 +
  32 + @Autowired
  33 + NoteInformService noteInformService;
  34 +
  35 + /**
  36 + * 短信通知接口
  37 + */
  38 + @RequestMapping("/note")
  39 + @Scheduled
  40 + public void note(){
  41 + /**
  42 + * 通知电表
  43 + */
  44 + try {
  45 + List<InformElectricity> informElectricitieList = informElectricityService.selectAll();
  46 + WaterEleUtils waterEleUtils = new WaterEleUtils();
  47 + // 取出每一个房间信息
  48 + for (InformElectricity informElectricity: informElectricitieList){
  49 + // 循环查询该设备用电余额
  50 + ElectricityMeter energyInfoForRealTime = waterEleUtils.getEnergyInfoForRealTime(informElectricity.getEeId());
  51 + // 是否满足通知条件
  52 + boolean eleMoney = waterEleUtils.eleMoney(energyInfoForRealTime.getBalance());
  53 + if (eleMoney){
  54 + int i = CallWebServiceUtils.sendSMSPost(informElectricity.getInformPhone(),
  55 + "您所在的宿舍" + informElectricity.getRoomName() + "电费已不足50元,为避免停电造成不变,请及时充值",
  56 + "");
  57 + if (i > 0){
  58 + // 成功修改为通知状态为否
  59 + NoteInform noteInform = new NoteInform();
  60 + noteInform.setInformStatus("1");
  61 + noteInform.setId(informElectricity.getId());
  62 + noteInformService.updateByPrimaryKeySelective(noteInform);
  63 + log.info("电表余额短信提醒成功房间号码为:{}", informElectricity.getRoomName());
  64 + }
  65 + }
  66 + }
  67 + }catch (Exception e){
  68 + e.printStackTrace();
  69 + }
  70 + }
  71 +}
1 -package com.sunyo.energy.location.dao;  
2 -  
3 -import com.sunyo.energy.location.model.ElectricityInfo;  
4 -import org.apache.ibatis.annotations.Param;  
5 -  
6 -import java.util.List;  
7 -  
8 -public interface ElectricityInfoMapper {  
9 - int deleteByPrimaryKey(String orderNumber);  
10 -  
11 - int insert(ElectricityInfo record);  
12 -  
13 - int insertSelective(ElectricityInfo record);  
14 -  
15 - ElectricityInfo selectByPrimaryKey(String orderNumber);  
16 -  
17 - List<ElectricityInfo> selectAll(@Param("deviceId") String deviceId);  
18 -  
19 - int updateByPrimaryKeySelective(ElectricityInfo record);  
20 -  
21 - int updateByPrimaryKey(ElectricityInfo record);  
22 -}  
  1 +package com.sunyo.energy.location.dao;
  2 +
  3 +import com.sunyo.energy.location.model.InformElectricity;
  4 +
  5 +import java.util.List;
  6 +
  7 +public interface InformElectricityMapper {
  8 + int insert(InformElectricity record);
  9 +
  10 + int insertSelective(InformElectricity record);
  11 +
  12 + List<InformElectricity> selectAll();
  13 +}
  1 +package com.sunyo.energy.location.dao;
  2 +
  3 +import com.sunyo.energy.location.model.LocationUsers;
  4 +
  5 +import java.util.List;
  6 +
  7 +public interface LocationUsersMapper {
  8 + int insert(LocationUsers record);
  9 +
  10 + int insertSelective(LocationUsers record);
  11 +
  12 + List<LocationUsers> selectAll();
  13 +}
  1 +package com.sunyo.energy.location.dao;
  2 +
  3 +import com.sunyo.energy.location.model.NoteInform;
  4 +
  5 +public interface NoteInformMapper {
  6 + int deleteByPrimaryKey(Integer id);
  7 +
  8 + int insert(NoteInform record);
  9 +
  10 + int insertSelective(NoteInform record);
  11 +
  12 + NoteInform selectByPrimaryKey(Integer id);
  13 +
  14 + int updateByPrimaryKeySelective(NoteInform record);
  15 +
  16 + int updateByPrimaryKey(NoteInform record);
  17 +}
1 -package com.sunyo.energy.location.dao;  
2 -  
3 -import com.sunyo.energy.location.model.PayRecords;  
4 -import org.apache.ibatis.annotations.Param;  
5 -  
6 -import java.util.List;  
7 -  
8 -public interface PayRecordsMapper {  
9 - int deleteByPrimaryKey(Integer id);  
10 -  
11 - int insert(PayRecords record);  
12 -  
13 - int insertSelective(PayRecords record);  
14 -  
15 - PayRecords selectByPrimaryKey(Integer id);  
16 -  
17 - int updateByPrimaryKeySelective(PayRecords record);  
18 -  
19 - int updateByPrimaryKey(PayRecords record);  
20 -  
21 - List<PayRecords> findAll(@Param(value = "orderNumber") String orderNumber,  
22 - @Param(value = "startTime") String startTime,  
23 - @Param(value = "endTime") String endTime,  
24 - @Param(value = "username") String username,  
25 - @Param(value = "payType") String payType);  
26 -  
27 - String findOrderNumber(String orderId);  
28 -  
29 - boolean selectType(String orderId);  
30 -  
31 - int updateStatus(String orderNumber);  
32 -}  
1 package com.sunyo.energy.location.model; 1 package com.sunyo.energy.location.model;
2 2
3 -/**  
4 - * 获取电表余额/实时数据1  
5 - */  
6 -  
7 import lombok.Data; 3 import lombok.Data;
8 4
  5 +/**
  6 + * @author shenhailong
  7 + * <p>
  8 + * 2020/7/22/15:46
  9 + */
9 @Data 10 @Data
10 public class ElectricityBalanceOne { 11 public class ElectricityBalanceOne {
11 12
1 -package com.sunyo.energy.location.model;  
2 -  
3 -import lombok.Data;  
4 -  
5 -/**  
6 - * 获取电表余额/实时数据3  
7 - */  
8 -@Data  
9 -public class ElectricityBalanceThree {  
10 -  
11 - private Integer deviceId;  
12 -  
13 - private Number totalEnergy;  
14 -  
15 - private Number tipEnergy;  
16 -  
17 - private Number peakEnergy;  
18 -  
19 - private Number valleyEnergy;  
20 -  
21 - private Number flatEnergy;  
22 -  
23 - private Number balance;  
24 -  
25 -}  
@@ -5,7 +5,9 @@ import lombok.Data; @@ -5,7 +5,9 @@ import lombok.Data;
5 import java.util.List; 5 import java.util.List;
6 6
7 /** 7 /**
8 - * 获取电表余额/实时数据2 8 + * @author shenhailong
  9 + * <p>
  10 + * 2020/7/22/15:47
9 */ 11 */
10 @Data 12 @Data
11 public class ElectricityBalanceTwo { 13 public class ElectricityBalanceTwo {
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 -}  
@@ -3,7 +3,14 @@ package com.sunyo.energy.location.model; @@ -3,7 +3,14 @@ package com.sunyo.energy.location.model;
3 import java.math.BigDecimal; 3 import java.math.BigDecimal;
4 import java.util.Date; 4 import java.util.Date;
5 5
  6 +/**
  7 + * @author shenhailong
  8 + * <p>
  9 + * 2020/7/22/15:45
  10 + */
6 public class ElectricityMeter { 11 public class ElectricityMeter {
  12 +
  13 +
7 private String deviceId; 14 private String deviceId;
8 15
9 private BigDecimal totalEnergy; 16 private BigDecimal totalEnergy;
@@ -27,90 +34,92 @@ public class ElectricityMeter { @@ -27,90 +34,92 @@ public class ElectricityMeter {
27 private String reamke2; 34 private String reamke2;
28 35
29 public String getDeviceId() { 36 public String getDeviceId() {
30 - return deviceId; 37 + return deviceId;
31 } 38 }
32 39
33 public void setDeviceId(String deviceId) { 40 public void setDeviceId(String deviceId) {
34 - this.deviceId = deviceId == null ? null : deviceId.trim(); 41 + this.deviceId = deviceId == null ? null : deviceId.trim();
35 } 42 }
36 43
37 public BigDecimal getTotalEnergy() { 44 public BigDecimal getTotalEnergy() {
38 - return totalEnergy; 45 + return totalEnergy;
39 } 46 }
40 47
41 public void setTotalEnergy(BigDecimal totalEnergy) { 48 public void setTotalEnergy(BigDecimal totalEnergy) {
42 - this.totalEnergy = totalEnergy; 49 + this.totalEnergy = totalEnergy;
43 } 50 }
44 51
45 public BigDecimal getTipEnergy() { 52 public BigDecimal getTipEnergy() {
46 - return tipEnergy; 53 + return tipEnergy;
47 } 54 }
48 55
49 public void setTipEnergy(BigDecimal tipEnergy) { 56 public void setTipEnergy(BigDecimal tipEnergy) {
50 - this.tipEnergy = tipEnergy; 57 + this.tipEnergy = tipEnergy;
51 } 58 }
52 59
53 public BigDecimal getPeakEnergy() { 60 public BigDecimal getPeakEnergy() {
54 - return peakEnergy; 61 + return peakEnergy;
55 } 62 }
56 63
57 public void setPeakEnergy(BigDecimal peakEnergy) { 64 public void setPeakEnergy(BigDecimal peakEnergy) {
58 - this.peakEnergy = peakEnergy; 65 + this.peakEnergy = peakEnergy;
59 } 66 }
60 67
61 public BigDecimal getValleyEnergy() { 68 public BigDecimal getValleyEnergy() {
62 - return valleyEnergy; 69 + return valleyEnergy;
63 } 70 }
64 71
65 public void setValleyEnergy(BigDecimal valleyEnergy) { 72 public void setValleyEnergy(BigDecimal valleyEnergy) {
66 - this.valleyEnergy = valleyEnergy; 73 + this.valleyEnergy = valleyEnergy;
67 } 74 }
68 75
69 public BigDecimal getFlatEnergy() { 76 public BigDecimal getFlatEnergy() {
70 - return flatEnergy; 77 + return flatEnergy;
71 } 78 }
72 79
73 public void setFlatEnergy(BigDecimal flatEnergy) { 80 public void setFlatEnergy(BigDecimal flatEnergy) {
74 - this.flatEnergy = flatEnergy; 81 + this.flatEnergy = flatEnergy;
75 } 82 }
76 83
77 public BigDecimal getBalance() { 84 public BigDecimal getBalance() {
78 - return balance; 85 + return balance;
79 } 86 }
80 87
81 public void setBalance(BigDecimal balance) { 88 public void setBalance(BigDecimal balance) {
82 - this.balance = balance; 89 + this.balance = balance;
83 } 90 }
84 91
85 public Date getActime() { 92 public Date getActime() {
86 - return actime; 93 + return actime;
87 } 94 }
88 95
89 public void setActime(Date actime) { 96 public void setActime(Date actime) {
90 - this.actime = actime; 97 + this.actime = actime;
91 } 98 }
92 99
93 public Date getUpdatetime() { 100 public Date getUpdatetime() {
94 - return updatetime; 101 + return updatetime;
95 } 102 }
96 103
97 public void setUpdatetime(Date updatetime) { 104 public void setUpdatetime(Date updatetime) {
98 - this.updatetime = updatetime; 105 + this.updatetime = updatetime;
99 } 106 }
100 107
101 public String getReamke1() { 108 public String getReamke1() {
102 - return reamke1; 109 + return reamke1;
103 } 110 }
104 111
105 public void setReamke1(String reamke1) { 112 public void setReamke1(String reamke1) {
106 - this.reamke1 = reamke1 == null ? null : reamke1.trim(); 113 + this.reamke1 = reamke1 == null ? null : reamke1.trim();
107 } 114 }
108 115
109 public String getReamke2() { 116 public String getReamke2() {
110 - return reamke2; 117 + return reamke2;
111 } 118 }
112 119
113 public void setReamke2(String reamke2) { 120 public void setReamke2(String reamke2) {
114 - this.reamke2 = reamke2 == null ? null : reamke2.trim(); 121 + this.reamke2 = reamke2 == null ? null : reamke2.trim();
115 } 122 }
116 -}  
  123 +
  124 +
  125 +}
  1 +package com.sunyo.energy.location.model;
  2 +
  3 +public class InformElectricity {
  4 + private String informMoney;
  5 +
  6 + private String informPhone;
  7 +
  8 + private String roomName;
  9 +
  10 + private String eeId;
  11 +
  12 + private Integer id;
  13 +
  14 + public String getInformMoney() {
  15 + return informMoney;
  16 + }
  17 +
  18 + public void setInformMoney(String informMoney) {
  19 + this.informMoney = informMoney == null ? null : informMoney.trim();
  20 + }
  21 +
  22 + public String getInformPhone() {
  23 + return informPhone;
  24 + }
  25 +
  26 + public void setInformPhone(String informPhone) {
  27 + this.informPhone = informPhone == null ? null : informPhone.trim();
  28 + }
  29 +
  30 + public String getRoomName() {
  31 + return roomName;
  32 + }
  33 +
  34 + public void setRoomName(String roomName) {
  35 + this.roomName = roomName == null ? null : roomName.trim();
  36 + }
  37 +
  38 + public String getEeId() {
  39 + return eeId;
  40 + }
  41 +
  42 + public void setEeId(String eeId) {
  43 + this.eeId = eeId == null ? null : eeId.trim();
  44 + }
  45 +
  46 + public Integer getId() {
  47 + return id;
  48 + }
  49 +
  50 + public void setId(Integer id) {
  51 + this.id = id;
  52 + }
  53 +}
  1 +package com.sunyo.energy.location.model;
  2 +
  3 +public class LocationUsers {
  4 + private String username;
  5 +
  6 + private String phone;
  7 +
  8 + private String wmid;
  9 +
  10 + private String eeid;
  11 +
  12 + public String getUsername() {
  13 + return username;
  14 + }
  15 +
  16 + public void setUsername(String username) {
  17 + this.username = username == null ? null : username.trim();
  18 + }
  19 +
  20 + public String getPhone() {
  21 + return phone;
  22 + }
  23 +
  24 + public void setPhone(String phone) {
  25 + this.phone = phone == null ? null : phone.trim();
  26 + }
  27 +
  28 + public String getWmid() {
  29 + return wmid;
  30 + }
  31 +
  32 + public void setWmid(String wmid) {
  33 + this.wmid = wmid == null ? null : wmid.trim();
  34 + }
  35 +
  36 + public String getEeid() {
  37 + return eeid;
  38 + }
  39 +
  40 + public void setEeid(String eeid) {
  41 + this.eeid = eeid == null ? null : eeid.trim();
  42 + }
  43 +}
  1 +package com.sunyo.energy.location.model;
  2 +
  3 +import java.util.Date;
  4 +
  5 +public class NoteInform {
  6 + private Integer id;
  7 +
  8 + private String roomName;
  9 +
  10 + private String waterEleType;
  11 +
  12 + private String informMoney;
  13 +
  14 + private String informStatus;
  15 +
  16 + private String informPhone;
  17 +
  18 + private Date informDate;
  19 +
  20 + private String status;
  21 +
  22 + public Integer getId() {
  23 + return id;
  24 + }
  25 +
  26 + public void setId(Integer id) {
  27 + this.id = id;
  28 + }
  29 +
  30 + public String getRoomName() {
  31 + return roomName;
  32 + }
  33 +
  34 + public void setRoomName(String roomName) {
  35 + this.roomName = roomName == null ? null : roomName.trim();
  36 + }
  37 +
  38 + public String getWaterEleType() {
  39 + return waterEleType;
  40 + }
  41 +
  42 + public void setWaterEleType(String waterEleType) {
  43 + this.waterEleType = waterEleType == null ? null : waterEleType.trim();
  44 + }
  45 +
  46 + public String getInformMoney() {
  47 + return informMoney;
  48 + }
  49 +
  50 + public void setInformMoney(String informMoney) {
  51 + this.informMoney = informMoney == null ? null : informMoney.trim();
  52 + }
  53 +
  54 + public String getInformStatus() {
  55 + return informStatus;
  56 + }
  57 +
  58 + public void setInformStatus(String informStatus) {
  59 + this.informStatus = informStatus == null ? null : informStatus.trim();
  60 + }
  61 +
  62 + public String getInformPhone() {
  63 + return informPhone;
  64 + }
  65 +
  66 + public void setInformPhone(String informPhone) {
  67 + this.informPhone = informPhone == null ? null : informPhone.trim();
  68 + }
  69 +
  70 + public Date getInformDate() {
  71 + return informDate;
  72 + }
  73 +
  74 + public void setInformDate(Date informDate) {
  75 + this.informDate = informDate;
  76 + }
  77 +
  78 + public String getStatus() {
  79 + return status;
  80 + }
  81 +
  82 + public void setStatus(String status) {
  83 + this.status = status == null ? null : status.trim();
  84 + }
  85 +}
1 -package com.sunyo.energy.location.model;  
2 -  
3 -import com.fasterxml.jackson.annotation.JsonFormat;  
4 -  
5 -import java.beans.SimpleBeanInfo;  
6 -import java.math.BigDecimal;  
7 -import java.text.SimpleDateFormat;  
8 -import java.util.Date;  
9 -  
10 -public class PayRecords {  
11 - private Integer id;  
12 -  
13 - private BigDecimal payfees;  
14 -  
15 - private Integer payuserid;  
16 -  
17 - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")  
18 - private Date paytime;  
19 -  
20 - private Integer paylocationid;  
21 -  
22 - private Boolean paystatus;  
23 -  
24 - private Boolean paytype;  
25 -  
26 - private Boolean payfesstype;  
27 -  
28 - private String ordernumber;  
29 -  
30 - private String reamke1;  
31 -  
32 - private String reamke2;  
33 -  
34 - private String reamke3;  
35 -  
36 - private String reamke4;  
37 -  
38 - private String payusername;  
39 -  
40 - private String paylocationname;  
41 -  
42 - private String paytypeaddress;  
43 -  
44 - private String stringType;  
45 -  
46 - private String stringStatus;  
47 -  
48 - private String stringReamke3;  
49 -  
50 - private String stringDate;  
51 -  
52 - public Integer getId() {  
53 - return id;  
54 - }  
55 -  
56 - public void setId(Integer id) {  
57 - this.id = id;  
58 - }  
59 -  
60 - public BigDecimal getPayfees() {  
61 - return payfees;  
62 - }  
63 -  
64 - public void setPayfees(BigDecimal payfees) {  
65 - this.payfees = payfees;  
66 - }  
67 -  
68 - public Integer getPayuserid() {  
69 - return payuserid;  
70 - }  
71 -  
72 - public void setPayuserid(Integer payuserid) {  
73 - this.payuserid = payuserid;  
74 - }  
75 -  
76 - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")  
77 - public Date getPaytime() {  
78 - return paytime;  
79 - }  
80 -  
81 - public void setPaytime(Date paytime) {  
82 - this.paytime = paytime;  
83 - }  
84 -  
85 - public Integer getPaylocationid() {  
86 - return paylocationid;  
87 - }  
88 -  
89 - public void setPaylocationid(Integer paylocationid) {  
90 - this.paylocationid = paylocationid;  
91 - }  
92 -  
93 - public Boolean getPaystatus() {  
94 - return paystatus;  
95 - }  
96 -  
97 - public void setPaystatus(Boolean paystatus) {  
98 - this.paystatus = paystatus;  
99 - }  
100 -  
101 - public Boolean getPaytype() {  
102 - return paytype;  
103 - }  
104 -  
105 - public void setPaytype(Boolean paytype) {  
106 - this.paytype = paytype;  
107 - }  
108 -  
109 - public Boolean getPayfesstype() {  
110 - return payfesstype;  
111 - }  
112 -  
113 - public void setPayfesstype(Boolean payfesstype) {  
114 - this.payfesstype = payfesstype;  
115 - }  
116 -  
117 - public String getOrdernumber() {  
118 - return ordernumber;  
119 - }  
120 -  
121 - public void setOrdernumber(String ordernumber) {  
122 - this.ordernumber = ordernumber == null ? null : ordernumber.trim();  
123 - }  
124 -  
125 - public String getReamke1() {  
126 - return reamke1;  
127 - }  
128 -  
129 - public void setReamke1(String reamke1) {  
130 - this.reamke1 = reamke1 == null ? null : reamke1.trim();  
131 - }  
132 -  
133 - public String getReamke2() {  
134 - return reamke2;  
135 - }  
136 -  
137 - public void setReamke2(String reamke2) {  
138 - this.reamke2 = reamke2 == null ? null : reamke2.trim();  
139 - }  
140 -  
141 - public String getReamke3() {  
142 - return reamke3;  
143 - }  
144 -  
145 - public void setReamke3(String reamke3) {  
146 - this.reamke3 = reamke3 == null ? null : reamke3.trim();  
147 - }  
148 -  
149 - public String getReamke4() {  
150 - return reamke4;  
151 - }  
152 -  
153 - public void setReamke4(String reamke4) {  
154 - this.reamke4 = reamke4 == null ? null : reamke4.trim();  
155 - }  
156 -  
157 - public String getPayusername() {  
158 - return payusername;  
159 - }  
160 -  
161 - public void setPayusername(String payusername) {  
162 - this.payusername = payusername == null ? null : payusername.trim();  
163 - }  
164 -  
165 - public String getPaylocationname() {  
166 - return paylocationname;  
167 - }  
168 -  
169 - public void setPaylocationname(String paylocationname) {  
170 - this.paylocationname = paylocationname == null ? null : paylocationname.trim();  
171 - }  
172 -  
173 - public String getPaytypeaddress() {  
174 - return paytypeaddress;  
175 - }  
176 -  
177 - public void setPaytypeaddress(String paytypeaddress) {  
178 - this.paytypeaddress = paytypeaddress == null ? null : paytypeaddress.trim();  
179 - }  
180 -  
181 - public String getStringType() {  
182 - if (getPaytype()){  
183 - return stringReamke3 = "电";  
184 - }else {  
185 - return stringReamke3 = "水";  
186 - }  
187 - }  
188 -  
189 - public void setStringType(String stringType) {  
190 - this.stringType = stringType;  
191 - }  
192 -  
193 - public String getStringStatus() {  
194 - if (getPaystatus()){  
195 - return stringReamke3 = "支付成功";  
196 - }else {  
197 - return stringReamke3 = "支付失败";  
198 - }  
199 - }  
200 -  
201 - public void setStringStatus(String stringStatus) {  
202 - this.stringStatus = stringStatus;  
203 - }  
204 -  
205 - public String getStringReamke3() {  
206 - if ("1".equals(getReamke3())){  
207 - return stringReamke3 = "充值成功";  
208 - }else {  
209 - return stringReamke3 = "充值失败";  
210 - }  
211 -  
212 - }  
213 -  
214 - public void setStringReamke3(String stringReamke3) {  
215 - this.stringReamke3 = stringReamke3;  
216 - }  
217 -  
218 - public String getStringDate() {  
219 - Date paytime = getPaytime();  
220 - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  
221 - String format = simpleDateFormat.format(paytime);  
222 - return format;  
223 - }  
224 -  
225 - public void setStringDate(String stringDate) {  
226 - this.stringDate = stringDate;  
227 - }  
228 -}  
1 -package com.sunyo.energy.location.model;  
2 -  
3 -import lombok.Data;  
4 -  
5 -/**  
6 - * @author shenhailong  
7 - * <p>  
8 - * 2020/6/2/17:44  
9 - */  
10 -@Data  
11 -public class RechargeDevicesResult {  
12 -  
13 - private String errcode;  
14 -  
15 - private String errmessage;  
16 -  
17 - private RechargeDevicesResultDatas data;  
18 -  
19 -}  
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.service.Imp;
  2 +
  3 +import com.sunyo.energy.location.dao.InformElectricityMapper;
  4 +import com.sunyo.energy.location.model.InformElectricity;
  5 +import com.sunyo.energy.location.service.InformElectricityService;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Service;
  8 +
  9 +import java.util.List;
  10 +
  11 +/**
  12 + * @author shenhailong
  13 + * <p>
  14 + * 2020/7/21/16:23
  15 + */
  16 +@Service
  17 +public class InformElectricityServiceImp implements InformElectricityService {
  18 +
  19 + @Autowired
  20 + InformElectricityMapper informElectricityMapper;
  21 +
  22 + @Override
  23 + public List<InformElectricity> selectAll() {
  24 + return informElectricityMapper.selectAll();
  25 + }
  26 +}
  1 +package com.sunyo.energy.location.service.Imp;
  2 +
  3 +import com.sunyo.energy.location.dao.NoteInformMapper;
  4 +import com.sunyo.energy.location.model.NoteInform;
  5 +import com.sunyo.energy.location.service.NoteInformService;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.stereotype.Service;
  8 +
  9 +/**
  10 + * @author shenhailong
  11 + * <p>
  12 + * 2020/7/22/15:56
  13 + */
  14 +@Service
  15 +public class NoteInformServiceImp implements NoteInformService {
  16 +
  17 + @Autowired
  18 + NoteInformMapper noteInformMapper;
  19 +
  20 + @Override
  21 + public int updateByPrimaryKeySelective(NoteInform record) {
  22 + return noteInformMapper.updateByPrimaryKeySelective(record);
  23 + }
  24 +}
1 -package com.sunyo.energy.location.model; 1 +package com.sunyo.energy.location.service;
2 2
3 -import lombok.Data; 3 +import com.sunyo.energy.location.model.InformElectricity;
4 4
5 import java.util.List; 5 import java.util.List;
6 6
7 /** 7 /**
8 * @author shenhailong 8 * @author shenhailong
9 * <p> 9 * <p>
10 - * 2020/6/4/14:29 10 + * 2020/7/21/16:23
11 */ 11 */
12 -@Data  
13 -public class RechargeDevicesResultDatas { 12 +public interface InformElectricityService {
14 13
15 - private List<RechargeDevicesResultData> datas; 14 + List<InformElectricity> selectAll();
16 15
17 } 16 }
1 package com.sunyo.energy.location.service; 1 package com.sunyo.energy.location.service;
2 2
3 -  
4 -import java.math.BigDecimal;  
5 -import java.util.Map; 3 +import com.sunyo.energy.location.model.NoteInform;
6 4
7 /** 5 /**
8 * @author shenhailong 6 * @author shenhailong
9 * <p> 7 * <p>
10 - * 2020/5/25/16:12 8 + * 2020/7/22/15:56
11 */ 9 */
12 -public interface ElectricityMeterService { 10 +public interface NoteInformService {
  11 +
13 12
  13 + int updateByPrimaryKeySelective(NoteInform record);
14 14
15 } 15 }
1 -package com.sunyo.energy.location.service.imp;  
2 -  
3 -import com.alibaba.fastjson.JSON;  
4 -import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIGlobalBinding;  
5 -import com.sunyo.energy.location.dao.*;  
6 -import com.sunyo.energy.location.model.*;  
7 -import com.sunyo.energy.location.service.ElectricityMeterService;  
8 -import com.sunyo.energy.location.utils.HttpsUtils;  
9 -import lombok.extern.slf4j.Slf4j;  
10 -import org.springframework.beans.factory.annotation.Autowired;  
11 -import org.springframework.beans.factory.annotation.Value;  
12 -import org.springframework.scheduling.annotation.Scheduled;  
13 -import org.springframework.stereotype.Service;  
14 -  
15 -import java.math.BigDecimal;  
16 -import java.util.HashMap;  
17 -import java.util.List;  
18 -import java.util.Map;  
19 -  
20 -@Slf4j  
21 -@Service  
22 -public class ElectricityMeterServiceImp implements ElectricityMeterService {  
23 -  
24 - @Autowired  
25 - ElectricityInfoMapper electricityInfoMapper;  
26 -  
27 - @Autowired  
28 - PayRecordsMapper payRecordsMapper;  
29 -  
30 - /**  
31 - * 电表充值接口地址  
32 - */  
33 - @Value("${eeUrl.rechargeDevicesUrl}")  
34 - private String rechargeDevicesUrl;  
35 -  
36 - @Value("${eeUrl.remoteControlDevices}")  
37 - private String remoteControlDevices;  
38 -  
39 - /**  
40 - * 获取电表实时数据/余额  
41 - */  
42 - @Value("${eeUrl.electricityBanlanceUrl}")  
43 - private String electricityBanlanceUrl;  
44 -  
45 - /**  
46 - * 定时读取电表临时表 发起充值  
47 - */  
48 - @Scheduled(fixedDelay = 30000)  
49 - public void electricityInfo() {  
50 - try {  
51 - List<ElectricityInfo> electricityInfos = electricityInfoMapper.selectAll("");  
52 - if (electricityInfos.size() > 0) {  
53 - for (ElectricityInfo electricityInfo : electricityInfos) {  
54 - Map<String, Object> stringObjectMap = mapCommon(electricityInfo.getActionType(),  
55 - electricityInfo.getDeviceId(),  
56 - String.valueOf(electricityInfo.getMoney()),  
57 - electricityInfo.getIpAddress());  
58 - stringObjectMap.put("secret", electricityInfo.getSecret());  
59 - String result = HttpsUtils.sendPost(rechargeDevicesUrl, stringObjectMap);  
60 - log.info("电表临时表充值请求信息:{}", electricityInfo.toString());  
61 - log.info("电表临时表充值返回信息:{}", result);  
62 - RechargeDevicesResult rechargeDevicesResult = JSON.parseObject(result, RechargeDevicesResult.class);  
63 - if (rechargeDevicesResult.getData() != null) {  
64 - List<RechargeDevicesResultData> data = rechargeDevicesResult.getData().getDatas();  
65 - Boolean message = null;  
66 - for (RechargeDevicesResultData rechargeDevicesResultData : data) {  
67 - message = rechargeDevicesResultData.getSuccess();  
68 - }  
69 - if ("0".equals(rechargeDevicesResult.getErrcode()) && message == true) {  
70 - ElectricityMeter energyInfoForRealTime = getEnergyInfoForRealTime(electricityInfo.getDeviceId());  
71 - if (energyInfoForRealTime.getBalance() != null){  
72 - int i = energyInfoForRealTime.getBalance().compareTo(BigDecimal.ZERO);  
73 - if (i > 0){  
74 - Map<String, Object> map = new HashMap<>();  
75 - map.put("deviceId", electricityInfo.getDeviceId());  
76 - map.put("action", "1");  
77 - HttpsUtils.sendPost(remoteControlDevices, map);  
78 - }  
79 - }  
80 - payRecordsMapper.updateStatus(electricityInfo.getOrderNumber());  
81 - // 成功 删除该订单  
82 - electricityInfoMapper.deleteByPrimaryKey(electricityInfo.getOrderNumber());  
83 - }  
84 - }  
85 - }  
86 - }  
87 - log.info("定时任务处理完成");  
88 - }catch (Exception e){  
89 - e.printStackTrace();  
90 - }  
91 - }  
92 -  
93 - public Map<String, Object> mapCommon(String actionType, String deviceId, String money, String ip_address) {  
94 - Map<String, Object> map = new HashMap<>();  
95 - map.put("actionType", actionType);  
96 - map.put("deviceId", deviceId);  
97 - map.put("money", money);  
98 - map.put("ipAddress", ip_address);  
99 - return map;  
100 - }  
101 -  
102 - /**  
103 - * 实施获取电表数据  
104 - */  
105 - public ElectricityMeter getEnergyInfoForRealTime(String deviceId) {  
106 - try {  
107 - if (!"".equals(deviceId)) {  
108 - Map<String, Object> stringObjectMap = eeInfo(deviceId);  
109 - String infoForRealTime = HttpsUtils.sendPost(electricityBanlanceUrl, stringObjectMap);  
110 - ElectricityBalanceOne electricityBalanceOne = JSON.parseObject(infoForRealTime, ElectricityBalanceOne.class);  
111 - List<ElectricityMeter> infoForRealTimeList = electricityBalanceOne.getData().getDatas();  
112 - for (ElectricityMeter electricityBalanceThree : infoForRealTimeList) {  
113 - if (electricityBalanceThree != null) {  
114 - return electricityBalanceThree;  
115 - }  
116 - }  
117 - }  
118 - return null;  
119 - } catch (Exception e) {  
120 - e.printStackTrace();  
121 - return null;  
122 - }  
123 - }  
124 -  
125 - public Map<String, Object> eeInfo(String deviceId) {  
126 - Map<String, Object> datas = new HashMap<>();  
127 - datas.put("deviceId", deviceId);  
128 - return datas;  
129 - }  
130 -  
131 -  
132 -}  
  1 +package com.sunyo.energy.location.utils;
  2 +
  3 +import org.apache.axiom.om.OMAbstractFactory;
  4 +import org.apache.axiom.om.OMElement;
  5 +import org.apache.axiom.om.OMFactory;
  6 +import org.apache.axiom.om.OMNamespace;
  7 +import org.apache.axis2.AxisFault;
  8 +import org.apache.axis2.addressing.EndpointReference;
  9 +import org.apache.axis2.client.Options;
  10 +import org.apache.axis2.client.ServiceClient;
  11 +import org.apache.commons.collections.map.HashedMap;
  12 +
  13 +import java.io.*;
  14 +import java.net.MalformedURLException;
  15 +import java.net.URL;
  16 +import java.net.URLConnection;
  17 +import java.net.URLEncoder;
  18 +import java.util.Map;
  19 +
  20 +/**
  21 + * @author shenhailong
  22 + * <p>
  23 + * 2020/7/21/17:34
  24 + */
  25 +public class CallWebServiceUtils {
  26 +
  27 + private static final String CorpID="HNJC002221";// 接口账号
  28 + private static final String Pwd="dxpt2221"; // 接口密码
  29 +
  30 +
  31 + public static void main(String[] args) throws MalformedURLException, UnsupportedEncodingException {
  32 + int i = sendSMSPost("17600319854", "短信提醒调用成功", "");
  33 + System.out.println(i);
  34 + }
  35 +
  36 + /**
  37 + * Hppt POST请求发送方法 返回值>0 为 提交成功
  38 + *
  39 + * @param Mobile
  40 + * 电话号码
  41 + * @param Content
  42 + * 发送内容
  43 + * @param send_time 参数格式例:20171222162230 ---代表2017年12月22日16点22分30秒
  44 + * 定时发送时间,为空时,为及时发送
  45 + * @return
  46 + * @throws MalformedURLException
  47 + * @throws UnsupportedEncodingException
  48 + */
  49 + public static int sendSMSPost(String Mobile, String Content,
  50 + String send_time) throws MalformedURLException,
  51 + UnsupportedEncodingException {
  52 + String inputLine = "";
  53 + int value = -2;
  54 + String send_content = URLEncoder.encode(
  55 + Content.replaceAll("<br/>", " "), "GBK");// 发送内容
  56 + String strUrl = "https://sdk2.028lk.com/sdk2/BatchSend2.aspx";
  57 + String param = "CorpID=" + CorpID + "&Pwd=" + Pwd + "&Mobile=" + Mobile
  58 + + "&Content=" + send_content + "&Cell=&SendTime=" + send_time;
  59 + try {
  60 + inputLine = sendPost(strUrl, param);
  61 + System.out.println("开始发送短信手机号码为 :" + Mobile);
  62 + value = new Integer(inputLine).intValue();
  63 + } catch (Exception e) {
  64 + System.out.println("网络异常,发送短信失败!");
  65 + value = -2;
  66 + }
  67 + System.out.println(String.format("返回值:%d", value));
  68 + return value;
  69 + }
  70 +
  71 + /**
  72 + * 向指定 URL 发送POST方法的请求
  73 + *
  74 + * @param url
  75 + * 发送请求的 URL
  76 + * @param param
  77 + * 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
  78 + * @return 所代表远程资源的响应结果
  79 + */
  80 + public static String sendPost(String url, String param) {
  81 + PrintWriter out = null;
  82 + BufferedReader in = null;
  83 + String result = "";
  84 + try {
  85 + URL realUrl = new URL(url);
  86 + // 打开和URL之间的连接
  87 + URLConnection conn = realUrl.openConnection();
  88 + // 设置通用的请求属性
  89 + conn.setRequestProperty("accept", "*/*");
  90 + conn.setRequestProperty("connection", "Keep-Alive");
  91 + conn.setRequestProperty("user-agent",
  92 + "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
  93 + // 发送POST请求必须设置如下两行
  94 + conn.setDoOutput(true);
  95 + conn.setDoInput(true);
  96 + // 获取URLConnection对象对应的输出流
  97 + out = new PrintWriter(conn.getOutputStream());
  98 + // 发送请求参数
  99 + out.print(param);
  100 + // flush输出流的缓冲
  101 + out.flush();
  102 + // 定义BufferedReader输入流来读取URL的响应
  103 + in = new BufferedReader(
  104 + new InputStreamReader(conn.getInputStream()));
  105 + String line;
  106 + while ((line = in.readLine()) != null) {
  107 + result += line;
  108 + }
  109 + } catch (Exception e) {
  110 + System.out.println("发送 POST 请求出现异常!" + e);
  111 + e.printStackTrace();
  112 + }
  113 + // 使用finally块来关闭输出流、输入流
  114 + finally {
  115 + try {
  116 + if (out != null) {
  117 + out.close();
  118 + }
  119 + if (in != null) {
  120 + in.close();
  121 + }
  122 + } catch (IOException ex) {
  123 + ex.printStackTrace();
  124 + }
  125 + }
  126 + return result;
  127 + }
  128 +
  129 +
  130 +
  131 +}
@@ -184,6 +184,8 @@ public class HttpsUtils { @@ -184,6 +184,8 @@ public class HttpsUtils {
184 // 打开URL连接 184 // 打开URL连接
185 java.net.HttpURLConnection httpConn = (java.net.HttpURLConnection) connURL 185 java.net.HttpURLConnection httpConn = (java.net.HttpURLConnection) connURL
186 .openConnection(); 186 .openConnection();
  187 + httpConn.setConnectTimeout(50000);
  188 + httpConn.setReadTimeout(50000);
187 // 设置通用属性 189 // 设置通用属性
188 httpConn.setRequestProperty("Accept", "*/*"); 190 httpConn.setRequestProperty("Accept", "*/*");
189 httpConn.setRequestProperty("Connection", "Keep-Alive"); 191 httpConn.setRequestProperty("Connection", "Keep-Alive");
  1 +package com.sunyo.energy.location.utils;
  2 +
  3 +import com.alibaba.fastjson.JSON;
  4 +import com.sunyo.energy.location.model.ElectricityBalanceOne;
  5 +import com.sunyo.energy.location.model.ElectricityMeter;
  6 +import org.springframework.beans.factory.annotation.Value;
  7 +import org.springframework.stereotype.Component;
  8 +
  9 +import java.math.BigDecimal;
  10 +import java.util.HashMap;
  11 +import java.util.List;
  12 +import java.util.Map;
  13 +
  14 +/**
  15 + * @author shenhailong
  16 + * <p>
  17 + * 处理水电一些逻辑判断
  18 + * 2020/7/21/15:13
  19 + */
  20 +@Component
  21 +public class WaterEleUtils {
  22 +
  23 + /**
  24 + * 查询实时余额
  25 + */
  26 + @Value("${eeUrl.electricityBanlanceUrl}")
  27 + private String electricityBanlanceUrl;
  28 +
  29 + /**
  30 + * 电表通知余额
  31 + */
  32 + @Value("${eeUrl.informMoney}")
  33 + private String informMoney;
  34 +
  35 + /**
  36 + * 实施获取电表数据
  37 + */
  38 + public ElectricityMeter getEnergyInfoForRealTime(String deviceId) {
  39 + try {
  40 + if (!"".equals(deviceId)) {
  41 + Map<String, Object> stringObjectMap = eeInfo(deviceId);
  42 + String infoForRealTime = HttpsUtils.sendPost(electricityBanlanceUrl, stringObjectMap);
  43 + ElectricityBalanceOne electricityBalanceOne = JSON.parseObject(infoForRealTime, ElectricityBalanceOne.class);
  44 + List<ElectricityMeter> infoForRealTimeList = electricityBalanceOne.getData().getDatas();
  45 + for (ElectricityMeter electricityBalanceThree : infoForRealTimeList) {
  46 + if (electricityBalanceThree != null) {
  47 + return electricityBalanceThree;
  48 + }
  49 + }
  50 + }
  51 + return null;
  52 + } catch (Exception e) {
  53 + e.printStackTrace();
  54 + return null;
  55 + }
  56 + }
  57 +
  58 +
  59 + public Map<String, Object> eeInfo(String deviceId) {
  60 + Map<String, Object> datas = new HashMap<>();
  61 + datas.put("deviceId", deviceId);
  62 + return datas;
  63 + }
  64 +
  65 + public boolean eleMoney(BigDecimal bigDecimal){
  66 + if (bigDecimal.compareTo(new BigDecimal(informMoney)) == -1){
  67 + return true;
  68 + }else {
  69 + return false;
  70 + }
  71 + }
  72 +
  73 +}
@@ -47,7 +47,7 @@ @@ -47,7 +47,7 @@
47 <property name="enableSubPackages" value="true"/> 47 <property name="enableSubPackages" value="true"/>
48 </javaClientGenerator> 48 </javaClientGenerator>
49 <!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名--> 49 <!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名-->
50 - <table tableName="electricity_info" domainObjectName="ElectricityInfo" enableCountByExample="false" 50 + <table tableName="inform_electricity" domainObjectName="InformElectricity" enableCountByExample="false"
51 enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" 51 enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false"
52 selectByExampleQueryId="true"></table> 52 selectByExampleQueryId="true"></table>
53 </context> 53 </context>
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" parameterType="string">  
28 - select  
29 - <include refid="Base_Column_List"/>  
30 - from electricity_info  
31 - where status = '1'  
32 - <if test="deviceId != null and deviceId != ''">  
33 - and device_id = #{deviceId, jdbcType=VARCHAR}  
34 - </if>  
35 - order by opert_time desc  
36 - </select>  
37 -  
38 - <delete id="deleteByPrimaryKey" parameterType="java.lang.String">  
39 - delete from electricity_info  
40 - where order_number = #{orderNumber,jdbcType=VARCHAR}  
41 - </delete>  
42 - <insert id="insert" parameterType="com.sunyo.energy.location.model.ElectricityInfo">  
43 - insert into electricity_info (order_number, action_type, device_id,  
44 - money, ip_address, secret,  
45 - status, opert_time, edit_time,  
46 - info_status)  
47 - values (#{orderNumber,jdbcType=VARCHAR}, #{actionType,jdbcType=VARCHAR}, #{deviceId,jdbcType=VARCHAR},  
48 - #{money,jdbcType=DECIMAL}, #{ipAddress,jdbcType=VARCHAR}, #{secret,jdbcType=VARCHAR},  
49 - #{status,jdbcType=VARCHAR}, #{opertTime,jdbcType=TIMESTAMP}, #{editTime,jdbcType=TIMESTAMP},  
50 - #{infoStatus,jdbcType=VARCHAR})  
51 - </insert>  
52 - <insert id="insertSelective" parameterType="com.sunyo.energy.location.model.ElectricityInfo">  
53 - insert into electricity_info  
54 - <trim prefix="(" suffix=")" suffixOverrides=",">  
55 - <if test="orderNumber != null">  
56 - order_number,  
57 - </if>  
58 - <if test="actionType != null">  
59 - action_type,  
60 - </if>  
61 - <if test="deviceId != null">  
62 - device_id,  
63 - </if>  
64 - <if test="money != null">  
65 - money,  
66 - </if>  
67 - <if test="ipAddress != null">  
68 - ip_address,  
69 - </if>  
70 - <if test="secret != null">  
71 - secret,  
72 - </if>  
73 - <if test="status != null">  
74 - status,  
75 - </if>  
76 - <if test="opertTime != null">  
77 - opert_time,  
78 - </if>  
79 - <if test="editTime != null">  
80 - edit_time,  
81 - </if>  
82 - <if test="infoStatus != null">  
83 - info_status,  
84 - </if>  
85 - </trim>  
86 - <trim prefix="values (" suffix=")" suffixOverrides=",">  
87 - <if test="orderNumber != null">  
88 - #{orderNumber,jdbcType=VARCHAR},  
89 - </if>  
90 - <if test="actionType != null">  
91 - #{actionType,jdbcType=VARCHAR},  
92 - </if>  
93 - <if test="deviceId != null">  
94 - #{deviceId,jdbcType=VARCHAR},  
95 - </if>  
96 - <if test="money != null">  
97 - #{money,jdbcType=DECIMAL},  
98 - </if>  
99 - <if test="ipAddress != null">  
100 - #{ipAddress,jdbcType=VARCHAR},  
101 - </if>  
102 - <if test="secret != null">  
103 - #{secret,jdbcType=VARCHAR},  
104 - </if>  
105 - <if test="status != null">  
106 - #{status,jdbcType=VARCHAR},  
107 - </if>  
108 - <if test="opertTime != null">  
109 - #{opertTime,jdbcType=TIMESTAMP},  
110 - </if>  
111 - <if test="editTime != null">  
112 - #{editTime,jdbcType=TIMESTAMP},  
113 - </if>  
114 - <if test="infoStatus != null">  
115 - #{infoStatus,jdbcType=VARCHAR},  
116 - </if>  
117 - </trim>  
118 - </insert>  
119 - <update id="updateByPrimaryKeySelective" parameterType="com.sunyo.energy.location.model.ElectricityInfo">  
120 - update electricity_info  
121 - <set>  
122 - <if test="actionType != null">  
123 - action_type = #{actionType,jdbcType=VARCHAR},  
124 - </if>  
125 - <if test="deviceId != null">  
126 - device_id = #{deviceId,jdbcType=VARCHAR},  
127 - </if>  
128 - <if test="money != null">  
129 - money = #{money,jdbcType=DECIMAL},  
130 - </if>  
131 - <if test="ipAddress != null">  
132 - ip_address = #{ipAddress,jdbcType=VARCHAR},  
133 - </if>  
134 - <if test="secret != null">  
135 - secret = #{secret,jdbcType=VARCHAR},  
136 - </if>  
137 - <if test="status != null">  
138 - status = #{status,jdbcType=VARCHAR},  
139 - </if>  
140 - <if test="opertTime != null">  
141 - opert_time = #{opertTime,jdbcType=TIMESTAMP},  
142 - </if>  
143 - <if test="editTime != null">  
144 - edit_time = #{editTime,jdbcType=TIMESTAMP},  
145 - </if>  
146 - <if test="infoStatus != null">  
147 - info_status = #{infoStatus,jdbcType=VARCHAR},  
148 - </if>  
149 - </set>  
150 - where order_number = #{orderNumber,jdbcType=VARCHAR}  
151 - </update>  
152 - <update id="updateByPrimaryKey" parameterType="com.sunyo.energy.location.model.ElectricityInfo">  
153 - update electricity_info  
154 - set action_type = #{actionType,jdbcType=VARCHAR},  
155 - device_id = #{deviceId,jdbcType=VARCHAR},  
156 - money = #{money,jdbcType=DECIMAL},  
157 - ip_address = #{ipAddress,jdbcType=VARCHAR},  
158 - secret = #{secret,jdbcType=VARCHAR},  
159 - status = #{status,jdbcType=VARCHAR},  
160 - opert_time = #{opertTime,jdbcType=TIMESTAMP},  
161 - edit_time = #{editTime,jdbcType=TIMESTAMP},  
162 - info_status = #{infoStatus,jdbcType=VARCHAR}  
163 - where order_number = #{orderNumber,jdbcType=VARCHAR}  
164 - </update>  
165 -</mapper>  
  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.InformElectricityMapper" >
  4 + <resultMap id="BaseResultMap" type="com.sunyo.energy.location.model.InformElectricity" >
  5 + <result column="inform_money" property="informMoney" jdbcType="VARCHAR" />
  6 + <result column="inform_phone" property="informPhone" jdbcType="VARCHAR" />
  7 + <result column="room_name" property="roomName" jdbcType="VARCHAR" />
  8 + <result column="ee_id" property="eeId" jdbcType="VARCHAR" />
  9 + <result column="id" property="id" jdbcType="INTEGER" />
  10 + </resultMap>
  11 +
  12 + <select id="selectAll" resultMap="BaseResultMap">
  13 + select * from inform_electricity
  14 + </select>
  15 +
  16 + <insert id="insert" parameterType="com.sunyo.energy.location.model.InformElectricity" >
  17 + insert into inform_electricity (inform_money, inform_phone, room_name,
  18 + ee_id, id)
  19 + values (#{informMoney,jdbcType=VARCHAR}, #{informPhone,jdbcType=VARCHAR}, #{roomName,jdbcType=VARCHAR},
  20 + #{eeId,jdbcType=VARCHAR}, #{id,jdbcType=INTEGER})
  21 + </insert>
  22 + <insert id="insertSelective" parameterType="com.sunyo.energy.location.model.InformElectricity" >
  23 + insert into inform_electricity
  24 + <trim prefix="(" suffix=")" suffixOverrides="," >
  25 + <if test="informMoney != null" >
  26 + inform_money,
  27 + </if>
  28 + <if test="informPhone != null" >
  29 + inform_phone,
  30 + </if>
  31 + <if test="roomName != null" >
  32 + room_name,
  33 + </if>
  34 + <if test="eeId != null" >
  35 + ee_id,
  36 + </if>
  37 + <if test="id != null" >
  38 + id,
  39 + </if>
  40 + </trim>
  41 + <trim prefix="values (" suffix=")" suffixOverrides="," >
  42 + <if test="informMoney != null" >
  43 + #{informMoney,jdbcType=VARCHAR},
  44 + </if>
  45 + <if test="informPhone != null" >
  46 + #{informPhone,jdbcType=VARCHAR},
  47 + </if>
  48 + <if test="roomName != null" >
  49 + #{roomName,jdbcType=VARCHAR},
  50 + </if>
  51 + <if test="eeId != null" >
  52 + #{eeId,jdbcType=VARCHAR},
  53 + </if>
  54 + <if test="id != null" >
  55 + #{id,jdbcType=INTEGER},
  56 + </if>
  57 + </trim>
  58 + </insert>
  59 +</mapper>
  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.LocationUsersMapper" >
  4 + <resultMap id="BaseResultMap" type="com.sunyo.energy.location.model.LocationUsers" >
  5 + <result column="username" property="username" jdbcType="VARCHAR" />
  6 + <result column="phone" property="phone" jdbcType="VARCHAR" />
  7 + <result column="wmId" property="wmid" jdbcType="VARCHAR" />
  8 + <result column="eeId" property="eeid" jdbcType="VARCHAR" />
  9 + </resultMap>
  10 +
  11 + <select id="selectAll" resultMap="BaseResultMap">
  12 + select
  13 + *
  14 + from
  15 + location_users
  16 + </select>
  17 +
  18 + <insert id="insert" parameterType="com.sunyo.energy.location.model.LocationUsers" >
  19 + insert into location_users (username, phone, wmId,
  20 + eeId)
  21 + values (#{username,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, #{wmid,jdbcType=VARCHAR},
  22 + #{eeid,jdbcType=VARCHAR})
  23 + </insert>
  24 + <insert id="insertSelective" parameterType="com.sunyo.energy.location.model.LocationUsers" >
  25 + insert into location_users
  26 + <trim prefix="(" suffix=")" suffixOverrides="," >
  27 + <if test="username != null" >
  28 + username,
  29 + </if>
  30 + <if test="phone != null" >
  31 + phone,
  32 + </if>
  33 + <if test="wmid != null" >
  34 + wmId,
  35 + </if>
  36 + <if test="eeid != null" >
  37 + eeId,
  38 + </if>
  39 + </trim>
  40 + <trim prefix="values (" suffix=")" suffixOverrides="," >
  41 + <if test="username != null" >
  42 + #{username,jdbcType=VARCHAR},
  43 + </if>
  44 + <if test="phone != null" >
  45 + #{phone,jdbcType=VARCHAR},
  46 + </if>
  47 + <if test="wmid != null" >
  48 + #{wmid,jdbcType=VARCHAR},
  49 + </if>
  50 + <if test="eeid != null" >
  51 + #{eeid,jdbcType=VARCHAR},
  52 + </if>
  53 + </trim>
  54 + </insert>
  55 +</mapper>
  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.NoteInformMapper" >
  4 + <resultMap id="BaseResultMap" type="com.sunyo.energy.location.model.NoteInform" >
  5 + <id column="id" property="id" jdbcType="INTEGER" />
  6 + <result column="room_name" property="roomName" jdbcType="VARCHAR" />
  7 + <result column="water_ele_type" property="waterEleType" jdbcType="VARCHAR" />
  8 + <result column="inform_money" property="informMoney" jdbcType="VARCHAR" />
  9 + <result column="inform_status" property="informStatus" jdbcType="VARCHAR" />
  10 + <result column="inform_phone" property="informPhone" jdbcType="VARCHAR" />
  11 + <result column="inform_date" property="informDate" jdbcType="TIMESTAMP" />
  12 + <result column="status" property="status" jdbcType="VARCHAR" />
  13 + </resultMap>
  14 + <sql id="Base_Column_List" >
  15 + id, room_name, water_ele_type, inform_money, inform_status, inform_phone, inform_date,
  16 + status
  17 + </sql>
  18 + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  19 + select
  20 + <include refid="Base_Column_List" />
  21 + from note_inform
  22 + where id = #{id,jdbcType=INTEGER}
  23 + </select>
  24 + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  25 + delete from note_inform
  26 + where id = #{id,jdbcType=INTEGER}
  27 + </delete>
  28 + <insert id="insert" parameterType="com.sunyo.energy.location.model.NoteInform" >
  29 + insert into note_inform (id, room_name, water_ele_type,
  30 + inform_money, inform_status, inform_phone,
  31 + inform_date, status)
  32 + values (#{id,jdbcType=INTEGER}, #{roomName,jdbcType=VARCHAR}, #{waterEleType,jdbcType=VARCHAR},
  33 + #{informMoney,jdbcType=VARCHAR}, #{informStatus,jdbcType=VARCHAR}, #{informPhone,jdbcType=VARCHAR},
  34 + #{informDate,jdbcType=TIMESTAMP}, #{status,jdbcType=VARCHAR})
  35 + </insert>
  36 + <insert id="insertSelective" parameterType="com.sunyo.energy.location.model.NoteInform" >
  37 + insert into note_inform
  38 + <trim prefix="(" suffix=")" suffixOverrides="," >
  39 + <if test="id != null" >
  40 + id,
  41 + </if>
  42 + <if test="roomName != null" >
  43 + room_name,
  44 + </if>
  45 + <if test="waterEleType != null" >
  46 + water_ele_type,
  47 + </if>
  48 + <if test="informMoney != null" >
  49 + inform_money,
  50 + </if>
  51 + <if test="informStatus != null" >
  52 + inform_status,
  53 + </if>
  54 + <if test="informPhone != null" >
  55 + inform_phone,
  56 + </if>
  57 + <if test="informDate != null" >
  58 + inform_date,
  59 + </if>
  60 + <if test="status != null" >
  61 + status,
  62 + </if>
  63 + </trim>
  64 + <trim prefix="values (" suffix=")" suffixOverrides="," >
  65 + <if test="id != null" >
  66 + #{id,jdbcType=INTEGER},
  67 + </if>
  68 + <if test="roomName != null" >
  69 + #{roomName,jdbcType=VARCHAR},
  70 + </if>
  71 + <if test="waterEleType != null" >
  72 + #{waterEleType,jdbcType=VARCHAR},
  73 + </if>
  74 + <if test="informMoney != null" >
  75 + #{informMoney,jdbcType=VARCHAR},
  76 + </if>
  77 + <if test="informStatus != null" >
  78 + #{informStatus,jdbcType=VARCHAR},
  79 + </if>
  80 + <if test="informPhone != null" >
  81 + #{informPhone,jdbcType=VARCHAR},
  82 + </if>
  83 + <if test="informDate != null" >
  84 + #{informDate,jdbcType=TIMESTAMP},
  85 + </if>
  86 + <if test="status != null" >
  87 + #{status,jdbcType=VARCHAR},
  88 + </if>
  89 + </trim>
  90 + </insert>
  91 + <update id="updateByPrimaryKeySelective" parameterType="com.sunyo.energy.location.model.NoteInform" >
  92 + update note_inform
  93 + <set >
  94 + <if test="roomName != null" >
  95 + room_name = #{roomName,jdbcType=VARCHAR},
  96 + </if>
  97 + <if test="waterEleType != null" >
  98 + water_ele_type = #{waterEleType,jdbcType=VARCHAR},
  99 + </if>
  100 + <if test="informMoney != null" >
  101 + inform_money = #{informMoney,jdbcType=VARCHAR},
  102 + </if>
  103 + <if test="informStatus != null" >
  104 + inform_status = #{informStatus,jdbcType=VARCHAR},
  105 + </if>
  106 + <if test="informPhone != null" >
  107 + inform_phone = #{informPhone,jdbcType=VARCHAR},
  108 + </if>
  109 + <if test="informDate != null" >
  110 + inform_date = #{informDate,jdbcType=TIMESTAMP},
  111 + </if>
  112 + <if test="status != null" >
  113 + status = #{status,jdbcType=VARCHAR},
  114 + </if>
  115 + </set>
  116 + where id = #{id,jdbcType=INTEGER}
  117 + </update>
  118 + <update id="updateByPrimaryKey" parameterType="com.sunyo.energy.location.model.NoteInform" >
  119 + update note_inform
  120 + set room_name = #{roomName,jdbcType=VARCHAR},
  121 + water_ele_type = #{waterEleType,jdbcType=VARCHAR},
  122 + inform_money = #{informMoney,jdbcType=VARCHAR},
  123 + inform_status = #{informStatus,jdbcType=VARCHAR},
  124 + inform_phone = #{informPhone,jdbcType=VARCHAR},
  125 + inform_date = #{informDate,jdbcType=TIMESTAMP},
  126 + status = #{status,jdbcType=VARCHAR}
  127 + where id = #{id,jdbcType=INTEGER}
  128 + </update>
  129 +</mapper>
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.PayRecordsMapper">  
4 - <resultMap id="BaseResultMap" type="com.sunyo.energy.location.model.PayRecords">  
5 - <id column="id" property="id" jdbcType="INTEGER"/>  
6 - <result column="payFees" property="payfees" jdbcType="DECIMAL"/>  
7 - <result column="payUserId" property="payuserid" jdbcType="INTEGER"/>  
8 - <result column="payTime" property="paytime" jdbcType="TIMESTAMP"/>  
9 - <result column="payLocationId" property="paylocationid" jdbcType="INTEGER"/>  
10 - <result column="payStatus" property="paystatus" jdbcType="BIT"/>  
11 - <result column="payType" property="paytype" jdbcType="BIT"/>  
12 - <result column="payFessType" property="payfesstype" jdbcType="BIT"/>  
13 - <result column="orderNumber" property="ordernumber" jdbcType="VARCHAR"/>  
14 - <result column="reamke1" property="reamke1" jdbcType="VARCHAR"/>  
15 - <result column="reamke2" property="reamke2" jdbcType="VARCHAR"/>  
16 - <result column="reamke3" property="reamke3" jdbcType="VARCHAR"/>  
17 - <result column="reamke4" property="reamke4" jdbcType="VARCHAR"/>  
18 - <result column="payUserName" property="payusername" jdbcType="VARCHAR"/>  
19 - <result column="payLocationName" property="paylocationname" jdbcType="VARCHAR"/>  
20 - <result column="payTypeAddress" property="paytypeaddress" jdbcType="VARCHAR"/>  
21 - </resultMap>  
22 - <sql id="Base_Column_List">  
23 - id, payFees, payUserId, payTime, payLocationId, payStatus, payType, payFessType,  
24 - orderNumber, reamke1, reamke2, reamke3, reamke4, payUserName, payLocationName, payTypeAddress  
25 - </sql>  
26 - <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">  
27 - select  
28 - <include refid="Base_Column_List"/>  
29 - from pay_records  
30 - where id = #{id,jdbcType=INTEGER}  
31 - </select>  
32 -  
33 - <select id="findAll" resultMap="BaseResultMap">  
34 - select  
35 - <include refid="Base_Column_List"/>  
36 - from pay_records  
37 - where reamke1 = '0'  
38 - <if test="orderNumber != '' and orderNumber != null">  
39 - and orderNumber = #{orderNumber,jdbcType=VARCHAR}  
40 - </if>  
41 - <if test="startTime != '' and startTime != null">  
42 - and payTime &gt; #{startTime,jdbcType=VARCHAR}  
43 - </if>  
44 - <if test="endTime != '' and endTime != null">  
45 - and payTime &lt; #{endTime,jdbcType=VARCHAR}  
46 - </if>  
47 - <if test="username != '' and username != null">  
48 - and payLocationName = #{username,jdbcType=VARCHAR}  
49 - </if>  
50 - <if test="payType != '' and payType != null">  
51 - and payType = #{payType, jdbcType=BIT}  
52 - </if>  
53 - order by payTime desc  
54 - </select>  
55 -  
56 - <select id="findOrderNumber" parameterType="string" resultType="string">  
57 - select distinct payTypeAddress from pay_records where orderNumber = #{value, jdbcType=VARCHAR}  
58 - </select>  
59 -  
60 - <select id="selectType" parameterType="string" resultType="boolean">  
61 - select distinct payType from pay_records where orderNumber = #{value, jdbcType=VARCHAR}  
62 - </select>  
63 -  
64 - <update id="deleteByPrimaryKey" parameterType="java.lang.Integer">  
65 - UPDATE pay_records  
66 - SET reamke1 = '1'  
67 - where id = #{id,jdbcType=INTEGER}  
68 - </update>  
69 -  
70 - <update id="updateStatus" parameterType="string">  
71 - update pay_records  
72 - set reamke3 = 1  
73 - where orderNumber = #{value, jdbcType=VARCHAR}  
74 - </update>  
75 -  
76 - <insert id="insert" parameterType="com.sunyo.energy.location.model.PayRecords">  
77 - insert into pay_records (id, payFees, payUserId,  
78 - payTime, payLocationId, payStatus,  
79 - payType, payFessType, orderNumber,  
80 - reamke1, reamke2, reamke3,  
81 - reamke4, payUserName, payLocationName,  
82 - payTypeAddress)  
83 - values (#{id,jdbcType=INTEGER}, #{payfees,jdbcType=DECIMAL}, #{payuserid,jdbcType=INTEGER},  
84 - #{paytime,jdbcType=TIMESTAMP}, #{paylocationid,jdbcType=INTEGER}, #{paystatus,jdbcType=BIT},  
85 - #{paytype,jdbcType=BIT}, #{payfesstype,jdbcType=BIT}, #{ordernumber,jdbcType=VARCHAR},  
86 - #{reamke1,jdbcType=VARCHAR}, #{reamke2,jdbcType=VARCHAR}, #{reamke3,jdbcType=VARCHAR},  
87 - #{reamke4,jdbcType=VARCHAR}, #{payusername,jdbcType=VARCHAR}, #{paylocationname,jdbcType=VARCHAR},  
88 - #{paytypeaddress,jdbcType=VARCHAR})  
89 - </insert>  
90 - <insert id="insertSelective" parameterType="com.sunyo.energy.location.model.PayRecords">  
91 - insert into pay_records  
92 - <trim prefix="(" suffix=")" suffixOverrides=",">  
93 - <if test="id != null">  
94 - id,  
95 - </if>  
96 - <if test="payfees != null">  
97 - payFees,  
98 - </if>  
99 - <if test="payuserid != null">  
100 - payUserId,  
101 - </if>  
102 - <if test="paytime != null">  
103 - payTime,  
104 - </if>  
105 - <if test="paylocationid != null">  
106 - payLocationId,  
107 - </if>  
108 - <if test="paystatus != null">  
109 - payStatus,  
110 - </if>  
111 - <if test="paytype != null">  
112 - payType,  
113 - </if>  
114 - <if test="payfesstype != null">  
115 - payFessType,  
116 - </if>  
117 - <if test="ordernumber != null">  
118 - orderNumber,  
119 - </if>  
120 - <if test="reamke1 != null">  
121 - reamke1,  
122 - </if>  
123 - <if test="reamke2 != null">  
124 - reamke2,  
125 - </if>  
126 - <if test="reamke3 != null">  
127 - reamke3,  
128 - </if>  
129 - <if test="reamke4 != null">  
130 - reamke4,  
131 - </if>  
132 - <if test="payusername != null">  
133 - payUserName,  
134 - </if>  
135 - <if test="paylocationname != null">  
136 - payLocationName,  
137 - </if>  
138 - <if test="paytypeaddress != null">  
139 - payTypeAddress,  
140 - </if>  
141 - </trim>  
142 - <trim prefix="values (" suffix=")" suffixOverrides=",">  
143 - <if test="id != null">  
144 - #{id,jdbcType=INTEGER},  
145 - </if>  
146 - <if test="payfees != null">  
147 - #{payfees,jdbcType=DECIMAL},  
148 - </if>  
149 - <if test="payuserid != null">  
150 - #{payuserid,jdbcType=INTEGER},  
151 - </if>  
152 - <if test="paytime != null">  
153 - #{paytime,jdbcType=TIMESTAMP},  
154 - </if>  
155 - <if test="paylocationid != null">  
156 - #{paylocationid,jdbcType=INTEGER},  
157 - </if>  
158 - <if test="paystatus != null">  
159 - #{paystatus,jdbcType=BIT},  
160 - </if>  
161 - <if test="paytype != null">  
162 - #{paytype,jdbcType=BIT},  
163 - </if>  
164 - <if test="payfesstype != null">  
165 - #{payfesstype,jdbcType=BIT},  
166 - </if>  
167 - <if test="ordernumber != null">  
168 - #{ordernumber,jdbcType=VARCHAR},  
169 - </if>  
170 - <if test="reamke1 != null">  
171 - #{reamke1,jdbcType=VARCHAR},  
172 - </if>  
173 - <if test="reamke2 != null">  
174 - #{reamke2,jdbcType=VARCHAR},  
175 - </if>  
176 - <if test="reamke3 != null">  
177 - #{reamke3,jdbcType=VARCHAR},  
178 - </if>  
179 - <if test="reamke4 != null">  
180 - #{reamke4,jdbcType=VARCHAR},  
181 - </if>  
182 - <if test="payusername != null">  
183 - #{payusername,jdbcType=VARCHAR},  
184 - </if>  
185 - <if test="paylocationname != null">  
186 - #{paylocationname,jdbcType=VARCHAR},  
187 - </if>  
188 - <if test="paytypeaddress != null">  
189 - #{paytypeaddress,jdbcType=VARCHAR},  
190 - </if>  
191 - </trim>  
192 - </insert>  
193 - <update id="updateByPrimaryKeySelective" parameterType="com.sunyo.energy.location.model.PayRecords">  
194 - update pay_records  
195 - <set>  
196 - <if test="payfees != null">  
197 - payFees = #{payfees,jdbcType=DECIMAL},  
198 - </if>  
199 - <if test="payuserid != null">  
200 - payUserId = #{payuserid,jdbcType=INTEGER},  
201 - </if>  
202 - <if test="paytime != null">  
203 - payTime = #{paytime,jdbcType=TIMESTAMP},  
204 - </if>  
205 - <if test="paylocationid != null">  
206 - payLocationId = #{paylocationid,jdbcType=INTEGER},  
207 - </if>  
208 - <if test="paystatus != null">  
209 - payStatus = #{paystatus,jdbcType=BIT},  
210 - </if>  
211 - <if test="paytype != null">  
212 - payType = #{paytype,jdbcType=BIT},  
213 - </if>  
214 - <if test="payfesstype != null">  
215 - payFessType = #{payfesstype,jdbcType=BIT},  
216 - </if>  
217 - <if test="ordernumber != null">  
218 - orderNumber = #{ordernumber,jdbcType=VARCHAR},  
219 - </if>  
220 - <if test="reamke1 != null">  
221 - reamke1 = #{reamke1,jdbcType=VARCHAR},  
222 - </if>  
223 - <if test="reamke2 != null">  
224 - reamke2 = #{reamke2,jdbcType=VARCHAR},  
225 - </if>  
226 - <if test="reamke3 != null">  
227 - reamke3 = #{reamke3,jdbcType=VARCHAR},  
228 - </if>  
229 - <if test="reamke4 != null">  
230 - reamke4 = #{reamke4,jdbcType=VARCHAR},  
231 - </if>  
232 - <if test="payusername != null">  
233 - payUserName = #{payusername,jdbcType=VARCHAR},  
234 - </if>  
235 - <if test="paylocationname != null">  
236 - payLocationName = #{paylocationname,jdbcType=VARCHAR},  
237 - </if>  
238 - <if test="paytypeaddress != null">  
239 - payTypeAddress = #{paytypeaddress,jdbcType=VARCHAR},  
240 - </if>  
241 - </set>  
242 - where id = #{id,jdbcType=INTEGER}  
243 - </update>  
244 - <!-- <update id="updateByPrimaryKey" parameterType="com.sunyo.energy.location.model.PayRecords" >-->  
245 - <!-- update pay_records-->  
246 - <!-- set payFees = #{payfees,jdbcType=DECIMAL},-->  
247 - <!-- payUserId = #{payuserid,jdbcType=INTEGER},-->  
248 - <!-- payTime = #{paytime,jdbcType=TIMESTAMP},-->  
249 - <!-- payLocationId = #{paylocationid,jdbcType=INTEGER},-->  
250 - <!-- payStatus = #{paystatus,jdbcType=BIT},-->  
251 - <!-- payType = #{paytype,jdbcType=BIT},-->  
252 - <!-- payFessType = #{payfesstype,jdbcType=BIT},-->  
253 - <!-- orderNumber = #{ordernumber,jdbcType=VARCHAR},-->  
254 - <!-- reamke1 = #{reamke1,jdbcType=VARCHAR},-->  
255 - <!-- reamke2 = #{reamke2,jdbcType=VARCHAR},-->  
256 - <!-- reamke3 = #{reamke3,jdbcType=VARCHAR},-->  
257 - <!-- reamke4 = #{reamke4,jdbcType=VARCHAR},-->  
258 - <!-- payUserName = #{payusername,jdbcType=VARCHAR},-->  
259 - <!-- payLocationName = #{paylocationname,jdbcType=VARCHAR},-->  
260 - <!-- payTypeAddress = #{paytypeaddress,jdbcType=VARCHAR}-->  
261 - <!-- where id = #{id,jdbcType=INTEGER}-->  
262 - <!-- </update>-->  
263 - <update id="updateByPrimaryKey" parameterType="com.sunyo.energy.location.model.PayRecords">  
264 - update pay_records  
265 - set  
266 - reamke3 = #{reamke3,jdbcType=VARCHAR},  
267 - payFessType = #{payfesstype,jdbcType=BIT}  
268 - where orderNumber = #{ordernumber,jdbcType=VARCHAR}  
269 -  
270 - </update>  
271 -</mapper>